public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] rtc: tegra: Add ACPI support
@ 2025-10-22  6:36 Kartik Rajput
  2025-10-22 17:08 ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Kartik Rajput @ 2025-10-22  6:36 UTC (permalink / raw)
  To: alexandre.belloni, thierry.reding, jonathanh, andriy.shevchenko,
	linux-rtc, linux-tegra, linux-kernel
  Cc: Kartik Rajput

Add ACPI support for Tegra RTC, which is available on Tegra241 and
Tegra410. Both Tegra241 and Tegra410 use the same ACPI ID 'NVDA0280'.
The RTC clock is configured by UEFI before the kernel boots.

Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
---
v1 -> v2:
	* Dropped "linux/acpi.h" from includes.
	* Dropped redundant ', 0' part from tegra_rtc_acpi_match.
	* Replaced "is_of_node(dev_fwnode(&pdev->dev))" with
	  "dev_of_node(&pdev->dev)" to check device of node.
	* Dropped redundant of_node checks before accessing clock
	  related APIs.
---
 drivers/rtc/rtc-tegra.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 46788db89953..a34f0c80fc37 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -274,6 +274,12 @@ static const struct of_device_id tegra_rtc_dt_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match);
 
+static const struct acpi_device_id tegra_rtc_acpi_match[] = {
+	{ "NVDA0280" },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, tegra_rtc_acpi_match);
+
 static int tegra_rtc_probe(struct platform_device *pdev)
 {
 	struct tegra_rtc_info *info;
@@ -300,9 +306,11 @@ static int tegra_rtc_probe(struct platform_device *pdev)
 	info->rtc->ops = &tegra_rtc_ops;
 	info->rtc->range_max = U32_MAX;
 
-	info->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(info->clk))
-		return PTR_ERR(info->clk);
+	if (dev_of_node(&pdev->dev)) {
+		info->clk = devm_clk_get(&pdev->dev, NULL);
+		if (IS_ERR(info->clk))
+			return PTR_ERR(info->clk);
+	}
 
 	ret = clk_prepare_enable(info->clk);
 	if (ret < 0)
@@ -404,6 +412,7 @@ static struct platform_driver tegra_rtc_driver = {
 	.driver = {
 		.name = "tegra_rtc",
 		.of_match_table = tegra_rtc_dt_match,
+		.acpi_match_table = tegra_rtc_acpi_match,
 		.pm = &tegra_rtc_pm_ops,
 	},
 };
-- 
2.43.0


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

end of thread, other threads:[~2025-10-23  9:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22  6:36 [PATCH v2] rtc: tegra: Add ACPI support Kartik Rajput
2025-10-22 17:08 ` Andy Shevchenko
2025-10-23  6:44   ` Kartik Rajput
2025-10-23  7:35     ` Andy Shevchenko
2025-10-23  9:32       ` Kartik Rajput

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox