[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH 2/9] hdaudio: Skip non-audio function groups



Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 hdaudio/device.h | 6 ++++++
 hdaudio/main.c   | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/hdaudio/device.h b/hdaudio/device.h
index 8552521..6af4ddc 100644
--- a/hdaudio/device.h
+++ b/hdaudio/device.h
@@ -73,6 +73,7 @@ enum hda_reg {
     REG_O0_STS      = 0x103,    ///< Output 0 - Status
     REG_O0_CBL      = 0x108,    ///< Output 0 - Cyclic Buffer Length
     REG_O0_STLVI    = 0x10c,    ///< Output 0 - Last Valid Index
+    REG_O0_FMT      = 0x112,    ///< Output 0 - Format
     REG_O0_BDLPL    = 0x118,    ///< Output 0 - BDL Pointer Lower
     REG_O0_BDLPU    = 0x11c,    ///< Output 0 - BDL Pointer Upper
 };
@@ -181,9 +182,14 @@ enum codec_verbs {
 
 enum codec_parameters {
     PARAM_NODE_COUNT        = 0x04,
+    PARAM_FN_GROUP_TYPE     = 0x05,
     PARAM_AUDIO_WID_CAP     = 0x09,
 };
 
+enum fn_group_type {
+    FN_GROUP_AUDIO          = 0x01,
+};
+
 enum sample_format {
     SR_48_KHZ               = 0,
     SR_44_KHZ               = (1 << 14),
diff --git a/hdaudio/main.c b/hdaudio/main.c
index c46d3f7..e179b28 100644
--- a/hdaudio/main.c
+++ b/hdaudio/main.c
@@ -238,6 +238,15 @@ static int find_output_widget(struct hda_device* hda, int codec)
 
         DPRINTF("    %d widgets starting at ID %d\n",
             num_widgets, widgets_start);
+
+        param = codec_query(hda, codec, fg_start + i,
+            VERB_GET_PARAMETER | PARAM_FN_GROUP_TYPE);
+        param &= 0x7f;
+        if (param != FN_GROUP_AUDIO) {
+            DPRINTF("    Function group type %x\n", param);
+            continue;
+        }
+
         for (j = 0; j < num_widgets; j++) {
             param = codec_query(hda, codec, widgets_start + j,
                 VERB_GET_PARAMETER | PARAM_AUDIO_WID_CAP);
-- 
2.1.4