vc/google: Decouple DSM_CALIB from CHROMEOS

DSM (Dynamic Speaker Management) uses calibration parameters stored in
a VPD (Vital Product Data) FMAP region to configure the audio output
via an ACPI _DSD table. This has no dependency on a ChromeOS, and can
be used by Linux/Windows drivers if appropriately configured.

Remove the dependency of DSM_CALIB (and the calibration file) on
CHROMEOS and replace it with VPD, so that non-CHROMEOS builds
can utilize this feature as well. Move files from underneath
vc/google/chromeos to underscore the point.

TEST=build/boot google/nightfury, dump ACPI, verify DSM calibraton
parameters present in _DSD table.

Change-Id: I643b3581bcc662befc9e30736dae806f94b055af
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74812
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: CoolStar <coolstarorganization@gmail.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
This commit is contained in:
Matt DeVillier
2023-01-17 13:51:29 -06:00
committed by Matt DeVillier
parent b78e462037
commit 1db8c57470
12 changed files with 59 additions and 47 deletions

View File

@ -9,3 +9,22 @@ config GOOGLE_SMBIOS_MAINBOARD_VERSION
help
Provide a common implementation for mainboard version,
which returns a formatted 'rev%d' board_id() string.
config GOOGLE_DSM_CALIB
bool
default n
depends on VPD
help
On some boards, there are calibrated parameters for Dynamic Speaker Management(DSM)
stored in VPD. Enable this config to read and parse these VPD values and write them
to ACPI DSD table in device driver. These parameters will be applied by kernel driver
through device property at boot.
config GOOGLE_DSM_PARAM_FILE_NAME
bool
default n
depends on GOOGLE_DSM_CALIB
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.

View File

@ -2,4 +2,5 @@
subdirs-$(CONFIG_CHROMEOS) += chromeos
ramstage-$(CONFIG_GOOGLE_DSM_CALIB) += dsm_calib.c
ramstage-$(CONFIG_GOOGLE_SMBIOS_MAINBOARD_VERSION) += smbios.c

View File

@ -57,23 +57,6 @@ config CHROMEOS_USE_EC_WATCHDOG_FLAG
help
Use the AP watchdog flag stored in EC.
config CHROMEOS_DSM_CALIB
bool
default n
help
On some boards, there are calibrated parameters for Dynamic Speaker Management(DSM)
stored in VPD. Enable this config to read and parse these VPD values and write them
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

View File

@ -8,7 +8,6 @@ ramstage-y += vpd_mac.c vpd_serialno.c vpd_calibration.c
ramstage-$(CONFIG_CHROMEOS_DISABLE_PLATFORM_HIERARCHY_ON_RESUME) += tpm2.c
ramstage-$(CONFIG_HAVE_REGULATORY_DOMAIN) += wrdd.c
ramstage-$(CONFIG_USE_SAR) += sar.c
ramstage-$(CONFIG_CHROMEOS_DSM_CALIB) += dsm_calib.c
ramstage-$(CONFIG_TPM_GOOGLE) += cr50_enable_update.c
romstage-$(CONFIG_CHROMEOS_CSE_BOARD_RESET_OVERRIDE) += cse_board_reset.c

View File

@ -27,16 +27,6 @@ void cbmem_add_vpd_calibration_data(void);
void chromeos_set_me_hash(u32*, int);
void chromeos_set_ramoops(void *ram_oops, size_t size);
/**
* get_dsm_calibration_from_key - Gets value related to DSM calibration from VPD
* @key: The key in RO_VPD. The valid prefix is "dsm_calib_". The valid keys are
* documented in https://chromeos.google.com/partner/dlm/docs/factory/vpd.html.
* @value: Output value. The value read from VPD parsed into uint64_t integer.
*
* Returns CB_SUCCESS on success or CB_ERR on failure.
*/
enum cb_err get_dsm_calibration_from_key(const char *key, uint64_t *value);
/*
* Declaration for mainboards to use to generate ACPI-specific ChromeOS needs.
*/

View File

@ -5,7 +5,7 @@
#include <stdint.h>
#include <string.h>
#include <types.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "dsm_calib.h"
#define DSM_BUF_LEN 128
#define DSM_PREFIX "dsm_calib_"

View File

@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __DSM_CALIB_H__
#define __DSM_CALIB_H__
#include <stddef.h>
#include <stdint.h>
#include <types.h>
/**
* get_dsm_calibration_from_key - Gets value related to DSM calibration from VPD
* @key: The key in RO_VPD. The valid prefix is "dsm_calib_". The valid keys are
* documented in https://chromeos.google.com/partner/dlm/docs/factory/vpd.html.
* @value: Output value. The value read from VPD parsed into uint64_t integer.
*
* Returns CB_SUCCESS on success or CB_ERR on failure.
*/
enum cb_err get_dsm_calibration_from_key(const char *key, uint64_t *value);
#endif /* __DSM_CALIB_H__ */