summaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
authorSunwei Li <lisunwei@huaqin.corp-partner.google.com>2021-08-04 10:28:34 +0800
committerKarthik Ramasubramanian <kramasub@google.com>2021-08-10 16:04:16 +0000
commit0c78fffa54d54249854f83b4711c587e007e85ea (patch)
tree39e025bd0bfafd5f0762849a90bc359a64dc1166 /src/mainboard/google
parent64be788420566692446baa2f7553f4c04f5f16e4 (diff)
mb/google/dedede/var/cappy2: Add fw_config probe for multi audio codec
Compatible headphone codec "Realtek ALC5682I-VD" and "cirrus CS42L42" Compatible AMP codec "ALC1015Q-VB" and "MAX98360" BUG=b:193373320 BRANCH=dedede TEST=Both realtek and cirrus audio codec can work normally Signed-off-by: Sunwei Li <lisunwei@huaqin.corp-partner.google.com> Change-Id: I9121e75eaf46b43e6dc5ef2e31029a153c7a807d Reviewed-on: https://review.coreboot.org/c/coreboot/+/56795 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Weimin Wu <wuweimin@huaqin.corp-partner.google.com> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/dedede/Kconfig1
-rw-r--r--src/mainboard/google/dedede/variants/cappy2/gpio.c22
-rw-r--r--src/mainboard/google/dedede/variants/cappy2/overridetree.cb42
3 files changed, 63 insertions, 2 deletions
diff --git a/src/mainboard/google/dedede/Kconfig b/src/mainboard/google/dedede/Kconfig
index 9437ddcfeb..aa72c32594 100644
--- a/src/mainboard/google/dedede/Kconfig
+++ b/src/mainboard/google/dedede/Kconfig
@@ -30,6 +30,7 @@ config BOARD_GOOGLE_BASEBOARD_DEDEDE
select DRIVERS_INTEL_MIPI_CAMERA
select SOC_INTEL_COMMON_BLOCK_IPU
select DRIVERS_GENERIC_ALC1015
+ select DRIVERS_GENERIC_MAX98357A
select SPI_FLASH_SMM
config BOARD_GOOGLE_BASEBOARD_DEDEDE_CR50
diff --git a/src/mainboard/google/dedede/variants/cappy2/gpio.c b/src/mainboard/google/dedede/variants/cappy2/gpio.c
index 3ac420c261..87f5e46fc4 100644
--- a/src/mainboard/google/dedede/variants/cappy2/gpio.c
+++ b/src/mainboard/google/dedede/variants/cappy2/gpio.c
@@ -2,11 +2,15 @@
#include <baseboard/gpio.h>
#include <baseboard/variants.h>
+#include <bootstate.h>
+#include <fw_config.h>
/* Pad configuration in ramstage */
static const struct pad_config gpio_table[] = {
/* D15 : EN_PP3300_CAMERA */
PAD_CFG_GPO(GPP_D15, 1, PLTRST),
+ /* H16 : AP_SUB_IO_L ==> HP_RST_ODL */
+ PAD_CFG_GPO(GPP_H16, 1, PWROK),
};
const struct pad_config *variant_override_gpio_table(size_t *num)
@@ -14,3 +18,21 @@ const struct pad_config *variant_override_gpio_table(size_t *num)
*num = ARRAY_SIZE(gpio_table);
return gpio_table;
}
+
+static const struct pad_config codec_rt5682_pads[] = {
+ PAD_NC(GPP_H16, NONE),
+};
+
+static const struct pad_config codec_cs42l42_pads[] = {
+ PAD_NC(GPP_D18, NONE),
+};
+
+static void fw_config_handle(void *unused)
+{
+ if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, AUDIO_CODEC_ALC5682)))
+ gpio_configure_pads(codec_rt5682_pads, ARRAY_SIZE(codec_rt5682_pads));
+ if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, AUDIO_CODEC_CS42l42)))
+ gpio_configure_pads(codec_cs42l42_pads, ARRAY_SIZE(codec_cs42l42_pads));
+}
+
+BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);
diff --git a/src/mainboard/google/dedede/variants/cappy2/overridetree.cb b/src/mainboard/google/dedede/variants/cappy2/overridetree.cb
index 41d1660c53..2635b34bdc 100644
--- a/src/mainboard/google/dedede/variants/cappy2/overridetree.cb
+++ b/src/mainboard/google/dedede/variants/cappy2/overridetree.cb
@@ -1,3 +1,11 @@
+fw_config
+ field AUDIO_CODEC_SOURCE 41 43
+ option AUDIO_CODEC_UNPROVISIONED 0
+ option AUDIO_CODEC_ALC5682 1
+ option AUDIO_CODEC_CS42l42 2
+ end
+end
+
chip soc/intel/jasperlake
# Intel Common SoC Config
@@ -95,8 +103,29 @@ chip soc/intel/jasperlake
register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
register "property_list[0].name" = ""realtek,jd-src""
register "property_list[0].integer" = "1"
- device i2c 1a on end
+ device i2c 1a on
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_UNPROVISIONED
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682
+ end
end
+ chip drivers/i2c/cs42l42
+ register "irq" = "ACPI_IRQ_LEVEL_LOW(GPP_D16_IRQ)"
+ register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_H16)"
+ register "ts_inv" = "true"
+ register "ts_dbnc_rise" = "RISE_DEB_1000_MS"
+ register "ts_dbnc_fall" = "FALL_DEB_0_MS"
+ register "btn_det_init_dbnce" = "100"
+ register "btn_det_event_dbnce" = "10"
+ register "bias_lvls[0]" = "15"
+ register "bias_lvls[1]" = "8"
+ register "bias_lvls[2]" = "4"
+ register "bias_lvls[3]" = "1"
+ register "hs_bias_ramp_rate" = "HSBIAS_RAMP_SLOW"
+ register "hs_bias_sense_disable" = "true"
+ device i2c 48 on
+ probe AUDIO_CODEC_SOURCE AUDIO_CODEC_CS42l42
+ end
+ end
end #I2C 4
device pci 1f.0 on
chip drivers/pc80/tpm
@@ -106,7 +135,16 @@ chip soc/intel/jasperlake
device pci 1f.3 on
chip drivers/generic/alc1015
register "sdb" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D17)"
- device generic 0 on end
+ device generic 0 on
+ probe AUDIO_AMP UNPROVISIONED
+ end
+ end
+ chip drivers/generic/max98357a
+ register "hid" = ""MX98360A""
+ register "sdmode_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D17)"
+ device generic 0 on
+ probe AUDIO_AMP MAX98360
+ end
end
end # Intel HDA
end