devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers rtc-pcf8523.c: add "clockout-disable" property
@ 2025-09-26  9:10 Rodolfo Giometti
  2025-10-02  1:59 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Rodolfo Giometti @ 2025-09-26  9:10 UTC (permalink / raw)
  To: linux-rtc, devicetree
  Cc: Alexandre Belloni, Rob Herring, Conor Dooley, Sam Ravnborg,
	Rodolfo Giometti

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(-)

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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers rtc-pcf8523.c: add "clockout-disable" property
  2025-09-26  9:10 [PATCH] drivers rtc-pcf8523.c: add "clockout-disable" property Rodolfo Giometti
@ 2025-10-02  1:59 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2025-10-02  1:59 UTC (permalink / raw)
  To: Rodolfo Giometti
  Cc: linux-rtc, devicetree, Alexandre Belloni, Conor Dooley,
	Sam Ravnborg

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-02  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26  9:10 [PATCH] drivers rtc-pcf8523.c: add "clockout-disable" property Rodolfo Giometti
2025-10-02  1:59 ` Rob Herring

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).