diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 11:52:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 11:52:38 -0400 |
commit | 710421cc7d295cc59eb2676fe2ba3bc3252c124e (patch) | |
tree | 4aa11cd7ee64b394871195cb585f16700553f540 /sound/soc/codecs/max98088.c | |
parent | d7ef64a9f9987b29e3d911369a9d40122d5be2dd (diff) | |
parent | f686c74cc3e78349d16d46fc72807354574b1516 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (346 commits)
ASoC: core: Don't set "(null)" as a driver name
ALSA: hda - Use LPIB for ATI/AMD chipsets as default
Revert "ALSA: hda - Use position_fix=3 as default for AMD chipsets"
ASoC: Tegra: Fix compile when debugfs not enabled
ASoC: spdif-dit: Add missing MODULE_*
SOUND: OSS: Remove Au1550 driver.
ALSA: hda - add Intel Panther Point HDMI codec id
ALSA: emu10k1 - Add dB range to Bass and Treble for SB Live!
ALSA: hda - Remove PCM mixer elements from Virtual Master of realtek
ALSA: hda - Fix input-src parse in patch_analog.c
ASoC: davinci-mcasp: enable ping-pong SRAM buffers
ASoC: add iPAQ hx4700 machine driver
ASoC: Asahi Kasei AK4641 codec driver
ALSA: hda - Enable Realtek ALC269 codec input layer beep
ALSA: intel8x0m: enable AMD8111 modem
ALSA: HDA: Add jack detection for HDMI
ALSA: sound, core, pcm_lib: fix xrun_log
ASoC: Max98095: Move existing NULL check before pointer dereference.
ALSA: sound, core, pcm_lib: xrun_log: log also in_interrupt
ALSA: usb-audio - Add support for USB X-Fi S51 Pro
...
Diffstat (limited to 'sound/soc/codecs/max98088.c')
-rw-r--r-- | sound/soc/codecs/max98088.c | 87 |
1 files changed, 52 insertions, 35 deletions
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index bd0517cb7980..4173b67c94d1 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
@@ -656,8 +656,6 @@ static const struct soc_enum max98088_exmode_enum = | |||
656 | ARRAY_SIZE(max98088_exmode_texts), | 656 | ARRAY_SIZE(max98088_exmode_texts), |
657 | max98088_exmode_texts, | 657 | max98088_exmode_texts, |
658 | max98088_exmode_values); | 658 | max98088_exmode_values); |
659 | static const struct snd_kcontrol_new max98088_exmode_controls = | ||
660 | SOC_DAPM_VALUE_ENUM("Route", max98088_exmode_enum); | ||
661 | 659 | ||
662 | static const char *max98088_ex_thresh[] = { /* volts PP */ | 660 | static const char *max98088_ex_thresh[] = { /* volts PP */ |
663 | "0.6", "1.2", "1.8", "2.4", "3.0", "3.6", "4.2", "4.8"}; | 661 | "0.6", "1.2", "1.8", "2.4", "3.0", "3.6", "4.2", "4.8"}; |
@@ -783,6 +781,7 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { | |||
783 | SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), | 781 | SOC_SINGLE("EQ1 Switch", M98088_REG_49_CFG_LEVEL, 0, 1, 0), |
784 | SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), | 782 | SOC_SINGLE("EQ2 Switch", M98088_REG_49_CFG_LEVEL, 1, 1, 0), |
785 | 783 | ||
784 | SOC_ENUM("EX Limiter Mode", max98088_exmode_enum), | ||
786 | SOC_ENUM("EX Limiter Threshold", max98088_ex_thresh_enum), | 785 | SOC_ENUM("EX Limiter Threshold", max98088_ex_thresh_enum), |
787 | 786 | ||
788 | SOC_ENUM("DAI1 Filter Mode", max98088_filter_mode_enum), | 787 | SOC_ENUM("DAI1 Filter Mode", max98088_filter_mode_enum), |
@@ -808,10 +807,10 @@ static const struct snd_kcontrol_new max98088_snd_controls[] = { | |||
808 | 807 | ||
809 | /* Left speaker mixer switch */ | 808 | /* Left speaker mixer switch */ |
810 | static const struct snd_kcontrol_new max98088_left_speaker_mixer_controls[] = { | 809 | static const struct snd_kcontrol_new max98088_left_speaker_mixer_controls[] = { |
811 | SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0), | 810 | SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0), |
812 | SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0), | 811 | SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0), |
813 | SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0), | 812 | SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0), |
814 | SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 0, 1, 0), | 813 | SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 7, 1, 0), |
815 | SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 5, 1, 0), | 814 | SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 5, 1, 0), |
816 | SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 6, 1, 0), | 815 | SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_2B_MIX_SPK_LEFT, 6, 1, 0), |
817 | SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 1, 1, 0), | 816 | SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_2B_MIX_SPK_LEFT, 1, 1, 0), |
@@ -836,10 +835,10 @@ static const struct snd_kcontrol_new max98088_right_speaker_mixer_controls[] = { | |||
836 | 835 | ||
837 | /* Left headphone mixer switch */ | 836 | /* Left headphone mixer switch */ |
838 | static const struct snd_kcontrol_new max98088_left_hp_mixer_controls[] = { | 837 | static const struct snd_kcontrol_new max98088_left_hp_mixer_controls[] = { |
839 | SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0), | 838 | SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0), |
840 | SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0), | 839 | SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0), |
841 | SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0), | 840 | SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0), |
842 | SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 0, 1, 0), | 841 | SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_25_MIX_HP_LEFT, 7, 1, 0), |
843 | SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_25_MIX_HP_LEFT, 5, 1, 0), | 842 | SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_25_MIX_HP_LEFT, 5, 1, 0), |
844 | SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_25_MIX_HP_LEFT, 6, 1, 0), | 843 | SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_25_MIX_HP_LEFT, 6, 1, 0), |
845 | SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_25_MIX_HP_LEFT, 1, 1, 0), | 844 | SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_25_MIX_HP_LEFT, 1, 1, 0), |
@@ -864,10 +863,10 @@ static const struct snd_kcontrol_new max98088_right_hp_mixer_controls[] = { | |||
864 | 863 | ||
865 | /* Left earpiece/receiver mixer switch */ | 864 | /* Left earpiece/receiver mixer switch */ |
866 | static const struct snd_kcontrol_new max98088_left_rec_mixer_controls[] = { | 865 | static const struct snd_kcontrol_new max98088_left_rec_mixer_controls[] = { |
867 | SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0), | 866 | SOC_DAPM_SINGLE("Left DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0), |
868 | SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0), | 867 | SOC_DAPM_SINGLE("Right DAC1 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0), |
869 | SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0), | 868 | SOC_DAPM_SINGLE("Left DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0), |
870 | SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 0, 1, 0), | 869 | SOC_DAPM_SINGLE("Right DAC2 Switch", M98088_REG_28_MIX_REC_LEFT, 7, 1, 0), |
871 | SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_28_MIX_REC_LEFT, 5, 1, 0), | 870 | SOC_DAPM_SINGLE("MIC1 Switch", M98088_REG_28_MIX_REC_LEFT, 5, 1, 0), |
872 | SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_28_MIX_REC_LEFT, 6, 1, 0), | 871 | SOC_DAPM_SINGLE("MIC2 Switch", M98088_REG_28_MIX_REC_LEFT, 6, 1, 0), |
873 | SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_28_MIX_REC_LEFT, 1, 1, 0), | 872 | SOC_DAPM_SINGLE("INA1 Switch", M98088_REG_28_MIX_REC_LEFT, 1, 1, 0), |
@@ -1094,9 +1093,6 @@ static const struct snd_soc_dapm_widget max98088_dapm_widgets[] = { | |||
1094 | 1093 | ||
1095 | SND_SOC_DAPM_MICBIAS("MICBIAS", M98088_REG_4C_PWR_EN_IN, 3, 0), | 1094 | SND_SOC_DAPM_MICBIAS("MICBIAS", M98088_REG_4C_PWR_EN_IN, 3, 0), |
1096 | 1095 | ||
1097 | SND_SOC_DAPM_MUX("EX Limiter Mode", SND_SOC_NOPM, 0, 0, | ||
1098 | &max98088_exmode_controls), | ||
1099 | |||
1100 | SND_SOC_DAPM_OUTPUT("HPL"), | 1096 | SND_SOC_DAPM_OUTPUT("HPL"), |
1101 | SND_SOC_DAPM_OUTPUT("HPR"), | 1097 | SND_SOC_DAPM_OUTPUT("HPR"), |
1102 | SND_SOC_DAPM_OUTPUT("SPKL"), | 1098 | SND_SOC_DAPM_OUTPUT("SPKL"), |
@@ -1112,7 +1108,7 @@ static const struct snd_soc_dapm_widget max98088_dapm_widgets[] = { | |||
1112 | SND_SOC_DAPM_INPUT("INB2"), | 1108 | SND_SOC_DAPM_INPUT("INB2"), |
1113 | }; | 1109 | }; |
1114 | 1110 | ||
1115 | static const struct snd_soc_dapm_route audio_map[] = { | 1111 | static const struct snd_soc_dapm_route max98088_audio_map[] = { |
1116 | /* Left headphone output mixer */ | 1112 | /* Left headphone output mixer */ |
1117 | {"Left HP Mixer", "Left DAC1 Switch", "DACL1"}, | 1113 | {"Left HP Mixer", "Left DAC1 Switch", "DACL1"}, |
1118 | {"Left HP Mixer", "Left DAC2 Switch", "DACL2"}, | 1114 | {"Left HP Mixer", "Left DAC2 Switch", "DACL2"}, |
@@ -1226,22 +1222,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
1226 | {"MIC2 Input", NULL, "MIC2"}, | 1222 | {"MIC2 Input", NULL, "MIC2"}, |
1227 | }; | 1223 | }; |
1228 | 1224 | ||
1229 | static int max98088_add_widgets(struct snd_soc_codec *codec) | ||
1230 | { | ||
1231 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
1232 | |||
1233 | snd_soc_dapm_new_controls(dapm, max98088_dapm_widgets, | ||
1234 | ARRAY_SIZE(max98088_dapm_widgets)); | ||
1235 | |||
1236 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
1237 | |||
1238 | snd_soc_add_controls(codec, max98088_snd_controls, | ||
1239 | ARRAY_SIZE(max98088_snd_controls)); | ||
1240 | |||
1241 | snd_soc_dapm_new_widgets(dapm); | ||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1245 | /* codec mclk clock divider coefficients */ | 1225 | /* codec mclk clock divider coefficients */ |
1246 | static const struct { | 1226 | static const struct { |
1247 | u32 rate; | 1227 | u32 rate; |
@@ -1586,6 +1566,36 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai, | |||
1586 | return 0; | 1566 | return 0; |
1587 | } | 1567 | } |
1588 | 1568 | ||
1569 | static int max98088_dai1_digital_mute(struct snd_soc_dai *codec_dai, int mute) | ||
1570 | { | ||
1571 | struct snd_soc_codec *codec = codec_dai->codec; | ||
1572 | int reg; | ||
1573 | |||
1574 | if (mute) | ||
1575 | reg = M98088_DAI_MUTE; | ||
1576 | else | ||
1577 | reg = 0; | ||
1578 | |||
1579 | snd_soc_update_bits(codec, M98088_REG_2F_LVL_DAI1_PLAY, | ||
1580 | M98088_DAI_MUTE_MASK, reg); | ||
1581 | return 0; | ||
1582 | } | ||
1583 | |||
1584 | static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int mute) | ||
1585 | { | ||
1586 | struct snd_soc_codec *codec = codec_dai->codec; | ||
1587 | int reg; | ||
1588 | |||
1589 | if (mute) | ||
1590 | reg = M98088_DAI_MUTE; | ||
1591 | else | ||
1592 | reg = 0; | ||
1593 | |||
1594 | snd_soc_update_bits(codec, M98088_REG_31_LVL_DAI2_PLAY, | ||
1595 | M98088_DAI_MUTE_MASK, reg); | ||
1596 | return 0; | ||
1597 | } | ||
1598 | |||
1589 | static void max98088_sync_cache(struct snd_soc_codec *codec) | 1599 | static void max98088_sync_cache(struct snd_soc_codec *codec) |
1590 | { | 1600 | { |
1591 | u16 *reg_cache = codec->reg_cache; | 1601 | u16 *reg_cache = codec->reg_cache; |
@@ -1647,12 +1657,14 @@ static struct snd_soc_dai_ops max98088_dai1_ops = { | |||
1647 | .set_sysclk = max98088_dai_set_sysclk, | 1657 | .set_sysclk = max98088_dai_set_sysclk, |
1648 | .set_fmt = max98088_dai1_set_fmt, | 1658 | .set_fmt = max98088_dai1_set_fmt, |
1649 | .hw_params = max98088_dai1_hw_params, | 1659 | .hw_params = max98088_dai1_hw_params, |
1660 | .digital_mute = max98088_dai1_digital_mute, | ||
1650 | }; | 1661 | }; |
1651 | 1662 | ||
1652 | static struct snd_soc_dai_ops max98088_dai2_ops = { | 1663 | static struct snd_soc_dai_ops max98088_dai2_ops = { |
1653 | .set_sysclk = max98088_dai_set_sysclk, | 1664 | .set_sysclk = max98088_dai_set_sysclk, |
1654 | .set_fmt = max98088_dai2_set_fmt, | 1665 | .set_fmt = max98088_dai2_set_fmt, |
1655 | .hw_params = max98088_dai2_hw_params, | 1666 | .hw_params = max98088_dai2_hw_params, |
1667 | .digital_mute = max98088_dai2_digital_mute, | ||
1656 | }; | 1668 | }; |
1657 | 1669 | ||
1658 | static struct snd_soc_dai_driver max98088_dai[] = { | 1670 | static struct snd_soc_dai_driver max98088_dai[] = { |
@@ -2010,7 +2022,8 @@ static int max98088_probe(struct snd_soc_codec *codec) | |||
2010 | 2022 | ||
2011 | max98088_handle_pdata(codec); | 2023 | max98088_handle_pdata(codec); |
2012 | 2024 | ||
2013 | max98088_add_widgets(codec); | 2025 | snd_soc_add_controls(codec, max98088_snd_controls, |
2026 | ARRAY_SIZE(max98088_snd_controls)); | ||
2014 | 2027 | ||
2015 | err_access: | 2028 | err_access: |
2016 | return ret; | 2029 | return ret; |
@@ -2036,6 +2049,10 @@ static struct snd_soc_codec_driver soc_codec_dev_max98088 = { | |||
2036 | .reg_word_size = sizeof(u8), | 2049 | .reg_word_size = sizeof(u8), |
2037 | .reg_cache_default = max98088_reg, | 2050 | .reg_cache_default = max98088_reg, |
2038 | .volatile_register = max98088_volatile_register, | 2051 | .volatile_register = max98088_volatile_register, |
2052 | .dapm_widgets = max98088_dapm_widgets, | ||
2053 | .num_dapm_widgets = ARRAY_SIZE(max98088_dapm_widgets), | ||
2054 | .dapm_routes = max98088_audio_map, | ||
2055 | .num_dapm_routes = ARRAY_SIZE(max98088_audio_map), | ||
2039 | }; | 2056 | }; |
2040 | 2057 | ||
2041 | static int max98088_i2c_probe(struct i2c_client *i2c, | 2058 | static int max98088_i2c_probe(struct i2c_client *i2c, |