rk2928: i2s init
authorkfx <kfx@rock-chips.com>
Thu, 12 Jul 2012 06:31:18 +0000 (14:31 +0800)
committerkfx <kfx@rock-chips.com>
Thu, 12 Jul 2012 06:31:18 +0000 (14:31 +0800)
arch/arm/mach-rk2928/board-rk2928-fpga.c
arch/arm/mach-rk2928/devices.c
sound/soc/rk29/Kconfig
sound/soc/rk29/Makefile
sound/soc/rk29/rk30_i2s.c

index ed5b66e9303fab32edb35b20b085c90e79173a61..cc9c9923a6fe2a8795270d0e835717ddefc312cc 100644 (file)
@@ -91,6 +91,11 @@ static struct clk_lookup clks[] = {
        CLK("rk_serial.2", "uart_frac_div", &xin24m),
        CLK("rk_serial.2", "uart", &xin24m),
        CLK("rk_serial.2", "pclk_uart", &xin24m),
+
+        CLK("rk29_i2s.0", "i2s_div", &xin24m),
+       CLK("rk29_i2s.0", "i2s_frac_div", &xin24m),
+       CLK("rk29_i2s.0", "i2s", &xin24m),
+       CLK("rk29_i2s.0", "hclk_i2s", &xin24m),
 };
 
 void __init rk30_clock_init(void)
index bbc9868cf2a6cfbae6bb75d8c186d4e049602c6d..4f8ea31fbdbebe75e61b921b1dbaa75507e0e26f 100755 (executable)
@@ -490,6 +490,51 @@ static void __init rk2928_init_spim(void)
        platform_device_register(&rk29xx_device_spi0m);
 #endif
 }
