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: 1393171 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork1.kernel.org (Postfix) with ESMTP id 087CD3FDFB for ; Fri, 31 Aug 2012 13:11:55 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q7VD962o026545; Fri, 31 Aug 2012 08:09:06 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7VD94eC001761; Fri, 31 Aug 2012 08:09:06 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Fri, 31 Aug 2012 08:09:04 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7VD94S9003878; Fri, 31 Aug 2012 08:09:04 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 855178062B; Fri, 31 Aug 2012 08:09:01 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id 411908062A for ; Fri, 31 Aug 2012 08:08:55 -0500 (CDT) 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 CC: , , X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com 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 } }