aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-stm32.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-10rtc: stm32: add missed clk_disable_unprepare in error path of resumeChuhong Yuan1-1/+4
The resume() forgets to call clk_disable_unprepare() when failed. Add the missed call to fix it. Signed-off-by: Chuhong Yuan <[email protected]> Reviewed-by: Amelie Delaunay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2019-10-07rtc: use devm_platform_ioremap_resource() to simplify codeYueHaibing1-3/+1
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Signed-off-by: YueHaibing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2019-08-13rtc: Remove dev_err() usage after platform_get_irq()Stephen Boyd1-1/+0
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Alessandro Zummo <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: [email protected] Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2019-07-13rtc: stm32: remove one condition check in stm32_rtc_set_alarm()Markus Elfring1-5/+1
A condition check was repeated in this function implementation despite of a corresponding check in the stm32_rtc_alarm_irq_enable() function. Thus delete redundant source code here. This issue was detected by using the Coccinelle software. Suggested-by: Russell King <[email protected]> Signed-off-by: Markus Elfring <[email protected]> Reviewed-by: Amelie Delaunay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2019-04-29rtc: stm32: manage the get_irq probe defer caseFabien Dessenne1-3/+6
Manage the -EPROBE_DEFER error case for the wake IRQ. Signed-off-by: Fabien Dessenne <[email protected]> Acked-by: Amelie Delaunay <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2018-05-22rtc: stm32: add stm32mp1 rtc supportAmelie Delaunay1-14/+89
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 <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2018-05-22rtc: stm32: rework register management to prepare other version of RTCAmelie Delaunay1-57/+127
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 <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2018-05-22rtc: stm32: fix misspelling and misalignment issuesAmelie Delaunay1-2/+2
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 <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2018-05-06rtc: stm32: get DBP register and mask from DT st, syscfg propertyAmelie Delaunay1-22/+37
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 <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2018-05-06rtc: stm32: fix alarm interrupt flags by removing IRQF_TRIGGER_RISINGAmelie Delaunay1-2/+1
RTC alarm interrupt is active high and already configured by device tree. So remove IRQF_TRIGGER_RISING from driver. Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2018-05-06rtc: stm32: fix copyright and adopt SPDX identifierAmelie Delaunay1-3/+3
Fix copyright by removing "SA" and "for STMicroelectronics", not required. Adopt SPDX identifier. Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-11-29rtc: stm32: Fix copyrightBenjamin Gaignard1-2/+2
Uniformize STMicroelectronics copyrights header Signed-off-by: Benjamin Gaignard <[email protected]> CC: Amelie Delaunay <[email protected]> Acked-by: Alexandre TORGUE <[email protected]> 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-01-23rtc: stm32: fix comparison warningsAmelie Delaunay1-3/+3
This patches fixes comparison between signed and unsigned values as it could produce an incorrect result when the signed value is converted to unsigned: drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_valid_alrm': drivers/rtc/rtc-stm32.c:404:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if ((((tm->tm_year > cur_year) && ... It also fixes comparison always true or false due to the fact that unsigned value is compared against zero with >= or <: drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_init': drivers/rtc/rtc-stm32.c:514:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] for (pred_a = pred_a_max; pred_a >= 0; pred_a-- ) { drivers/rtc/rtc-stm32.c:530:44: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] (rate - ((pred_a + 1) * (pred_s + 1)) < 0) ? Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver") Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-01-23rtc: stm32: use 0 instead of ~PWR_CR_DBP in regmap_update_bitsAmelie Delaunay1-2/+2
Using the ~ operator on a BIT() constant results in a large 'unsigned long' constant that won't fit into an 'unsigned int' function argument on 64-bit architectures, resulting in a harmless build warning in x86 allmodconfig: drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_probe': drivers/rtc/rtc-stm32.c:651:51: error: large integer implicitly truncated to unsigned type [-Werror=overflow] regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, ~PWR_CR_DBP); As PWR_CR_DBP mask prevents other bits to be cleared, replace all ~PWR_CR_DBP by 0. Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-01-13rtc: stm32: fix building without CONFIG_OFArnd Bergmann1-2/+0
The new driver has a stray #ifdef in it that causes a build error: drivers/rtc/rtc-stm32.c:718:21: error: 'stm32_rtc_of_match' undeclared here (not in a function); did you mean 'stm32_rtc_pm_ops'? As the #ifdef serves no purpose here, let's just remove it. Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-01-13rtc: stm32: remove __exit annotation on remove callbackArnd Bergmann1-1/+1
The remove function can be called at runtime for a manual 'unbind' operation and must not be left out from a built-in driver, as kbuild complains: `stm32_rtc_remove' referenced in section `.data.stm32_rtc_driver' of drivers/rtc/rtc-stm32.o: defined in discarded section `.exit.text' of drivers/rtc/rtc-stm32.o This removes the extraneous annotation. Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2017-01-13rtc: add STM32 RTC driverAmelie Delaunay1-0/+727
This patch adds support for the STM32 RTC. Signed-off-by: Amelie Delaunay <[email protected]> Reviewed-by: Mathieu Poirier <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>