ASoC: Avoid direct register cache access when setting defaults
Subsystems (3)
PATCH 1/1 ASoC: Avoid direct register cache access when setting defaults
Directly accessing the register cache means that we can't use anything except a flat register cache so use snd_soc_update_bits().
Signed-off-by Mark Brown <[email protected]>
--- sound/soc/codecs/wm8523.c | 6 +++--- sound/soc/codecs/wm8741.c | 13 ++++++++----- sound/soc/codecs/wm8904.c | 41 ++++++++++++++++++++++++++--------------- sound/soc/codecs/wm8955.c | 27 +++++++++++++++++++-------- sound/soc/codecs/wm8962.c | 30 ++++++++++++++++++++---------- sound/soc/codecs/wm8978.c | 2 +- sound/soc/codecs/wm9090.c | 41 ++++++++++++++++++++++++----------------- 7 files changed, 101 insertions(+), 59 deletions(-)
sound/soc/codecs/wm8523.c +3 -3
@@ -414,7 +414,6 @@ static int wm8523_resume(struct snd_soc_codec *codec)static int wm8523_probe (struct snd_soc_codec *codec) {struct wm8523_priv *wm8523 =snd_soc_codec_get_drvdata (codec); -u16 *reg_cache = codec->reg_cache;int ret, i; codec->hw_write = (hw_write_t )i2c_master_send;
@@ -471,8 +470,9 @@ static int wm8523_probe(struct snd_soc_codec *codec) }/* Change some default settings - latch VU and enable ZC */ - reg_cache[WM8523_DAC_GAINR ] |=WM8523_DACR_VU ; - reg_cache[WM8523_DAC_CTRL3 ] |=WM8523_ZC ; +snd_soc_update_bits (codec,WM8523_DAC_GAINR , +WM8523_DACR_VU ,WM8523_DACR_VU ); +snd_soc_update_bits (codec,WM8523_DAC_CTRL3 ,WM8523_ZC ,WM8523_ZC );wm8523_set_bias_level (codec,SND_SOC_BIAS_STANDBY );
sound/soc/codecs/wm8741.c +8 -5
@@ -421,7 +421,6 @@ static int wm8741_resume(struct snd_soc_codec *codec)static int wm8741_probe (struct snd_soc_codec *codec) {struct wm8741_priv *wm8741 =snd_soc_codec_get_drvdata (codec); -u16 *reg_cache = codec->reg_cache;int ret =0 ; ret =snd_soc_codec_set_cache_io (codec,7 ,9 , wm8741->control_type);
@@ -437,10 +436,14 @@ static int wm8741_probe(struct snd_soc_codec *codec) }/* Change some default settings - latch VU */ - reg_cache[WM8741_DACLLSB_ATTENUATION ] |=WM8741_UPDATELL ; - reg_cache[WM8741_DACLMSB_ATTENUATION ] |=WM8741_UPDATELM ; - reg_cache[WM8741_DACRLSB_ATTENUATION ] |=WM8741_UPDATERL ; - reg_cache[WM8741_DACRLSB_ATTENUATION ] |=WM8741_UPDATERM ; +snd_soc_update_bits (codec,WM8741_DACLLSB_ATTENUATION , +WM8741_UPDATELL ,WM8741_UPDATELL ); +snd_soc_update_bits (codec,WM8741_DACLMSB_ATTENUATION , +WM8741_UPDATELM ,WM8741_UPDATELM ); +snd_soc_update_bits (codec,WM8741_DACRLSB_ATTENUATION , +WM8741_UPDATERL ,WM8741_UPDATERL ); +snd_soc_update_bits (codec,WM8741_DACRLSB_ATTENUATION , +WM8741_UPDATERM ,WM8741_UPDATERM );snd_soc_add_controls (codec, wm8741_snd_controls,ARRAY_SIZE (wm8741_snd_controls));
sound/soc/codecs/wm8904.c +26 -15
55 lines not on this page · raw message
sound/soc/codecs/wm8955.c +19 -8
@@ -934,16 +934,27 @@ static int wm8955_probe(struct snd_soc_codec *codec) }/* Change some default settings - latch VU and enable ZC */ - reg_cache[WM8955_LEFT_DAC_VOLUME ] |=WM8955_LDVU ; - reg_cache[WM8955_RIGHT_DAC_VOLUME ] |=WM8955_RDVU ; - reg_cache[WM8955_LOUT1_VOLUME ] |=WM8955_LO1VU |WM8955_LO1ZC ; - reg_cache[WM8955_ROUT1_VOLUME ] |=WM8955_RO1VU |WM8955_RO1ZC ; - reg_cache[WM8955_LOUT2_VOLUME ] |=WM8955_LO2VU |WM8955_LO2ZC ; - reg_cache[WM8955_ROUT2_VOLUME ] |=WM8955_RO2VU |WM8955_RO2ZC ; - reg_cache[WM8955_MONOOUT_VOLUME ] |=WM8955_MOZC ; +snd_soc_update_bits (codec,WM8955_LEFT_DAC_VOLUME , +WM8955_LDVU ,WM8955_LDVU ); +snd_soc_update_bits (codec,WM8955_RIGHT_DAC_VOLUME , +WM8955_RDVU ,WM8955_RDVU ); +snd_soc_update_bits (codec,WM8955_LOUT1_VOLUME , +WM8955_LO1VU |WM8955_LO1ZC , +WM8955_LO1VU |WM8955_LO1ZC ); +snd_soc_update_bits (codec,WM8955_ROUT1_VOLUME , +WM8955_RO1VU |WM8955_RO1ZC , +WM8955_RO1VU |WM8955_RO1ZC ); +snd_soc_update_bits (codec,WM8955_LOUT2_VOLUME , +WM8955_LO2VU |WM8955_LO2ZC , +WM8955_LO2VU |WM8955_LO2ZC ); +snd_soc_update_bits (codec,WM8955_ROUT2_VOLUME , +WM8955_RO2VU |WM8955_RO2ZC , +WM8955_RO2VU |WM8955_RO2ZC ); +snd_soc_update_bits (codec,WM8955_MONOOUT_VOLUME , +WM8955_MOZC ,WM8955_MOZC );/* Also enable adaptive bass boost by default */ - reg_cache[WM8955_BASS_CONTROL ] |=WM8955_BB ; +snd_soc_update_bits (codec,WM8955_BASS_CONTROL ,WM8955_BB ,WM8955_BB );/* Set platform data values */ if (pdata) {
sound/soc/codecs/wm8962.c +20 -10
@@ -3822,16 +3822,26 @@ static int wm8962_probe(struct snd_soc_codec *codec) }/* Latch volume update bits */ - reg_cache[WM8962_LEFT_INPUT_VOLUME ] |=WM8962_IN_VU ; - reg_cache[WM8962_RIGHT_INPUT_VOLUME ] |=WM8962_IN_VU ; - reg_cache[WM8962_LEFT_ADC_VOLUME ] |=WM8962_ADC_VU ; - reg_cache[WM8962_RIGHT_ADC_VOLUME ] |=WM8962_ADC_VU ; - reg_cache[WM8962_LEFT_DAC_VOLUME ] |=WM8962_DAC_VU ; - reg_cache[WM8962_RIGHT_DAC_VOLUME ] |=WM8962_DAC_VU ; - reg_cache[WM8962_SPKOUTL_VOLUME ] |=WM8962_SPKOUT_VU ; - reg_cache[WM8962_SPKOUTR_VOLUME ] |=WM8962_SPKOUT_VU ; - reg_cache[WM8962_HPOUTL_VOLUME ] |=WM8962_HPOUT_VU ; - reg_cache[WM8962_HPOUTR_VOLUME ] |=WM8962_HPOUT_VU ; +snd_soc_update_bits (codec,WM8962_LEFT_INPUT_VOLUME , +WM8962_IN_VU ,WM8962_IN_VU ); +snd_soc_update_bits (codec,WM8962_RIGHT_INPUT_VOLUME , +WM8962_IN_VU ,WM8962_IN_VU ); +snd_soc_update_bits (codec,WM8962_LEFT_ADC_VOLUME , +WM8962_ADC_VU ,WM8962_ADC_VU ); +snd_soc_update_bits (codec,WM8962_RIGHT_ADC_VOLUME , +WM8962_ADC_VU ,WM8962_ADC_VU ); +snd_soc_update_bits (codec,WM8962_LEFT_DAC_VOLUME , +WM8962_DAC_VU ,WM8962_DAC_VU ); +snd_soc_update_bits (codec,WM8962_RIGHT_DAC_VOLUME , +WM8962_DAC_VU ,WM8962_DAC_VU ); +snd_soc_update_bits (codec,WM8962_SPKOUTL_VOLUME , +WM8962_SPKOUT_VU ,WM8962_SPKOUT_VU ); +snd_soc_update_bits (codec,WM8962_SPKOUTR_VOLUME , +WM8962_SPKOUT_VU ,WM8962_SPKOUT_VU ); +snd_soc_update_bits (codec,WM8962_HPOUTL_VOLUME , +WM8962_HPOUT_VU ,WM8962_HPOUT_VU ); +snd_soc_update_bits (codec,WM8962_HPOUTR_VOLUME , +WM8962_HPOUT_VU ,WM8962_HPOUT_VU );wm8962_add_widgets (codec);
sound/soc/codecs/wm8978.c +1 -1
@@ -965,7 +965,7 @@ static int wm8978_probe(struct snd_soc_codec *codec)* written. */ for (i =0 ; i <ARRAY_SIZE (update_reg); i++) - ((u16 *)codec->reg_cache)[update_reg[i]] |=0x100 ; +snd_soc_update_bits (codec, update_reg[i],0x100 ,0x100 );/* Reset the codec */ ret =snd_soc_write (codec,WM8978_RESET ,0 );
sound/soc/codecs/wm9090.c +24 -17
53 lines not on this page · raw message
Signature · 1 line
1.7.2.3
Quoted 4 lines · Mark Brown
Directly accessing the register cache means that we can't use anything except a flat register cache so use
snd_soc_update_bits().Signed-off-by Mark Brown <[email protected]>
Quoted 9 lines
--- sound/soc/codecs/wm8523.c | 6 +++--- sound/soc/codecs/wm8741.c | 13 ++++++++----- sound/soc/codecs/wm8904.c | 41 ++++++++++++++++++++++++++--------------- sound/soc/codecs/wm8955.c | 27 +++++++++++++++++++-------- sound/soc/codecs/wm8962.c | 30 ++++++++++++++++++++---------- sound/soc/codecs/wm8978.c | 2 +- sound/soc/codecs/wm9090.c | 41 ++++++++++++++++++++++++----------------- 7 files changed, 101 insertions(+), 59 deletions(-)
Acked-by Liam Girdwood <[email protected]>
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk