alsa-devel.alsa-project.org archive mirror
 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 03/18] ALSA: hda: move hda_eld to use hdac helpers
Date: Tue,  6 Oct 2015 16:07:40 +0100	[thread overview]
Message-ID: <1444144075-28963-4-git-send-email-vinod.koul@intel.com> (raw)
In-Reply-To: <1444144075-28963-1-git-send-email-vinod.koul@intel.com>

Mover this driver 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_eld.c | 65 +++++++++++++++++++++++++++++++++++--------------
 1 file changed, 47 insertions(+), 18 deletions(-)

diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 563984dd2562..3df0ef45c93d 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -150,7 +150,7 @@ static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid,
 {
 	unsigned int val;
 
-	val = snd_hda_codec_read(codec, nid, 0,
+	val = snd_hdac_codec_read(&codec->core, nid, 0,
 					AC_VERB_GET_HDMI_ELDD, byte_index);
 #ifdef BE_PARANOID
 	codec_info(codec, "HDMI: ELD data byte %d: 0x%x\n", byte_index, val);
@@ -312,7 +312,7 @@ out_fail:
 
 int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid)
 {
-	return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE,
+	return snd_hdac_codec_read(&codec->core, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE,
 						 AC_DIPSIZE_ELD_BUF);
 }
 
@@ -675,7 +675,8 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
 
 	/* ATI/AMD does not have ELD, emulate it */
 
-	spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);
+	spkalloc = snd_hdac_codec_read(&codec->core, nid, 0,
+				       ATI_VERB_GET_SPEAKER_ALLOCATION, 0);
 
 	if (spkalloc <= 0) {
 		codec_info(codec, "HDMI ATI/AMD: no speaker allocation for ELD\n");
@@ -699,24 +700,44 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
 	if (rev3_or_later) {
 		int sink_info;
 
-		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_LOW);
-		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     ATI_VERB_SET_SINK_INFO_INDEX,
+				     ATI_INFO_IDX_PORT_ID_LOW);
+		sink_info = snd_hdac_codec_read(&codec->core, nid, 0,
+						ATI_VERB_GET_SINK_INFO_DATA,
+						0);
 		put_unaligned_le32(sink_info, buf + 8);
 
-		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_HIGH);
-		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     ATI_VERB_SET_SINK_INFO_INDEX,
+				     ATI_INFO_IDX_PORT_ID_HIGH);
+		sink_info = snd_hdac_codec_read(&codec->core, nid, 0,
+						ATI_VERB_GET_SINK_INFO_DATA,
+						0);
 		put_unaligned_le32(sink_info, buf + 12);
 
-		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_MANUFACTURER_ID);
-		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     ATI_VERB_SET_SINK_INFO_INDEX,
+				     ATI_INFO_IDX_MANUFACTURER_ID);
+		sink_info = snd_hdac_codec_read(&codec->core, nid, 0,
+						ATI_VERB_GET_SINK_INFO_DATA,
+						0);
 		put_unaligned_le16(sink_info, buf + 16);
 
-		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PRODUCT_ID);
-		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     ATI_VERB_SET_SINK_INFO_INDEX,
+				     ATI_INFO_IDX_PRODUCT_ID);
+		sink_info = snd_hdac_codec_read(&codec->core, nid, 0,
+						ATI_VERB_GET_SINK_INFO_DATA,
+						0);
 		put_unaligned_le16(sink_info, buf + 18);
 
-		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_LEN);
-		sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     ATI_VERB_SET_SINK_INFO_INDEX,
+				     ATI_INFO_IDX_SINK_DESC_LEN);
+		sink_desc_len = snd_hdac_codec_read(&codec->core, nid, 0,
+						    ATI_VERB_GET_SINK_INFO_DATA,
+						    0);
 
 		if (sink_desc_len > ELD_MAX_MNL) {
 			codec_info(codec, "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n",
@@ -727,8 +748,12 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
 		buf[4] |= sink_desc_len;
 
 		for (i = 0; i < sink_desc_len; i++) {
-			snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_FIRST + i);
-			buf[pos++] = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+			snd_hdac_codec_write(&codec->core, nid, 0,
+					     ATI_VERB_SET_SINK_INFO_INDEX,
+					     ATI_INFO_IDX_SINK_DESC_FIRST + i);
+			buf[pos++] = snd_hdac_codec_read(&codec->core, nid, 0,
+							 ATI_VERB_GET_SINK_INFO_DATA,
+							 0);
 		}
 	}
 
@@ -736,8 +761,11 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
 		if (i == AUDIO_CODING_TYPE_SACD || i == AUDIO_CODING_TYPE_DST)
 			continue; /* not handled by ATI/AMD */
 
-		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3);
-		ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0);
+		snd_hdac_codec_write(&codec->core, nid, 0,
+				     ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3);
+		ati_sad = snd_hdac_codec_read(&codec->core, nid, 0,
+					      ATI_VERB_GET_AUDIO_DESCRIPTOR,
+					      0);
 
 		if (ati_sad <= 0)
 			continue;
@@ -778,7 +806,8 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
 	 *  [1..250]   msecs = x*2  (max 500ms with x = 250 = 0xfa)
 	 *  [251..255] reserved
 	 */
-	aud_synch = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0);
+	aud_synch = snd_hdac_codec_read(&codec->core, nid, 0,
+					ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0);
 	if ((aud_synch & ATI_DELAY_VIDEO_LATENCY) && (aud_synch & ATI_DELAY_AUDIO_LATENCY)) {
 		int video_latency_hdmi = (aud_synch & ATI_DELAY_VIDEO_LATENCY);
 		int audio_latency_hdmi = (aud_synch & ATI_DELAY_AUDIO_LATENCY) >> 8;
-- 
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 ` Vinod Koul [this message]
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 ` [PATCH 07/18] ALSA: hda: move hda_proc " Vinod Koul
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-4-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 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).