Patch "eeprom: at24: Probe for DDR3 thermal sensor in the SPD case" has been added to the 5.15-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

    eeprom: at24: Probe for DDR3 thermal sensor in the SPD case

to the 5.15-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:
     eeprom-at24-probe-for-ddr3-thermal-sensor-in-the-spd.patch
and it can be found in the queue-5.15 subdirectory.

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



commit ecc4cc6cb4915d569048e89ffb62f477303eafef
Author: Heiner Kallweit <hkallweit1@xxxxxxxxx>
Date:   Wed Dec 20 13:55:58 2023 +0100

    eeprom: at24: Probe for DDR3 thermal sensor in the SPD case
    
    [ Upstream commit caba40ec3531b0849f44502a03117796e8c9f4a1 ]
    
    The DDR3 SPD data structure advertises the presence of a thermal
    sensor on a DDR3 module in byte 32, bit 7. Let's use this information
    to explicitly instantiate the thermal sensor I2C client instead of
    having to rely on class-based I2C probing.
    
    The temp sensor i2c address can be derived from the SPD i2c address,
    so we can directly instantiate the device and don't have to probe
    for it. If the temp sensor has been instantiated already by other
    means (e.g. class-based auto-detection), then the busy-check in
    i2c_new_client_device will detect this.
    
    Note: Thermal sensors on DDR4 DIMM's are instantiated from the
          ee1004 driver.
    
    Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
    Link: https://lore.kernel.org/r/68113672-3724-44d5-9ff8-313dd6628f8c@xxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: f42c97027fb7 ("eeprom: at24: fix memory corruption race condition")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index b100bbc888668..65a7517c031a7 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -585,6 +585,31 @@ static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len)
 	}
 }
 
+static void at24_probe_temp_sensor(struct i2c_client *client)
+{
+	struct at24_data *at24 = i2c_get_clientdata(client);
+	struct i2c_board_info info = { .type = "jc42" };
+	int ret;
+	u8 val;
+
+	/*
+	 * Byte 2 has value 11 for DDR3, earlier versions don't
+	 * support the thermal sensor present flag
+	 */
+	ret = at24_read(at24, 2, &val, 1);
+	if (ret || val != 11)
+		return;
+
+	/* Byte 32, bit 7 is set if temp sensor is present */
+	ret = at24_read(at24, 32, &val, 1);
+	if (ret || !(val & BIT(7)))
+		return;
+
+	info.addr = 0x18 | (client->addr & 7);
+
+	i2c_new_client_device(client->adapter, &info);
+}
+
 static int at24_probe(struct i2c_client *client)
 {
 	struct regmap_config regmap_config = { };
@@ -778,6 +803,10 @@ static int at24_probe(struct i2c_client *client)
 		return -ENODEV;
 	}
 
+	/* If this a SPD EEPROM, probe for DDR3 thermal sensor */
+	if (cdata == &at24_data_spd)
+		at24_probe_temp_sensor(client);
+
 	pm_runtime_idle(dev);
 
 	if (writable)




[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