Commit e2ada818 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: rt5645: Replace direct snd_soc_codec dapm field access

The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all
other manual access to codec->dapm with snd_soc_codec_get_dapm().
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d770e558
...@@ -2642,7 +2642,7 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, ...@@ -2642,7 +2642,7 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec,
switch (level) { switch (level) {
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
if (SND_SOC_BIAS_STANDBY == codec->dapm.bias_level) { if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) {
snd_soc_update_bits(codec, RT5645_PWR_ANLG1, snd_soc_update_bits(codec, RT5645_PWR_ANLG1,
RT5645_PWR_VREF1 | RT5645_PWR_MB | RT5645_PWR_VREF1 | RT5645_PWR_MB |
RT5645_PWR_BG | RT5645_PWR_VREF2, RT5645_PWR_BG | RT5645_PWR_VREF2,
...@@ -2760,20 +2760,17 @@ static int rt5650_calibration(struct rt5645_priv *rt5645) ...@@ -2760,20 +2760,17 @@ static int rt5650_calibration(struct rt5645_priv *rt5645)
static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec,
bool enable) bool enable)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
if (enable) { if (enable) {
snd_soc_dapm_mutex_lock(&codec->dapm); snd_soc_dapm_mutex_lock(dapm);
snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC L power");
"ADC L power"); snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC R power");
snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO2");
"ADC R power"); snd_soc_dapm_force_enable_pin_unlocked(dapm, "Mic Det Power");
snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, snd_soc_dapm_sync_unlocked(dapm);
"LDO2"); snd_soc_dapm_mutex_unlock(dapm);
snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm,
"Mic Det Power");
snd_soc_dapm_sync_unlocked(&codec->dapm);
snd_soc_dapm_mutex_unlock(&codec->dapm);
snd_soc_update_bits(codec, snd_soc_update_bits(codec,
RT5645_INT_IRQ_ST, 0x8, 0x8); RT5645_INT_IRQ_ST, 0x8, 0x8);
...@@ -2786,23 +2783,20 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, ...@@ -2786,23 +2783,20 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0);
snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0);
snd_soc_dapm_mutex_lock(&codec->dapm); snd_soc_dapm_mutex_lock(dapm);
snd_soc_dapm_disable_pin_unlocked(&codec->dapm, snd_soc_dapm_disable_pin_unlocked(dapm, "ADC L power");
"ADC L power"); snd_soc_dapm_disable_pin_unlocked(dapm, "ADC R power");
snd_soc_dapm_disable_pin_unlocked(&codec->dapm,
"ADC R power");
if (rt5645->pdata.jd_mode == 0) if (rt5645->pdata.jd_mode == 0)
snd_soc_dapm_disable_pin_unlocked(&codec->dapm, snd_soc_dapm_disable_pin_unlocked(dapm, "LDO2");
"LDO2"); snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Det Power");
snd_soc_dapm_disable_pin_unlocked(&codec->dapm, snd_soc_dapm_sync_unlocked(dapm);
"Mic Det Power"); snd_soc_dapm_mutex_unlock(dapm);
snd_soc_dapm_sync_unlocked(&codec->dapm);
snd_soc_dapm_mutex_unlock(&codec->dapm);
} }
} }
static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
unsigned int val; unsigned int val;
...@@ -2811,10 +2805,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) ...@@ -2811,10 +2805,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
if (codec->component.card->instantiated) { if (codec->component.card->instantiated) {
/* for jack type detect */ /* for jack type detect */
snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2"); snd_soc_dapm_force_enable_pin(dapm, "LDO2");
snd_soc_dapm_force_enable_pin(&codec->dapm, snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power");
"Mic Det Power"); snd_soc_dapm_sync(dapm);
snd_soc_dapm_sync(&codec->dapm);
} else { } else {
/* Power up necessary bits for JD if dapm is /* Power up necessary bits for JD if dapm is
not ready yet */ not ready yet */
...@@ -2847,9 +2840,8 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) ...@@ -2847,9 +2840,8 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
} }
} else { } else {
if (codec->component.card->instantiated) { if (codec->component.card->instantiated) {
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin(dapm, "Mic Det Power");
"Mic Det Power"); snd_soc_dapm_sync(dapm);
snd_soc_dapm_sync(&codec->dapm);
} else } else
regmap_update_bits(rt5645->regmap, regmap_update_bits(rt5645->regmap,
RT5645_PWR_VOL, RT5645_PWR_MIC_DET, 0); RT5645_PWR_VOL, RT5645_PWR_MIC_DET, 0);
...@@ -2863,11 +2855,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) ...@@ -2863,11 +2855,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
else { else {
if (codec->component.card->instantiated) { if (codec->component.card->instantiated) {
if (rt5645->pdata.jd_mode == 0) if (rt5645->pdata.jd_mode == 0)
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin(dapm, "LDO2");
"LDO2"); snd_soc_dapm_disable_pin(dapm, "Mic Det Power");
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_sync(dapm);
"Mic Det Power");
snd_soc_dapm_sync(&codec->dapm);
} else { } else {
if (rt5645->pdata.jd_mode == 0) if (rt5645->pdata.jd_mode == 0)
regmap_update_bits(rt5645->regmap, regmap_update_bits(rt5645->regmap,
...@@ -3043,21 +3033,22 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645) ...@@ -3043,21 +3033,22 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645)
static int rt5645_probe(struct snd_soc_codec *codec) static int rt5645_probe(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
rt5645->codec = codec; rt5645->codec = codec;
switch (rt5645->codec_type) { switch (rt5645->codec_type) {
case CODEC_TYPE_RT5645: case CODEC_TYPE_RT5645:
snd_soc_dapm_add_routes(&codec->dapm, snd_soc_dapm_add_routes(dapm,
rt5645_specific_dapm_routes, rt5645_specific_dapm_routes,
ARRAY_SIZE(rt5645_specific_dapm_routes)); ARRAY_SIZE(rt5645_specific_dapm_routes));
break; break;
case CODEC_TYPE_RT5650: case CODEC_TYPE_RT5650:
snd_soc_dapm_new_controls(&codec->dapm, snd_soc_dapm_new_controls(dapm,
rt5650_specific_dapm_widgets, rt5650_specific_dapm_widgets,
ARRAY_SIZE(rt5650_specific_dapm_widgets)); ARRAY_SIZE(rt5650_specific_dapm_widgets));
snd_soc_dapm_add_routes(&codec->dapm, snd_soc_dapm_add_routes(dapm,
rt5650_specific_dapm_routes, rt5650_specific_dapm_routes,
ARRAY_SIZE(rt5650_specific_dapm_routes)); ARRAY_SIZE(rt5650_specific_dapm_routes));
break; break;
...@@ -3067,9 +3058,9 @@ static int rt5645_probe(struct snd_soc_codec *codec) ...@@ -3067,9 +3058,9 @@ static int rt5645_probe(struct snd_soc_codec *codec)
/* for JD function */ /* for JD function */
if (rt5645->pdata.jd_mode) { if (rt5645->pdata.jd_mode) {
snd_soc_dapm_force_enable_pin(&codec->dapm, "JD Power"); snd_soc_dapm_force_enable_pin(dapm, "JD Power");
snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2"); snd_soc_dapm_force_enable_pin(dapm, "LDO2");
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment