diff options
author | Peter Marheine <pmarheine@chromium.org> | 2022-02-17 13:29:19 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-18 01:27:46 +0000 |
commit | c2f0fd3663fdeccd320d9c7b5e0b7a0cfa9a5e38 (patch) | |
tree | f1a19e90a931539371f7c8875b12c4cc0e62b20e | |
parent | 5cb1740ecc517969c0fd2a30cf429deb18dd55d6 (diff) | |
download | chrome-ec-c2f0fd3663fdeccd320d9c7b5e0b7a0cfa9a5e38.tar.gz |
nissa: configure voltage divider on EC_VSENSE_PP3300_S5
The hardware has a divider on the EC monitoring pin for the PP3300_S5
power rail because neither of the NPCX9 nor IT8xxx2 ECs can measure the
full-scale 3.3V rail. Configure it for the shim code.
Zephyr doesn't support generic voltage dividers on ADC inputs, so nothing
is done for those. Zephyr code that reads the ADC will need to be
divider-aware if required.
BUG=b:220001622
TEST=nivviks: `adc` now shows EC_VSENSE_PP3300_S5 at 3293 mV rather than
2714 mV after PP3300_S5 is turned on (`gpioset en_pp3300_s5 1`).
nereid: `adc EC_VSENSE_PP300_S5` shows expected ~3300 mV when the
rail is turned on.
BRANCH=none
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I10f49760196e41b295674a9120da6d2eed02e9fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3470818
Reviewed-by: Andrew McRae <amcrae@google.com>
-rw-r--r-- | zephyr/projects/nissa/nereid_overlay.dts | 12 | ||||
-rw-r--r-- | zephyr/projects/nissa/nivviks_overlay.dts | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/zephyr/projects/nissa/nereid_overlay.dts b/zephyr/projects/nissa/nereid_overlay.dts index d101dd11f1..3d6cdb368f 100644 --- a/zephyr/projects/nissa/nereid_overlay.dts +++ b/zephyr/projects/nissa/nereid_overlay.dts @@ -186,6 +186,18 @@ status = "okay"; }; +&adc_ec_vsense_pp3300_s5 { + /* + * Voltage divider on input has 47k upper and 220k lower legs with 3 V + * full-scale reading on the ADC. Apply the largest possible multiplier + * (without overflowing int32) to get the best possible approximation + * of the actual ratio, but derate by a factor of two to ensure + * unexpectedly high values won't overflow. + */ + mul = <(715828 / 2)>; + div = <(589820 / 2)>; +}; + /* Set bus speeds for I2C */ &i2c0 { label = "I2C_EEPROM"; diff --git a/zephyr/projects/nissa/nivviks_overlay.dts b/zephyr/projects/nissa/nivviks_overlay.dts index 52906f4bb8..b730c06e1e 100644 --- a/zephyr/projects/nissa/nivviks_overlay.dts +++ b/zephyr/projects/nissa/nivviks_overlay.dts @@ -173,6 +173,18 @@ status = "okay"; }; +&adc_ec_vsense_pp3300_s5 { + /* + * Voltage divider on input has 47k upper and 220k lower legs with + * 2714 mV full-scale reading on the ADC. Apply the largest possible + * multiplier (without overflowing int32) to get the best possible + * approximation of the actual ratio, but derate by a factor of two to + * ensure unexpectedly high values won't overflow. + */ + mul = <(791261 / 2)>; + div = <(651975 / 2)>; +}; + /* Set bus speeds for I2C */ &i2c0_0 { label = "I2C_EEPROM"; |