+#ifdef CONFIG_SND_RK29_SOC_I2S
+#ifdef CONFIG_SND_RK29_SOC_I2S_8CH
+static struct resource resource_iis0_8ch[] = {
+       [0] = {
+               .start  = RK2928_I2S_PHYS,
+               .end    = RK2928_I2S_PHYS + RK2928_I2S_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = DMACH_I2S0_8CH_TX,
+               .end    = DMACH_I2S0_8CH_TX,
+               .flags  = IORESOURCE_DMA,
+       },
+       [2] = {
+               .start  = DMACH_I2S0_8CH_RX,
+               .end    = DMACH_I2S0_8CH_RX,
+               .flags  = IORESOURCE_DMA,
+       },
+       [3] = {
+               .start  = IRQ_I2S,
+               .end    = IRQ_I2S,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_iis0_8ch = {
+       .name           = "rk29_i2s",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(resource_iis0_8ch),
+       .resource       = resource_iis0_8ch,
+};
+#endif
+#endif
+static struct platform_device device_pcm = {
+       .name = "rockchip-audio",
+       .id = -1,
+};
+
+static void __init rk2928_init_i2s(void)
+{
+#ifdef CONFIG_SND_RK29_SOC_I2S_8CH
+       platform_device_register(&device_iis0_8ch);
+#endif
+       platform_device_register(&device_pcm);
+}
 #ifdef CONFIG_KEYS_RK29
 extern struct rk29_keys_platform_data rk29_keys_pdata;
 static struct platform_device device_keys = {
@@ -512,6 +557,7 @@ static int __init rk2928_init_devices(void)
 #if defined(CONFIG_FIQ_DEBUGGER) && defined(DEBUG_UART_PHYS)
        rk_serial_debug_init(DEBUG_UART_BASE, IRQ_DEBUG_UART, IRQ_UART_SIGNAL, -1);
 #endif
+       rk2928_init_i2s();
        return 0;
 }
 arch_initcall(rk2928_init_devices);
index 1bc84a597cdf74c6242575e2e422bfedc65c0f99..63e28d3c21e15b75929812951f395670f19b5d66 100755 (executable)
@@ -19,14 +19,14 @@ config SND_RK29_SOC_I2S_8CH
 config SND_RK29_SOC_I2S_2CH
         bool "Soc RK29 I2S 2 Channel support(I2S1)"
         default n
-       depends on SND_RK29_SOC_I2S
+       depends on SND_RK29_SOC_I2S && !ARCH_RK2928
        help
                 This supports the use of the 2 Channel I2S interface on rk29 processors.
 
 config SND_RK_SOC_I2S2_2CH
        bool "Soc RK29 I2S 2 Channel support(I2S2)"
        default n
-       depends on SND_RK29_SOC_I2S && ARCH_RK30
+       depends on SND_RK29_SOC_I2S && ARCH_RK30 && !ARCH_RK2928
        help
                This supports the use of the 2 Channel I2S2 interface on rk30 processors.
 
index a1f0de123846cc73573971a94c3c724e980582ec..0d06e37a1620ceff906844eeb85ab54dc6804488 100644 (file)
@@ -6,6 +6,9 @@ endif
 ifdef CONFIG_ARCH_RK30
 snd-soc-rockchip-i2s-objs := rk30_i2s.o
 endif
+ifdef CONFIG_ARCH_RK2928
+snd-soc-rockchip-i2s-objs := rk30_i2s.o
+endif
 snd-soc-rockchip-spdif-objs := rk29_spdif.o
 
 obj-$(CONFIG_SND_RK29_SOC) += snd-soc-rockchip.o
@@ -37,4 +40,4 @@ obj-$(CONFIG_SND_RK29_SOC_CS42L52) += snd-soc-cs42l52.o
 obj-$(CONFIG_SND_RK29_SOC_AIC3111) += snd-soc-aic3111.o
 obj-$(CONFIG_SND_RK29_SOC_AIC3262) += snd-soc-aic3262.o
 obj-$(CONFIG_SND_RK29_SOC_HDMI) += snd-soc-hdmi.o
-obj-$(CONFIG_SND_RK29_SOC_RK610) += snd-soc-rk610.o
\ No newline at end of file
+obj-$(CONFIG_SND_RK29_SOC_RK610) += snd-soc-rk610.o
index 19ce1882057152677fc475e70393f0413f50cec2..f03cbbee1f3bd94da57212bf3a5cdfaa08d0c0e6 100755 (executable)
@@ -484,6 +484,7 @@ static int rockchip_i2s_dai_probe(struct snd_soc_dai *dai)
 {      
        I2S_DBG("Enter %s, %d >>>>>>>>>>>\n", __func__, __LINE__);
        switch(dai->id) {
+#ifdef CONFIG_ARCH_RK30
         case 0:
                        rk30_mux_api_set(GPIO0A7_I2S8CHSDI_NAME, GPIO0A_I2S_8CH_SDI);           
                        rk30_mux_api_set(GPIO0B0_I2S8CHCLK_NAME, GPIO0B_I2S_8CH_CLK);                
@@ -511,6 +512,16 @@ static int rockchip_i2s_dai_probe(struct snd_soc_dai *dai)
             rk30_mux_api_set(GPIO0D4_I2S22CHSDI_SMCADDR0_NAME, GPIO0D_I2S2_2CH_SDI);
             rk30_mux_api_set(GPIO0D5_I2S22CHSDO_SMCADDR1_NAME, GPIO0D_I2S2_2CH_SDO);
             break;                             
+#endif
+#ifdef CONFIG_ARCH_RK2928
+        case 0:
+                rk30_mux_api_set(GPIO1A0_I2S_MCLK_NAME, GPIO1A_I2S_MCLK);
+                rk30_mux_api_set(GPIO1A1_I2S_SCLK_NAME, GPIO1A_I2S_SCLK);
+                rk30_mux_api_set(GPIO1A2_I2S_LRCKRX_NAME, GPIO1A_I2S_LRCKRX);
+                rk30_mux_api_set(GPIO1A3_I2S_LRCKTX_NAME, GPIO1A_I2S_LRCKTX);
+                rk30_mux_api_set(GPIO1A4_I2S_SDO_NAME, GPIO1A_I2S_SDO);
+                rk30_mux_api_set(GPIO1A5_I2S_SDI_NAME, GPIO1A_I2S_SDI);
+#endif
         default:
             I2S_DBG("Enter:%s, %d, Error For DevId!!!", __FUNCTION__, __LINE__);
             return -EINVAL;
@@ -627,6 +638,7 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev)
        
        switch(pdev->id)
        {
+#ifdef CONFIG_ARCH_RK30
        case 0:
                i2s->dma_capture->channel = DMACH_I2S0_8CH_RX;
                i2s->dma_capture->dma_addr = RK30_I2S0_8CH_PHYS + I2S_RXR_BUFF;
@@ -644,7 +656,16 @@ static int __devinit rockchip_i2s_probe(struct platform_device *pdev)
                i2s->dma_capture->dma_addr = RK30_I2S2_2CH_PHYS + I2S_RXR_BUFF;
                i2s->dma_playback->channel = DMACH_I2S2_2CH_TX;
                i2s->dma_playback->dma_addr = RK30_I2S2_2CH_PHYS + I2S_TXR_BUFF;        
-               break;          
+               break;
+#endif
+#ifdef CONFIG_ARCH_RK2928
+       case 0:
+               i2s->dma_capture->channel = DMACH_I2S0_8CH_RX;
+               i2s->dma_capture->dma_addr = RK2928_I2S_PHYS + I2S_RXR_BUFF;
+               i2s->dma_playback->channel = DMACH_I2S0_8CH_TX;
+               i2s->dma_playback->dma_addr = RK2928_I2S_PHYS + I2S_TXR_BUFF;           
+               break;
+#endif
        }
 
        i2s->dma_capture->client = &rk29_dma_client_in;