diff options
Diffstat (limited to 'src/mainboard/purism')
-rw-r--r-- | src/mainboard/purism/librem_cnl/variants/librem_14/hda_verb.c | 31 |
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)); + } + } +} |