arm: tegra: p1852: Add i2s/tdm mode selection
Nitin Pai [Wed, 30 May 2012 10:56:25 +0000 (15:56 +0530)]
Added code to select i2s vs tdm mode.
Added tdm-pcm-audio device defination.
Changed the pcm driver to use tdm-pcm-audio device.
Added fields to pass the pcm driver name to ASoC.
Added P1852_TDM config to KConfig and Linux defconfig

Bug 948478

Change-Id: I82fa03ab947cc615089e0a3107fb53901a1c00cd
Signed-off-by: Bob Johnston <bjohnston@nvidia.com>
Reviewed-on: http://git-master/r/105383
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/configs/tegra_p1852_gnu_linux_defconfig
arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/board-p1852.c
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/devices.h
arch/arm/mach-tegra/include/mach/tegra_p1852_pdata.h

index 6a98b5b..243eaff 100644 (file)
@@ -31,6 +31,7 @@ CONFIG_ARCH_TEGRA_3x_SOC=y
 CONFIG_TEGRA_PCI=y
 CONFIG_MACH_P1852=y
 CONFIG_TEGRA_PWM=y
+CONFIG_TEGRA_P1852_TDM=y
 # CONFIG_TEGRA_CPU_DVFS is not set
 CONFIG_TEGRA_CLOCK_DEBUG_WRITE=y
 # CONFIG_TEGRA_MC_EARLY_ACK is not set
index 184ea71..64836a4 100644 (file)
@@ -277,6 +277,14 @@ config TEGRA_FIQ_DEBUGGER
        help
          Enables the FIQ serial debugger on Tegra
 
+config TEGRA_P1852_TDM
+       bool "Enable TDM mode for P1852 SKUs"
+       default n
+       depends on MACH_P1852
+       help
+               Enables TDM mode driver for P1852 SKUs. If this
+               is not defined then I2S mode is selected by default.
+
 config TEGRA_CARDHU_DSI
        bool "Support DSI panel on Cardhu"
        depends on MACH_CARDHU
index f86e482..1777719 100644 (file)
@@ -200,12 +200,14 @@ static void __init p1852_uart_init(void)
                                ARRAY_SIZE(p1852_uart_devices));
 }
 
-static struct tegra_p1852_platform_data p1852_audio_pdata = {
+#if defined(CONFIG_TEGRA_P1852_TDM)
+static struct tegra_p1852_platform_data p1852_audio_tdm_pdata = {
        .codec_info[0] = {
                .codec_dai_name = "dit-hifi",
                .cpu_dai_name = "tegra30-i2s.0",
                .codec_name = "spdif-dit.0",
                .name = "tegra-i2s-1",
+               .pcm_driver = "tegra-tdm-pcm-audio",
                .i2s_format = format_tdm,
                .master = 1,
                .num_slots = 4,
@@ -218,6 +220,7 @@ static struct tegra_p1852_platform_data p1852_audio_pdata = {
                .cpu_dai_name = "tegra30-i2s.4",
                .codec_name = "spdif-dit.1",
                .name = "tegra-i2s-2",
+               .pcm_driver = "tegra-tdm-pcm-audio",
                .i2s_format = format_tdm,
                .master = 1,
                .num_slots = 8,
@@ -225,9 +228,29 @@ static struct tegra_p1852_platform_data p1852_audio_pdata = {
                .tx_mask = 0xff,
                .rx_mask = 0xff,
        },
-
 };
-
+#else
+static struct tegra_p1852_platform_data p1852_audio_i2s_pdata = {
+       .codec_info[0] = {
+               .codec_dai_name = "dit-hifi",
+               .cpu_dai_name = "tegra30-i2s.0",
+               .codec_name = "spdif-dit.0",
+               .name = "tegra-i2s-1",
+               .pcm_driver = "tegra-pcm-audio",
+               .i2s_format = format_i2s,
+               .master = 1,
+       },
+       .codec_info[1] = {
+               .codec_dai_name = "dit-hifi",
+               .cpu_dai_name = "tegra30-i2s.4",
+               .codec_name = "spdif-dit.1",
+               .name = "tegra-i2s-2",
+               .pcm_driver = "tegra-pcm-audio",
+               .i2s_format = format_i2s,
+               .master = 0,
+       },
+};
+#endif
 static struct platform_device generic_codec_1 = {
        .name           = "spdif-dit",
        .id                     = 0,
@@ -241,13 +264,18 @@ static struct platform_device tegra_snd_p1852 = {
        .name       = "tegra-snd-p1852",
        .id = 0,
        .dev    = {
-           .platform_data = &p1852_audio_pdata,
+#if defined(CONFIG_TEGRA_P1852_TDM)
+               .platform_data = &p1852_audio_tdm_pdata,
+#else
+               .platform_data = &p1852_audio_i2s_pdata,
+#endif
        },
 };
 
 static void p1852_i2s_audio_init(void)
 {
        platform_device_register(&tegra_pcm_device);
+       platform_device_register(&tegra_tdm_pcm_device);
        platform_device_register(&generic_codec_1);
        platform_device_register(&generic_codec_2);
        platform_device_register(&tegra_i2s_device0);
index 3feab75..ebcde0f 100644 (file)
@@ -1291,6 +1291,11 @@ struct platform_device tegra_pcm_device = {
        .id = -1,
 };
 
+struct platform_device tegra_tdm_pcm_device = {
+       .name = "tegra-tdm-pcm-audio",
+       .id = -1,
+};
+
 static struct resource w1_resources[] = {
        [0] = {
                .start = INT_OWR,
index b11962e..02b8e1a 100644 (file)
@@ -73,6 +73,7 @@ extern struct platform_device spdif_dit_device;
 extern struct platform_device bluetooth_dit_device;
 extern struct platform_device baseband_dit_device;
 extern struct platform_device tegra_pcm_device;
+extern struct platform_device tegra_tdm_pcm_device;
 extern struct platform_device tegra_w1_device;
 extern struct platform_device tegra_udc_device;
 extern struct platform_device tegra_ehci1_device;
index 6bea4e5..501d815 100644 (file)
@@ -35,6 +35,7 @@ struct codec_info_s {
        char *cpu_dai_name;
        char *codec_name;       /* Name of the Codec Driver */
        char *name;                     /* Name of the Codec-Dai-Link */
+       char *pcm_driver;       /* Name of the PCM driver */
        enum i2s_data_format i2s_format;
        int master;                     /* Codec is Master or Slave */
        /* TDM format setttings */