* [PATCH] rtc: pcf2127: align power management configuration
@ 2025-05-26 16:12 Giampiero Baggiani
2025-05-26 19:39 ` Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: Giampiero Baggiani @ 2025-05-26 16:12 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Giampiero Baggiani, linux-rtc, linux-kernel
The PCF2131 comes with the following default settings:
- battery switch-over function is disabled;
- battery low detection function is disabled.
These defaults differ from those of other models supported by this driver.
This commit aligns the behavior across all supported models, configuring
them to the settings typically expected from an RTC.
Signed-off-by: Giampiero Baggiani <giampiero@sferalabs.cc>
---
drivers/rtc/rtc-pcf2127.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 31c7dca8f469..cbdf7f23e6a6 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1312,8 +1312,15 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
* Clear battery interrupt flags which can block new trigger events.
* Note: This is the default chip behaviour but added to ensure
* correct tamper timestamp and interrupt function.
+ *
+ * Power management functions set to:
+ * - battery switch-over function is enabled in standard mode;
+ * - battery low detection function is enabled;
+ * - extra power fail detection function is enabled.
+ * Note: This is the default configuration except for pcf2131.
*/
ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
+ PCF2127_CTRL3_PM |
PCF2127_BIT_CTRL3_BTSE |
PCF2127_BIT_CTRL3_BIE |
PCF2127_BIT_CTRL3_BLIE, 0);
--
2.39.2 (Apple Git-143)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: pcf2127: align power management configuration
2025-05-26 16:12 [PATCH] rtc: pcf2127: align power management configuration Giampiero Baggiani
@ 2025-05-26 19:39 ` Alexandre Belloni
2025-05-27 8:22 ` Giampiero Baggiani
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2025-05-26 19:39 UTC (permalink / raw)
To: Giampiero Baggiani; +Cc: linux-rtc, linux-kernel
On 26/05/2025 18:12:34+0200, Giampiero Baggiani wrote:
> The PCF2131 comes with the following default settings:
> - battery switch-over function is disabled;
> - battery low detection function is disabled.
> These defaults differ from those of other models supported by this driver.
>
> This commit aligns the behavior across all supported models, configuring
> them to the settings typically expected from an RTC.
We can't do that as this is going to break existing users as they may rely on
the current behaviour and the configuration is persistent across reboots.
>
> Signed-off-by: Giampiero Baggiani <giampiero@sferalabs.cc>
> ---
> drivers/rtc/rtc-pcf2127.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> index 31c7dca8f469..cbdf7f23e6a6 100644
> --- a/drivers/rtc/rtc-pcf2127.c
> +++ b/drivers/rtc/rtc-pcf2127.c
> @@ -1312,8 +1312,15 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
> * Clear battery interrupt flags which can block new trigger events.
> * Note: This is the default chip behaviour but added to ensure
> * correct tamper timestamp and interrupt function.
> + *
> + * Power management functions set to:
> + * - battery switch-over function is enabled in standard mode;
> + * - battery low detection function is enabled;
> + * - extra power fail detection function is enabled.
> + * Note: This is the default configuration except for pcf2131.
> */
> ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
> + PCF2127_CTRL3_PM |
> PCF2127_BIT_CTRL3_BTSE |
> PCF2127_BIT_CTRL3_BIE |
> PCF2127_BIT_CTRL3_BLIE, 0);
> --
> 2.39.2 (Apple Git-143)
>
--
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: pcf2127: align power management configuration
2025-05-26 19:39 ` Alexandre Belloni
@ 2025-05-27 8:22 ` Giampiero Baggiani
0 siblings, 0 replies; 3+ messages in thread
From: Giampiero Baggiani @ 2025-05-27 8:22 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel
Thank you for the prompt feedback Alexandre.
On Mon, May 26, 2025 at 9:39 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> On 26/05/2025 18:12:34+0200, Giampiero Baggiani wrote:
> > The PCF2131 comes with the following default settings:
> > - battery switch-over function is disabled;
> > - battery low detection function is disabled.
> > These defaults differ from those of other models supported by this driver.
> >
> > This commit aligns the behavior across all supported models, configuring
> > them to the settings typically expected from an RTC.
>
> We can't do that as this is going to break existing users as they may rely on
> the current behaviour and the configuration is persistent across reboots.
Would it be ok to use a "backup-switchover-mode" device property?
I guess a "battery-low-detection" property will be needed too, which
would also fix the current issue of BLD config lost when switching
between BSMs.
Thank you.
>
> >
> > Signed-off-by: Giampiero Baggiani <giampiero@sferalabs.cc>
> > ---
> > drivers/rtc/rtc-pcf2127.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> > index 31c7dca8f469..cbdf7f23e6a6 100644
> > --- a/drivers/rtc/rtc-pcf2127.c
> > +++ b/drivers/rtc/rtc-pcf2127.c
> > @@ -1312,8 +1312,15 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
> > * Clear battery interrupt flags which can block new trigger events.
> > * Note: This is the default chip behaviour but added to ensure
> > * correct tamper timestamp and interrupt function.
> > + *
> > + * Power management functions set to:
> > + * - battery switch-over function is enabled in standard mode;
> > + * - battery low detection function is enabled;
> > + * - extra power fail detection function is enabled.
> > + * Note: This is the default configuration except for pcf2131.
> > */
> > ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
> > + PCF2127_CTRL3_PM |
> > PCF2127_BIT_CTRL3_BTSE |
> > PCF2127_BIT_CTRL3_BIE |
> > PCF2127_BIT_CTRL3_BLIE, 0);
> > --
> > 2.39.2 (Apple Git-143)
> >
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
Giampiero Baggiani
Sfera Labs - www.sferalabs.cc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-27 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26 16:12 [PATCH] rtc: pcf2127: align power management configuration Giampiero Baggiani
2025-05-26 19:39 ` Alexandre Belloni
2025-05-27 8:22 ` Giampiero Baggiani
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).