Skip to contentSkip to conversation

da9061: DA9061 driver submission

PATCH Applied Steve Twiss 7 participants 26 messages Oct 26, 2016 – Dec 15, 2016

Subsystems (8)

v2 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover da9061: DA9061 driver submission

From: Steve Twiss <[email protected]>

This patch set adds support for the Dialog DA9061 Power Management IC. Support is made by altering the existing DA9062 device driver, where appropriate.

In this patch set the following is provided:

[PATCH V2 01/10] Binding for onkey
[PATCH V2 02/10] Binding for watchdog
[PATCH V2 03/10] Binding for thermal supervisor
[PATCH V2 04/10] Binding for MFD and regulators
[PATCH V2 05/10] MFD core support
[PATCH V2 06/10] BUCKs and LDOs
[PATCH V2 07/10] Onkey
[PATCH V2 08/10] Watchdog
[PATCH V2 09/10] PMIC temperature monitoring
[PATCH V2 10/10] MAINTAINERS update

This patch applies against linux-next and v4.8

Thank you,
Steve Twiss, Dialog Semiconductor Ltd.

Steve Twiss (10):
Documentation: devicetree: input: additions for da9061 onkey driver
Documentation: devicetree: watchdog: da9062/61 watchdog timer binding
Documentation: devicetree: thermal: da9062/61 TJUNC temperature
binding
Documentation: devicetree: mfd: da9062/61 MFD binding
mfd: da9061: MFD core support
regulator: da9061: BUCK and LDO regulator driver
Input: da9061: onkey driver
watchdog: da9062/61: watchdog driver
thermal: da9062/61: Thermal junction temperature monitoring driver
MAINTAINERS: da9062/61 updates to the Dialog Semiconductor search
terms

 .../devicetree/bindings/input/da9062-onkey.txt     |  39 +-
 Documentation/devicetree/bindings/mfd/da9062.txt   |  45 ++-
 .../devicetree/bindings/thermal/da9062-thermal.txt |  37 ++
 .../devicetree/bindings/watchdog/da9062-wdt.txt    |  21 +
 MAINTAINERS                                        |   4 +
 drivers/input/misc/Kconfig                         |   7 +-
 drivers/input/misc/da9063_onkey.c                  |   8 +-
 drivers/mfd/Kconfig                                |   5 +-
 drivers/mfd/da9062-core.c                          | 427 ++++++++++++++++++++-
 drivers/regulator/Kconfig                          |   4 +-
 drivers/regulator/da9062-regulator.c               | 301 ++++++++++++++-
 drivers/thermal/Kconfig                            |  10 +
 drivers/thermal/Makefile                           |   1 +
 drivers/thermal/da9062-thermal.c                   | 289 ++++++++++++++
 drivers/watchdog/Kconfig                           |   4 +-
 drivers/watchdog/da9062_wdt.c                      |  18 +-
 include/linux/mfd/da9062/core.h                    |  27 +-
 include/linux/mfd/da9062/registers.h               |   2 +
 18 files changed, 1180 insertions(+), 69 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/da9062-thermal.txt
 create mode 100644 Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
 create mode 100644 drivers/thermal/da9062-thermal.c
Signature · 1 line
end-of-patch for PATCH V2
#1 lore raw

PATCH v2 1/10 Documentation: devicetree: input: additions for da9061 onkey driver

From: Steve Twiss <[email protected]>

Add binding information for DA9061 onkey.

This patch updates the compatible string "dlg,da9061-onkey" to support DA9061, removes the reference to KEY_SLEEP (which the driver no longer supports) and fixes a typo in the example for DA9063.

