diff options
Diffstat (limited to 'sound/soc/codecs/sta32x.c')
| -rw-r--r-- | sound/soc/codecs/sta32x.c | 94 | 
1 files changed, 40 insertions, 54 deletions
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 06edb396e73..0579d187135 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = {  	13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0),  }; -static const struct soc_enum sta32x_drc_ac_enum = -	SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, -			2, sta32x_drc_ac); -static const struct soc_enum sta32x_auto_eq_enum = -	SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, -			3, sta32x_auto_eq_mode); -static const struct soc_enum sta32x_auto_gc_enum = -	SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, -			4, sta32x_auto_gc_mode); -static const struct soc_enum sta32x_auto_xo_enum = -	SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, -			16, sta32x_auto_xo_mode); -static const struct soc_enum sta32x_preset_eq_enum = -	SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, -			32, sta32x_preset_eq_mode); -static const struct soc_enum sta32x_limiter_ch1_enum = -	SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, -			3, sta32x_limiter_select); -static const struct soc_enum sta32x_limiter_ch2_enum = -	SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, -			3, sta32x_limiter_select); -static const struct soc_enum sta32x_limiter_ch3_enum = -	SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, -			3, sta32x_limiter_select); -static const struct soc_enum sta32x_limiter1_attack_rate_enum = -	SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT, -			16, sta32x_limiter_attack_rate); -static const struct soc_enum sta32x_limiter2_attack_rate_enum = -	SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT, -			16, sta32x_limiter_attack_rate); -static const struct soc_enum sta32x_limiter1_release_rate_enum = -	SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT, -			16, sta32x_limiter_release_rate); -static const struct soc_enum sta32x_limiter2_release_rate_enum = -	SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT, -			16, sta32x_limiter_release_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum, +			    STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, +			    sta32x_drc_ac); +static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum, +			    STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, +			    sta32x_auto_eq_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum, +			    STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, +			    sta32x_auto_gc_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum, +			    STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, +			    sta32x_auto_xo_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum, +			    STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, +			    sta32x_preset_eq_mode); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum, +			    STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, +			    sta32x_limiter_select); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum, +			    STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, +			    sta32x_limiter_select); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum, +			    STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, +			    sta32x_limiter_select); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum, +			    STA32X_L1AR, STA32X_LxA_SHIFT, +			    sta32x_limiter_attack_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum, +			    STA32X_L2AR, STA32X_LxA_SHIFT, +			    sta32x_limiter_attack_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum, +			    STA32X_L1AR, STA32X_LxR_SHIFT, +			    sta32x_limiter_release_rate); +static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum, +			    STA32X_L2AR, STA32X_LxR_SHIFT, +			    sta32x_limiter_release_rate);  /* byte array controls for setting biquad, mixer, scaling coefficients;   * for biquads all five coefficients need to be set in one go, @@ -243,7 +243,7 @@ static int sta32x_coefficient_info(struct snd_kcontrol *kcontrol,  static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol,  				  struct snd_ctl_elem_value *ucontrol)  { -	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); +	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);  	int numcoef = kcontrol->private_value >> 16;  	int index = kcontrol->private_value & 0xffff;  	unsigned int cfud; @@ -272,7 +272,7 @@ static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol,  static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,  				  struct snd_ctl_elem_value *ucontrol)  { -	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); +	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);  	struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);  	int numcoef = kcontrol->private_value >> 16;  	int index = kcontrol->private_value & 0xffff; @@ -331,7 +331,7 @@ static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)  static int sta32x_cache_sync(struct snd_soc_codec *codec)  { -	struct sta32x_priv *sta32x = codec->control_data; +	struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);  	unsigned int mute;  	int rc; @@ -434,7 +434,7 @@ SOC_SINGLE_TLV("Treble Tone Control", STA32X_TONE, STA32X_TONE_TTC_SHIFT, 15, 0,  SOC_ENUM("Limiter1 Attack Rate (dB/ms)", sta32x_limiter1_attack_rate_enum),  SOC_ENUM("Limiter2 Attack Rate (dB/ms)", sta32x_limiter2_attack_rate_enum),  SOC_ENUM("Limiter1 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), -SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), +SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter2_release_rate_enum),  /* depending on mode, the attack/release thresholds have   * two different enum definitions; provide both @@ -872,16 +872,6 @@ static int sta32x_probe(struct snd_soc_codec *codec)  		return ret;  	} -	/* Tell ASoC what kind of I/O to use to read the registers.  ASoC will -	 * then do the I2C transactions itself. -	 */ -	codec->control_data = sta32x->regmap; -	ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); -	if (ret < 0) { -		dev_err(codec->dev, "failed to set cache I/O (ret=%i)\n", ret); -		goto err; -	} -  	/* Chip documentation explicitly requires that the reset values  	 * of reserved register bits are left untouched.  	 * Write the register default value to cache for reserved registers, @@ -946,10 +936,6 @@ static int sta32x_probe(struct snd_soc_codec *codec)  	regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);  	return 0; - -err: -	regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); -	return ret;  }  static int sta32x_remove(struct snd_soc_codec *codec)  | 
