From 61598093bbdd283a7edc367d900f223070ead8d2 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Fri, 10 May 2024 07:43:03 +0000 Subject: [PATCH] add ax88772C AX88772C_eeprom_tools --- kernel/drivers/rtc/rtc-tps65910.c | 39 +++++++++++++++++++-------------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/kernel/drivers/rtc/rtc-tps65910.c b/kernel/drivers/rtc/rtc-tps65910.c index 9f10af7..6eec86b 100644 --- a/kernel/drivers/rtc/rtc-tps65910.c +++ b/kernel/drivers/rtc/rtc-tps65910.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * rtc-tps65910.c -- TPS65910 Real Time Clock interface * @@ -7,11 +8,6 @@ * Based on original TI driver rtc-twl.c * Copyright (C) 2007 MontaVista Software, Inc * Author: Alexandre Rusev <source@mvista.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. */ #include <linux/kernel.h> @@ -147,7 +143,7 @@ struct tps65910 *tps = dev_get_drvdata(dev->parent); int ret; - ret = regmap_bulk_read(tps->regmap, TPS65910_SECONDS, alarm_data, + ret = regmap_bulk_read(tps->regmap, TPS65910_ALARM_SECONDS, alarm_data, NUM_TIME_REGS); if (ret < 0) { dev_err(dev, "rtc_read_alarm error %d\n", ret); @@ -365,6 +361,13 @@ .set_offset = tps65910_set_offset, }; +static const struct rtc_class_ops tps65910_rtc_ops_noirq = { + .read_time = tps65910_rtc_read_time, + .set_time = tps65910_rtc_set_time, + .read_offset = tps65910_read_offset, + .set_offset = tps65910_set_offset, +}; + static int tps65910_rtc_probe(struct platform_device *pdev) { struct tps65910 *tps65910 = NULL; @@ -418,24 +421,20 @@ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, tps65910_rtc_interrupt, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), &pdev->dev); - if (ret < 0) { - dev_err(&pdev->dev, "IRQ is not free.\n"); - return ret; - } - tps_rtc->irq = irq; - device_set_wakeup_capable(&pdev->dev, 1); + if (ret < 0) + irq = -1; - tps_rtc->rtc->ops = &tps65910_rtc_ops; + tps_rtc->irq = irq; + if (irq != -1) { + device_set_wakeup_capable(&pdev->dev, 1); + tps_rtc->rtc->ops = &tps65910_rtc_ops; + } else + tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq; + tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099; - ret = rtc_register_device(tps_rtc->rtc); - if (ret) { - dev_err(&pdev->dev, "RTC device register: err %d\n", ret); - return ret; - } - - return 0; + return rtc_register_device(tps_rtc->rtc); } #ifdef CONFIG_PM_SLEEP -- Gitblit v1.6.2