drivers/rtc/rtc-tegra.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
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>
---
drivers/rtc/rtc-tegra.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 46788db89953..40617c82070f 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -5,6 +5,7 @@
* Copyright (c) 2010-2019, NVIDIA Corporation.
*/
+#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/init.h>
@@ -274,6 +275,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", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, tegra_rtc_acpi_match);
+
static int tegra_rtc_probe(struct platform_device *pdev)
{
struct tegra_rtc_info *info;
@@ -300,13 +307,15 @@ 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 (is_of_node(dev_fwnode(&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)
- return ret;
+ ret = clk_prepare_enable(info->clk);
+ if (ret < 0)
+ return ret;
+ }
/* set context info */
info->pdev = pdev;
@@ -338,7 +347,8 @@ static int tegra_rtc_probe(struct platform_device *pdev)
return 0;
disable_clk:
- clk_disable_unprepare(info->clk);
+ if (is_of_node(dev_fwnode(&pdev->dev)))
+ clk_disable_unprepare(info->clk);
return ret;
}
@@ -346,7 +356,8 @@ static void tegra_rtc_remove(struct platform_device *pdev)
{
struct tegra_rtc_info *info = platform_get_drvdata(pdev);
- clk_disable_unprepare(info->clk);
+ if (is_of_node(dev_fwnode(&pdev->dev)))
+ clk_disable_unprepare(info->clk);
}
#ifdef CONFIG_PM_SLEEP
@@ -404,6 +415,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
Hi Kartik, kernel test robot noticed the following build errors: [auto build test ERROR on tegra/for-next] [also build test ERROR on abelloni/rtc-next linus/master v6.17-rc6 next-20250919] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kartik-Rajput/rtc-tegra-Add-ACPI-support/20250919-191553 base: https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next patch link: https://lore.kernel.org/r/20250919111232.605405-1-kkartik%40nvidia.com patch subject: [PATCH] rtc: tegra: Add ACPI support config: arm-randconfig-001-20250920 (https://download.01.org/0day-ci/archive/20250920/202509200953.uZOl24Is-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250920/202509200953.uZOl24Is-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202509200953.uZOl24Is-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/rtc/rtc-tegra.c: In function 'tegra_rtc_probe': >> drivers/rtc/rtc-tegra.c:310:13: error: implicit declaration of function 'is_of_node'; did you mean 'dev_of_node'? [-Werror=implicit-function-declaration] 310 | if (is_of_node(dev_fwnode(&pdev->dev))) { | ^~~~~~~~~~ | dev_of_node cc1: some warnings being treated as errors vim +310 drivers/rtc/rtc-tegra.c 283 284 static int tegra_rtc_probe(struct platform_device *pdev) 285 { 286 struct tegra_rtc_info *info; 287 int ret; 288 289 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 290 if (!info) 291 return -ENOMEM; 292 293 info->base = devm_platform_ioremap_resource(pdev, 0); 294 if (IS_ERR(info->base)) 295 return PTR_ERR(info->base); 296 297 ret = platform_get_irq(pdev, 0); 298 if (ret <= 0) 299 return ret; 300 301 info->irq = ret; 302 303 info->rtc = devm_rtc_allocate_device(&pdev->dev); 304 if (IS_ERR(info->rtc)) 305 return PTR_ERR(info->rtc); 306 307 info->rtc->ops = &tegra_rtc_ops; 308 info->rtc->range_max = U32_MAX; 309 > 310 if (is_of_node(dev_fwnode(&pdev->dev))) { 311 info->clk = devm_clk_get(&pdev->dev, NULL); 312 if (IS_ERR(info->clk)) 313 return PTR_ERR(info->clk); 314 315 ret = clk_prepare_enable(info->clk); 316 if (ret < 0) 317 return ret; 318 } 319 320 /* set context info */ 321 info->pdev = pdev; 322 spin_lock_init(&info->lock); 323 324 platform_set_drvdata(pdev, info); 325 326 /* clear out the hardware */ 327 writel(0, info->base + TEGRA_RTC_REG_SECONDS_ALARM0); 328 writel(0xffffffff, info->base + TEGRA_RTC_REG_INTR_STATUS); 329 writel(0, info->base + TEGRA_RTC_REG_INTR_MASK); 330 331 device_init_wakeup(&pdev->dev, true); 332 333 ret = devm_request_irq(&pdev->dev, info->irq, tegra_rtc_irq_handler, 334 IRQF_TRIGGER_HIGH, dev_name(&pdev->dev), 335 &pdev->dev); 336 if (ret) { 337 dev_err(&pdev->dev, "failed to request interrupt: %d\n", ret); 338 goto disable_clk; 339 } 340 341 ret = devm_rtc_register_device(info->rtc); 342 if (ret) 343 goto disable_clk; 344 345 dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); 346 347 return 0; 348 349 disable_clk: 350 if (is_of_node(dev_fwnode(&pdev->dev))) 351 clk_disable_unprepare(info->clk); 352 return ret; 353 } 354 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.