- 21 May, 2018 2 commits
-
-
Alexandre Belloni authored
Let the core handle the range. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Switch to devm_rtc_allocate_device/rtc_register_device. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 19 May, 2018 3 commits
-
-
Alexandre Belloni authored
Use the 64-bit version of rtc_time_to_tm in mxc_rtc_read_alarm Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
This RTC is a 32-bit second counter. This also solves an issue where mxc_rtc_set_alarm() can return with the lock taken. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 18 May, 2018 1 commit
-
-
Alexandre Belloni authored
While the year is encoded on 32 bits in SYS_TOYWRITE1i/SYS_TOYREAD1. The Loongson 1c datasheet states that the range is from 0 to 99. The current code exceeds this range and seems to be working, I deduce that the leap year algorithm will fail in 2100. Anyway, alarm registers only encode the year on 14 bits so with alarm support, the range will always be limited to 0 to 16383. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 17 May, 2018 24 commits
-
-
Alexandre Belloni authored
The error handling in ls1x_rtc_probe used to release resources but since it is using devm functions, it only returns a value. Make the code clearer by returning directly instead of using goto. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Let the core handle offsetting and windowing the RTC range. The RTC has a 40-bit counter counting at 1024 Hz. So its maximum value is 2^(40-10) - 1. Also, let the core handle the offset instead of coding it in the callbacks. Keep the default epoch at the beginning of 2009 (this will fail in 2043). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The probe function is not allowed to fail after the RTC is registered because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The vr41xx RTC is a 48-bit counter counting at 32.768 kHz, giving a maximum value of 2^(48-15)-1 seconds. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The probe function is not allowed to fail after the RTC is registered because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Switch to regmap to simplify handling block read/write. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Return an error when the date is unreliable because the battery is low. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The rx8581_driver forward declaration is useless, remove it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
rx8581_get_datetime and rx8581_set_datetime are only used after casting dev to an i2c_client. Remove that useless indirection. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Let the core handle offsetting and windowing the RTC range. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The rx8581 can support dates from 01/01/2000 to 31/12/2099. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The tps65910 RTC can support dates from 01/01/2000 to 31/12/2099. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Currently, the IRQs are disabled when the rtc driver is removed (e.g. when shutting down the platform). This means that the RTC will be unable to power up the platform. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The ab-b5ze-s3 RTC is storing the year in an 8bit bcd coded register so it can handle dates from year 2000 to year 2099. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Also, the probe function is not allowed to fail after the RTC is registered because the following may happen: CPU0: CPU1: sys_load_module() do_init_module() do_one_initcall() cmos_do_probe() rtc_device_register() __register_chrdev() cdev->owner = struct module* open("/dev/rtc0") rtc_device_unregister() module_put() free_module() module_free(mod->module_core) /* struct module *module is now freed */ chrdev_open() spin_lock(cdev_lock) cdev_get() try_module_get() module_is_live() /* dereferences already freed struct module* */ Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ and register the RTC as late as possible. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Now that the RTC range is properly checked, convert the driver to rtc_tm_to_time64/rtc_time64_to_tm Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The 88pm80x RTC is storing the time as a 32bit offset from a 32bit counter so it can handle dates from 0 to U32_MAX. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
pm80x_rtc_info.calib_work and pm80x_rtc_info.vrtc are never used, remove them. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
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>
-
Alexandre Belloni authored
The at91rm9200 RTC can support dates from 1900-01-01 00:00:00 to 2099-12-31 23:59:59. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 16 May, 2018 1 commit
-
-
Alexandre Belloni authored
Avoid reporting an error when RTC_NVMEM is not selected. Reported-by: kernel test robot <xiaolong.ye@intel.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 14 May, 2018 1 commit
-
-
Fabio Estevam authored
According to Devicetree Specification v0.2 document: "The name of a node should be somewhat generic, reflecting the function of the device and not its precise programming model." Do as suggested in the binding example. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 06 May, 2018 4 commits
-
-
Amelie Delaunay authored
RTC driver should not be aware of the PWR registers offset and bits position. Furthermore, we can imagine that DBP relative register and bit mask could change depending on the SoC. So this patch introduces 2 parameters, dbp_reg and dbp_mask, allowing to get PWR_CR and PWR_CR_DBP from device tree. And it prepares next RTC version, backup domain write protection is disabled only if needed. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Amelie Delaunay authored
RTC driver should not be aware of the PWR registers offset and bits position. Furthermore, we can imagine that Disable Backup Protection (DBP) relative register and bit mask could change depending on the SoC. So this patch moves st,syscfg property from single pwrcfg phandle to pwrcfg phandle/offset/mask triplet. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Acked-by: Alexandre TORGUE <alexandre.torgue@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Amelie Delaunay authored
RTC alarm interrupt is active high and already configured by device tree. So remove IRQF_TRIGGER_RISING from driver. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Amelie Delaunay authored
Fix copyright by removing "SA" and "for STMicroelectronics", not required. Adopt SPDX identifier. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 03 May, 2018 4 commits
-
-
Arnd Bergmann authored
The tps6586x use a 64-bit 'epoch_start' value, but then computes that value using an 'mktime()', which has a smaller range and overflows in 2106 at the latest. As both the hardware and the subsystem interface support wider than 32-bit ranges for rtc times here, let's change all the operations on 'seconds' to time64_t. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Arnd Bergmann authored
The loongson1 platform is 32-bit, so storing a time value in 32 bits suffers from limited range. In this case it is likely to be correct until 2106, but it's better to avoid the limitation and just use the time64_t based mktime64() and rtc_time64_to_tm() interfaces. The hardware uses a 32-bit year number, and time64_t can cover that entire range. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Arnd Bergmann authored
This driver uses mktime() and rtc_time_to_tm() to convert between time values. This works fine on 64-bit kernels over the whole supported range, and the vr41xx chip is a 64-bit MIPS implementation, but it is inconsistent because it doesn't do the same thing on 32-bit kernels that overflow in 2106 or 2038. Changing it to use mktime64/rtc_time64_to_tm() should have no visible impact on vr41xx but gets us closer to removing the 32-bit interfaces. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Andrea Greco authored
Add support Dallas DS1340 trickle charger function. Signed-off-by: Andrea Greco <a.greco@4sigma.it> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-