aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc
AgeCommit message (Collapse)AuthorFilesLines
2020-09-15rtc: rx8010: rename ret to err in rx8010_set_time()Bartosz Golaszewski1-11/+11
All other functions in this driver use 'err' for integer return values. Do the same in rx8010_set_time() for consistency. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-09-15rtc: rx8010: use tabs instead of spaces for code formattingBartosz Golaszewski1-29/+29
The define values in this driver are close to their names and they are separated by spaces. Use tabs instead and align all defines. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-09-15rtc: rx8010: consolidate local variables of the same typeBartosz Golaszewski1-12/+6
Move local variables of the same type into a single line for better readability. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-09-15rtc: rx8010: remove unnecessary bracketsBartosz Golaszewski1-6/+3
Remove brackets wherever they guard a single line. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-09-15rtc: rx8010: remove a stray newlineBartosz Golaszewski1-1/+0
Remove an unnecessary newline after requesting the interrupt. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-09-15rtc: rx8010: don't modify the global rtc opsBartosz Golaszewski1-7/+17
The way the driver is implemented is buggy for the (admittedly unlikely) use case where there are two RTCs with one having an interrupt configured and the second not. This is caused by the fact that we use a global rtc_class_ops struct which we modify depending on whether the irq number is present or not. Fix it by using two const ops structs with and without alarm operations. While at it: not being able to request a configured interrupt is an error so don't ignore it and bail out of probe(). Fixes: ed13d89b08e3 ("rtc: Add Epson RX8010SJ RTC driver") Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
2020-09-15rtc: s3c: Simplify with dev_err_probe()Krzysztof Kozlowski1-7/+2
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva4-4/+4
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <[email protected]>
2020-08-21rtc: fsl-ftm-alarm: update acpi device idPeng Ma1-2/+2
Original device id would conflict with crypto driver, change it. Signed-off-by: Peng Ma <[email protected]> Signed-off-by: Ran Wang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-21rtc: ds1307: Clear OSF flag on DS1388 when setting timeChris Packham1-0/+4
Ensure the OSF flag is cleared on the DS1388 when the clock is set. Fixes: df11b323b16f ("rtc: ds1307: handle oscillator failure flags for ds1388 variant") Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-21rtc: ds1307: Ensure oscillator is enabled for DS1388Chris Packham1-0/+14
Similar to the other variants the DS1388 has a bit to stop the oscillator to reduce the power consumption from VBAT. Ensure that the oscillator is enabled when the system is up. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-21rtc: rtc-rs5c313: Convert to module_platform_driver()Geert Uytterhoeven1-12/+1
Reduce boilerplate by using the module_platform_driver() helper. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-21rtc: rtc-rs5c313: Fix late hardware initGeert Uytterhoeven1-12/+8
rs5c313_rtc_init() calls platform_driver_register(), and initializes the hardware. This is wrong because of two reasons: 1. As soon as the driver has been registered, the device may be probed. If devm_rtc_device_register() is called before hardware initialization, reading the current time will fail: rs5c313 rs5c313: rs5c313_rtc_read_time: timeout error rs5c313 rs5c313: registered as rtc0 rs5c313 rs5c313: rs5c313_rtc_read_time: timeout error rs5c313 rs5c313: hctosys: unable to read the hardware clock 2. If the platform device does not exist, the driver will still write to a hardware device that may not be present. Fix this by moving the hardware initialization sequence to the driver's .probe() method. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-21rtc: rtc-rs5c313: Drop obsolete platform_set_drvdata() callGeert Uytterhoeven1-6/+1
Commit 284e2fa1da00a998 ("rtc: rtc-rs5c313: use devm_rtc_device_register()"), removed the last user of the driver-specific data. Hence there is no longer a need to set it. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-21rtc: cmos: zero-init wkalrm when reading from CMOSVictor Ding1-0/+2
cmos_read_alarm() may leave certain fields of a struct rtc_wkalrm untouched; therefore, these fields contain garbage if not properly initialized, leading to inconsistent values when converting into time64_t. This patch to zero initialize the struct before calling cmos_read_alarm(). Note that this patch is not intended to produce a correct time64_t, it is only to produce a consistent value. In the case of suspend/resume, a correct time64_t is not necessary; a consistent value is sufficient to correctly perform an equality test for t_current_expires and t_saved_expires. Logic to deduce a correct time64_t is expensive and hence should be avoided. Signed-off-by: Victor Ding <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/20200814191654.v2.1.Iaf7638a2f2a87ff68d85fcb8dec615e41340c97f@changeid
2020-08-12Merge tag 'rtc-5.9' of ↵Linus Torvalds13-214/+242
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Not much this cycle - mostly non urgent driver fixes: - ds1374: use watchdog core - pcf2127: add alarm and pcf2129 support" * tag 'rtc-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: rtc: pcf2127: fix alarm handling rtc: pcf2127: add alarm support rtc: pcf2127: add pca2129 device id rtc: max77686: Fix wake-ups for max77620 rtc: ds1307: provide an indication that the watchdog has fired rtc: ds1374: remove unused define rtc: ds1374: fix RTC_DRV_DS1374_WDT dependencies rtc: cleanup obsolete comment about struct rtc_class_ops rtc: pl031: fix set_alarm by adding back call to alarm_irq_enable rtc: ds1374: wdt: Use watchdog core for watchdog part rtc: Replace HTTP links with HTTPS ones rtc: goldfish: Enable interrupt in set_alarm() when necessary rtc: max77686: Do not allow interrupt to fire before system resume rtc: imxdi: fix trivial typos rtc: cpcap: fix range
2020-08-12rtc: pcf2127: fix alarm handlingAlexandre Belloni1-18/+19
Fix multiple issues when handling alarms: - Use threaded interrupt to avoid scheduling when atomic - Stop matching on week day as it may not be set correctly - Avoid parsing the DT interrupt and use what is provided by the i2c or spi subsystem - Avoid returning IRQ_NONE in case of error in the interrupt handler - Never write WDTF as specified in the datasheet - Set uie_unsupported, as for the pcf85063, setting alarms every seconds is not working correctly and confuses the RTC. Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-12rtc: pcf2127: add alarm supportLiam Beguin1-0/+134
Add alarm support for the pcf2127 RTC chip family. Tested on pca2129. Signed-off-by: Liam Beguin <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Bruno Thomsen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-12rtc: pcf2127: add pca2129 device idLiam Beguin1-0/+3
The PCA2129 is the automotive grade version of the PCF2129. add it to the list of compatibles. Signed-off-by: Liam Beguin <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Bruno Thomsen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-07rtc: max77686: Fix wake-ups for max77620Jon Hunter1-4/+7
Following commit d8f090dbeafd ("rtc: max77686: Do not allow interrupt to fire before system resume"), RTC wake-ups stopped working on Jetson TX2 and Jetson Xavier platforms. The Jetson TX2 uses the max77620 PMIC and the Jetson Xavier uses max20024 PMIC. Both of these PMICs have the same max77620 RTC controller. For the max77620 RTC, the variable 'rtc_irq_from_platform' is defined as true in the max77686 driver and because of this the IRQ passed to the max77686 driver for RTC is the PMIC IRQ and not the parent. Hence, following commit d8f090dbeafd ("rtc: max77686: Do not allow interrupt to fire before system resume"), for the max77620 the RTC IRQ within the PMIC is now getting disabled on entry to suspend and unable to wake the system up. Fix this by only disabling interrupts on entry to suspend in the max77686 RTC driver, if the interrupt is the parent interrupt. Fixes: d8f090dbeafd ("rtc: max77686: Do not allow interrupt to fire before system resume") Signed-off-by: Jon Hunter <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Tested-by: Thierry Reding <[email protected]> Reviewed-by: Thierry Reding <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-05rtc: ds1307: provide an indication that the watchdog has firedChris Packham1-0/+6
There's not much feedback when the ds1388 watchdog fires. Generally it yanks on the reset line and the board reboots. Capture the fact that the watchdog has fired in the past so that userspace can retrieve it via WDIOC_GETBOOTSTATUS. This should help distinguish a watchdog triggered reset from a power interruption. Signed-off-by: Chris Packham <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-21rtc: ds1374: remove unused defineAlexandre Belloni1-3/+1
Remove unused define and fix typo where it should have been used. Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-21rtc: ds1374: fix RTC_DRV_DS1374_WDT dependenciesAlexandre Belloni1-2/+2
It is not enough to select WATCHDOG_CORE, the watchdog part of the driver now also depends on WATCHDOG. This is currently the best we can do because alarm support and watchdog support are mutually exclusive. Reported-by: Randy Dunlap <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Link: https://lore.kernel.org/r/[email protected]
2020-07-16rtc: pl031: fix set_alarm by adding back call to alarm_irq_enableSudeep Holla1-0/+1
Commit c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64") seemed to have accidentally removed the call to pl031_alarm_irq_enable from pl031_set_alarm while switching to 64-bit apis. Let us add back the same to get the set alarm functionality back. Fixes: c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64") Signed-off-by: Sudeep Holla <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Tested-by: Valentin Schneider <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-16rtc: ds1374: wdt: Use watchdog core for watchdog partJohnson CH Chen (陳昭勳)2-197/+62
Let ds1374 watchdog use watchdog core functions. It also includes improving watchdog timer setting and nowayout, and just uses ioctl() of watchdog core. Signed-off-by: Johnson Chen <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/HK2PR01MB328182D5A54BFAA8A22E448AFA640@HK2PR01MB3281.apcprd01.prod.exchangelabs.com
2020-07-16rtc: Replace HTTP links with HTTPS onesAlexander A. Klimov4-5/+5
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-16rtc: goldfish: Enable interrupt in set_alarm() when necessaryHuacai Chen1-0/+1
When use goldfish rtc, the "hwclock" command fails with "select() to /dev/rtc to wait for clock tick timed out". This is because "hwclock" need the set_alarm() hook to enable interrupt when alrm->enabled is true. This operation is missing in goldfish rtc (but other rtc drivers, such as cmos rtc, enable interrupt here), so add it. Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Jiaxun Yang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-16rtc: max77686: Do not allow interrupt to fire before system resumeKrzysztof Kozlowski1-2/+18
The rtc-max77686 device shares the main interrupt line with parent MFD device (max77686 driver). During the system suspend, the parent MFD device disables this IRQ to prevent an early event happening before resuming I2C bus controller. The same should be done by rtc-max77686 driver because otherwise the interrupt handler max77686_rtc_alarm_irq() will be called before its resume function (max77686_rtc_resume()). Such issue is not fatal but disabling shared IRQ by all users ensures correct behavior. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-02rtc: imxdi: fix trivial typosTales L. da Aparecida1-2/+2
Fix typos 'pionter' -> 'pointer' and 'softwere' -> 'software' Signed-off-by: Tales L. da Aparecida <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-02rtc: cpcap: fix rangeSebastian Reichel1-1/+1
Unbreak CPCAP driver, which has one more bit in the day counter increasing the max. range from 2014 to 2058. The original commit introducing the range limit was obviously wrong, since the driver has only been written in 2017 (3 years after 14 bits would have run out). Fixes: d2377f8cc5a7 ("rtc: cpcap: set range") Reported-by: Sicelo A. Mhlongo <[email protected]> Reported-by: Dev Null <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Tested-by: Merlijn Wajer <[email protected]> Acked-by: Tony Lindgren <[email protected]> Acked-by: Merlijn Wajer <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-01rtc: remove fb-puv3 driverMike Rapoport3-296/+0
The unicore32 port is removed from the kernel. There is no point to keep stale RTC driver for this architecture. Signed-off-by: Mike Rapoport <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Guenter Roeck <[email protected]>
2020-06-07Merge tag 'rtc-5.8' of ↵Linus Torvalds16-149/+255
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Not much this cycle apart from the ingenic rtc driver rework. The fixes are mainly minor issues reported by coccinelle rather than real world issues. Subsystem: - new VL flag for backup switch over Drivers: - ingenic: only support device tree - pcf2127: report battery switch over, handle nowayout" * tag 'rtc-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (29 commits) rtc: pcf2127: watchdog: handle nowayout feature rtc: fsl-ftm-alarm: fix freeze(s2idle) failed to wake rtc: abx80x: Provide debug feedback for invalid dt properties rtc: abx80x: Add Device Tree matching table rtc: rv3028: Add missed check for devm_regmap_init_i2c() rtc: mpc5121: Use correct return value for mpc5121_rtc_probe() rtc: goldfish: Use correct return value for goldfish_rtc_probe() rtc: snvs: Add necessary clock operations for RTC APIs rtc: snvs: Make SNVS clock always prepared rtc: ingenic: Reset regulator register in probe rtc: ingenic: Fix masking of error code rtc: ingenic: Remove unused fields from private structure rtc: ingenic: Set wakeup params in probe rtc: ingenic: Enable clock in probe rtc: ingenic: Use local 'dev' variable in probe rtc: ingenic: Only support probing from devicetree rtc: mc13xxx: fix a double-unlock issue rtc: stmp3xxx: update contact email rtc: max77686: Use single-byte writes on MAX77620 rtc: pcf2127: report battery switch over ...
2020-06-06Merge tag 'sh-for-5.8' of git://git.libc.org/linux-shLinus Torvalds1-1/+1
Pull arch/sh updates from Rich Felker: "Fix for arch/sh build regression with newer binutils, removal of SH5, fixes for module exports, and misc cleanup" * tag 'sh-for-5.8' of git://git.libc.org/linux-sh: sh: remove sh5 support sh: add missing EXPORT_SYMBOL() for __delay sh: Convert ins[bwl]/outs[bwl] macros to inline functions sh: Convert iounmap() macros to inline functions sh: Add missing DECLARE_EXPORT() for __ashiftrt_r4_xx sh: configs: Cleanup old Kconfig IO scheduler options arch/sh: vmlinux.scr sh: Replace CONFIG_MTD_M25P80 with CONFIG_MTD_SPI_NOR in sh7757lcr_defconfig sh: sh4a: Bring back tmu3_device early device
2020-06-06rtc: pcf2127: watchdog: handle nowayout featureBruno Thomsen1-0/+1
Driver does not use module parameter for nowayout, so it need to statically initialize status variable of the watchdog_device based on CONFIG_WATCHDOG_NOWAYOUT. Signed-off-by: Bruno Thomsen <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Acked-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-06-06rtc: fsl-ftm-alarm: fix freeze(s2idle) failed to wakeRan Wang1-1/+5
Use dev_pm_set_wake_irq() instead of flag IRQF_NO_SUSPEND to enable wakeup system feature for both freeze(s2idle) and mem(deep). Signed-off-by: Ran Wang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-06-06rtc: abx80x: Provide debug feedback for invalid dt propertiesKevin P. Fleming1-6/+11
When the user provides an invalid value for tc-diode or tc-resistor generate a debug message instead of silently ignoring it. Signed-off-by: Kevin P. Fleming <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-06-01sh: remove sh5 supportArnd Bergmann1-1/+1
sh5 never became a product and has probably never really worked. Remove it by recursively deleting all associated Kconfig options and all corresponding files. Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Rich Felker <[email protected]>
2020-05-30rtc: abx80x: Add Device Tree matching tableKevin P. Fleming1-0/+49
Enable automatic loading of the module when a Device Tree overlay specifies a device supported by this driver. Signed-off-by: Kevin P. Fleming <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-05-30rtc: rv3028: Add missed check for devm_regmap_init_i2c()Chuhong Yuan1-0/+2
rv3028_probe() misses a check for devm_regmap_init_i2c(). Add the missed check to fix it. Fixes: e6e7376cfd7b ("rtc: rv3028: add new driver") Signed-off-by: Chuhong Yuan <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-05-30rtc: mpc5121: Use correct return value for mpc5121_rtc_probe()Tiezhu Yang1-1/+1
When call function devm_platform_ioremap_resource(), we should use IS_ERR() to check the return value and return PTR_ERR() if failed. Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-05-30rtc: goldfish: Use correct return value for goldfish_rtc_probe()Tiezhu Yang1-1/+1
When call function devm_platform_ioremap_resource(), we should use IS_ERR() to check the return value and return PTR_ERR() if failed. Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-05-30rtc: snvs: Add necessary clock operations for RTC APIsAnson Huang1-2/+53
There could be still RTC registers access after RTC suspend with clock disabled, need to add clock operations for each RTC API to make sure accessing RTC registers is successfully. Signed-off-by: Anson Huang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-05-30rtc: snvs: Make SNVS clock always preparedAnson Huang1-2/+2
In IRQ handler, ONLY clock enable/disable is called due to clock prepare can NOT be called in interrupt context, but clock enable/disable will return failure if prepare count is 0, to fix this issue, just make SNVS clock always prepared there, the SNVS clock has no prepare function implemented, so it won't impact anything. Signed-off-by: Anson Huang <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-05-21rtc: mt6397: Add support for the MediaTek MT6358 RTCRan Bi1-3/+15
This add support for the MediaTek MT6358 RTC. Driver using compatible data to store different RTC_WRTGR address offset. This replace RTC_WRTGR to RTC_WRTGR_MT6323 in mt6323-poweroff driver which only needed by armv7 CPU without ATF. Signed-off-by: Ran Bi <[email protected]> Signed-off-by: Hsin-Hsiung Wang <[email protected]> Reviewed-by: Nicolas Boichat <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Reviewed-by: Yingjoe Chen <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2020-05-11rtc: ingenic: Reset regulator register in probePaul Cercueil1-0/+3
The regulator register specifies how many input clock cycles (minus one) are contained in one tick of the 1 Hz clock. Since this register can contain bogus values after the system boots, it needs to be reset in the probe register, otherwise the RTC may count way to slow or way too fast. Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2020-05-11rtc: ingenic: Fix masking of error codePaul Cercueil1-1/+1
The code was returning -ENOENT on any error of platform_get_irq(), even if it returned a different error. Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2020-05-11rtc: ingenic: Remove unused fields from private structurePaul Cercueil1-14/+12
The 'clk' and 'irq' fields were only ever used in the probe function. Therefore they can be moved to be simple local variables of the probe function. Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2020-05-11rtc: ingenic: Set wakeup params in probePaul Cercueil1-51/+44
We can write the wakeup timing parameters as soon as the driver probes, there's no need to wait the very last moment. Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2020-05-11rtc: ingenic: Enable clock in probePaul Cercueil1-2/+17
It makes no sense to request a clock and not enable it even though the hardware is being used. So the driver now enables the clock in the probe. Besides, now we can properly handle errors. Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
2020-05-11rtc: ingenic: Use local 'dev' variable in probePaul Cercueil1-15/+15
Clean a bit the probe function by adding a local struct device *dev variable. Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>