aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Hall <jonathon.hall@puri.sm>2023-03-03 10:28:15 -0500
committerFelix Held <felix-coreboot@felixheld.de>2023-05-26 14:59:23 +0000
commit9fb599bd9b4c73e573842a2a874964034034484e (patch)
tree721c5171492316eb5e131580492d9e2ced08102c
parenta41c825068f4f5afc3fd6839a796d868241d91cd (diff)
mb/purism/librem_cnl: Enable Librem 14 jack detect with fixed EC
Use verbs enabling jack detect if the EC firmware has been updated with fixed jack detection. Test: Build Librem 14 and boot with latest EC, test headset jack detection. Change-Id: I57a27b1d51e4f6c7c712bcb2823d21692b9c5ce6 Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74364 Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--src/mainboard/purism/librem_cnl/variants/librem_14/hda_verb.c31
1 files changed, 29 insertions, 2 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 1256c1721b..4e2fc2d128 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
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/azalia_device.h>
+#include <ec/purism/librem-ec/librem_ec.h>
+#include <console/console.h>
const u32 cim_verb_data[] = {
0x10ec0256, /* Codec Vendor/Device ID: Realtek ALC256 */
@@ -14,12 +16,12 @@ const u32 cim_verb_data[] = {
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, 0x04a11130), /* Jack analog mic */
+ AZALIA_PIN_CFG(0, 0x19, 0x02a11030), /* 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, 0x04211120), /* Jack analog out */
+ AZALIA_PIN_CFG(0, 0x21, 0x02211020), /* Jack analog out */
/* Hidden SW reset */
0x0205001a,
@@ -58,3 +60,28 @@ const u32 cim_verb_data[] = {
const u32 pc_beep_verbs[] = {};
AZALIA_ARRAY_SIZES;
+
+/* Older verbs with no jack detect - needed if an older Librem EC is in use that
+ lacks jack detect. Headphones can be selected manually. */
+static const u32 no_jack_detect_verbs[] = {
+ AZALIA_PIN_CFG(0, 0x19, 0x04a11130), /* Jack analog mic */
+ AZALIA_PIN_CFG(0, 0x21, 0x04211120), /* Jack analog out */
+};
+
+void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid)
+{
+ if (viddid == 0x10ec0256) {
+ /* Now that the codec is configured, we can check if the EC has
+ jack detect. */
+ if (librem_ec_has_jack_detect()) {
+ printk(BIOS_INFO, "EC jack detect enabled\n");
+ } else {
+ printk(BIOS_WARNING, "EC firmware lacks jack detect, applying workaround.\n");
+ printk(BIOS_WARNING, "Update to Librem-EC 1.13 or later for jack detect.\n");
+ /* The EC firmware lacks jack detect. Program the
+ older workaround verbs with no jack detect. */
+ azalia_program_verb_table(base, no_jack_detect_verbs,
+ ARRAY_SIZE(no_jack_detect_verbs));
+ }
+ }
+}