summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSumit Bhattacharya <sumitb@nvidia.com>2011-08-30 22:04:55 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:48:50 -0800
commit96397146845c7ad1556087ab81f835ff3758f12d (patch)
treed1e4a17c93ad29a787d25dbbd7f64dde58b725a5 /arch
parent05c336b014c78fb1670260e26975a1e252e840dc (diff)
ARM: tegra: whistler: Add sound support
Bug 862023 Change-Id: I32d8406a7c1d88b09156b94dda2a2b47e89e515f Reviewed-on: http://git-master/r/49874 Tested-by: Sumit Bhattacharya <sumitb@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R9846b3685e78fe8366ce4584f6fa1e573d6de63d
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/Kconfig1
-rw-r--r--arch/arm/mach-tegra/board-whistler-pinmux.c24
-rw-r--r--arch/arm/mach-tegra/board-whistler.c29
-rw-r--r--arch/arm/mach-tegra/board-whistler.h7
-rw-r--r--arch/arm/mach-tegra/include/mach/tegra_wm8753_pdata.h23
5 files changed, 77 insertions, 7 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index bcb10cb8e4ee..2ea7f817d926 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -117,6 +117,7 @@ config MACH_WARIO
config MACH_WHISTLER
bool "Whistler board"
depends on ARCH_TEGRA_2x_SOC
+ select MACH_HAS_SND_SOC_TEGRA_WM8753 if SND_SOC
help
Support for NVIDIA Whistler development platform
diff --git a/arch/arm/mach-tegra/board-whistler-pinmux.c b/arch/arm/mach-tegra/board-whistler-pinmux.c
index aa74f29a9624..5dc8b7910d3f 100644
--- a/arch/arm/mach-tegra/board-whistler-pinmux.c
+++ b/arch/arm/mach-tegra/board-whistler-pinmux.c
@@ -16,8 +16,12 @@
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/gpio.h>
#include <mach/pinmux.h>
+#include "board-whistler.h"
+#include "gpio-names.h"
+
#define DEFAULT_DRIVE(_name) \
{ \
.pingroup = TEGRA_DRIVE_PINGROUP_##_name, \
@@ -45,14 +49,14 @@ static __initdata struct tegra_pingroup_config whistler_pinmux[] = {
{TEGRA_PINGROUP_ATC, TEGRA_MUX_SDIO4, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
{TEGRA_PINGROUP_ATD, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
{TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
- {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_OSC, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
+ {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_PLLA_OUT, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
{TEGRA_PINGROUP_CDEV2, TEGRA_MUX_OSC, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
{TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
{TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
- {TEGRA_PINGROUP_DAP1, TEGRA_MUX_DAP1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
- {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
- {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
- {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
+ {TEGRA_PINGROUP_DAP1, TEGRA_MUX_DAP1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
+ {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
+ {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
+ {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
{TEGRA_PINGROUP_DDC, TEGRA_MUX_I2C2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
{TEGRA_PINGROUP_DTA, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
{TEGRA_PINGROUP_DTB, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
@@ -158,9 +162,17 @@ static __initdata struct tegra_pingroup_config whistler_pinmux[] = {
{TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
};
-void __init whistler_pinmux_init(void)
+static struct tegra_gpio_table gpio_table[] = {
+ { .gpio = TEGRA_GPIO_HP_DET, .enable = true },
+ { .gpio = TEGRA_GPIO_SPKR_EN, .enable = true },
+};
+
+int __init whistler_pinmux_init(void)
{
tegra_pinmux_config_table(whistler_pinmux, ARRAY_SIZE(whistler_pinmux));
tegra_drive_pinmux_config_table(whistler_drive_pinmux,
ARRAY_SIZE(whistler_drive_pinmux));
+
+ tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
+ return 0;
}
diff --git a/arch/arm/mach-tegra/board-whistler.c b/arch/arm/mach-tegra/board-whistler.c
index 753a323341bb..84aa8533f012 100644
--- a/arch/arm/mach-tegra/board-whistler.c
+++ b/arch/arm/mach-tegra/board-whistler.c
@@ -44,6 +44,8 @@
#include <mach/pinmux.h>
#include <mach/iomap.h>
#include <mach/io.h>
+#include <mach/i2s.h>
+#include <mach/tegra_wm8753_pdata.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -214,6 +216,7 @@ static __initdata struct tegra_clk_init_table whistler_clk_init_table[] = {
{ "pwm", "clk_32k", 32768, false},
{ "kbc", "clk_32k", 32768, true},
{ "sdmmc2", "pll_p", 25000000, false},
+ { "i2s1", "pll_a_out0", 0, false},
{ NULL, NULL, 0, 0},
};
@@ -254,6 +257,10 @@ static struct tegra_i2c_platform_data whistler_dvc_platform_data = {
.is_dvc = true,
};
+static struct i2c_board_info __initdata wm8753_board_info = {
+ I2C_BOARD_INFO("wm8753", 0x1a),
+};
+
static void whistler_i2c_init(void)
{
tegra_i2c_device1.dev.platform_data = &whistler_i2c1_platform_data;
@@ -265,6 +272,8 @@ static void whistler_i2c_init(void)
platform_device_register(&tegra_i2c_device3);
platform_device_register(&tegra_i2c_device2);
platform_device_register(&tegra_i2c_device1);
+
+ i2c_register_board_info(4, &wm8753_board_info, 1);
}
#define GPIO_SCROLL(_pinaction, _gpio, _desc) \
@@ -301,6 +310,22 @@ static struct platform_device tegra_camera = {
.id = -1,
};
+static struct tegra_wm8753_platform_data whistler_audio_pdata = {
+ .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
+ .gpio_hp_det = TEGRA_GPIO_HP_DET,
+ .gpio_hp_mute = -1,
+ .gpio_int_mic_en = -1,
+ .gpio_ext_mic_en = -1,
+};
+
+static struct platform_device whistler_audio_device = {
+ .name = "tegra-snd-wm8753",
+ .id = 0,
+ .dev = {
+ .platform_data = &whistler_audio_pdata,
+ },
+};
+
static struct platform_device *whistler_devices[] __initdata = {
&tegra_pmu_device,
&tegra_udc_device,
@@ -309,6 +334,10 @@ static struct platform_device *whistler_devices[] __initdata = {
&tegra_avp_device,
&whistler_scroll_device,
&tegra_camera,
+ &tegra_i2s_device1,
+ &tegra_das_device,
+ &tegra_pcm_device,
+ &whistler_audio_device,
};
static int __init whistler_scroll_init(void)
diff --git a/arch/arm/mach-tegra/board-whistler.h b/arch/arm/mach-tegra/board-whistler.h
index c8d2f7b87d69..884f7c416a02 100644
--- a/arch/arm/mach-tegra/board-whistler.h
+++ b/arch/arm/mach-tegra/board-whistler.h
@@ -28,6 +28,11 @@ int whistler_emc_init(void);
/* Interrupt numbers from external peripherals */
#define MAX8907C_INT_BASE TEGRA_NR_IRQS
-#define MAX8907C_INT_END (MAX8907C_INT_BASE + 32)
+#define MAX8907C_INT_END (MAX8907C_INT_BASE + 31)
+
+/* Audio-related GPIOs */
+#define WHISTLER_GPIO_WM8753(_x_) (MAX8907C_INT_END + 1 + (_x_))
+#define TEGRA_GPIO_SPKR_EN WHISTLER_GPIO_WM8753(2)
+#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2
#endif
diff --git a/arch/arm/mach-tegra/include/mach/tegra_wm8753_pdata.h b/arch/arm/mach-tegra/include/mach/tegra_wm8753_pdata.h
new file mode 100644
index 000000000000..17190c653baf
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/tegra_wm8753_pdata.h
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-tegra/include/mach/tegra_wm8903_pdata.h
+ *
+ * Copyright 2011 NVIDIA, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+struct tegra_wm8753_platform_data {
+ int gpio_spkr_en;
+ int gpio_hp_det;
+ int gpio_hp_mute;
+ int gpio_int_mic_en;
+ int gpio_ext_mic_en;
+};