Skip to contentSkip to conversation

rtc: ds1374: Add trickle charger device tree binding

PATCH In review Moritz Fischer 3 participants 6 messages Apr 17, 2017 – Apr 24, 2017 4 messages not in the archive

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

PATCH 1/1 rtc: ds1374: Add trickle charger device tree binding

Introduce a device tree binding for specifying the trickle charger configuration for ds1374. This is based on the code for ds13390.

---
 .../devicetree/bindings/rtc/dallas,ds1374.txt      | 18 ++++++++
 drivers/rtc/rtc-ds1374.c                           | 54 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/dallas,ds1374.txt
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +18 -0
new file mode 100644
index 0000000..4cf5bd7
@@ -0,0 +1,18 @@
+* Dallas DS1374		I2C Real-Time Clock / WDT
+
+Required properties:
+- compatible: Should contain "dallas,ds1374".
+- reg: I2C address for chip
+
+Optional properties:
+- trickle-resistor-ohms : Selected resistor for trickle charger
+	Values usable for ds1374 are 250, 2000, 4000
+	Should be given if trickle charger should be enabled
+- trickle-diode-disable : Do not use internal trickle charger diode
+	Should be given if internal trickle charger diode should be disabled
+Example:
+	ds1374: rtc@0 {
+		compatible = "dallas,ds1374";
+		trickle-resistor-ohms = <250>;
+		reg = <0>;
+	};
drivers/rtc/rtc-ds1374.c +54 -0

72 lines not on this page · raw message

Signature · 11 lines
2.7.4

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.

A message that is not in the archive (sent off-list or not yet received): 1492468810-17224-1-git-send-email-mdf-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw
Quoted 16 lines · Moritz Fischer

Introduce a device tree binding for specifying the trickle charger configuration for ds1374. This is based on the code for ds13390.

---
 .../devicetree/bindings/rtc/dallas,ds1374.txt      | 18 ++++++++
 drivers/rtc/rtc-ds1374.c                           | 54 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/dallas,ds1374.txt
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +0 -0
new file mode 100644
index 0000000..4cf5bd7

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 1

Quoted 1 line
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +1 -0
@@ -0,0 +1,18 @@
+* Dallas DS1374		I2C Real-Time Clock / WDT

Please remove from trivial-devices.txt, too. (which is moving in 4.12 BTW)

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 12

Quoted 11 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +11 -0
+
+Required properties:
+- compatible: Should contain "dallas,ds1374".
+- reg: I2C address for chip
+
+Optional properties:
+- trickle-resistor-ohms : Selected resistor for trickle charger
+	Values usable for ds1374 are 250, 2000, 4000
+	Should be given if trickle charger should be enabled
+- trickle-diode-disable : Do not use internal trickle charger diode
+	Should be given if internal trickle charger diode should be disabled

These should have vendor prefix unless you think they are common.

Quoted 6 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +6 -0
+Example:
+	ds1374: rtc@0 {
+		compatible = "dallas,ds1374";
+		trickle-resistor-ohms = <250>;
+		reg = <0>;
+	};
Signature · 8 lines
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
#3 lore raw
Quoted 11 lines · Rob Herring
Quoted 10 lines · Moritz Fischer

Introduce a device tree binding for specifying the trickle charger configuration for ds1374. This is based on the code for ds13390.

---
 .../devicetree/bindings/rtc/dallas,ds1374.txt      | 18 ++++++++
 drivers/rtc/rtc-ds1374.c                           | 54 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/dallas,ds1374.txt
Quoted 10 lines

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +1 -0
new file mode 100644
index 0000000..4cf5bd7
@@ -0,0 +1,18 @@
+* Dallas DS1374		I2C Real-Time Clock / WDT

Please remove from trivial-devices.txt, too. (which is moving in 4.12 BTW)

Ok, I'll redo this on top of b7e252fcddfa573bb1ee275b53bba6cef85671d4 (Documentation: devicetree: move trivial-devices out of I2C realm) then.

Quoted 14 lines

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 12

Quoted 12 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +11 -0
+
+Required properties:
+- compatible: Should contain "dallas,ds1374".
+- reg: I2C address for chip
+
+Optional properties:
+- trickle-resistor-ohms : Selected resistor for trickle charger
+	Values usable for ds1374 are 250, 2000, 4000
+	Should be given if trickle charger should be enabled
+- trickle-diode-disable : Do not use internal trickle charger diode
+	Should be given if internal trickle charger diode should be disabled

These should have vendor prefix unless you think they are common.

Well works at least for maxim, dallas & different models like ds1390, ds1374, so I figured I'd keep the bindings the same.

Quoted 7 lines

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 18

Quoted 7 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +6 -0
+Example:
+	ds1374: rtc@0 {
+		compatible = "dallas,ds1374";
+		trickle-resistor-ohms = <250>;
+		reg = <0>;
+	};

Thanks,

Moritz

Signature · 8 lines
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.

A message that is not in the archive (sent off-list or not yet received): 20170420172538.GA13892-R0KNJUYl863z/[email protected]

#5 lore raw
Quoted 23 lines · Moritz Fischer
Quoted 11 lines · Rob Herring
Quoted 10 lines · Moritz Fischer

