From patchwork Fri Aug 31 12:50:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hebbar, Gururaja" X-Patchwork-Id: 1393181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 979AFE0000 for ; Fri, 31 Aug 2012 13:12:12 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T7Qy9-0008Rv-Oh; Fri, 31 Aug 2012 13:09:05 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T7Qy6-0008QT-0a for linux-arm-kernel@lists.infradead.org; Fri, 31 Aug 2012 13:09:03 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q7VD8uGd000731; Fri, 31 Aug 2012 08:08:57 -0500 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7VD8oZ3007767; Fri, 31 Aug 2012 18:38:53 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Fri, 31 Aug 2012 18:38:50 +0530 Received: from ucmsshproxy.india.ext.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with SMTP id q7VD8kC3031029; Fri, 31 Aug 2012 18:38:46 +0530 Received: from symphony.india.ext.ti.com (unknown [192.168.247.13]) by ucmsshproxy.india.ext.ti.com (Postfix) with ESMTP id 56030158004; Fri, 31 Aug 2012 18:38:46 +0530 (IST) Received: from linux-psp-server.india.ext.ti.com (linux-psp-server [192.168.247.76]) by symphony.india.ext.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id q7VD8jI00608; Fri, 31 Aug 2012 18:38:45 +0530 (IST) From: "Hebbar, Gururaja" To: , , Subject: [PATCH 2/3] ASoC: Davinci: pcm: add support for sram-support-less platforms Date: Fri, 31 Aug 2012 18:20:58 +0530 Message-ID: <1346417459-30042-3-git-send-email-gururaja.hebbar@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1346417459-30042-1-git-send-email-gururaja.hebbar@ti.com> References: <1346417459-30042-1-git-send-email-gururaja.hebbar@ti.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.1 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: sudhakar.raj@ti.com, tony@atomide.com, broonie@opensource.wolfsonmicro.com, nsekhar@ti.com, gururaja.hebbar@ti.com, lrg@ti.com 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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org OMAP2+ platforms (like TI81xx, AM33xx) uses davinci-pcm driver. SRAM is not needed/used in EDMA transfers for audio on such platforms. However they do not provide generic SRAM APIs (sram_alloc() and sram_free()). In such cases the pcm driver cannot be used directly as it results in compilation failure on OMAP2 platforms. Fix this by providing a config option to indicate missing SRAM API support. This config is enabled by default on Davinci platform so as to not break existing platforms. For OMAP2+ platforms, the config is disabled. Signed-off-by: Hebbar, Gururaja --- :100644 100644 9e11a14... 328b463... M sound/soc/davinci/Kconfig :100644 100644 93ea3bf... 7ac5a19... M sound/soc/davinci/davinci-pcm.c sound/soc/davinci/Kconfig | 5 +++++ sound/soc/davinci/davinci-pcm.c | 8 ++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index 9e11a14..328b463 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig @@ -15,6 +15,11 @@ config SND_DAVINCI_SOC_MCASP config SND_DAVINCI_SOC_VCIF tristate +config SND_DAVINCI_HAVE_SRAM + bool + default y if ARCH_DAVINCI=y + default n if ARCH_OMAP=y + config SND_DAVINCI_SOC_EVM tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM" depends on SND_DAVINCI_SOC diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 93ea3bf..7ac5a19 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -23,7 +23,9 @@ #include #include +#if defined(CONFIG_SND_DAVINCI_HAVE_SRAM) #include +#endif #include "davinci-pcm.h" @@ -259,6 +261,7 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data) } } +#if defined(CONFIG_SND_DAVINCI_HAVE_SRAM) static int allocate_sram(struct snd_pcm_substream *substream, unsigned size, struct snd_pcm_hardware *ppcm) { @@ -289,6 +292,7 @@ exit2: exit1: return -ENOMEM; } +#endif /* * Only used with ping/pong. @@ -676,7 +680,9 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream) ppcm = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? &pcm_hardware_playback : &pcm_hardware_capture; +#if defined(CONFIG_SND_DAVINCI_HAVE_SRAM) allocate_sram(substream, params->sram_size, ppcm); +#endif snd_soc_set_runtime_hwparams(substream, ppcm); /* ensure that buffer size is a multiple of period size */ ret = snd_pcm_hw_constraint_integer(runtime, @@ -817,11 +823,13 @@ static void davinci_pcm_free(struct snd_pcm *pcm) dma_free_writecombine(pcm->card->dev, buf->bytes, buf->area, buf->addr); buf->area = NULL; +#if defined(CONFIG_SND_DAVINCI_HAVE_SRAM) iram_dma = buf->private_data; if (iram_dma) { sram_free(iram_dma->area, iram_dma->bytes); kfree(iram_dma); } +#endif } }