aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc
AgeCommit message (Collapse)AuthorFilesLines
2017-09-01rtc: ds1307: constify struct chip_desc variablesHeiner Kallweit1-3/+3
Constify struct chip_desc variables. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-09-01rtc: ds1307: improve trickle charger initializationHeiner Kallweit1-17/+16
Instead of storing the trickle_charger_setup value in struct chip_desc we can let function ds1307_trickle_init return it because it's used in the probe function only. This allows us to constify struct chip_desc variables in a next step. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-09-01rtc: ds1307: factor out bbsqi bit to struct chip_descHeiner Kallweit1-7/+4
Factor out the bbsqi bit to struct chip_desc. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-09-01rtc: ds1307: remove member irq from struct ds1307Heiner Kallweit1-7/+5
The irq number is used in the probe function only, so we don't have to store it in struct ds1307. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-09-01rtc: rk808: Name RK805 in Kconfig for RTC_DRV_RK808Elaine Zhang1-2/+2
The RK808 and RK805 PMICs are using a similar register map. We can reuse the rtc driver for the RK805 PMIC. So let's add the RK805 in the Kconfig description. Signed-off-by: Elaine Zhang <[email protected]> Signed-off-by: Joseph Chen <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-09-01rtc: constify i2c_device_idArvind Yadav4-4/+4
i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: remove .open() and .release()Alexandre Belloni1-16/+4
There are no driver left using .open and .release. There is no good use case for them as there is nothing the character device interface does that should not be done in the sysfs interface or in-kernel interface. Remove those callbacks now to avoid future confusion. Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: mxc: avoid disabling interrupts on device closeAlexandre Belloni1-21/+0
Currently, the IRQs are disabled when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device as is done in rtcwake. Keep the alarm functional on character device release so the platform can actually wakeup. Reviewed-by: Fabio Estevam <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: vr41xx: make alarms usefulAlexandre Belloni1-18/+0
Currently, the IRQs are disabled when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device. Keep the alarms functional on character device release. Note that the PIE are never enabled and would anyway be disabled by the core. Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: sa1100: make alarms usefulAlexandre Belloni1-41/+22
Currently, the driver unregisters the IRQs when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device. Move the IRQ requests to sa1100_rtc_probe() and use the devm managed versions so we don't need to free them. Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: sa1100: fix unbalanced clk_prepare_enable/clk_disable_unprepareAlexandre Belloni1-3/+1
In the error path of sa1100_rtc_open(), info->clk is disabled which will happen again in sa1100_rtc_remove() when the module is removed whereas it is only enabled once in sa1100_rtc_init(). Fixes: 0cc0c38e9139 ("drivers/rtc/rtc-sa1100.c: move clock enable/disable to probe/remove") Acked-by: Robert Jarzmik <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: pxa: fix possible race conditionAlexandre Belloni1-1/+3
pxa_rtc_open() registers the interrupt handler which will access the RTC registers. However, pxa_rtc_open() is called before the register range is ioremapped. Instead, call it after devm_ioremap(). Acked-by: Robert Jarzmik <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: m41t80: remove debug sysfs attributeAlexandre Belloni1-44/+0
The last remaining sysfs attribute is undocumented and useless as it can only be used to debug the driver. Remove it. Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-24rtc: m41t80: enable wakealarm when "wakeup-source" is specifiedEric Cooper1-6/+17
Don't require an IRQ if the wakeup-source device-tree property is present. Signed-off-by: Eric Cooper <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-22rtc: puv3: make alarms usefulAlexandre Belloni1-42/+14
Currently, the driver unregisters the IRQs when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device. Move the IRQ requests to puv3_rtc_probe() and use the devm managed versions so we don't need to free them. Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-22rtc: puv3: switch to devm_rtc_allocate_device()/rtc_register_device()Alexandre Belloni1-9/+7
Use managed RTC device allocation as this allows for further cleanup. Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-21rtc: ds1307: fix regmap configHeiner Kallweit1-1/+0
Current max_register setting breaks reading nvram on certain chips and also reading the standard registers on RX8130 where register map starts at 0x10. Signed-off-by: Heiner Kallweit <[email protected]> Fixes: 11e5890b5342 "rtc: ds1307: convert driver to regmap" Signed-off-by: Alexandre Belloni <[email protected]>
2017-08-15mfd: dm355evm_msp: Move header file out of I2C realmWolfram Sang1-1/+1
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2017-07-31rtc: max8925: remove redundant check on retColin Ian King1-2/+0
The check on ret < 0 is redundant as the goto destination is the next statment. Remove this redudant check and goto. Detected by CoverityScan, CID#1268785 ("Identical code for different branches") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-31rtc: sun6i: ensure clk_data is kfree'd on errorColin Ian King1-2/+6
There are two error return paths that do not kfree clk_data and we end up with a memory leak. Fix these with a kfree error exit path. Detected by CoverityScan, CID#1402959 ("Resource Leak") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-31rtc: sun6i: Remove double init of spinlock in sun6i_rtc_clk_init()Alexey Klimov1-1/+1
Remove double init of spinlock in sun6i_rtc_clk_init() Fixes: 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator") Signed-off-by: Alexey Klimov <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-31rtc: ds1307: remove legacy check for "isil, irq2-can-wakeup-machine" propertyHeiner Kallweit1-7/+1
Commit 8b44f5be20fd ("ARM: dts: armada: replace isil,irq2-can-wakeup-machine with wakeup-source property") removed the last usage of "isil,irq2-can-wakeup-machine" almost two years ago. So I think we can get rid of supporting this legacy binding. Signed-off-by: Heiner Kallweit <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-31rtc: s35390a: implement ioctlsFabien Lahoudere1-1/+31
Implements RTC_VL_READ and RTC_VL_CLR ioctls. Signed-off-by: Fabien Lahoudere <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-31rtc: s35390a: handle invalid RTC timeFabien Lahoudere1-30/+42
If RTC time have been altered by low voltage, we notify users that RTC time is invalid by returning -EINVAL. The RTC time needs to be set correctly to clear the invalid flag. Signed-off-by: Fabien Lahoudere <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-13Merge tag 'rtc-4.13' of ↵Linus Torvalds22-839/+1696
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Here is the pull-request for the RTC subsystem for 4.13. Subsystem: - expose non volatile RAM using nvmem instead of open coding in many drivers. Unfortunately, this option has to be enabled by default to not break existing users. - rtctest can now test for cutoff dates, showing when an RTC will start failing to properly save time and date. - new RTC registration functions to remove race conditions in drivers Newly supported RTCs: - Broadcom STB wake-timer - Epson RX8130CE - Maxim IC DS1308 - STMicroelectronics STM32H7 Drivers: - ds1307: use regmap, use nvmem, more cleanups - ds3232: temperature reading support - gemini: renamed to ftrtc010 - m41t80: use CCF to expose the clock - rv8803: use nvmem - s3c: many cleanups - st-lpc: fix y2106 bug" * tag 'rtc-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits) rtc: Remove wrong deprecation comment nvmem: include linux/err.h from header rtc: st-lpc: make it robust against y2038/2106 bug rtc: rtctest: add check for problematic dates tools: timer: add rtctest_setdate rtc: ds1307: remove ds1307_remove rtc: ds1307: use generic nvmem rtc: ds1307: switch to rtc_register_device rtc: rv8803: remove rv8803_remove rtc: rv8803: use generic nvmem support rtc: rv8803: switch to rtc_register_device rtc: add generic nvmem support rtc: at91rm9200: remove race condition rtc: introduce new registration method rtc: class separate id allocation from registration rtc: class separate device allocation from registration rtc: stm32: add STM32H7 RTC support dt-bindings: rtc: stm32: add support for STM32H7 rtc: ds1307: add ds1308 variant rtc: ds3232: add temperature support ...
2017-07-09rtc: st-lpc: make it robust against y2038/2106 bugBenjamin Gaignard1-11/+8
Make driver use u64 variables and functions to be sure that it will support dates after year 2038. Signed-off-by: Benjamin Gaignard <[email protected]> Acked-by: Patrice Chotard <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: ds1307: remove ds1307_removeAlexandre Belloni1-6/+0
ds1307_remove() is now empty, remove it Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: ds1307: use generic nvmemAlexandre Belloni1-66/+22
Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: ds1307: switch to rtc_register_deviceAlexandre Belloni1-2/+7
This removes a possible race condition and crash and allows for further improvement of the driver. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: rv8803: remove rv8803_removeAlexandre Belloni1-6/+0
rv8803_remove() is now empty, remove it. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: rv8803: use generic nvmem supportAlexandre Belloni1-31/+20
Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: rv8803: switch to rtc_register_deviceAlexandre Belloni1-6/+9
This removes a possible race condition and allows for further improvement of the driver. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: add generic nvmem supportAlexandre Belloni5-0/+134
Many RTCs have an on board non volatile storage. It can be battery backed RAM or an EEPROM. Use the nvmem subsystem to export it to both userspace and in-kernel consumers. This stays compatible with the previous (non documented) ABI that was using /sys/class/rtc/rtcx/device/nvram to export that memory. But will warn about the deprecation. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: at91rm9200: remove race conditionAlexandre Belloni1-6/+8
While highly unlikely, it is possible to get an interrupt as soon as it is requested. In that case, at91_rtc_interrupt() will be called with rtc == NULL. Solve that by using devm_rtc_allocate_device/rtc_register_device. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: introduce new registration methodAlexandre Belloni1-0/+84
Introduce rtc_register_device() to register an already allocated and initialized struct rtc_device. It automatically sets up the owner and the two steps allocation/registration will allow to remove race conditions in the IRQ handling of some driver. It also allows to properly extend the core without adding more arguments to rtc_device_register(). Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: class separate id allocation from registrationAlexandre Belloni1-19/+25
Create rtc_device_get_id to allocate the id for an RTC. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-07rtc: class separate device allocation from registrationAlexandre Belloni1-26/+37
Create rtc_allocate_device to allocate memory for a struct rtc_device and initialize it. Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: stm32: add STM32H7 RTC supportAmelie Delaunay1-17/+65
This patch adds support for STM32H7 RTC. On STM32H7, the RTC bus interface clock (APB clock) needs to be enabled. Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: ds1307: add ds1308 variantSean Nyekjaer1-0/+12
The ds1308 variant is very similar to the already supported ds1338 variant, it have more debug registers and a square wave clock output. Signed-off-by: Sean Nyekjaer <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: ds3232: add temperature supportKirill Esipov2-0/+127
DS3232/DS3234 has the temperature registers with a resolution of 0.25 degree celsius. This enables to get the value through hwmon. # cat /sys/class/hwmon/hwmon0/temp1_input 37250 Signed-off-by: Kirill Esipov <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: rtc-nuc900: fix loop timeout testDan Carpenter1-1/+1
We should change this post-op to a pre-op because we want the loop to exit with "timeout" set to zero. Fixes: 0a89b55364e0 ("nuc900/rtc: change the waiting for device ready implement") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: gemini/ftrtc010: rename driver and symbolsLinus Walleij3-51/+52
The Gemini RTC is actually a generic IP block from Faraday Technology names FTRTC010. Rename the driver file and all symbols to match this IP name. The relationship can be clearly seen in the U-Boot driver posted by Po-Yu Chuang for the Faraday A320 board: https://lists.denx.de/pipermail/u-boot/2009-September/061326.html Remove the dependency on ARCH_GEMINI but select the driver for ARCH_GEMINI so we get a smooth transition. The IP block is synthsized on different silicon and architectures. Cc: Po-Yu Chuang <[email protected]> Acked-by: Hans Ulli Kroll <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: gemini: Add optional clock handlingLinus Walleij1-0/+28
This makes the Gemini optionally take two clock references to the PCLK and EXTCLK. As we are adding a clock framework to the Gemini platform we need to make sure that we get the right references. Acked-by: Hans Ulli Kroll <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-06rtc: ds1307: factor out century bit handlingHeiner Kallweit1-46/+27
The driver has lots of places with chip-specific code what doesn't necessarily facilitate maintenance. Let's describe chip-specific differences in century bit handling in struct chip_desc to improve this. Signed-off-by: Heiner Kallweit <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-05rtc: ds1307: use regmap_update_bits where applicableHeiner Kallweit1-62/+20
After the switch to regmap we can now make use of regmap_update_bits to simplify read/modify/write ops. Signed-off-by: Heiner Kallweit <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-07-05rtc: brcmstb-waketimer: Add Broadcom STB wake-timerBrian Norris3-0/+342
This adds support for the Broadcom STB wake-timer which is a timer in the chip's 27Mhz clock domain that offers the ability to wake the system (wake-up source) from suspend states (S2, S3, S5). It is supported using the rtc framework allowing us to configure alarms for system wake-up. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Markus Mayer <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-06-24rtc: ds1307: Add support for Epson RX8130CEMarek Vasut1-0/+175
Add support for yet another RTC chip, Epson RX8130CE. This time around, the chip has slightly permutated registers and also the register starts at 0x10 instead of 0x0 . So far, we only support the RTC and NVRAM parts of the chip, Alarm and Timer is not supported. Signed-off-by: Marek Vasut <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Nishanth Menon <[email protected]> Cc: Tony Lindgren <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-06-24rtc: s3c: Handle clock enable failuresKrzysztof Kozlowski1-15/+57
clk_enable() can fail so handle such case. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-06-24rtc: s3c: Handle clock prepare failures in probeKrzysztof Kozlowski1-2/+6
clk_prepare_enable() can fail so handle such case. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-06-24rtc: s3c: Do not remove const from rodata memoryKrzysztof Kozlowski1-3/+3
All instances of struct s3c_rtc_data are in fact static const thus put in rodata so we should not drop the const while getting the pointer to them. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>