aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Chavan <ashish.chavan@kpitcummins.com>2012-10-11 07:01:05 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-17 09:57:43 -0400
commit5619d76dcbf56d560e235d33123e2850dd810227 (patch)
treed9ed4a03adc8021f61f5fafa184783f37041bd4a
parent5e82aaa751180e43326747483396bdf381e702de (diff)
ASoC: da9055: DAPMise Headphone and Lineout enable controls
This patch DAPMises headphone and lineout output enable controls. Earlier these output enable bits were permanently turned on in probe. In da9055 codec, right outmixer is directly connected with right HP and Line out. This resulted in two side effects, (1) When you only want to use lineout, right HP (and connected charge pump) also gets enabled (2) When you only want to use stereo HP, lineout also gets enabled This patch adds three switches to select which output(s) should be enabled. Signed-off-by: Ashish Chavan <ashish.chavan@kpitcummins.com> Signed-off-by: David Dajun Chen <david.chen@diasemi.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/da9055.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index 27c44547b829..7ffe765e7b2a 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -733,6 +733,17 @@ static const struct snd_kcontrol_new da9055_dapm_mixoutr_controls[] = {
733 6, 1, 0), 733 6, 1, 0),
734}; 734};
735 735
736/* Headphone Output Enable */
737static const struct snd_kcontrol_new da9055_dapm_hp_l_control =
738SOC_DAPM_SINGLE("Switch", DA9055_HP_L_CTRL, 3, 1, 0);
739
740static const struct snd_kcontrol_new da9055_dapm_hp_r_control =
741SOC_DAPM_SINGLE("Switch", DA9055_HP_R_CTRL, 3, 1, 0);
742
743/* Lineout Output Enable */
744static const struct snd_kcontrol_new da9055_dapm_lineout_control =
745SOC_DAPM_SINGLE("Switch", DA9055_LINE_CTRL, 3, 1, 0);
746
736/* DAPM widgets */ 747/* DAPM widgets */
737static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = { 748static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = {
738 /* Input Side */ 749 /* Input Side */
@@ -797,6 +808,14 @@ static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = {
797 &da9055_dapm_mixoutr_controls[0], 808 &da9055_dapm_mixoutr_controls[0],
798 ARRAY_SIZE(da9055_dapm_mixoutr_controls)), 809 ARRAY_SIZE(da9055_dapm_mixoutr_controls)),
799 810
811 /* Output Enable Switches */
812 SND_SOC_DAPM_SWITCH("Headphone Left Enable", SND_SOC_NOPM, 0, 0,
813 &da9055_dapm_hp_l_control),
814 SND_SOC_DAPM_SWITCH("Headphone Right Enable", SND_SOC_NOPM, 0, 0,
815 &da9055_dapm_hp_r_control),
816 SND_SOC_DAPM_SWITCH("Lineout Enable", SND_SOC_NOPM, 0, 0,
817 &da9055_dapm_lineout_control),
818
800 /* Output PGAs */ 819 /* Output PGAs */
801 SND_SOC_DAPM_PGA("MIXOUT Left", DA9055_MIXOUT_L_CTRL, 7, 0, NULL, 0), 820 SND_SOC_DAPM_PGA("MIXOUT Left", DA9055_MIXOUT_L_CTRL, 7, 0, NULL, 0),
802 SND_SOC_DAPM_PGA("MIXOUT Right", DA9055_MIXOUT_R_CTRL, 7, 0, NULL, 0), 821 SND_SOC_DAPM_PGA("MIXOUT Right", DA9055_MIXOUT_R_CTRL, 7, 0, NULL, 0),
@@ -882,17 +901,20 @@ static const struct snd_soc_dapm_route da9055_audio_map[] = {
882 {"Out Mixer Right", "DAC Right Switch", "DAC Right"}, 901 {"Out Mixer Right", "DAC Right Switch", "DAC Right"},
883 902
884 {"MIXOUT Left", NULL, "Out Mixer Left"}, 903 {"MIXOUT Left", NULL, "Out Mixer Left"},
885 {"Headphone Left", NULL, "MIXOUT Left"}, 904 {"Headphone Left Enable", "Switch", "MIXOUT Left"},
905 {"Headphone Left", NULL, "Headphone Left Enable"},
886 {"Headphone Left", NULL, "Charge Pump"}, 906 {"Headphone Left", NULL, "Charge Pump"},
887 {"HPL", NULL, "Headphone Left"}, 907 {"HPL", NULL, "Headphone Left"},
888 908
889 {"MIXOUT Right", NULL, "Out Mixer Right"}, 909 {"MIXOUT Right", NULL, "Out Mixer Right"},
890 {"Headphone Right", NULL, "MIXOUT Right"}, 910 {"Headphone Right Enable", "Switch", "MIXOUT Right"},
911 {"Headphone Right", NULL, "Headphone Right Enable"},
891 {"Headphone Right", NULL, "Charge Pump"}, 912 {"Headphone Right", NULL, "Charge Pump"},
892 {"HPR", NULL, "Headphone Right"}, 913 {"HPR", NULL, "Headphone Right"},
893 914
894 {"MIXOUT Right", NULL, "Out Mixer Right"}, 915 {"MIXOUT Right", NULL, "Out Mixer Right"},
895 {"Lineout", NULL, "MIXOUT Right"}, 916 {"Lineout Enable", "Switch", "MIXOUT Right"},
917 {"Lineout", NULL, "Lineout Enable"},
896 {"LINE", NULL, "Lineout"}, 918 {"LINE", NULL, "Lineout"},
897}; 919};
898 920
@@ -1374,8 +1396,7 @@ static int da9055_probe(struct snd_soc_codec *codec)
1374 DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN); 1396 DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN);
1375 1397
1376 /* 1398 /*
1377 * There are two separate control bits for input and output mixers as 1399 * There are two separate control bits for input and output mixers.
1378 * well as headphone and line outs.
1379 * One to enable corresponding amplifier and other to enable its 1400 * One to enable corresponding amplifier and other to enable its
1380 * output. As amplifier bits are related to power control, they are 1401 * output. As amplifier bits are related to power control, they are
1381 * being managed by DAPM while other (non power related) bits are 1402 * being managed by DAPM while other (non power related) bits are
@@ -1391,14 +1412,6 @@ static int da9055_probe(struct snd_soc_codec *codec)
1391 snd_soc_update_bits(codec, DA9055_MIXOUT_R_CTRL, 1412 snd_soc_update_bits(codec, DA9055_MIXOUT_R_CTRL,
1392 DA9055_MIXOUT_R_MIX_EN, DA9055_MIXOUT_R_MIX_EN); 1413 DA9055_MIXOUT_R_MIX_EN, DA9055_MIXOUT_R_MIX_EN);
1393 1414
1394 snd_soc_update_bits(codec, DA9055_HP_L_CTRL,
1395 DA9055_HP_L_AMP_OE, DA9055_HP_L_AMP_OE);
1396 snd_soc_update_bits(codec, DA9055_HP_R_CTRL,
1397 DA9055_HP_R_AMP_OE, DA9055_HP_R_AMP_OE);
1398
1399 snd_soc_update_bits(codec, DA9055_LINE_CTRL,
1400 DA9055_LINE_AMP_OE, DA9055_LINE_AMP_OE);
1401
1402 /* Set this as per your system configuration */ 1415 /* Set this as per your system configuration */
1403 snd_soc_write(codec, DA9055_PLL_CTRL, DA9055_PLL_INDIV_10_20_MHZ); 1416 snd_soc_write(codec, DA9055_PLL_CTRL, DA9055_PLL_INDIV_10_20_MHZ);
1404 1417