aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2009-08-23 21:50:46 -0400
committerTakashi Iwai <tiwai@suse.de>2009-08-24 03:42:48 -0400
commitfd72d008465d45db63d7f8931eea6a04e05916d6 (patch)
tree8daba43d08b3162e028799d06f0c487e301a1ab5 /sound/pci
parent454e134d0e9e38421830f26426c66f37a6d39465 (diff)
ALSA: hda: move open coded tricks into get_wcaps_channels()
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_local.h10
-rw-r--r--sound/pci/hda/hda_proc.c4
-rw-r--r--sound/pci/hda/patch_atihdmi.c3
3 files changed, 12 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index fa57cb93b443..5f1dcc59002b 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -410,6 +410,16 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
410/* get the widget type from widget capability bits */ 410/* get the widget type from widget capability bits */
411#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT) 411#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT)
412 412
413static inline unsigned int get_wcaps_channels(u32 wcaps)
414{
415 unsigned int chans;
416
417 chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13;
418 chans = ((chans << 1) | 1) + 1;
419
420 return chans;
421}
422
413u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); 423u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
414int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 424int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
415 unsigned int caps); 425 unsigned int caps);
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index a721eb08a290..95f24e4729f8 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -515,9 +515,7 @@ static void print_codec_info(struct snd_info_entry *entry,
515 snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, 515 snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid,
516 get_wid_type_name(wid_type), wid_caps); 516 get_wid_type_name(wid_type), wid_caps);
517 if (wid_caps & AC_WCAP_STEREO) { 517 if (wid_caps & AC_WCAP_STEREO) {
518 unsigned int chans; 518 unsigned int chans = get_wcaps_channels(wid_caps);
519 chans = (wid_caps & AC_WCAP_CHAN_CNT_EXT) >> 13;
520 chans = ((chans << 1) | 1) + 1;
521 if (chans == 2) 519 if (chans == 2)
522 snd_iprintf(buffer, " Stereo"); 520 snd_iprintf(buffer, " Stereo");
523 else 521 else
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c
index 233e4778bba9..fb684f00156b 100644
--- a/sound/pci/hda/patch_atihdmi.c
+++ b/sound/pci/hda/patch_atihdmi.c
@@ -141,8 +141,7 @@ static int atihdmi_build_pcms(struct hda_codec *codec)
141 /* FIXME: we must check ELD and change the PCM parameters dynamically 141 /* FIXME: we must check ELD and change the PCM parameters dynamically
142 */ 142 */
143 chans = get_wcaps(codec, CVT_NID); 143 chans = get_wcaps(codec, CVT_NID);
144 chans = (chans & AC_WCAP_CHAN_CNT_EXT) >> 13; 144 chans = get_wcaps_channels(chans);
145 chans = ((chans << 1) | 1) + 1;
146 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; 145 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans;
147 146
148 return 0; 147 return 0;