linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: Tony Lindgren <tony@atomide.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2] rtc: cpcap: new rtc driver
Date: Wed, 22 Feb 2017 09:18:05 +0100	[thread overview]
Message-ID: <20170222081805.ap2yvarymlr5vvjo@piout.net> (raw)
In-Reply-To: <20170222015634.ugadzezywlrjduyx@earth>

On 22/02/2017 at 02:56:34 +0100, Sebastian Reichel wrote:
> > Does this mean there is a race condition?
> 
> The logic (incl. comments) in this section are from the vendor
> kernel driver and there is no documentation for CPCAP as far as
> I know. I don't know if the hardware has logic to prevent a race
> condition for the cpcap_tm.tod1 == 255 case.
> 

That's fine, I was just curious :)

> > > +	err = cpcap_get_vendor(dev, rtc->regmap, &rtc->vendor);
> > I think this means it depends on the mfd tree.
> 
> Yes, but cpcap_get_vendor should get into mainline with the
> 4.11 mfd pull request. So if you base your 4.12 for-next tree
> on 4.11-rc1 everything should be fine.
> 

OK, I'll take it for 4.12 then

> > > +	if (err)
> > > +		return err;
> > > +
> > > +	rtc->alarm_irq= platform_get_irq(pdev, 0);
> > > +	err = devm_request_threaded_irq(dev, rtc->alarm_irq, NULL,
> > > +					cpcap_rtc_alarm_irq, IRQ_NONE,
> > > +					"rtc_alarm", rtc);
> > > +	if (err) {
> > > +		dev_err(dev, "Could not request alarm irq: %d\n", err);
> > > +		return err;
> > > +	}
> > > +	disable_irq(rtc->alarm_irq);
> > > +
> > > +	rtc->update_irq= platform_get_irq(pdev, 1);
> > > +	err = devm_request_threaded_irq(dev, rtc->update_irq, NULL,
> > > +					cpcap_rtc_update_irq, IRQ_NONE,
> > > +					"rtc_1hz", rtc);
> 
> > I don't think this IRQ is actually useful. It doesn't really harm but
> > the tests should pass without it.
> 
> Yes. RTC works perfectly fine with just the alarm irq. It also
> works perfectly fine with just the 1 Hz irq (except for wakeup).
> 
> I would like to keep the irq in the driver, so that it's explicitly
> disabled. On Droid 4 mainline kernel is booted via kexec from
> Android (AKA bootloader) and Motorola's Android kernel uses the
> 1 Hz IRQ for some proprietary "secure clock daemon".
> 
> I will add a comment.
> 

OK, my plan was to remove all the RTC_UF users. I'll give it more
thoughts.

> > > +	if (err) {
> > > +		dev_err(dev, "Could not request update irq: %d\n", err);
> > > +		return err;
> > > +	}
> > > +	disable_irq(rtc->update_irq);
> > > +
> > > +	err = device_init_wakeup(dev, 1);
> > 
> > If you use device_init_wakeup, I think it needs to be called before
> > devm_rtc_device_register() to properly work.
> 
> I successfully tested wakeup before sending this. But in case your 
> prefer it to be called before registering the RTC I can move the
> call accordingly.
> 

Then it is fine where it is.

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

  reply	other threads:[~2017-02-22  8:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20  7:35 [PATCH 0/1] Motorola CPCAP PMIC RTC Sebastian Reichel
2017-02-20  7:35 ` [PATCH 1/1] rtc: cpcap: new rtc driver Sebastian Reichel
2017-02-20 16:31   ` Tony Lindgren
2017-02-20 16:38     ` Alexandre Belloni
2017-02-20 17:21       ` Tony Lindgren
2017-02-20 17:27         ` Tony Lindgren
2017-02-20 19:35           ` Sebastian Reichel
2017-02-21  6:16 ` [PATCHv2] " Sebastian Reichel
2017-02-21 23:52   ` Alexandre Belloni
2017-02-22  1:56     ` Sebastian Reichel
2017-02-22  8:18       ` Alexandre Belloni [this message]
2017-02-23  1:03 ` [PATCHv3 1/2] dt-bindings: Add vendor prefix for Motorola Sebastian Reichel
2017-02-23  1:03   ` [PATCHv3 2/2] rtc: cpcap: new rtc driver Sebastian Reichel
2017-02-27 23:49     ` Rob Herring
2017-02-27 23:48   ` [PATCHv3 1/2] dt-bindings: Add vendor prefix for Motorola Rob Herring
2017-03-02  0:27 ` [PATCHv4 " Sebastian Reichel
2017-03-02  0:27   ` [PATCHv4 2/2] rtc: cpcap: new rtc driver Sebastian Reichel
2017-03-02 14:11     ` Rob Herring
2017-03-09  0:34     ` Alexandre Belloni
2017-03-09  0:33   ` [PATCHv4 1/2] dt-bindings: Add vendor prefix for Motorola Alexandre Belloni

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=20170222081805.ap2yvarymlr5vvjo@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /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).