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

[cdi-devel] [PATCH 8/9] hdaudio: Set EAPD bit for all widgets



This is the "External Amplifier Power Down" flag and a 1 must be written
to power the amplifier up.

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

diff --git a/hdaudio/device.h b/hdaudio/device.h
index 2697da0..196f692 100644
--- a/hdaudio/device.h
+++ b/hdaudio/device.h
@@ -186,6 +186,7 @@ enum codec_verbs {
     VERB_GET_PIN_CONTROL    = 0xf0700,
     VERB_SET_PIN_CONTROL    = 0x70700,
     VERB_GET_EAPD_BTL       = 0xf0c00,
+    VERB_SET_EAPD_BTL       = 0x70c00,
     VERB_GET_POWER_STATE    = 0xf0500,
     VERB_SET_POWER_STATE    = 0x70500,
 };
diff --git a/hdaudio/main.c b/hdaudio/main.c
index 4d0b02f..e198e01 100644
--- a/hdaudio/main.c
+++ b/hdaudio/main.c
@@ -267,6 +267,7 @@ static void widget_init(struct hda_device* hda, int codec, int nid)
     uint32_t widget_cap;
     enum widget_type type;
     uint32_t amp_cap;
+    uint32_t eapd_btl;
 
     widget_cap = codec_query(hda, codec, nid,
                              VERB_GET_PARAMETER | PARAM_AUDIO_WID_CAP);
@@ -278,9 +279,9 @@ static void widget_init(struct hda_device* hda, int codec, int nid)
 
     amp_cap = codec_query(hda, codec, nid,
                           VERB_GET_PARAMETER | PARAM_OUT_AMP_CAP);
+    eapd_btl = codec_query(hda, codec, nid, VERB_GET_EAPD_BTL);
 
 #ifdef DEBUG
-    uint32_t eapd_btl;
     uint32_t amp_gain;
     const char* s;
 
@@ -300,7 +301,6 @@ static void widget_init(struct hda_device* hda, int codec, int nid)
     amp_gain = codec_query(hda, codec, nid,
                            VERB_GET_AMP_GAIN_MUTE | 0x8000) << 8;
     amp_gain |= codec_query(hda, codec, nid, VERB_GET_AMP_GAIN_MUTE | 0xa000);
-    eapd_btl = codec_query(hda, codec, nid, VERB_GET_EAPD_BTL);
 
     DPRINTF("    %s at ID %d; cap %x, eapd %x, amp %x/%x\n",
             s, nid, widget_cap, eapd_btl, amp_gain, amp_cap);
@@ -330,6 +330,7 @@ static void widget_init(struct hda_device* hda, int codec, int nid)
 
             ctl |= PIN_CTL_ENABLE_OUTPUT;
             codec_query(hda, codec, nid, VERB_SET_PIN_CONTROL | ctl);
+            codec_query(hda, codec, nid, VERB_SET_EAPD_BTL | eapd_btl | 0x2);
             break;
         }
 
@@ -341,6 +342,8 @@ static void widget_init(struct hda_device* hda, int codec, int nid)
                 hda->output.nid = nid;
                 hda->output.amp_gain_steps = (amp_cap >> 8) & 0x7f;
             }
+
+            codec_query(hda, codec, nid, VERB_SET_EAPD_BTL | eapd_btl | 0x2);
             break;
         }
 
-- 
2.1.4