alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: Brian Austin <brian.austin@cirrus.com>,
	alsa-devel@alsa-project.org,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	Paul Handrigan <Paul.Handrigan@cirrus.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 41/47] ASoC: wm8994: Replace direct snd_soc_codec dapm field access
Date: Mon,  1 Jun 2015 10:11:00 +0200	[thread overview]
Message-ID: <1433146266-1599-41-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1433146266-1599-1-git-send-email-lars@metafoo.de>

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: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/wm8994.c | 58 +++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 2d32b54..99a758a 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -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)
 {
+	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
 	struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 	int change, new;
 
@@ -239,7 +240,7 @@ static int configure_clock(struct snd_soc_codec *codec)
 	change = snd_soc_update_bits(codec, WM8994_CLOCKING_1,
 				     WM8994_SYSCLK_SRC, new);
 	if (change)
-		snd_soc_dapm_sync(&codec->dapm);
+		snd_soc_dapm_sync(dapm);
 
 	wm8958_micd_set_rate(codec);
 
@@ -2492,12 +2493,12 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
 			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);
 		break;
 
 	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) {
 			case WM8958:
 				if (control->revision == 0) {
@@ -2521,7 +2522,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
 					    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);
 
 		/* MICBIAS into bypass mode on newer devices */
@@ -2541,7 +2542,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
 		break;
 
 	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;
 		break;
 	}
@@ -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)
 {
 	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) {
 	case WM8994_VMID_NORMAL:
@@ -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 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_micdet *micdet;
 	struct wm8994 *control = wm8994->wm8994;
@@ -3368,20 +3370,16 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
 	case 1:
 		micdet = &wm8994->micdet[0];
 		if (jack)
-			ret = snd_soc_dapm_force_enable_pin(&codec->dapm,
-							    "MICBIAS1");
+			ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
 		else
-			ret = snd_soc_dapm_disable_pin(&codec->dapm,
-						       "MICBIAS1");
+			ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1");
 		break;
 	case 2:
 		micdet = &wm8994->micdet[1];
 		if (jack)
-			ret = snd_soc_dapm_force_enable_pin(&codec->dapm,
-							    "MICBIAS1");
+			ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
 		else
-			ret = snd_soc_dapm_disable_pin(&codec->dapm,
-						       "MICBIAS1");
+			ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1");
 		break;
 	default:
 		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,
 			    WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK,
 			    WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB);
 
-	snd_soc_dapm_sync(&codec->dapm);
+	snd_soc_dapm_sync(dapm);
 
 	return 0;
 }
@@ -3503,6 +3501,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data)
 /* Should be called with accdet_lock held */
 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);
 
 	if (!wm8994->jackdet)
@@ -3513,8 +3512,7 @@ static void wm1811_micd_stop(struct snd_soc_codec *codec)
 	wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK);
 
 	if (wm8994->wm8994->pdata.jd_ext_cap)
-		snd_soc_dapm_disable_pin(&codec->dapm,
-					 "MICBIAS2");
+		snd_soc_dapm_disable_pin(dapm, "MICBIAS2");
 }
 
 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)
 						  mic_work.work);
 	struct wm8994 *control = wm8994->wm8994;
 	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);
 
 	/* If required for an external cap force MICBIAS on */
 	if (control->pdata.jd_ext_cap) {
-		snd_soc_dapm_force_enable_pin(&codec->dapm,
-					      "MICBIAS2");
-		snd_soc_dapm_sync(&codec->dapm);
+		snd_soc_dapm_force_enable_pin(dapm, "MICBIAS2");
+		snd_soc_dapm_sync(dapm);
 	}
 
 	mutex_lock(&wm8994->accdet_lock);
@@ -3662,6 +3660,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
 	struct wm8994_priv *wm8994 = data;
 	struct wm8994 *control = wm8994->wm8994;
 	struct snd_soc_codec *codec = wm8994->hubs.codec;
+	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
 	int reg, delay;
 	bool present;
 
@@ -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 */
 	if (control->pdata.jd_ext_cap && !present)
-		snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2");
+		snd_soc_dapm_disable_pin(dapm, "MICBIAS2");
 
 	if (present)
 		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,
 		      wm1811_micdet_cb det_cb, void *det_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 *control = wm8994->wm8994;
 	u16 micd_lvl_sel;
