Skip to contentSkip to conversation

hwmon: new driver for ST stts751 thermal sensor

PATCH Applied Andrea Merello 2 participants 4 messages Feb 2, 2017 – Feb 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/2 hwmon: new driver for ST stts751 thermal sensor

This patch adds a HWMON driver for ST Microelectronics STTS751 temperature sensors.

Changes since V3:
- fix sysfs_notify() filename
- simplify error exit path in stts751_update_temp(): kill useless goto
- fix set function were racy due to lock incorrectly placed
- use msecs_to_jiffies instead of manual calculation
- fix jiffies and msecs were mixed up
- don't mark cache as good unless reads really succeded to fill up it
- when updating therm, hyst keeps relative value rather than abs value
- don't should in dev_dbg when chip is detected
- don't ever generate two uevents
- clarify clear-on-read behaviour of status reg alarm flags
- simplify mDEG to HW conversion function
- fix chip stops due to incorrect resolution configuration
- fix incorrectly reading negative numbers from HW

Changes since V4:
- fix continuation lines (style, remove uncecessary, ..)
- shorten a unnecessary verbose dev_warn() message
- fix set_interval() exitpath didn't return error
- change uncecesary neg-logic
- change file symbolic permissions with octal
- move chip revision test in probe(), change dev_notice() in dev_dbg()
- use "return 0" on success (non functional change)
- add further checks in i2c detect function
- fix i2c detect function read wrong reg while checking for manufacturer ID

Changes since V5:
- fix mixed usage of i2c dev and hwmon dev for logging functions
- avoid max/min alert log spam

Thanks-to: LABBE Corentin [for suggestions]
Thanks-to: Guenter Roeck [for suggestion and discussions]

Cc LABBE Corentin <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Jean Delvare <[email protected]>
---
 drivers/hwmon/Kconfig   |  10 +
 drivers/hwmon/Makefile  |   1 +
 drivers/hwmon/stts751.c | 834 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 845 insertions(+)
 create mode 100644 drivers/hwmon/stts751.c
drivers/hwmon/Kconfig +10 -0
index d1f82f2..8fdd241 100644
@@ -1448,6 +1448,16 @@ config SENSORS_SCH5636
 	  This driver can also be built as a module.  If so, the module
 	  will be called sch5636.
 
+config SENSORS_STTS751
+	tristate "ST Microelectronics STTS751"
+	depends on I2C
+	help
+	  If you say yes here you get support for STTS751
+	  temperature sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called stts751.
+
 config SENSORS_SMM665
 	tristate "Summit Microelectronics SMM665"
 	depends on I2C
drivers/hwmon/Makefile +1 -0
index 7476b22..1114130 100644
@@ -147,6 +147,7 @@ obj-$(CONFIG_SENSORS_SMM665)	+= smm665.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
 obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
+obj-$(CONFIG_SENSORS_STTS751)	+= stts751.o
 obj-$(CONFIG_SENSORS_AMC6821)	+= amc6821.o
 obj-$(CONFIG_SENSORS_TC74)	+= tc74.o
 obj-$(CONFIG_SENSORS_THMC50)	+= thmc50.o
drivers/hwmon/stts751.c new file +834 -0

834 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v6 2/2 DT: add binding documentation for STTS751

Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
---
 Documentation/devicetree/bindings/hwmon/stts751.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/stts751.txt
Documentation/devicetree/bindings/hwmon/stts751.txt new file +15 -0
new file mode 100644
index 0000000..3ee1dc3
@@ -0,0 +1,15 @@
+* STTS751 thermometer.
+
+Required node properties:
+- compatible: "stts751"
+- reg: I2C bus address of the device
+
+Optional properties:
+- smbus-timeout-disable: when set, the smbus timeout function will be disabled
+
+Example stts751 node:
+
+temp-sensor {
+	compatible = "stts751";
+	reg = <0x48>;
+}
Signature · 1 line
2.7.4
maintainer Applied
#2 lore raw

Re: [PATCH v6 2/2] DT: add binding documentation for STTS751

Quoted 4 lines · Andrea Merello
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>

---

Applied to hwmon-next.

Guenter

Quoted 26 lines
 Documentation/devicetree/bindings/hwmon/stts751.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/stts751.txt
Documentation/devicetree/bindings/hwmon/stts751.txt new file +15 -0
new file mode 100644
index 0000000..3ee1dc3
@@ -0,0 +1,15 @@
+* STTS751 thermometer.
+
+Required node properties:
+- compatible: "stts751"
+- reg: I2C bus address of the device
+
+Optional properties:
+- smbus-timeout-disable: when set, the smbus timeout function will be disabled
+
+Example stts751 node:
+
+temp-sensor {
+	compatible = "stts751";
+	reg = <0x48>;
+}
maintainer Applied
#3 lore raw
In reply to Andrea Merello
Quoted 33 lines · Andrea Merello

This patch adds a HWMON driver for ST Microelectronics STTS751 temperature sensors.

Changes since V3:
- fix sysfs_notify() filename
- simplify error exit path in stts751_update_temp(): kill useless goto
- fix set function were racy due to lock incorrectly placed
- use msecs_to_jiffies instead of manual calculation
- fix jiffies and msecs were mixed up
- don't mark cache as good unless reads really succeded to fill up it
- when updating therm, hyst keeps relative value rather than abs value
- don't should in dev_dbg when chip is detected
- don't ever generate two uevents
- clarify clear-on-read behaviour of status reg alarm flags
- simplify mDEG to HW conversion function
- fix chip stops due to incorrect resolution configuration
- fix incorrectly reading negative numbers from HW

Changes since V4:
- fix continuation lines (style, remove uncecessary, ..)
- shorten a unnecessary verbose dev_warn() message
- fix set_interval() exitpath didn't return error
- change uncecesary neg-logic
- change file symbolic permissions with octal
- move chip revision test in probe(), change dev_notice() in dev_dbg()
- use "return 0" on success (non functional change)
- add further checks in i2c detect function
- fix i2c detect function read wrong reg while checking for manufacturer ID

Changes since V5:
- fix mixed usage of i2c dev and hwmon dev for logging functions
- avoid max/min alert log spam

Quoted 6 lines

Thanks-to: LABBE Corentin [for suggestions]
Thanks-to: Guenter Roeck [for suggestion and discussions]

Cc LABBE Corentin <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Jean Delvare <[email protected]>

Applied to hwmon-next.

Guenter