Introduce a device tree binding for specifying the trickle charger configuration for ds1374. This is based on the code for ds13390.

---
 .../devicetree/bindings/rtc/dallas,ds1374.txt      | 18 ++++++++
 drivers/rtc/rtc-ds1374.c                           | 54 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/dallas,ds1374.txt
Quoted 10 lines

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +1 -0
new file mode 100644
index 0000000..4cf5bd7
@@ -0,0 +1,18 @@
+* Dallas DS1374            I2C Real-Time Clock / WDT

Please remove from trivial-devices.txt, too. (which is moving in 4.12 BTW)

Quoted 2 lines

Ok, I'll redo this on top of b7e252fcddfa573bb1ee275b53bba6cef85671d4 (Documentation: devicetree: move trivial-devices out of I2C realm) then.

Follow up question, right now one selects between WDT and ALARM mode with a CONFIG_RTC_DRV_DS1374_WDT=y statically at compile time.

I'd like to add a 'dallas,mode = <DS1374_WDT>;' or dallas,enable-watchdog property
to the binding, same goes for the ability to remap the WDT reset output to the interrupt pin (which is currently not supported, but my hardware needs this).

Would be the right way to add the remapping something like 'dallas,remap-reset-to-int' ?

Ideas? This change would obviously break people's setups where they select one or
the other behavior via the build time option. Is that acceptable seen that relying on
build time CONFIG_FOO seems like a bad assumption to begin with?

A bit of background: I currently started cleaning up a bunch of issues in this driver,
like refactoring it to use the watchdog framework instead of open coding everything,
make setting the timeout actually work (right now it the timeout to tick conversion is
hosed).

Thanks,

Moritz
--
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

A message that is not in the archive (sent off-list or not yet received): CAAtXAHfNuRXninLWySAOdtV99ih4PBt=JPszn3UkNa08OvXLFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw
Quoted 44 lines · Moritz Fischer
Quoted 23 lines · Moritz Fischer
Quoted 11 lines · Rob Herring
Quoted 10 lines · Moritz Fischer

Introduce a device tree binding for specifying the trickle charger configuration for ds1374. This is based on the code for ds13390.

---
 .../devicetree/bindings/rtc/dallas,ds1374.txt      | 18 ++++++++
 drivers/rtc/rtc-ds1374.c                           | 54 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/dallas,ds1374.txt
Quoted 10 lines

Documentation/devicetree/bindings/rtc/dallas,ds1374.txt line 1

Quoted 7 lines
Documentation/devicetree/bindings/rtc/dallas,ds1374.txt new file +1 -0
new file mode 100644
index 0000000..4cf5bd7
@@ -0,0 +1,18 @@
+* Dallas DS1374            I2C Real-Time Clock / WDT

Please remove from trivial-devices.txt, too. (which is moving in 4.12 BTW)

Quoted 2 lines

Ok, I'll redo this on top of b7e252fcddfa573bb1ee275b53bba6cef85671d4 (Documentation: devicetree: move trivial-devices out of I2C realm) then.

Follow up question, right now one selects between WDT and ALARM mode with a CONFIG_RTC_DRV_DS1374_WDT=y statically at compile time.

I'd like to add a 'dallas,mode = <DS1374_WDT>;' or dallas,enable-watchdog property
to the binding, same goes for the ability to remap the WDT reset output to the interrupt pin (which is currently not supported, but my hardware needs this).

Would be the right way to add the remapping something like 'dallas,remap-reset-to-int' ?

Ideas? This change would obviously break people's setups where they select one or
the other behavior via the build time option. Is that acceptable seen that relying on
build time CONFIG_FOO seems like a bad assumption to begin with?

Quoted 8 lines

A bit of background: I currently started cleaning up a bunch of issues in this driver,
like refactoring it to use the watchdog framework instead of open coding everything,
make setting the timeout actually work (right now it the timeout to tick conversion is
hosed).

I think I would do something with MFD as you were suggesting on IRC. You can have a look at the flexcom driver (atmel-flexcom.c) which is simply selecting a mode and then using whatever IP driver already existed (UART, I2C or SPI).

I didn't have a close look but maybe that fits. Then, as you are concerned wtih backward compatibility, you could enforce the mode from the MFD driver, depending on the CONFIG_RTC_DRV_DS1374_WDT value.

Signature · 13 lines
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.

A message that is not in the archive (sent off-list or not yet received): 20170424171639.6vv5hxrejylloh3b-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org

#9 lore raw

Hi Alex,

Quoted 4 lines · Alexandre Belloni

I think I would do something with MFD as you were suggesting on IRC. You can have a look at the flexcom driver (atmel-flexcom.c) which is simply selecting a mode and then using whatever IP driver already existed (UART, I2C or SPI).

That's an interesting approach, so the idea is to basically use the MFD to switch an existing driver one way or another via pdata? That could work.

Quoted 4 lines

I didn't have a close look but maybe that fits. Then, as you are concerned wtih backward compatibility, you could enforce the mode from the MFD driver, depending on the CONFIG_RTC_DRV_DS1374_WDT value.

This is where I'm currently at:

https://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux.git/log/?h=wip/mfd-ds1374-rfc

Still a WIP, maybe can get out a patchset by the end of the week ...

Thanks,
Moritz

Signature · 8 lines
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.