aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ps3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-ps3.c')
-rw-r--r--drivers/rtc/rtc-ps3.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
index 347288bff438..f0336d691e6c 100644
--- a/drivers/rtc/rtc-ps3.c
+++ b/drivers/rtc/rtc-ps3.c
@@ -1,20 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * PS3 RTC Driver 3 * PS3 RTC Driver
3 * 4 *
4 * Copyright 2009 Sony Corporation 5 * Copyright 2009 Sony Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
17 * If not, see <http://www.gnu.org/licenses/>.
18 */ 6 */
19 7
20#include <linux/kernel.h> 8#include <linux/kernel.h>
@@ -40,16 +28,13 @@ static u64 read_rtc(void)
40 28
41static int ps3_get_time(struct device *dev, struct rtc_time *tm) 29static int ps3_get_time(struct device *dev, struct rtc_time *tm)
42{ 30{
43 rtc_time_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm); 31 rtc_time64_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
44 return 0; 32 return 0;
45} 33}
46 34
47static int ps3_set_time(struct device *dev, struct rtc_time *tm) 35static int ps3_set_time(struct device *dev, struct rtc_time *tm)
48{ 36{
49 unsigned long now; 37 ps3_os_area_set_rtc_diff(rtc_tm_to_time64(tm) - read_rtc());
50
51 rtc_tm_to_time(tm, &now);
52 ps3_os_area_set_rtc_diff(now - read_rtc());
53 return 0; 38 return 0;
54} 39}
55 40
@@ -62,13 +47,16 @@ static int __init ps3_rtc_probe(struct platform_device *dev)
62{ 47{
63 struct rtc_device *rtc; 48 struct rtc_device *rtc;
64 49
65 rtc = devm_rtc_device_register(&dev->dev, "rtc-ps3", &ps3_rtc_ops, 50 rtc = devm_rtc_allocate_device(&dev->dev);
66 THIS_MODULE);
67 if (IS_ERR(rtc)) 51 if (IS_ERR(rtc))
68 return PTR_ERR(rtc); 52 return PTR_ERR(rtc);
69 53
54 rtc->ops = &ps3_rtc_ops;
55 rtc->range_max = U64_MAX;
56
70 platform_set_drvdata(dev, rtc); 57 platform_set_drvdata(dev, rtc);
71 return 0; 58
59 return rtc_register_device(rtc);
72} 60}
73 61
74static struct platform_driver ps3_rtc_driver = { 62static struct platform_driver ps3_rtc_driver = {