diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-09 10:22:06 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-09 10:22:06 -0500 |
commit | 57769541b4bb696bf69c3350ca09187e04ebe7d4 (patch) | |
tree | 817cc4323dbd0130478309949988b8c6a4df94ae | |
parent | ac0d9c9001ad1d2a37035cbefbf13f6022c52636 (diff) | |
parent | 5619d76dcbf56d560e235d33123e2850dd810227 (diff) |
Merge remote-tracking branch 'asoc/topic/da9055' into asoc-next
-rw-r--r-- | sound/soc/codecs/da9055.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c index f379b085c392..d3a6de2e757b 100644 --- a/sound/soc/codecs/da9055.c +++ b/sound/soc/codecs/da9055.c | |||
@@ -173,6 +173,7 @@ | |||
173 | #define DA9055_AIF_FORMAT_I2S_MODE (0 << 0) | 173 | #define DA9055_AIF_FORMAT_I2S_MODE (0 << 0) |
174 | #define DA9055_AIF_FORMAT_LEFT_J (1 << 0) | 174 | #define DA9055_AIF_FORMAT_LEFT_J (1 << 0) |
175 | #define DA9055_AIF_FORMAT_RIGHT_J (2 << 0) | 175 | #define DA9055_AIF_FORMAT_RIGHT_J (2 << 0) |
176 | #define DA9055_AIF_FORMAT_DSP (3 << 0) | ||
176 | #define DA9055_AIF_WORD_S16_LE (0 << 2) | 177 | #define DA9055_AIF_WORD_S16_LE (0 << 2) |
177 | #define DA9055_AIF_WORD_S20_3LE (1 << 2) | 178 | #define DA9055_AIF_WORD_S20_3LE (1 << 2) |
178 | #define DA9055_AIF_WORD_S24_LE (2 << 2) | 179 | #define DA9055_AIF_WORD_S24_LE (2 << 2) |
@@ -752,6 +753,17 @@ static const struct snd_kcontrol_new da9055_dapm_mixoutr_controls[] = { | |||
752 | 6, 1, 0), | 753 | 6, 1, 0), |
753 | }; | 754 | }; |
754 | 755 | ||
756 | /* Headphone Output Enable */ | ||
757 | static const struct snd_kcontrol_new da9055_dapm_hp_l_control = | ||
758 | SOC_DAPM_SINGLE("Switch", DA9055_HP_L_CTRL, 3, 1, 0); | ||
759 | |||
760 | static const struct snd_kcontrol_new da9055_dapm_hp_r_control = | ||
761 | SOC_DAPM_SINGLE("Switch", DA9055_HP_R_CTRL, 3, 1, 0); | ||
762 | |||
763 | /* Lineout Output Enable */ | ||
764 | static const struct snd_kcontrol_new da9055_dapm_lineout_control = | ||
765 | SOC_DAPM_SINGLE("Switch", DA9055_LINE_CTRL, 3, 1, 0); | ||
766 | |||
755 | /* DAPM widgets */ | 767 | /* DAPM widgets */ |
756 | static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = { | 768 | static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = { |
757 | /* Input Side */ | 769 | /* Input Side */ |
@@ -816,6 +828,14 @@ static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = { | |||
816 | &da9055_dapm_mixoutr_controls[0], | 828 | &da9055_dapm_mixoutr_controls[0], |
817 | ARRAY_SIZE(da9055_dapm_mixoutr_controls)), | 829 | ARRAY_SIZE(da9055_dapm_mixoutr_controls)), |
818 | 830 | ||
831 | /* Output Enable Switches */ | ||
832 | SND_SOC_DAPM_SWITCH("Headphone Left Enable", SND_SOC_NOPM, 0, 0, | ||
833 | &da9055_dapm_hp_l_control), | ||
834 | SND_SOC_DAPM_SWITCH("Headphone Right Enable", SND_SOC_NOPM, 0, 0, | ||
835 | &da9055_dapm_hp_r_control), | ||
836 | SND_SOC_DAPM_SWITCH("Lineout Enable", SND_SOC_NOPM, 0, 0, | ||
837 | &da9055_dapm_lineout_control), | ||
838 | |||
819 | /* Output PGAs */ | 839 | /* Output PGAs */ |
820 | SND_SOC_DAPM_PGA("MIXOUT Left", DA9055_MIXOUT_L_CTRL, 7, 0, NULL, 0), | 840 | SND_SOC_DAPM_PGA("MIXOUT Left", DA9055_MIXOUT_L_CTRL, 7, 0, NULL, 0), |
821 | SND_SOC_DAPM_PGA("MIXOUT Right", DA9055_MIXOUT_R_CTRL, 7, 0, NULL, 0), | 841 | SND_SOC_DAPM_PGA("MIXOUT Right", DA9055_MIXOUT_R_CTRL, 7, 0, NULL, 0), |
@@ -901,17 +921,20 @@ static const struct snd_soc_dapm_route da9055_audio_map[] = { | |||
901 | {"Out Mixer Right", "DAC Right Switch", "DAC Right"}, | 921 | {"Out Mixer Right", "DAC Right Switch", "DAC Right"}, |
902 | 922 | ||
903 | {"MIXOUT Left", NULL, "Out Mixer Left"}, | 923 | {"MIXOUT Left", NULL, "Out Mixer Left"}, |
904 | {"Headphone Left", NULL, "MIXOUT Left"}, | 924 | {"Headphone Left Enable", "Switch", "MIXOUT Left"}, |
925 | {"Headphone Left", NULL, "Headphone Left Enable"}, | ||
905 | {"Headphone Left", NULL, "Charge Pump"}, | 926 | {"Headphone Left", NULL, "Charge Pump"}, |
906 | {"HPL", NULL, "Headphone Left"}, | 927 | {"HPL", NULL, "Headphone Left"}, |
907 | 928 | ||
908 | {"MIXOUT Right", NULL, "Out Mixer Right"}, | 929 | {"MIXOUT Right", NULL, "Out Mixer Right"}, |
909 | {"Headphone Right", NULL, "MIXOUT Right"}, | 930 | {"Headphone Right Enable", "Switch", "MIXOUT Right"}, |
931 | {"Headphone Right", NULL, "Headphone Right Enable"}, | ||
910 | {"Headphone Right", NULL, "Charge Pump"}, | 932 | {"Headphone Right", NULL, "Charge Pump"}, |
911 | {"HPR", NULL, "Headphone Right"}, | 933 | {"HPR", NULL, "Headphone Right"}, |
912 | 934 | ||
913 | {"MIXOUT Right", NULL, "Out Mixer Right"}, | 935 | {"MIXOUT Right", NULL, "Out Mixer Right"}, |
914 | {"Lineout", NULL, "MIXOUT Right"}, | 936 | {"Lineout Enable", "Switch", "MIXOUT Right"}, |
937 | {"Lineout", NULL, "Lineout Enable"}, | ||
915 | {"LINE", NULL, "Lineout"}, | 938 | {"LINE", NULL, "Lineout"}, |
916 | }; | 939 | }; |
917 | 940 | ||
@@ -1175,6 +1198,9 @@ static int da9055_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
1175 | case SND_SOC_DAIFMT_RIGHT_J: | 1198 | case SND_SOC_DAIFMT_RIGHT_J: |
1176 | aif_ctrl = DA9055_AIF_FORMAT_RIGHT_J; | 1199 | aif_ctrl = DA9055_AIF_FORMAT_RIGHT_J; |
1177 | break; | 1200 | break; |
1201 | case SND_SOC_DAIFMT_DSP_A: | ||
1202 | aif_ctrl = DA9055_AIF_FORMAT_DSP; | ||
1203 | break; | ||
1178 | default: | 1204 | default: |
1179 | return -EINVAL; | 1205 | return -EINVAL; |
1180 | } | 1206 | } |
@@ -1390,8 +1416,7 @@ static int da9055_probe(struct snd_soc_codec *codec) | |||
1390 | DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN); | 1416 | DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN); |
1391 | 1417 | ||
1392 | /* | 1418 | /* |
1393 | * There are two separate control bits for input and output mixers as | 1419 | * There are two separate control bits for input and output mixers. |
1394 | * well as headphone and line outs. | ||
1395 | * One to enable corresponding amplifier and other to enable its | 1420 | * One to enable corresponding amplifier and other to enable its |
1396 | * output. As amplifier bits are related to power control, they are | 1421 | * output. As amplifier bits are related to power control, they are |
1397 | * being managed by DAPM while other (non power related) bits are | 1422 | * being managed by DAPM while other (non power related) bits are |
@@ -1407,14 +1432,6 @@ static int da9055_probe(struct snd_soc_codec *codec) | |||
1407 | snd_soc_update_bits(codec, DA9055_MIXOUT_R_CTRL, | 1432 | snd_soc_update_bits(codec, DA9055_MIXOUT_R_CTRL, |
1408 | DA9055_MIXOUT_R_MIX_EN, DA9055_MIXOUT_R_MIX_EN); | 1433 | DA9055_MIXOUT_R_MIX_EN, DA9055_MIXOUT_R_MIX_EN); |
1409 | 1434 | ||
1410 | snd_soc_update_bits(codec, DA9055_HP_L_CTRL, | ||
1411 | DA9055_HP_L_AMP_OE, DA9055_HP_L_AMP_OE); | ||
1412 | snd_soc_update_bits(codec, DA9055_HP_R_CTRL, | ||
1413 | DA9055_HP_R_AMP_OE, DA9055_HP_R_AMP_OE); | ||
1414 | |||
1415 | snd_soc_update_bits(codec, DA9055_LINE_CTRL, | ||
1416 | DA9055_LINE_AMP_OE, DA9055_LINE_AMP_OE); | ||
1417 | |||
1418 | /* Set this as per your system configuration */ | 1435 | /* Set this as per your system configuration */ |
1419 | snd_soc_write(codec, DA9055_PLL_CTRL, DA9055_PLL_INDIV_10_20_MHZ); | 1436 | snd_soc_write(codec, DA9055_PLL_CTRL, DA9055_PLL_INDIV_10_20_MHZ); |
1420 | 1437 | ||