patches/coreboot-4.14: Add patches for Librem mini, 14

Patches for the Librem Mini (v1/v2) and Librem 14 upstreamed
post-4.14. Fixes some issues with acoustic noise and headphone
jack detection.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
Matt DeVillier 2021-09-16 10:05:55 -05:00 committed by tlaurion
parent ed0282d33e
commit ffde47133f
4 changed files with 181 additions and 0 deletions

View File

@ -0,0 +1,30 @@
From 154c2089204962d290860eeecee58165f72868eb Mon Sep 17 00:00:00 2001
From: Matt DeVillier <matt.devillier@puri.sm>
Date: Tue, 18 May 2021 11:07:16 -0500
Subject: [PATCH 1/4] mb/purism/librem_14: set SA slew rate to fast/16
Decrease SA slew rate to match other domains and reduce
high-frequency noise slightly.
Change-Id: I02cd93481f6bfba6249cb338a0e2f47d471a438e
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
---
.../purism/librem_cnl/variants/librem_14/devicetree.cb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mainboard/purism/librem_cnl/variants/librem_14/devicetree.cb b/src/mainboard/purism/librem_cnl/variants/librem_14/devicetree.cb
index f61eb2b60a..6d0eb205e7 100644
--- a/src/mainboard/purism/librem_cnl/variants/librem_14/devicetree.cb
+++ b/src/mainboard/purism/librem_cnl/variants/librem_14/devicetree.cb
@@ -39,7 +39,7 @@ chip soc/intel/cannonlake
register "SlowSlewRateForIa" = "3" # fast/16
register "SlowSlewRateForGt" = "3" # fast/16
- register "SlowSlewRateForSa" = "2" # fast/8
+ register "SlowSlewRateForSa" = "3" # fast/16
register "SlowSlewRateForFivr" = "3" # fast/16
# Power
--
2.30.2

View File

