From patchwork Thu Jan 7 22:17:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: miguel.aguilar@ridgerun.com X-Patchwork-Id: 71671 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o07ML18d022995 for ; Thu, 7 Jan 2010 22:21:01 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o07MIjO9032679 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Jan 2010 16:18:45 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id o07MIhkR013534; Thu, 7 Jan 2010 16:18:44 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 89D58808A0; Thu, 7 Jan 2010 16:18:07 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id B632580660 for ; Thu, 7 Jan 2010 16:17:32 -0600 (CST) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id o07MHW2Z025921 for ; Thu, 7 Jan 2010 16:17:32 -0600 (CST) Received: from psmtp.com (na3sys009amx245.postini.com [74.125.149.129]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id o07MHVRw017944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 7 Jan 2010 16:17:32 -0600 Received: from source ([74.208.67.6]) (using TLSv1) by na3sys009amx245.postini.com ([74.125.148.10]) with SMTP; Thu, 07 Jan 2010 17:17:32 EST Received: from [201.198.127.70] (helo=localhost.localdomain) by mail.navvo.net with esmtpa (Exim 4.63) (envelope-from ) id 1NT0fY-0006c8-Nv; Thu, 07 Jan 2010 16:17:30 -0600 From: miguel.aguilar@ridgerun.com To: davinci-linux-open-source@linux.davincidsp.com, nsnehaprabha@ti.com Date: Thu, 7 Jan 2010 16:17:21 -0600 Message-Id: <1262902641-14821-1-git-send-email-miguel.aguilar@ridgerun.com> X-Mailer: git-send-email 1.6.0.4 X-SA-Exim-Connect-IP: 201.198.127.70 X-SA-Exim-Mail-From: miguel.aguilar@ridgerun.com X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on mail.navvo.net X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, NO_REAL_NAME autolearn=ham version=3.1.7-deb Subject: [PATCH 2/2] Davinci: DM365: Enable DaVinci Voice Codec support for DM365 EVM X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000) X-SA-Exim-Scanned: Yes (on mail.navvo.net) X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.46751/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 X-pstn-addresses: from [db-null] Cc: alsa-devel@alsa-project.org, clark.becker@ridgerun.com, santiago.nunez@ridgerun.com, Miguel Aguilar 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: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 8d23972..74f3519 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -175,7 +175,43 @@ static struct at24_platform_data eeprom_info = { .context = (void *)0x7f00, }; -static struct snd_platform_data dm365_evm_snd_data; +static int dm365_snd_dma_event_mux(int device, int enable, int playback) +{ + static int tx_dma_mux = 0; + static int rx_dma_mux = 0; + + if (!enable) { + if (playback) + tx_dma_mux = 0; + else + rx_dma_mux = 0; + return 0; + } + + if (playback) { + if (tx_dma_mux == 1) + return -EBUSY; + if (device == 0) + davinci_cfg_reg(DM365_EVT2_ASP_TX); + else + davinci_cfg_reg(DM365_EVT2_VC_TX); + tx_dma_mux = 1; + } else { + if (rx_dma_mux == 1) + return -EBUSY; + if (device == 0) + davinci_cfg_reg(DM365_EVT3_ASP_RX); + else + davinci_cfg_reg(DM365_EVT3_VC_RX); + rx_dma_mux = 1; + } + + return 0; +} + +static struct snd_platform_data dm365_evm_snd_data = { + .dma_event_mux = &dm365_snd_dma_event_mux, +}; static struct i2c_board_info i2c_info[] = { { @@ -513,6 +549,7 @@ static __init void dm365_evm_init(void) evm_init_cpld(); dm365_init_asp(&dm365_evm_snd_data); + dm365_init_vc(&dm365_evm_snd_data); dm365_init_rtc(); #ifdef CONFIG_KEYBOARD_DAVINCI diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index cc3bae4..024cbab 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -455,7 +455,7 @@ static struct davinci_clk dm365_clks[] = { CLK(NULL, "timer3", &timer3_clk), CLK(NULL, "usb", &usb_clk), CLK("davinci_emac.1", NULL, &emac_clk), - CLK("voice_codec", NULL, &voicecodec_clk), + CLK("davinci_voicecodec", NULL, &voicecodec_clk), CLK("davinci-asp.0", NULL, &asp0_clk), CLK(NULL, "rto", &rto_clk), CLK(NULL, "mjcp", &mjcp_clk), @@ -604,6 +604,8 @@ INT_CFG(DM365, INT_IMX1_DISABLE, 24, 1, 0, false) INT_CFG(DM365, INT_NSF_ENABLE, 25, 1, 1, false) INT_CFG(DM365, INT_NSF_DISABLE, 25, 1, 0, false) +EVT_CFG(DM365, EVT2_VC_TX, 0, 1, 1, false) +EVT_CFG(DM365, EVT3_VC_RX, 1, 1, 1, false) EVT_CFG(DM365, EVT2_ASP_TX, 0, 1, 0, false) EVT_CFG(DM365, EVT3_ASP_RX, 1, 1, 0, false) #endif @@ -835,6 +837,31 @@ static struct platform_device dm365_asp_device = { .resource = dm365_asp_resources, }; +static struct resource dm365_vc_resources[] = { + { + .start = DAVINCI_DM365_VC_BASE, + .end = DAVINCI_DM365_VC_BASE + SZ_1K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = DAVINCI_DMA_VC_TX, + .end = DAVINCI_DMA_VC_TX, + .flags = IORESOURCE_DMA, + }, + { + .start = DAVINCI_DMA_VC_RX, + .end = DAVINCI_DMA_VC_RX, + .flags = IORESOURCE_DMA, + }, +}; + +static struct platform_device dm365_vc_device = { + .name = "davinci_voicecodec", + .id = -1, + .num_resources = ARRAY_SIZE(dm365_vc_resources), + .resource = dm365_vc_resources, +}; + static struct resource dm365_rtc_resources[] = { { .start = DM365_RTC_BASE, @@ -985,12 +1012,16 @@ void __init dm365_init_asp(struct snd_platform_data *pdata) davinci_cfg_reg(DM365_MCBSP0_BDR); davinci_cfg_reg(DM365_MCBSP0_R); davinci_cfg_reg(DM365_MCBSP0_BFSR); - davinci_cfg_reg(DM365_EVT2_ASP_TX); - davinci_cfg_reg(DM365_EVT3_ASP_RX); dm365_asp_device.dev.platform_data = pdata; platform_device_register(&dm365_asp_device); } +void __init dm365_init_vc(struct snd_platform_data *pdata) +{ + dm365_vc_device.dev.platform_data = pdata; + platform_device_register(&dm365_vc_device); +} + void __init dm365_init_ks(struct davinci_ks_platform_data *pdata) { davinci_cfg_reg(DM365_KEYSCAN); diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/arch/arm/mach-davinci/include/mach/asp.h index 834725f..6a175eb 100644 --- a/arch/arm/mach-davinci/include/mach/asp.h +++ b/arch/arm/mach-davinci/include/mach/asp.h @@ -50,6 +50,7 @@ #define DAVINCI_ASP1_TX_INT IRQ_MBXINT struct snd_platform_data { + int (*dma_event_mux)(int, int, int); u32 tx_dma_offset; u32 rx_dma_offset; enum dma_event_q eventq_no; /* event queue number */ diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h index 3c07a88..50aeaec 100644 --- a/arch/arm/mach-davinci/include/mach/dm365.h +++ b/arch/arm/mach-davinci/include/mach/dm365.h @@ -31,8 +31,13 @@ #define DM365_RTC_BASE (0x01C69000) +#define DAVINCI_DM365_VC_BASE (0x01D0C000) +#define DAVINCI_DMA_VC_TX 2 +#define DAVINCI_DMA_VC_RX 3 + void __init dm365_init(void); void __init dm365_init_asp(struct snd_platform_data *pdata); +void __init dm365_init_vc(struct snd_platform_data *pdata); void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); void __init dm365_init_rtc(void); diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h index b60c693..2937c51 100644 --- a/arch/arm/mach-davinci/include/mach/mux.h +++ b/arch/arm/mach-davinci/include/mach/mux.h @@ -325,6 +325,8 @@ enum davinci_dm365_index { DM365_INT_NSF_DISABLE, /* EDMA event muxing */ + DM365_EVT2_VC_TX, + DM365_EVT3_VC_RX, DM365_EVT2_ASP_TX, DM365_EVT3_ASP_RX, DM365_EVT26_MMC0_RX,