All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: liam.r.girdwood@linux.intel.com, tiwai@suse.de,
	broonie@kernel.org, Vinod Koul <vinod.koul@intel.com>,
	patches.audio@intel.com
Subject: [PATCH 07/18] ALSA: hda: move hda_proc to use hdac helpers
Date: Tue,  6 Oct 2015 16:07:44 +0100	[thread overview]
Message-ID: <1444144075-28963-8-git-send-email-vinod.koul@intel.com> (raw)
In-Reply-To: <1444144075-28963-1-git-send-email-vinod.koul@intel.com>

Move hda_proc to use newly moved snd_hdac_read/write_codec() and
snd_hdac_check_power_state APIs.

This was done using coccinelle script

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/pci/hda/hda_proc.c | 80 +++++++++++++++++++++++++-----------------------
 1 file changed, 42 insertions(+), 38 deletions(-)

diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 033aa84365b9..297e4501fa4c 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -157,14 +157,14 @@ static void print_amp_vals(struct snd_info_buffer *buffer,
 	dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT;
 	for (i = 0; i < indices; i++) {
 		snd_iprintf(buffer, " [");
-		val = snd_hda_codec_read(codec, nid, 0,
-					 AC_VERB_GET_AMP_GAIN_MUTE,
-					 AC_AMP_GET_LEFT | dir | i);
+		val = snd_hdac_codec_read(&codec->core, nid, 0,
+					  AC_VERB_GET_AMP_GAIN_MUTE,
+					  AC_AMP_GET_LEFT | dir | i);
 		snd_iprintf(buffer, "0x%02x", val);
 		if (stereo) {
-			val = snd_hda_codec_read(codec, nid, 0,
-						 AC_VERB_GET_AMP_GAIN_MUTE,
-						 AC_AMP_GET_RIGHT | dir | i);
+			val = snd_hdac_codec_read(&codec->core, nid, 0,
+						  AC_VERB_GET_AMP_GAIN_MUTE,
+						  AC_AMP_GET_RIGHT | dir | i);
 			snd_iprintf(buffer, " 0x%02x", val);
 		}
 		snd_iprintf(buffer, "]");
@@ -374,8 +374,8 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
 	} else
 		*supports_vref = 0;
 	if (caps & AC_PINCAP_EAPD) {
-		val = snd_hda_codec_read(codec, nid, 0,
-					 AC_VERB_GET_EAPD_BTLENABLE, 0);
+		val = snd_hdac_codec_read(&codec->core, nid, 0,
+					  AC_VERB_GET_EAPD_BTLENABLE, 0);
 		snd_iprintf(buffer, "  EAPD 0x%x:", val);
 		if (val & AC_EAPDBTL_BALANCED)
 			snd_iprintf(buffer, " BALANCED");
@@ -385,7 +385,8 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
 			snd_iprintf(buffer, " R/L");
 		snd_iprintf(buffer, "\n");
 	}
-	caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
+	caps = snd_hdac_codec_read(&codec->core, nid, 0,
+				   AC_VERB_GET_CONFIG_DEFAULT, 0);
 	snd_iprintf(buffer, "  Pin Default 0x%08x: [%s] %s at %s %s\n", caps,
 		    jack_conns[(caps & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT],
 		    get_jack_type(caps),
@@ -417,8 +418,8 @@ static void print_pin_ctls(struct snd_info_buffer *buffer,
 {
 	unsigned int pinctls;
 
-	pinctls = snd_hda_codec_read(codec, nid, 0,
-				     AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+	pinctls = snd_hdac_codec_read(&codec->core, nid, 0,
+				      AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
 	snd_iprintf(buffer, "  Pin-ctls: 0x%02x:", pinctls);
 	if (pinctls & AC_PINCTL_IN_EN)
 		snd_iprintf(buffer, " IN");
@@ -455,8 +456,8 @@ static void print_vol_knob(struct snd_info_buffer *buffer,
 	unsigned int cap = param_read(codec, nid, AC_PAR_VOL_KNB_CAP);
 	snd_iprintf(buffer, "  Volume-Knob: delta=%d, steps=%d, ",
 		    (cap >> 7) & 1, cap & 0x7f);
-	cap = snd_hda_codec_read(codec, nid, 0,
-				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
+	cap = snd_hdac_codec_read(&codec->core, nid, 0,
+				  AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
 	snd_iprintf(buffer, "direct=%d, val=%d\n",
 		    (cap >> 7) & 1, cap & 0x7f);
 }
@@ -465,14 +466,14 @@ static void print_audio_io(struct snd_info_buffer *buffer,
 			   struct hda_codec *codec, hda_nid_t nid,
 			   unsigned int wid_type)
 {
-	int conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
+	int conv = snd_hdac_codec_read(&codec->core, nid, 0, AC_VERB_GET_CONV, 0);
 	snd_iprintf(buffer,
 		    "  Converter: stream=%d, channel=%d\n",
 		    (conv & AC_CONV_STREAM) >> AC_CONV_STREAM_SHIFT,
 		    conv & AC_CONV_CHANNEL);
 
 	if (wid_type == AC_WID_AUD_IN && (conv & AC_CONV_CHANNEL) == 0) {
-		int sdi = snd_hda_codec_read(codec, nid, 0,
+		int sdi = snd_hdac_codec_read(&codec->core, nid, 0,
 					     AC_VERB_GET_SDI_SELECT, 0);
 		snd_iprintf(buffer, "  SDI-Select: %d\n",
 			    sdi & AC_SDI_SELECT);
@@ -482,7 +483,7 @@ static void print_audio_io(struct snd_info_buffer *buffer,
 static void print_digital_conv(struct snd_info_buffer *buffer,
 			       struct hda_codec *codec, hda_nid_t nid)
 {
-	unsigned int digi1 = snd_hda_codec_read(codec, nid, 0,
+	unsigned int digi1 = snd_hdac_codec_read(&codec->core, nid, 0,
 						AC_VERB_GET_DIGI_CONVERT_1, 0);
 	unsigned char digi2 = digi1 >> 8;
 	unsigned char digi3 = digi1 >> 16;
@@ -538,7 +539,7 @@ static void print_power_state(struct snd_info_buffer *buffer,
 	};
 
 	int sup = param_read(codec, nid, AC_PAR_POWER_STATE);
-	int pwr = snd_hda_codec_read(codec, nid, 0,
+	int pwr = snd_hdac_codec_read(&codec->core, nid, 0,
 				     AC_VERB_GET_POWER_STATE, 0);
 	if (sup != -1) {
 		int i;
@@ -567,7 +568,7 @@ static void print_power_state(struct snd_info_buffer *buffer,
 static void print_unsol_cap(struct snd_info_buffer *buffer,
 			      struct hda_codec *codec, hda_nid_t nid)
 {
-	int unsol = snd_hda_codec_read(codec, nid, 0,
+	int unsol = snd_hdac_codec_read(&codec->core, nid, 0,
 				       AC_VERB_GET_UNSOLICITED_RESPONSE, 0);
 	snd_iprintf(buffer,
 		    "  Unsolicited: tag=%02x, enabled=%d\n",
@@ -598,15 +599,18 @@ static void print_proc_caps(struct snd_info_buffer *buffer,
 
 	/* Note: This is racy - another process could run in parallel and change
 	   the coef index too. */
-	oldindex = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_COEF_INDEX, 0);
+	oldindex = snd_hdac_codec_read(&codec->core, nid, 0,
+				       AC_VERB_GET_COEF_INDEX, 0);
 	for (i = 0; i < ncoeff; i++) {
 		unsigned int val;
-		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, i);
-		val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF,
-					 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     AC_VERB_SET_COEF_INDEX, i);
+		val = snd_hdac_codec_read(&codec->core, nid, 0,
+					  AC_VERB_GET_PROC_COEF, 0);
 		snd_iprintf(buffer, "    Coeff 0x%02x: 0x%04x\n", i, val);
 	}
-	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, oldindex);
+	snd_hdac_codec_write(&codec->core, nid, 0, AC_VERB_SET_COEF_INDEX,
+			     oldindex);
 }
 
 static void print_conn_list(struct snd_info_buffer *buffer,
@@ -622,8 +626,8 @@ static void print_conn_list(struct snd_info_buffer *buffer,
 	    wid_type != AC_WID_AUD_MIX &&
 	    wid_type != AC_WID_VOL_KNB &&
 	    wid_type != AC_WID_POWER)
-		curr = snd_hda_codec_read(codec, nid, 0,
-					  AC_VERB_GET_CONNECT_SEL, 0);
+		curr = snd_hdac_codec_read(&codec->core, nid, 0,
+					   AC_VERB_GET_CONNECT_SEL, 0);
 	snd_iprintf(buffer, "  Connection: %d\n", conn_len);
 	if (conn_len > 0) {
 		snd_iprintf(buffer, "    ");
@@ -666,18 +670,18 @@ static void print_gpio(struct snd_info_buffer *buffer,
 	max = gpio & AC_GPIO_IO_COUNT;
 	if (!max || max > 8)
 		return;
-	enable = snd_hda_codec_read(codec, nid, 0,
-				    AC_VERB_GET_GPIO_MASK, 0);
-	direction = snd_hda_codec_read(codec, nid, 0,
-				       AC_VERB_GET_GPIO_DIRECTION, 0);
-	wake = snd_hda_codec_read(codec, nid, 0,
-				  AC_VERB_GET_GPIO_WAKE_MASK, 0);
-	unsol  = snd_hda_codec_read(codec, nid, 0,
+	enable = snd_hdac_codec_read(&codec->core, nid, 0,
+				     AC_VERB_GET_GPIO_MASK, 0);
+	direction = snd_hdac_codec_read(&codec->core, nid, 0,
+					AC_VERB_GET_GPIO_DIRECTION, 0);
+	wake = snd_hdac_codec_read(&codec->core, nid, 0,
+				   AC_VERB_GET_GPIO_WAKE_MASK, 0);
+	unsol = snd_hdac_codec_read(&codec->core, nid, 0,
 				    AC_VERB_GET_GPIO_UNSOLICITED_RSP_MASK, 0);
-	sticky = snd_hda_codec_read(codec, nid, 0,
-				    AC_VERB_GET_GPIO_STICKY_MASK, 0);
-	data = snd_hda_codec_read(codec, nid, 0,
-				  AC_VERB_GET_GPIO_DATA, 0);
+	sticky = snd_hdac_codec_read(&codec->core, nid, 0,
+				     AC_VERB_GET_GPIO_STICKY_MASK, 0);
+	data = snd_hdac_codec_read(&codec->core, nid, 0,
+				   AC_VERB_GET_GPIO_DATA, 0);
 	for (i = 0; i < max; ++i)
 		snd_iprintf(buffer,
 			    "  IO[%d]: enable=%d, dir=%d, wake=%d, "
@@ -706,8 +710,8 @@ static void print_device_list(struct snd_info_buffer *buffer,
 	if (devlist_len <= 0)
 		return;
 
-	curr = snd_hda_codec_read(codec, nid, 0,
-				AC_VERB_GET_DEVICE_SEL, 0);
+	curr = snd_hdac_codec_read(&codec->core, nid, 0,
+				   AC_VERB_GET_DEVICE_SEL, 0);
 
 	for (i = 0; i < devlist_len; i++) {
 		if (i == curr)
-- 
2.4.3

  parent reply	other threads:[~2015-10-06 15:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 15:07 [PATCH 00/18] ALSA: hdac: move hdac helpers to core Vinod Koul
2015-10-06 15:07 ` [PATCH 01/18] ALSA: hdac: Copy codec " Vinod Koul
2015-10-06 15:07 ` [PATCH 02/18] ALSA: hda: move hda beep to use hdac helpers Vinod Koul
2015-10-06 15:07 ` [PATCH 03/18] ALSA: hda: move hda_eld " Vinod Koul
2015-10-06 15:07 ` [PATCH 04/18] ALSA: hda: move hda_generic " Vinod Koul
2015-10-06 15:07 ` [PATCH 05/18] ALSA: hda: move hda_hwdep " Vinod Koul
2015-10-06 15:07 ` [PATCH 06/18] ALSA: hda: move hda_jack " Vinod Koul
2015-10-06 15:07 ` Vinod Koul [this message]
2015-10-06 15:07 ` [PATCH 08/18] ALSA: hda: move patch_analog " Vinod Koul
2015-10-06 15:07 ` [PATCH 09/18] ALSA: hda: move patch_ca0132.c " Vinod Koul
2015-10-06 15:07 ` [PATCH 10/18] ALSA: hda: move patch_cirrus " Vinod Koul
2015-10-06 15:07 ` [PATCH 11/18] ALSA: hda: move " Vinod Koul
2015-10-06 15:07 ` [PATCH 12/18] ALSA: hda: move patch_hdmi " Vinod Koul
2015-10-06 15:07 ` [PATCH 13/18] ALSA: hda: move patch_realtek " Vinod Koul
2015-10-06 15:07 ` [PATCH 14/18] ALSA: hda: move patch_si3054 " Vinod Koul
2015-10-06 15:07 ` [PATCH 15/18] ALSA: hda: move patch_sigmatel " Vinod Koul
2015-10-06 15:07 ` [PATCH 16/18] ALSA: hda: move patch_via " Vinod Koul
2015-10-06 15:07 ` [PATCH 17/18] ALSA: hda: move hda_codec " Vinod Koul
2015-10-06 15:07 ` [PATCH 18/18] ALSA: hda: remove the old helpers Vinod Koul
2015-10-06 18:12 ` [PATCH 00/18] ALSA: hdac: move hdac helpers to core Takashi Iwai
2015-10-07 10:52   ` Koul, Vinod

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=1444144075-28963-8-git-send-email-vinod.koul@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.