diff options
Diffstat (limited to 'sound/soc/codecs/wm8988.c')
| -rw-r--r-- | sound/soc/codecs/wm8988.c | 84 | 
1 files changed, 38 insertions, 46 deletions
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 39b9acceb59..d3fea46d58e 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)  struct wm8988_priv {  	struct regmap *regmap;  	unsigned int sysclk; -	struct snd_pcm_hw_constraint_list *sysclk_constraints; +	const struct snd_pcm_hw_constraint_list *sysclk_constraints;  };  #define wm8988_reset(c)	snd_soc_write(c, WM8988_RESET, 0) @@ -126,46 +126,46 @@ struct wm8988_priv {   */  static const char *bass_boost_txt[] = {"Linear Control", "Adaptive Boost"}; -static const struct soc_enum bass_boost = -	SOC_ENUM_SINGLE(WM8988_BASS, 7, 2, bass_boost_txt); +static SOC_ENUM_SINGLE_DECL(bass_boost, +			    WM8988_BASS, 7, bass_boost_txt);  static const char *bass_filter_txt[] = { "130Hz @ 48kHz", "200Hz @ 48kHz" }; -static const struct soc_enum bass_filter = -	SOC_ENUM_SINGLE(WM8988_BASS, 6, 2, bass_filter_txt); +static SOC_ENUM_SINGLE_DECL(bass_filter, +			    WM8988_BASS, 6, bass_filter_txt);  static const char *treble_txt[] = {"8kHz", "4kHz"}; -static const struct soc_enum treble = -	SOC_ENUM_SINGLE(WM8988_TREBLE, 6, 2, treble_txt); +static SOC_ENUM_SINGLE_DECL(treble, +			    WM8988_TREBLE, 6, treble_txt);  static const char *stereo_3d_lc_txt[] = {"200Hz", "500Hz"}; -static const struct soc_enum stereo_3d_lc = -	SOC_ENUM_SINGLE(WM8988_3D, 5, 2, stereo_3d_lc_txt); +static SOC_ENUM_SINGLE_DECL(stereo_3d_lc, +			    WM8988_3D, 5, stereo_3d_lc_txt);  static const char *stereo_3d_uc_txt[] = {"2.2kHz", "1.5kHz"}; -static const struct soc_enum stereo_3d_uc = -	SOC_ENUM_SINGLE(WM8988_3D, 6, 2, stereo_3d_uc_txt); +static SOC_ENUM_SINGLE_DECL(stereo_3d_uc, +			    WM8988_3D, 6, stereo_3d_uc_txt);  static const char *stereo_3d_func_txt[] = {"Capture", "Playback"}; -static const struct soc_enum stereo_3d_func = -	SOC_ENUM_SINGLE(WM8988_3D, 7, 2, stereo_3d_func_txt); +static SOC_ENUM_SINGLE_DECL(stereo_3d_func, +			    WM8988_3D, 7, stereo_3d_func_txt);  static const char *alc_func_txt[] = {"Off", "Right", "Left", "Stereo"}; -static const struct soc_enum alc_func = -	SOC_ENUM_SINGLE(WM8988_ALC1, 7, 4, alc_func_txt); +static SOC_ENUM_SINGLE_DECL(alc_func, +			    WM8988_ALC1, 7, alc_func_txt);  static const char *ng_type_txt[] = {"Constant PGA Gain",  				    "Mute ADC Output"}; -static const struct soc_enum ng_type = -	SOC_ENUM_SINGLE(WM8988_NGATE, 1, 2, ng_type_txt); +static SOC_ENUM_SINGLE_DECL(ng_type, +			    WM8988_NGATE, 1, ng_type_txt);  static const char *deemph_txt[] = {"None", "32Khz", "44.1Khz", "48Khz"}; -static const struct soc_enum deemph = -	SOC_ENUM_SINGLE(WM8988_ADCDAC, 1, 4, deemph_txt); +static SOC_ENUM_SINGLE_DECL(deemph, +			    WM8988_ADCDAC, 1, deemph_txt);  static const char *adcpol_txt[] = {"Normal", "L Invert", "R Invert",  				   "L + R Invert"}; -static const struct soc_enum adcpol = -	SOC_ENUM_SINGLE(WM8988_ADCDAC, 5, 4, adcpol_txt); +static SOC_ENUM_SINGLE_DECL(adcpol, +			    WM8988_ADCDAC, 5, adcpol_txt);  static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0);  static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1); @@ -268,7 +268,7 @@ static const struct soc_enum wm8988_lline_enum =  			      wm8988_line_texts,  			      wm8988_line_values);  static const struct snd_kcontrol_new wm8988_left_line_controls = -	SOC_DAPM_VALUE_ENUM("Route", wm8988_lline_enum); +	SOC_DAPM_ENUM("Route", wm8988_lline_enum);  static const struct soc_enum wm8988_rline_enum =  	SOC_VALUE_ENUM_SINGLE(WM8988_ROUTM1, 0, 7, @@ -276,7 +276,7 @@ static const struct soc_enum wm8988_rline_enum =  			      wm8988_line_texts,  			      wm8988_line_values);  static const struct snd_kcontrol_new wm8988_right_line_controls = -	SOC_DAPM_VALUE_ENUM("Route", wm8988_lline_enum); +	SOC_DAPM_ENUM("Route", wm8988_lline_enum);  /* Left Mixer */  static const struct snd_kcontrol_new wm8988_left_mixer_controls[] = { @@ -304,7 +304,7 @@ static const struct soc_enum wm8988_lpga_enum =  			      wm8988_pga_sel,  			      wm8988_pga_val);  static const struct snd_kcontrol_new wm8988_left_pga_controls = -	SOC_DAPM_VALUE_ENUM("Route", wm8988_lpga_enum); +	SOC_DAPM_ENUM("Route", wm8988_lpga_enum);  /* Right PGA Mux */  static const struct soc_enum wm8988_rpga_enum = @@ -313,20 +313,20 @@ static const struct soc_enum wm8988_rpga_enum =  			      wm8988_pga_sel,  			      wm8988_pga_val);  static const struct snd_kcontrol_new wm8988_right_pga_controls = -	SOC_DAPM_VALUE_ENUM("Route", wm8988_rpga_enum); +	SOC_DAPM_ENUM("Route", wm8988_rpga_enum);  /* Differential Mux */  static const char *wm8988_diff_sel[] = {"Line 1", "Line 2"}; -static const struct soc_enum diffmux = -	SOC_ENUM_SINGLE(WM8988_ADCIN, 8, 2, wm8988_diff_sel); +static SOC_ENUM_SINGLE_DECL(diffmux, +			    WM8988_ADCIN, 8, wm8988_diff_sel);  static const struct snd_kcontrol_new wm8988_diffmux_controls =  	SOC_DAPM_ENUM("Route", diffmux);  /* Mono ADC Mux */  static const char *wm8988_mono_mux[] = {"Stereo", "Mono (Left)",  	"Mono (Right)", "Digital Mono"}; -static const struct soc_enum monomux = -	SOC_ENUM_SINGLE(WM8988_ADCIN, 6, 4, wm8988_mono_mux); +static SOC_ENUM_SINGLE_DECL(monomux, +			    WM8988_ADCIN, 6, wm8988_mono_mux);  static const struct snd_kcontrol_new wm8988_monomux_controls =  	SOC_DAPM_ENUM("Route", monomux); @@ -521,30 +521,30 @@ static inline int get_coeff(int mclk, int rate)  /* The set of rates we can generate from the above for each SYSCLK */ -static unsigned int rates_12288[] = { +static const unsigned int rates_12288[] = {  	8000, 12000, 16000, 24000, 24000, 32000, 48000, 96000,  }; -static struct snd_pcm_hw_constraint_list constraints_12288 = { +static const struct snd_pcm_hw_constraint_list constraints_12288 = {  	.count	= ARRAY_SIZE(rates_12288),  	.list	= rates_12288,  }; -static unsigned int rates_112896[] = { +static const unsigned int rates_112896[] = {  	8000, 11025, 22050, 44100,  }; -static struct snd_pcm_hw_constraint_list constraints_112896 = { +static const struct snd_pcm_hw_constraint_list constraints_112896 = {  	.count	= ARRAY_SIZE(rates_112896),  	.list	= rates_112896,  }; -static unsigned int rates_12[] = { +static const unsigned int rates_12[] = {  	8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000,  	48000, 88235, 96000,  }; -static struct snd_pcm_hw_constraint_list constraints_12 = { +static const struct snd_pcm_hw_constraint_list constraints_12 = {  	.count	= ARRAY_SIZE(rates_12),  	.list	= rates_12,  }; @@ -810,16 +810,8 @@ static int wm8988_resume(struct snd_soc_codec *codec)  static int wm8988_probe(struct snd_soc_codec *codec)  { -	struct wm8988_priv *wm8988 = snd_soc_codec_get_drvdata(codec);  	int ret = 0; -	codec->control_data = wm8988->regmap; -	ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP); -	if (ret < 0) { -		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); -		return ret; -	} -  	ret = wm8988_reset(codec);  	if (ret < 0) {  		dev_err(codec->dev, "Failed to issue reset\n"); @@ -912,7 +904,7 @@ static struct spi_driver wm8988_spi_driver = {  };  #endif /* CONFIG_SPI_MASTER */ -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) +#if IS_ENABLED(CONFIG_I2C)  static int wm8988_i2c_probe(struct i2c_client *i2c,  			    const struct i2c_device_id *id)  { @@ -964,7 +956,7 @@ static struct i2c_driver wm8988_i2c_driver = {  static int __init wm8988_modinit(void)  {  	int ret = 0; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) +#if IS_ENABLED(CONFIG_I2C)  	ret = i2c_add_driver(&wm8988_i2c_driver);  	if (ret != 0) {  		printk(KERN_ERR "Failed to register WM8988 I2C driver: %d\n", @@ -984,7 +976,7 @@ module_init(wm8988_modinit);  static void __exit wm8988_exit(void)  { -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) +#if IS_ENABLED(CONFIG_I2C)  	i2c_del_driver(&wm8988_i2c_driver);  #endif  #if defined(CONFIG_SPI_MASTER)  | 
