Re: [PATCH v3 1/9] hwmon: (core) Order include files alphabetically

2016-09-27 Thread Jean Delvare
On dim., 2016-07-24 at 20:32 -0700, Guenter Roeck wrote:
> Ordering include files alphabetically makes it easier to add new ones.
> Stop including linux/spinlock.h and linux/kdev_t.h since both are not
> needed.
> 
> Reviewed-by: Jonathan Cameron 
> Signed-off-by: Guenter Roeck 
> ---
> v3: No change
> v2: Added patch
> 
>  drivers/hwmon/hwmon.c | 10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
> (...)

Reviewed-by: Jean Delvare 

-- 
Jean Delvare
SUSE L3 Support

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] DT: add binding documentation for STTS751

2016-09-27 Thread Andrea Merello
Signed-off-by: Andrea Merello 
Cc: Rob Herring 
Cc: Mark Rutland 
---
 Documentation/devicetree/bindings/hwmon/stts751.txt | 19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/stts751.txt

diff --git a/Documentation/devicetree/bindings/hwmon/stts751.txt 
b/Documentation/devicetree/bindings/hwmon/stts751.txt
new file mode 100644
index 000..277ad46
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/stts751.txt
@@ -0,0 +1,19 @@
+* STTS751 thermometer.
+
+Required node properties:
+- compatible: "stts751"
+- reg: I2C bus address of the device
+
+Optional properties:
+- has-therm: specifies that the "therm" pin is wired
+- has-event: specifies that the "event" pin is wired
+- smbus-timeout-disable: when set, the smbus timeout function will be disabled
+
+Example stts751 node:
+
+temp-sensor {
+   compatible = "stts751";
+   reg = <0x48>;
+   has-therm;
+   has-event;
+}
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] hwmon: new driver for ST stts751 thermal sensor

2016-09-27 Thread Andrea Merello
This patch adds a HWMON driver for ST Microelectronics STTS751
temperature sensors.

It does support temperature reading (of course), SMBUS alert
functionality and "therm" output.

Thanks-to: LABBE Corentin [for suggestions]
Thanks-to: Guenter Roeck [for suggestions/discussions]
Signed-off-by: Andrea Merello 
Cc: LABBE Corentin 
Cc: Guenter Roeck 
Cc: Jean Delvare 
---
 drivers/hwmon/Kconfig   |  12 +-
 drivers/hwmon/Makefile  |   2 +-
 drivers/hwmon/stts751.c | 805 
 3 files changed, 817 insertions(+), 2 deletions(-)
 create mode 100644 drivers/hwmon/stts751.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index eaf2f91..4e70b42 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -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
@@ -1506,7 +1516,7 @@ config SENSORS_ADS7871
 
 config SENSORS_AMC6821
tristate "Texas Instruments AMC6821"
-   depends on I2C 
+   depends on I2C
help
  If you say yes here you get support for the Texas Instruments
  AMC6821 hardware monitoring chips.
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index fe87d28..1114130 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -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
@@ -169,4 +170,3 @@ obj-$(CONFIG_SENSORS_WM8350)+= wm8350-hwmon.o
 obj-$(CONFIG_PMBUS)+= pmbus/
 
 ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
-
diff --git a/drivers/hwmon/stts751.c b/drivers/hwmon/stts751.c
new file mode 100644
index 000..8358e04
--- /dev/null
+++ b/drivers/hwmon/stts751.c
@@ -0,0 +1,805 @@
+/*
+ * STTS751 sensor driver
+ *
+ * Copyright (C) 2016 Istituto Italiano di Tecnologia - RBCS - EDL
+ * Robotics, Brain and Cognitive Sciences department
+ * Electronic Design Laboratory
+ *
+ * Written by Andrea Merello 
+ *
+ * Based on  LM95241 driver and LM90 driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DEVNAME "stts751"
+
+static const unsigned short normal_i2c[] = {
+   0x48, 0x49, 0x38, 0x39,  /* STTS751-0 */
+   0x4A, 0x4B, 0x3A, 0x3B,  /* STTS751-1 */
+   I2C_CLIENT_END };
+
+#define STTS751_REG_TEMP_H 0x00
+#define STTS751_REG_STATUS 0x01
+#define STTS751_STATUS_TRIPL   BIT(5)
+#define STTS751_STATUS_TRIPH   BIT(6)
+#define STTS751_STATUS_BUSYBIT(8)
+#define STTS751_REG_TEMP_L 0x02
+#define STTS751_REG_CONF   0x03
+#define STTS751_CONF_RES_MASK  0x0C
+#define STTS751_CONF_RES_SHIFT  2
+#define STTS751_CONF_EVENT_DIS  BIT(7)
+#define STTS751_CONF_STOP  BIT(6)
+#define STTS751_REG_RATE   0x04
+#define STTS751_REG_HLIM_H 0x05
+#define STTS751_REG_HLIM_L 0x06
+#define STTS751_REG_LLIM_H 0x07
+#define STTS751_REG_LLIM_L 0x08
+#define STTS751_REG_ONESHOT0x0F
+#define STTS751_REG_TLIM   0x20
+#define STTS751_REG_HYST   0x21
+#define STTS751_REG_SMBUS_TO   0x22
+
+#define STTS751_REG_PROD_ID0xFD
+#define STTS751_REG_MAN_ID 0xFE
+#define STTS751_REG_REV_ID 0xFF
+
+#define STTS751_0_PROD_ID  0x00
+#define STTS751_1_PROD_ID  0x01
+#define ST_MAN_ID  0x53
+
+/* stick with HW defaults */
+#define STTS751_THERM_DEFAULT  85000
+#define STTS751_HYST_DEFAULT   1
+#define STTS751_EVENT_MAX_DEFAULT 85000
+#define STTS751_EVENT_MIN_DEFAULT 0
+
+#define STTS751_RACE_RETRY 5
+#define STTS751_CONV_TIMEOUT   100 /* mS 

[PATCH v2 0/2] Add driver for ST stts751 thermal sensor

2016-09-27 Thread Andrea Merello
This series adds new driver for ST stts751 thermal sensor

Changes since v1:
- removed the "manual mode" logic; always use automatic mode
- changed the way 16-bit data is read from two 8-bit regs (now similar to lm90)
- code simplifications
- comment style fixes

Andrea Merello (2):
  DT: add binding documentation for STTS751
  hwmon: new driver for ST stts751 thermal sensor

 .../devicetree/bindings/hwmon/stts751.txt  |  19 +
 drivers/hwmon/Kconfig  |  12 +-
 drivers/hwmon/Makefile |   2 +-
 drivers/hwmon/stts751.c| 805 +
 4 files changed, 836 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/stts751.txt
 create mode 100644 drivers/hwmon/stts751.c

Cc: Rob Herring 
Cc: Mark Rutland 
Cc: LABBE Corentin 
Cc: Guenter Roeck 
Cc: Jean Delvare 


--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html