@ -0,0 +1,61 @@
From d41d57dcb15694b04bf0022a62b0867ead94e807 Mon Sep 17 00:00:00 2001
From: Matt DeVillier <matt.devillier@puri.sm>
Date: Thu, 17 Jun 2021 18:54:16 -0500
Subject: [PATCH 3/4] mb/purism/librem_14/hda_verb.c: Fix subsystem, verb
count, jack detect
- set subsystem/subvendor ID to Realtek default, as the one dumped
from the vendor UEFI firmware provides no advantages
- fix the number of verb entries, which excluded the 4 following the
pin configs
- issue the reset *before* setting the subvendor, and use the Azalia macro
- disable jack detect for the 3.5mm jack, both line out and mic, since
it's not currently working, so that the outputs can be manually selected
Change-Id: Icd961c3c5aec23cf61d6a9ad65c603c6dc04697a
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
---
.../librem_cnl/variants/librem_14/hda_verb.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/src/mainboard/purism/librem_cnl/variants/librem_14/hda_verb.c b/src/mainboard/purism/librem_cnl/variants/librem_14/hda_verb.c
index 97422ef317..1256c1721b 100644
--- a/src/mainboard/purism/librem_cnl/variants/librem_14/hda_verb.c
+++ b/src/mainboard/purism/librem_cnl/variants/librem_14/hda_verb.c
@@ -4,27 +4,22 @@
const u32 cim_verb_data[] = {
0x10ec0256, /* Codec Vendor/Device ID: Realtek ALC256 */
- 0x1b50580a, /* Subsystem ID */
- 12, /* Number of entries */
+ 0x10ec0256, /* Subsystem ID */
+ 16, /* Number of entries */
- AZALIA_SUBVENDOR(0, 0x1b50580a),
-
- /* Widget node 0x01 */
- 0x0017ff00,
- 0x0017ff00,
- 0x0017ff00,
- 0x0017ff00,
+ AZALIA_RESET(0x1),
+ AZALIA_SUBVENDOR(0, 0x10ec0256),
AZALIA_PIN_CFG(0, 0x12, 0x90a60140), /* Front digital mic */
AZALIA_PIN_CFG(0, 0x13, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x14, 0x90170110), /* Internal speakers */
AZALIA_PIN_CFG(0, 0x18, 0x411111f0), /* NC */
- AZALIA_PIN_CFG(0, 0x19, 0x04a11030), /* Jack analog mic */
+ AZALIA_PIN_CFG(0, 0x19, 0x04a11130), /* Jack analog mic */
AZALIA_PIN_CFG(0, 0x1a, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x1b, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x1d, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x1e, 0x411111f0), /* NC */
- AZALIA_PIN_CFG(0, 0x21, 0x04211020), /* Jack analog out */
+ AZALIA_PIN_CFG(0, 0x21, 0x04211120), /* Jack analog out */
/* Hidden SW reset */
0x0205001a,
--
2.30.2

View File

@ -0,0 +1,40 @@
From 8fed12fb31b9437934525a0389e5b4a45be56bd2 Mon Sep 17 00:00:00 2001
From: Matt DeVillier <matt.devillier@puri.sm>
Date: Tue, 15 Jun 2021 10:50:17 -0500
Subject: [PATCH 2/4] mb/purism/librem_mini: Enable acoustic noise mitigation
Enable FastPkgCRampDisable for all domains, set SlowSlewRate
to fast/16 for all domains.
Test: boot Librem Mini v2, observe high frequency acoustic noise reduced.
Change-Id: I10bc2a3e6b631b8c0b430e204f376aa9a81ac683
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
---
.../librem_cnl/variants/librem_mini/devicetree.cb | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/devicetree.cb b/src/mainboard/purism/librem_cnl/variants/librem_mini/devicetree.cb
index 69d1b423bd..836f4aceaf 100644
--- a/src/mainboard/purism/librem_cnl/variants/librem_mini/devicetree.cb
+++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/devicetree.cb
@@ -22,6 +22,16 @@ chip soc/intel/cannonlake
# Misc
register "AcousticNoiseMitigation" = "1"
+ register "FastPkgCRampDisableIa" = "1"
+ register "FastPkgCRampDisableGt" = "1"
+ register "FastPkgCRampDisableSa" = "1"
+ register "FastPkgCRampDisableFivr" = "1"
+
+ register "SlowSlewRateForIa" = "3" # fast/16
+ register "SlowSlewRateForGt" = "3" # fast/16
+ register "SlowSlewRateForSa" = "3" # fast/16
+ register "SlowSlewRateForFivr" = "3" # fast/16
+
# Power
register "PchPmSlpS3MinAssert" = "3" # 50ms
register "PchPmSlpS4MinAssert" = "1" # 1s
--
2.30.2

View File

@ -0,0 +1,50 @@
From 438a16b089f152eedb5a4b96f6b98c82635708f1 Mon Sep 17 00:00:00 2001
From: Matt DeVillier <matt.devillier@puri.sm>
Date: Thu, 17 Jun 2021 18:58:45 -0500
Subject: [PATCH 4/4] mb/purism/librem_mini/hda_verb.c: Fix subsystem, jack
detect
- set subsystem/subvendor ID to Realtek default, as the one dumped
from the vendor UEFI firmware provides no advantages
- Add a codec reset before setting the subvendor ID using the Azalia macro
for consistency with all other Realtek HDA codecs
- disable jack detect for the external mic on the 3.5mm jack, since it's not
currently working, so that the external microphone can be manually selected
Change-Id: Ib0f99e5088973a721c0a295899012c9aea5009cf
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
---
.../librem_cnl/variants/librem_mini/hda_verb.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/mainboard/purism/librem_cnl/variants/librem_mini/hda_verb.c b/src/mainboard/purism/librem_cnl/variants/librem_mini/hda_verb.c
index 93dd2702bf..5a9aead2e7 100644
--- a/src/mainboard/purism/librem_cnl/variants/librem_mini/hda_verb.c
+++ b/src/mainboard/purism/librem_cnl/variants/librem_mini/hda_verb.c
@@ -3,16 +3,18 @@
#include <device/azalia_device.h>
const u32 cim_verb_data[] = {
- 0x10ec0269, /* Codec Vendor/Device ID: Realtek ALC293 */
- 0x10ec0000, /* Subsystem ID */
- 11, /* Number of entries */
+ 0x10ec0269, /* Codec Vendor/Device ID: Realtek ALC269 */
+ 0x10ec0269, /* Subsystem ID */
+ 12, /* Number of entries */
- AZALIA_SUBVENDOR(0, 0x10ec0000),
+ AZALIA_RESET(0x1),
+
+ AZALIA_SUBVENDOR(0, 0x10ec0269),
AZALIA_PIN_CFG(0, 0x12, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x14, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x15, 0x02211010), /* Jack analog out */
AZALIA_PIN_CFG(0, 0x17, 0x411111f0), /* NC */
- AZALIA_PIN_CFG(0, 0x18, 0x02a11020), /* Jack analog mic */
+ AZALIA_PIN_CFG(0, 0x18, 0x02a11120), /* Jack analog mic, no presence detect */
AZALIA_PIN_CFG(0, 0x19, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x1a, 0x411111f0), /* NC */
AZALIA_PIN_CFG(0, 0x1b, 0x411111f0), /* NC */
--
2.30.2