All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: [PATCH] hda: move open coded tricks into get_wcaps_channels()
Date: Mon, 24 Aug 2009 09:50:46 +0800	[thread overview]
Message-ID: <20090824015046.GA10025@localhost> (raw)

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 sound/pci/hda/hda_local.h     |   10 ++++++++++
 sound/pci/hda/hda_proc.c      |    4 +---
 sound/pci/hda/patch_atihdmi.c |    3 +--
 3 files changed, 12 insertions(+), 5 deletions(-)

--- sound-2.6.orig/sound/pci/hda/hda_local.h	2009-08-24 09:48:57.000000000 +0800
+++ sound-2.6/sound/pci/hda/hda_local.h	2009-08-24 09:49:44.000000000 +0800
@@ -410,6 +410,16 @@ static inline u32 get_wcaps(struct hda_c
 /* get the widget type from widget capability bits */
 #define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT)
 
+static inline unsigned int get_wcaps_channels(u32 wcaps)
+{
+	unsigned int chans;
+
+	chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13;
+	chans = ((chans << 1) | 1) + 1;
+
+	return chans;
+}
+
 u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
 			      unsigned int caps);
--- sound-2.6.orig/sound/pci/hda/hda_proc.c	2009-08-24 09:48:57.000000000 +0800
+++ sound-2.6/sound/pci/hda/hda_proc.c	2009-08-24 09:49:44.000000000 +0800
@@ -515,9 +515,7 @@ static void print_codec_info(struct snd_
 		snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid,
 			    get_wid_type_name(wid_type), wid_caps);
 		if (wid_caps & AC_WCAP_STEREO) {
-			unsigned int chans;
-			chans = (wid_caps & AC_WCAP_CHAN_CNT_EXT) >> 13;
-			chans = ((chans << 1) | 1) + 1;
+			unsigned int chans = get_wcaps_channels(wid_caps);
 			if (chans == 2)
 				snd_iprintf(buffer, " Stereo");
 			else
--- sound-2.6.orig/sound/pci/hda/patch_atihdmi.c	2009-08-24 09:48:57.000000000 +0800
+++ sound-2.6/sound/pci/hda/patch_atihdmi.c	2009-08-24 09:49:44.000000000 +0800
@@ -141,8 +141,7 @@ static int atihdmi_build_pcms(struct hda
 	/* FIXME: we must check ELD and change the PCM parameters dynamically
 	 */
 	chans = get_wcaps(codec, CVT_NID);
-	chans = (chans & AC_WCAP_CHAN_CNT_EXT) >> 13;
-	chans = ((chans << 1) | 1) + 1;
+	chans = get_wcaps_channels(chans);
 	info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans;
 
 	return 0;

                 reply	other threads:[~2009-08-24  1:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090824015046.GA10025@localhost \
    --to=fengguang.wu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --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.