]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ALSA: hda: move open coded tricks into get_wcaps_channels()
authorWu Fengguang <fengguang.wu@intel.com>
Mon, 24 Aug 2009 01:50:46 +0000 (09:50 +0800)
committerTakashi Iwai <tiwai@suse.de>
Mon, 24 Aug 2009 07:42:48 +0000 (09:42 +0200)
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_local.h
sound/pci/hda/hda_proc.c
sound/pci/hda/patch_atihdmi.c

index fa57cb93b44318ab90d108dba7d7c64bb8f507a3..5f1dcc59002b4a610f0bff8b6455e9d1205f42a9 100644 (file)
@@ -410,6 +410,16 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
 /* 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);
index a721eb08a290e29e0e468d84ebdc5eb69593e1fa..95f24e4729f83c5eede0328f26bef18f2021a68c 100644 (file)
@@ -515,9 +515,7 @@ static void print_codec_info(struct snd_info_entry *entry,
                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
index 233e4778bba9dad5921cf0062ceff19f698f0a9b..fb684f00156b207844d4b7b8c79e77a49e2f32a5 100644 (file)
@@ -141,8 +141,7 @@ static int atihdmi_build_pcms(struct hda_codec *codec)
        /* 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;