Patch "hwmon: (ina3221) Fix shunt sum critical calculation" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hwmon: (ina3221) Fix shunt sum critical calculation

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwmon-ina3221-fix-shunt-sum-critical-calculation.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b5a93d353c5e0c57961d8c999493edf59dac4857
Author: Ninad Malwade <nmalwade@xxxxxxxxxx>
Date:   Tue Nov 8 12:45:08 2022 +0800

    hwmon: (ina3221) Fix shunt sum critical calculation
    
    [ Upstream commit b8d27d2ce8dfc207e4b67b929a86f2be76fbc6ef ]
    
    The shunt sum critical limit register value should be left shifted
    by one bit as its LSB-0 is a reserved bit.
    
    Fixes: 2057bdfb7184 ("hwmon: (ina3221) Add summation feature support")
    Signed-off-by: Ninad Malwade <nmalwade@xxxxxxxxxx>
    Reviewed-by: Thierry Reding <treding@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221108044508.23463-1-nmalwade@xxxxxxxxxx
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index ad11cbddc3a7..d3c98115042b 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -230,7 +230,7 @@ static int ina3221_read_value(struct ina3221_data *ina, unsigned int reg,
 	 * Shunt Voltage Sum register has 14-bit value with 1-bit shift
 	 * Other Shunt Voltage registers have 12 bits with 3-bit shift
 	 */
-	if (reg == INA3221_SHUNT_SUM)
+	if (reg == INA3221_SHUNT_SUM || reg == INA3221_CRIT_SUM)
 		*val = sign_extend32(regval >> 1, 14);
 	else
 		*val = sign_extend32(regval >> 3, 12);
@@ -465,7 +465,7 @@ static int ina3221_write_curr(struct device *dev, u32 attr,
 	 *     SHUNT_SUM: (1 / 40uV) << 1 = 1 / 20uV
 	 *     SHUNT[1-3]: (1 / 40uV) << 3 = 1 / 5uV
 	 */
-	if (reg == INA3221_SHUNT_SUM)
+	if (reg == INA3221_SHUNT_SUM || reg == INA3221_CRIT_SUM)
 		regval = DIV_ROUND_CLOSEST(voltage_uv, 20) & 0xfffe;
 	else
 		regval = DIV_ROUND_CLOSEST(voltage_uv, 5) & 0xfff8;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux