ALSA: hda - Define AC_FMT_* constants
Define constants for the HD-audio stream format bits, and replace the
magic numbers in codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 8534792..522e074 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -698,6 +698,10 @@
* Callbacks
*/
+/* HBR should be Non-PCM, 8 channels */
+#define is_hbr_format(format) \
+ ((format & AC_FMT_TYPE_NON_PCM) && (format & AC_FMT_CHAN_MASK) == 7)
+
static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid,
u32 stream_tag, int format)
{
@@ -718,8 +722,7 @@
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
new_pinctl = pinctl & ~AC_PINCTL_EPT;
- /* Non-PCM, 8 channels */
- if ((format & 0x8000) && (format & 0x0f) == 7)
+ if (is_hbr_format(format))
new_pinctl |= AC_PINCTL_EPT_HBR;
else
new_pinctl |= AC_PINCTL_EPT_NATIVE;
@@ -736,7 +739,7 @@
new_pinctl);
}
- if ((format & 0x8000) && (format & 0x0f) == 7 && !new_pinctl) {
+ if (is_hbr_format(format) && !new_pinctl) {
snd_printdd("hdmi_setup_stream: HBR is not supported\n");
return -EINVAL;
}