From: Iliyan Malchev Date: Thu, 29 Jul 2010 21:12:39 +0000 (-0700) Subject: [ARM] tegra: stingray: configure board for audio through i2s1 X-Git-Tag: firefly_0821_release~9834^2~733 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39108c894da147c1c22d4ffd49112e07f97bedcb;p=firefly-linux-kernel-4.4.55.git [ARM] tegra: stingray: configure board for audio through i2s1 Signed-off-by: Iliyan Malchev --- diff --git a/arch/arm/mach-tegra/board-stingray.c b/arch/arm/mach-tegra/board-stingray.c index c241704fb076..035358732624 100644 --- a/arch/arm/mach-tegra/board-stingray.c +++ b/arch/arm/mach-tegra/board-stingray.c @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include @@ -222,6 +224,17 @@ static struct platform_device cpcap_otg = { .num_resources = ARRAY_SIZE(cpcap_otg_resources), }; +static struct tegra_audio_platform_data tegra_audio_pdata = { + .master = false, + .dma_on = true, /* use dma by default */ + .i2s_clk_rate = 240000000, + .dap_clk = "clk_dev1", + .audio_sync_clk = "audio_2x", + .mode = I2S_BIT_FORMAT_I2S, + .fifo_fmt = I2S_FIFO_16_LSB, + .bit_size = I2S_BIT_SIZE_16, +}; + static char *usb_functions[] = { "mtp" }; static char *usb_functions_adb[] = { "mtp", "adb" }; @@ -440,6 +453,7 @@ static struct platform_device *stingray_devices[] __initdata = { &tegra_gart_dev, &ram_console_device, &tegra_isp, + &tegra_i2s_device1, }; extern struct tegra_sdhci_platform_data stingray_wifi_data; /* sdhci2 */ @@ -662,6 +676,30 @@ static struct tegra_suspend_platform_data stingray_suspend = { .wake_any = 0, }; +static void *das_base = IO_ADDRESS(TEGRA_APB_MISC_BASE); + +static inline void das_writel(unsigned long value, unsigned long offset) +{ + writel(value, das_base + offset); +} + +#define APB_MISC_DAS_DAP_CTRL_SEL_0 0xc00 +#define APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0 0xc40 + +static void init_das(void) +{ + bool master = tegra_audio_pdata.master; + + /* DAC1 -> DAP1 */ + das_writel((!master)<<31, APB_MISC_DAS_DAP_CTRL_SEL_0); + das_writel(0, APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0); + + /* DAC2 -> DAP2 */ + das_writel((!master)<<31 | 1, APB_MISC_DAS_DAP_CTRL_SEL_0 + 4); + das_writel(1<<28 | 1<<24 | 1, + APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0 + 4); +} + extern int nvmap_add_carveout_heap(unsigned long, size_t, const char *, unsigned int); @@ -733,6 +771,9 @@ static void __init tegra_stingray_init(void) tegra_periph_reset_deassert(clk); clk_put(clk); + init_das(); + tegra_i2s_device1.dev.platform_data = &tegra_audio_pdata; + platform_add_devices(stingray_devices, ARRAY_SIZE(stingray_devices)); stingray_i2c_init();