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

ASoC: wm8994: 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>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f8ae3cf8
...@@ -212,6 +212,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif) ...@@ -212,6 +212,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
static int configure_clock(struct snd_soc_codec *codec) static int configure_clock(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
int change, new; int change, new;
...@@ -239,7 +240,7 @@ static int configure_clock(struct snd_soc_codec *codec) ...@@ -239,7 +240,7 @@ static int configure_clock(struct snd_soc_codec *codec)
change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, change = snd_soc_update_bits(codec, WM8994_CLOCKING_1,
WM8994_SYSCLK_SRC, new); WM8994_SYSCLK_SRC, new);
if (change) if (change)
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm);
wm8958_micd_set_rate(codec); wm8958_micd_set_rate(codec);
...@@ -2492,12 +2493,12 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, ...@@ -2492,12 +2493,12 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY)
active_reference(codec); active_reference(codec);
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
switch (control->type) { switch (control->type) {
case WM8958: case WM8958:
if (control->revision == 0) { if (control->revision == 0) {
...@@ -2521,7 +2522,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, ...@@ -2521,7 +2522,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
WM8994_LINEOUT2_DISCH); WM8994_LINEOUT2_DISCH);
} }
if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE)
active_dereference(codec); active_dereference(codec);
/* MICBIAS into bypass mode on newer devices */ /* MICBIAS into bypass mode on newer devices */
...@@ -2541,7 +2542,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, ...@@ -2541,7 +2542,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY)
wm8994->cur_fw = NULL; wm8994->cur_fw = NULL;
break; break;
} }
...@@ -2552,7 +2553,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, ...@@ -2552,7 +2553,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode) int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode)
{ {
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
switch (mode) { switch (mode) {
case WM8994_VMID_NORMAL: case WM8994_VMID_NORMAL:
...@@ -3354,6 +3355,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994) ...@@ -3354,6 +3355,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
int micbias) int micbias)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994_micdet *micdet; struct wm8994_micdet *micdet;
struct wm8994 *control = wm8994->wm8994; struct wm8994 *control = wm8994->wm8994;
...@@ -3368,20 +3370,16 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, ...@@ -3368,20 +3370,16 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
case 1: case 1:
micdet = &wm8994->micdet[0]; micdet = &wm8994->micdet[0];
if (jack) if (jack)
ret = snd_soc_dapm_force_enable_pin(&codec->dapm, ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
"MICBIAS1");
else else
ret = snd_soc_dapm_disable_pin(&codec->dapm, ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1");
"MICBIAS1");
break; break;
case 2: case 2:
micdet = &wm8994->micdet[1]; micdet = &wm8994->micdet[1];
if (jack) if (jack)
ret = snd_soc_dapm_force_enable_pin(&codec->dapm, ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
"MICBIAS1");
else else
ret = snd_soc_dapm_disable_pin(&codec->dapm, ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1");
"MICBIAS1");
break; break;
default: default:
dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias);
...@@ -3413,7 +3411,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, ...@@ -3413,7 +3411,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK, WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK,
WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB); WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB);
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm);
return 0; return 0;
} }
...@@ -3503,6 +3501,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data) ...@@ -3503,6 +3501,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data)
/* Should be called with accdet_lock held */ /* Should be called with accdet_lock held */
static void wm1811_micd_stop(struct snd_soc_codec *codec) static void wm1811_micd_stop(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
if (!wm8994->jackdet) if (!wm8994->jackdet)
...@@ -3513,8 +3512,7 @@ static void wm1811_micd_stop(struct snd_soc_codec *codec) ...@@ -3513,8 +3512,7 @@ static void wm1811_micd_stop(struct snd_soc_codec *codec)
wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK);
if (wm8994->wm8994->pdata.jd_ext_cap) if (wm8994->wm8994->pdata.jd_ext_cap)
snd_soc_dapm_disable_pin(&codec->dapm, snd_soc_dapm_disable_pin(dapm, "MICBIAS2");
"MICBIAS2");
} }
static void wm8958_button_det(struct snd_soc_codec *codec, u16 status) static void wm8958_button_det(struct snd_soc_codec *codec, u16 status)
...@@ -3623,14 +3621,14 @@ static void wm1811_mic_work(struct work_struct *work) ...@@ -3623,14 +3621,14 @@ static void wm1811_mic_work(struct work_struct *work)
mic_work.work); mic_work.work);
struct wm8994 *control = wm8994->wm8994; struct wm8994 *control = wm8994->wm8994;
struct snd_soc_codec *codec = wm8994->hubs.codec; struct snd_soc_codec *codec = wm8994->hubs.codec;
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
pm_runtime_get_sync(codec->dev); pm_runtime_get_sync(codec->dev);
/* If required for an external cap force MICBIAS on */ /* If required for an external cap force MICBIAS on */
if (control->pdata.jd_ext_cap) { if (control->pdata.jd_ext_cap) {
snd_soc_dapm_force_enable_pin(&codec->dapm, snd_soc_dapm_force_enable_pin(dapm, "MICBIAS2");
"MICBIAS2"); snd_soc_dapm_sync(dapm);
snd_soc_dapm_sync(&codec->dapm);
} }
mutex_lock(&wm8994->accdet_lock); mutex_lock(&wm8994->accdet_lock);
...@@ -3662,6 +3660,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) ...@@ -3662,6 +3660,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
struct wm8994_priv *wm8994 = data; struct wm8994_priv *wm8994 = data;
struct wm8994 *control = wm8994->wm8994; struct wm8994 *control = wm8994->wm8994;
struct snd_soc_codec *codec = wm8994->hubs.codec; struct snd_soc_codec *codec = wm8994->hubs.codec;
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
int reg, delay; int reg, delay;
bool present; bool present;
...@@ -3722,7 +3721,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) ...@@ -3722,7 +3721,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
/* Turn off MICBIAS if it was on for an external cap */ /* Turn off MICBIAS if it was on for an external cap */
if (control->pdata.jd_ext_cap && !present) if (control->pdata.jd_ext_cap && !present)
snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2"); snd_soc_dapm_disable_pin(dapm, "MICBIAS2");
if (present) if (present)
snd_soc_jack_report(wm8994->micdet[0].jack, snd_soc_jack_report(wm8994->micdet[0].jack,
...@@ -3768,6 +3767,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, ...@@ -3768,6 +3767,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
wm1811_micdet_cb det_cb, void *det_cb_data, wm1811_micdet_cb det_cb, void *det_cb_data,
wm1811_mic_id_cb id_cb, void *id_cb_data) wm1811_mic_id_cb id_cb, void *id_cb_data)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct wm8994 *control = wm8994->wm8994; struct wm8994 *control = wm8994->wm8994;
u16 micd_lvl_sel; u16 micd_lvl_sel;
...@@ -3781,8 +3781,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, ...@@ -3781,8 +3781,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
} }
if (jack) { if (jack) {
snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS"); snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS");
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm);
wm8994->micdet[0].jack = jack; wm8994->micdet[0].jack = jack;
...@@ -3817,7 +3817,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, ...@@ -3817,7 +3817,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, snd_soc_update_bits(codec, WM8958_MIC_DETECT_2,
WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel);
WARN_ON(codec->dapm.bias_level > SND_SOC_BIAS_STANDBY); WARN_ON(snd_soc_codec_get_bias_level(codec) > SND_SOC_BIAS_STANDBY);
/* /*
* If we can use jack detection start off with that, * If we can use jack detection start off with that,
...@@ -3844,8 +3844,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, ...@@ -3844,8 +3844,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
WM8958_MICD_ENA, 0); WM8958_MICD_ENA, 0);
wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE); wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE);
snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS"); snd_soc_dapm_disable_pin(dapm, "CLK_SYS");
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm);
} }
return 0; return 0;
...@@ -3983,9 +3983,9 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data) ...@@ -3983,9 +3983,9 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data)
static int wm8994_codec_probe(struct snd_soc_codec *codec) static int wm8994_codec_probe(struct snd_soc_codec *codec)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
struct wm8994 *control = dev_get_drvdata(codec->dev->parent); struct wm8994 *control = dev_get_drvdata(codec->dev->parent);
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
unsigned int reg; unsigned int reg;
int ret, i; int ret, i;
...@@ -4016,7 +4016,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) ...@@ -4016,7 +4016,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
wm8994->micdet_irq = control->pdata.micdet_irq; wm8994->micdet_irq = control->pdata.micdet_irq;
/* By default use idle_bias_off, will override for WM8994 */ /* By default use idle_bias_off, will override for WM8994 */
codec->dapm.idle_bias_off = 1; dapm->idle_bias_off = 1;
/* Set revision-specific configuration */ /* Set revision-specific configuration */
switch (control->type) { switch (control->type) {
...@@ -4024,7 +4024,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) ...@@ -4024,7 +4024,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
/* Single ended line outputs should have VMID on. */ /* Single ended line outputs should have VMID on. */
if (!control->pdata.lineout1_diff || if (!control->pdata.lineout1_diff ||
!control->pdata.lineout2_diff) !control->pdata.lineout2_diff)
codec->dapm.idle_bias_off = 0; dapm->idle_bias_off = 0;
switch (control->revision) { switch (control->revision) {
case 2: case 2:
......
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