devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: "fixed-term.Oleksij.Rempel"
	<fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Cc: Dirk Behme <dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Carsten Resch
	<Carsten.Resch-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree
Date: Wed, 29 Jun 2016 10:02:08 +0200	[thread overview]
Message-ID: <20160629080208.GQ29249@piout.net> (raw)
In-Reply-To: <57734FFB.4000104-V5te9oGctAVWk0Htik3J/w@public.gmane.org>

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.

      parent reply	other threads:[~2016-06-29  8:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160629080208.GQ29249@piout.net \
    --to=alexandre.belloni-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=Carsten.Resch-V5te9oGctAVWk0Htik3J/w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org \
    --cc=fixed-term.Oleksij.Rempel-V5te9oGctAVWk0Htik3J/w@public.gmane.org \
    --cc=rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).