Cheng-Yi Chiang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for DSM (dynamic speaker management) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib," prefix.
Known keys are
"dsm_calib, r0_0" "dsm_calib, r0_1" "dsm_calib, r0_2" "dsm_calib, r0_3" "dsm_calib, temp_0"
The values for unsigned long. This library will be used for RT1011 device driver in the patch series.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 80 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/1
diff --git a/src/include/dsm_calib.h b/src/include/dsm_calib.h new file mode 100644 index 0000000..e398d87 --- /dev/null +++ b/src/include/dsm_calib.h @@ -0,0 +1,23 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DSM_CALIB_H_ +#define _DSM_CALIB_H_ + +#include <stdint.h> + +int get_dsm_calibration_from_key(const char *key, uint64_t *value); + +#endif /* _DSM_CALIB_H_ */ diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig index 2ff7ec7..c7d3adf 100644 --- a/src/vendorcode/google/chromeos/Kconfig +++ b/src/vendorcode/google/chromeos/Kconfig @@ -95,5 +95,9 @@ help Use the AP watchdog flag stored in EC.
+config CHROMEOS_DSM_CALIB + bool + default n + endif # CHROMEOS endmenu diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index 000d056..05acdee 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -21,6 +21,7 @@ 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_CR50) += cr50_enable_update.c ifeq ($(CONFIG_ARCH_MIPS),) bootblock-y += watchdog.c diff --git a/src/vendorcode/google/chromeos/dsm_calib.c b/src/vendorcode/google/chromeos/dsm_calib.c new file mode 100644 index 0000000..a4480bc --- /dev/null +++ b/src/vendorcode/google/chromeos/dsm_calib.c @@ -0,0 +1,52 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <console/console.h> +#include <drivers/vpd/vpd.h> +#include <dsm_calib.h> +#include <stdint.h> +#include <string.h> + +#define DSM_BUF_LEN 128 +#define DSM_PREFIX "dsm_calib" + +int get_dsm_calibration_from_key(const char* key, uint64_t *value) +{ + char buf[DSM_BUF_LEN]; + char* ret; + long value_from_vpd; + + if (strncmp(key, DSM_PREFIX, strlen(DSM_PREFIX))) { + printk(BIOS_ERR, "@@ got invalid dsm_calib key: %s\n", key); + return -1; + } + + ret = vpd_gets(key, buf, DSM_BUF_LEN, VPD_RO); + if (!ret) { + printk(BIOS_ERR, "@@ failed to find key in VPD: %s\n", key); + return -1; + } + + value_from_vpd = atol(buf); + if (value < 0) { + printk(BIOS_ERR, "@@ got invalid dsm_calib from VPD: %ld\n", + value_from_vpd); + return -1; + } + + *value = value_from_vpd; + + return 0; +}
Hello Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#2).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for DSM (dynamic speaker management) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib," prefix.
Known keys are
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
The values for unsigned long. This library will be used for RT1011 device driver in the patch series.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 80 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/2
Hello Paul Fagerburg, Tim Wawrzynczak, Shelley Chen, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#3).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for DSM (dynamic speaker management) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib," prefix.
Known keys are
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
The values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 80 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/3
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 3: Code-Review+1
Shelley Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/36028/3//COMMIT_MSG@25 PS3, Line 25: Please add BUG, BRANCH, and TEST fields.
Hello Paul Fagerburg, Tim Wawrzynczak, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#4).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for DSM (dynamic speaker management) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib," prefix.
Known keys are
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
The values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 80 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/4
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 4:
(1 comment)
Hi Shelley, thanks for the review. Also fixed the commit message in other three patches.
https://review.coreboot.org/c/coreboot/+/36028/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/36028/3//COMMIT_MSG@25 PS3, Line 25:
Please add BUG, BRANCH, and TEST fields.
Done
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG@17 PS4, Line 17: "dsm_calib_r0_0" just curious, how are those names made up and where is a global list to make sure it doesn't conflict with existing VPDs?
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 4:
(3 comments)
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG@13 PS4, Line 13: dsm_calib, should fix to dsm_calib_
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG@17 PS4, Line 17: "dsm_calib_r0_0"
just curious, how are those names made up and where is a global list to make sure it doesn't conflic […]
The complete list is at https://chromeos.google.com/partner/dlm/docs/factory/vpd.html The internal CL to make change to that list is at https://chrome-internal-review.googlesource.com/c/chromeos/docs/+/1983987 We are going to deprecate dsm_calib in current list because that format is bad for parsing. Beside, putting values into one field does not save the time to read VPD because there are four RT1011 devices, where we need to read once for each device.
https://review.coreboot.org/c/coreboot/+/36028/4/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/4/src/vendorcode/google/chrom... PS4, Line 23: dsm_calib should fix to dsm_calib_
Hello Paul Fagerburg, Tim Wawrzynczak, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#5).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for DSM (dynamic speaker management) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 80 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/5
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/5/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/5/src/vendorcode/google/chrom... PS5, Line 25: int Please use CB_SUCCESS and friends.
Hello Paul Fagerburg, Duncan Laurie, Tim Wawrzynczak, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#6).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 81 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/6
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 6:
(1 comment)
Hi Paul, Thanks for reviewing the patch. I have run clang-format on this patch.
https://review.coreboot.org/c/coreboot/+/36028/5/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/5/src/vendorcode/google/chrom... PS5, Line 25: int
Please use CB_SUCCESS and friends.
Done
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 6:
A gentle ping. Please let me know if I need to address some concern. Thanks!
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 6: Code-Review+1
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/6/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/Kconfig:
https://review.coreboot.org/c/coreboot/+/36028/6/src/vendorcode/google/chrom... PS6, Line 101: Please add some help text here so future users know what this is for.
Hello Paul Fagerburg, Tim Wawrzynczak, Duncan Laurie, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#7).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- A src/include/dsm_calib.h M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 86 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/7
Jimmy Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/6/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/Kconfig:
https://review.coreboot.org/c/coreboot/+/36028/6/src/vendorcode/google/chrom... PS6, Line 101:
Please add some help text here so future users know what this is for.
Done. Thanks for reviewing!
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 7: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h File src/include/dsm_calib.h:
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h@1 PS7, Line 1: /* You could put this with the code in vendorcode/google/chromeos and include the header with the full path.
There is similar precedent for sar putting a generic header in src/include so this is just a suggestion.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 7:
(3 comments)
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h File src/include/dsm_calib.h:
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h@1 PS7, Line 1: /*
You could put this with the code in vendorcode/google/chromeos and include the header with the full […]
It can potentially be moved to chromeos.h under vendorcode/google/chromeos/ along with cbmem_add_vpd_calibration_data(): https://review.coreboot.org/cgit/coreboot.git/tree/src/vendorcode/google/chr...
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h@22 PS7, Line 22: get_dsm_calibration_from_key Can you please add a comment indicating what the arguments are and what the expectations are e.g. key needs to start with dsm_calib, etc.
https://review.coreboot.org/c/coreboot/+/36028/7/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/7/src/vendorcode/google/chrom... PS7, Line 28: char static
Hello Paul Fagerburg, Duncan Laurie, Tim Wawrzynczak, Jimmy Cheng-Yi Chiang, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#8).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc M src/vendorcode/google/chromeos/chromeos.h A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 76 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/8
Hello Paul Fagerburg, Jimmy Cheng-Yi Chiang, Duncan Laurie, Tim Wawrzynczak, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#9).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc M src/vendorcode/google/chromeos/chromeos.h A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 75 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/9
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 9:
(2 comments)
Thanks for reviewing!
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h File src/include/dsm_calib.h:
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h@1 PS7, Line 1: /*
It can potentially be moved to chromeos. […]
I see. I moved this function declaration to chromeos.h
https://review.coreboot.org/c/coreboot/+/36028/7/src/include/dsm_calib.h@22 PS7, Line 22: get_dsm_calibration_from_key
Can you please add a comment indicating what the arguments are and what the expectations are e.g. […]
Done
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/7/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/7/src/vendorcode/google/chrom... PS7, Line 28: char
static
Done
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 9:
(3 comments)
Added some Done to pass "ALl-Comments-Resolved" field
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG@13 PS4, Line 13: dsm_calib,
should fix to dsm_calib_
Done
https://review.coreboot.org/c/coreboot/+/36028/4//COMMIT_MSG@17 PS4, Line 17: "dsm_calib_r0_0"
The complete list is at […]
Done FYI, the new VPD page is published.
https://review.coreboot.org/c/coreboot/+/36028/4/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/4/src/vendorcode/google/chrom... PS4, Line 23: dsm_calib
should fix to dsm_calib_
Done
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 9: Code-Review+1
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 9: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/chromeos.h:
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... PS9, Line 62: #if CONFIG(CHROMEOS_DSM_CALIB) I know this is common in this file, but it should be okay not to guard this declaration.
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 9: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... PS9, Line 44: value_from_vpd < 0) Is it expected that some calibration parameters could be 0? If they are resistor values and temperatures, I would not expect to find 0 in either of those values; would they just not be included in the VPD in that case?
Hello Paul Fagerburg, Tim Wawrzynczak, Jimmy Cheng-Yi Chiang, Duncan Laurie, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#10).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc M src/vendorcode/google/chromeos/chromeos.h A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 73 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/10
Hello Paul Fagerburg, Tim Wawrzynczak, Jimmy Cheng-Yi Chiang, Duncan Laurie, Shelley Chen, Hung-Te Lin, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36028
to look at the new patch set (#11).
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers greater than 0. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e --- M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc M src/vendorcode/google/chromeos/chromeos.h A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 73 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/36028/11
Cheng-Yi Chiang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 11:
(2 comments)
Thanks for reviewing!
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/chromeos.h:
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... PS9, Line 62: #if CONFIG(CHROMEOS_DSM_CALIB)
I know this is common in this file, but it should be okay not to guard this declaration.
Done
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... File src/vendorcode/google/chromeos/dsm_calib.c:
https://review.coreboot.org/c/coreboot/+/36028/9/src/vendorcode/google/chrom... PS9, Line 44: value_from_vpd < 0)
Is it expected that some calibration parameters could be 0? If they are resistor values and tempera […]
Thanks for catching this. Yes these values are expected to be greater than 0. In the factory these values were checked before writing to VPD. If somehow a non-positive value is calibrated, it will fail the calibration step and that device will not be shipped until being resolved. But it is better we put a check here as well.
Paul Fagerburg has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 11: Code-Review+2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
Patch Set 11: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/36028 )
Change subject: google/chromeos: Add a library to get DSM calibration data ......................................................................
google/chromeos: Add a library to get DSM calibration data
On ChromeOS, there will be VPD values for dynamic speaker management (DSM) calibration data. They are resistor calibration values and temperature during calibration.
These VPD fields use "dsm_calib_" prefix.
Known keys are:
"dsm_calib_r0_0" "dsm_calib_r0_1" "dsm_calib_r0_2" "dsm_calib_r0_3" "dsm_calib_temp_0"
For now these values are unsigned decimal numbers greater than 0. This library will be used for RT1011 device driver in the patch series.
Note that in the future we may encode more values into this VPD field if needed. We retain the flexibility for coreboot device driver or codec driver to decode/parse the VPD values based on the needed use case per-board.
BUG=b:140397934 BRANCH=none TEST=On Helios, with patch series, check realtek,r0_calib and realtek,temperature_calib are available to rt1011 codec driver.
Signed-off-by: Cheng-Yi Chiang cychiang@chromium.org Change-Id: Ib9579a5cc055f8f438cb30a8acaf250a343db19e Reviewed-on: https://review.coreboot.org/c/coreboot/+/36028 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Paul Fagerburg pfagerburg@chromium.org Reviewed-by: Furquan Shaikh furquan@google.com --- M src/vendorcode/google/chromeos/Kconfig M src/vendorcode/google/chromeos/Makefile.inc M src/vendorcode/google/chromeos/chromeos.h A src/vendorcode/google/chromeos/dsm_calib.c 4 files changed, 73 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved Paul Fagerburg: Looks good to me, approved
diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig index 2ff7ec7..cdb4305 100644 --- a/src/vendorcode/google/chromeos/Kconfig +++ b/src/vendorcode/google/chromeos/Kconfig @@ -95,5 +95,14 @@ 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. + endif # CHROMEOS endmenu diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index 000d056..05acdee 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -21,6 +21,7 @@ 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_CR50) += cr50_enable_update.c ifeq ($(CONFIG_ARCH_MIPS),) bootblock-y += watchdog.c diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index e5420ac..a40c4c9 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -23,6 +23,7 @@ #include <rules.h> #include <security/vboot/misc.h> #include <security/vboot/vboot_common.h> +#include <types.h>
#if CONFIG(CHROMEOS) /* functions implemented in watchdog.c */ @@ -58,6 +59,16 @@
void cbmem_add_vpd_calibration_data(void);
+/** + * 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); + /* * Create the OIPG package containing the Chrome OS gpios described by * the chromeos_gpio array. diff --git a/src/vendorcode/google/chromeos/dsm_calib.c b/src/vendorcode/google/chromeos/dsm_calib.c new file mode 100644 index 0000000..d3b14cb --- /dev/null +++ b/src/vendorcode/google/chromeos/dsm_calib.c @@ -0,0 +1,52 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <console/console.h> +#include <drivers/vpd/vpd.h> +#include <stdint.h> +#include <string.h> +#include <types.h> +#include <vendorcode/google/chromeos/chromeos.h> + +#define DSM_BUF_LEN 128 +#define DSM_PREFIX "dsm_calib_" + +enum cb_err get_dsm_calibration_from_key(const char *key, uint64_t *value) +{ + static char buf[DSM_BUF_LEN]; + char *ret; + long value_from_vpd; + + if (strncmp(key, DSM_PREFIX, strlen(DSM_PREFIX))) { + printk(BIOS_ERR, "got invalid dsm_calib key: %s\n", key); + return CB_ERR; + } + + ret = vpd_gets(key, buf, DSM_BUF_LEN, VPD_RO); + if (!ret) { + printk(BIOS_ERR, "failed to find key in VPD: %s\n", key); + return CB_ERR; + } + + value_from_vpd = atol(buf); + if (value_from_vpd <= 0) { + printk(BIOS_ERR, "got invalid dsm_calib from VPD: %ld\n", value_from_vpd); + return CB_ERR; + } + + *value = value_from_vpd; + + return CB_SUCCESS; +}