[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2024112715321236991788@mail.local>
Date: Wed, 27 Nov 2024 16:32:12 +0100
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Ciprian Marian Costea <ciprianmarian.costea@....nxp.com>
Cc: Frank Li <Frank.li@....com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, linux-rtc@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev,
NXP S32 Linux <s32@....com>, Christophe Lizzi <clizzi@...hat.com>,
Alberto Ruiz <aruizrui@...hat.com>,
Enric Balletbo <eballetb@...hat.com>,
Bogdan Hamciuc <bogdan.hamciuc@....com>,
Ghennadi Procopciuc <Ghennadi.Procopciuc@....com>
Subject: Re: [PATCH v5 2/4] rtc: s32g: add NXP S32G2/S32G3 SoC support
On 27/11/2024 17:07:48+0200, Ciprian Marian Costea wrote:
> > > + if (priv->dt_irq_id < 0)
> > > + return priv->dt_irq_id;
> > > +
> > > + ret = devm_request_irq(dev, priv->dt_irq_id,
> > > + s32g_rtc_handler, 0, dev_name(dev), pdev);
> > > + if (ret) {
> > > + dev_err(dev, "Request interrupt %d failed, error: %d\n",
> > > + priv->dt_irq_id, ret);
> > > + goto disable_rtc;
> >
> >
> > Already enable rtc at rtc_clk_src_setup(), you direct return fail after
> > check clk_get_rate();
> >
> > if you want to disable_rtc, you use devm_add_action_or_reset() to add
> > a disable action callback and return dev_err_probe() here directly.
> >
> > Frank
> >
>
> Thanks for pointing this out. I will use 'devm_add_action_or_reset' in V6.
>
Won't this disable the RTC on driver unload which we already discussed
should not be done?
> > > + /* Reset RTC to prevent overflow.
> > > + * RTCCNT (RTC Counter) cannot be individually reset
> > > + * since it is RO (read-only).
> > > + */
> >
> > what's happen if overflow happen? I suppose it should go back to 0 and
> > continue increase?
> >
>
> Indeed if overflow happens the 'RTCCNT' counter goes back to 0 and continues
> to increase. The reason for resetting it here in 'suspend' routine comes
> after dropping the rollover support (as agreed on V4 of this patchset) to
> prevent an overflow during the standby state.
>
I don't think the overflow matters as the comparator should continue to work
properly after it happens so you always have the complete range to wait
for the alarm to happen.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists