[alsa-devel] [PATCH 0/4] Tegra patches for 2.6.40
Below are the patches I have queued up for Tegra in 2.6.40.
The first 2 and last 1 are bug fixes and can be applied immediately. I believe these are all reposts too.
The 3rd updates the Seaboard board to define to required platform data for the audio driver. This one patch relies on the git pull request that I sent out earlier today.
I tested:
* After applying these changes, everything builds OK and runs fine on Harmony, including audio. * After additionally merging Mark's ASoC for-2.6.40/for-next branch, there are no merge conflicts, everything builds OK, and everything runs OK on Seaboard clamshell, including a full audio checkout. Note that non-clamshell Seaboard has difficulty initializing I2C. I'm investigating this, but don't expect to need to modify any of these changes because of this issue; most likely some unrelated bug needs fixing.
Stephen Warren (4): ARM: Tegra: Harmony: Fix conflicting GPIO numbering ARM: Tegra: Seaboard: Re-order sdhci device registration ARM: Tegra: Seaboard board updates for audio ARM: tegra: Harmony: Register and configure WM8903 IRQ GPIO
arch/arm/mach-tegra/board-harmony-power.c | 4 +- arch/arm/mach-tegra/board-harmony.c | 3 + arch/arm/mach-tegra/board-harmony.h | 3 +- arch/arm/mach-tegra/board-seaboard-pinmux.c | 21 +++++++++- arch/arm/mach-tegra/board-seaboard.c | 56 ++++++++++++++++++++++++++- arch/arm/mach-tegra/board-seaboard.h | 12 ++++-- 6 files changed, 89 insertions(+), 10 deletions(-)
Currently, both the WM8903 and TPS6586x chips attempt to register with gpiolib using the same GPIO numbers. This causes the audio driver to fail to initialize.
To solve this, add a define to board-harmony.h for the TPS6586x, and make board-harmony-power.c use this define, instead of directly referencing TEGRA_NR_GPIOS.
This fixes a regression introduced by commit 6f168f2fa60f87e85e0df25e87e2372f22f5eb7c. ARM: tegra: harmony: initialize the TPS65862 PMIC
Signed-off-by: Stephen Warren swarren@nvidia.com --- arch/arm/mach-tegra/board-harmony-power.c | 4 +++- arch/arm/mach-tegra/board-harmony.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c index c84442c..5ad8b2f 100644 --- a/arch/arm/mach-tegra/board-harmony-power.c +++ b/arch/arm/mach-tegra/board-harmony-power.c @@ -24,6 +24,8 @@
#include <mach/irqs.h>
+#include "board-harmony.h" + #define PMC_CTRL 0x0 #define PMC_CTRL_INTR_LOW (1 << 17)
@@ -98,7 +100,7 @@ static struct tps6586x_platform_data tps_platform = { .irq_base = TEGRA_NR_IRQS, .num_subdevs = ARRAY_SIZE(tps_devs), .subdevs = tps_devs, - .gpio_base = TEGRA_NR_GPIOS, + .gpio_base = HARMONY_GPIO_TPS6586X(0), };
static struct i2c_board_info __initdata harmony_regulators[] = { diff --git a/arch/arm/mach-tegra/board-harmony.h b/arch/arm/mach-tegra/board-harmony.h index 1e57b07..d85142e 100644 --- a/arch/arm/mach-tegra/board-harmony.h +++ b/arch/arm/mach-tegra/board-harmony.h @@ -17,7 +17,8 @@ #ifndef _MACH_TEGRA_BOARD_HARMONY_H #define _MACH_TEGRA_BOARD_HARMONY_H
-#define HARMONY_GPIO_WM8903(_x_) (TEGRA_NR_GPIOS + (_x_)) +#define HARMONY_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_)) +#define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_))
#define TEGRA_GPIO_SD2_CD TEGRA_GPIO_PI5 #define TEGRA_GPIO_SD2_WP TEGRA_GPIO_PH1
Ensure the built-in eMMC is always named mmcblk0.
This is important because:
* U-Boot statically assigns MMC device IDs based on controller ID. * U-Boot assumes that kernel MMC device ID numbering matches U-Boot numbering. * U-Boot provides a kernel cmdline option e.g. root=/dev/mmcblk0p3 based on that numbering. * The kernel dynamically assigns MMC device IDs based on enumeration order of the memory behind the host controller, rather than statically based on host controller ID like U-Boot. * By registering the SDHCI controller for the built-in eMMC first, the enumeration of the built-in eMMC is performed first, and hence eMMC gets assigned ID 0 just like U-Boot. If the SD slot is filled, it then gets assigned ID 1 just like U-Boot. * If the MMC IDs mismatch, and the system boots from SD card not eMMC, the kernel will access the eMMC instead of SD card when attempting to mount /dev/mmcblk1p3 as the root fs. If eMMC is not partitioned/formatted, the kernel will panic since the root fs can't be mounted. If eMMC is partitioned and formatted, the kernel will mount an unexpected filesystem as the root fs.
This change relies on the SDHCI driver performing initial card detection synchronously during device registration. This is currently the case.
Signed-off-by: Stephen Warren swarren@nvidia.com --- arch/arm/mach-tegra/board-seaboard.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index a8d7ace..783de17 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c @@ -137,9 +137,9 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 = { static struct platform_device *seaboard_devices[] __initdata = { &debug_uart, &tegra_pmu_device, - &tegra_sdhci_device1, - &tegra_sdhci_device3, &tegra_sdhci_device4, + &tegra_sdhci_device3, + &tegra_sdhci_device1, &seaboard_gpio_keys_device, };
* Initialize clock tree for audio * Add GPIO base definitions * Add audio GPIO definitions * Define platform data for WM8903 and ASoC machine driver * Add special case for Kaen to handle HP_MUTE GPIO * Register platform devices for audio * Update pinmux to cater for new GPIOs used for audio
Signed-off-by: Stephen Warren swarren@nvidia.com --- NOTE: This patch relies on the git pull request I sent out earlier today (from Mark's ASoC tegra branch, to update the platform data structure etc.)
arch/arm/mach-tegra/board-seaboard-pinmux.c | 21 ++++++++++- arch/arm/mach-tegra/board-seaboard.c | 52 +++++++++++++++++++++++++++ arch/arm/mach-tegra/board-seaboard.h | 12 ++++-- 3 files changed, 79 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-tegra/board-seaboard-pinmux.c b/arch/arm/mach-tegra/board-seaboard-pinmux.c index 0bda495..e693246 100644 --- a/arch/arm/mach-tegra/board-seaboard-pinmux.c +++ b/arch/arm/mach-tegra/board-seaboard-pinmux.c @@ -49,7 +49,7 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_NORMAL, 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_TRISTATE}, + {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DDC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, @@ -133,7 +133,7 @@ static __initdata struct tegra_pingroup_config seaboard_pinmux[] = { {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIB, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, + {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_SPID, TEGRA_MUX_SPI1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIE, TEGRA_MUX_SPI1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_SPIF, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, @@ -171,6 +171,23 @@ static struct tegra_gpio_table gpio_table[] = {
void __init seaboard_pinmux_init(void) { + /* + * PINGROUP_SPIC contains two pins: + * + PX2, DISABLE_CHRGR (output) + * + PX3, WM8903 codec IRQ (input) + * + * The pinmux module can only configure TRISTATE vs. NORMAL on a + * per-group rather than per-pin basis. The group must be NORMAL + * since at least one pin is an output. However, we must ensure that + * the WM8903 IRQ is never driven, since the WM8903 itself is driving + * it, and we don't want multiple drivers. To ensure this, configure + * PX3 as a GPIO here, and set is as an input, before the pinmux table + * is written, which is when the pins will be un-tristated. + */ + tegra_gpio_enable(TEGRA_GPIO_CDC_IRQ); + gpio_request(TEGRA_GPIO_CDC_IRQ, "wm8903"); + gpio_direction_input(TEGRA_GPIO_CDC_IRQ); + tegra_pinmux_config_table(seaboard_pinmux, ARRAY_SIZE(seaboard_pinmux));
tegra_drive_pinmux_config_table(seaboard_drive_pinmux, diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index 783de17..2fdd376 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c @@ -26,9 +26,12 @@ #include <linux/gpio.h> #include <linux/gpio_keys.h>
+#include <sound/wm8903.h> + #include <mach/iomap.h> #include <mach/irqs.h> #include <mach/sdhci.h> +#include <mach/tegra_wm8903_pdata.h>
#include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -63,6 +66,10 @@ static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = { /* name parent rate enabled */ { "uartb", "pll_p", 216000000, true}, { "uartd", "pll_p", 216000000, true}, + { "pll_a", "pll_p_out1", 56448000, true }, + { "pll_a_out0", "pll_a", 11289600, true }, + { "cdev1", NULL, 0, true }, + { "i2s1", "pll_a_out0", 11289600, false}, { NULL, NULL, 0, 0}, };
@@ -134,6 +141,22 @@ static struct tegra_sdhci_platform_data sdhci_pdata4 = { .is_8bit = 1, };
+static struct tegra_wm8903_platform_data seaboard_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 seaboard_audio_device = { + .name = "tegra-snd-wm8903", + .id = 0, + .dev = { + .platform_data = &seaboard_audio_pdata, + }, +}; + static struct platform_device *seaboard_devices[] __initdata = { &debug_uart, &tegra_pmu_device, @@ -141,6 +164,10 @@ static struct platform_device *seaboard_devices[] __initdata = { &tegra_sdhci_device3, &tegra_sdhci_device1, &seaboard_gpio_keys_device, + &tegra_i2s_device1, + &tegra_das_device, + &tegra_pcm_device, + &seaboard_audio_device, };
static struct i2c_board_info __initdata isl29018_device = { @@ -152,6 +179,26 @@ static struct i2c_board_info __initdata adt7461_device = { I2C_BOARD_INFO("adt7461", 0x4c), };
+static struct wm8903_platform_data wm8903_pdata = { + .irq_active_low = 0, + .micdet_cfg = 0, + .micdet_delay = 100, + .gpio_base = SEABOARD_GPIO_WM8903(0), + .gpio_cfg = { + WM8903_GPIO_NO_CONFIG, + WM8903_GPIO_NO_CONFIG, + 0, + WM8903_GPIO_NO_CONFIG, + WM8903_GPIO_NO_CONFIG, + }, +}; + +static struct i2c_board_info __initdata wm8903_device = { + I2C_BOARD_INFO("wm8903", 0x1a), + .platform_data = &wm8903_pdata, + .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), +}; + static void __init seaboard_i2c_init(void) { gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); @@ -161,6 +208,8 @@ static void __init seaboard_i2c_init(void)
i2c_register_board_info(4, &adt7461_device, 1);
+ i2c_register_board_info(0, &wm8903_device, 1); + tegra_i2c_device1.dev.platform_data = &seaboard_i2c1_platform_data; tegra_i2c_device2.dev.platform_data = &seaboard_i2c2_platform_data; tegra_i2c_device3.dev.platform_data = &seaboard_i2c3_platform_data; @@ -204,6 +253,9 @@ static void __init tegra_kaen_init(void) debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE; debug_uart_platform_data[0].irq = INT_UARTB;
+ seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE; + tegra_gpio_enable(TEGRA_GPIO_KAEN_HP_MUTE); + seaboard_common_init();
seaboard_i2c_init(); diff --git a/arch/arm/mach-tegra/board-seaboard.h b/arch/arm/mach-tegra/board-seaboard.h index d8415e1..d06c334 100644 --- a/arch/arm/mach-tegra/board-seaboard.h +++ b/arch/arm/mach-tegra/board-seaboard.h @@ -17,6 +17,9 @@ #ifndef _MACH_TEGRA_BOARD_SEABOARD_H #define _MACH_TEGRA_BOARD_SEABOARD_H
+#define SEABOARD_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_)) +#define SEABOARD_GPIO_WM8903(_x_) (SEABOARD_GPIO_TPS6586X(4) + (_x_)) + #define TEGRA_GPIO_SD2_CD TEGRA_GPIO_PI5 #define TEGRA_GPIO_SD2_WP TEGRA_GPIO_PH1 #define TEGRA_GPIO_SD2_POWER TEGRA_GPIO_PI6 @@ -31,10 +34,11 @@ #define TEGRA_GPIO_MAGNETOMETER TEGRA_GPIO_PN5 #define TEGRA_GPIO_ISL29018_IRQ TEGRA_GPIO_PZ2 #define TEGRA_GPIO_AC_ONLINE TEGRA_GPIO_PV3 - -#define TPS_GPIO_BASE TEGRA_NR_GPIOS - -#define TPS_GPIO_WWAN_PWR (TPS_GPIO_BASE + 2) +#define TEGRA_GPIO_WWAN_PWR SEABOARD_GPIO_TPS6586X(2) +#define TEGRA_GPIO_CDC_IRQ TEGRA_GPIO_PX3 +#define TEGRA_GPIO_SPKR_EN SEABOARD_GPIO_WM8903(2) +#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PX1 +#define TEGRA_GPIO_KAEN_HP_MUTE TEGRA_GPIO_PA5
void seaboard_pinmux_init(void);
Technically, we need to request and configure the GPIO used as the WM8903 interrupt. This prevents conflicting registrations, and assures that the GPIO is correctly configured in all cases, e.g. if the bootloader left the GPIO in some unexpected state.
In practice, the previous code works as-is, at least when using ChromeOS's U-Boot as the boot-loader.
Signed-off-by: Stephen Warren swarren@nvidia.com --- Note: For Harmony, we don't have to do this inside harmony_pinmux_init (see Seaboard's seaboard_pinmux_init in patch 3 in this series) because pingroup SPIC pins are all input on Harmony.
arch/arm/mach-tegra/board-harmony.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index 30e18bc..87cbc4b 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c @@ -131,6 +131,9 @@ static void __init harmony_i2c_init(void) platform_device_register(&tegra_i2c_device3); platform_device_register(&tegra_i2c_device4);
+ gpio_request(TEGRA_GPIO_CDC_IRQ, "wm8903"); + gpio_direction_input(TEGRA_GPIO_CDC_IRQ); + i2c_register_board_info(0, &wm8903_board_info, 1); }
Stephen Warren wrote at Thursday, April 21, 2011 12:01 PM:
Below are the patches I have queued up for Tegra in 2.6.40. ... I tested:
- After applying these changes, everything builds OK and runs fine on Harmony, including audio.
- After additionally merging Mark's ASoC for-2.6.40/for-next branch, there are no merge conflicts, everything builds OK, and everything runs OK on Seaboard clamshell, including a full audio checkout.
Note that non-clamshell Seaboard has difficulty initializing I2C. I'm investigating this, but don't expect to need to modify any of these changes because of this issue; most likely some unrelated bug needs fixing.
Note that I found the cause of this; please see my recent email titled "[PATCH] i2c: tegra: Enable new slave mode." for this fix for this.
Thanks.
participants (1)
-
Stephen Warren