.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for the Epson RTC module RX-6110 SA |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright(C) 2015 Pengutronix, Steffen Trumtrar <kernel@pengutronix.de> |
---|
5 | 6 | * Copyright(C) SEIKO EPSON CORPORATION 2013. All rights reserved. |
---|
6 | | - * |
---|
7 | | - * This driver software is distributed as is, without any warranty of any kind, |
---|
8 | | - * either express or implied as further specified in the GNU Public License. |
---|
9 | | - * This software may be used and distributed according to the terms of the GNU |
---|
10 | | - * Public License, version 2 as published by the Free Software Foundation. |
---|
11 | | - * See the file COPYING in the main directory of this archive for more details. |
---|
12 | | - * |
---|
13 | | - * You should have received a copy of the GNU General Public License along with |
---|
14 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | 7 | */ |
---|
16 | 8 | |
---|
17 | 9 | #include <linux/bcd.h> |
---|
.. | .. |
---|
21 | 13 | #include <linux/of_gpio.h> |
---|
22 | 14 | #include <linux/regmap.h> |
---|
23 | 15 | #include <linux/rtc.h> |
---|
| 16 | +#include <linux/of.h> |
---|
| 17 | +#include <linux/of_device.h> |
---|
24 | 18 | #include <linux/spi/spi.h> |
---|
25 | 19 | |
---|
26 | 20 | /* RX-6110 Register definitions */ |
---|
.. | .. |
---|
114 | 108 | */ |
---|
115 | 109 | static int rx6110_rtc_tm_to_data(struct rtc_time *tm, u8 *data) |
---|
116 | 110 | { |
---|
117 | | - pr_debug("%s: date %ds %dm %dh %dmd %dm %dy\n", __func__, |
---|
118 | | - tm->tm_sec, tm->tm_min, tm->tm_hour, |
---|
119 | | - tm->tm_mday, tm->tm_mon, tm->tm_year); |
---|
| 111 | + pr_debug("%s: date %ptRr\n", __func__, tm); |
---|
120 | 112 | |
---|
121 | 113 | /* |
---|
122 | 114 | * The year in the RTC is a value between 0 and 99. |
---|
.. | .. |
---|
154 | 146 | tm->tm_mon = bcd2bin(data[RTC_MONTH] & 0x1f) - 1; |
---|
155 | 147 | tm->tm_year = bcd2bin(data[RTC_YEAR]) + 100; |
---|
156 | 148 | |
---|
157 | | - pr_debug("%s: date %ds %dm %dh %dmd %dm %dy\n", __func__, |
---|
158 | | - tm->tm_sec, tm->tm_min, tm->tm_hour, |
---|
159 | | - tm->tm_mday, tm->tm_mon, tm->tm_year); |
---|
| 149 | + pr_debug("%s: date %ptRr\n", __func__, tm); |
---|
160 | 150 | |
---|
161 | 151 | /* |
---|
162 | 152 | * The year in the RTC is a value between 0 and 99. |
---|
.. | .. |
---|
248 | 238 | if (ret) |
---|
249 | 239 | return ret; |
---|
250 | 240 | |
---|
251 | | - dev_dbg(dev, "%s: date %ds %dm %dh %dmd %dm %dy\n", __func__, |
---|
252 | | - tm->tm_sec, tm->tm_min, tm->tm_hour, |
---|
253 | | - tm->tm_mday, tm->tm_mon, tm->tm_year); |
---|
| 241 | + dev_dbg(dev, "%s: date %ptRr\n", __func__, tm); |
---|
254 | 242 | |
---|
255 | 243 | return 0; |
---|
256 | 244 | } |
---|
.. | .. |
---|
374 | 362 | return 0; |
---|
375 | 363 | } |
---|
376 | 364 | |
---|
377 | | -static int rx6110_remove(struct spi_device *spi) |
---|
378 | | -{ |
---|
379 | | - return 0; |
---|
380 | | -} |
---|
381 | | - |
---|
382 | 365 | static const struct spi_device_id rx6110_id[] = { |
---|
383 | 366 | { "rx6110", 0 }, |
---|
384 | 367 | { } |
---|
385 | 368 | }; |
---|
386 | 369 | MODULE_DEVICE_TABLE(spi, rx6110_id); |
---|
387 | 370 | |
---|
| 371 | +static const struct of_device_id rx6110_spi_of_match[] = { |
---|
| 372 | + { .compatible = "epson,rx6110" }, |
---|
| 373 | + { }, |
---|
| 374 | +}; |
---|
| 375 | +MODULE_DEVICE_TABLE(of, rx6110_spi_of_match); |
---|
| 376 | + |
---|
388 | 377 | static struct spi_driver rx6110_driver = { |
---|
389 | 378 | .driver = { |
---|
390 | 379 | .name = RX6110_DRIVER_NAME, |
---|
| 380 | + .of_match_table = of_match_ptr(rx6110_spi_of_match), |
---|
391 | 381 | }, |
---|
392 | 382 | .probe = rx6110_probe, |
---|
393 | | - .remove = rx6110_remove, |
---|
394 | 383 | .id_table = rx6110_id, |
---|
395 | 384 | }; |
---|
396 | 385 | |
---|