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-digicolor.c | 29 +++++++++++++---------------- 1 files changed, 13 insertions(+), 16 deletions(-) diff --git a/kernel/drivers/rtc/rtc-digicolor.c b/kernel/drivers/rtc/rtc-digicolor.c index b253bf1..200d85b 100644 --- a/kernel/drivers/rtc/rtc-digicolor.c +++ b/kernel/drivers/rtc/rtc-digicolor.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Real Time Clock driver for Conexant Digicolor * * Copyright (C) 2015 Paradox Innovation Ltd. * * Author: Baruch Siach <baruch@tkos.co.il> - * - * 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/io.h> @@ -106,11 +102,11 @@ return 0; } -static int dc_rtc_set_mmss(struct device *dev, unsigned long secs) +static int dc_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct dc_rtc *rtc = dev_get_drvdata(dev); - return dc_rtc_write(rtc, secs); + return dc_rtc_write(rtc, rtc_tm_to_time64(tm)); } static int dc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) @@ -161,7 +157,7 @@ static const struct rtc_class_ops dc_rtc_ops = { .read_time = dc_rtc_read_time, - .set_mmss = dc_rtc_set_mmss, + .set_time = dc_rtc_set_time, .read_alarm = dc_rtc_read_alarm, .set_alarm = dc_rtc_set_alarm, .alarm_irq_enable = dc_rtc_alarm_irq_enable, @@ -179,7 +175,6 @@ static int __init dc_rtc_probe(struct platform_device *pdev) { - struct resource *res; struct dc_rtc *rtc; int irq, ret; @@ -187,10 +182,13 @@ if (!rtc) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - rtc->regs = devm_ioremap_resource(&pdev->dev, res); + rtc->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(rtc->regs)) return PTR_ERR(rtc->regs); + + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(rtc->rtc_dev)) + return PTR_ERR(rtc->rtc_dev); irq = platform_get_irq(pdev, 0); if (irq < 0) @@ -200,12 +198,11 @@ return ret; platform_set_drvdata(pdev, rtc); - rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name, - &dc_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc->rtc_dev)) - return PTR_ERR(rtc->rtc_dev); - return 0; + rtc->rtc_dev->ops = &dc_rtc_ops; + rtc->rtc_dev->range_max = U32_MAX; + + return rtc_register_device(rtc->rtc_dev); } static const struct of_device_id dc_dt_ids[] = { -- Gitblit v1.6.2