- 05 Jun, 2018 1 commit
-
-
Alexandre Belloni authored
Switch to devm managed functions to simplify error handling and device removal Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 04 Jun, 2018 1 commit
-
-
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> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 31 May, 2018 10 commits
-
-
Alexandre Belloni authored
Now that alarms are emulated, remove the irq sysfs file that could be used to send alarms. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Use timers to emulate alarms. Note that multiple alarms may happen if they are set more than 15 days after the current RTC time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Store the time as an offset to system time. As the offset is in second, it is currently always synced with system time. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Use a loop to register RTC devices Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
The rtc proc callback is useless for two reasosn: - the test RTC is often not the first RTC so it will never be used - all the info is available in the name file of the RTC sys folder Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Alexandre Belloni authored
Useful range is 2000-2099 because leap year fails on centuries. 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. 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>
-
Baolin Wang authored
We should use the new method to check if RTC was powered down, which is more solid. Since we have introduced power control and power status registers, and we just check if the power status is the default value (0x96), if yes that means the RTC has been powered down. Meanwhile We can set the power control register to be one valid value to change the power status to indicate RTC device is valid now. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Michael Trimarchi authored
clk-gate core will take bit_idx through clk_register_gate and then do clk_gate_ops by using BIT(bit_idx), but rtc-sun6i is passing bit_idx as BIT(bit_idx) it becomes BIT(BIT(bit_idx) which is wrong and eventually external gate clock is not enabling. This patch fixed by passing bit index and the original change introduced from below commit. "rtc: sun6i: Add support for the external oscillator gate" (sha1: 17ecd246) Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Fixes: 17ecd246 ("rtc: sun6i: Add support for the external oscillator gate") Cc: stable@vger.kernel.org Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Mathieu Malaterre authored
Fix typo introduced for RTC_DRV_JZ4740 in commit 586655d2 ("rtc: jz4740: make the driver buildable as a module again"). Signed-off-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 26 May, 2018 1 commit
-
-
Alexandre Belloni authored
There is no point in testing .set_mmss versus .set_mmss64 as there are both taking the exact same argument (truncated for set_mmss though). Also, this allows to constify struct rtc_ops. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 23 May, 2018 2 commits
-
-
Alexandre Belloni authored
The RTC has a 64 bit counter. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> 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. Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 22 May, 2018 6 commits
-
-
Amelie Delaunay authored
This patch adds support for stm32mp1 RTC. Some common registers with previous RTC version have a different offset. It is the case for Control Register (CR) and ALaRMA Register (ALRMAR). There are also new registers regarding event flags: now, Alarm event flag is in Status Register (SR) and write 1 in Status Clear Register (SCR) is required to clear the event. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Amelie Delaunay authored
RTC embedded in stm32mp1 SoC is slightly different from stm32h7 one, it doesn't require to disable backup domain write protection, and rtc_ck parent clock assignment isn't allowed. To sum up, stm32mp1 RTC requires 2 clocks, pclk and rtc_ck, and an RTC alarm interrupt. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Amelie Delaunay authored
This patch reworks register/bits management because next version of RTC uses the same way of working but with different register's offset or bits moved in new registers. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Amelie Delaunay authored
This patch cleans the following checkpatch complaints: CHECK: 'initalized' may be misspelled - perhaps 'initialized'? #644: FILE: drivers/rtc/rtc-stm32.c:644: + * the calendar has been initalized or not. INITS flag is reset by a CHECK: Alignment should match open parenthesis #669: FILE: drivers/rtc/rtc-stm32.c:669: + rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name, + &stm32_rtc_ops, THIS_MODULE); Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Fabio Estevam authored
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Fabio Estevam authored
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
- 21 May, 2018 4 commits
-
-
Uwe Kleine-König authored
nvmem_register() never returns NULL, so IS_ERR is good enough here. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
Uwe Kleine-König authored
nvmem_register() assumes these values to be 1 if unset, so they don't need to be set explicitly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-
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 11 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>
-