From 0a12bb3bf1a052ff7af08bc5b53252a4b56ba7d0 Mon Sep 17 00:00:00 2001 From: PeterHo-wiwynn Date: Fri, 8 Mar 2024 13:56:09 -0800 Subject: [PATCH] yosemite4: Adjust ina233 config for matching hardware design Summary: # Description: Adjust ina233 config for matching hardware design. The external shunt is 5 mohm, so the resistor-calibration should be 0x0400. This patch is for hardware testing. According to the datasheet and upstream review comment, resistor-calibration should be calculated, and we should set external shunt on DTS instead. We will revise the ina233 driver by the upstream review comment and contribute the code once we finish. # Motivation: Hardware team reported that the current reading wasn't correct. X-link: https://github.com/facebookexternal/openbmc.wiwynn/pull/2997 Test Plan: Measure the current with current load and compare with the BMC's reading - pass Reviewed By: wangx6f Differential Revision: D54569359 fbshipit-source-id: 134dfeb4881c93013e05469631c47ded1de0ad70 --- ...calibration-for-matching-hardware-de.patch | 62 +++++++++++++++++++ .../linux/linux-aspeed_%.bbappend | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed/0512-Adjust-resistor-calibration-for-matching-hardware-de.patch diff --git a/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed/0512-Adjust-resistor-calibration-for-matching-hardware-de.patch b/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed/0512-Adjust-resistor-calibration-for-matching-hardware-de.patch new file mode 100644 index 000000000000..c17d77977808 --- /dev/null +++ b/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed/0512-Adjust-resistor-calibration-for-matching-hardware-de.patch @@ -0,0 +1,62 @@ +From 6e15f71291c5b1ab7bbed0d97ab5e865888fbfbe Mon Sep 17 00:00:00 2001 +From: PeterHo-wiwynn +Date: Tue, 5 Mar 2024 15:15:49 +0800 +Subject: [PATCH] Adjust resistor-calibration for matching hardware design + +This patch is for hardware testing. According to the datasheet and +upstream review comment, resistor-calibration should be calculated, +and we should set external shunt on DTS instead. We will revise the +ina233 driver by the upstream review comment and contribute the code +once we finish. +--- + .../boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +index 45248c31db22..a8b724049e83 100644 +--- a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts ++++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +@@ -1079,35 +1079,35 @@ adc@37 { + power-sensor@40 { + compatible = "ti,ina233"; + reg = <0x40>; +- resistor-calibration = /bits/ 16 <0x0a00>; ++ resistor-calibration = /bits/ 16 <0x0400>; + current-lsb= /bits/ 16 <0x0001>; + }; + + power-sensor@41 { + compatible = "ti,ina233"; + reg = <0x41>; +- resistor-calibration = /bits/ 16 <0x0a00>; ++ resistor-calibration = /bits/ 16 <0x0400>; + current-lsb= /bits/ 16 <0x0001>; + }; + + power-sensor@42 { + compatible = "ti,ina233"; + reg = <0x42>; +- resistor-calibration = /bits/ 16 <0x0a00>; ++ resistor-calibration = /bits/ 16 <0x0400>; + current-lsb= /bits/ 16 <0x0001>; + }; + + power-sensor@43 { + compatible = "ti,ina233"; + reg = <0x43>; +- resistor-calibration = /bits/ 16 <0x0a00>; ++ resistor-calibration = /bits/ 16 <0x0400>; + current-lsb= /bits/ 16 <0x0001>; + }; + + power-sensor@44 { + compatible = "ti,ina233"; + reg = <0x44>; +- resistor-calibration = /bits/ 16 <0x0a00>; ++ resistor-calibration = /bits/ 16 <0x0400>; + current-lsb= /bits/ 16 <0x0001>; + }; + +-- +2.25.1 + diff --git a/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed_%.bbappend index e7522215df3b..bd4ec2dfe9b1 100644 --- a/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-facebook/meta-yosemite4/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -12,5 +12,5 @@ SRC_URI += " \ file://0509-Meta-yv4-dts-add-mac-config-property.patch \ file://0510-yosemite4-Add-EEPROMs-for-NICs-in-DTS.patch \ file://0511-Add-ina233-and-ina238-devicetree-config.patch \ + file://0512-Adjust-resistor-calibration-for-matching-hardware-de.patch \ " -