* [PATCH] rtc: pcf85063: disable the clkout output by default
@ 2026-08-24 8:07 A. Sverdlin
2026-08-24 8:24 ` Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: A. Sverdlin @ 2026-08-24 8:07 UTC (permalink / raw)
To: linux-rtc; +Cc: Alexander Sverdlin, Alexandre Belloni, linux-kernel
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
The PCF85063 powers up with its CLKOUT pin driving the 32.768 kHz. While
it's possible to request a specific default frequency in the DT via
assigned-clocks/assigned-clock-rates on the RTC node itself, even without
a real consumer referencing the clock, there is no such possibility to
disable the clock output by default.
Therefore gate CLKOUT in the driver before registering the OF provider,
mirroring the pcf8563 and hym8563 siblings which already force an off state
at registration. Doing it before devm_of_clk_add_hw_provider() leaves the
real consumers in the device tree free to re-enable the output afterwards,
while an otherwise unused CLKOUT now stays off.
In practice it means that with CLKOUT disabled the RTC consumes around
250nA at 25°C and 6-10uA with CLKOUT enabled (5v Vdd). Which means days vs
hours on a supercapacitor.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
drivers/rtc/rtc-pcf85063.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 01e209d88f5f3..0b6d8083b6456 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -523,6 +523,12 @@ static struct clk *pcf85063_clkout_register_clk(struct pcf85063 *pcf85063)
/* optional override of the clockname */
of_property_read_string(node, "clock-output-names", &init.name);
+ /* power-on default is the 32768 Hz output on; gate it until claimed */
+ ret = regmap_update_bits(pcf85063->regmap, PCF85063_REG_CTRL2,
+ PCF85063_REG_CLKO_F_MASK, PCF85063_REG_CLKO_F_OFF);
+ if (ret)
+ return ret;
+
/* register the clock */
clk = devm_clk_register(&pcf85063->rtc->dev, &pcf85063->clkout_hw);
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: pcf85063: disable the clkout output by default
2026-08-24 8:07 [PATCH] rtc: pcf85063: disable the clkout output by default A. Sverdlin
@ 2026-08-24 8:24 ` Alexandre Belloni
2026-08-24 9:58 ` Sverdlin, Alexander
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2026-08-24 8:24 UTC (permalink / raw)
To: A. Sverdlin; +Cc: linux-rtc, linux-kernel
On 24/08/2026 10:07:59+0200, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
>
> The PCF85063 powers up with its CLKOUT pin driving the 32.768 kHz. While
> it's possible to request a specific default frequency in the DT via
> assigned-clocks/assigned-clock-rates on the RTC node itself, even without
> a real consumer referencing the clock, there is no such possibility to
> disable the clock output by default.
Are you sure about this? The CCF should disable the clock if it is not
used.
>
> Therefore gate CLKOUT in the driver before registering the OF provider,
> mirroring the pcf8563 and hym8563 siblings which already force an off state
> at registration. Doing it before devm_of_clk_add_hw_provider() leaves the
> real consumers in the device tree free to re-enable the output afterwards,
> while an otherwise unused CLKOUT now stays off.
>
> In practice it means that with CLKOUT disabled the RTC consumes around
> 250nA at 25°C and 6-10uA with CLKOUT enabled (5v Vdd). Which means days vs
> hours on a supercapacitor.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
> drivers/rtc/rtc-pcf85063.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
> index 01e209d88f5f3..0b6d8083b6456 100644
> --- a/drivers/rtc/rtc-pcf85063.c
> +++ b/drivers/rtc/rtc-pcf85063.c
> @@ -523,6 +523,12 @@ static struct clk *pcf85063_clkout_register_clk(struct pcf85063 *pcf85063)
> /* optional override of the clockname */
> of_property_read_string(node, "clock-output-names", &init.name);
>
> + /* power-on default is the 32768 Hz output on; gate it until claimed */
> + ret = regmap_update_bits(pcf85063->regmap, PCF85063_REG_CTRL2,
> + PCF85063_REG_CLKO_F_MASK, PCF85063_REG_CLKO_F_OFF);
> + if (ret)
> + return ret;
> +
> /* register the clock */
> clk = devm_clk_register(&pcf85063->rtc->dev, &pcf85063->clkout_hw);
>
> --
> 2.55.0
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: pcf85063: disable the clkout output by default
2026-08-24 8:24 ` Alexandre Belloni
@ 2026-08-24 9:58 ` Sverdlin, Alexander
0 siblings, 0 replies; 3+ messages in thread
From: Sverdlin, Alexander @ 2026-08-24 9:58 UTC (permalink / raw)
To: alexandre.belloni; +Cc: linux-rtc, linux-kernel
Hi Alexandre,
On Mon, 2026-08-24 at 10:24 +0200, Alexandre Belloni wrote:
> > From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> >
> > The PCF85063 powers up with its CLKOUT pin driving the 32.768 kHz. While
> > it's possible to request a specific default frequency in the DT via
> > assigned-clocks/assigned-clock-rates on the RTC node itself, even without
> > a real consumer referencing the clock, there is no such possibility to
> > disable the clock output by default.
>
> Are you sure about this? The CCF should disable the clock if it is not
> used.
There is late_initcall_sync(clk_disable_unused) (marked __init), but for the
clock providers registered later, say, via modules, there is no such mechanism.
And I double-checked this putting some debug prints into the driver,
nothing from struct clk_ops is being called without a consumer in DT.
> > Therefore gate CLKOUT in the driver before registering the OF provider,
> > mirroring the pcf8563 and hym8563 siblings which already force an off state
> > at registration. Doing it before devm_of_clk_add_hw_provider() leaves the
> > real consumers in the device tree free to re-enable the output afterwards,
> > while an otherwise unused CLKOUT now stays off.
> >
> > In practice it means that with CLKOUT disabled the RTC consumes around
> > 250nA at 25°C and 6-10uA with CLKOUT enabled (5v Vdd). Which means days vs
> > hours on a supercapacitor.
> >
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> > ---
> > drivers/rtc/rtc-pcf85063.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
> > index 01e209d88f5f3..0b6d8083b6456 100644
> > --- a/drivers/rtc/rtc-pcf85063.c
> > +++ b/drivers/rtc/rtc-pcf85063.c
> > @@ -523,6 +523,12 @@ static struct clk *pcf85063_clkout_register_clk(struct pcf85063 *pcf85063)
> > /* optional override of the clockname */
> > of_property_read_string(node, "clock-output-names", &init.name);
> >
> > + /* power-on default is the 32768 Hz output on; gate it until claimed */
> > + ret = regmap_update_bits(pcf85063->regmap, PCF85063_REG_CTRL2,
> > + PCF85063_REG_CLKO_F_MASK, PCF85063_REG_CLKO_F_OFF);
> > + if (ret)
> > + return ret;
> > +
> > /* register the clock */
> > clk = devm_clk_register(&pcf85063->rtc->dev, &pcf85063->clkout_hw);
> >
> > --
> > 2.55.0
> >
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-24 9:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-24 8:07 [PATCH] rtc: pcf85063: disable the clkout output by default A. Sverdlin
2026-08-24 8:24 ` Alexandre Belloni
2026-08-24 9:58 ` Sverdlin, Alexander
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®