@@ -3781,8 +3781,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
 	}
 
 	if (jack) {
-		snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS");
-		snd_soc_dapm_sync(&codec->dapm);
+		snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS");
+		snd_soc_dapm_sync(dapm);
 
 		wm8994->micdet[0].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,
 				    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,
@@ -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,
 				    WM8958_MICD_ENA, 0);
 		wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE);
-		snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS");
-		snd_soc_dapm_sync(&codec->dapm);
+		snd_soc_dapm_disable_pin(dapm, "CLK_SYS");
+		snd_soc_dapm_sync(dapm);
 	}
 
 	return 0;
@@ -3983,9 +3983,9 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data)
 
 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_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
 	unsigned int reg;
 	int ret, i;
 
@@ -4016,7 +4016,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
 	wm8994->micdet_irq = control->pdata.micdet_irq;
 
 	/* 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 */
 	switch (control->type) {
@@ -4024,7 +4024,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
 		/* Single ended line outputs should have VMID on. */
 		if (!control->pdata.lineout1_diff ||
 		    !control->pdata.lineout2_diff)
-			codec->dapm.idle_bias_off = 0;
+			dapm->idle_bias_off = 0;
 
 		switch (control->revision) {
 		case 2:
-- 
2.1.4

  parent reply	other threads:[~2015-06-01  8:11 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  8:10 [PATCH 01/47] ASoC: cs42l52: Replace direct snd_soc_codec dapm field access Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 02/47] ASoC: cs42l56: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 03/47] ASoC: cs42l73: " Lars-Peter Clausen
2015-06-01 12:12   ` Brian Austin
2015-06-01  8:10 ` [PATCH 04/47] ASoC: cs42xx8: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 05/47] ASoC: arizona: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 06/47] ASoC: wm0010: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 07/47] ASoC: wm5100: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 08/47] ASoC: wm5102: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 09/47] ASoC: wm5110: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 10/47] ASoC: wm8350: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 11/47] ASoC: wm8400: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 12/47] ASoC: wm8510: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 13/47] ASoC: wm8523: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 14/47] ASoC: wm8580: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 15/47] ASoC: wm8711: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 16/47] ASoC: wm8728: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 17/47] ASoC: wm8731: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 18/47] ASoC: wm8737: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 19/47] ASoC: wm8750: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 20/47] ASoC: wm8753: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 21/47] ASoC: wm8770: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 22/47] ASoC: wm8776: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 23/47] ASoC: wm8804: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 24/47] ASoC: wm8900: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 25/47] ASoC: wm8903: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 26/47] ASoC: wm8904: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 27/47] ASoC: wm8940: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 28/47] ASoC: wm8955: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 29/47] ASoC: wm8960: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 30/47] ASoC: wm8961: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 31/47] ASoC: wm8962: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 32/47] ASoC: wm8971: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 33/47] ASoC: wm8974: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 34/47] ASoC: wm8978: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 35/47] ASoC: wm8983: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 36/47] ASoC: wm8985: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 37/47] ASoC: wm8988: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 38/47] ASoC: wm8990: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 39/47] ASoC: wm8991: " Lars-Peter Clausen
2015-06-01  8:10 ` [PATCH 40/47] ASoC: wm8993: " Lars-Peter Clausen
2015-06-01  8:11 ` Lars-Peter Clausen [this message]
2015-06-01  8:11 ` [PATCH 42/47] ASoC: wm8995: " Lars-Peter Clausen
2015-06-01  8:11 ` [PATCH 43/47] ASoC: wm8996: " Lars-Peter Clausen
2015-06-01  8:11 ` [PATCH 44/47] ASoC: wm8997: " Lars-Peter Clausen
2015-06-01  8:11 ` [PATCH 45/47] ASoC: wm9081: " Lars-Peter Clausen
2015-06-01  8:11 ` [PATCH 46/47] ASoC: wm9090: " Lars-Peter Clausen
2015-06-01  8:11 ` [PATCH 47/47] ASoC: wm_hubs: " Lars-Peter Clausen
2015-06-01  9:13   ` Charles Keepax
2015-06-01 15:46 ` [PATCH 01/47] ASoC: cs42l52: " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433146266-1599-41-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=Paul.Handrigan@cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brian.austin@cirrus.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=lgirdwood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).