diff mbox series

drivers rtc-pcf8523.c: add "clockout-disable" property

Message ID 20250926091038.2262571-1-giometti@enneenne.com
State New
Headers show
Series drivers rtc-pcf8523.c: add "clockout-disable" property | expand

Commit Message

Rodolfo Giometti Sept. 26, 2025, 9:10 a.m. UTC
Some systems may require disabling clock generation on the CLKOUT pin
even if there is no IRQ management.

Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
---
 .../devicetree/bindings/rtc/nxp,pcf8523.yaml        |  5 +++++
 drivers/rtc/rtc-pcf8523.c                           | 13 +++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

Comments

Rob Herring Oct. 2, 2025, 1:59 a.m. UTC | #1
On Fri, Sep 26, 2025 at 11:10:38AM +0200, Rodolfo Giometti wrote:
> Some systems may require disabling clock generation on the CLKOUT pin
> even if there is no IRQ management.
> 
> Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
> ---
>  .../devicetree/bindings/rtc/nxp,pcf8523.yaml        |  5 +++++

Bindings should be a separate patch.

>  drivers/rtc/rtc-pcf8523.c                           | 13 +++++++++----
>  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml
> index d11c8bc16bc0..d18c396c06cd 100644
> --- a/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml
> +++ b/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml
> @@ -25,6 +25,11 @@ properties:
>      enum: [ 7000, 12500 ]
>      default: 12500
>  
> +  clockout-disable:

Needs a vendor prefix (nxp,)

> +    type: boolean
> +    description:
> +      Disable the clock generation on CLKOUT pin.
> +
>  required:
>    - compatible
>    - reg
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml b/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml
index d11c8bc16bc0..d18c396c06cd 100644
--- a/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml
+++ b/Documentation/devicetree/bindings/rtc/nxp,pcf8523.yaml
@@ -25,6 +25,11 @@  properties:
     enum: [ 7000, 12500 ]
     default: 12500
 
+  clockout-disable:
+    type: boolean
+    description:
+      Disable the clock generation on CLKOUT pin.
+
 required:
   - compatible
   - reg
diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index 2c63c0ffd05a..7ecbee4f9c6b 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -418,6 +418,7 @@  static int pcf8523_probe(struct i2c_client *client)
 	struct pcf8523 *pcf8523;
 	struct rtc_device *rtc;
 	bool wakeup_source = false;
+	bool clockout_disable;
 	u32 value;
 	int err;
 
@@ -467,16 +468,20 @@  static int pcf8523_probe(struct i2c_client *client)
 	set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features);
 	clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features);
 
+	clockout_disable = of_property_read_bool(client->dev.of_node,
+							"clockout-disable");
+	if (client->irq > 0 || clockout_disable) {
+		err = regmap_write(pcf8523->regmap,
+						PCF8523_TMR_CLKOUT_CTRL, 0x38);
+		if (err < 0)
+			return err;
+	}
 	if (client->irq > 0) {
 		unsigned long irqflags = IRQF_TRIGGER_LOW;
 
 		if (dev_fwnode(&client->dev))
 			irqflags = 0;
 
-		err = regmap_write(pcf8523->regmap, PCF8523_TMR_CLKOUT_CTRL, 0x38);
-		if (err < 0)
-			return err;
-
 		err = devm_request_threaded_irq(&client->dev, client->irq,
 						NULL, pcf8523_irq,
 						IRQF_SHARED | IRQF_ONESHOT | irqflags,