aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-07-21 09:01:07 -0400
committerTakashi Iwai <tiwai@suse.de>2010-07-21 09:01:07 -0400
commit49e704279953b652ec6adc7f5dec412ad118a938 (patch)
tree865cdc6736066e0caceb1dc199f30b19d69e8d28 /sound
parentd1ce6b200cba6bfd76e17e327b5052aa76a46abf (diff)
parent01ea6ba2bce64112623dbf8c45ce487062b65446 (diff)
Merge branch 'for-2.6.36' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6 into topic/asoc
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/twl4030.c47
-rw-r--r--sound/soc/codecs/twl4030.h1
-rw-r--r--sound/soc/codecs/twl6040.c56
3 files changed, 63 insertions, 41 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 8d36bfa20552..bd557c2bcb8c 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -143,6 +143,9 @@ struct twl4030_priv {
143 u8 earpiece_enabled; 143 u8 earpiece_enabled;
144 u8 predrivel_enabled, predriver_enabled; 144 u8 predrivel_enabled, predriver_enabled;
145 u8 carkitl_enabled, carkitr_enabled; 145 u8 carkitl_enabled, carkitr_enabled;
146
147 /* Delay needed after enabling the digimic interface */
148 unsigned int digimic_delay;
146}; 149};
147 150
148/* 151/*
@@ -312,6 +315,8 @@ static void twl4030_init_chip(struct platform_device *pdev)
312 if (!setup) 315 if (!setup)
313 return; 316 return;
314 317
318 twl4030->digimic_delay = setup->digimic_delay;
319
315 /* Configuration for headset ramp delay from setup data */ 320 /* Configuration for headset ramp delay from setup data */
316 if (setup->sysclk != twl4030->sysclk) 321 if (setup->sysclk != twl4030->sysclk)
317 dev_warn(codec->dev, 322 dev_warn(codec->dev,
@@ -540,10 +545,11 @@ static const struct snd_kcontrol_new twl4030_dapm_abypassl2_control =
540static const struct snd_kcontrol_new twl4030_dapm_abypassv_control = 545static const struct snd_kcontrol_new twl4030_dapm_abypassv_control =
541 SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0); 546 SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0);
542 547
543/* Digital bypass gain, 0 mutes the bypass */ 548/* Digital bypass gain, mute instead of -30dB */
544static const unsigned int twl4030_dapm_dbypass_tlv[] = { 549static const unsigned int twl4030_dapm_dbypass_tlv[] = {
545 TLV_DB_RANGE_HEAD(2), 550 TLV_DB_RANGE_HEAD(3),
546 0, 3, TLV_DB_SCALE_ITEM(-2400, 0, 1), 551 0, 1, TLV_DB_SCALE_ITEM(-3000, 600, 1),
552 2, 3, TLV_DB_SCALE_ITEM(-2400, 0, 0),
547 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0), 553 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0),
548}; 554};
549 555
@@ -854,6 +860,16 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w,
854 return 0; 860 return 0;
855} 861}
856 862
863static int digimic_event(struct snd_soc_dapm_widget *w,
864 struct snd_kcontrol *kcontrol, int event)
865{
866 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
867
868 if (twl4030->digimic_delay)
869 mdelay(twl4030->digimic_delay);
870 return 0;
871}
872
857/* 873/*
858 * Some of the gain controls in TWL (mostly those which are associated with 874 * Some of the gain controls in TWL (mostly those which are associated with
859 * the outputs) are implemented in an interesting way: 875 * the outputs) are implemented in an interesting way:
@@ -1438,10 +1454,12 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1438 SND_SOC_DAPM_PGA("ADC Physical Right", 1454 SND_SOC_DAPM_PGA("ADC Physical Right",
1439 TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0), 1455 TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0),
1440 1456
1441 SND_SOC_DAPM_PGA("Digimic0 Enable", 1457 SND_SOC_DAPM_PGA_E("Digimic0 Enable",
1442 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), 1458 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0,
1443 SND_SOC_DAPM_PGA("Digimic1 Enable", 1459 digimic_event, SND_SOC_DAPM_POST_PMU),
1444 TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0), 1460 SND_SOC_DAPM_PGA_E("Digimic1 Enable",
1461 TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0,
1462 digimic_event, SND_SOC_DAPM_POST_PMU),
1445 1463
1446 SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0), 1464 SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0),
1447 SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0), 1465 SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0),
@@ -1459,8 +1477,11 @@ static const struct snd_soc_dapm_route intercon[] = {
1459 /* Supply for the digital part (APLL) */ 1477 /* Supply for the digital part (APLL) */
1460 {"Digital Voice Playback Mixer", NULL, "APLL Enable"}, 1478 {"Digital Voice Playback Mixer", NULL, "APLL Enable"},
1461 1479
1462 {"Digital R1 Playback Mixer", NULL, "AIF Enable"}, 1480 {"DAC Left1", NULL, "AIF Enable"},
1463 {"Digital L1 Playback Mixer", NULL, "AIF Enable"}, 1481 {"DAC Right1", NULL, "AIF Enable"},
1482 {"DAC Left2", NULL, "AIF Enable"},
1483 {"DAC Right1", NULL, "AIF Enable"},
1484
1464 {"Digital R2 Playback Mixer", NULL, "AIF Enable"}, 1485 {"Digital R2 Playback Mixer", NULL, "AIF Enable"},
1465 {"Digital L2 Playback Mixer", NULL, "AIF Enable"}, 1486 {"Digital L2 Playback Mixer", NULL, "AIF Enable"},
1466 1487
@@ -1531,10 +1552,10 @@ static const struct snd_soc_dapm_route intercon[] = {
1531 1552
1532 /* outputs */ 1553 /* outputs */
1533 /* Must be always connected (for AIF and APLL) */ 1554 /* Must be always connected (for AIF and APLL) */
1534 {"Virtual HiFi OUT", NULL, "Digital L1 Playback Mixer"}, 1555 {"Virtual HiFi OUT", NULL, "DAC Left1"},
1535 {"Virtual HiFi OUT", NULL, "Digital R1 Playback Mixer"}, 1556 {"Virtual HiFi OUT", NULL, "DAC Right1"},
1536 {"Virtual HiFi OUT", NULL, "Digital L2 Playback Mixer"}, 1557 {"Virtual HiFi OUT", NULL, "DAC Left2"},
1537 {"Virtual HiFi OUT", NULL, "Digital R2 Playback Mixer"}, 1558 {"Virtual HiFi OUT", NULL, "DAC Right2"},
1538 /* Must be always connected (for APLL) */ 1559 /* Must be always connected (for APLL) */
1539 {"Virtual Voice OUT", NULL, "Digital Voice Playback Mixer"}, 1560 {"Virtual Voice OUT", NULL, "Digital Voice Playback Mixer"},
1540 /* Physical outputs */ 1561 /* Physical outputs */
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index 788e3d125099..6c57430f6e24 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -41,6 +41,7 @@ extern struct snd_soc_codec_device soc_codec_dev_twl4030;
41 41
42struct twl4030_setup_data { 42struct twl4030_setup_data {
43 unsigned int ramp_delay_value; 43 unsigned int ramp_delay_value;
44 unsigned int digimic_delay; /* in ms */
44 unsigned int sysclk; 45 unsigned int sysclk;
45 unsigned int offset_cncl_path; 46 unsigned int offset_cncl_path;
46 unsigned int check_defaults:1; 47 unsigned int check_defaults:1;
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 85dd4fb4c681..64a807f1a8a1 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -360,6 +360,13 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf)
360 return 0; 360 return 0;
361} 361}
362 362
363static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w,
364 struct snd_kcontrol *kcontrol, int event)
365{
366 msleep(1);
367 return 0;
368}
369
363static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w, 370static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w,
364 struct snd_kcontrol *kcontrol, int event) 371 struct snd_kcontrol *kcontrol, int event)
365{ 372{
@@ -371,6 +378,8 @@ static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w,
371 else 378 else
372 priv->non_lp--; 379 priv->non_lp--;
373 380
381 msleep(1);
382
374 return 0; 383 return 0;
375} 384}
376 385
@@ -471,20 +480,6 @@ static const struct snd_kcontrol_new hfdacl_switch_controls =
471static const struct snd_kcontrol_new hfdacr_switch_controls = 480static const struct snd_kcontrol_new hfdacr_switch_controls =
472 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 2, 1, 0); 481 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 2, 1, 0);
473 482
474/* Headset driver switches */
475static const struct snd_kcontrol_new hsl_driver_switch_controls =
476 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HSLCTL, 2, 1, 0);
477
478static const struct snd_kcontrol_new hsr_driver_switch_controls =
479 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HSRCTL, 2, 1, 0);
480
481/* Handsfree driver switches */
482static const struct snd_kcontrol_new hfl_driver_switch_controls =
483 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 4, 1, 0);
484
485static const struct snd_kcontrol_new hfr_driver_switch_controls =
486 SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 4, 1, 0);
487
488static const struct snd_kcontrol_new ep_driver_switch_controls = 483static const struct snd_kcontrol_new ep_driver_switch_controls =
489 SOC_DAPM_SINGLE("Switch", TWL6040_REG_EARCTL, 0, 1, 0); 484 SOC_DAPM_SINGLE("Switch", TWL6040_REG_EARCTL, 0, 1, 0);
490 485
@@ -548,10 +543,14 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {
548 TWL6040_REG_DMICBCTL, 4, 0), 543 TWL6040_REG_DMICBCTL, 4, 0),
549 544
550 /* DACs */ 545 /* DACs */
551 SND_SOC_DAPM_DAC("HSDAC Left", "Headset Playback", 546 SND_SOC_DAPM_DAC_E("HSDAC Left", "Headset Playback",
552 TWL6040_REG_HSLCTL, 0, 0), 547 TWL6040_REG_HSLCTL, 0, 0,
553 SND_SOC_DAPM_DAC("HSDAC Right", "Headset Playback", 548 twl6040_hs_dac_event,
554 TWL6040_REG_HSRCTL, 0, 0), 549 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
550 SND_SOC_DAPM_DAC_E("HSDAC Right", "Headset Playback",
551 TWL6040_REG_HSRCTL, 0, 0,
552 twl6040_hs_dac_event,
553 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
555 SND_SOC_DAPM_DAC_E("HFDAC Left", "Handsfree Playback", 554 SND_SOC_DAPM_DAC_E("HFDAC Left", "Handsfree Playback",
556 TWL6040_REG_HFLCTL, 0, 0, 555 TWL6040_REG_HFLCTL, 0, 0,
557 twl6040_power_mode_event, 556 twl6040_power_mode_event,
@@ -571,18 +570,19 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {
571 SND_SOC_DAPM_SWITCH("HFDAC Right Playback", 570 SND_SOC_DAPM_SWITCH("HFDAC Right Playback",
572 SND_SOC_NOPM, 0, 0, &hfdacr_switch_controls), 571 SND_SOC_NOPM, 0, 0, &hfdacr_switch_controls),
573 572
574 SND_SOC_DAPM_SWITCH("Headset Left Driver", 573 /* Analog playback drivers */
575 SND_SOC_NOPM, 0, 0, &hsl_driver_switch_controls), 574 SND_SOC_DAPM_PGA_E("Handsfree Left Driver",
576 SND_SOC_DAPM_SWITCH("Headset Right Driver", 575 TWL6040_REG_HFLCTL, 4, 0, NULL, 0,
577 SND_SOC_NOPM, 0, 0, &hsr_driver_switch_controls),
578 SND_SOC_DAPM_SWITCH_E("Handsfree Left Driver",
579 SND_SOC_NOPM, 0, 0, &hfl_driver_switch_controls,
580 twl6040_power_mode_event, 576 twl6040_power_mode_event,
581 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 577 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
582 SND_SOC_DAPM_SWITCH_E("Handsfree Right Driver", 578 SND_SOC_DAPM_PGA_E("Handsfree Right Driver",
583 SND_SOC_NOPM, 0, 0, &hfr_driver_switch_controls, 579 TWL6040_REG_HFRCTL, 4, 0, NULL, 0,
584 twl6040_power_mode_event, 580 twl6040_power_mode_event,
585 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 581 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
582 SND_SOC_DAPM_PGA("Headset Left Driver",
583 TWL6040_REG_HSLCTL, 2, 0, NULL, 0),
584 SND_SOC_DAPM_PGA("Headset Right Driver",
585 TWL6040_REG_HSRCTL, 2, 0, NULL, 0),
586 SND_SOC_DAPM_SWITCH_E("Earphone Driver", 586 SND_SOC_DAPM_SWITCH_E("Earphone Driver",
587 SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls, 587 SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls,
588 twl6040_power_mode_event, 588 twl6040_power_mode_event,
@@ -616,8 +616,8 @@ static const struct snd_soc_dapm_route intercon[] = {
616 {"HSDAC Left Playback", "Switch", "HSDAC Left"}, 616 {"HSDAC Left Playback", "Switch", "HSDAC Left"},
617 {"HSDAC Right Playback", "Switch", "HSDAC Right"}, 617 {"HSDAC Right Playback", "Switch", "HSDAC Right"},
618 618
619 {"Headset Left Driver", "Switch", "HSDAC Left Playback"}, 619 {"Headset Left Driver", NULL, "HSDAC Left Playback"},
620 {"Headset Right Driver", "Switch", "HSDAC Right Playback"}, 620 {"Headset Right Driver", NULL, "HSDAC Right Playback"},
621 621
622 {"HSOL", NULL, "Headset Left Driver"}, 622 {"HSOL", NULL, "Headset Left Driver"},
623 {"HSOR", NULL, "Headset Right Driver"}, 623 {"HSOR", NULL, "Headset Right Driver"},