It also adds two new examples, one for DA9062 and one for DA9061. The DA9061 examples uses a fall-back compatible string for the DA9062 onkey driver.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 06/10] to [PATCH V2 01/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Typo s/ther/the/ in commit message
- Explanation about why KEY_SLEEP was removed (see below)
- Addition of DA9062 example
- Addition of a DA9061 example to follow the driver fall-back compatible convention being applied for this device driver

Hi,

This patch depends on the acceptance of the main code for the onkey:
[PATCH V2 07/10] Input: da9061: onkey driver.

The device driver no longer supports KEY_SLEEP. It only supports KEY_POWER. This change was sent a while ago for the DA9063 ONKEY driver, but the docs were not updated.

Supporting KEY_SLEEP was not the general convention and the typical solution should have been for KEY_POWER to support both cases of suspend and S/W power off.

There is also new binding examples for DA9062 and DA9061. Importantly, the Linux device driver changes for DA9061 were rejected because the DA9062 device driver can be reused. For this reason, the DA9061 example uses a fall-back compatible string.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 .../devicetree/bindings/input/da9062-onkey.txt     | 39 +++++++++++++++-------
 1 file changed, 27 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/input/da9062-onkey.txt +27 -12
index ab0e048..e5a0469 100644
@@ -1,32 +1,47 @@
-* Dialog DA9062/63 OnKey Module
+* Dialog DA9061/62/63 OnKey Module
 
-This module is part of the DA9062/DA9063. For more details about entire
-chips see Documentation/devicetree/bindings/mfd/da9062.txt and
-Documentation/devicetree/bindings/mfd/da9063.txt
+This module is part of the DA9061/DA9062/DA9063. For more details about entire
+DA9062 and DA9061 chips see Documentation/devicetree/bindings/mfd/da9062.txt
+For DA9063 see Documentation/devicetree/bindings/mfd/da9063.txt
 
-This module provides KEY_POWER, KEY_SLEEP and events.
+This module provides the KEY_POWER event.
 
 Required properties:
 
 - compatible: should be one of:
+	dlg,da9061-onkey
 	dlg,da9062-onkey
 	dlg,da9063-onkey
 
 Optional properties:
 
-  - dlg,disable-key-power : Disable power-down using a long key-press. If this
+- dlg,disable-key-power : Disable power-down using a long key-press. If this
     entry exists the OnKey driver will remove support for the KEY_POWER key
-    press. If this entry does not exist then by default the key-press
-    triggered power down is enabled and the OnKey will support both KEY_POWER
-    and KEY_SLEEP.
+    press when triggered using a long press of the OnKey.
 
-Example:
-
-	pmic0: da9062@58 {
+Example: DA9063
 
+	pmic0: da9063@58 {
 		onkey {
 			compatible = "dlg,da9063-onkey";
 			dlg,disable-key-power;
 		};
+	};
+
+Example: DA9062
+
+	pmic0: da9062@58 {
+		onkey {
+			compatible = "dlg,da9062-onkey";
+			dlg,disable-key-power;
+		};
+	};
+
+Example: DA9061 using a fall-back compatible for the DA9062 onkey driver
 
+	pmic0: da9061@58 {
+		onkey {
+			compatible = "dlg,da9061-onkey", "dlg,da9062-onkey";
+			dlg,disable-key-power;
+		};
 	};
Signature · 6 lines
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#2 lore raw

Re: [PATCH V2 01/10] Documentation: devicetree: input: additions for da9061 onkey driver

Quoted 27 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Add binding information for DA9061 onkey.

This patch updates the compatible string "dlg,da9061-onkey" to support DA9061, removes the reference to KEY_SLEEP (which the driver no longer supports) and fixes a typo in the example for DA9063.

It also adds two new examples, one for DA9062 and one for DA9061. The DA9061 examples uses a fall-back compatible string for the DA9062 onkey driver.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 06/10] to [PATCH V2 01/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Typo s/ther/the/ in commit message
- Explanation about why KEY_SLEEP was removed (see below)
- Addition of DA9062 example
- Addition of a DA9061 example to follow the driver fall-back compatible convention being applied for this device driver

Quoted 4 lines

Hi,

This patch depends on the acceptance of the main code for the onkey:
[PATCH V2 07/10] Input: da9061: onkey driver.

Just FYI, not really. While common practice is we take the whole series together bindings could come first without a driver.

Quoted 7 lines

The device driver no longer supports KEY_SLEEP. It only supports KEY_POWER. This change was sent a while ago for the DA9063 ONKEY driver, but the docs were not updated.

Supporting KEY_SLEEP was not the general convention and the typical solution should have been for KEY_POWER to support both cases of suspend and S/W power off.

This info will be lost when applied. You should add it to the commit message.

Quoted 25 lines

There is also new binding examples for DA9062 and DA9061. Importantly, the Linux device driver changes for DA9061 were rejected because the DA9062 device driver can be reused. For this reason, the DA9061 example uses a fall-back compatible string.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 .../devicetree/bindings/input/da9062-onkey.txt     | 39 +++++++++++++++-------
 1 file changed, 27 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/input/da9062-onkey.txt +2 -4
index ab0e048..e5a0469 100644
@@ -1,32 +1,47 @@
-* Dialog DA9062/63 OnKey Module
+* Dialog DA9061/62/63 OnKey Module
 
-This module is part of the DA9062/DA9063. For more details about entire
-chips see Documentation/devicetree/bindings/mfd/da9062.txt and
-Documentation/devicetree/bindings/mfd/da9063.txt
+This module is part of the DA9061/DA9062/DA9063. For more details about entire

Documentation/devicetree/bindings/input/da9062-onkey.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/input/da9062-onkey.txt +4 -1
+DA9062 and DA9061 chips see Documentation/devicetree/bindings/mfd/da9062.txt
+For DA9063 see Documentation/devicetree/bindings/mfd/da9063.txt
 
-This module provides KEY_POWER, KEY_SLEEP and events.
+This module provides the KEY_POWER event.
 
 Required properties:
 
 - compatible: should be one of:
+	dlg,da9061-onkey

This needs to list the fallback too. It's below, but each line should be valid combinations of compatible strings.

Quoted 45 lines
Documentation/devicetree/bindings/input/da9062-onkey.txt +21 -7
 	dlg,da9062-onkey
 	dlg,da9063-onkey
 
 Optional properties:
 
-  - dlg,disable-key-power : Disable power-down using a long key-press. If this
+- dlg,disable-key-power : Disable power-down using a long key-press. If this
     entry exists the OnKey driver will remove support for the KEY_POWER key
-    press. If this entry does not exist then by default the key-press
-    triggered power down is enabled and the OnKey will support both KEY_POWER
-    and KEY_SLEEP.
+    press when triggered using a long press of the OnKey.
 
-Example:
-
-	pmic0: da9062@58 {
+Example: DA9063
 
+	pmic0: da9063@58 {
 		onkey {
 			compatible = "dlg,da9063-onkey";
 			dlg,disable-key-power;
 		};
+	};
+
+Example: DA9062
+
+	pmic0: da9062@58 {
+		onkey {
+			compatible = "dlg,da9062-onkey";
+			dlg,disable-key-power;
+		};
+	};
+
+Example: DA9061 using a fall-back compatible for the DA9062 onkey driver
 
+	pmic0: da9061@58 {
+		onkey {
+			compatible = "dlg,da9061-onkey", "dlg,da9062-onkey";
+			dlg,disable-key-power;
+		};
 	};
Signature · 1 line
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

PATCH v2 2/10 Documentation: devicetree: watchdog: da9062/61 watchdog timer binding

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Add binding information for DA9062 and DA9061 watchdog.

Example bindings for both devices are added.

The original binding for DA9062 (only) used to reside inside the Documentation/devicetree/bindings/mfd/da9062.txt MFD document. The da9062-watchdog section was deleted in that file and replaced with a link to the new DA9061/62 binding information stored in this patch.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 07/10] to [PATCH V2 02/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Updated the patch description to be explicit about where parts of this binding had originally been stored
- A second example for DA9061 is provided to highlight the use of a fall-back compatible option for the DA9062 watchdog driver

Hi,

This patch depends on the acceptance of DA9061 watchdog driver:
[PATCH V2 08/10] watchdog: da9061: watchdog driver

This previous [PATCH V1 07/10] was acked-by: Rob Herring, however changes in the Linux device driver have meant an additional binding example is necessary to describe the use of DA9061.

The Linux device driver changes for DA9061 were rejected after conversations with the watchdog maintainers, specifically about compatibility between DA9061 and DA9062 watchdog hardware components. In the case of the watchdog the DA9062 device driver is compatible with the DA9061 and for this reason there is minimal change required to the DA9062 watchdog device driver and so the example for the DA9061 watchdog shows the use of a fall-back compatible string.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 .../devicetree/bindings/watchdog/da9062-wdt.txt     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
Documentation/devicetree/bindings/watchdog/da9062-wdt.txt new file +21 -0
new file mode 100644
index 0000000..1f8255c
@@ -0,0 +1,21 @@
+* Dialog Semiconductor DA9062/61 Watchdog Timer
+
+Required properties:
+- compatible: "dlg,da9062-watchdog"
+              "dlg,da9061-watchdog"
+
+Example: DA9062
+
+	pmic0: da9062@58 {
+		watchdog {
+			compatible = "dlg,da9062-watchdog";
+		};
+	};
+
+Example: DA9061 using a fall-back compatible for the DA9062 watchdog driver
+
+	pmic0: da9061@58 {
+		watchdog {
+			compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog";
+		};
+	};
Signature · 1 line
end-of-patch for PATCH V2
maintainer
#4 lore raw

Re: [PATCH V2 02/10] Documentation: devicetree: watchdog: da9062/61 watchdog timer binding

Quoted 57 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Add binding information for DA9062 and DA9061 watchdog.

Example bindings for both devices are added.

The original binding for DA9062 (only) used to reside inside the Documentation/devicetree/bindings/mfd/da9062.txt MFD document. The da9062-watchdog section was deleted in that file and replaced with a link to the new DA9061/62 binding information stored in this patch.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 07/10] to [PATCH V2 02/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Updated the patch description to be explicit about where parts of this binding had originally been stored
- A second example for DA9061 is provided to highlight the use of a fall-back compatible option for the DA9062 watchdog driver

Hi,

This patch depends on the acceptance of DA9061 watchdog driver:
[PATCH V2 08/10] watchdog: da9061: watchdog driver

This previous [PATCH V1 07/10] was acked-by: Rob Herring, however changes in the Linux device driver have meant an additional binding example is necessary to describe the use of DA9061.

The Linux device driver changes for DA9061 were rejected after conversations with the watchdog maintainers, specifically about compatibility between DA9061 and DA9062 watchdog hardware components. In the case of the watchdog the DA9062 device driver is compatible with the DA9061 and for this reason there is minimal change required to the DA9062 watchdog device driver and so the example for the DA9061 watchdog shows the use of a fall-back compatible string.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 .../devicetree/bindings/watchdog/da9062-wdt.txt     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
Documentation/devicetree/bindings/watchdog/da9062-wdt.txt new file +0 -0
new file mode 100644
index 0000000..1f8255c

Documentation/devicetree/bindings/watchdog/da9062-wdt.txt line 5

Quoted 5 lines
Documentation/devicetree/bindings/watchdog/da9062-wdt.txt new file +5 -0
@@ -0,0 +1,21 @@
+* Dialog Semiconductor DA9062/61 Watchdog Timer
+
+Required properties:
+- compatible: "dlg,da9062-watchdog"
+              "dlg,da9061-watchdog"

Similar comment here. List each valid combination.

Quoted 19 lines
Documentation/devicetree/bindings/watchdog/da9062-wdt.txt new file +16 -0
+
+Example: DA9062
+
+	pmic0: da9062@58 {
+		watchdog {
+			compatible = "dlg,da9062-watchdog";
+		};
+	};
+
+Example: DA9061 using a fall-back compatible for the DA9062 watchdog driver
+
+	pmic0: da9061@58 {
+		watchdog {
+			compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog";
+		};
+	};
Signature · 1 line
end-of-patch for PATCH V2
#5 lore raw

PATCH v2 3/10 Documentation: devicetree: thermal: da9062/61 TJUNC temperature binding

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Device tree binding information for DA9062 and DA9061 thermal junction temperature monitor.

Binding descriptions for the DA9061 and DA9062 thermal TJUNC supervisor device driver, using a single THERMAL_TRIP_HOT trip-wire and allowing for a configurable polling period for over-temperature polling.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 08/10] to [PATCH V2 03/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- A second example for DA9061 is provided to highlight the use of a fall-back compatible option for the DA9062 watchdog driver

Hi,

This patch depends on acceptance of the main code for the thermal device driver:
[PATCH V2 09/10] thermal: da9061: TJUNC temperature driver

The previous [PATCH V1 08/10] was acked-by: Rob Herring, however this has not been added because changes have been made to add a new binding example. This describes the use of DA9061.
This addition was made after alterations to the device driver meant that a fall-back compatible string could reuse the DA9062 device driver.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 .../devicetree/bindings/thermal/da9062-thermal.txt | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/da9062-thermal.txt
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +37 -0
new file mode 100644
index 0000000..fb207ff
@@ -0,0 +1,37 @@
+* Dialog DA9062/61 TJUNC Thermal Module
+
+This module is part of the DA9061/DA9062. For more details about entire
+DA9062 and DA9061 chips see Documentation/devicetree/bindings/mfd/da9062.txt
+
+Junction temperature thermal module uses an interrupt signal to identify
+high THERMAL_TRIP_HOT temperatures for the PMIC device.
+
+Required properties:
+
+- compatible: should be one of:
+        dlg,da9061-thermal
+        dlg,da9062-thermal
+
+Optional properties:
+
+- dlg,tjunc-temp-polling-period-ms : Specify the polling period, measured
+    in milliseconds, between thermal zone device update checks.
+
+Example: DA9061
+
+	pmic0: da9062@58 {
+		thermal {
+			compatible = "dlg,da9062-thermal";
+			dlg,tjunc-temp-polling-period-ms = <3000>;
+		};
+	};
+
+Example: DA9061 using a fall-back compatible for the DA9062 onkey driver
+
+	pmic0: da9061@58 {
+		thermal {
+			compatible = "dlg,da9061-thermal", "dlg,da9062-thermal";
+			dlg,tjunc-temp-polling-period-ms = <3000>;
+		};
+	};
+
Signature · 6 lines
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

Re: [PATCH V2 03/10] Documentation: devicetree: thermal: da9062/61 TJUNC temperature binding

Quoted 55 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Device tree binding information for DA9062 and DA9061 thermal junction temperature monitor.

Binding descriptions for the DA9061 and DA9062 thermal TJUNC supervisor device driver, using a single THERMAL_TRIP_HOT trip-wire and allowing for a configurable polling period for over-temperature polling.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 08/10] to [PATCH V2 03/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- A second example for DA9061 is provided to highlight the use of a fall-back compatible option for the DA9062 watchdog driver

Hi,

This patch depends on acceptance of the main code for the thermal device driver:
[PATCH V2 09/10] thermal: da9061: TJUNC temperature driver

The previous [PATCH V1 08/10] was acked-by: Rob Herring, however this has not been added because changes have been made to add a new binding example. This describes the use of DA9061.
This addition was made after alterations to the device driver meant that a fall-back compatible string could reuse the DA9062 device driver.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 .../devicetree/bindings/thermal/da9062-thermal.txt | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/da9062-thermal.txt
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +8 -0
new file mode 100644
index 0000000..fb207ff
@@ -0,0 +1,37 @@
+* Dialog DA9062/61 TJUNC Thermal Module
+
+This module is part of the DA9061/DA9062. For more details about entire
+DA9062 and DA9061 chips see Documentation/devicetree/bindings/mfd/da9062.txt
+
+Junction temperature thermal module uses an interrupt signal to identify
+high THERMAL_TRIP_HOT temperatures for the PMIC device.
+

Documentation/devicetree/bindings/thermal/da9062-thermal.txt line 18

Quoted 10 lines
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +10 -0
+Required properties:
+
+- compatible: should be one of:
+        dlg,da9061-thermal
+        dlg,da9062-thermal
+
+Optional properties:
+
+- dlg,tjunc-temp-polling-period-ms : Specify the polling period, measured
+    in milliseconds, between thermal zone device update checks.

Can you please elaborate on why you need this chip manufacture specific property?

Can we use the polling property of already existing in the Documentation/devicetree/bindings/thermal/thermal.txt

See the polling properties.

Documentation/devicetree/bindings/thermal/da9062-thermal.txt line 25

Quoted 7 lines
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +7 -0
+
+Example: DA9061
+
+	pmic0: da9062@58 {
+		thermal {
+			compatible = "dlg,da9062-thermal";
+			dlg,tjunc-temp-polling-period-ms = <3000>;

Same

Documentation/devicetree/bindings/thermal/da9062-thermal.txt line 34

Quoted 9 lines
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +9 -0
+		};
+	};
+
+Example: DA9061 using a fall-back compatible for the DA9062 onkey driver
+
+	pmic0: da9061@58 {
+		thermal {
+			compatible = "dlg,da9061-thermal", "dlg,da9062-thermal";
+			dlg,tjunc-temp-polling-period-ms = <3000>;

Same

Quoted 6 lines
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +3 -0
+		};
+	};
+
Signature · 1 line
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

RE: [PATCH V2 03/10] Documentation: devicetree: thermal: da9062/61 TJUNC temperature binding

Hi Eduardo,

Quoted 13 lines · Eduardo Valentin,

Documentation/devicetree/bindings/thermal/da9062-thermal.txt line 18

Quoted 4 lines · Steve Twiss
Documentation/devicetree/bindings/thermal/da9062-thermal.txt new file +4 -0
+Optional properties:
+
+- dlg,tjunc-temp-polling-period-ms : Specify the polling period, measured
+    in milliseconds, between thermal zone device update checks.

Can you please elaborate on why you need this chip manufacture specific property?

Can we use the polling property of already existing in the Documentation/devicetree/bindings/thermal/thermal.txt

See the polling properties.

[...]

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+			dlg,tjunc-temp-polling-period-ms = <3000>;

Agreed. There is a polling period built into the thermal core. I've discussed my reasoning for this decision in answer to your other e-mail. Please refer to the other discussion thread: https://lkml.org/lkml/2016/11/29/262

Regards,
Steve
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

PATCH v2 4/10 Documentation: devicetree: mfd: da9062/61 MFD binding

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Extend existing DA9062 binding information to include the DA9061 PMIC for MFD core and regulators.

Add a da9062-onkey link to the existing onkey binding file.

Add a da9062-thermal link to the new temperature monitoring binding file found in [PATCH V2 03/10].

Delete the da9062-watchdog section and replace it with a link to the new DA9061/62 binding information file added by [PATCH V2 02/10].

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 09/10] to [PATCH V2 04/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order

Hi,

This patch depends on acceptance of the main code for the DA9061 MFD:

- [PATCH V2 1/10] mfd: da9061: MFD core support

and also from the following binding file changes:

- [PATCH V2 01/10] Binding for onkey
- [PATCH V2 02/10] Binding for watchdog
- [PATCH V2 03/10] Binding for thermal

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 Documentation/devicetree/bindings/mfd/da9062.txt | 45 +++++++++++++++++-------
 1 file changed, 33 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/mfd/da9062.txt +33 -12
index 38802b5..38ba5e2 100644
@@ -1,22 +1,32 @@
 * Dialog DA9062 Power Management Integrated Circuit (PMIC)
 
-DA9062 consists of a large and varied group of sub-devices:
+The DA9062 driver is compatible with the DA9062 and DA9061 devices.
+
+Product information can be found here:
+- http://www.dialog-semiconductor.com/products/da9062
+- http://www.dialog-semiconductor.com/products/da9061
+
+DA9062 driver consists of a large and varied group of sub-devices:
 
 Device                   Supply Names    Description
 ------                   ------------    -----------
 da9062-regulator        :               : LDOs & BUCKs
 da9062-rtc              :               : Real-Time Clock
+da9062-onkey            :               : On Key
 da9062-watchdog         :               : Watchdog Timer
+da9062-thermal          :               : Thermal
 
 ======
 
 Required properties:
 
-- compatible : Should be "dlg,da9062".
+- compatible : Should be
+    "dlg,da9062" for DA9062
+    "dlg,da9061" for DA9061
 - reg : Specifies the I2C slave address (this defaults to 0x58 but it can be
   modified to match the chip's OTP settings).
 - interrupt-parent : Specifies the reference to the interrupt controller for
-  the DA9062.
+  the DA9062 or DA9061.
 - interrupts : IRQ line information.
 - interrupt-controller
 
@@ -25,8 +35,8 @@ further information on IRQ bindings.
 
 Sub-nodes:
 
-- regulators : This node defines the settings for the LDOs and BUCKs. The
-  DA9062 regulators are bound using their names listed below:
+- regulators : This node defines the settings for the LDOs and BUCKs.
+  The DA9062 regulators are bound using their names listed below:
 
     buck1    : BUCK_1
     buck2    : BUCK_2
@@ -37,6 +47,16 @@ Sub-nodes:
     ldo3     : LDO_3
     ldo4     : LDO_4
 
+  The DA9061 regulators are bound using their names listed below:
+
+    buck1    : BUCK_1
+    buck2    : BUCK_2
+    buck3    : BUCK_3
+    ldo1     : LDO_1
+    ldo2     : LDO_2
+    ldo3     : LDO_3
+    ldo4     : LDO_4
+
   The component follows the standard regulator framework and the bindings
   details of individual regulator device can be found in:
   Documentation/devicetree/bindings/regulator/regulator.txt
@@ -46,9 +66,14 @@ Sub-nodes:
   with the DA9062. There are currently no entries in this binding, however
   compatible = "dlg,da9062-rtc" should be added if a node is created.
 
-- watchdog: This node defines the settings for the watchdog driver associated
-  with the DA9062 PMIC. The compatible = "dlg,da9062-watchdog" should be added
-  if a node is created.
+
+- onkey : See ../input/da9062-onkey.txt
+
+
+- watchdog: See ../watchdog/da9062-watchdog.txt
+
+
+- thermal : See ../thermal/da9062-thermal.txt
 
 
 Example:
@@ -64,10 +89,6 @@ Example:
 			compatible = "dlg,da9062-rtc";
 		};
 
-		watchdog {
-			compatible = "dlg,da9062-watchdog";
-		};
-
 		regulators {
 			DA9062_BUCK1: buck1 {
 				regulator-name = "BUCK1";
Signature · 6 lines
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#9 lore raw

Re: [PATCH V2 04/10] Documentation: devicetree: mfd: da9062/61 MFD binding

Quoted 47 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Extend existing DA9062 binding information to include the DA9061 PMIC for MFD core and regulators.

Add a da9062-onkey link to the existing onkey binding file.

Add a da9062-thermal link to the new temperature monitoring binding file found in [PATCH V2 03/10].

Delete the da9062-watchdog section and replace it with a link to the new DA9061/62 binding information file added by [PATCH V2 02/10].

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 09/10] to [PATCH V2 04/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order

Hi,

This patch depends on acceptance of the main code for the DA9061 MFD:

- [PATCH V2 1/10] mfd: da9061: MFD core support

and also from the following binding file changes:

- [PATCH V2 01/10] Binding for onkey
- [PATCH V2 02/10] Binding for watchdog
- [PATCH V2 03/10] Binding for thermal

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 Documentation/devicetree/bindings/mfd/da9062.txt | 45 +++++++++++++++++-------
 1 file changed, 33 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/mfd/da9062.txt +0 -0
index 38802b5..38ba5e2 100644

Documentation/devicetree/bindings/mfd/da9062.txt line 3

Quoted 4 lines
Documentation/devicetree/bindings/mfd/da9062.txt +1 -1
@@ -1,22 +1,32 @@
 * Dialog DA9062 Power Management Integrated Circuit (PMIC)
 
-DA9062 consists of a large and varied group of sub-devices:
+The DA9062 driver is compatible with the DA9062 and DA9061 devices.

Describe the device, not driver.

Documentation/devicetree/bindings/mfd/da9062.txt line 9

Quoted 6 lines
Documentation/devicetree/bindings/mfd/da9062.txt +6 -0
+
+Product information can be found here:
+- http://www.dialog-semiconductor.com/products/da9062
+- http://www.dialog-semiconductor.com/products/da9061
+
+DA9062 driver consists of a large and varied group of sub-devices:

DA9062/DA9061 PMIC consists of...

Quoted 85 lines
Documentation/devicetree/bindings/mfd/da9062.txt +26 -11
 Device                   Supply Names    Description
 ------                   ------------    -----------
 da9062-regulator        :               : LDOs & BUCKs
 da9062-rtc              :               : Real-Time Clock
+da9062-onkey            :               : On Key
 da9062-watchdog         :               : Watchdog Timer
+da9062-thermal          :               : Thermal
 
 ======
 
 Required properties:
 
-- compatible : Should be "dlg,da9062".
+- compatible : Should be
+    "dlg,da9062" for DA9062
+    "dlg,da9061" for DA9061
 - reg : Specifies the I2C slave address (this defaults to 0x58 but it can be
   modified to match the chip's OTP settings).
 - interrupt-parent : Specifies the reference to the interrupt controller for
-  the DA9062.
+  the DA9062 or DA9061.
 - interrupts : IRQ line information.
 - interrupt-controller
 
@@ -25,8 +35,8 @@ further information on IRQ bindings.
 
 Sub-nodes:
 
-- regulators : This node defines the settings for the LDOs and BUCKs. The
-  DA9062 regulators are bound using their names listed below:
+- regulators : This node defines the settings for the LDOs and BUCKs.
+  The DA9062 regulators are bound using their names listed below:
 
     buck1    : BUCK_1
     buck2    : BUCK_2
@@ -37,6 +47,16 @@ Sub-nodes:
     ldo3     : LDO_3
     ldo4     : LDO_4
 
+  The DA9061 regulators are bound using their names listed below:
+
+    buck1    : BUCK_1
+    buck2    : BUCK_2
+    buck3    : BUCK_3
+    ldo1     : LDO_1
+    ldo2     : LDO_2
+    ldo3     : LDO_3
+    ldo4     : LDO_4
+
   The component follows the standard regulator framework and the bindings
   details of individual regulator device can be found in:
   Documentation/devicetree/bindings/regulator/regulator.txt
@@ -46,9 +66,14 @@ Sub-nodes:
   with the DA9062. There are currently no entries in this binding, however
   compatible = "dlg,da9062-rtc" should be added if a node is created.
 
-- watchdog: This node defines the settings for the watchdog driver associated
-  with the DA9062 PMIC. The compatible = "dlg,da9062-watchdog" should be added
-  if a node is created.
+
+- onkey : See ../input/da9062-onkey.txt
+
+
+- watchdog: See ../watchdog/da9062-watchdog.txt
+
+
+- thermal : See ../thermal/da9062-thermal.txt
 
 
 Example:
@@ -64,10 +89,6 @@ Example:
 			compatible = "dlg,da9062-rtc";
 		};
 
-		watchdog {
-			compatible = "dlg,da9062-watchdog";
-		};
-
 		regulators {
 			DA9062_BUCK1: buck1 {
 				regulator-name = "BUCK1";
Signature · 1 line
end-of-patch for PATCH V2
#10 lore raw

PATCH v2 5/10 mfd: da9061: MFD core support

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

MFD support for DA9061 is provided as part of the DA9062 device driver.

The registers header file adds two new chip variant IDs defined in DA9061 and DA9062 hardware. The core header file adds new software enumerations for listing the valid DA9061 IRQs and a da9062_compatible_types enumeration for distinguishing between DA9061/62 devices in software.

The core source code adds a new .compatible of_device_id entry. This is extended from DA9062 to support both "dlg,da9061" and "dlg,da9062". The .data entry now holds a reference to the enumerated device type.

A new regmap_irq_chip model is added for DA9061 and this supports the new list of regmap_irq entries. A new mfd_cell da9061_devs[] array lists the new sub system components for DA9061. Support is added for a new DA9061 regmap_config which lists the correct readable, writable and volatile ranges for this chip.

The probe function uses the device tree compatible string to switch on the da9062_compatible_types and configure the correct mfd cells, irq chip and regmap config.

Kconfig is updated to reflect support for DA9061 and DA9062 PMICs.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 01/10] to [PATCH V2 05/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Fixed typo in the commit message "readble" to "readable"
- Removed the explicit cross-check to decide if there is a conflict between the device tree compatible string and the hardware definition. This patch assumes the device tree is correctly written and therefore removes the need for a hardware/DT sanity check.
- Removed extra semicolon in drivers/mfd/da9062-core.c:877
- Re-write compatible entries into numerical order

Lee,

This patch adds support for the DA9061 PMIC. This is done as part of the existing DA9062 device driver by extending the of_device_id match table. This in turn allows new MFD cells, irq chip and regmap definitions to support DA9061.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/mfd/Kconfig                  |   5 +-
 drivers/mfd/da9062-core.c            | 427 +++++++++++++++++++++++++++++++++--
 include/linux/mfd/da9062/core.h      |  27 ++-
 include/linux/mfd/da9062/registers.h |   2 +
 4 files changed, 441 insertions(+), 20 deletions(-)
drivers/mfd/Kconfig +3 -2
index 2d1fb64..533798a 100644
@@ -236,13 +236,14 @@ config MFD_DA9055
 	  called "da9055"
 
 config MFD_DA9062
-	tristate "Dialog Semiconductor DA9062 PMIC Support"
+	tristate "Dialog Semiconductor DA9062/61 PMIC Support"
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	depends on I2C
 	help
-	  Say yes here for support for the Dialog Semiconductor DA9062 PMIC.
+	  Say yes here for support for the Dialog Semiconductor DA9061 and
+	  DA9062 PMICs.
 	  This includes the I2C driver and core APIs.
 	  Additional drivers must be enabled in order to use the functionality
 	  of the device.
drivers/mfd/da9062-core.c +410 -17

524 lines not on this page · raw message

include/linux/mfd/da9062/core.h +26 -1
index 376ba84..199c524 100644
@@ -18,7 +18,31 @@
 #include <linux/interrupt.h>
 #include <linux/mfd/da9062/registers.h>
 
-/* Interrupts */
+enum da9062_compatible_types {
+	COMPAT_TYPE_DA9061 = 1,
+	COMPAT_TYPE_DA9062,
+};
+
+enum da9061_irqs {
+	/* IRQ A */
+	DA9061_IRQ_ONKEY,
+	DA9061_IRQ_WDG_WARN,
+	DA9061_IRQ_SEQ_RDY,
+	/* IRQ B*/
+	DA9061_IRQ_TEMP,
+	DA9061_IRQ_LDO_LIM,
+	DA9061_IRQ_DVC_RDY,
+	DA9061_IRQ_VDD_WARN,
+	/* IRQ C */
+	DA9061_IRQ_GPI0,
+	DA9061_IRQ_GPI1,
+	DA9061_IRQ_GPI2,
+	DA9061_IRQ_GPI3,
+	DA9061_IRQ_GPI4,
+
+	DA9061_NUM_IRQ,
+};
+
 enum da9062_irqs {
 	/* IRQ A */
 	DA9062_IRQ_ONKEY,
@@ -45,6 +69,7 @@ struct da9062 {
 	struct device *dev;
 	struct regmap *regmap;
 	struct regmap_irq_chip_data *regmap_irq;
+	enum da9062_compatible_types chip_type;
 };
 
 #endif /* __MFD_DA9062_CORE_H__ */
include/linux/mfd/da9062/registers.h +2 -0
index 97790d1..4457fdc 100644
@@ -18,6 +18,8 @@
 
 #define DA9062_PMIC_DEVICE_ID		0x62
 #define DA9062_PMIC_VARIANT_MRC_AA	0x01
+#define DA9062_PMIC_VARIANT_VRC_DA9061	0x01
+#define DA9062_PMIC_VARIANT_VRC_DA9062	0x02
 
 #define DA9062_I2C_PAGE_SEL_SHIFT	1
 
Signature · 1 line
end-of-patch for PATCH V2
#11 lore raw

Re: [PATCH V2 05/10] mfd: da9061: MFD core support

Quoted 58 lines · Steve Twiss

From: Steve Twiss <[email protected]>

MFD support for DA9061 is provided as part of the DA9062 device driver.

The registers header file adds two new chip variant IDs defined in DA9061 and DA9062 hardware. The core header file adds new software enumerations for listing the valid DA9061 IRQs and a da9062_compatible_types enumeration for distinguishing between DA9061/62 devices in software.

The core source code adds a new .compatible of_device_id entry. This is extended from DA9062 to support both "dlg,da9061" and "dlg,da9062". The .data entry now holds a reference to the enumerated device type.

A new regmap_irq_chip model is added for DA9061 and this supports the new list of regmap_irq entries. A new mfd_cell da9061_devs[] array lists the new sub system components for DA9061. Support is added for a new DA9061 regmap_config which lists the correct readable, writable and volatile ranges for this chip.

The probe function uses the device tree compatible string to switch on the da9062_compatible_types and configure the correct mfd cells, irq chip and regmap config.

Kconfig is updated to reflect support for DA9061 and DA9062 PMICs.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 01/10] to [PATCH V2 05/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Fixed typo in the commit message "readble" to "readable"
- Removed the explicit cross-check to decide if there is a conflict between the device tree compatible string and the hardware definition. This patch assumes the device tree is correctly written and therefore removes the need for a hardware/DT sanity check.
- Removed extra semicolon in drivers/mfd/da9062-core.c:877
- Re-write compatible entries into numerical order

Lee,

This patch adds support for the DA9061 PMIC. This is done as part of the existing DA9062 device driver by extending the of_device_id match table. This in turn allows new MFD cells, irq chip and regmap definitions to support DA9061.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/mfd/Kconfig                  |   5 +-
 drivers/mfd/da9062-core.c            | 427 +++++++++++++++++++++++++++++++++--
 include/linux/mfd/da9062/core.h      |  27 ++-
 include/linux/mfd/da9062/registers.h |   2 +
 4 files changed, 441 insertions(+), 20 deletions(-)

[...]

Quoted 9 lines
drivers/mfd/da9062-core.c +9 -0
+static struct resource da9061_core_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_regulators_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_LDO_LIM, 1, "LDO_LIM", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_thermal_resources[] = {

drivers/mfd/da9062-core.c static struct regmap_irq_chip da9062_irq_chip = { · line 187

Quoted 10 lines
drivers/mfd/da9062-core.c +10 -0
+	DEFINE_RES_NAMED(DA9061_IRQ_TEMP, 1, "THERMAL", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_wdt_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_onkey_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_ONKEY, 1, "ONKEY", IORESOURCE_IRQ),
+};

These should al be: DEFINE_RES_IO_NAMED()

[...]

drivers/mfd/da9062-core.c static const struct mfd_cell da9062_devs[] = { · line 260

Quoted 7 lines

};

drivers/mfd/da9062-core.c +1 -1
@@ -142,7 +257,7 @@ static const struct mfd_cell da9062_devs[] = {
 		.name		= "da9062-watchdog",
 		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
 		.resources	= da9062_wdt_resources,
-		.of_compatible  = "dlg,da9062-wdt",
+		.of_compatible  = "dlg,da9062-watchdog",

This should be a separate change.

Quoted 14 lines
drivers/mfd/da9062-core.c +2 -1
 	},
 	{
 		.name		= "da9062-thermal",
@@ -200,7 +315,8 @@ static int da9062_clear_fault_log(struct da9062 *chip)
 
 static int da9062_get_device_type(struct da9062 *chip)
 {
-	int device_id, variant_id, variant_mrc;
+	int device_id, variant_id, variant_mrc, variant_vrc;
+	char *type;
 	int ret;
 
 	ret = regmap_read(chip->regmap, DA9062AA_DEVICE_ID, &device_id);

drivers/mfd/da9062-core.c static int da9062_get_device_type(struct da9062 *chip) · line 327

Quoted 4 lines
drivers/mfd/da9062-core.c +1 -0
@@ -208,6 +324,7 @@ static int da9062_get_device_type(struct da9062 *chip)
 		dev_err(chip->dev, "Cannot read chip ID.\n");
 		return -EIO;
 	}
+

Sneaky!

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#12 lore raw

RE: [PATCH V2 05/10] mfd: da9061: MFD core support

Quoted 14 lines · Lee Jones
Quoted 14 lines
drivers/mfd/da9062-core.c +13 -0
+static struct resource da9061_core_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_regulators_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_LDO_LIM, 1, "LDO_LIM", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_thermal_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_TEMP, 1, "THERMAL", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_wdt_resources[] = {
Quoted 8 lines

drivers/mfd/da9062-core.c static struct regmap_irq_chip da9062_irq_chip = { · line 187

Quoted 6 lines
drivers/mfd/da9062-core.c +6 -0
+	DEFINE_RES_NAMED(DA9061_IRQ_WDG_WARN, 1, "WD_WARN", IORESOURCE_IRQ),
+};
+
+static struct resource da9061_onkey_resources[] = {
+	DEFINE_RES_NAMED(DA9061_IRQ_ONKEY, 1, "ONKEY", IORESOURCE_IRQ),
+};

These should al be: DEFINE_RES_IO_NAMED()

Have altered these to DEFINE_RES_IRQ_NAMED()

Quoted 8 lines

drivers/mfd/da9062-core.c static const struct mfd_cell da9062_devs[] = { · line 260

Quoted 6 lines
drivers/mfd/da9062-core.c +1 -1
@@ -142,7 +257,7 @@ static const struct mfd_cell da9062_devs[] = {
 		.name		= "da9062-watchdog",
 		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
 		.resources	= da9062_wdt_resources,
-		.of_compatible  = "dlg,da9062-wdt",
+		.of_compatible  = "dlg,da9062-watchdog",

This should be a separate change.

Ok. reverted.

Quoted 7 lines

drivers/mfd/da9062-core.c static int da9062_get_device_type(struct da9062 *chip) · line 327

Quoted 5 lines
drivers/mfd/da9062-core.c +1 -0
@@ -208,6 +324,7 @@ static int da9062_get_device_type(struct da9062 *chip)
 		dev_err(chip->dev, "Cannot read chip ID.\n");
 		return -EIO;
 	}
+

Sneaky!

Removed the whitespace.

#13 lore raw

PATCH v2 6/10 regulator: da9061: BUCK and LDO regulator driver

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Regulator support for the DA9061 is added into the DA9062 regulator driver.

The regulators for DA9061 differ from those of DA9062.
A new DA9061 enumeration list for the LDOs and Bucks supported by this device is added. Regulator information added: the old regulator information for DA9062 is renamed from local_regulator_info[] to local_da9062_regulator_info[] and a new array is added to support local_da9061_regulator_info[].

The probe() function switches on the da9062_compatible_types enumeration and configures the correct da9062_regulator_info array and number of regulator entries.

Kconfig is updated to reflect support for DA9061 and DA9062 regulators.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 02/10] to [PATCH V2 06/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Updated header to use DA9061 and DA9062

Mark,

These changes depend on a header file provided as part of an earlier patch [PATCH V2 05/10] from this set. The regulator probe() switches on the chip_type which uses enum da9062_compatible_types in core.h from this patch.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/regulator/Kconfig            |   4 +-
 drivers/regulator/da9062-regulator.c | 301 +++++++++++++++++++++++++++++++++--
 2 files changed, 292 insertions(+), 13 deletions(-)
drivers/regulator/Kconfig +2 -2
index 6c88e31..c4f678fe 100644
@@ -188,11 +188,11 @@ config REGULATOR_DA9055
 	  will be called da9055-regulator.
 
 config REGULATOR_DA9062
-	tristate "Dialog Semiconductor DA9062 regulators"
+	tristate "Dialog Semiconductor DA9061/62 regulators"
 	depends on MFD_DA9062
 	help
 	  Say y here to support the BUCKs and LDOs regulators found on
-	  DA9062 PMICs.
+	  DA9061 and DA9062 PMICs.
 
 	  This driver can also be built as a module. If so, the module
 	  will be called da9062-regulator.
drivers/regulator/da9062-regulator.c +290 -11

354 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V2
maintainer Acked-by on v2 6/10
#14 lore raw

Re: [PATCH V2 06/10] regulator: da9061: BUCK and LDO regulator driver

Quoted 10 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Regulator support for the DA9061 is added into the DA9062 regulator driver.

The regulators for DA9061 differ from those of DA9062.
A new DA9061 enumeration list for the LDOs and Bucks supported by this device is added. Regulator information added: the old regulator information for DA9062 is renamed from local_regulator_info[] to local_da9062_regulator_info[] and a new array is added to support local_da9061_regulator_info[].

#15 lore raw

PATCH v2 7/10 Input: da9061: onkey driver

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Copyright header is updated to add DA9061 in its description and the module description macro is extended to include DA9061.

Minor change to the code, alters dev_dbg() statements to report a generic "PMIC" instead of DA9063. This device driver is compatible with DA9061, DA9062 and DA9063.

Kconfig is updated to reflect support for DA9061/62/63.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 03/10] to [PATCH V2 07/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Revert changes for DA9061 specific compatible changes.

Dmitry,

Alterations made in accordance with previous e-mail thread on the use of compatible strings: https://lkml.org/lkml/2016/10/7/641
Now assuming the use of a fallback compatible string in the DT. compatible = "dlg,da9061-onkey", "dlg,da9062-onkey";

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/input/misc/Kconfig        | 7 ++++---
 drivers/input/misc/da9063_onkey.c | 8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/input/misc/Kconfig +4 -3
index efb0ca8..57cc9c2 100644
@@ -613,11 +613,12 @@ config INPUT_DA9055_ONKEY
 	  will be called da9055_onkey.
 
 config INPUT_DA9063_ONKEY
-	tristate "Dialog DA9062/63 OnKey"
+	tristate "Dialog DA9063/62/61 OnKey"
 	depends on MFD_DA9063 || MFD_DA9062
 	help
-	  Support the ONKEY of Dialog DA9063 and DA9062 Power Management ICs
-	  as an input device capable of reporting the power button status.
+	  Support the ONKEY of Dialog DA9063, DA9062 and DA9061 Power
+	  Management ICs as an input device capable of reporting the
+	  power button status.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called da9063_onkey.
drivers/input/misc/da9063_onkey.c +4 -4
index bb863e0..dff6fe5 100644
@@ -1,5 +1,5 @@
 /*
- * OnKey device driver for DA9063 and DA9062 PMICs
+ * OnKey device driver for DA9063, DA9062 and DA9061 PMICs
  * Copyright (C) 2015  Dialog Semiconductor Ltd.
  *
  * This program is free software; you can redistribute it and/or
@@ -149,13 +149,13 @@ static void da9063_poll_on(struct work_struct *work)
 			 * and then send shutdown command
 			 */
 			dev_dbg(&onkey->input->dev,
-				"Sending SHUTDOWN to DA9063 ...\n");
+				"Sending SHUTDOWN to PMIC ...\n");
 			error = regmap_write(onkey->regmap,
 					     config->onkey_shutdown,
 					     config->onkey_shutdown_mask);
 			if (error)
 				dev_err(&onkey->input->dev,
-					"Cannot SHUTDOWN DA9063: %d\n",
+					"Cannot SHUTDOWN PMIC: %d\n",
 					error);
 		}
 	}
@@ -300,6 +300,6 @@ static struct platform_driver da9063_onkey_driver = {
 module_platform_driver(da9063_onkey_driver);
 
 MODULE_AUTHOR("S Twiss <[email protected]>");
-MODULE_DESCRIPTION("Onkey device driver for Dialog DA9063 and DA9062");
+MODULE_DESCRIPTION("Onkey device driver for Dialog DA9063, DA9062 and DA9061");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" DA9063_DRVNAME_ONKEY);
Signature · 6 lines
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Applied
#16 lore raw

Re: [PATCH V2 07/10] Input: da9061: onkey driver

Quoted 5 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Copyright header is updated to add DA9061 in its description and the module description macro is extended to include DA9061.

Quoted 7 lines

Minor change to the code, alters dev_dbg() statements to report a generic "PMIC" instead of DA9063. This device driver is compatible with DA9061, DA9062 and DA9063.

Kconfig is updated to reflect support for DA9061/62/63.

Applied, thank you.

Quoted 83 lines

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 03/10] to [PATCH V2 07/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Revert changes for DA9061 specific compatible changes.

Dmitry,

Alterations made in accordance with previous e-mail thread on the use of compatible strings: https://lkml.org/lkml/2016/10/7/641
Now assuming the use of a fallback compatible string in the DT. compatible = "dlg,da9061-onkey", "dlg,da9062-onkey";

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/input/misc/Kconfig        | 7 ++++---
 drivers/input/misc/da9063_onkey.c | 8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/input/misc/Kconfig +4 -3
index efb0ca8..57cc9c2 100644
@@ -613,11 +613,12 @@ config INPUT_DA9055_ONKEY
 	  will be called da9055_onkey.
 
 config INPUT_DA9063_ONKEY
-	tristate "Dialog DA9062/63 OnKey"
+	tristate "Dialog DA9063/62/61 OnKey"
 	depends on MFD_DA9063 || MFD_DA9062
 	help
-	  Support the ONKEY of Dialog DA9063 and DA9062 Power Management ICs
-	  as an input device capable of reporting the power button status.
+	  Support the ONKEY of Dialog DA9063, DA9062 and DA9061 Power
+	  Management ICs as an input device capable of reporting the
+	  power button status.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called da9063_onkey.
drivers/input/misc/da9063_onkey.c +4 -4
index bb863e0..dff6fe5 100644
@@ -1,5 +1,5 @@
 /*
- * OnKey device driver for DA9063 and DA9062 PMICs
+ * OnKey device driver for DA9063, DA9062 and DA9061 PMICs
  * Copyright (C) 2015  Dialog Semiconductor Ltd.
  *
  * This program is free software; you can redistribute it and/or
@@ -149,13 +149,13 @@ static void da9063_poll_on(struct work_struct *work)
 			 * and then send shutdown command
 			 */
 			dev_dbg(&onkey->input->dev,
-				"Sending SHUTDOWN to DA9063 ...\n");
+				"Sending SHUTDOWN to PMIC ...\n");
 			error = regmap_write(onkey->regmap,
 					     config->onkey_shutdown,
 					     config->onkey_shutdown_mask);
 			if (error)
 				dev_err(&onkey->input->dev,
-					"Cannot SHUTDOWN DA9063: %d\n",
+					"Cannot SHUTDOWN PMIC: %d\n",
 					error);
 		}
 	}
@@ -300,6 +300,6 @@ static struct platform_driver da9063_onkey_driver = {
 module_platform_driver(da9063_onkey_driver);
 
 MODULE_AUTHOR("S Twiss <[email protected]>");
-MODULE_DESCRIPTION("Onkey device driver for Dialog DA9063 and DA9062");
+MODULE_DESCRIPTION("Onkey device driver for Dialog DA9063, DA9062 and DA9061");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" DA9063_DRVNAME_ONKEY);
Signature · 1 line
end-of-patch for PATCH V2
Signature · 1 line
Dmitry
#17 lore raw

PATCH v2 8/10 watchdog: da9062/61: watchdog driver

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

The of_device_id match array is added to support "dlg,da9062-watchdog" as a valid .compatible string.

The watchdog_info structure is linked to this device tree compatible string in the .data section. Extra code is added into the probe function to search-for and assign this match data.

This patch now assumes the use of a DA9062 fallback compatible string for the DTS to pick up the DA9062 device driver for use with the DA9061 watchdog hardware.

Copyright header is updated to add DA9061 in its description and the module description macro is extended to include DA9061.

Kconfig is updated to reflect support for DA9061/62.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 04/10] to [PATCH V2 08/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Removal of the DA9061 compatible entries for this device driver.
- Additional explanation in the patch description for the use of a fall-back compatible DTS string

Guenter,

Alterations have been made in accordance with the previous e-mail thread on the use of compatible strings: https://lkml.org/lkml/2016/10/7/641
This patch now assumes the use of a fallback compatible string in the DTS. Of the form: compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog";

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/watchdog/Kconfig      |  4 ++--
 drivers/watchdog/da9062_wdt.c | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/watchdog/Kconfig +2 -2
index 1bffe00..d6b4088 100644
@@ -104,11 +104,11 @@ config DA9063_WATCHDOG
 	  This driver can be built as a module. The module name is da9063_wdt.
 
 config DA9062_WATCHDOG
-	tristate "Dialog DA9062 Watchdog"
+	tristate "Dialog DA9062/61 Watchdog"
 	depends on MFD_DA9062
 	select WATCHDOG_CORE
 	help
-	  Support for the watchdog in the DA9062 PMIC.
+	  Support for the watchdog in the DA9062 and DA9061 PMICs.
 
 	  This driver can be built as a module. The module name is da9062_wdt.
 
drivers/watchdog/da9062_wdt.c +15 -3
index 7386111..4b20b7a 100644
@@ -1,5 +1,5 @@
 /*
- * da9062_wdt.c - WDT device driver for DA9062
+ * Watchdog device driver for DA9062 and DA9061 PMICs
  * Copyright (C) 2015  Dialog Semiconductor Ltd.
  *
  * This program is free software; you can redistribute it and/or
@@ -188,23 +188,34 @@ static const struct watchdog_ops da9062_watchdog_ops = {
 	.set_timeout = da9062_wdt_set_timeout,
 };
 
+static const struct of_device_id da9062_compatible_id_table[] = {
+	{ .compatible = "dlg,da9062-watchdog", .data = &da9062_watchdog_info },
+	{ },
+};
+
 static int da9062_wdt_probe(struct platform_device *pdev)
 {
 	int ret;
 	struct da9062 *chip;
 	struct da9062_watchdog *wdt;
+	const struct of_device_id *match;
 
 	chip = dev_get_drvdata(pdev->dev.parent);
 	if (!chip)
 		return -EINVAL;
 
+	match = of_match_node(da9062_compatible_id_table,
+			      pdev->dev.of_node);
+	if (!match)
+		return -ENXIO;
+
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
 	if (!wdt)
 		return -ENOMEM;
 
 	wdt->hw = chip;
 
-	wdt->wdtdev.info = &da9062_watchdog_info;
+	wdt->wdtdev.info = (const struct watchdog_info *)match->data;
 	wdt->wdtdev.ops = &da9062_watchdog_ops;
 	wdt->wdtdev.min_timeout = DA9062_WDT_MIN_TIMEOUT;
 	wdt->wdtdev.max_timeout = DA9062_WDT_MAX_TIMEOUT;
@@ -244,11 +255,12 @@ static struct platform_driver da9062_wdt_driver = {
 	.remove = da9062_wdt_remove,
 	.driver = {
 		.name = "da9062-watchdog",
+		.of_match_table = da9062_compatible_id_table,
 	},
 };
 module_platform_driver(da9062_wdt_driver);
 
 MODULE_AUTHOR("S Twiss <[email protected]>");
-MODULE_DESCRIPTION("WDT device driver for Dialog DA9062");
+MODULE_DESCRIPTION("WDT device driver for Dialog DA9062 and DA9061");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:da9062-watchdog");
Signature · 6 lines
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#18 lore raw

Re: [PATCH V2 08/10] watchdog: da9062/61: watchdog driver

Quoted 98 lines · Steve Twiss

From: Steve Twiss <[email protected]>

The of_device_id match array is added to support "dlg,da9062-watchdog" as a valid .compatible string.

The watchdog_info structure is linked to this device tree compatible string in the .data section. Extra code is added into the probe function to search-for and assign this match data.

This patch now assumes the use of a DA9062 fallback compatible string for the DTS to pick up the DA9062 device driver for use with the DA9061 watchdog hardware.

Copyright header is updated to add DA9061 in its description and the module description macro is extended to include DA9061.

Kconfig is updated to reflect support for DA9061/62.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 04/10] to [PATCH V2 08/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- Removal of the DA9061 compatible entries for this device driver.
- Additional explanation in the patch description for the use of a fall-back compatible DTS string

Guenter,

Alterations have been made in accordance with the previous e-mail thread on the use of compatible strings: https://lkml.org/lkml/2016/10/7/641
This patch now assumes the use of a fallback compatible string in the DTS. Of the form: compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog";

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/watchdog/Kconfig      |  4 ++--
 drivers/watchdog/da9062_wdt.c | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/watchdog/Kconfig +2 -2
index 1bffe00..d6b4088 100644
@@ -104,11 +104,11 @@ config DA9063_WATCHDOG
 	  This driver can be built as a module. The module name is da9063_wdt.
 
 config DA9062_WATCHDOG
-	tristate "Dialog DA9062 Watchdog"
+	tristate "Dialog DA9062/61 Watchdog"
 	depends on MFD_DA9062
 	select WATCHDOG_CORE
 	help
-	  Support for the watchdog in the DA9062 PMIC.
+	  Support for the watchdog in the DA9062 and DA9061 PMICs.
 
 	  This driver can be built as a module. The module name is da9062_wdt.
 
drivers/watchdog/da9062_wdt.c +10 -1
index 7386111..4b20b7a 100644
@@ -1,5 +1,5 @@
 /*
- * da9062_wdt.c - WDT device driver for DA9062
+ * Watchdog device driver for DA9062 and DA9061 PMICs
  * Copyright (C) 2015  Dialog Semiconductor Ltd.
  *
  * This program is free software; you can redistribute it and/or
@@ -188,23 +188,34 @@ static const struct watchdog_ops da9062_watchdog_ops = {
 	.set_timeout = da9062_wdt_set_timeout,
 };
 
+static const struct of_device_id da9062_compatible_id_table[] = {
+	{ .compatible = "dlg,da9062-watchdog", .data = &da9062_watchdog_info },
+	{ },
+};
+
 static int da9062_wdt_probe(struct platform_device *pdev)
 {
 	int ret;
 	struct da9062 *chip;
 	struct da9062_watchdog *wdt;
+	const struct of_device_id *match;
 
 	chip = dev_get_drvdata(pdev->dev.parent);
 	if (!chip)
 		return -EINVAL;
 
+	match = of_match_node(da9062_compatible_id_table,
+			      pdev->dev.of_node);
+	if (!match)

drivers/watchdog/da9062_wdt.c static const struct watchdog_ops da9062_watchdog_ops = { · line 218

Quoted 10 lines
drivers/watchdog/da9062_wdt.c +3 -1
+		return -ENXIO;
+
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
 	if (!wdt)
 		return -ENOMEM;
 
 	wdt->hw = chip;
 
-	wdt->wdtdev.info = &da9062_watchdog_info;
+	wdt->wdtdev.info = (const struct watchdog_info *)match->data;

I don't see why you would need match->data or of_match_node above.

Guenter

Quoted 20 lines
drivers/watchdog/da9062_wdt.c +2 -1
 	wdt->wdtdev.ops = &da9062_watchdog_ops;
 	wdt->wdtdev.min_timeout = DA9062_WDT_MIN_TIMEOUT;
 	wdt->wdtdev.max_timeout = DA9062_WDT_MAX_TIMEOUT;
@@ -244,11 +255,12 @@ static struct platform_driver da9062_wdt_driver = {
 	.remove = da9062_wdt_remove,
 	.driver = {
 		.name = "da9062-watchdog",
+		.of_match_table = da9062_compatible_id_table,
 	},
 };
 module_platform_driver(da9062_wdt_driver);
 
 MODULE_AUTHOR("S Twiss <[email protected]>");
-MODULE_DESCRIPTION("WDT device driver for Dialog DA9062");
+MODULE_DESCRIPTION("WDT device driver for Dialog DA9062 and DA9061");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:da9062-watchdog");
Signature · 1 line
end-of-patch for PATCH V2
#19 lore raw

RE: [PATCH V2 08/10] watchdog: da9062/61: watchdog driver

Quoted 28 lines · On 26 October 2016 19:59 Guenter Roeck wrote:
Quoted 27 lines · Steve Twiss

From: Steve Twiss <[email protected]>

drivers/watchdog/da9062_wdt.c +11 -0
+static const struct of_device_id da9062_compatible_id_table[] = {
+	{ .compatible = "dlg,da9062-watchdog", .data = &da9062_watchdog_info },
+	{ },
+};
+
 static int da9062_wdt_probe(struct platform_device *pdev)
 {
 	int ret;
 	struct da9062 *chip;
 	struct da9062_watchdog *wdt;
+	const struct of_device_id *match;
 
 	chip = dev_get_drvdata(pdev->dev.parent);
 	if (!chip)
 		return -EINVAL;
 
+	match = of_match_node(da9062_compatible_id_table,
+			      pdev->dev.of_node);
+	if (!match)
+		return -ENXIO;
+
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
 	if (!wdt)
 		return -ENOMEM;
Quoted 6 lines

drivers/watchdog/da9062_wdt.c static const struct watchdog_ops da9062_watchdog_ops = { · line 218

Quoted 4 lines
drivers/watchdog/da9062_wdt.c +1 -1
 	wdt->hw = chip;
 
-	wdt->wdtdev.info = &da9062_watchdog_info;
+	wdt->wdtdev.info = (const struct watchdog_info *)match->data;

I don't see why you would need match->data or of_match_node above.

Hi Guenter,

True. I do not need to do any matching on the table any more if the assumption is to use a fall-back compatible string for DA9061 devices (to use the da9062 device driver).

I can erase most of that content. Including the .data = &da9062_watchdog_info.

Regards,
Steve

#20 lore raw

PATCH v2 9/10 thermal: da9062/61: Thermal junction temperature monitoring driver

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Add junction temperature monitoring supervisor device driver, compatible with the DA9062 and DA9061 PMICs.

If the PMIC's internal junction temperature rises above TEMP_WARN (125 degC) an interrupt is issued. This TEMP_WARN level is defined as the THERMAL_TRIP_HOT trip-wire inside the device driver.

The thermal triggering mechanism is interrupt based and happens when the temperature rises above a given threshold level. The component cannot return an exact temperature, it only has knowledge if the temperature is above or below a given threshold value. A status bit must be polled to detect when the temperature falls below that threshold level again. A kernel work queue is configured to repeatedly poll and detect when the temperature falls below this trip-wire, between 1 and 10 second intervals (defaulting at 3 seconds).

This first level of temperature supervision is intended for non-invasive temperature control, where the necessary measures for cooling the system down are left to the host software.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 05/10] to [PATCH V2 09/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- List the header files in alphabetical order
- Remove "GPL v2" and replace with MODULE_LICENSE("GPL") to match the copyright "GNU Public License v2 or later" option in the header comment for this file. See the allowed identifiers in the file include/linux/module.h +170
- Remove notify function "da9062_thermal_notify" function.
- MODULE_AUTHOR() macros removes Company Name and just gives Name in accordance with include/linux/module.h +200
- Remove the compatible "dlg,da9061-thermal" option in the of_device_id struct table. This patch now assumes the use of a DA9062 fallback compatible string in the DTS when using the DA9061 thermal component of the DA9061 device.
- Re-ordered some assignments earlier in the probe() for thermal->hw, thermal->polling_period, thermal->mode, thermal->dev
- Added further information in the patch description to explain the use of the device driver's built-in work-queue.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/thermal/Kconfig          |  10 ++
 drivers/thermal/Makefile         |   1 +
 drivers/thermal/da9062-thermal.c | 289 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 300 insertions(+)
 create mode 100644 drivers/thermal/da9062-thermal.c
drivers/thermal/Kconfig +10 -0
index 2d702ca..da58e54 100644
@@ -272,6 +272,16 @@ config DB8500_CPUFREQ_COOLING
 	  bound cpufreq cooling device turns active to set CPU frequency low to
 	  cool down the CPU.
 
+config DA9062_THERMAL
+	tristate "DA9062/DA9061 Dialog Semiconductor thermal driver"
+	depends on MFD_DA9062
+	depends on OF
+	help
+	  Enable this for the Dialog Semiconductor thermal sensor driver.
+	  This will report PMIC junction over-temperature for one thermal trip
+	  zone.
+	  Compatible with the DA9062 and DA9061 PMICs.
+
 config INTEL_POWERCLAMP
 	tristate "Intel PowerClamp idle injection driver"
 	depends on THERMAL
drivers/thermal/Makefile +1 -0
index 10b07c1..0a2b3f2 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_ARMADA_THERMAL)	+= armada_thermal.o
 obj-$(CONFIG_TANGO_THERMAL)	+= tango_thermal.o
 obj-$(CONFIG_IMX_THERMAL)	+= imx_thermal.o
 obj-$(CONFIG_DB8500_CPUFREQ_COOLING)	+= db8500_cpufreq_cooling.o
+obj-$(CONFIG_DA9062_THERMAL)	+= da9062-thermal.o
 obj-$(CONFIG_INTEL_POWERCLAMP)	+= intel_powerclamp.o
 obj-$(CONFIG_X86_PKG_TEMP_THERMAL)	+= x86_pkg_temp_thermal.o
 obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE)	+= intel_soc_dts_iosf.o
drivers/thermal/da9062-thermal.c new file +289 -0

289 lines not on this page · raw message

Signature · 6 lines
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#21 lore raw

Re: [PATCH V2 09/10] thermal: da9062/61: Thermal junction temperature monitoring driver

Hello Steve,

Quoted 65 lines · Steve Twiss

From: Steve Twiss <[email protected]>

Add junction temperature monitoring supervisor device driver, compatible with the DA9062 and DA9061 PMICs.

If the PMIC's internal junction temperature rises above TEMP_WARN (125 degC) an interrupt is issued. This TEMP_WARN level is defined as the THERMAL_TRIP_HOT trip-wire inside the device driver.

The thermal triggering mechanism is interrupt based and happens when the temperature rises above a given threshold level. The component cannot return an exact temperature, it only has knowledge if the temperature is above or below a given threshold value. A status bit must be polled to detect when the temperature falls below that threshold level again. A kernel work queue is configured to repeatedly poll and detect when the temperature falls below this trip-wire, between 1 and 10 second intervals (defaulting at 3 seconds).

This first level of temperature supervision is intended for non-invasive temperature control, where the necessary measures for cooling the system down are left to the host software.

---
This patch applies against linux-next and v4.8

v1 -> v2
- Patch renamed from [PATCH V1 05/10] to [PATCH V2 09/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order
- List the header files in alphabetical order
- Remove "GPL v2" and replace with MODULE_LICENSE("GPL") to match the copyright "GNU Public License v2 or later" option in the header comment for this file. See the allowed identifiers in the file include/linux/module.h +170
- Remove notify function "da9062_thermal_notify" function.
- MODULE_AUTHOR() macros removes Company Name and just gives Name in accordance with include/linux/module.h +200
- Remove the compatible "dlg,da9061-thermal" option in the of_device_id struct table. This patch now assumes the use of a DA9062 fallback compatible string in the DTS when using the DA9061 thermal component of the DA9061 device.
- Re-ordered some assignments earlier in the probe() for thermal->hw, thermal->polling_period, thermal->mode, thermal->dev
- Added further information in the patch description to explain the use of the device driver's built-in work-queue.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 drivers/thermal/Kconfig          |  10 ++
 drivers/thermal/Makefile         |   1 +
 drivers/thermal/da9062-thermal.c | 289 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 300 insertions(+)
 create mode 100644 drivers/thermal/da9062-thermal.c
drivers/thermal/Kconfig +0 -0
index 2d702ca..da58e54 100644
@@ -272,6 +272,16 @@ config DB8500_CPUFREQ_COOLING
 	  bound cpufreq cooling device turns active to set CPU frequency low to
 	  cool down the CPU.

drivers/thermal/Kconfig config DB8500_CPUFREQ_COOLING · line 283

Quoted 10 lines
drivers/thermal/Kconfig +9 -0
 
+config DA9062_THERMAL
+	tristate "DA9062/DA9061 Dialog Semiconductor thermal driver"
+	depends on MFD_DA9062
+	depends on OF
+	help
+	  Enable this for the Dialog Semiconductor thermal sensor driver.
+	  This will report PMIC junction over-temperature for one thermal trip
+	  zone.
+	  Compatible with the DA9062 and DA9061 PMICs.

Is there any hardware documentation available for this chip that can be pointed out?

Quoted 95 lines
drivers/thermal/Kconfig +1 -0
+
 config INTEL_POWERCLAMP
 	tristate "Intel PowerClamp idle injection driver"
 	depends on THERMAL
drivers/thermal/Makefile +1 -0
index 10b07c1..0a2b3f2 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_ARMADA_THERMAL)	+= armada_thermal.o
 obj-$(CONFIG_TANGO_THERMAL)	+= tango_thermal.o
 obj-$(CONFIG_IMX_THERMAL)	+= imx_thermal.o
 obj-$(CONFIG_DB8500_CPUFREQ_COOLING)	+= db8500_cpufreq_cooling.o
+obj-$(CONFIG_DA9062_THERMAL)	+= da9062-thermal.o
 obj-$(CONFIG_INTEL_POWERCLAMP)	+= intel_powerclamp.o
 obj-$(CONFIG_X86_PKG_TEMP_THERMAL)	+= x86_pkg_temp_thermal.o
 obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE)	+= intel_soc_dts_iosf.o
drivers/thermal/da9062-thermal.c new file +73 -0
new file mode 100644
index 0000000..e0d2b1b
@@ -0,0 +1,289 @@
+/*
+ * Thermal device driver for DA9062 and DA9061
+ * Copyright (C) 2016  Dialog Semiconductor Ltd.
+ *
+ * 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 <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/thermal.h>
+#include <linux/workqueue.h>
+
+#include <linux/mfd/da9062/core.h>
+#include <linux/mfd/da9062/registers.h>
+
+#define DA9062_DEFAULT_POLLING_MS_PERIOD	3000
+#define DA9062_MAX_POLLING_MS_PERIOD		10000
+#define DA9062_MIN_POLLING_MS_PERIOD		1000
+
+#define DA9062_MILLI_CELSIUS(t)			((t)*1000)
+
+struct da9062_thermal_config {
+	const char *name;
+};
+
+struct da9062_thermal {
+	struct da9062 *hw;
+	struct delayed_work work;
+	struct thermal_zone_device *zone;
+	enum thermal_device_mode mode;
+	unsigned int polling_period;
+	struct mutex lock;
+	int temperature;
+	int irq;
+	const struct da9062_thermal_config *config;
+	struct device *dev;
+};
+
+static void da9062_thermal_poll_on(struct work_struct *work)
+{
+	struct da9062_thermal *thermal = container_of(work,
+						struct da9062_thermal,
+						work.work);
+	unsigned int val;
+	int ret;
+
+	/* clear E_TEMP */
+	ret = regmap_write(thermal->hw->regmap,
+				DA9062AA_EVENT_B,
+				DA9062AA_E_TEMP_MASK);
+	if (ret < 0) {
+		dev_err(thermal->dev,
+			"Cannot clear the TJUNC temperature status\n");
+		goto err_enable_irq;
+	}
+
+	/* Now read E_TEMP again: it is acting like a status bit.
+	 * If over-temperature, then this status will be true.
+	 * If not over-temperature, this status will be false.
+	 */
+	ret = regmap_read(thermal->hw->regmap,

drivers/thermal/da9062-thermal.c line 83

Quoted 10 lines
drivers/thermal/da9062-thermal.c new file +10 -0
+			  DA9062AA_EVENT_B,
+			  &val);
+	if (ret < 0) {
+		dev_err(thermal->dev,
+			"Cannot check the TJUNC temperature status\n");
+		goto err_enable_irq;
+	} else {
+		if (val & DA9062AA_E_TEMP_MASK) {
+			mutex_lock(&thermal->lock);
+			thermal->temperature = DA9062_MILLI_CELSIUS(125);

Does this mean that the chip temperature is above or equal to 125C, is this really a safe temperature to keep it running?

Quoted 14 lines
drivers/thermal/da9062-thermal.c new file +14 -0
+			mutex_unlock(&thermal->lock);
+			thermal_zone_device_update(thermal->zone);
+
+			schedule_delayed_work(&thermal->work,
+				msecs_to_jiffies(thermal->polling_period));
+			return;
+		} else {
+			mutex_lock(&thermal->lock);
+			thermal->temperature = DA9062_MILLI_CELSIUS(0);
+			mutex_unlock(&thermal->lock);
+			thermal_zone_device_update(thermal->zone);
+		}
+	}
+

drivers/thermal/da9062-thermal.c line 107

Quoted 10 lines
drivers/thermal/da9062-thermal.c new file +10 -0
+err_enable_irq:
+	enable_irq(thermal->irq);
+}
+
+static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
+{
+	struct da9062_thermal *thermal = data;
+
+	disable_irq_nosync(thermal->irq);
+	schedule_delayed_work(&thermal->work, 0);

Can you please elaborate a little on why you have an one shot threaded IRQ handler that is only disabling the IRQ then, scheduling a work with delay of 0?

To my understanding, this is exactly what you get when you run your threaded IRQ handler, when you configure it as one shot.

Have you tried simply handling the same work done in your workqueue handler in your threaded IRQ? That should simplify your code and get the same result you are expecting.

If you are not getting the IRQ disabled on the threaded IRQ when configured as one shot, something else seams to be broken.

Quoted 115 lines
drivers/thermal/da9062-thermal.c new file +115 -0
+
+	return IRQ_HANDLED;
+}
+
+static int da9062_thermal_get_mode(struct thermal_zone_device *z,
+				   enum thermal_device_mode *mode)
+{
+	struct da9062_thermal *thermal = z->devdata;
+	*mode = thermal->mode;
+	return 0;
+}
+
+static int da9062_thermal_get_trip_type(struct thermal_zone_device *z,
+				int trip,
+				enum thermal_trip_type *type)
+{
+	struct da9062_thermal *thermal = z->devdata;
+
+	switch (trip) {
+	case 0:
+		*type = THERMAL_TRIP_HOT;
+		break;
+	default:
+		dev_err(thermal->dev,
+			"Driver does not support more than 1 trip-wire\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int da9062_thermal_get_trip_temp(struct thermal_zone_device *z,
+					int trip,
+					int *temp)
+{
+	struct da9062_thermal *thermal = z->devdata;
+
+	switch (trip) {
+	case 0:
+		*temp = DA9062_MILLI_CELSIUS(125);
+		break;
+	default:
+		dev_err(thermal->dev,
+			"Driver does not support more than 1 trip-wire\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int da9062_thermal_get_temp(struct thermal_zone_device *z,
+				   int *temp)
+{
+	struct da9062_thermal *thermal = z->devdata;
+
+	mutex_lock(&thermal->lock);
+	*temp = thermal->temperature;
+	mutex_unlock(&thermal->lock);
+
+	return 0;
+}
+
+static struct thermal_zone_device_ops da9062_thermal_ops = {
+	.get_temp	= da9062_thermal_get_temp,
+	.get_mode	= da9062_thermal_get_mode,
+	.get_trip_type	= da9062_thermal_get_trip_type,
+	.get_trip_temp	= da9062_thermal_get_trip_temp,
+};
+
+static const struct da9062_thermal_config da9062_config = {
+	.name = "da9062-thermal",
+};
+
+static const struct of_device_id da9062_compatible_reg_id_table[] = {
+	{ .compatible = "dlg,da9062-thermal", .data = &da9062_config },
+	{ },
+};
+
+static int da9062_thermal_probe(struct platform_device *pdev)
+{
+	struct da9062 *chip = dev_get_drvdata(pdev->dev.parent);
+	struct da9062_thermal *thermal;
+	unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD;
+	const struct of_device_id *match;
+	int ret = 0;
+
+	match = of_match_node(da9062_compatible_reg_id_table,
+			      pdev->dev.of_node);
+	if (!match)
+		return -ENXIO;
+
+	if (pdev->dev.of_node) {
+		if (!of_property_read_u32(pdev->dev.of_node,
+					"dlg,tjunc-temp-polling-period-ms",
+					&pp_tmp)) {
+			if (pp_tmp < DA9062_MIN_POLLING_MS_PERIOD ||
+				pp_tmp > DA9062_MAX_POLLING_MS_PERIOD)
+				pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD;
+		}
+
+		dev_dbg(&pdev->dev,
+			 "TJUNC temp polling period set at %d ms\n",
+			 pp_tmp);
+	}
+
+	thermal = devm_kzalloc(&pdev->dev, sizeof(struct da9062_thermal),
+			     GFP_KERNEL);
+	if (!thermal) {
+		ret = -ENOMEM;
+		goto err;
+	}
+
+	thermal->config = match->data;
+	thermal->hw = chip;
+	thermal->polling_period = pp_tmp;

drivers/thermal/da9062-thermal.c line 232

Quoted 10 lines
drivers/thermal/da9062-thermal.c new file +10 -0
+	thermal->mode = THERMAL_DEVICE_ENABLED;
+	thermal->dev = &pdev->dev;
+
+	INIT_DELAYED_WORK(&thermal->work, da9062_thermal_poll_on);
+	mutex_init(&thermal->lock);
+
+	thermal->zone = thermal_zone_device_register(thermal->config->name,
+					1, 0, thermal,
+					&da9062_thermal_ops, NULL, 0,
+					0);

Did you try using of-thermal?

So you would avoid having specific DT properties for something that there is already a defined property?

Quoted 7 lines
drivers/thermal/da9062-thermal.c new file +7 -0
+	if (IS_ERR(thermal->zone)) {
+		dev_err(&pdev->dev, "Cannot register thermal zone device\n");
+		ret = PTR_ERR(thermal->zone);
+		goto err;
+	}
+
+	ret = platform_get_irq_byname(pdev, "THERMAL");

drivers/thermal/da9062-thermal.c line 249

Quoted 10 lines
drivers/thermal/da9062-thermal.c new file +10 -0
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Failed to get platform IRQ.\n");
+		goto err_zone;
+	}
+	thermal->irq = ret;
+
+	ret = request_threaded_irq(thermal->irq, NULL,
+				   da9062_thermal_irq_handler,
+				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+				   "THERMAL", thermal);

How about using the devm_ version?

Quoted 43 lines
drivers/thermal/da9062-thermal.c new file +40 -0
+	if (ret) {
+		dev_err(&pdev->dev,
+			"Failed to request thermal device IRQ.\n");
+		goto err_zone;
+	}
+
+	platform_set_drvdata(pdev, thermal);
+	return 0;
+
+err_zone:
+	thermal_zone_device_unregister(thermal->zone);
+err:
+	return ret;
+}
+
+static int da9062_thermal_remove(struct platform_device *pdev)
+{
+	struct	da9062_thermal *thermal = platform_get_drvdata(pdev);
+
+	free_irq(thermal->irq, thermal);
+	thermal_zone_device_unregister(thermal->zone);
+	cancel_delayed_work_sync(&thermal->work);
+	return 0;
+}
+
+static struct platform_driver da9062_thermal_driver = {
+	.probe	= da9062_thermal_probe,
+	.remove	= da9062_thermal_remove,
+	.driver	= {
+		.name	= "da9062-thermal",
+		.of_match_table = da9062_compatible_reg_id_table,
+	},
+};
+
+module_platform_driver(da9062_thermal_driver);
+
+MODULE_AUTHOR("Steve Twiss");
+MODULE_DESCRIPTION("Thermal TJUNC device driver for Dialog DA9062 and DA9061");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:da9062-thermal");
Signature · 1 line
end-of-patch for PATCH V2

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw

RE: [PATCH V2 09/10] thermal: da9062/61: Thermal junction temperature monitoring driver

Hi Eduardo,

Thanks for your response.

Quoted 13 lines · Eduardo Valentin,

drivers/thermal/Kconfig config DB8500_CPUFREQ_COOLING · line 283

Quoted 9 lines · Steve Twiss
drivers/thermal/Kconfig +9 -0
+config DA9062_THERMAL
+	tristate "DA9062/DA9061 Dialog Semiconductor thermal driver"
+	depends on MFD_DA9062
+	depends on OF
+	help
+	  Enable this for the Dialog Semiconductor thermal sensor driver.
+	  This will report PMIC junction over-temperature for one thermal trip
+	  zone.
+	  Compatible with the DA9062 and DA9061 PMICs.

Is there any hardware documentation available for this chip that can be pointed out?

As part of this patch set, I added a link to the the datasheet into the top-level MFD component of the device tree binding: https://patchwork.kernel.org/patch/9426791/
You can get all the information for DA9062 and DA9061 from the patch update in that link.

[...]

Quoted 10 lines
Quoted 10 lines
drivers/thermal/da9062-thermal.c new file +10 -0
+	/* Now read E_TEMP again: it is acting like a status bit.
+	 * If over-temperature, then this status will be true.
+	 * If not over-temperature, this status will be false.
+	 */
+	ret = regmap_read(thermal->hw->regmap,
+			  DA9062AA_EVENT_B,
+			  &val);
+	if (ret < 0) {
+		dev_err(thermal->dev,
+			"Cannot check the TJUNC temperature status\n");
Quoted 8 lines

drivers/thermal/da9062-thermal.c line 83

Quoted 5 lines
drivers/thermal/da9062-thermal.c new file +5 -0
+		goto err_enable_irq;
+	} else {
+		if (val & DA9062AA_E_TEMP_MASK) {
+			mutex_lock(&thermal->lock);
+			thermal->temperature = DA9062_MILLI_CELSIUS(125);

Does this mean that the chip temperature is above or equal to 125C, is this really a safe temperature to keep it running?

There is more information in the datasheet under the section titles "Junction temperature supervision". The value of 125 degC comes from the "warning temperature threshold" and the event is triggered when "the junction temperature rises above the first threshold (TEMP_WARN), the event E_TEMP is asserted".

This suggests strictly greater than 125. However, there is no way for the chip to know the exact temperature. The mechanism is interrupt based and triggering only happens when the temperature rises above the threshold level.

[...]

Quoted 13 lines

drivers/thermal/da9062-thermal.c line 107

Quoted 6 lines
drivers/thermal/da9062-thermal.c new file +6 -0
+static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
+{
+	struct da9062_thermal *thermal = data;
+
+	disable_irq_nosync(thermal->irq);
+	schedule_delayed_work(&thermal->work, 0);

Can you please elaborate a little on why you have an one shot threaded IRQ handler that is only disabling the IRQ then, scheduling a work with delay of 0?

To my understanding, this is exactly what you get when you run your threaded IRQ handler, when you configure it as one shot.

Quoted 6 lines

Have you tried simply handling the same work done in your workqueue handler in your threaded IRQ? That should simplify your code and get the same result you are expecting.

If you are not getting the IRQ disabled on the threaded IRQ when configured as one shot, something else seams to be broken.

Over-temperature triggering is event based: an interrupt happens when the temperature rises above 125 degC. However, this event based system changes into a polling operation to detect when the temperature falls below the threshold level again. This asymmetry in the chip's behaviour is the reasoning behind why I am not using the thermal core's built-in polling functionality.

When over-temperature is reached, the interrupt from the DA9061/2 will be repeatedly triggered. The IRQ is disabled when the first over-temperature event happens and the status bit is polled using the work-queue until it becomes false. After that, the IRQ is re-enabled again so a new critical temperature event can be detected.

After the interrupt has happened, event bit for the interrupt switches into a status bit and is used for polling and detecting when the temperature drops below the threshold.

https://lkml.org/lkml/2016/10/20/372
https://lkml.org/lkml/2016/10/20/433

[...]

Quoted 9 lines

drivers/thermal/da9062-thermal.c line 232

Quoted 4 lines
drivers/thermal/da9062-thermal.c new file +4 -0
+	thermal->zone = thermal_zone_device_register(thermal->config->name,
+					1, 0, thermal,
+					&da9062_thermal_ops, NULL, 0,
+					0);

Did you try using of-thermal?

So you would avoid having specific DT properties for something that there is already a defined property?

In an earlier RFC, I examined a work-around by hijacking and toggling the thermal core's built-in polling function when I needed to poll the temperature through get_temp(). However I thought this was quite dangerous, since it would not be using a formal thermal core interface.

https://patchwork.kernel.org/patch/9387241/

[...]

Quoted 6 lines

drivers/thermal/da9062-thermal.c line 249

Quoted 4 lines
drivers/thermal/da9062-thermal.c new file +4 -0
+	ret = request_threaded_irq(thermal->irq, NULL,
+				   da9062_thermal_irq_handler,
+				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+				   "THERMAL", thermal);

How about using the devm_ version?

I wanted to explicitly free_irq() before calling thermal_zone_device_unregister() in the remove function.

Regards,
Steve
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#23 lore raw

Re: [PATCH V2 09/10] thermal: da9062/61: Thermal junction temperature monitoring driver

Hey Steve,

Quoted 20 lines · Steve Twiss

Hi Eduardo,

Thanks for your response.

Quoted 13 lines · Eduardo Valentin,

drivers/thermal/Kconfig config DB8500_CPUFREQ_COOLING · line 283

Quoted 9 lines · Steve Twiss
drivers/thermal/Kconfig +9 -0
+config DA9062_THERMAL
+	tristate "DA9062/DA9061 Dialog Semiconductor thermal driver"
+	depends on MFD_DA9062
+	depends on OF
+	help
+	  Enable this for the Dialog Semiconductor thermal sensor driver.
+	  This will report PMIC junction over-temperature for one thermal trip
+	  zone.
+	  Compatible with the DA9062 and DA9061 PMICs.

Is there any hardware documentation available for this chip that can be pointed out?

Quoted 4 lines

As part of this patch set, I added a link to the the datasheet into the top-level MFD component of the device tree binding: https://patchwork.kernel.org/patch/9426791/
You can get all the information for DA9062 and DA9061 from the patch update in that link.

Thanks for getting me up to speed.

Quoted 2 lines

[...]

<cut>

Quoted 11 lines
Quoted 2 lines

Does this mean that the chip temperature is above or equal to 125C, is this really a safe temperature to keep it running?

There is more information in the datasheet under the section titles "Junction temperature supervision". The value of 125 degC comes from the "warning temperature threshold" and the event is triggered when "the junction temperature rises above the first threshold (TEMP_WARN), the event E_TEMP is asserted".

This suggests strictly greater than 125. However, there is no way for the chip to know the exact temperature. The mechanism is interrupt based and triggering only happens when the temperature rises above the threshold level.

Understood. My original concern was if the driver would be too nice with the event. But given that the hardware has its own shutdown protection, looks like we are OK here.

Quoted 34 lines

[...]

Quoted 13 lines

drivers/thermal/da9062-thermal.c line 107

Quoted 6 lines
drivers/thermal/da9062-thermal.c new file +6 -0
+static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
+{
+	struct da9062_thermal *thermal = data;
+
+	disable_irq_nosync(thermal->irq);
+	schedule_delayed_work(&thermal->work, 0);

Can you please elaborate a little on why you have an one shot threaded IRQ handler that is only disabling the IRQ then, scheduling a work with delay of 0?

To my understanding, this is exactly what you get when you run your threaded IRQ handler, when you configure it as one shot.

Quoted 6 lines

Have you tried simply handling the same work done in your workqueue handler in your threaded IRQ? That should simplify your code and get the same result you are expecting.

If you are not getting the IRQ disabled on the threaded IRQ when configured as one shot, something else seams to be broken.

Over-temperature triggering is event based: an interrupt happens when the temperature rises above 125 degC. However, this event based system changes into a polling operation to detect when the temperature falls below the threshold level again. This asymmetry in the chip's behaviour is the reasoning behind why I am not using the thermal core's built-in polling functionality.

When over-temperature is reached, the interrupt from the DA9061/2 will be repeatedly triggered. The IRQ is disabled when the first over-temperature event happens and the status bit is polled using the work-queue until it becomes false. After that, the IRQ is re-enabled again so a new critical temperature event can be detected.

Quoted 3 lines

After the interrupt has happened, event bit for the interrupt switches into a status bit and is used for polling and detecting when the temperature drops below the threshold.

OK. got it. Then, I am assuming your strategy here is to keep periodically issuing uevents (HOT trip point) to userland, hoping that something would change the
system power consumption, then, relying on the hardware shutdown protection if nothing happens.

I would say, your above explanation, and the uevent based strategy, deserves to be at least in the commit message, preferably in the driver documentation, so people know what to expect from the driver.

Now, if my understand is correct, would it make sense to have still a failsafe mechanism in the driver? Maybe having a max number of polling?

The data sheet does not mention anything, but does one have any silicon lifetime implication if one leaves the PMIC running for very long time in a temperature between Twarn and Tcrit?

Quoted 15 lines

https://lkml.org/lkml/2016/10/20/372
https://lkml.org/lkml/2016/10/20/433

[...]

Quoted 9 lines

drivers/thermal/da9062-thermal.c line 232

Quoted 4 lines
drivers/thermal/da9062-thermal.c new file +4 -0
+	thermal->zone = thermal_zone_device_register(thermal->config->name,
+					1, 0, thermal,
+					&da9062_thermal_ops, NULL, 0,
+					0);

Did you try using of-thermal?

So you would avoid having specific DT properties for something that there is already a defined property?

Quoted 7 lines

In an earlier RFC, I examined a work-around by hijacking and toggling the thermal core's built-in polling function when I needed to poll the temperature through get_temp(). However I thought this was quite dangerous, since it would not be using a formal thermal core interface.

https://patchwork.kernel.org/patch/9387241/

my point was more under the lines of having this driver using the of-thermal DT support to get the polling value, instead of you having a manufacturer specific property:
Documentation/devicetree/bindings/thermal/thermal.txt

But given that your case is more specific, I start to see why you avoided using it. But still, you could probably get the polling values from of-thermal, populated in the tz struct, then using them from the tz, when handling the IRQ event.

Probably your regular polling should always be set to 0, and the passive polling to the value you want.

then again, this comment is more from a DT perspective than from the driver code itself. Just trying to avoid specific properties that may get described by what is already defined.

Quoted 11 lines

[...]

Quoted 6 lines

drivers/thermal/da9062-thermal.c line 249

Quoted 4 lines
drivers/thermal/da9062-thermal.c new file +4 -0
+	ret = request_threaded_irq(thermal->irq, NULL,
+				   da9062_thermal_irq_handler,
+				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+				   "THERMAL", thermal);

How about using the devm_ version?

I wanted to explicitly free_irq() before calling thermal_zone_device_unregister() in the remove function.

Ok

Quoted 2 lines

Regards,
Steve

#24 lore raw

RE: [PATCH V2 09/10] thermal: da9062/61: Thermal junction temperature monitoring driver

Hi Eduardo,

Thank you for your review comments,

On 30 November 2016 06:10, Eduardo Valentin wrote,

Quoted 3 lines · Steve Twiss
Quoted 2 lines · Eduardo Valentin,
Quoted 1 line · Steve Twiss

[...]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/thermal/da9062-thermal.c new file +6 -0
+static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
+{
+	struct da9062_thermal *thermal = data;
+
+	disable_irq_nosync(thermal->irq);
+	schedule_delayed_work(&thermal->work, 0);

[...]

Quoted 17 lines
Quoted 13 lines

Over-temperature triggering is event based: an interrupt happens when the temperature rises above 125 degC. However, this event based system changes into a polling operation to detect when the temperature falls below the threshold level again. This asymmetry in the chip's behaviour is the reasoning behind why I am not using the thermal core's built-in polling functionality.

When over-temperature is reached, the interrupt from the DA9061/2 will be repeatedly triggered. The IRQ is disabled when the first over-temperature event happens and the status bit is polled using the work-queue until it becomes false. After that, the IRQ is re-enabled again so a new critical temperature event can be detected.

Quoted 3 lines

After the interrupt has happened, event bit for the interrupt switches into a status bit and is used for polling and detecting when the temperature drops below the threshold.

Quoted 8 lines

OK. got it. Then, I am assuming your strategy here is to keep periodically issuing uevents (HOT trip point) to userland, hoping that something would change the
system power consumption, then, relying on the hardware shutdown protection if nothing happens.

I would say, your above explanation, and the uevent based strategy, deserves to be at least in the commit message, preferably in the driver documentation, so people know what to expect from the driver.

Ah, yes. I did not discuss that part in the design. Looking at this objectively, it is not immediately obvious -- although you did describe my intentions exactly. I will add those two changes into the next PATCH V5 submission so the meaning is explicit.

Quoted 3 lines

The data sheet does not mention anything, but does one have any silicon lifetime implication if one leaves the PMIC running for very long time in a temperature between Twarn and Tcrit?

As of writing this reply, the latest available datasheet for DA9062 contains sections on "Absolute Maximum Ratings" and "Recommended Operating Conditions" for the junction temperature.

Regarding the warning temperature the datasheet says, "Operating the device in conditions exceeding [this level] [...] for extended periods of time may affect device reliability".

Reference to the documentation in the Linux kernel would also be useful on the warning threshold. The driver defines this trip-point as,

Documentation/devicetree/bindings/thermal/thermal.txt "hot": A trip point to notify emergency

I chose this trip point to indicate a strong recommendation that the temperature warning is treated as an emergency, and should be brought under control as fast as possible. This will stop any potential reliability problems before the hardware enforces "a shutdown sequence to RESET mode" in the PMIC.

Quoted 2 lines

Now, if my understand is correct, would it make sense to have still a failsafe mechanism in the driver? Maybe having a max number of polling?

I'm not certain what failsafe capability the general driver "should" have. I am not implementing a notify function for instance. I expect the general driver to be modified by the designers of the final integrated system. They will also have access to the PMIC product datasheet and the information on over-temperature and would be best placed to make a decision for their system.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/thermal/da9062-thermal.c line 232

Quoted 4 lines
drivers/thermal/da9062-thermal.c new file +4 -0
+	thermal->zone = thermal_zone_device_register(thermal->config->name,
+					1, 0, thermal,
+					&da9062_thermal_ops, NULL, 0,
+					0);

Did you try using of-thermal?

So you would avoid having specific DT properties for something that there is already a defined property?

[...]

Quoted 11 lines

using the of-thermal DT support to get the polling value, instead of you having a manufacturer specific property:
Documentation/devicetree/bindings/thermal/thermal.txt

But given that your case is more specific, I start to see why you avoided using it. But still, you could probably get the polling values from of-thermal, populated in the tz struct, then using them from the tz, when handling the IRQ event.

Probably your regular polling should always be set to 0, and the passive polling to the value you want.

Thank you for your additional explanation.

I will implement this as part of the next PATCH V5 submission.

Quoted 3 lines

then again, this comment is more from a DT perspective than from the driver code itself. Just trying to avoid specific properties that may get described by what is already defined.

I agree. If I can possibly avoid creating device specific properties that are not required and instead re-use existing core ones, I should do that.

[...]

Regards,
Steve

#25 lore raw

PATCH v2 10/10 MAINTAINERS: da9062/61 updates to the Dialog Semiconductor search terms

In reply to Steve Twiss

From: Steve Twiss <[email protected]>

Hi,

Dialog Semiconductor support would like to add to the MAINTAINERS search terms. This update will allow us to follow files for device tree bindings and source code relating to input onkey drivers, chip thermal monitoring and watchdog timers.

---
This patch applies against linux-next and v4.8

v1 -> v2
NO CHANGE

Hi,

This patch depends on acceptance of the following from this patch set:

- [PATCH V2 09/10] PMIC temperature monitoring

and also from the following binding file changes:

- [PATCH V2 01/10] Binding for onkey
- [PATCH V2 02/10] Binding for watchdog
- [PATCH V2 03/10] Binding for thermal

Regards,
Steve Twiss, Dialog Semiconductor Ltd.

 MAINTAINERS | 4 ++++
 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
index f593300..a7fd809 100644
@@ -3752,7 +3752,10 @@ W:	http://www.dialog-semiconductor.com/products
 S:	Supported
 F:	Documentation/hwmon/da90??
 F:	Documentation/devicetree/bindings/mfd/da90*.txt
+F:	Documentation/devicetree/bindings/input/da90??-onkey.txt
+F:	Documentation/devicetree/bindings/thermal/da90??-thermal.txt
 F:	Documentation/devicetree/bindings/regulator/da92*.txt
+F:	Documentation/devicetree/bindings/watchdog/da92??-wdt.txt
 F:	Documentation/devicetree/bindings/sound/da[79]*.txt
 F:	drivers/gpio/gpio-da90??.c
 F:	drivers/hwmon/da90??-hwmon.c
@@ -3767,6 +3770,7 @@ F:	drivers/power/da9052-battery.c
 F:	drivers/power/da91??-*.c
 F:	drivers/regulator/da903x.c
 F:	drivers/regulator/da9???-regulator.[ch]
+F:	drivers/thermal/da90??-thermal.c
 F:	drivers/rtc/rtc-da90??.c
 F:	drivers/video/backlight/da90??_bl.c
 F:	drivers/watchdog/da90??_wdt.c
Signature · 1 line
end-of-patch for PATCH V2