All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Support Opensource <support.opensource@diasemi.com>,
	linux-rtc@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Biju Das <biju.das.au@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH 1/6] rtc: da9063: Make IRQ as optional
Date: Fri,  1 Dec 2023 11:08:35 +0000	[thread overview]
Message-ID: <20231201110840.37408-2-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20231201110840.37408-1-biju.das.jz@bp.renesas.com>

On some platforms (eg: RZ/{G2UL,Five} SMARC EVK), there is no IRQ
populated by default. Add irq optional support.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/rtc/rtc-da9063.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
index 2f5d60622564..613ba2c5d757 100644
--- a/drivers/rtc/rtc-da9063.c
+++ b/drivers/rtc/rtc-da9063.c
@@ -485,25 +485,26 @@ static int da9063_rtc_probe(struct platform_device *pdev)
 		clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtc_dev->features);
 	}
 
-	irq_alarm = platform_get_irq_byname(pdev, "ALARM");
-	if (irq_alarm < 0)
-		return irq_alarm;
-
-	ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
-					da9063_alarm_event,
-					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-					"ALARM", rtc);
-	if (ret)
-		dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
-			irq_alarm, ret);
-
-	ret = dev_pm_set_wake_irq(&pdev->dev, irq_alarm);
-	if (ret)
-		dev_warn(&pdev->dev,
-			 "Failed to set IRQ %d as a wake IRQ: %d\n",
-			 irq_alarm, ret);
-
-	device_init_wakeup(&pdev->dev, true);
+	irq_alarm = platform_get_irq_byname_optional(pdev, "ALARM");
+	if (irq_alarm >= 0) {
+		ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
+						da9063_alarm_event,
+						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+						"ALARM", rtc);
+		if (ret)
+			dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
+				irq_alarm, ret);
+
+		ret = dev_pm_set_wake_irq(&pdev->dev, irq_alarm);
+		if (ret)
+			dev_warn(&pdev->dev,
+				 "Failed to set IRQ %d as a wake IRQ: %d\n",
+				 irq_alarm, ret);
+
+		device_init_wakeup(&pdev->dev, true);
+	} else {
+		clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtc_dev->features);
+	}
 
 	return devm_rtc_register_device(rtc->rtc_dev);
 }
-- 
2.25.1


  reply	other threads:[~2023-12-01 11:08 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 11:08 [PATCH 0/6] Add DA9062 PMIC and built-in RTC support for RZ/G2UL SMARC EVK Biju Das
2023-12-01 11:08 ` Biju Das
2023-12-01 11:08 ` Biju Das [this message]
2023-12-01 13:00   ` [PATCH 1/6] rtc: da9063: Make IRQ as optional Geert Uytterhoeven
2023-12-01 13:23     ` Biju Das
2023-12-01 11:08 ` [PATCH 2/6] rtc: da9063: Use device_get_match_data() Biju Das
2023-12-01 13:06   ` Geert Uytterhoeven
2023-12-01 11:08 ` [PATCH 3/6] rtc: da9063: Use dev_err_probe() Biju Das
2023-12-01 13:11   ` Geert Uytterhoeven
2023-12-01 13:30     ` Biju Das
2023-12-01 15:20       ` Alexandre Belloni
2023-12-01 15:43         ` Biju Das
2023-12-01 15:55           ` Alexandre Belloni
2023-12-01 16:40             ` Biju Das
2023-12-19 23:49               ` Alexandre Belloni
2023-12-19 23:56                 ` Alexandre Belloni
2024-01-04 19:31                 ` Biju Das
2023-12-01 11:08 ` [PATCH 4/6] dt-bindings: mfd: Convert da9062 to json-schema Biju Das
2023-12-01 13:33   ` Geert Uytterhoeven
2023-12-01 15:54     ` Conor Dooley
2023-12-06  5:15   ` kernel test robot
2023-12-06  9:33     ` Biju Das
2023-12-06 13:28       ` Lee Jones
2023-12-06 15:19         ` Biju Das
2023-12-08  2:21           ` Liu, Yujie
2023-12-01 11:08 ` [PATCH 5/6] arm64: dts: renesas: rzg2ul-smarc: Enable PMIC and built-in RTC Biju Das
2023-12-01 13:39   ` Geert Uytterhoeven
2023-12-01 13:48     ` Biju Das
2023-12-01 13:58       ` Geert Uytterhoeven
2023-12-01 11:08 ` [PATCH 6/6] arm64: defconfig: Enable Renesas DA9062 defconfig Biju Das
2023-12-01 11:08   ` Biju Das
2023-12-01 13:41   ` Geert Uytterhoeven
2023-12-01 13:41     ` Geert Uytterhoeven
2023-12-01 15:02     ` Biju Das
2023-12-01 15:02       ` Biju Das
2023-12-01 15:41       ` Geert Uytterhoeven
2023-12-01 15:41         ` Geert Uytterhoeven
2023-12-10  9:49         ` Biju Das
2023-12-10  9:49           ` Biju Das
2023-12-11  8:20           ` Geert Uytterhoeven
2023-12-11  8:20             ` Geert Uytterhoeven
2023-12-11  8:32             ` Biju Das
2023-12-11  8:32               ` Biju Das
2023-12-11  8:52               ` Geert Uytterhoeven
2023-12-11  8:52                 ` Geert Uytterhoeven
2023-12-11  9:00                 ` Biju Das
2023-12-11  9:00                   ` Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231201110840.37408-2-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=biju.das.au@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=support.opensource@diasemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.