diff options
| -rw-r--r-- | sound/soc/codecs/wm8961.c | 16 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8962.c | 67 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8974.c | 4 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8983.c | 6 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8988.c | 62 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8990.c | 41 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8991.c | 44 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8993.c | 66 | ||||
| -rw-r--r-- | sound/soc/codecs/wm_hubs.c | 16 |
9 files changed, 165 insertions, 157 deletions
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 900328e28a15..ce8fa6e01cb4 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c | |||
| @@ -317,15 +317,15 @@ static const char *adc_hpf_text[] = { | |||
| 317 | "Hi-fi", "Voice 1", "Voice 2", "Voice 3", | 317 | "Hi-fi", "Voice 1", "Voice 2", "Voice 3", |
| 318 | }; | 318 | }; |
| 319 | 319 | ||
| 320 | static const struct soc_enum adc_hpf = | 320 | static SOC_ENUM_SINGLE_DECL(adc_hpf, |
| 321 | SOC_ENUM_SINGLE(WM8961_ADC_DAC_CONTROL_2, 7, 4, adc_hpf_text); | 321 | WM8961_ADC_DAC_CONTROL_2, 7, adc_hpf_text); |
| 322 | 322 | ||
| 323 | static const char *dac_deemph_text[] = { | 323 | static const char *dac_deemph_text[] = { |
| 324 | "None", "32kHz", "44.1kHz", "48kHz", | 324 | "None", "32kHz", "44.1kHz", "48kHz", |
| 325 | }; | 325 | }; |
| 326 | 326 | ||
| 327 | static const struct soc_enum dac_deemph = | 327 | static SOC_ENUM_SINGLE_DECL(dac_deemph, |
| 328 | SOC_ENUM_SINGLE(WM8961_ADC_DAC_CONTROL_1, 1, 4, dac_deemph_text); | 328 | WM8961_ADC_DAC_CONTROL_1, 1, dac_deemph_text); |
| 329 | 329 | ||
| 330 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); | 330 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); |
| 331 | static const DECLARE_TLV_DB_SCALE(hp_sec_tlv, -700, 100, 0); | 331 | static const DECLARE_TLV_DB_SCALE(hp_sec_tlv, -700, 100, 0); |
| @@ -385,11 +385,11 @@ static const char *sidetone_text[] = { | |||
| 385 | "None", "Left", "Right" | 385 | "None", "Left", "Right" |
| 386 | }; | 386 | }; |
| 387 | 387 | ||
| 388 | static const struct soc_enum dacl_sidetone = | 388 | static SOC_ENUM_SINGLE_DECL(dacl_sidetone, |
| 389 | SOC_ENUM_SINGLE(WM8961_DSP_SIDETONE_0, 2, 3, sidetone_text); | 389 | WM8961_DSP_SIDETONE_0, 2, sidetone_text); |
| 390 | 390 | ||
| 391 | static const struct soc_enum dacr_sidetone = | 391 | static SOC_ENUM_SINGLE_DECL(dacr_sidetone, |
| 392 | SOC_ENUM_SINGLE(WM8961_DSP_SIDETONE_1, 2, 3, sidetone_text); | 392 | WM8961_DSP_SIDETONE_1, 2, sidetone_text); |
| 393 | 393 | ||
| 394 | static const struct snd_kcontrol_new dacl_mux = | 394 | static const struct snd_kcontrol_new dacl_mux = |
| 395 | SOC_DAPM_ENUM("DACL Sidetone", dacl_sidetone); | 395 | SOC_DAPM_ENUM("DACL Sidetone", dacl_sidetone); |
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 9e6233633c44..62af9dc59fc5 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
| @@ -1479,7 +1479,9 @@ static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | |||
| 1479 | 1479 | ||
| 1480 | static int wm8962_dsp2_write_config(struct snd_soc_codec *codec) | 1480 | static int wm8962_dsp2_write_config(struct snd_soc_codec *codec) |
| 1481 | { | 1481 | { |
| 1482 | return regcache_sync_region(codec->control_data, | 1482 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); |
| 1483 | |||
| 1484 | return regcache_sync_region(wm8962->regmap, | ||
| 1483 | WM8962_HDBASS_AI_1, WM8962_MAX_REGISTER); | 1485 | WM8962_HDBASS_AI_1, WM8962_MAX_REGISTER); |
| 1484 | } | 1486 | } |
| 1485 | 1487 | ||
| @@ -1658,16 +1660,16 @@ static const char *cap_hpf_mode_text[] = { | |||
| 1658 | "Hi-fi", "Application" | 1660 | "Hi-fi", "Application" |
| 1659 | }; | 1661 | }; |
| 1660 | 1662 | ||
| 1661 | static const struct soc_enum cap_hpf_mode = | 1663 | static SOC_ENUM_SINGLE_DECL(cap_hpf_mode, |
| 1662 | SOC_ENUM_SINGLE(WM8962_ADC_DAC_CONTROL_2, 10, 2, cap_hpf_mode_text); | 1664 | WM8962_ADC_DAC_CONTROL_2, 10, cap_hpf_mode_text); |
| 1663 | 1665 | ||
| 1664 | 1666 | ||
| 1665 | static const char *cap_lhpf_mode_text[] = { | 1667 | static const char *cap_lhpf_mode_text[] = { |
| 1666 | "LPF", "HPF" | 1668 | "LPF", "HPF" |
| 1667 | }; | 1669 | }; |
| 1668 | 1670 | ||
| 1669 | static const struct soc_enum cap_lhpf_mode = | 1671 | static SOC_ENUM_SINGLE_DECL(cap_lhpf_mode, |
| 1670 | SOC_ENUM_SINGLE(WM8962_LHPF1, 1, 2, cap_lhpf_mode_text); | 1672 | WM8962_LHPF1, 1, cap_lhpf_mode_text); |
| 1671 | 1673 | ||
| 1672 | static const struct snd_kcontrol_new wm8962_snd_controls[] = { | 1674 | static const struct snd_kcontrol_new wm8962_snd_controls[] = { |
| 1673 | SOC_DOUBLE("Input Mixer Switch", WM8962_INPUT_MIXER_CONTROL_1, 3, 2, 1, 1), | 1675 | SOC_DOUBLE("Input Mixer Switch", WM8962_INPUT_MIXER_CONTROL_1, 3, 2, 1, 1), |
| @@ -2014,40 +2016,40 @@ static int dsp2_event(struct snd_soc_dapm_widget *w, | |||
| 2014 | 2016 | ||
| 2015 | static const char *st_text[] = { "None", "Left", "Right" }; | 2017 | static const char *st_text[] = { "None", "Left", "Right" }; |
| 2016 | 2018 | ||
| 2017 | static const struct soc_enum str_enum = | 2019 | static SOC_ENUM_SINGLE_DECL(str_enum, |
| 2018 | SOC_ENUM_SINGLE(WM8962_DAC_DSP_MIXING_1, 2, 3, st_text); | 2020 | WM8962_DAC_DSP_MIXING_1, 2, st_text); |
| 2019 | 2021 | ||
| 2020 | static const struct snd_kcontrol_new str_mux = | 2022 | static const struct snd_kcontrol_new str_mux = |
| 2021 | SOC_DAPM_ENUM("Right Sidetone", str_enum); | 2023 | SOC_DAPM_ENUM("Right Sidetone", str_enum); |
| 2022 | 2024 | ||
| 2023 | static const struct soc_enum stl_enum = | 2025 | static SOC_ENUM_SINGLE_DECL(stl_enum, |
| 2024 | SOC_ENUM_SINGLE(WM8962_DAC_DSP_MIXING_2, 2, 3, st_text); | 2026 | WM8962_DAC_DSP_MIXING_2, 2, st_text); |
| 2025 | 2027 | ||
| 2026 | static const struct snd_kcontrol_new stl_mux = | 2028 | static const struct snd_kcontrol_new stl_mux = |
| 2027 | SOC_DAPM_ENUM("Left Sidetone", stl_enum); | 2029 | SOC_DAPM_ENUM("Left Sidetone", stl_enum); |
| 2028 | 2030 | ||
| 2029 | static const char *outmux_text[] = { "DAC", "Mixer" }; | 2031 | static const char *outmux_text[] = { "DAC", "Mixer" }; |
| 2030 | 2032 | ||
| 2031 | static const struct soc_enum spkoutr_enum = | 2033 | static SOC_ENUM_SINGLE_DECL(spkoutr_enum, |
| 2032 | SOC_ENUM_SINGLE(WM8962_SPEAKER_MIXER_2, 7, 2, outmux_text); | 2034 | WM8962_SPEAKER_MIXER_2, 7, outmux_text); |
| 2033 | 2035 | ||
| 2034 | static const struct snd_kcontrol_new spkoutr_mux = | 2036 | static const struct snd_kcontrol_new spkoutr_mux = |
| 2035 | SOC_DAPM_ENUM("SPKOUTR Mux", spkoutr_enum); | 2037 | SOC_DAPM_ENUM("SPKOUTR Mux", spkoutr_enum); |
| 2036 | 2038 | ||
| 2037 | static const struct soc_enum spkoutl_enum = | 2039 | static SOC_ENUM_SINGLE_DECL(spkoutl_enum, |
| 2038 | SOC_ENUM_SINGLE(WM8962_SPEAKER_MIXER_1, 7, 2, outmux_text); | 2040 | WM8962_SPEAKER_MIXER_1, 7, outmux_text); |
| 2039 | 2041 | ||
| 2040 | static const struct snd_kcontrol_new spkoutl_mux = | 2042 | static const struct snd_kcontrol_new spkoutl_mux = |
| 2041 | SOC_DAPM_ENUM("SPKOUTL Mux", spkoutl_enum); | 2043 | SOC_DAPM_ENUM("SPKOUTL Mux", spkoutl_enum); |
| 2042 | 2044 | ||
| 2043 | static const struct soc_enum hpoutr_enum = | 2045 | static SOC_ENUM_SINGLE_DECL(hpoutr_enum, |
| 2044 | SOC_ENUM_SINGLE(WM8962_HEADPHONE_MIXER_2, 7, 2, outmux_text); | 2046 | WM8962_HEADPHONE_MIXER_2, 7, outmux_text); |
| 2045 | 2047 | ||
| 2046 | static const struct snd_kcontrol_new hpoutr_mux = | 2048 | static const struct snd_kcontrol_new hpoutr_mux = |
| 2047 | SOC_DAPM_ENUM("HPOUTR Mux", hpoutr_enum); | 2049 | SOC_DAPM_ENUM("HPOUTR Mux", hpoutr_enum); |
| 2048 | 2050 | ||
| 2049 | static const struct soc_enum hpoutl_enum = | 2051 | static SOC_ENUM_SINGLE_DECL(hpoutl_enum, |
| 2050 | SOC_ENUM_SINGLE(WM8962_HEADPHONE_MIXER_1, 7, 2, outmux_text); | 2052 | WM8962_HEADPHONE_MIXER_1, 7, outmux_text); |
| 2051 | 2053 | ||
| 2052 | static const struct snd_kcontrol_new hpoutl_mux = | 2054 | static const struct snd_kcontrol_new hpoutl_mux = |
| 2053 | SOC_DAPM_ENUM("HPOUTL Mux", hpoutl_enum); | 2055 | SOC_DAPM_ENUM("HPOUTL Mux", hpoutl_enum); |
| @@ -2884,9 +2886,13 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, | |||
| 2884 | snd_soc_write(codec, WM8962_FLL_CONTROL_7, fll_div.lambda); | 2886 | snd_soc_write(codec, WM8962_FLL_CONTROL_7, fll_div.lambda); |
| 2885 | snd_soc_write(codec, WM8962_FLL_CONTROL_8, fll_div.n); | 2887 | snd_soc_write(codec, WM8962_FLL_CONTROL_8, fll_div.n); |
| 2886 | 2888 | ||
| 2887 | try_wait_for_completion(&wm8962->fll_lock); | 2889 | reinit_completion(&wm8962->fll_lock); |
| 2888 | 2890 | ||
| 2889 | pm_runtime_get_sync(codec->dev); | 2891 | ret = pm_runtime_get_sync(codec->dev); |
| 2892 | if (ret < 0) { | ||
| 2893 | dev_err(codec->dev, "Failed to resume device: %d\n", ret); | ||
| 2894 | return ret; | ||
| 2895 | } | ||
| 2890 | 2896 | ||
| 2891 | snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1, | 2897 | snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1, |
| 2892 | WM8962_FLL_FRAC | WM8962_FLL_REFCLK_SRC_MASK | | 2898 | WM8962_FLL_FRAC | WM8962_FLL_REFCLK_SRC_MASK | |
| @@ -2894,8 +2900,6 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, | |||
| 2894 | 2900 | ||
| 2895 | dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); | 2901 | dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); |
| 2896 | 2902 | ||
| 2897 | ret = 0; | ||
| 2898 | |||
| 2899 | /* This should be a massive overestimate but go even | 2903 | /* This should be a massive overestimate but go even |
| 2900 | * higher if we'll error out | 2904 | * higher if we'll error out |
| 2901 | */ | 2905 | */ |
| @@ -2909,14 +2913,17 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, | |||
| 2909 | 2913 | ||
| 2910 | if (timeout == 0 && wm8962->irq) { | 2914 | if (timeout == 0 && wm8962->irq) { |
| 2911 | dev_err(codec->dev, "FLL lock timed out"); | 2915 | dev_err(codec->dev, "FLL lock timed out"); |
| 2912 | ret = -ETIMEDOUT; | 2916 | snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1, |
| 2917 | WM8962_FLL_ENA, 0); | ||
| 2918 | pm_runtime_put(codec->dev); | ||
| 2919 | return -ETIMEDOUT; | ||
| 2913 | } | 2920 | } |
| 2914 | 2921 | ||
| 2915 | wm8962->fll_fref = Fref; | 2922 | wm8962->fll_fref = Fref; |
| 2916 | wm8962->fll_fout = Fout; | 2923 | wm8962->fll_fout = Fout; |
| 2917 | wm8962->fll_src = source; | 2924 | wm8962->fll_src = source; |
| 2918 | 2925 | ||
| 2919 | return ret; | 2926 | return 0; |
| 2920 | } | 2927 | } |
| 2921 | 2928 | ||
| 2922 | static int wm8962_mute(struct snd_soc_dai *dai, int mute) | 2929 | static int wm8962_mute(struct snd_soc_dai *dai, int mute) |
| @@ -3003,9 +3010,16 @@ static irqreturn_t wm8962_irq(int irq, void *data) | |||
| 3003 | unsigned int active; | 3010 | unsigned int active; |
| 3004 | int reg, ret; | 3011 | int reg, ret; |
| 3005 | 3012 | ||
| 3013 | ret = pm_runtime_get_sync(dev); | ||
| 3014 | if (ret < 0) { | ||
| 3015 | dev_err(dev, "Failed to resume: %d\n", ret); | ||
| 3016 | return IRQ_NONE; | ||
| 3017 | } | ||
| 3018 | |||
| 3006 | ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2_MASK, | 3019 | ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2_MASK, |
| 3007 | &mask); | 3020 | &mask); |
| 3008 | if (ret != 0) { | 3021 | if (ret != 0) { |
| 3022 | pm_runtime_put(dev); | ||
| 3009 | dev_err(dev, "Failed to read interrupt mask: %d\n", | 3023 | dev_err(dev, "Failed to read interrupt mask: %d\n", |
| 3010 | ret); | 3024 | ret); |
| 3011 | return IRQ_NONE; | 3025 | return IRQ_NONE; |
| @@ -3013,14 +3027,17 @@ static irqreturn_t wm8962_irq(int irq, void *data) | |||
| 3013 | 3027 | ||
| 3014 | ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, &active); | 3028 | ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, &active); |
| 3015 | if (ret != 0) { | 3029 | if (ret != 0) { |
| 3030 | pm_runtime_put(dev); | ||
| 3016 | dev_err(dev, "Failed to read interrupt: %d\n", ret); | 3031 | dev_err(dev, "Failed to read interrupt: %d\n", ret); |
| 3017 | return IRQ_NONE; | 3032 | return IRQ_NONE; |
| 3018 | } | 3033 | } |
| 3019 | 3034 | ||
| 3020 | active &= ~mask; | 3035 | active &= ~mask; |
| 3021 | 3036 | ||
| 3022 | if (!active) | 3037 | if (!active) { |
| 3038 | pm_runtime_put(dev); | ||
| 3023 | return IRQ_NONE; | 3039 | return IRQ_NONE; |
| 3040 | } | ||
| 3024 | 3041 | ||
| 3025 | /* Acknowledge the interrupts */ | 3042 | /* Acknowledge the interrupts */ |
| 3026 | ret = regmap_write(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, active); | 3043 | ret = regmap_write(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, active); |
| @@ -3070,6 +3087,8 @@ static irqreturn_t wm8962_irq(int irq, void *data) | |||
| 3070 | msecs_to_jiffies(250)); | 3087 | msecs_to_jiffies(250)); |
| 3071 | } | 3088 | } |
| 3072 | 3089 | ||
| 3090 | pm_runtime_put(dev); | ||
| 3091 | |||
| 3073 | return IRQ_HANDLED; | 3092 | return IRQ_HANDLED; |
| 3074 | } | 3093 | } |
| 3075 | 3094 | ||
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 15f45c7bd833..6e16c4306461 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
| @@ -84,8 +84,8 @@ static const struct soc_enum wm8974_enum[] = { | |||
| 84 | 84 | ||
| 85 | static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" }; | 85 | static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" }; |
| 86 | 86 | ||
| 87 | static const struct soc_enum wm8974_auxmode = | 87 | static SOC_ENUM_SINGLE_DECL(wm8974_auxmode, |
| 88 | SOC_ENUM_SINGLE(WM8974_INPUT, 3, 2, wm8974_auxmode_text); | 88 | WM8974_INPUT, 3, wm8974_auxmode_text); |
| 89 | 89 | ||
| 90 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1); | 90 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1); |
| 91 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | 91 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index 770e5a705851..58f0551eed2d 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c | |||
| @@ -1124,7 +1124,7 @@ static struct spi_driver wm8983_spi_driver = { | |||
| 1124 | }; | 1124 | }; |
| 1125 | #endif | 1125 | #endif |
| 1126 | 1126 | ||
| 1127 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 1127 | #if IS_ENABLED(CONFIG_I2C) |
| 1128 | static int wm8983_i2c_probe(struct i2c_client *i2c, | 1128 | static int wm8983_i2c_probe(struct i2c_client *i2c, |
| 1129 | const struct i2c_device_id *id) | 1129 | const struct i2c_device_id *id) |
| 1130 | { | 1130 | { |
| @@ -1177,7 +1177,7 @@ static int __init wm8983_modinit(void) | |||
| 1177 | { | 1177 | { |
| 1178 | int ret = 0; | 1178 | int ret = 0; |
| 1179 | 1179 | ||
| 1180 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 1180 | #if IS_ENABLED(CONFIG_I2C) |
| 1181 | ret = i2c_add_driver(&wm8983_i2c_driver); | 1181 | ret = i2c_add_driver(&wm8983_i2c_driver); |
| 1182 | if (ret) { | 1182 | if (ret) { |
| 1183 | printk(KERN_ERR "Failed to register wm8983 I2C driver: %d\n", | 1183 | printk(KERN_ERR "Failed to register wm8983 I2C driver: %d\n", |
| @@ -1197,7 +1197,7 @@ module_init(wm8983_modinit); | |||
| 1197 | 1197 | ||
| 1198 | static void __exit wm8983_exit(void) | 1198 | static void __exit wm8983_exit(void) |
| 1199 | { | 1199 | { |
| 1200 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 1200 | #if IS_ENABLED(CONFIG_I2C) |
| 1201 | i2c_del_driver(&wm8983_i2c_driver); | 1201 | i2c_del_driver(&wm8983_i2c_driver); |
| 1202 | #endif | 1202 | #endif |
| 1203 | #if defined(CONFIG_SPI_MASTER) | 1203 | #if defined(CONFIG_SPI_MASTER) |
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index a55e1c2c382e..0277a76c6bef 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
| @@ -116,7 +116,7 @@ static bool wm8988_writeable(struct device *dev, unsigned int reg) | |||
| 116 | struct wm8988_priv { | 116 | struct wm8988_priv { |
| 117 | struct regmap *regmap; | 117 | struct regmap *regmap; |
| 118 | unsigned int sysclk; | 118 | unsigned int sysclk; |
| 119 | struct snd_pcm_hw_constraint_list *sysclk_constraints; | 119 | const struct snd_pcm_hw_constraint_list *sysclk_constraints; |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | #define wm8988_reset(c) snd_soc_write(c, WM8988_RESET, 0) | 122 | #define wm8988_reset(c) snd_soc_write(c, WM8988_RESET, 0) |
| @@ -126,46 +126,46 @@ struct wm8988_priv { | |||
| 126 | */ | 126 | */ |
| 127 | 127 | ||
| 128 | static const char *bass_boost_txt[] = {"Linear Control", "Adaptive Boost"}; | 128 | static const char *bass_boost_txt[] = {"Linear Control", "Adaptive Boost"}; |
| 129 | static const struct soc_enum bass_boost = | 129 | static SOC_ENUM_SINGLE_DECL(bass_boost, |
| 130 | SOC_ENUM_SINGLE(WM8988_BASS, 7, 2, bass_boost_txt); | 130 | WM8988_BASS, 7, bass_boost_txt); |
| 131 | 131 | ||
| 132 | static const char *bass_filter_txt[] = { "130Hz @ 48kHz", "200Hz @ 48kHz" }; | 132 | static const char *bass_filter_txt[] = { "130Hz @ 48kHz", "200Hz @ 48kHz" }; |
| 133 | static const struct soc_enum bass_filter = | 133 | static SOC_ENUM_SINGLE_DECL(bass_filter, |
| 134 | SOC_ENUM_SINGLE(WM8988_BASS, 6, 2, bass_filter_txt); | 134 | WM8988_BASS, 6, bass_filter_txt); |
| 135 | 135 | ||
| 136 | static const char *treble_txt[] = {"8kHz", "4kHz"}; | 136 | static const char *treble_txt[] = {"8kHz", "4kHz"}; |
| 137 | static const struct soc_enum treble = | 137 | static SOC_ENUM_SINGLE_DECL(treble, |
| 138 | SOC_ENUM_SINGLE(WM8988_TREBLE, 6, 2, treble_txt); | 138 | WM8988_TREBLE, 6, treble_txt); |
| 139 | 139 | ||
| 140 | static const char *stereo_3d_lc_txt[] = {"200Hz", "500Hz"}; | 140 | static const char *stereo_3d_lc_txt[] = {"200Hz", "500Hz"}; |
| 141 | static const struct soc_enum stereo_3d_lc = | 141 | static SOC_ENUM_SINGLE_DECL(stereo_3d_lc, |
| 142 | SOC_ENUM_SINGLE(WM8988_3D, 5, 2, stereo_3d_lc_txt); | 142 | WM8988_3D, 5, stereo_3d_lc_txt); |
| 143 | 143 | ||
| 144 | static const char *stereo_3d_uc_txt[] = {"2.2kHz", "1.5kHz"}; | 144 | static const char *stereo_3d_uc_txt[] = {"2.2kHz", "1.5kHz"}; |
| 145 | static const struct soc_enum stereo_3d_uc = | 145 | static SOC_ENUM_SINGLE_DECL(stereo_3d_uc, |
| 146 | SOC_ENUM_SINGLE(WM8988_3D, 6, 2, stereo_3d_uc_txt); | 146 | WM8988_3D, 6, stereo_3d_uc_txt); |
| 147 | 147 | ||
| 148 | static const char *stereo_3d_func_txt[] = {"Capture", "Playback"}; | 148 | static const char *stereo_3d_func_txt[] = {"Capture", "Playback"}; |
| 149 | static const struct soc_enum stereo_3d_func = | 149 | static SOC_ENUM_SINGLE_DECL(stereo_3d_func, |
| 150 | SOC_ENUM_SINGLE(WM8988_3D, 7, 2, stereo_3d_func_txt); | 150 | WM8988_3D, 7, stereo_3d_func_txt); |
| 151 | 151 | ||
| 152 | static const char *alc_func_txt[] = {"Off", "Right", "Left", "Stereo"}; | 152 | static const char *alc_func_txt[] = {"Off", "Right", "Left", "Stereo"}; |
| 153 | static const struct soc_enum alc_func = | 153 | static SOC_ENUM_SINGLE_DECL(alc_func, |
| 154 | SOC_ENUM_SINGLE(WM8988_ALC1, 7, 4, alc_func_txt); | 154 | WM8988_ALC1, 7, alc_func_txt); |
| 155 | 155 | ||
| 156 | static const char *ng_type_txt[] = {"Constant PGA Gain", | 156 | static const char *ng_type_txt[] = {"Constant PGA Gain", |
| 157 | "Mute ADC Output"}; | 157 | "Mute ADC Output"}; |
| 158 | static const struct soc_enum ng_type = | 158 | static SOC_ENUM_SINGLE_DECL(ng_type, |
| 159 | SOC_ENUM_SINGLE(WM8988_NGATE, 1, 2, ng_type_txt); | 159 | WM8988_NGATE, 1, ng_type_txt); |
| 160 | 160 | ||
| 161 | static const char *deemph_txt[] = {"None", "32Khz", "44.1Khz", "48Khz"}; | 161 | static const char *deemph_txt[] = {"None", "32Khz", "44.1Khz", "48Khz"}; |
| 162 | static const struct soc_enum deemph = | 162 | static SOC_ENUM_SINGLE_DECL(deemph, |
| 163 | SOC_ENUM_SINGLE(WM8988_ADCDAC, 1, 4, deemph_txt); | 163 | WM8988_ADCDAC, 1, deemph_txt); |
| 164 | 164 | ||
| 165 | static const char *adcpol_txt[] = {"Normal", "L Invert", "R Invert", | 165 | static const char *adcpol_txt[] = {"Normal", "L Invert", "R Invert", |
| 166 | "L + R Invert"}; | 166 | "L + R Invert"}; |
| 167 | static const struct soc_enum adcpol = | 167 | static SOC_ENUM_SINGLE_DECL(adcpol, |
| 168 | SOC_ENUM_SINGLE(WM8988_ADCDAC, 5, 4, adcpol_txt); | 168 | WM8988_ADCDAC, 5, adcpol_txt); |
| 169 | 169 | ||
| 170 | static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0); | 170 | static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0); |
| 171 | static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1); | 171 | static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1); |
| @@ -317,16 +317,16 @@ static const struct snd_kcontrol_new wm8988_right_pga_controls = | |||
| 317 | 317 | ||
| 318 | /* Differential Mux */ | 318 | /* Differential Mux */ |
| 319 | static const char *wm8988_diff_sel[] = {"Line 1", "Line 2"}; | 319 | static const char *wm8988_diff_sel[] = {"Line 1", "Line 2"}; |
| 320 | static const struct soc_enum diffmux = | 320 | static SOC_ENUM_SINGLE_DECL(diffmux, |
| 321 | SOC_ENUM_SINGLE(WM8988_ADCIN, 8, 2, wm8988_diff_sel); | 321 | WM8988_ADCIN, 8, wm8988_diff_sel); |
| 322 | static const struct snd_kcontrol_new wm8988_diffmux_controls = | 322 | static const struct snd_kcontrol_new wm8988_diffmux_controls = |
| 323 | SOC_DAPM_ENUM("Route", diffmux); | 323 | SOC_DAPM_ENUM("Route", diffmux); |
| 324 | 324 | ||
| 325 | /* Mono ADC Mux */ | 325 | /* Mono ADC Mux */ |
| 326 | static const char *wm8988_mono_mux[] = {"Stereo", "Mono (Left)", | 326 | static const char *wm8988_mono_mux[] = {"Stereo", "Mono (Left)", |
| 327 | "Mono (Right)", "Digital Mono"}; | 327 | "Mono (Right)", "Digital Mono"}; |
| 328 | static const struct soc_enum monomux = | 328 | static SOC_ENUM_SINGLE_DECL(monomux, |
| 329 | SOC_ENUM_SINGLE(WM8988_ADCIN, 6, 4, wm8988_mono_mux); | 329 | WM8988_ADCIN, 6, wm8988_mono_mux); |
| 330 | static const struct snd_kcontrol_new wm8988_monomux_controls = | 330 | static const struct snd_kcontrol_new wm8988_monomux_controls = |
| 331 | SOC_DAPM_ENUM("Route", monomux); | 331 | SOC_DAPM_ENUM("Route", monomux); |
| 332 | 332 | ||
| @@ -521,30 +521,30 @@ static inline int get_coeff(int mclk, int rate) | |||
| 521 | 521 | ||
| 522 | /* The set of rates we can generate from the above for each SYSCLK */ | 522 | /* The set of rates we can generate from the above for each SYSCLK */ |
| 523 | 523 | ||
| 524 | static unsigned int rates_12288[] = { | 524 | static const unsigned int rates_12288[] = { |
| 525 | 8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000, | 525 | 8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000, |
| 526 | }; | 526 | }; |
| 527 | 527 | ||
| 528 | static struct snd_pcm_hw_constraint_list constraints_12288 = { | 528 | static const struct snd_pcm_hw_constraint_list constraints_12288 = { |
| 529 | .count = ARRAY_SIZE(rates_12288), | 529 | .count = ARRAY_SIZE(rates_12288), |
| 530 | .list = rates_12288, | 530 | .list = rates_12288, |
| 531 | }; | 531 | }; |
| 532 | 532 | ||
| 533 | static unsigned int rates_112896[] = { | 533 | static const unsigned int rates_112896[] = { |
| 534 | 8000, 11025, 22050, 44100, | 534 | 8000, 11025, 22050, 44100, |
| 535 | }; | 535 | }; |
| 536 | 536 | ||
| 537 | static struct snd_pcm_hw_constraint_list constraints_112896 = { | 537 | static const struct snd_pcm_hw_constraint_list constraints_112896 = { |
| 538 | .count = ARRAY_SIZE(rates_112896), | 538 | .count = ARRAY_SIZE(rates_112896), |
| 539 | .list = rates_112896, | 539 | .list = rates_112896, |
| 540 | }; | 540 | }; |
| 541 | 541 | ||
| 542 | static unsigned int rates_12[] = { | 542 | static const unsigned int rates_12[] = { |
| 543 | 8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000, | 543 | 8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000, |
| 544 | 48000, 88235, 96000, | 544 | 48000, 88235, 96000, |
| 545 | }; | 545 | }; |
| 546 | 546 | ||
| 547 | static struct snd_pcm_hw_constraint_list constraints_12 = { | 547 | static const struct snd_pcm_hw_constraint_list constraints_12 = { |
| 548 | .count = ARRAY_SIZE(rates_12), | 548 | .count = ARRAY_SIZE(rates_12), |
| 549 | .list = rates_12, | 549 | .list = rates_12, |
| 550 | }; | 550 | }; |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 0ccd4d8d043b..33f53ab1e7b0 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
| @@ -157,26 +157,23 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
| 157 | static const char *wm8990_digital_sidetone[] = | 157 | static const char *wm8990_digital_sidetone[] = |
| 158 | {"None", "Left ADC", "Right ADC", "Reserved"}; | 158 | {"None", "Left ADC", "Right ADC", "Reserved"}; |
| 159 | 159 | ||
| 160 | static const struct soc_enum wm8990_left_digital_sidetone_enum = | 160 | static SOC_ENUM_SINGLE_DECL(wm8990_left_digital_sidetone_enum, |
| 161 | SOC_ENUM_SINGLE(WM8990_DIGITAL_SIDE_TONE, | 161 | WM8990_DIGITAL_SIDE_TONE, |
| 162 | WM8990_ADC_TO_DACL_SHIFT, | 162 | WM8990_ADC_TO_DACL_SHIFT, |
| 163 | WM8990_ADC_TO_DACL_MASK, | 163 | wm8990_digital_sidetone); |
| 164 | wm8990_digital_sidetone); | 164 | |
| 165 | 165 | static SOC_ENUM_SINGLE_DECL(wm8990_right_digital_sidetone_enum, | |
| 166 | static const struct soc_enum wm8990_right_digital_sidetone_enum = | 166 | WM8990_DIGITAL_SIDE_TONE, |
| 167 | SOC_ENUM_SINGLE(WM8990_DIGITAL_SIDE_TONE, | 167 | WM8990_ADC_TO_DACR_SHIFT, |
| 168 | WM8990_ADC_TO_DACR_SHIFT, | 168 | wm8990_digital_sidetone); |
| 169 | WM8990_ADC_TO_DACR_MASK, | ||
| 170 | wm8990_digital_sidetone); | ||
| 171 | 169 | ||
| 172 | static const char *wm8990_adcmode[] = | 170 | static const char *wm8990_adcmode[] = |
| 173 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; | 171 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; |
| 174 | 172 | ||
| 175 | static const struct soc_enum wm8990_right_adcmode_enum = | 173 | static SOC_ENUM_SINGLE_DECL(wm8990_right_adcmode_enum, |
| 176 | SOC_ENUM_SINGLE(WM8990_ADC_CTRL, | 174 | WM8990_ADC_CTRL, |
| 177 | WM8990_ADC_HPF_CUT_SHIFT, | 175 | WM8990_ADC_HPF_CUT_SHIFT, |
| 178 | WM8990_ADC_HPF_CUT_MASK, | 176 | wm8990_adcmode); |
| 179 | wm8990_adcmode); | ||
| 180 | 177 | ||
| 181 | static const struct snd_kcontrol_new wm8990_snd_controls[] = { | 178 | static const struct snd_kcontrol_new wm8990_snd_controls[] = { |
| 182 | /* INMIXL */ | 179 | /* INMIXL */ |
| @@ -475,9 +472,9 @@ SOC_DAPM_SINGLE("RINPGA34 Switch", WM8990_INPUT_MIXER3, WM8990_L34MNB_BIT, | |||
| 475 | static const char *wm8990_ainlmux[] = | 472 | static const char *wm8990_ainlmux[] = |
| 476 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; | 473 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; |
| 477 | 474 | ||
| 478 | static const struct soc_enum wm8990_ainlmux_enum = | 475 | static SOC_ENUM_SINGLE_DECL(wm8990_ainlmux_enum, |
| 479 | SOC_ENUM_SINGLE(WM8990_INPUT_MIXER1, WM8990_AINLMODE_SHIFT, | 476 | WM8990_INPUT_MIXER1, WM8990_AINLMODE_SHIFT, |
| 480 | ARRAY_SIZE(wm8990_ainlmux), wm8990_ainlmux); | 477 | wm8990_ainlmux); |
| 481 | 478 | ||
| 482 | static const struct snd_kcontrol_new wm8990_dapm_ainlmux_controls = | 479 | static const struct snd_kcontrol_new wm8990_dapm_ainlmux_controls = |
| 483 | SOC_DAPM_ENUM("Route", wm8990_ainlmux_enum); | 480 | SOC_DAPM_ENUM("Route", wm8990_ainlmux_enum); |
| @@ -488,9 +485,9 @@ SOC_DAPM_ENUM("Route", wm8990_ainlmux_enum); | |||
| 488 | static const char *wm8990_ainrmux[] = | 485 | static const char *wm8990_ainrmux[] = |
| 489 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; | 486 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; |
| 490 | 487 | ||
| 491 | static const struct soc_enum wm8990_ainrmux_enum = | 488 | static SOC_ENUM_SINGLE_DECL(wm8990_ainrmux_enum, |
| 492 | SOC_ENUM_SINGLE(WM8990_INPUT_MIXER1, WM8990_AINRMODE_SHIFT, | 489 | WM8990_INPUT_MIXER1, WM8990_AINRMODE_SHIFT, |
| 493 | ARRAY_SIZE(wm8990_ainrmux), wm8990_ainrmux); | 490 | wm8990_ainrmux); |
| 494 | 491 | ||
| 495 | static const struct snd_kcontrol_new wm8990_dapm_ainrmux_controls = | 492 | static const struct snd_kcontrol_new wm8990_dapm_ainrmux_controls = |
| 496 | SOC_DAPM_ENUM("Route", wm8990_ainrmux_enum); | 493 | SOC_DAPM_ENUM("Route", wm8990_ainrmux_enum); |
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index dba0306c42a5..32d219570cca 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c | |||
| @@ -171,26 +171,23 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
| 171 | static const char *wm8991_digital_sidetone[] = | 171 | static const char *wm8991_digital_sidetone[] = |
| 172 | {"None", "Left ADC", "Right ADC", "Reserved"}; | 172 | {"None", "Left ADC", "Right ADC", "Reserved"}; |
| 173 | 173 | ||
| 174 | static const struct soc_enum wm8991_left_digital_sidetone_enum = | 174 | static SOC_ENUM_SINGLE_DECL(wm8991_left_digital_sidetone_enum, |
| 175 | SOC_ENUM_SINGLE(WM8991_DIGITAL_SIDE_TONE, | 175 | WM8991_DIGITAL_SIDE_TONE, |
| 176 | WM8991_ADC_TO_DACL_SHIFT, | 176 | WM8991_ADC_TO_DACL_SHIFT, |
| 177 | WM8991_ADC_TO_DACL_MASK, | 177 | wm8991_digital_sidetone); |
| 178 | wm8991_digital_sidetone); | 178 | |
| 179 | 179 | static SOC_ENUM_SINGLE_DECL(wm8991_right_digital_sidetone_enum, | |
| 180 | static const struct soc_enum wm8991_right_digital_sidetone_enum = | 180 | WM8991_DIGITAL_SIDE_TONE, |
| 181 | SOC_ENUM_SINGLE(WM8991_DIGITAL_SIDE_TONE, | 181 | WM8991_ADC_TO_DACR_SHIFT, |
| 182 | WM8991_ADC_TO_DACR_SHIFT, | 182 | wm8991_digital_sidetone); |
| 183 | WM8991_ADC_TO_DACR_MASK, | ||
| 184 | wm8991_digital_sidetone); | ||
| 185 | 183 | ||
| 186 | static const char *wm8991_adcmode[] = | 184 | static const char *wm8991_adcmode[] = |
| 187 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; | 185 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; |
| 188 | 186 | ||
| 189 | static const struct soc_enum wm8991_right_adcmode_enum = | 187 | static SOC_ENUM_SINGLE_DECL(wm8991_right_adcmode_enum, |
| 190 | SOC_ENUM_SINGLE(WM8991_ADC_CTRL, | 188 | WM8991_ADC_CTRL, |
| 191 | WM8991_ADC_HPF_CUT_SHIFT, | 189 | WM8991_ADC_HPF_CUT_SHIFT, |
| 192 | WM8991_ADC_HPF_CUT_MASK, | 190 | wm8991_adcmode); |
| 193 | wm8991_adcmode); | ||
| 194 | 191 | ||
| 195 | static const struct snd_kcontrol_new wm8991_snd_controls[] = { | 192 | static const struct snd_kcontrol_new wm8991_snd_controls[] = { |
| 196 | /* INMIXL */ | 193 | /* INMIXL */ |
| @@ -486,9 +483,9 @@ static const struct snd_kcontrol_new wm8991_dapm_inmixr_controls[] = { | |||
| 486 | static const char *wm8991_ainlmux[] = | 483 | static const char *wm8991_ainlmux[] = |
| 487 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; | 484 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; |
| 488 | 485 | ||
| 489 | static const struct soc_enum wm8991_ainlmux_enum = | 486 | static SOC_ENUM_SINGLE_DECL(wm8991_ainlmux_enum, |
| 490 | SOC_ENUM_SINGLE(WM8991_INPUT_MIXER1, WM8991_AINLMODE_SHIFT, | 487 | WM8991_INPUT_MIXER1, WM8991_AINLMODE_SHIFT, |
| 491 | ARRAY_SIZE(wm8991_ainlmux), wm8991_ainlmux); | 488 | wm8991_ainlmux); |
| 492 | 489 | ||
| 493 | static const struct snd_kcontrol_new wm8991_dapm_ainlmux_controls = | 490 | static const struct snd_kcontrol_new wm8991_dapm_ainlmux_controls = |
| 494 | SOC_DAPM_ENUM("Route", wm8991_ainlmux_enum); | 491 | SOC_DAPM_ENUM("Route", wm8991_ainlmux_enum); |
| @@ -499,9 +496,9 @@ static const struct snd_kcontrol_new wm8991_dapm_ainlmux_controls = | |||
| 499 | static const char *wm8991_ainrmux[] = | 496 | static const char *wm8991_ainrmux[] = |
| 500 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; | 497 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; |
| 501 | 498 | ||
| 502 | static const struct soc_enum wm8991_ainrmux_enum = | 499 | static SOC_ENUM_SINGLE_DECL(wm8991_ainrmux_enum, |
| 503 | SOC_ENUM_SINGLE(WM8991_INPUT_MIXER1, WM8991_AINRMODE_SHIFT, | 500 | WM8991_INPUT_MIXER1, WM8991_AINRMODE_SHIFT, |
| 504 | ARRAY_SIZE(wm8991_ainrmux), wm8991_ainrmux); | 501 | wm8991_ainrmux); |
| 505 | 502 | ||
| 506 | static const struct snd_kcontrol_new wm8991_dapm_ainrmux_controls = | 503 | static const struct snd_kcontrol_new wm8991_dapm_ainrmux_controls = |
| 507 | SOC_DAPM_ENUM("Route", wm8991_ainrmux_enum); | 504 | SOC_DAPM_ENUM("Route", wm8991_ainrmux_enum); |
| @@ -1251,11 +1248,8 @@ static int wm8991_remove(struct snd_soc_codec *codec) | |||
| 1251 | 1248 | ||
| 1252 | static int wm8991_probe(struct snd_soc_codec *codec) | 1249 | static int wm8991_probe(struct snd_soc_codec *codec) |
| 1253 | { | 1250 | { |
| 1254 | struct wm8991_priv *wm8991; | ||
| 1255 | int ret; | 1251 | int ret; |
| 1256 | 1252 | ||
| 1257 | wm8991 = snd_soc_codec_get_drvdata(codec); | ||
| 1258 | |||
| 1259 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); | 1253 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); |
| 1260 | if (ret < 0) { | 1254 | if (ret < 0) { |
| 1261 | dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret); | 1255 | dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret); |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 2ee23a39622c..7b0630a076fa 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
| @@ -646,8 +646,8 @@ static const char *dac_deemph_text[] = { | |||
| 646 | "48kHz", | 646 | "48kHz", |
| 647 | }; | 647 | }; |
| 648 | 648 | ||
| 649 | static const struct soc_enum dac_deemph = | 649 | static SOC_ENUM_SINGLE_DECL(dac_deemph, |
| 650 | SOC_ENUM_SINGLE(WM8993_DAC_CTRL, 4, 4, dac_deemph_text); | 650 | WM8993_DAC_CTRL, 4, dac_deemph_text); |
| 651 | 651 | ||
| 652 | static const char *adc_hpf_text[] = { | 652 | static const char *adc_hpf_text[] = { |
| 653 | "Hi-Fi", | 653 | "Hi-Fi", |
| @@ -656,16 +656,16 @@ static const char *adc_hpf_text[] = { | |||
| 656 | "Voice 3", | 656 | "Voice 3", |
| 657 | }; | 657 | }; |
| 658 | 658 | ||
| 659 | static const struct soc_enum adc_hpf = | 659 | static SOC_ENUM_SINGLE_DECL(adc_hpf, |
| 660 | SOC_ENUM_SINGLE(WM8993_ADC_CTRL, 5, 4, adc_hpf_text); | 660 | WM8993_ADC_CTRL, 5, adc_hpf_text); |
| 661 | 661 | ||
| 662 | static const char *drc_path_text[] = { | 662 | static const char *drc_path_text[] = { |
| 663 | "ADC", | 663 | "ADC", |
| 664 | "DAC" | 664 | "DAC" |
| 665 | }; | 665 | }; |
| 666 | 666 | ||
| 667 | static const struct soc_enum drc_path = | 667 | static SOC_ENUM_SINGLE_DECL(drc_path, |
| 668 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_1, 14, 2, drc_path_text); | 668 | WM8993_DRC_CONTROL_1, 14, drc_path_text); |
| 669 | 669 | ||
| 670 | static const char *drc_r0_text[] = { | 670 | static const char *drc_r0_text[] = { |
| 671 | "1", | 671 | "1", |
| @@ -676,8 +676,8 @@ static const char *drc_r0_text[] = { | |||
| 676 | "0", | 676 | "0", |
| 677 | }; | 677 | }; |
| 678 | 678 | ||
| 679 | static const struct soc_enum drc_r0 = | 679 | static SOC_ENUM_SINGLE_DECL(drc_r0, |
| 680 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_3, 8, 6, drc_r0_text); | 680 | WM8993_DRC_CONTROL_3, 8, drc_r0_text); |
| 681 | 681 | ||
| 682 | static const char *drc_r1_text[] = { | 682 | static const char *drc_r1_text[] = { |
| 683 | "1", | 683 | "1", |
| @@ -687,8 +687,8 @@ static const char *drc_r1_text[] = { | |||
| 687 | "0", | 687 | "0", |
| 688 | }; | 688 | }; |
| 689 | 689 | ||
| 690 | static const struct soc_enum drc_r1 = | 690 | static SOC_ENUM_SINGLE_DECL(drc_r1, |
| 691 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_4, 13, 5, drc_r1_text); | 691 | WM8993_DRC_CONTROL_4, 13, drc_r1_text); |
| 692 | 692 | ||
| 693 | static const char *drc_attack_text[] = { | 693 | static const char *drc_attack_text[] = { |
| 694 | "Reserved", | 694 | "Reserved", |
| @@ -705,8 +705,8 @@ static const char *drc_attack_text[] = { | |||
| 705 | "185.6ms", | 705 | "185.6ms", |
| 706 | }; | 706 | }; |
| 707 | 707 | ||
| 708 | static const struct soc_enum drc_attack = | 708 | static SOC_ENUM_SINGLE_DECL(drc_attack, |
| 709 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_2, 12, 12, drc_attack_text); | 709 | WM8993_DRC_CONTROL_2, 12, drc_attack_text); |
| 710 | 710 | ||
| 711 | static const char *drc_decay_text[] = { | 711 | static const char *drc_decay_text[] = { |
| 712 | "186ms", | 712 | "186ms", |
| @@ -720,16 +720,16 @@ static const char *drc_decay_text[] = { | |||
| 720 | "47.56ms", | 720 | "47.56ms", |
| 721 | }; | 721 | }; |
| 722 | 722 | ||
| 723 | static const struct soc_enum drc_decay = | 723 | static SOC_ENUM_SINGLE_DECL(drc_decay, |
| 724 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_2, 8, 9, drc_decay_text); | 724 | WM8993_DRC_CONTROL_2, 8, drc_decay_text); |
| 725 | 725 | ||
| 726 | static const char *drc_ff_text[] = { | 726 | static const char *drc_ff_text[] = { |
| 727 | "5 samples", | 727 | "5 samples", |
| 728 | "9 samples", | 728 | "9 samples", |
| 729 | }; | 729 | }; |
| 730 | 730 | ||
| 731 | static const struct soc_enum drc_ff = | 731 | static SOC_ENUM_SINGLE_DECL(drc_ff, |
| 732 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_3, 7, 2, drc_ff_text); | 732 | WM8993_DRC_CONTROL_3, 7, drc_ff_text); |
| 733 | 733 | ||
| 734 | static const char *drc_qr_rate_text[] = { | 734 | static const char *drc_qr_rate_text[] = { |
| 735 | "0.725ms", | 735 | "0.725ms", |
| @@ -737,8 +737,8 @@ static const char *drc_qr_rate_text[] = { | |||
| 737 | "5.8ms", | 737 | "5.8ms", |
| 738 | }; | 738 | }; |
| 739 | 739 | ||
| 740 | static const struct soc_enum drc_qr_rate = | 740 | static SOC_ENUM_SINGLE_DECL(drc_qr_rate, |
| 741 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_3, 0, 3, drc_qr_rate_text); | 741 | WM8993_DRC_CONTROL_3, 0, drc_qr_rate_text); |
| 742 | 742 | ||
| 743 | static const char *drc_smooth_text[] = { | 743 | static const char *drc_smooth_text[] = { |
| 744 | "Low", | 744 | "Low", |
| @@ -746,8 +746,8 @@ static const char *drc_smooth_text[] = { | |||
| 746 | "High", | 746 | "High", |
| 747 | }; | 747 | }; |
| 748 | 748 | ||
| 749 | static const struct soc_enum drc_smooth = | 749 | static SOC_ENUM_SINGLE_DECL(drc_smooth, |
| 750 | SOC_ENUM_SINGLE(WM8993_DRC_CONTROL_1, 4, 3, drc_smooth_text); | 750 | WM8993_DRC_CONTROL_1, 4, drc_smooth_text); |
| 751 | 751 | ||
| 752 | static const struct snd_kcontrol_new wm8993_snd_controls[] = { | 752 | static const struct snd_kcontrol_new wm8993_snd_controls[] = { |
| 753 | SOC_DOUBLE_TLV("Digital Sidetone Volume", WM8993_DIGITAL_SIDE_TONE, | 753 | SOC_DOUBLE_TLV("Digital Sidetone Volume", WM8993_DIGITAL_SIDE_TONE, |
| @@ -841,26 +841,26 @@ static const char *aif_text[] = { | |||
| 841 | "Left", "Right" | 841 | "Left", "Right" |
| 842 | }; | 842 | }; |
| 843 | 843 | ||
| 844 | static const struct soc_enum aifoutl_enum = | 844 | static SOC_ENUM_SINGLE_DECL(aifoutl_enum, |
| 845 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_1, 15, 2, aif_text); | 845 | WM8993_AUDIO_INTERFACE_1, 15, aif_text); |
| 846 | 846 | ||
| 847 | static const struct snd_kcontrol_new aifoutl_mux = | 847 | static const struct snd_kcontrol_new aifoutl_mux = |
| 848 | SOC_DAPM_ENUM("AIFOUTL Mux", aifoutl_enum); | 848 | SOC_DAPM_ENUM("AIFOUTL Mux", aifoutl_enum); |
| 849 | 849 | ||
| 850 | static const struct soc_enum aifoutr_enum = | 850 | static SOC_ENUM_SINGLE_DECL(aifoutr_enum, |
| 851 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_1, 14, 2, aif_text); | 851 | WM8993_AUDIO_INTERFACE_1, 14, aif_text); |
| 852 | 852 | ||
| 853 | static const struct snd_kcontrol_new aifoutr_mux = | 853 | static const struct snd_kcontrol_new aifoutr_mux = |
| 854 | SOC_DAPM_ENUM("AIFOUTR Mux", aifoutr_enum); | 854 | SOC_DAPM_ENUM("AIFOUTR Mux", aifoutr_enum); |
| 855 | 855 | ||
| 856 | static const struct soc_enum aifinl_enum = | 856 | static SOC_ENUM_SINGLE_DECL(aifinl_enum, |
| 857 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_2, 15, 2, aif_text); | 857 | WM8993_AUDIO_INTERFACE_2, 15, aif_text); |
| 858 | 858 | ||
| 859 | static const struct snd_kcontrol_new aifinl_mux = | 859 | static const struct snd_kcontrol_new aifinl_mux = |
| 860 | SOC_DAPM_ENUM("AIFINL Mux", aifinl_enum); | 860 | SOC_DAPM_ENUM("AIFINL Mux", aifinl_enum); |
| 861 | 861 | ||
| 862 | static const struct soc_enum aifinr_enum = | 862 | static SOC_ENUM_SINGLE_DECL(aifinr_enum, |
| 863 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_2, 14, 2, aif_text); | 863 | WM8993_AUDIO_INTERFACE_2, 14, aif_text); |
| 864 | 864 | ||
| 865 | static const struct snd_kcontrol_new aifinr_mux = | 865 | static const struct snd_kcontrol_new aifinr_mux = |
| 866 | SOC_DAPM_ENUM("AIFINR Mux", aifinr_enum); | 866 | SOC_DAPM_ENUM("AIFINR Mux", aifinr_enum); |
| @@ -869,14 +869,14 @@ static const char *sidetone_text[] = { | |||
| 869 | "None", "Left", "Right" | 869 | "None", "Left", "Right" |
| 870 | }; | 870 | }; |
| 871 | 871 | ||
| 872 | static const struct soc_enum sidetonel_enum = | 872 | static SOC_ENUM_SINGLE_DECL(sidetonel_enum, |
| 873 | SOC_ENUM_SINGLE(WM8993_DIGITAL_SIDE_TONE, 2, 3, sidetone_text); | 873 | WM8993_DIGITAL_SIDE_TONE, 2, sidetone_text); |
| 874 | 874 | ||
| 875 | static const struct snd_kcontrol_new sidetonel_mux = | 875 | static const struct snd_kcontrol_new sidetonel_mux = |
| 876 | SOC_DAPM_ENUM("Left Sidetone", sidetonel_enum); | 876 | SOC_DAPM_ENUM("Left Sidetone", sidetonel_enum); |
| 877 | 877 | ||
| 878 | static const struct soc_enum sidetoner_enum = | 878 | static SOC_ENUM_SINGLE_DECL(sidetoner_enum, |
| 879 | SOC_ENUM_SINGLE(WM8993_DIGITAL_SIDE_TONE, 0, 3, sidetone_text); | 879 | WM8993_DIGITAL_SIDE_TONE, 0, sidetone_text); |
| 880 | 880 | ||
| 881 | static const struct snd_kcontrol_new sidetoner_mux = | 881 | static const struct snd_kcontrol_new sidetoner_mux = |
| 882 | SOC_DAPM_ENUM("Right Sidetone", sidetoner_enum); | 882 | SOC_DAPM_ENUM("Right Sidetone", sidetoner_enum); |
| @@ -1559,8 +1559,6 @@ static int wm8993_probe(struct snd_soc_codec *codec) | |||
| 1559 | 1559 | ||
| 1560 | static int wm8993_remove(struct snd_soc_codec *codec) | 1560 | static int wm8993_remove(struct snd_soc_codec *codec) |
| 1561 | { | 1561 | { |
| 1562 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); | ||
| 1563 | |||
| 1564 | wm8993_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1562 | wm8993_set_bias_level(codec, SND_SOC_BIAS_OFF); |
| 1565 | return 0; | 1563 | return 0; |
| 1566 | } | 1564 | } |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index b371066dd5bc..b6209662ab13 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
| @@ -50,16 +50,16 @@ static const char *speaker_ref_text[] = { | |||
| 50 | "VMID", | 50 | "VMID", |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | static const struct soc_enum speaker_ref = | 53 | static SOC_ENUM_SINGLE_DECL(speaker_ref, |
| 54 | SOC_ENUM_SINGLE(WM8993_SPEAKER_MIXER, 8, 2, speaker_ref_text); | 54 | WM8993_SPEAKER_MIXER, 8, speaker_ref_text); |
| 55 | 55 | ||
| 56 | static const char *speaker_mode_text[] = { | 56 | static const char *speaker_mode_text[] = { |
| 57 | "Class D", | 57 | "Class D", |
| 58 | "Class AB", | 58 | "Class AB", |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | static const struct soc_enum speaker_mode = | 61 | static SOC_ENUM_SINGLE_DECL(speaker_mode, |
| 62 | SOC_ENUM_SINGLE(WM8993_SPKMIXR_ATTENUATION, 8, 2, speaker_mode_text); | 62 | WM8993_SPKMIXR_ATTENUATION, 8, speaker_mode_text); |
| 63 | 63 | ||
| 64 | static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) | 64 | static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) |
| 65 | { | 65 | { |
| @@ -735,15 +735,15 @@ static const char *hp_mux_text[] = { | |||
| 735 | "DAC", | 735 | "DAC", |
| 736 | }; | 736 | }; |
| 737 | 737 | ||
| 738 | static const struct soc_enum hpl_enum = | 738 | static SOC_ENUM_SINGLE_DECL(hpl_enum, |
| 739 | SOC_ENUM_SINGLE(WM8993_OUTPUT_MIXER1, 8, 2, hp_mux_text); | 739 | WM8993_OUTPUT_MIXER1, 8, hp_mux_text); |
| 740 | 740 | ||
| 741 | const struct snd_kcontrol_new wm_hubs_hpl_mux = | 741 | const struct snd_kcontrol_new wm_hubs_hpl_mux = |
| 742 | WM_HUBS_ENUM_W("Left Headphone Mux", hpl_enum); | 742 | WM_HUBS_ENUM_W("Left Headphone Mux", hpl_enum); |
| 743 | EXPORT_SYMBOL_GPL(wm_hubs_hpl_mux); | 743 | EXPORT_SYMBOL_GPL(wm_hubs_hpl_mux); |
| 744 | 744 | ||
| 745 | static const struct soc_enum hpr_enum = | 745 | static SOC_ENUM_SINGLE_DECL(hpr_enum, |
| 746 | SOC_ENUM_SINGLE(WM8993_OUTPUT_MIXER2, 8, 2, hp_mux_text); | 746 | WM8993_OUTPUT_MIXER2, 8, hp_mux_text); |
| 747 | 747 | ||
| 748 | const struct snd_kcontrol_new wm_hubs_hpr_mux = | 748 | const struct snd_kcontrol_new wm_hubs_hpr_mux = |
| 749 | WM_HUBS_ENUM_W("Right Headphone Mux", hpr_enum); | 749 | WM_HUBS_ENUM_W("Right Headphone Mux", hpr_enum); |
