From patchwork Wed Sep 12 11:47:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1443251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 19D063FE79 for ; Wed, 12 Sep 2012 11:58:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBlQw-0006oQ-Eu; Wed, 12 Sep 2012 11:48:43 +0000 Received: from na3sys009aog119.obsmtp.com ([74.125.149.246]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TBlPW-0006Px-8I for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2012 11:47:15 +0000 Received: from mail-ob0-f177.google.com ([209.85.214.177]) (using TLSv1) by na3sys009aob119.postini.com ([74.125.148.12]) with SMTP ID DSNKUFB2QFQkGHUP0oRfCbLBWtbbCxA84+92@postini.com; Wed, 12 Sep 2012 04:47:14 PDT Received: by obbta17 with SMTP id ta17so2565358obb.36 for ; Wed, 12 Sep 2012 04:47:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=RxbDMYaOSfPzYqp6xnLBV/2Ieon97qouaztptGRp9io=; b=cGRaJnFcqp9KBmTq4u30qRwtIz7bLtYOoslt1d2BVEOx3pBetw+pMEtZv/BZL7KO07 a5DP2GEupkWXXR/yEk6CqcLeJ+0k3GB4uF8mXdQrjV3rSncar5vgerH+C0b0IzGVELWW Op90xpZSkwyd+cuVLSVGW6uFO+b7sWztsF3AGWPH1eg33Y0A88YTyMk2AELxIo/0bJhq w3Dq81R2g0obF3PATfDWWKYo6vWV86NdgLYL/8hYJy0+qd94mXOpuN1bwEU0PMoOEXuW 3AqrZs19jRG6y6rLpMfYlkzLPS5sl9emvR5cry7BWhaBYMMo+jJ4d+oMk+T5GyiyiDag gf8Q== Received: by 10.182.139.99 with SMTP id qx3mr21591770obb.102.1347450432179; Wed, 12 Sep 2012 04:47:12 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id c6sm19835570obd.22.2012.09.12.04.47.09 (version=SSLv3 cipher=OTHER); Wed, 12 Sep 2012 04:47:11 -0700 (PDT) From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Tony Lindgren , Russell King , Vinod Koul , Dan Williams , Jarkko Nikula Subject: [PATCH 10/11] ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup time Date: Wed, 12 Sep 2012 14:47:06 +0300 Message-Id: <1347450427-27627-11-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347450427-27627-1-git-send-email-peter.ujfalusi@ti.com> References: <1347450427-27627-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQkd+uh2CTgnVmDm92j9Mv/77VzM7EiRZhxdXZKwkf+/tcIOqLnji8E5n9RCXM7qiOQKsyfY X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.246 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: alsa-devel@alsa-project.org, Janusz Krzysztofik , Ricardo Neri , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Set the dma_data for the stream (snd_soc_dai_set_dma_data) at dai_startup time so omap-pcm will have access to the needed information regarding to the DMA channel earlier. This is needed for the clean dmaengine support. Signed-off-by: Peter Ujfalusi --- sound/soc/omap/omap-dmic.c | 6 ++++-- sound/soc/omap/omap-hdmi.c | 15 +++++++++------ sound/soc/omap/omap-mcbsp.c | 7 ++++--- sound/soc/omap/omap-mcpdm.c | 8 ++++---- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index df0ff24..68f2cd1 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -118,6 +118,7 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream, mutex_unlock(&dmic->mutex); + snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params); return ret; } @@ -202,6 +203,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + struct omap_pcm_dma_data *dma_data; int channels; dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params)); @@ -227,8 +229,8 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, } /* packet size is threshold * channels */ - omap_dmic_dai_dma_params.packet_size = dmic->threshold * channels; - snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params); + dma_data = snd_soc_dai_get_dma_data(dai, substream); + dma_data->packet_size = dmic->threshold * channels; return 0; } diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 0951767..f59c69f 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -67,6 +67,9 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, dev_err(dai->dev, "audio not supported\n"); return -ENODEV; } + + snd_soc_dai_set_dma_data(dai, substream, &priv->dma_params); + return 0; } @@ -85,24 +88,24 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); struct snd_aes_iec958 *iec = &priv->iec; struct snd_cea_861_aud_if *cea = &priv->cea; + struct omap_pcm_dma_data *dma_data; int err = 0; + dma_data = snd_soc_dai_get_dma_data(dai, substream); + switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: - priv->dma_params.packet_size = 16; + dma_data->packet_size = 16; break; case SNDRV_PCM_FORMAT_S24_LE: - priv->dma_params.packet_size = 32; + dma_data->packet_size = 32; break; default: dev_err(dai->dev, "format not supported!\n"); return -EINVAL; } - priv->dma_params.data_type = 32; - - snd_soc_dai_set_dma_data(dai, substream, - &priv->dma_params); + dma_data->data_type = 32; /* * fill the IEC-60958 channel status word diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index a230646..fef2f59 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -151,6 +151,9 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); } + snd_soc_dai_set_dma_data(cpu_dai, substream, + &mcbsp->dma_data[substream->stream]); + return err; } @@ -228,7 +231,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, int pkt_size = 0; unsigned int format, div, framesize, master; - dma_data = &mcbsp->dma_data[substream->stream]; + dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); channels = params_channels(params); switch (params_format(params)) { @@ -277,8 +280,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, dma_data->packet_size = pkt_size; - snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); - if (mcbsp->configured) { /* McBSP already configured by another stream */ return 0; diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index c1b4935..060cd16 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -266,9 +266,11 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, } omap_mcpdm_open_streams(mcpdm); } - mutex_unlock(&mcpdm->mutex); + snd_soc_dai_set_dma_data(dai, substream, + &omap_mcpdm_dai_dma_params[substream->stream]); + return 0; } @@ -323,7 +325,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - dma_data = &omap_mcpdm_dai_dma_params[stream]; + dma_data = snd_soc_dai_get_dma_data(dai, substream); /* Configure McPDM channels, and DMA packet size */ if (stream == SNDRV_PCM_STREAM_PLAYBACK) { @@ -335,8 +337,6 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, dma_data->packet_size = mcpdm->up_threshold * channels; } - snd_soc_dai_set_dma_data(dai, substream, dma_data); - return 0; }