aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-12-31 05:51:46 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-02 08:04:25 -0500
commit5712ded9cf0b6981825af3c86e0059be93e5e17c (patch)
treec41c8311ac25d444ba4ff278daee9e5225afc1d0 /sound/soc
parente04d6e55fe02351b1ac338d9e8082fcc434610ce (diff)
ASoC: twl4030: Configure extmute pinmux when the dedicated pin is in use
When HS extmute is enabled without custom GPIO we should configure the mux to allow the pin to be used as extmute signal. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/twl4030.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 5dd7c81623a6..7bfabe5750e8 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -41,6 +41,11 @@
41/* Register descriptions are here */ 41/* Register descriptions are here */
42#include <linux/mfd/twl4030-audio.h> 42#include <linux/mfd/twl4030-audio.h>
43 43
44/* TWL4030 PMBR1 Register */
45#define TWL4030_PMBR1_REG 0x0D
46/* TWL4030 PMBR1 Register GPIO6 mux bits */
47#define TWL4030_GPIO6_PWM0_MUTE(value) ((value & 0x03) << 2)
48
44/* Shadow register used by the audio driver */ 49/* Shadow register used by the audio driver */
45#define TWL4030_REG_SW_SHADOW 0x4A 50#define TWL4030_REG_SW_SHADOW 0x4A
46#define TWL4030_CACHEREGNUM (TWL4030_REG_SW_SHADOW + 1) 51#define TWL4030_CACHEREGNUM (TWL4030_REG_SW_SHADOW + 1)
@@ -348,19 +353,32 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
348 353
349 pdata = twl4030_get_pdata(codec); 354 pdata = twl4030_get_pdata(codec);
350 355
351 if (pdata && pdata->hs_extmute && 356 if (pdata && pdata->hs_extmute) {
352 gpio_is_valid(pdata->hs_extmute_gpio)) { 357 if (gpio_is_valid(pdata->hs_extmute_gpio)) {
353 int ret; 358 int ret;
354 359
355 if (!pdata->hs_extmute_gpio) 360 if (!pdata->hs_extmute_gpio)
356 dev_warn(codec->dev, 361 dev_warn(codec->dev,
357 "Extmute GPIO is 0 is this correct?\n"); 362 "Extmute GPIO is 0 is this correct?\n");
358 363
359 ret = gpio_request_one(pdata->hs_extmute_gpio, 364 ret = gpio_request_one(pdata->hs_extmute_gpio,
360 GPIOF_OUT_INIT_LOW, "hs_extmute"); 365 GPIOF_OUT_INIT_LOW,
361 if (ret) { 366 "hs_extmute");
362 dev_err(codec->dev, "Failed to get hs_extmute GPIO\n"); 367 if (ret) {
363 pdata->hs_extmute_gpio = -1; 368 dev_err(codec->dev,
369 "Failed to get hs_extmute GPIO\n");
370 pdata->hs_extmute_gpio = -1;
371 }
372 } else {
373 u8 pin_mux;
374
375 /* Set TWL4030 GPIO6 as EXTMUTE signal */
376 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux,
377 TWL4030_PMBR1_REG);
378 pin_mux &= ~TWL4030_GPIO6_PWM0_MUTE(0x03);
379 pin_mux |= TWL4030_GPIO6_PWM0_MUTE(0x02);
380 twl_i2c_write_u8(TWL4030_MODULE_INTBR, pin_mux,
381 TWL4030_PMBR1_REG);
364 } 382 }
365 } 383 }
366 384