[alsa-devel] [PATCH 0/6] ARM: OMAP3: Audio support update for omap-twl4030
Hello,
omap-twl4030 ASoC machine driver can support more boards with the following series: http://mailman.alsa-project.org/pipermail/alsa-devel/2012-December/058119.ht...
Rework the omap-twl4030 audio support code in arch/arm/mach-omap2/ to take advantages of this. The same machine driver can support the zoom2 and sdp3430 boards as well.
Regards, Peter --- Peter Ujfalusi (6): ARM: OMAP: 3430sdp: Enable extmute functionality for audio ARM: OMAP: zoom: Zoom2 does not have extmute functionality ARM: OMAP2+: twl-common: Add default twl4030 audio configuration ARM: OMAP2+: twl-common: Allow boards to customize the twl4030 audio setup ARM: OMAP: zoom: Audio support via the common omap-twl4030 machine driver ARM: OMAP: sdp3430: Audio support via the common omap-twl4030 machine driver
arch/arm/mach-omap2/board-3430sdp.c | 20 +++++++++++++++++++ arch/arm/mach-omap2/board-cm-t35.c | 2 +- arch/arm/mach-omap2/board-devkit8000.c | 2 +- arch/arm/mach-omap2/board-igep0020.c | 2 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-omap3evm.c | 2 +- arch/arm/mach-omap2/board-overo.c | 2 +- arch/arm/mach-omap2/board-zoom-peripherals.c | 29 ++++++++++++++++++++-------- arch/arm/mach-omap2/twl-common.c | 17 ++++++++++------ arch/arm/mach-omap2/twl-common.h | 3 ++- 10 files changed, 60 insertions(+), 21 deletions(-)
Enable the use of extmute on the HS path.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/board-3430sdp.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index bb73afc..40c22a7 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -382,6 +382,9 @@ static int __init omap3430_i2c_init(void) sdp3430_twldata.vpll2->constraints.apply_uV = true; sdp3430_twldata.vpll2->constraints.name = "VDVI";
+ sdp3430_twldata.audio->codec->hs_extmute = 1; + sdp3430_twldata.audio->codec->hs_extmute_gpio = -EINVAL; + omap3_pmic_init("twl4030", &sdp3430_twldata);
/* i2c2 on camera connector (for sensor control) and optional isp1301 */
The HS extmute is not used on Zoom2 boards. Furthermore the GPIO153 is used as IRQ for the TSC2004 touchscreen controller - for which we do not have driver upstream, yet.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/board-zoom-peripherals.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 26e07ad..03ec6b2 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c @@ -34,7 +34,7 @@ #include "common-board-devices.h"
#define OMAP_ZOOM_WLAN_PMENA_GPIO (101) -#define ZOOM2_HEADSET_EXTMUTE_GPIO (153) +#define OMAP_ZOOM_TSC2004_IRQ_GPIO (153) #define OMAP_ZOOM_WLAN_IRQ_GPIO (162)
#define LCD_PANEL_ENABLE_GPIO (7 + OMAP_MAX_GPIO_LINES) @@ -264,14 +264,9 @@ static int __init omap_i2c_init(void) TWL_COMMON_PDATA_MADC | TWL_COMMON_PDATA_AUDIO, TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
- if (machine_is_omap_zoom2()) { - struct twl4030_codec_data *codec_data; - codec_data = zoom_twldata.audio->codec; + if (machine_is_omap_zoom2()) + zoom_twldata.audio->codec->ramp_delay_value = 3; /* 161 ms */
- codec_data->ramp_delay_value = 3; /* 161 ms */ - codec_data->hs_extmute = 1; - codec_data->hs_extmute_gpio = ZOOM2_HEADSET_EXTMUTE_GPIO; - } omap_pmic_init(1, 2400, "twl5030", 7 + OMAP_INTC_START, &zoom_twldata); omap_register_i2c_bus(2, 400, NULL, 0); omap_register_i2c_bus(3, 400, NULL, 0);
Select the most commonly used audio configuration on boards with twl4030 audio: Headset, Handsfree output and Line in input
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/twl-common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index e49b40b..cd1cba8 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -528,7 +528,12 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE) #include <linux/platform_data/omap-twl4030.h>
-static struct omap_tw4030_pdata omap_twl4030_audio_data; +/* Commonly used configuration */ +static struct omap_tw4030_pdata omap_twl4030_audio_data = { + .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, + .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, + .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, +};
static struct platform_device audio_device = { .name = "omap-twl4030",
Boards with special audio routing can pass a custom omap_tw4030_pdata to the audio machine driver.
At the same time update the board files using the same audio driver.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/board-cm-t35.c | 2 +- arch/arm/mach-omap2/board-devkit8000.c | 2 +- arch/arm/mach-omap2/board-igep0020.c | 2 +- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-omap3evm.c | 2 +- arch/arm/mach-omap2/board-overo.c | 2 +- arch/arm/mach-omap2/twl-common.c | 22 +++++++++++----------- arch/arm/mach-omap2/twl-common.h | 3 ++- 8 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index b3102c2..eec635e 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c @@ -722,7 +722,7 @@ static void __init cm_t3x_common_init(void) cm_t35_init_ethernet(); cm_t35_init_led(); cm_t35_init_display(); - omap_twl4030_audio_init("cm-t3x"); + omap_twl4030_audio_init("cm-t3x", NULL);
usb_musb_init(NULL); cm_t35_init_usbh(); diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 12865af..f0aa64b 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c @@ -627,7 +627,7 @@ static void __init devkit8000_init(void) board_nand_init(devkit8000_nand_partitions, ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS, NAND_BUSWIDTH_16, NULL); - omap_twl4030_audio_init("omap3beagle"); + omap_twl4030_audio_init("omap3beagle", NULL);
/* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 0f24cb8..d1a7352 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -629,7 +629,7 @@ static void __init igep_init(void)
igep_flash_init(); igep_leds_init(); - omap_twl4030_audio_init("igep2"); + omap_twl4030_audio_init("igep2", NULL);
/* * WLAN-BT combo module from MuRata which has a Marvell WLAN diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 22c483d..909e7fa 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -524,7 +524,7 @@ static void __init omap3_beagle_init(void) board_nand_init(omap3beagle_nand_partitions, ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, NAND_BUSWIDTH_16, NULL); - omap_twl4030_audio_init("omap3beagle"); + omap_twl4030_audio_init("omap3beagle", NULL);
/* Ensure msecure is mux'd to be able to set the RTC. */ omap_mux_init_signal("sys_drm_msecure", OMAP_PIN_OFF_OUTPUT_HIGH); diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 3985f35..8803b5c 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -744,7 +744,7 @@ static void __init omap3_evm_init(void) omap3evm_init_smsc911x(); omap3_evm_display_init(); omap3_evm_wl12xx_init(); - omap_twl4030_audio_init("omap3evm"); + omap_twl4030_audio_init("omap3evm", NULL); }
MACHINE_START(OMAP3EVM, "OMAP3 EVM") diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index c8fde3e..fe644eb 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c @@ -506,7 +506,7 @@ static void __init overo_init(void) overo_display_init(); overo_init_led(); overo_init_keys(); - omap_twl4030_audio_init("overo"); + omap_twl4030_audio_init("overo", NULL);
/* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index cd1cba8..931495a 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -529,28 +529,28 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, #include <linux/platform_data/omap-twl4030.h>
/* Commonly used configuration */ -static struct omap_tw4030_pdata omap_twl4030_audio_data = { - .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, - .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, - .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, -}; +static struct omap_tw4030_pdata omap_twl4030_audio_data;
static struct platform_device audio_device = { .name = "omap-twl4030", .id = -1, - .dev = { - .platform_data = &omap_twl4030_audio_data, - }, };
-void __init omap_twl4030_audio_init(char *card_name) +void __init omap_twl4030_audio_init(char *card_name, + struct omap_tw4030_pdata *pdata) { - omap_twl4030_audio_data.card_name = card_name; + if (!pdata) + pdata = &omap_twl4030_audio_data; + + pdata->card_name = card_name; + + audio_device.dev.platform_data = pdata; platform_device_register(&audio_device); }
#else /* SOC_OMAP_TWL4030 */ -void __init omap_twl4030_audio_init(char *card_name) +void __init omap_twl4030_audio_init(char *card_name, + struct omap_tw4030_pdata *pdata) { return; } diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index dcfbad5..24b65d0 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h @@ -32,6 +32,7 @@
struct twl4030_platform_data; struct twl6040_platform_data; +struct omap_tw4030_pdata; struct i2c_board_info;
void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, @@ -60,6 +61,6 @@ void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags);
-void omap_twl4030_audio_init(char *card_name); +void omap_twl4030_audio_init(char *card_name, struct omap_tw4030_pdata *pdata);
#endif /* __OMAP_PMIC_COMMON__ */
Use the common omap-twl4030 ASoC machine driver for audio.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/board-zoom-peripherals.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 03ec6b2..f4ea926 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c @@ -20,6 +20,7 @@ #include <linux/wl12xx.h> #include <linux/mmc/host.h> #include <linux/platform_data/gpio-omap.h> +#include <linux/platform_data/omap-twl4030.h>
#include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -226,6 +227,19 @@ static struct omap2_hsmmc_info mmc[] = { {} /* Terminator */ };
+static struct omap_tw4030_pdata omap_twl4030_audio_data = { + .voice_connected = true, + .custom_routing = true, + + .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, + .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, + + .has_mainmic = true, + .has_submic = true, + .has_hsmic = true, + .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, +}; + static int zoom_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) { @@ -241,6 +255,10 @@ static int zoom_twl_gpio_setup(struct device *dev, pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", LCD_PANEL_ENABLE_GPIO);
+ /* Audio setup */ + omap_twl4030_audio_data.jack_detect = gpio + 2; + omap_twl4030_audio_init("Zoom2", &omap_twl4030_audio_data); + return ret; }
Use the common omap-twl4030 ASoC machine driver for audio.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/board-3430sdp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 40c22a7..e7ef311 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -25,6 +25,7 @@ #include <linux/gpio.h> #include <linux/mmc/host.h> #include <linux/platform_data/spi-omap2-mcspi.h> +#include <linux/platform_data/omap-twl4030.h>
#include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -209,6 +210,19 @@ static struct omap2_hsmmc_info mmc[] = { {} /* Terminator */ };
+static struct omap_tw4030_pdata omap_twl4030_audio_data = { + .voice_connected = true, + .custom_routing = true, + + .has_hs = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, + .has_hf = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, + + .has_mainmic = true, + .has_submic = true, + .has_hsmic = true, + .has_linein = OMAP_TWL4030_LEFT | OMAP_TWL4030_RIGHT, +}; + static int sdp3430_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) { @@ -225,6 +239,9 @@ static int sdp3430_twl_gpio_setup(struct device *dev, /* gpio + 15 is "sub_lcd_nRST" (output) */ gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
+ omap_twl4030_audio_data.jack_detect = gpio + 2; + omap_twl4030_audio_init("SDP3430", &omap_twl4030_audio_data); + return 0; }
participants (1)
-
Peter Ujfalusi