]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rtc: tegra: Add ACPI support
authorKartik Rajput <kkartik@nvidia.com>
Fri, 24 Oct 2025 06:49:51 +0000 (12:19 +0530)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 8 Dec 2025 21:26:42 +0000 (22:26 +0100)
Add ACPI support for Tegra RTC, which is available on Tegra241 and
Tegra410. Both Tegra241 and Tegra410 use the same ACPI ID 'NVDA0280'.
When ACPI boot is used, the RTC clock is configured by UEFI before
the kernel boots. On device-tree boot, the probe must fail if clocks are
not provided in the device-tree.

Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://patch.msgid.link/20251024064952.775883-2-kkartik@nvidia.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-tegra.c

index e8c83a6a96b30edf2c0745638b337c4a7edaba0d..9e4e9c88178f3d973cf8a2dfb99fa17504237aec 100644 (file)
@@ -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_enabled(&pdev->dev, NULL);
-       if (IS_ERR(info->clk))
-               return PTR_ERR(info->clk);
+       if (dev_of_node(&pdev->dev)) {
+               info->clk = devm_clk_get_enabled(&pdev->dev, NULL);
+               if (IS_ERR(info->clk))
+                       return PTR_ERR(info->clk);
+       }
 
        /* set context info */
        info->pdev = pdev;
@@ -386,6 +394,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,
        },
 };