hwmon: Add support for SPD5118 compliant temperature sensors
Subsystems (3)
Guenter Roeck
maintainerPATCH v2 2/3 hwmon: Add support for SPD5118 compliant temperature sensors
Add support for SPD5118 (Jedec JESD300-5B.01) compliant temperature sensors. Such sensors are typically found on DDR5 memory modules.
The first patch of the series adds SPD5118 devicetree bindings. The second patch adds support for SPD5118 temperature sensors. The third patch adds support for suspend/resume.
Note: The driver introduced with this patch series does not currently support accessing the SPD5118 EEPROM, or accessing SPD5118 compatible chips in I3C mode.
v2: Drop PEC support; it only applies to I3C mode.
Update documentation
Add suspend/resume support
----------------------------------------------------------------
Guenter Roeck (3):
dt-bindings: hwmon: jedec,spd5118: Add bindings
hwmon: Add support for SPD5118 compliant temperature sensors
hwmon: (spd5118) Add suspend/resume support
.../devicetree/bindings/hwmon/jedec,spd5118.yaml | 48 ++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/spd5118.rst | 56 +++ drivers/hwmon/Kconfig | 12 + drivers/hwmon/Makefile | 1 + drivers/hwmon/spd5118.c | 510 +++++++++++++++++++++ 6 files changed, 628 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml create mode 100644 Documentation/hwmon/spd5118.rst create mode 100644 drivers/hwmon/spd5118.c
Guenter Roeck
maintainerPATCH v2 1/3 dt-bindings: hwmon: jedec,spd5118: Add bindings
Add device tree bindings for the SPD hub present in DDR5 modules.
---
v2: Drop pec-enable property
.../bindings/hwmon/jedec,spd5118.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml new file +48 -0
@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/jedec,spd5118.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: JEDEC JESD300-5B (SPD5118) compatible DDR5 SPD hub + +maintainers: + - Guenter Roeck <[email protected]> + +description: | + JEDEC JESD300-5B.01 SPD5118 Hub and Serial Presence Detect + https://www.jedec.org/standards-documents/docs/jesd300-5b01 + +select: + properties: + compatible: + const: jedec,spd5118 + + required: + - compatible + - reg + +properties: + compatible: + const: jedec,spd5118 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + temp-sensor@51 { + compatible = "jedec,spd5118"; + reg = <0x51>; + }; + };
Signature · 1 line
2.39.2
Re: [PATCH v2 1/3] dt-bindings: hwmon: jedec,spd5118: Add bindings
Quoted 3 lines · Guenter Roeck
Add device tree bindings for the SPD hub present in DDR5 modules.
Signed-off-by Guenter Roeck <[email protected]>
...
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml line 19
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml new file +13
-0+title: JEDEC JESD300-5B (SPD5118) compatible DDR5 SPD hub + +maintainers: + - Guenter Roeck <[email protected]> + +description: | + JEDEC JESD300-5B.01 SPD5118 Hub and Serial Presence Detect + https://www.jedec.org/standards-documents/docs/jesd300-5b01 + +select: + properties: + compatible: + const: jedec,spd5118
Why do you need the select? This s needed for cases with multiple bindings using parts of compatible list. I don't see the case here so far.
Best regards,
Krzysztof
Guenter Roeck
maintainerRe: [PATCH v2 1/3] dt-bindings: hwmon: jedec,spd5118: Add bindings
Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · Guenter Roeck
Add device tree bindings for the SPD hub present in DDR5 modules.
Signed-off-by Guenter Roeck <[email protected]>...
Quoted 17 lines
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml line 19
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml new file +13
-0+title: JEDEC JESD300-5B (SPD5118) compatible DDR5 SPD hub + +maintainers: + - Guenter Roeck <[email protected]> + +description: | + JEDEC JESD300-5B.01 SPD5118 Hub and Serial Presence Detect + https://www.jedec.org/standards-documents/docs/jesd300-5b01 + +select: + properties: + compatible: + const: jedec,spd5118Why do you need the select? This s needed for cases with multiple bindings using parts of compatible list. I don't see the case here so far.
Sorry, I am not a devicetree expert, I don't really know what I am doing, and just copied this from some other binding. I'll try to find a better example. Actually, I'll just add the binding to trivial devices.
Thanks,
Guenter
Re: [PATCH v2 1/3] dt-bindings: hwmon: jedec,spd5118: Add bindings
Quoted 26 lines · Guenter Roeck
Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · Guenter Roeck
Add device tree bindings for the SPD hub present in DDR5 modules.
Signed-off-by Guenter Roeck <[email protected]>...
Quoted 17 lines
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml line 19
Quoted 13 lines
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yaml new file +13
-0+title: JEDEC JESD300-5B (SPD5118) compatible DDR5 SPD hub + +maintainers: + - Guenter Roeck <[email protected]> + +description: | + JEDEC JESD300-5B.01 SPD5118 Hub and Serial Presence Detect + https://www.jedec.org/standards-documents/docs/jesd300-5b01 + +select: + properties: + compatible: + const: jedec,spd5118Why do you need the select? This s needed for cases with multiple bindings using parts of compatible list. I don't see the case here so far.
Quoted 3 lines
Sorry, I am not a devicetree expert, I don't really know what I am doing, and just copied this from some other binding. I'll try to find a better example. Actually, I'll just add the binding to trivial devices.
Sounds good.
Best regards,
Krzysztof
Guenter Roeck
maintainerPATCH v2 2/3 hwmon: Add support for SPD5118 compliant temperature sensors
In reply to Guenter RoeckAdd support for SPD5118 (Jedec JESD300-5B.01) compliant temperature sensors. Such sensors are typically found on DDR5 memory modules.
---
v2: Drop PEC property documentation
Add note indicating that alarm attributes are sticky until read to documentation
Fix detect function
Fix misspelling in Makefile (CONFIG_SENSORS_SPD5118->CONFIG_SENSORS_SPD5118)
Documentation/hwmon/index.rst | 1 + Documentation/hwmon/spd5118.rst | 56 ++++ drivers/hwmon/Kconfig | 12 + drivers/hwmon/Makefile | 1 + drivers/hwmon/spd5118.c | 481 ++++++++++++++++++++++++++++++++ 5 files changed, 551 insertions(+) create mode 100644 Documentation/hwmon/spd5118.rst create mode 100644 drivers/hwmon/spd5118.c
Documentation/hwmon/index.rst +1 -0
@@ -215,6 +215,7 @@ Hardware Monitoring Kernel Drivers smsc47m192 smsc47m1 sparx5-temp + spd5118 stpddc60 surface_fan sy7636a-hwmon
Documentation/hwmon/spd5118.rst new file +56 -0
56 lines not on this page · raw message
drivers/hwmon/Kconfig +12 -0
@@ -2181,6 +2181,18 @@ config SENSORS_INA3221 This driver can also be built as a module. If so, the module will be called ina3221. +config SENSORS_SPD5118 + tristate "SPD5118 Compliant Temperature Sensors" + depends on I2C + select REGMAP_I2C + help + If you say yes here you get support for SPD5118 (JEDEC JESD300-5B) + compliant temperature sensors. Such sensors are found on DDR5 memory + modules. + + This driver can also be built as a module. If so, the module + will be called spd5118. + config SENSORS_TC74 tristate "Microchip TC74" depends on I2C
drivers/hwmon/Makefile +1 -0
@@ -207,6 +207,7 @@ obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o +obj-$(CONFIG_SENSORS_SPD5118) += spd5118.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o obj-$(CONFIG_SENSORS_SURFACE_FAN)+= surface_fan.o obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o
drivers/hwmon/spd5118.c new file +481 -0
481 lines not on this page · raw message
Signature · 1 line
2.39.2
Guenter Roeck
maintainerPATCH v2 3/3 hwmon: (spd5118) Add suspend/resume support
In reply to Guenter RoeckAdd suspend/resume support to ensure that limit and configuration registers are updated and synchronized after a suspend/resume cycle.
---
v2: New patch
RFT: I tested the patch through a suspend/resume cycle, and it seems
to work, but I am not sure if that had any effect because, after all, the memory is still active during suspend/resume. I was unable to test a hibernation cycle with my system.
drivers/hwmon/spd5118.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/hwmon/spd5118.c +29 -0
@@ -20,6 +20,7 @@#include <linux/i2c.h> #include <linux/hwmon.h> #include <linux/module.h> +#include <linux/pm.h> #include <linux/regmap.h> #include <linux/units.h>
@@ -432,6 +433,8 @@ static int spd5118_probe(struct i2c_client *client)if (!spd5118_vendor_valid (bank, vendor))return -ENODEV ; +dev_set_drvdata (dev, regmap); + hwmon_dev =devm_hwmon_device_register_with_info (dev,"spd5118" , regmap, &spd5118_chip_info,NULL );
@@ -449,6 +452,31 @@ static int spd5118_probe(struct i2c_client *client)return 0 ; } +static int spd5118_suspend (struct device *dev) +{ +struct regmap *regmap =dev_get_drvdata (dev); + +regcache_cache_bypass (regmap, true); +regmap_update_bits (regmap,SPD5118_REG_TEMP_CONFIG ,SPD5118_TS_DISABLE , +SPD5118_TS_DISABLE ); +regcache_cache_bypass (regmap, false); + +regcache_cache_only (regmap, true); +regcache_mark_dirty (regmap); + +return 0 ; +} + +static int spd5118_resume (struct device *dev) +{ +struct regmap *regmap =dev_get_drvdata (dev); + +regcache_cache_only (regmap, false); +return regcache_sync (regmap); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(spd5118_pm_ops, spd5118_suspend, spd5118_resume); +static const struct i2c_device_id spd5118_id[] = { {"spd5118" ,0 }, { }
@@ -466,6 +494,7 @@ static struct i2c_driver spd5118_driver = { .driver = { .name = "spd5118", .of_match_table = spd5118_of_ids, + .pm = pm_sleep_ptr(&spd5118_pm_ops), }, .probe = spd5118_probe, .id_table = spd5118_id,
Signature · 1 line
2.39.2
Guenter Roeck
maintainerQuoted 28 lines · Guenter Roeck
Add support for SPD5118 (Jedec JESD300-5B.01) compliant temperature sensors. Such sensors are typically found on DDR5 memory modules.
The first patch of the series adds SPD5118 devicetree bindings. The second patch adds support for SPD5118 temperature sensors. The third patch adds support for suspend/resume.
Note: The driver introduced with this patch series does not currently support accessing the SPD5118 EEPROM, or accessing SPD5118 compatible chips in I3C mode.
v2: Drop PEC support; it only applies to I3C mode.
Update documentation
Add suspend/resume support----------------------------------------------------------------
Guenter Roeck (3):
dt-bindings: hwmon: jedec,spd5118: Add bindings
hwmon: Add support for SPD5118 compliant temperature sensors
hwmon: (spd5118) Add suspend/resume support.../devicetree/bindings/hwmon/jedec,spd5118.yaml | 48 ++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/spd5118.rst | 56 +++ drivers/hwmon/Kconfig | 12 + drivers/hwmon/Makefile | 1 + drivers/hwmon/spd5118.c | 510 +++++++++++++++++++++ 6 files changed, 628 insertions(+)
Quoted 3 lines
create mode 100644
Documentation/devicetree/bindings/hwmon/jedec,spd5118.yamlcreate mode 100644Documentation/hwmon/spd5118.rst
create mode 100644drivers/hwmon/spd5118.c
Obviously this should have been patch 0/3. Sory.
Guenter