devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] add device tree support for rtc-rv8803
@ 2016-06-22  6:42 Dirk Behme
       [not found] ` <1466577742-18824-1-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Dirk Behme @ 2016-06-22  6:42 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Oleksij Rempel

From: Oleksij Rempel <linux-YEK0n+YFykbzxQdaRaTXBw@public.gmane.org>

Changes v2:
- rename mc to microcrystal
- rename vdetoff to vdet-disable

Knut Wohlrab (1):
  rtc: rv8803: add device tree compatible names

Oleksij Rempel (3):
  devicetree: Add Micro Crystal AG vendor id
  dt/bindings: Add bindings for Micro Crystal rv8803
  rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree

 .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |  1 +
 drivers/rtc/rtc-rv8803.c                           | 50 ++++++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt

-- 
1.9.1

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] devicetree: Add Micro Crystal AG vendor id
       [not found] ` <1466577742-18824-1-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-22  6:42   ` Dirk Behme
       [not found]     ` <1466577742-18824-2-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-22  6:42   ` [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803 Dirk Behme
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Dirk Behme @ 2016-06-22  6:42 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Oleksij Rempel

From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>

Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 2c2500d..7a1d5ea 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -158,6 +158,7 @@ melexis	Melexis N.V.
 merrii	Merrii Technology Co., Ltd.
 micrel	Micrel Inc.
 microchip	Microchip Technology Inc.
+microcrystal	Micro Crystal AG
 micron	Micron Technology Inc.
 minix	MINIX Technology Ltd.
 mitsubishi	Mitsubishi Electric Corporation
-- 
1.9.1

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803
       [not found] ` <1466577742-18824-1-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-22  6:42   ` [PATCH v2 1/4] devicetree: Add Micro Crystal AG vendor id Dirk Behme
@ 2016-06-22  6:42   ` Dirk Behme
       [not found]     ` <1466577742-18824-3-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-22  6:42   ` [PATCH v2 3/4] rtc: rv8803: add device tree compatible names Dirk Behme
  2016-06-22  6:42   ` [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree Dirk Behme
  3 siblings, 1 reply; 16+ messages in thread
From: Dirk Behme @ 2016-06-22  6:42 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Oleksij Rempel

From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>

... and Epson RX8900 real time clock

Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt

diff --git a/Documentation/devicetree/bindings/rtc/epson,rx8900.txt b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
new file mode 100644
index 0000000..3f61e51
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
@@ -0,0 +1,22 @@
+Real Time Clock driver for:
+  - Epson RX8900
+  - Micro Crystal rv8803
+
+Required properties:
+- compatible: should be: "microcrystal,rv8803" or "epson,rx8900"
+- reg : the I2C address of the device for I2C
+
+Optional properties:
+- epson,vdet-disable : boolean, if present will disable voltage detector.
+  Should be set if no backup battery is used.
+- trickle-diode-disable : boolean, if present will disable internal trickle
+  charger diode
+
+Example:
+
+	rtc: rtc@32 {
+		compatible = "epson,rx8900"
+		reg = <0x32>;
+		epson,vdet-disable;
+		trickle-diode-disable;
+	};
-- 
1.9.1

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] rtc: rv8803: add device tree compatible names
       [not found] ` <1466577742-18824-1-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-22  6:42   ` [PATCH v2 1/4] devicetree: Add Micro Crystal AG vendor id Dirk Behme
  2016-06-22  6:42   ` [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803 Dirk Behme
@ 2016-06-22  6:42   ` Dirk Behme
       [not found]     ` <1466577742-18824-4-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-22  6:42   ` [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree Dirk Behme
  3 siblings, 1 reply; 16+ messages in thread
From: Dirk Behme @ 2016-06-22  6:42 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Knut Wohlrab, Oleksij Rempel

From: Knut Wohlrab <Knut.Wohlrab-V5te9oGctAVWk0Htik3J/w@public.gmane.org>

Add device tree compatible names for usage in a compatible
list of alternative RTC devices.

Signed-off-by: Knut Wohlrab <Knut.Wohlrab-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/rtc/rtc-rv8803.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index f623038..e122b51 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/rtc.h>
+#include <linux/of.h>
 
 #define RV8803_SEC			0x00
 #define RV8803_MIN			0x01
@@ -520,9 +521,19 @@ static const struct i2c_device_id rv8803_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rv8803_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id rv8803_of_match[] = {
+	{ .compatible = "microcrystal,rv8803", },
+	{ .compatible = "epson,rx8900", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rv8803_of_match);
+#endif
+
 static struct i2c_driver rv8803_driver = {
 	.driver = {
 		.name = "rtc-rv8803",
+		.of_match_table = of_match_ptr(rv8803_of_match),
 	},
 	.probe		= rv8803_probe,
 	.remove		= rv8803_remove,
-- 
1.9.1

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree
       [not found] ` <1466577742-18824-1-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-06-22  6:42   ` [PATCH v2 3/4] rtc: rv8803: add device tree compatible names Dirk Behme
@ 2016-06-22  6:42   ` Dirk Behme
       [not found]     ` <1466577742-18824-5-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  3 siblings, 1 reply; 16+ messages in thread
From: Dirk Behme @ 2016-06-22  6:42 UTC (permalink / raw)
  To: rtc-linux-/JYPxA39Uh5TLH3MbocFFw, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Oleksij Rempel, Carsten Resch, Dirk Behme

From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>

There might be designs where the power supply circuit is designed
in a way that VDETOFF and SWOFF is reuqired to be set. Otherwise the
RTC detects a power loss. Add a device tree interface for this.

Signed-off-by: Carsten Resch <Carsten.Resch-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Dirk Behme <dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/rtc/rtc-rv8803.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index e122b51..32a5686 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -50,6 +50,10 @@
 #define RV8803_CTRL_TIE			BIT(4)
 #define RV8803_CTRL_UIE			BIT(5)
 
+#define RX8900_BACKUP_CTRL		0x18
+#define RX8900_FLAG_SWOFF		BIT(2)
+#define RX8900_FLAG_VDETOFF		BIT(3)
+
 struct rv8803_data {
 	struct i2c_client *client;
 	struct rtc_device *rtc;
@@ -423,6 +427,35 @@ static struct rtc_class_ops rv8803_rtc_ops = {
 	.ioctl = rv8803_ioctl,
 };
 
+static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
+{
+	struct i2c_client *client = rv8803->client;
+	struct device_node *node = client->dev.of_node;
+	int err;
+	u8 flags;
+
+	if (!node)
+		return 0;
+
+	if (!of_device_is_compatible(node, "epson,rx8900"))
+		return 0;
+
+	err = i2c_smbus_read_byte_data(rv8803->client, RX8900_BACKUP_CTRL);
+	if (err < 0)
+		return err;
+
+	flags = ~(RX8900_FLAG_VDETOFF | RX8900_FLAG_SWOFF) & (u8)err;
+
+	if (of_property_read_bool(node, "epson,vdet-disable"))
+		flags |= RX8900_FLAG_VDETOFF;
+
+	if (of_property_read_bool(node, "trickle-diode-disable"))
+		flags |= RX8900_FLAG_SWOFF;
+
+	return i2c_smbus_write_byte_data(rv8803->client, RX8900_BACKUP_CTRL,
+					 flags);
+}
+
 static int rv8803_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
@@ -498,6 +531,12 @@ static int rv8803_probe(struct i2c_client *client,
 	if (err)
 		return err;
 
+	err = rx8900_trickle_charger_init(rv8803);
+	if (err) {
+		dev_err(&client->dev, "failed to init charger\n");
+		return err;
+	}
+
 	err = device_create_bin_file(&client->dev, &rv8803_nvram_attr);
 	if (err)
 		return err;
-- 
1.9.1

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/4] rtc: rv8803: add device tree compatible names
       [not found]     ` <1466577742-18824-4-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-24  7:00       ` Alexandre Belloni
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2016-06-24  7:00 UTC (permalink / raw)
  To: Dirk Behme
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Knut Wohlrab, Oleksij Rempel

On 22/06/2016 at 08:42:21 +0200, Dirk Behme wrote :
> From: Knut Wohlrab <Knut.Wohlrab-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> 
> Add device tree compatible names for usage in a compatible
> list of alternative RTC devices.
> 

This patch is unnecessary, the i2c subsystem is making sure the driver
is probed without it.

> Signed-off-by: Knut Wohlrab <Knut.Wohlrab-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  drivers/rtc/rtc-rv8803.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
> index f623038..e122b51 100644
> --- a/drivers/rtc/rtc-rv8803.c
> +++ b/drivers/rtc/rtc-rv8803.c
> @@ -18,6 +18,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/rtc.h>
> +#include <linux/of.h>
>  
>  #define RV8803_SEC			0x00
>  #define RV8803_MIN			0x01
> @@ -520,9 +521,19 @@ static const struct i2c_device_id rv8803_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, rv8803_id);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id rv8803_of_match[] = {
> +	{ .compatible = "microcrystal,rv8803", },
> +	{ .compatible = "epson,rx8900", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, rv8803_of_match);
> +#endif
> +
>  static struct i2c_driver rv8803_driver = {
>  	.driver = {
>  		.name = "rtc-rv8803",
> +		.of_match_table = of_match_ptr(rv8803_of_match),
>  	},
>  	.probe		= rv8803_probe,
>  	.remove		= rv8803_remove,
> -- 
> 1.9.1
> 
> -- 
> 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/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] devicetree: Add Micro Crystal AG vendor id
       [not found]     ` <1466577742-18824-2-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-24  7:00       ` Alexandre Belloni
  2016-06-24 15:43       ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2016-06-24  7:00 UTC (permalink / raw)
  To: Dirk Behme
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Oleksij Rempel

On 22/06/2016 at 08:42:19 +0200, Dirk Behme wrote :
> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> 

Please always include a commit message.

> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index 2c2500d..7a1d5ea 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -158,6 +158,7 @@ melexis	Melexis N.V.
>  merrii	Merrii Technology Co., Ltd.
>  micrel	Micrel Inc.
>  microchip	Microchip Technology Inc.
> +microcrystal	Micro Crystal AG
>  micron	Micron Technology Inc.
>  minix	MINIX Technology Ltd.
>  mitsubishi	Mitsubishi Electric Corporation
> -- 
> 1.9.1
> 
> -- 
> 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/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree
       [not found]     ` <1466577742-18824-5-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-24  7:44       ` Alexandre Belloni
       [not found]         ` <20160624074407.GJ5809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Alexandre Belloni @ 2016-06-24  7:44 UTC (permalink / raw)
  To: Dirk Behme
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Oleksij Rempel, Carsten Resch

On 22/06/2016 at 08:42:22 +0200, Dirk Behme wrote :
> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> 
> There might be designs where the power supply circuit is designed
> in a way that VDETOFF and SWOFF is reuqired to be set. Otherwise the
> RTC detects a power loss. Add a device tree interface for this.
> 
> Signed-off-by: Carsten Resch <Carsten.Resch-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Dirk Behme <dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  drivers/rtc/rtc-rv8803.c | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
> index e122b51..32a5686 100644
> --- a/drivers/rtc/rtc-rv8803.c
> +++ b/drivers/rtc/rtc-rv8803.c
> @@ -50,6 +50,10 @@
>  #define RV8803_CTRL_TIE			BIT(4)
>  #define RV8803_CTRL_UIE			BIT(5)
>  
> +#define RX8900_BACKUP_CTRL		0x18
> +#define RX8900_FLAG_SWOFF		BIT(2)
> +#define RX8900_FLAG_VDETOFF		BIT(3)
> +
>  struct rv8803_data {
>  	struct i2c_client *client;
>  	struct rtc_device *rtc;
> @@ -423,6 +427,35 @@ static struct rtc_class_ops rv8803_rtc_ops = {
>  	.ioctl = rv8803_ioctl,
>  };
>  
> +static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
> +{
> +	struct i2c_client *client = rv8803->client;
> +	struct device_node *node = client->dev.of_node;
> +	int err;
> +	u8 flags;
> +
> +	if (!node)
> +		return 0;
> +
> +	if (!of_device_is_compatible(node, "epson,rx8900"))
> +		return 0;
> +

Can you use the i2c_device_id instead of of_device_is_compatible to
avoid matching on yet another string?


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803
       [not found]     ` <1466577742-18824-3-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-24  7:48       ` Alexandre Belloni
       [not found]         ` <20160624074849.GK5809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
  2016-06-24 15:44       ` Rob Herring
  1 sibling, 1 reply; 16+ messages in thread
From: Alexandre Belloni @ 2016-06-24  7:48 UTC (permalink / raw)
  To: Dirk Behme, Andrey Smirnov, Rob Herring
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Oleksij Rempel

On 22/06/2016 at 08:42:20 +0200, Dirk Behme wrote :
> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> 
> ... and Epson RX8900 real time clock
> 
> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/epson,rx8900.txt b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
> new file mode 100644
> index 0000000..3f61e51
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
> @@ -0,0 +1,22 @@
> +Real Time Clock driver for:
> +  - Epson RX8900
> +  - Micro Crystal rv8803
> +
> +Required properties:
> +- compatible: should be: "microcrystal,rv8803" or "epson,rx8900"
> +- reg : the I2C address of the device for I2C
> +
> +Optional properties:
> +- epson,vdet-disable : boolean, if present will disable voltage detector.
> +  Should be set if no backup battery is used.

I guess we need to make that one generic. I would use
voltage-detection-disable.

Andrey, can you use that one instead of
dallas,disable-oscillator-stop-flag ?

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] devicetree: Add Micro Crystal AG vendor id
       [not found]     ` <1466577742-18824-2-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-24  7:00       ` Alexandre Belloni
@ 2016-06-24 15:43       ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2016-06-24 15:43 UTC (permalink / raw)
  To: Dirk Behme
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Oleksij Rempel

On Wed, Jun 22, 2016 at 08:42:19AM +0200, Dirk Behme wrote:
> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> 
> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803
       [not found]     ` <1466577742-18824-3-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  2016-06-24  7:48       ` Alexandre Belloni
@ 2016-06-24 15:44       ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2016-06-24 15:44 UTC (permalink / raw)
  To: Dirk Behme
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Oleksij Rempel

On Wed, Jun 22, 2016 at 08:42:20AM +0200, Dirk Behme wrote:
> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> 
> ... and Epson RX8900 real time clock
> 
> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803
       [not found]         ` <20160624074849.GK5809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
@ 2016-06-24 19:14           ` Andrey Smirnov
  2016-06-29  4:34             ` fixed-term.Oleksij.Rempel
  0 siblings, 1 reply; 16+ messages in thread
From: Andrey Smirnov @ 2016-06-24 19:14 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Dirk Behme, Rob Herring, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Oleksij Rempel

On Fri, Jun 24, 2016 at 12:48 AM, Alexandre Belloni
<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> On 22/06/2016 at 08:42:20 +0200, Dirk Behme wrote :
>> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>>
>> ... and Epson RX8900 real time clock
>>
>> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> ---
>>  .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++++++++++++++
>>  1 file changed, 22 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt
>>
>> diff --git a/Documentation/devicetree/bindings/rtc/epson,rx8900.txt b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
>> new file mode 100644
>> index 0000000..3f61e51
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
>> @@ -0,0 +1,22 @@
>> +Real Time Clock driver for:
>> +  - Epson RX8900
>> +  - Micro Crystal rv8803
>> +
>> +Required properties:
>> +- compatible: should be: "microcrystal,rv8803" or "epson,rx8900"
>> +- reg : the I2C address of the device for I2C
>> +
>> +Optional properties:
>> +- epson,vdet-disable : boolean, if present will disable voltage detector.
>> +  Should be set if no backup battery is used.
>
> I guess we need to make that one generic. I would use
> voltage-detection-disable.
>
> Andrey, can you use that one instead of
> dallas,disable-oscillator-stop-flag ?
>

AFAIU from reading RX8900 datasheet, it has two power rails main and a
backup one, so setting this property disables circuitry responsible
for detecting main power rail failure and switching to a backup one.

DS1341 has only one power rail and setting
"dallas,disable-oscillator-stop-flag" will disable circuitry
responsible for detection of failure of the oscillator ticking its
internal clock.

IMHO, those functionalities don't have much in common and using the
same property would be confusing for users of that binding on DS1341,
but it's a boolean so there's not technical reason I couldn't.

Thanks,
Andrey Smirnov

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803
  2016-06-24 19:14           ` Andrey Smirnov
@ 2016-06-29  4:34             ` fixed-term.Oleksij.Rempel
       [not found]               ` <57734FF2.7070208-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: fixed-term.Oleksij.Rempel @ 2016-06-29  4:34 UTC (permalink / raw)
  To: Andrey Smirnov, Alexandre Belloni
  Cc: Dirk Behme, Rob Herring, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA



On 24.06.2016 21:14, Andrey Smirnov wrote:
> On Fri, Jun 24, 2016 at 12:48 AM, Alexandre Belloni
> <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> On 22/06/2016 at 08:42:20 +0200, Dirk Behme wrote :
>>> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>>>
>>> ... and Epson RX8900 real time clock
>>>
>>> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> ---
>>>  .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++++++++++++++
>>>  1 file changed, 22 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/rtc/epson,rx8900.txt b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
>>> new file mode 100644
>>> index 0000000..3f61e51
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
>>> @@ -0,0 +1,22 @@
>>> +Real Time Clock driver for:
>>> +  - Epson RX8900
>>> +  - Micro Crystal rv8803
>>> +
>>> +Required properties:
>>> +- compatible: should be: "microcrystal,rv8803" or "epson,rx8900"
>>> +- reg : the I2C address of the device for I2C
>>> +
>>> +Optional properties:
>>> +- epson,vdet-disable : boolean, if present will disable voltage detector.
>>> +  Should be set if no backup battery is used.
>>
>> I guess we need to make that one generic. I would use
>> voltage-detection-disable.
>>
>> Andrey, can you use that one instead of
>> dallas,disable-oscillator-stop-flag ?
>>
> 
> AFAIU from reading RX8900 datasheet, it has two power rails main and a
> backup one, so setting this property disables circuitry responsible
> for detecting main power rail failure and switching to a backup one.
> 
> DS1341 has only one power rail and setting
> "dallas,disable-oscillator-stop-flag" will disable circuitry
> responsible for detection of failure of the oscillator ticking its
> internal clock.
> 
> IMHO, those functionalities don't have much in common and using the
> same property would be confusing for users of that binding on DS1341,
> but it's a boolean so there's not technical reason I couldn't.

Should i still replace epson,vdet-disable to voltage-detection-disable?

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree
       [not found]         ` <20160624074407.GJ5809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
@ 2016-06-29  4:35           ` fixed-term.Oleksij.Rempel
       [not found]             ` <57734FFB.4000104-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: fixed-term.Oleksij.Rempel @ 2016-06-29  4:35 UTC (permalink / raw)
  To: Alexandre Belloni, Dirk Behme
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Carsten Resch



On 24.06.2016 09:44, Alexandre Belloni wrote:
> On 22/06/2016 at 08:42:22 +0200, Dirk Behme wrote :
>> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>>
>> There might be designs where the power supply circuit is designed
>> in a way that VDETOFF and SWOFF is reuqired to be set. Otherwise the
>> RTC detects a power loss. Add a device tree interface for this.
>>
>> Signed-off-by: Carsten Resch <Carsten.Resch-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>> Signed-off-by: Dirk Behme <dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> ---
>>  drivers/rtc/rtc-rv8803.c | 39 +++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
>> index e122b51..32a5686 100644
>> --- a/drivers/rtc/rtc-rv8803.c
>> +++ b/drivers/rtc/rtc-rv8803.c
>> @@ -50,6 +50,10 @@
>>  #define RV8803_CTRL_TIE			BIT(4)
>>  #define RV8803_CTRL_UIE			BIT(5)
>>  
>> +#define RX8900_BACKUP_CTRL		0x18
>> +#define RX8900_FLAG_SWOFF		BIT(2)
>> +#define RX8900_FLAG_VDETOFF		BIT(3)
>> +
>>  struct rv8803_data {
>>  	struct i2c_client *client;
>>  	struct rtc_device *rtc;
>> @@ -423,6 +427,35 @@ static struct rtc_class_ops rv8803_rtc_ops = {
>>  	.ioctl = rv8803_ioctl,
>>  };
>>  
>> +static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
>> +{
>> +	struct i2c_client *client = rv8803->client;
>> +	struct device_node *node = client->dev.of_node;
>> +	int err;
>> +	u8 flags;
>> +
>> +	if (!node)
>> +		return 0;
>> +
>> +	if (!of_device_is_compatible(node, "epson,rx8900"))
>> +		return 0;
>> +
> 
> Can you use the i2c_device_id instead of of_device_is_compatible to
> avoid matching on yet another string?

Sure, ... is it possible that device tree defines rx8900 but i2c will
detect rv8803?
I assume it is potential source of errors. What would be better way to
handle it?

-- 
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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree
       [not found]             ` <57734FFB.4000104-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-29  8:02               ` Alexandre Belloni
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2016-06-29  8:02 UTC (permalink / raw)
  To: fixed-term.Oleksij.Rempel
  Cc: Dirk Behme, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Carsten Resch

On 29/06/2016 at 06:35:07 +0200, fixed-term.Oleksij.Rempel wrote :
> 
> 
> On 24.06.2016 09:44, Alexandre Belloni wrote:
> > On 22/06/2016 at 08:42:22 +0200, Dirk Behme wrote :
> >> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> >>
> >> There might be designs where the power supply circuit is designed
> >> in a way that VDETOFF and SWOFF is reuqired to be set. Otherwise the
> >> RTC detects a power loss. Add a device tree interface for this.
> >>
> >> Signed-off-by: Carsten Resch <Carsten.Resch-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> >> Signed-off-by: Dirk Behme <dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> >> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> >> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >> ---
> >>  drivers/rtc/rtc-rv8803.c | 39 +++++++++++++++++++++++++++++++++++++++
> >>  1 file changed, 39 insertions(+)
> >>
> >> diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
> >> index e122b51..32a5686 100644
> >> --- a/drivers/rtc/rtc-rv8803.c
> >> +++ b/drivers/rtc/rtc-rv8803.c
> >> @@ -50,6 +50,10 @@
> >>  #define RV8803_CTRL_TIE			BIT(4)
> >>  #define RV8803_CTRL_UIE			BIT(5)
> >>  
> >> +#define RX8900_BACKUP_CTRL		0x18
> >> +#define RX8900_FLAG_SWOFF		BIT(2)
> >> +#define RX8900_FLAG_VDETOFF		BIT(3)
> >> +
> >>  struct rv8803_data {
> >>  	struct i2c_client *client;
> >>  	struct rtc_device *rtc;
> >> @@ -423,6 +427,35 @@ static struct rtc_class_ops rv8803_rtc_ops = {
> >>  	.ioctl = rv8803_ioctl,
> >>  };
> >>  
> >> +static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
> >> +{
> >> +	struct i2c_client *client = rv8803->client;
> >> +	struct device_node *node = client->dev.of_node;
> >> +	int err;
> >> +	u8 flags;
> >> +
> >> +	if (!node)
> >> +		return 0;
> >> +
> >> +	if (!of_device_is_compatible(node, "epson,rx8900"))
> >> +		return 0;
> >> +
> > 
> > Can you use the i2c_device_id instead of of_device_is_compatible to
> > avoid matching on yet another string?
> 
> Sure, ... is it possible that device tree defines rx8900 but i2c will
> detect rv8803?

There is no detection in i2c, it will use the compatible strng to pass
the correct i2c_device_id.

> I assume it is potential source of errors. What would be better way to
> handle it?

i2c is doing the right thing, you just have to use the i2c_device_id.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803
       [not found]               ` <57734FF2.7070208-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
@ 2016-06-29  8:03                 ` Alexandre Belloni
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2016-06-29  8:03 UTC (permalink / raw)
  To: fixed-term.Oleksij.Rempel
  Cc: Andrey Smirnov, Dirk Behme, Rob Herring,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On 29/06/2016 at 06:34:58 +0200, fixed-term.Oleksij.Rempel wrote :
> 
> 
> On 24.06.2016 21:14, Andrey Smirnov wrote:
> > On Fri, Jun 24, 2016 at 12:48 AM, Alexandre Belloni
> > <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> >> On 22/06/2016 at 08:42:20 +0200, Dirk Behme wrote :
> >>> From: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> >>>
> >>> ... and Epson RX8900 real time clock
> >>>
> >>> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
> >>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >>> ---
> >>>  .../devicetree/bindings/rtc/epson,rx8900.txt       | 22 ++++++++++++++++++++++
> >>>  1 file changed, 22 insertions(+)
> >>>  create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx8900.txt
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/rtc/epson,rx8900.txt b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
> >>> new file mode 100644
> >>> index 0000000..3f61e51
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/rtc/epson,rx8900.txt
> >>> @@ -0,0 +1,22 @@
> >>> +Real Time Clock driver for:
> >>> +  - Epson RX8900
> >>> +  - Micro Crystal rv8803
> >>> +
> >>> +Required properties:
> >>> +- compatible: should be: "microcrystal,rv8803" or "epson,rx8900"
> >>> +- reg : the I2C address of the device for I2C
> >>> +
> >>> +Optional properties:
> >>> +- epson,vdet-disable : boolean, if present will disable voltage detector.
> >>> +  Should be set if no backup battery is used.
> >>
> >> I guess we need to make that one generic. I would use
> >> voltage-detection-disable.
> >>
> >> Andrey, can you use that one instead of
> >> dallas,disable-oscillator-stop-flag ?
> >>
> > 
> > AFAIU from reading RX8900 datasheet, it has two power rails main and a
> > backup one, so setting this property disables circuitry responsible
> > for detecting main power rail failure and switching to a backup one.
> > 
> > DS1341 has only one power rail and setting
> > "dallas,disable-oscillator-stop-flag" will disable circuitry
> > responsible for detection of failure of the oscillator ticking its
> > internal clock.
> > 
> > IMHO, those functionalities don't have much in common and using the
> > same property would be confusing for users of that binding on DS1341,
> > but it's a boolean so there's not technical reason I couldn't.
> 
> Should i still replace epson,vdet-disable to voltage-detection-disable?

No, Andrey is right.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android 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/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-06-29  8:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-22  6:42 [PATCH v2 0/4] add device tree support for rtc-rv8803 Dirk Behme
     [not found] ` <1466577742-18824-1-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-22  6:42   ` [PATCH v2 1/4] devicetree: Add Micro Crystal AG vendor id Dirk Behme
     [not found]     ` <1466577742-18824-2-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-24  7:00       ` Alexandre Belloni
2016-06-24 15:43       ` Rob Herring
2016-06-22  6:42   ` [PATCH v2 2/4] dt/bindings: Add bindings for Micro Crystal rv8803 Dirk Behme
     [not found]     ` <1466577742-18824-3-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-24  7:48       ` Alexandre Belloni
     [not found]         ` <20160624074849.GK5809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2016-06-24 19:14           ` Andrey Smirnov
2016-06-29  4:34             ` fixed-term.Oleksij.Rempel
     [not found]               ` <57734FF2.7070208-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-29  8:03                 ` Alexandre Belloni
2016-06-24 15:44       ` Rob Herring
2016-06-22  6:42   ` [PATCH v2 3/4] rtc: rv8803: add device tree compatible names Dirk Behme
     [not found]     ` <1466577742-18824-4-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-24  7:00       ` Alexandre Belloni
2016-06-22  6:42   ` [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree Dirk Behme
     [not found]     ` <1466577742-18824-5-git-send-email-dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-24  7:44       ` Alexandre Belloni
     [not found]         ` <20160624074407.GJ5809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2016-06-29  4:35           ` fixed-term.Oleksij.Rempel
     [not found]             ` <57734FFB.4000104-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2016-06-29  8:02               ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).