summaryrefslogtreecommitdiffstats
path: root/drivers/rtc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* rtc: da9063: set uie_unsupported when relevantAlexandre Belloni2019-04-021-0/+7
| | | | | | | | | | | | The DA9063AD doesn't support alarms on any seconds and its granularity is the minute. Set uie_unsupported in that case. Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: sd3078: fix manufacturer nameAlexandre Belloni2019-03-201-2/+2
| | | | | | The proper manufacturer name is Shenzhen whwave. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: sh: Fix invalid alarm warning for non-enabled alarmGeert Uytterhoeven2019-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | When no alarm has been programmed on RSK-RZA1, an error message is printed during boot: rtc rtc0: invalid alarm value: 2019-03-14T255:255:255 sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm field that is not enabled. __rtc_read_alarm() validates the received alarm values, and fills in missing fields when needed. While 0xff is handled fine for the year, month, and day fields, and corrected as considered being out-of-range, this is not the case for the hour, minute, and second fields, where -1 is expected for missing fields. Fix this by returning -1 instead, as this value is handled fine for all fields. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: cros-ec: Fail suspend/resume if wake IRQ can't be configuredStephen Boyd2019-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we encounter a failure during suspend where this RTC was programmed to wakeup the system from suspend, but that wakeup couldn't be configured because the system didn't support wakeup interrupts, we'll run into the following warning: Unbalanced IRQ 166 wake disable WARNING: CPU: 7 PID: 3071 at kernel/irq/manage.c:669 irq_set_irq_wake+0x108/0x278 This happens because the suspend process isn't aborted when the RTC fails to configure the wakeup IRQ. Instead, we continue suspending the system and then another suspend callback fails the suspend process and "unwinds" the previously suspended drivers by calling their resume callbacks. When we get back to resuming this RTC driver, we'll call disable_irq_wake() on an IRQ that hasn't been configured for wake. Let's just fail suspend/resume here if we can't configure the system to wake and the user has chosen to wakeup with this device. This fixes this warning and makes the code more robust in case there are systems out there that can't wakeup from suspend on this line but the user has chosen to do so. Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Evan Green <evgreen@chromium.org> Cc: Benson Leung <bleung@chromium.org> Cc: Guenter Roeck <groeck@chromium.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Acked-By: Benson Leung <bleung@chromium.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* Merge tag 'tag-chrome-platform-for-v5.1' of ↵Linus Torvalds2019-03-123-0/+189
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux Pull chrome platform updates from Benson Leung: - SPDX identifier cleanup for platform/chrome - Cleanup series between mfd and chrome/platform, moving cros-ec attributes from mfd/cros_ec_dev to sub-drivers in platform/chrome - Wilco EC driver - Maintainership change to new group repository * tag 'tag-chrome-platform-for-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: platform/chrome: fix wilco-ec dependencies platform/chrome: wilco_ec: Add RTC driver platform/chrome: wilco_ec: Add support for raw commands in debugfs platform/chrome: Add new driver for Wilco EC platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec MAINTAINERS: chrome-platform: change the git tree to a chrome-platform group git tree platform/chrome: cros_ec_sysfs: remove pr_fmt() define platform/chrome: cros_ec_lightbar: remove pr_fmt() define platform/chrome: cros_kbd_led_backlight: switch to SPDX identifier platform/chrome: cros_ec_spi: switch to SPDX identifier platform/chrome: cros_ec_proto: switch to SPDX identifier platform/chrome: cros_ec_lpc: switch to SPDX identifier platform/chrome: cros_ec_i2c: switch to SPDX identifier platform/chrome: cros_ec_vbc: switch to SPDX identifier platform/chrome: cros_ec_sysfs: switch to SPDX identifier platform/chrome: cros_ec_lightbar: switch to SPDX identifier platform/chrome: cros_ec_debugfs: switch to SPDX identifier platform/chrome: cromeos_pstore: switch to SPDX identifier
| * platform/chrome: wilco_ec: Add RTC driverNick Crews2019-02-213-0/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This Embedded Controller has an internal RTC that is exposed as a standard RTC class driver with read/write functionality. The driver is added to the drivers/rtc/ so that the maintainer of that directory will be able to comment on this change, as that maintainer is the expert on this system. In addition, the driver code is called indirectly after a corresponding device is registered from core.c, as opposed to core.c registering the driver callbacks directly. To test: > hwclock --show --rtc /dev/rtc1 2007-12-31 16:01:20.460959-08:00 > hwclock --systohc --rtc /dev/rtc1 > hwclock --show --rtc /dev/rtc1 2018-11-29 17:08:00.780793-08:00 > hwclock --show --rtc /dev/rtc1 2007-12-31 16:01:20.460959-08:00 > hwclock --systohc --rtc /dev/rtc1 > hwclock --show --rtc /dev/rtc1 2018-11-29 17:08:00.780793-08:00 Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> [Fix the sparse warning: symbol 'wilco_ec_rtc_read/write' was not declared] Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* | rtc: pic32: convert to SPDX identifierAlexandre Belloni2019-03-041-9/+1
| | | | | | | | | | | | Use SPDX-License-Identifier instead of a verbose license text. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: pic32: let the core handle rangeAlexandre Belloni2019-03-041-7/+3
| | | | | | | | | | | | Let the core handle the RTC range instead of open coding it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: pic32: convert to devm_rtc_allocate_deviceAlexandre Belloni2019-03-041-6/+8
| | | | | | | | | | | | This allows further improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: update my email addressAlexandre Belloni2019-03-042-4/+4
| | | | | | | | | | | | Use my current email address. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: rv8803: convert to SPDX identifierAlexandre Belloni2019-03-041-5/+1
| | | | | | | | | | | | Use SPDX-License-Identifier instead of a verbose license text. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: rv8803: let the core handle rangeAlexandre Belloni2019-03-041-3/+2
| | | | | | | | | | | | Let the core handle the RTC range instead of open coding it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: tx4939: convert to SPDX identifierAlexandre Belloni2019-03-041-5/+2
| | | | | | | | | | | | | | | | | | Use SPDX-License-Identifier instead of a verbose license text. The original text refers to the COPYING file in the main directory which is GPL v2 only so also update MODULE_LICENSE() to "GPL v2" instead of "GPL". Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: tx4939: use .set_timeAlexandre Belloni2019-03-031-2/+3
| | | | | | | | | | | | Switch from .set_mmss to .set_time as the former is deprecated. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: tx4939: switch to rtc_time64_to_tm/rtc_tm_to_time64Alexandre Belloni2019-03-031-3/+3
| | | | | | | | | | | | | | Call the 64bit versions of rtc_time_to_tm now that the range is enforced by the core. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: tx4939: set rangeAlexandre Belloni2019-03-031-0/+1
| | | | | | | | | | | | | | The TX4939 RTC is a 48bit counter that counts two on every clock edge of 32.768 KHz oscillator clock so it counts 32bit seconds. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: tx4939: remove useless testAlexandre Belloni2019-03-031-7/+0
| | | | | | | | | | | | | | The tested condition will never happen as the core always passes a fully set struct tm (using rtc_ktime_to_tm) to the .set_alarm callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: zynqmp: let the core handle rangeAlexandre Belloni2019-03-031-7/+1
| | | | | | | | | | | | Let the core handle the RTC range instead of open coding it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: zynqmp: fix possible race conditionAlexandre Belloni2019-03-031-3/+7
| | | | | | | | | | | | | | | | | | | | | | 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 struct before requesting the IRQ. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: imx-sc: use rtc_time64_to_tmAlexandre Belloni2019-03-031-1/+1
| | | | | | | | | | | | | | The imx-sc driver properly sets range_max, use rtc_time64_to_tm() instead of the deprecated rtc_time_to_tm() Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: rx8581: Add support for Epson rx8571 RTCBiju Das2019-03-022-11/+108
| | | | | | | | | | | | | | | | | | | | | | Add support for Epson rx8571 real-time clock. rx8571 rtc is compatible with rx8581,except that rx8571 has additional 16 bytes of RAM. 16 bytes of nvmem is supported and exposed in sysfs (# is the instance number,starting with 0): /sys/bus/nvmem/devices/rx8571-#/nvmem Signed-off-by: Biju Das <biju.das@bp.renesas.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: pcf85063: remove dead codeAlexey Roslyakov2019-03-021-7/+0
| | | | | | | | | | | | | | | | | | Some of defines are not in use since 7b5768486a910532885f01b9d2dad4818c8b3be1. Remove it to make the code easier to read and understand. Signed-off-by: Alexey Roslyakov <alexey.roslyakov@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: remove rtc_class_ops.read_callbackAlexandre Belloni2019-02-251-5/+0
| | | | | | | | | | | | | | | | Since commit 416f0e8056f7 ("RTC: sa1100: Update the sa1100 RTC driver."), the last user of .read_callback is gone. It has been 8 years and now new user appeared. Simply remove it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: add AB-RTCMC-32.768kHz-EOZ9 RTC supportArtem Panfilov2019-02-183-0/+476
| | | | | | | | | | | | | | | | This patch adds support for AB-RTCMC-32.768kHz-EOZ9 RTC/Calendar module with I2C interface. Signed-off-by: Artem Panfilov <panfilov.artyom@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: hid-sensor-time: stop selecting IIOAlexandre Belloni2019-02-171-2/+1
| | | | | | | | | | | | | | | | Make RTC_DRV_HID_SENSOR_TIME depend on IIO and HID_SENSOR_HUB to remove possible circular dependencies as this is the only symbol selecting those. Suggested-by: Florian Lohoff <f@zz.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: rv3028: add new driverAlexandre Belloni2019-02-173-0/+742
| | | | | | | | | | | | | | | | | | | | | | Add a driver for the MicroCrystal RV-3028. It is a SMT Real-Time Clock Module that incorporates an integrated CMOS circuit together with an XTAL. It has an i2c interface. The driver handles date/time, alarms, trickle charging, timestamping, frequency offset correction, EEPROM and NVRAM. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: isl1208: Add new style nvmem support to driverTrent Piepho2019-02-171-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the RTC's NVRAM using the standard nvmem support that is part of the Linux RTC framework. This driver already has a sysfs attribute that provides access to the RTC's NVRAM as a single 16-bit value. Some chips have more than two bytes of NVRAM, so this will not work for them. It's also non-standard. This sysfs attribute is left in for backward compatibility, but will only be able to read the first two bytes of NVRAM. The nvmem interface will allow access to all NVRAM, e.g. eight bytes on the isl1218. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: isl1208: Support more chip variationsTrent Piepho2019-02-171-22/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add more support in the driver for dealing with differences in is1208 compatible chips. Put the 1208, 1209, 1218, and 1219 in the list and encode information about nvram size, tamper, and timestamp features. This adds support for the isl1209, which has a tamper detect but no timestamp feature. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: isl1208: Introduce driver state structTrent Piepho2019-02-171-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | This driver has no state of its own, depending entirely on what is in the generic rtc device. Intoduce a state struct. For now it only contains a pointer to the rtc device struct, but future patches will add more data. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: meson: remove useless rtc_nvmem_unregister callAlexandre Belloni2019-02-171-4/+1
| | | | | | | | | | | | | | | | rtc_nvmem_unregister() is called on rtc_device release so it is not necessary to call it from the driver. Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: support for the Amlogic Meson RTCMartin Blumenstingl2019-02-113-0/+422
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the RTC block on the 32-bit Amlogic Meson6, Meson8, Meson8b and Meson8m2 SoCs. The RTC is split in to two parts, which are both managed by this driver: - the AHB front end - and a simple serial connection to the actual registers The RTC_COUNTER register which holds the time is 32-bits wide. There are four 32-bit wide (in total: 16 bytes) "regmem" registers which are exposed using nvmem. On Amlogic's 3.10 kernel this is used to store data which needs to survive a suspend / resume cycle. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> [resurrected Ben's patches after 2 years] Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: rs5c372: Fix reading from rtc when the oscillator got interrupted.Oliver.Rohe@wago.com2019-02-111-7/+47
| | | | | | | | | | | | | | | | | | When the oscillator of the rtc gets interrupted, e.g. due to an empty battery, reading from the rtc will now return an error and the oscillator bit will be cleared, once the rtc is successfully reset. Signed-off-by: Oliver Rohe <oliver.rohe@wago.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: imx-sc: depend on HAVE_ARM_SMCCCAlexandre Belloni2019-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | Fix the following build issue: drivers/rtc/rtc-imx-sc.o: In function `imx_sc_rtc_set_time': >> rtc-imx-sc.c:(.text+0x212): undefined reference to `__arm_smccc_smc' Fixes: 13a929f38ad7 ("rtc: imx-sc: add rtc set time support") Reviewed-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: pm8xxx: fix unintended sign extensionColin Ian King2019-02-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shifting a u8 by 24 will cause the value to be promoted to an integer. If the top bit of the u8 is set then the following conversion to an unsigned long will sign extend the value causing the upper 32 bits to be set in the result. Fix this by casting the u8 value to an unsigned long before the shift. Detected by CoverityScan, CID#1309693 ("Unintended sign extension") Fixes: 9a9a54ad7aa2 ("drivers/rtc: add support for Qualcomm PMIC8xxx RTC") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: 88pm80x: fix unintended sign extensionColin Ian King2019-02-081-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shifting a u8 by 24 will cause the value to be promoted to an integer. If the top bit of the u8 is set then the following conversion to an unsigned long will sign extend the value causing the upper 32 bits to be set in the result. Fix this by casting the u8 value to an unsigned long before the shift. Detected by CoverityScan, CID#714646-714649 ("Unintended sign extension") Fixes: 2985c29c1964 ("rtc: Add rtc support to 88PM80X PMIC") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: 88pm860x: fix unintended sign extensionColin Ian King2019-02-081-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shifting a u8 by 24 will cause the value to be promoted to an integer. If the top bit of the u8 is set then the following conversion to an unsigned long will sign extend the value causing the upper 32 bits to be set in the result. Fix this by casting the u8 value to an unsigned long before the shift. Detected by CoverityScan, CID#144925-144928 ("Unintended sign extension") Fixes: 008b30408c40 ("mfd: Add rtc support to 88pm860x") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: ds1307: rx8130: Fix alarm handlingUwe Kleine-König2019-02-071-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the EXTENSION.WADA bit is set, register 0x19 contains a bitmap of week days, not a day of month. As Linux only handles a single alarm without repetition using day of month is more flexible, so clear this bit. (Otherwise a value depending on time.tm_wday would have to be written to register 0x19.) Also optimize setting the AIE bit to use a single register write instead of a bulk write of three registers. Fixes: ee0981be7704 ("rtc: ds1307: Add support for Epson RX8130CE") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: ds1307: rx8130: honor Voltage Loss Flag when reading the timeUwe Kleine-König2019-02-071-0/+25
| | | | | | | | | | | | | | | | | | When voltage dropped since the RTC was last set the reported time is not reliable. In this case return an error indicator instead of a bogus time. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: ds1307: correct register offset for rx8130Uwe Kleine-König2019-02-071-6/+7
| | | | | | | | | | | | | | | | | | | | While rx8130 has a register offset of 0x10 in its chip_desc, this isn't used when regmap accesses are done. So add 0x10 to access the right locations. Fixes: ee0981be7704 ("rtc: ds1307: Add support for Epson RX8130CE") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: ds1307: forward declare chips array instead of a bunch of functionsUwe Kleine-König2019-02-071-325/+297
| | | | | | | | | | | | | | | | | | There used to be 16 declarations for static functions. By just adding a declaration for the chips array and reordering the functions the 16 function declarations can be dropped. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: ds1307: Move register definitions to start of fileUwe Kleine-König2019-02-071-26/+26
| | | | | | | | | | | | | | | | This allows to use the register offsets in all functions which is needed in one of the next patches. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: imx-sc: add rtc set time supportAnson Huang2019-02-071-0/+19
| | | | | | | | | | | | | | | | | | | | This patch adds i.MX system controller RTC set time support, the RTC set time is implemented via SIP(silicon provider) runtime service call and ARM-Trusted-Firmware will communicate with system controller via MU(message unit) IPC to set RTC time. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: rs5c372: r2221: fix to use the correct XSTP bitOliver.Rohe@wago.com2019-02-051-11/+21
| | | | | | | | | | | | | | | | The Ricoh chips have slightly different register layouts and the r2221 chip uses bit 5 as the oscillator halt sensor bit. Signed-off-by: Olive Rohe <oliver.rohe@wago.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: snvs: make sure clock is enabled for interrupt handleAnson Huang2019-02-051-0/+6
| | | | | | | | | | | | | | | | | | | | During system suspend, the SNVS RTC's clock will be disabled in noirq suspend phase, but SNVS RTC's alarm interrupt could still arrive, system will hang if SNVS RTC driver tries to access register without clock enabled, this patch fixes the issue of this scenario. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: ds1672: fix unintended sign extensionColin Ian King2019-02-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shifting a u8 by 24 will cause the value to be promoted to an integer. If the top bit of the u8 is set then the following conversion to an unsigned long will sign extend the value causing the upper 32 bits to be set in the result. Fix this by casting the u8 value to an unsigned long before the shift. Detected by CoverityScan, CID#138801 ("Unintended sign extension") Fixes: edf1aaa31fc5 ("[PATCH] RTC subsystem: DS1672 driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: abx80x: Configure reserved bits in RV1805Marek Vasut2019-01-301-2/+65
| | | | | | | | | | | | | | | | | | | | | | The RV1805 uses smaller package than the AB1805, discern those two chips based on the compatible value and configure reserved bits in the RV1805 to prevent current leakage and accidental test mode entry. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> To: linux-rtc@vger.kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: sd3078: fix platform_no_drv_owner.cocci warningsYueHaibing2019-01-231-1/+0
| | | | | | | | | | | | | | | | Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: Add Cadence RTC driverJan Kotas2019-01-223-0/+434
| | | | | | | | | | | | | | | | | | | | This patch adds a driver for Cadence RTC controller. It can be enabled with RTC_DRV_CADENCE Kconfig option. It supports waking system from sleep modes. Signed-off-by: Jan Kotas <jank@cadence.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: cmos: ignore bogus century byteEric Wong2019-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Older versions of Libreboot and Coreboot had an invalid value (`3' in my case) in the century byte affecting the GM45 in the Thinkpad X200. Not everybody's updated their firmwares, and Linux <= 4.2 was able to read the RTC without problems, so workaround this by ignoring invalid values. Fixes: 3c217e51d8a272b9 ("rtc: cmos: century support") Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Sylvain Chouleur <sylvain.chouleur@intel.com> Cc: Patrick McDermott <patrick.mcdermott@libiquity.com> Cc: linux-rtc@vger.kernel.org Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | rtc: hym8563: fix a missing check of block data readKangjie Lu2019-01-221-0/+2
| | | | | | | | | | | | | | | | | | | | When i2c_smbus_read_i2c_block_data() fails, the read data in "buf" could be incorrect and should not be used. The fix checks if i2c_smbus_read_i2c_block_data fails, and if so, return its error code upstream. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>