7e6066ca1f
rtc: Kconfig: Fix typo in help message of rx 6110
...
The help message in the Kconfig for the RX-6110 erronously stated
RX-6610.
Signed-off-by: Claudius Heine <ch@denx.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201117121817.953924-2-ch@denx.de
2020-11-17 20:30:30 +01:00
698fffc270
rtc: ds1307: Drop of_match_ptr and CONFIG_OF protections
...
These prevent use of this driver with ACPI via PRP0001.
Drop them to remove this restriction.
Also added mod_devicetable.h include given use of struct of_device_id.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201116142859.31257-3-andriy.shevchenko@linux.intel.com
2020-11-17 20:25:42 +01:00
227ec129ad
rtc: ds1307: Make use of device properties
...
Device property API allows to gather device resources from different sources,
such as ACPI. Convert the drivers to unleash the power of device property API.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201116142859.31257-2-andriy.shevchenko@linux.intel.com
2020-11-17 20:25:34 +01:00
a31111189b
rtc: ds1307: Remove non-valid ACPI IDs
...
The commit 9c19b8930d
("rtc: ds1307: Add ACPI support") added invalid
ACPI IDs (all of them are abusing ACPI specification). Moreover there is
not even a single evidence that vendor registered any of such devices.
Remove broken ACPI IDs from the driver. For prototyping one may use PRP0001
with device properties adhering to a DT binding. The following patches
will add support of that to the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com >
Cc: Tin Huynh <tnhuynh@apm.com >
Link: https://uefi.org/PNP_ACPI_Registry
Link: https://lore.kernel.org/r/20201116142859.31257-1-andriy.shevchenko@linux.intel.com
2020-11-17 20:23:16 +01:00
bfca1c924d
rtc: at91rm9200: Add sam9x60 compatible
...
Handle the sam9x60 RTC. While it can work with the at91sam9x5 fallback, it
has crystal correction support and doesn't need to shadow IMR.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com >
Link: https://lore.kernel.org/r/20201117133920.1229679-1-alexandre.belloni@bootlin.com
2020-11-17 19:35:09 +01:00
f6a46f8b30
rtc: at91rm9200: add correction support
...
The sama5d4 and sama5d2 RTCs are able to correct for imprecise crystals, up
to 1953 ppm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com >
Link: https://lore.kernel.org/r/20201108232001.1580128-1-alexandre.belloni@bootlin.com
2020-11-17 19:32:12 +01:00
767fbb7102
rtc: rv3032: fix nvram nvmem priv pointer
...
The nvmem priv pointer is set to rv3032 but the rv3032_nvram_write and
rv3032_nvram_read expect the regmap pointer.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201108223710.1574331-1-alexandre.belloni@bootlin.com
2020-11-15 00:51:34 +01:00
5022cfc112
rtc: goldfish: Remove GOLDFISH dependency
...
Goldfish platform is covered with dust.
However the goldfish-rtc had been used as virtualized RTC
in QEMU for RISC-V virt hw and MIPS loongson3-virt hw, thus
we can drop other parts of goldfish but leave goldfish-rtc here.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201114130921.651882-2-jiaxun.yang@flygoat.com
2020-11-15 00:36:26 +01:00
081e2500df
rtc: snvs: Remove NULL pointer check before clk_*
...
Because clk_* already checked NULL clock parameter,
so the additional checks are unnecessary, just remove them.
Signed-off-by: Xu Wang <vulab@iscas.ac.cn >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201113080305.65961-1-vulab@iscas.ac.cn
2020-11-14 23:54:44 +01:00
910d002d84
rtc: brcmstb-waketimer: Remove redundant null check before clk_disable_unprepare
...
Because clk_disable_unprepare() already checked NULL clock parameter,
so the additional check is unnecessary, just remove it.
Signed-off-by: Xu Wang <vulab@iscas.ac.cn >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Florian Fainelli <f.fainelli@gmail.com >
Link: https://lore.kernel.org/r/20201113074538.65028-1-vulab@iscas.ac.cn
2020-11-14 23:52:09 +01:00
1eab0fea25
rtc: pl031: fix resource leak in pl031_probe
...
When devm_rtc_allocate_device is failed in pl031_probe, it should release
mem regions with device.
Reported-by: Hulk Robot <hulkci@huawei.com >
Signed-off-by: Zheng Liang <zhengliang6@huawei.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Linus Walleij <linus.walleij@linaro.org >
Link: https://lore.kernel.org/r/20201112093139.32566-1-zhengliang6@huawei.com
2020-11-14 23:42:29 +01:00
bc06cfc1c4
rtc: cpcap: Fix missing IRQF_ONESHOT as only threaded handler
...
Coccinelle noticed:
drivers/rtc/rtc-cpcap.c:271:7-32: ERROR: Threaded IRQ with no
primary handler requested without IRQF_ONESHOT
drivers/rtc/rtc-cpcap.c:287:7-32: ERROR: Threaded IRQ with no
primary handler requested without IRQF_ONESHOT
Signed-off-by: Tian Tao <tiantao6@hisilicon.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/1605000947-32882-1-git-send-email-tiantao6@hisilicon.com
2020-11-14 23:39:02 +01:00
c56ac7a0f4
rtc: hym8563: enable wakeup when applicable
...
Enable wakeup in the hym8563 driver if the IRQ was successfully
requested or if wakeup-source is set in the devicetree.
As per the description of device_init_wakeup(), it should be enabled
for "devices that everyone expects to be wakeup sources". One would
expect this to be the case with a real-time clock.
Tested on rk3288-rock2-square, which has an IRQ configured for the
RTC. As a result, wakeup was enabled during driver initialisation.
Fixes: dcaf038493
("rtc: add hym8563 rtc-driver")
Reported-by: kernelci.org bot <bot@kernelci.org >
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/1ea023e2ba50a4dab6e39be93d7de3146af71a60.1604653374.git.guillaume.tucker@collabora.com
2020-11-14 23:36:10 +01:00
a48c6224ae
rtc: da9063: Simplify bool comparison
...
Fix the following coccicheck warning:
./drivers/rtc/rtc-da9063.c:246:5-18: WARNING: Comparison to bool
Reported-by: Tosk Robot <tencent_os_robot@tencent.com >
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/1604649637-1014-1-git-send-email-kaixuxia@tencent.com
2020-11-14 23:31:33 +01:00
825156a5ee
rtc: sc27xx: Remove unnecessary conversion to bool
...
Here we could use the '!=' expression to fix the following coccicheck
warning:
./drivers/rtc/rtc-sc27xx.c:566:50-55: WARNING: conversion to bool not needed here
Reported-by: Tosk Robot <tencent_os_robot@tencent.com >
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/1604647854-876-1-git-send-email-kaixuxia@tencent.com
2020-11-14 23:30:10 +01:00
28d211919e
rtc: sun6i: Fix memleak in sun6i_rtc_clk_init
...
When clk_hw_register_fixed_rate_with_accuracy() fails,
clk_data should be freed. It's the same for the subsequent
two error paths, but we should also unregister the already
registered clocks in them.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201020061226.6572-1-dinghao.liu@zju.edu.cn
2020-10-28 18:51:56 +01:00
ba1c30bf3f
rtc: pcf2127: fix pcf2127_nvmem_read/write() returns
...
These functions should return zero on success. Non-zero returns are
treated as error. On some paths, this doesn't matter but in
nvmem_cell_read() a non-zero return would be passed to ERR_PTR() and
lead to an Oops.
Fixes: d6c3029f32
("rtc: pcf2127: add support for accessing internal static RAM")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201022070451.GA2817669@mwanda
2020-10-27 12:23:23 +01:00
5d78533a0c
rtc: pcf2127: move watchdog initialisation to a separate function
...
The obvious advantages are:
- The linker can drop the watchdog functions if CONFIG_WATCHDOG is off.
- All watchdog stuff grouped together with only a single function call
left in generic code.
- Watchdog register is only read when it is actually used.
- Less #ifdefery
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200924105256.18162-2-u.kleine-koenig@pengutronix.de
2020-10-27 12:18:28 +01:00
b7769c45b8
Merge tag 'rtc-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
...
Pull RTC updates from Alexandre Belloni:
"A new driver this cycle is making the bulk of the changes and the
rx8010 driver has been rework to use the modern APIs.
Summary:
Subsystem:
- new generic DT properties: aux-voltage-chargeable,
trickle-voltage-millivolt
New driver:
- Microcrystal RV-3032
Drivers:
- ds1307: use aux-voltage-chargeable
- r9701, rx8010: modernization of the driver
- rv3028: fix clock output, trickle resistor values, RAM
configuration registers"
* tag 'rtc-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (50 commits)
rtc: r9701: set range
rtc: r9701: convert to devm_rtc_allocate_device
rtc: r9701: stop setting RWKCNT
rtc: r9701: remove useless memset
rtc: r9701: stop setting a default time
rtc: r9701: remove leftover comment
rtc: rv3032: Add a driver for Microcrystal RV-3032
dt-bindings: rtc: rv3032: add RV-3032 bindings
dt-bindings: rtc: add trickle-voltage-millivolt
rtc: rv3028: ensure ram configuration registers are saved
rtc: rv3028: factorize EERD bit handling
rtc: rv3028: fix trickle resistor values
rtc: rv3028: fix clock output support
rtc: mt6397: Remove unused member dev
rtc: rv8803: simplify the return expression of rv8803_nvram_write
rtc: meson: simplify the return expression of meson_vrtc_probe
rtc: rx8010: rename rx8010_init_client() to rx8010_init()
rtc: ds1307: enable rx8130's backup battery, make it chargeable optionally
rtc: ds1307: consider aux-voltage-chargeable
rtc: ds1307: store previous charge default per chip
...
2020-10-21 11:22:08 -07:00
35331b506f
rtc: r9701: set range
...
Set range and remove the set_time check. This is a classic BCD RTC.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201015191135.471249-6-alexandre.belloni@bootlin.com
2020-10-19 22:48:55 +02:00
dfe13cf2ae
rtc: r9701: convert to devm_rtc_allocate_device
...
This allows further improvement of the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201015191135.471249-5-alexandre.belloni@bootlin.com
2020-10-19 22:48:55 +02:00
8b34134907
rtc: r9701: stop setting RWKCNT
...
tm_wday is never checked for validity and it is not read back in
r9701_get_datetime. Avoid setting it to stop tripping static checkers:
drivers/rtc/rtc-r9701.c:109 r9701_set_datetime()
error: undefined (user controlled) shift '1 << dt->tm_wday'
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201015191135.471249-4-alexandre.belloni@bootlin.com
2020-10-19 22:48:55 +02:00
2a8f3380c9
rtc: r9701: remove useless memset
...
The RTC core already sets to zero the struct rtc_tie it passes to the
driver, avoid doing it a second time.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201015191135.471249-3-alexandre.belloni@bootlin.com
2020-10-19 22:48:55 +02:00
7390bec4ed
rtc: r9701: stop setting a default time
...
It doesn't make sense to set the RTC to a default value at probe time. Let
the core handle invalid date and time.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201015191135.471249-2-alexandre.belloni@bootlin.com
2020-10-19 22:48:55 +02:00
92c6dcfbd1
rtc: r9701: remove leftover comment
...
Commit 22652ba724
("rtc: stop validating rtc_time in .read_time") removed
the code but not the associated comment.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201015191135.471249-1-alexandre.belloni@bootlin.com
2020-10-19 22:48:55 +02:00
2eeaa532ac
rtc: rv3032: Add a driver for Microcrystal RV-3032
...
New driver for the Microcrystal RV-3032, including support for:
- Date/time
- Alarms
- Low voltage detection
- Trickle charge
- Trimming
- Clkout
- RAM
- EEPROM
- Temperature sensor
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201013144110.1942218-3-alexandre.belloni@bootlin.com
2020-10-19 22:47:56 +02:00
024e6f3dce
rtc: rv3028: ensure ram configuration registers are saved
...
If RV3028_CTRL1_EERD is not set (this is the default), the RTC will refresh
the RAM configuration registers from the EEPROM at midnight. It is
necessary to save the RAM registers back to EEPROM after modifying them.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201009153101.721149-4-alexandre.belloni@bootlin.com
2020-10-15 12:09:35 +02:00
de0ad60e79
rtc: rv3028: factorize EERD bit handling
...
Both rv3028_eeprom_write and rv3028_eeprom_read enable EERD before sending
commands to the EEPROM and restore it afterwards. Factorize this code.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201009153101.721149-3-alexandre.belloni@bootlin.com
2020-10-15 12:09:35 +02:00
c1efae1432
rtc: rv3028: fix trickle resistor values
...
Version 1.0 of the application manual had the wrong resistor values. Fix
them according to version 1.1
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201009153101.721149-2-alexandre.belloni@bootlin.com
2020-10-15 12:09:35 +02:00
00e8e87f10
rtc: rv3028: fix clock output support
...
rv3028_clkout_set_rate unconditionally sets RV3028_CLKOUT_CLKOE but
clk_set_rate may be called with the clock disabled. Ensure the clock is
kept disabled if it was not yet enabled.
Also, the actual rate was overwritten when enabling the clock, properly
write to the register only once.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201009153101.721149-1-alexandre.belloni@bootlin.com
2020-10-15 12:09:34 +02:00
770c03e6da
rtc: mt6397: Remove unused member dev
...
Removing the struct member "dev" in mt6397 RTC driver because it's not
initialized and the only usage is for one debugging message.
Also fixed a typo in the error message.
Signed-off-by: Fei Shao <fshao@chromium.org >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20201008093414.1911699-1-fshao@chromium.org
2020-10-15 12:01:29 +02:00
179b4bcc4c
rtc: rv8803: simplify the return expression of rv8803_nvram_write
...
Simplify the return expression.
Signed-off-by: Liu Shixin <liushixin2@huawei.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200921082449.2591981-1-liushixin2@huawei.com
2020-09-29 22:20:10 +02:00
9ce42e8e03
rtc: meson: simplify the return expression of meson_vrtc_probe
...
Simplify the return expression.
Signed-off-by: Liu Shixin <liushixin2@huawei.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Kevin Hilman <khilman@baylibre.com >
Link: https://lore.kernel.org/r/20200919100856.1639319-1-liushixin2@huawei.com
2020-09-29 22:19:15 +02:00
ba1bcafb29
rtc: rx8010: rename rx8010_init_client() to rx8010_init()
...
Since the switch to using regmap this function no longer takes the
I2C client struct as argument nor do we even interact with the client
anywhere other than when creating the regmap.
Rename it to a less misleading name: "rx8010_init()".
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200917114656.9036-1-brgl@bgdev.pl
2020-09-29 22:18:10 +02:00
0026f1604c
rtc: ds1307: enable rx8130's backup battery, make it chargeable optionally
...
The ds1307 charger infrastructure now allows to add a rx8130 charger
setup that..
- does not depend on trickle-resistor-ohms
- does not use DS13XX_TRICKLE_CHARGER_MAGIC trickle-charge select (TCS)
bits
- keeps previous no-charge behavior for device trees without
aux-voltage-chargeable
Make that happen.
Signed-off-by: Bastian Krause <bst@pengutronix.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200917183246.19446-9-bst@pengutronix.de
2020-09-24 09:56:04 +02:00
0874734e09
rtc: ds1307: consider aux-voltage-chargeable
...
Prefer aux-voltage-chargeable over trickle-diode-disable and set diode
accordingly. This is then passed to the chip's appropriate charge setup
function.
Signed-off-by: Bastian Krause <bst@pengutronix.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200917183246.19446-8-bst@pengutronix.de
2020-09-24 09:56:04 +02:00
95a74cbb21
rtc: ds1307: store previous charge default per chip
...
Some RTC's batteries and supercaps were charged by default until now.
In contrast other RTCs allow charging but the driver did not configure
them to do so until now. These must not be charged by default to stay
backwards compatible.
In order to do that, store the charge default per chip.
Signed-off-by: Bastian Krause <bst@pengutronix.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200917183246.19446-7-bst@pengutronix.de
2020-09-24 09:56:04 +02:00
1b5b6af788
rtc: ds1307: introduce requires_trickle_resistor per chip
...
Make trickle-resistor-ohms optional for charging setups that do not
require specifying ROUT bits (specifying the resistor value between Vcc
and Vbackup). In order to allow specifying that, introduce
requires_trickle_resistor per chip.
Signed-off-by: Bastian Krause <bst@pengutronix.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200917183246.19446-6-bst@pengutronix.de
2020-09-24 09:56:04 +02:00
462eb736db
rtc: ds1307: apply DS13XX_TRICKLE_CHARGER_MAGIC only conditionally
...
DS13XX_TRICKLE_CHARGER_MAGIC sets the trickle-charge select (TCS) bits
(7..4). The datasheet of Maxim Integrated's DS1339 [1] for instance
reads:
"To prevent accidental enabling, only a pattern on 1010 enables the
trickle charger. All other patterns disable the trickle charger."
Since not all RTCs connected to a backup battery or supercap use these
bits DS13XX_TRICKLE_CHARGER_MAGIC should not get applied for all charger
setups unconditionally.
Epson's RX8130 is such an example: Instead of TCS bits "SMPTSEL1",
"SMPTSEL0", "CHGEN" and "INIEN" are expected as bit 7..4.
DS1339 and DS1340 are currently the only RTCs in the ds1307 driver that
apply DS13XX_TRICKLE_CHARGER_MAGIC to their setup register value. So
apply DS13XX_TRICKLE_CHARGER_MAGIC in do_trickle_setup_ds1339() which
is used by both RTCs.
[1] https://datasheets.maximintegrated.com/en/ds/DS1339-DS1339U.pdf
[2] https://support.epson.biz/td/api/doc_check.php?dl=app_RX8130CE
Signed-off-by: Bastian Krause <bst@pengutronix.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200917183246.19446-5-bst@pengutronix.de
2020-09-24 09:56:03 +02:00
35425bafc7
rtc: pcf2127: fix a bug when not specify interrupts property
...
Fix a bug when not specify interrupts property in dts
as follows,
rtc-pcf2127-i2c 1-0051: failed to request alarm irq
rtc-pcf2127-i2c: probe of 1-0051 failed with error -22
Signed-off-by: Biwen Li <biwen.li@nxp.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200915073213.12779-1-biwen.li@oss.nxp.com
2020-09-15 12:25:44 +02:00
9f8010e71f
rtc: ds1685: Fix bank switching to avoid endless loop
...
ds1685_rtc_begin_data_access() tried to access an extended register before
enabling access to it by switching to bank 1. Depending on content in NVRAM
this could lead to an endless loop. While at it fix also switch back to
bank 0 in ds1685_rtc_end_data_access().
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Acked-by: Joshua Kinard <kumba@gentoo.org >
Link: https://lore.kernel.org/r/20200910084124.138560-1-tsbogend@alpha.franken.de
2020-09-15 11:24:29 +02:00
d0a3b65052
rtc: st-lpc: Constify st_rtc_ops
...
The only usage of st_rtc_ops is to assign its address to the ops field
in the rtc_device struct. which is a const pointer. Make it const to
allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200913122644.35515-1-rikard.falkeborn@gmail.com
2020-09-15 11:21:50 +02:00
2fc1af3095
rtc: rx8010: use range checking provided by core RTC code
...
We don't need to check the time range manually in set_time(), we can
use range_min and range_max exposed by struct rtc_device.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-15-brgl@bgdev.pl
2020-09-15 10:50:38 +02:00
9868bc1ce2
rtc: rx8010: convert to using regmap
...
This driver requires SMBUS to work. We can relax this requirement if we
switch to using i2c regmap and let the regmap sub-system figure out how
to talk to the bus.
This also has the advantage of shrinking the code for register updates.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-14-brgl@bgdev.pl
2020-09-15 10:50:38 +02:00
cee015d90d
rtc: rx8010: switch to using the preferred i2c API
...
We should generally use probe_new instead of probe when registering i2c
drivers. Convert rx8010 to using it.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-13-brgl@bgdev.pl
2020-09-15 10:50:38 +02:00
0ce627785a
rtc: rx8010: switch to using the preferred RTC API
...
Use devm_rtc_allocate_device() + rtc_register_device() instead of the
deprecated devm_rtc_device_register().
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-12-brgl@bgdev.pl
2020-09-15 10:50:38 +02:00
666f21413b
rtc: rx8010: prefer sizeof(*val) over sizeof(struct type_of_val)
...
Using the size of the variable is preferred over using the size of its
type when allocating memory. Convert the call to devm_kzalloc() in
probe().
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-11-brgl@bgdev.pl
2020-09-15 10:50:37 +02:00
955a123c14
rtc: rx8010: use a helper variable for client->dev in probe()
...
Simple 'dev' looks better then repeated &client->dev and has the added
benefit of avoiding unnecessary line breaks.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-10-brgl@bgdev.pl
2020-09-15 10:50:37 +02:00
b3ff7fd68d
rtc: rx8010: drop unnecessary initialization
...
The 'err' local variable in rx8010_init_client() doesn't need to be
initialized.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-9-brgl@bgdev.pl
2020-09-15 10:50:37 +02:00
f702699c67
rtc: rx8010: don't use magic values for time buffer length
...
The time buffer len is used directly in this driver. For readability
it's better to define it as the difference between the date register
offsets and use sizeof() whenever referencing it.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com >
Link: https://lore.kernel.org/r/20200914154601.32245-8-brgl@bgdev.pl
2020-09-15 10:50:37 +02:00