diff options
author | Wisley Chen <wisley.chen@quanta.corp-partner.google.com> | 2021-08-24 18:39:06 +0600 |
---|---|---|
committer | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2021-09-14 02:35:41 +0000 |
commit | 889fa6093d765f873d238ca1f5e60ad6ff7d996a (patch) | |
tree | db21496b58500ea259aa179084e1e77e32cb7ae4 /src | |
parent | 8337e686a6043f900b251c9748b0430b3d880215 (diff) |
driver/i2c/max98390: add dsm_param_name
Maxim driver look for "maxim,dsm_param_name" to load dsm parameter file.
dsm param file name consist of {dsm_param_file_name} filled in devicetree,
{MAINBOARD_VENDOR} and {MAINBOARD_PART_NUMBER}.
=> {dsm_param_file_name}_{MAINBOARD_VENDOR}_{MAINBOARD_PART_NUMBER}.bin
BUG=b:197076844
TEST=build, and check ssdt
Change-Id: I006572d6a6ea55298374c688dfd9d877835da82d
Signed-off-by: Wisley Chen <wisley.chen@quanta.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57119
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/i2c/max98390/chip.h | 1 | ||||
-rw-r--r-- | src/drivers/i2c/max98390/max98390.c | 23 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/Kconfig | 8 |
3 files changed, 30 insertions, 2 deletions
diff --git a/src/drivers/i2c/max98390/chip.h b/src/drivers/i2c/max98390/chip.h index 193a17412c..d01237b418 100644 --- a/src/drivers/i2c/max98390/chip.h +++ b/src/drivers/i2c/max98390/chip.h @@ -13,4 +13,5 @@ struct drivers_i2c_max98390_config { const char *r0_calib_key; /* The VPD key of temperature during speaker calibration. */ const char *temperature_calib_key; + const char *dsm_param_file_name; }; diff --git a/src/drivers/i2c/max98390/max98390.c b/src/drivers/i2c/max98390/max98390.c index c216391e04..4beb6c29b7 100644 --- a/src/drivers/i2c/max98390/max98390.c +++ b/src/drivers/i2c/max98390/max98390.c @@ -25,8 +25,9 @@ static void max98390_fill_ssdt(const struct device *dev) .speed = I2C_SPEED_FAST, .resource = scope, }; - struct acpi_dp *dp; + struct acpi_dp *dp = NULL; uint64_t r0_value, temp_value; + char dsm_name[80] = {}; if (!scope) return; @@ -58,11 +59,29 @@ static void max98390_fill_ssdt(const struct device *dev) dp = acpi_dp_new_table("_DSD"); MAX98390_DP_INT("r0_calib", r0_value); MAX98390_DP_INT("temperature_calib", temp_value); - acpi_dp_write(dp); printk(BIOS_INFO, "set dsm_calib properties\n"); } } + if (CONFIG(CHROMEOS_DSM_PARAM_FILE_NAME)) { + if (config->dsm_param_file_name) { + if (!dp) + dp = acpi_dp_new_table("_DSD"); + + size_t chars = snprintf(dsm_name, sizeof(dsm_name), "%s_%s_%s.bin", + config->dsm_param_file_name, CONFIG_MAINBOARD_VENDOR, + CONFIG_MAINBOARD_PART_NUMBER); + + if (chars >= sizeof(dsm_name)) + printk(BIOS_ERR, "ERROR: String too long in %s\n", __func__); + + acpi_dp_add_string(dp, "maxim,dsm_param_name", dsm_name); + } + } + + if (dp) + acpi_dp_write(dp); + acpigen_pop_len(); /* Device */ acpigen_pop_len(); /* Scope */ diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig index e6d45e14ce..605b09e91b 100644 --- a/src/vendorcode/google/chromeos/Kconfig +++ b/src/vendorcode/google/chromeos/Kconfig @@ -70,6 +70,14 @@ config CHROMEOS_DSM_CALIB to ACPI DSD table in device driver. These parameters will be applied by kernel driver through device property at boot. +config CHROMEOS_DSM_PARAM_FILE_NAME + bool + default n + help + On some boards, there are different dsm parameter files for Dynamic Speaker + Management (DSM). Enable this config to assign dsm parameters file name in ACPI + SSDT table. Kernel driver uses this to load the DSM parameter file. + config CHROMEOS_CSE_BOARD_RESET_OVERRIDE bool default n |