summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-pcf2127.c
AgeCommit message (Collapse)Author
2021-07-10rtc: pcf2127: handle timestamp interruptsMian Yousaf Kaukab
commit 03623b4b041c ("rtc: pcf2127: add tamper detection support") added support for timestamp interrupts. However they are not being handled in the irq handler. If a timestamp interrupt occurs it results in kernel disabling the interrupt and displaying the call trace: [ 121.145580] irq 78: nobody cared (try booting with the "irqpoll" option) ... [ 121.238087] [<00000000c4d69393>] irq_default_primary_handler threaded [<000000000a90d25b>] pcf2127_rtc_irq [rtc_pcf2127] [ 121.248971] Disabling IRQ #78 Handle timestamp interrupts in pcf2127_rtc_irq(). Save time stamp before clearing TSF1 and TSF2 flags so that it can't be overwritten. Set a flag to mark if the timestamp is valid and only report to sysfs if the flag is set. To mimic the hardware behavior, don’t save another timestamp until the first one has been read by the userspace. However, if the alarm irq is not configured, keep the old way of handling timestamp interrupt in the timestamp0 sysfs calls. Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Tested-by: Bruno Thomsen <bruno.thomsen@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210629150643.31551-1-ykaukab@suse.de
2021-06-20rtc: pcf2127: Fix the datasheet URLFabio Estevam
The current datasheet URL is no longer valid. Replace with a valid one. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210603143447.2223353-1-festevam@gmail.com
2021-02-13rtc: pcf2127: properly set flag WD_CD for rtc chips(pcf2129, pca2129)Biwen Li
Properly set flag WD_CD for rtc chips(pcf2129, pca2129) Signed-off-by: Biwen Li <biwen.li@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201202031840.15582-1-biwen.li@oss.nxp.com
2021-01-26rtc: pcf2127: Run a OTP refresh if not done beforePhilipp Rosenberger
The datasheet of the PCF2127 states, it is recommended to process an OTP refresh once the power is up and the oscillator is operating stable. The OTP refresh takes less than 100 ms to complete. Signed-off-by: Philipp Rosenberger <p.rosenberger@kunbus.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210118085752.5759-3-p.rosenberger@kunbus.com
2021-01-26rtc: pcf2127: Disable Power-On Reset OverridePhilipp Rosenberger
To resume normal operation after a total power loss (no or empty battery) the "Power-On Reset Override (PORO)" facility needs to be disabled. The register reset value sets the PORO enabled and the data sheet recommends setting it to disabled for normal operation. From what I've seen on the PCF2127 and PCF2129 there is no event generated at the interrupt pin (INT), as long the PORO bit is set. This behavior is not documented in the manual. Signed-off-by: Philipp Rosenberger <p.rosenberger@kunbus.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210118085752.5759-2-p.rosenberger@kunbus.com
2021-01-16rtc: pcf2127: remove pcf2127_rtc_alrm_opsAlexandre Belloni
Move the alarm callbacks in pcf2127_rtc_ops and use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of having a supplementary struct rtc_class_ops without alarm callbacks. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210110231752.1418816-8-alexandre.belloni@bootlin.com
2020-12-19rtc: pcf2127: only use watchdog when explicitly availableUwe Kleine-König
Most boards using the pcf2127 chip (in my bubble) don't make use of the watchdog functionality and the respective output is not connected. The effect on such a board is that there is a watchdog device provided that doesn't work. So only register the watchdog if the device tree has a "reset-source" property. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [RV: s/has-watchdog/reset-source/] Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201218101054.25416-3-rasmus.villemoes@prevas.dk
2020-11-19rtc: rework rtc_register_device() resource managementBartosz Golaszewski
rtc_register_device() is a managed interface but it doesn't use devres by itself - instead it marks an rtc_device as "registered" and the devres callback for devm_rtc_allocate_device() takes care of resource release. This doesn't correspond with the design behind devres where managed structures should not be aware of being managed. The correct solution here is to register a separate devres callback for unregistering the device. While at it: rename rtc_register_device() to devm_rtc_register_device() and add it to the list of managed interfaces in devres.rst. This way we can avoid any potential confusion of driver developers who may expect there to exist a corresponding unregister function. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl
2020-11-19rtc: add devm_ prefix to rtc_nvmem_register()Bartosz Golaszewski
rtc_nvmem_register() is a managed interface. It doesn't require any release function to be called at driver detach. To avoid confusing driver authors, let's rename it to devm_rtc_nvmem_register() and add it to the list of managed interfaces in Documentation/. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201109163409.24301-6-brgl@bgdev.pl
2020-10-27rtc: pcf2127: fix pcf2127_nvmem_read/write() returnsDan Carpenter
These functions should return zero on success. Non-zero returns are treated as error. On some paths, this doesn't matter but in nvmem_cell_read() a non-zero return would be passed to ERR_PTR() and lead to an Oops. Fixes: d6c3029f32f7 ("rtc: pcf2127: add support for accessing internal static RAM") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201022070451.GA2817669@mwanda
2020-10-27rtc: pcf2127: move watchdog initialisation to a separate functionUwe Kleine-König
The obvious advantages are: - The linker can drop the watchdog functions if CONFIG_WATCHDOG is off. - All watchdog stuff grouped together with only a single function call left in generic code. - Watchdog register is only read when it is actually used. - Less #ifdefery Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200924105256.18162-2-u.kleine-koenig@pengutronix.de
2020-09-15rtc: pcf2127: fix a bug when not specify interrupts propertyBiwen Li
Fix a bug when not specify interrupts property in dts as follows, rtc-pcf2127-i2c 1-0051: failed to request alarm irq rtc-pcf2127-i2c: probe of 1-0051 failed with error -22 Signed-off-by: Biwen Li <biwen.li@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200915073213.12779-1-biwen.li@oss.nxp.com
2020-08-12rtc: pcf2127: fix alarm handlingAlexandre Belloni
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 <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200812085114.474903-1-alexandre.belloni@bootlin.com
2020-08-12rtc: pcf2127: add alarm supportLiam Beguin
Add alarm support for the pcf2127 RTC chip family. Tested on pca2129. Signed-off-by: Liam Beguin <lvb@xiphos.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20200630024211.12782-3-liambeguin@gmail.com
2020-08-12rtc: pcf2127: add pca2129 device idLiam Beguin
The PCA2129 is the automotive grade version of the PCF2129. add it to the list of compatibles. Signed-off-by: Liam Beguin <lvb@xiphos.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20200630024211.12782-2-liambeguin@gmail.com
2020-06-06rtc: pcf2127: watchdog: handle nowayout featureBruno Thomsen
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 <bruno.thomsen@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20200604162602.76524-1-bruno.thomsen@gmail.com
2020-05-11rtc: pcf2127: report battery switch overAlexandre Belloni
Add support for the RTC_VL_BACKUP_SWITCH flag to report battery switch over events. Link: https://lore.kernel.org/r/20200511140335.799133-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: pcf2127: set regmap max_registerAlexandre Belloni
Set regmap max_register to ease debugging and enforce the register range. Link: https://lore.kernel.org/r/20200505201310.255145-4-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: pcf2127: remove unnecessary #ifdefAlexandre Belloni
There is not point in setting .ioctl to NULL when CONFIG_RTC_INTF_DEV is not defined because it would not be called anyway. Link: https://lore.kernel.org/r/20200505201310.255145-3-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: pcf2127: let the core handle rtc rangeAlexandre Belloni
Let the core handle offsetting and windowing the RTC range. Link: https://lore.kernel.org/r/20200505201310.255145-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18rtc: pcf2127: return meaningful value for RTC_VL_READAlexandre Belloni
PCF2127_BIT_CTRL3_BLF indicates the battery is low and needs to be replaced soon. Link: https://lore.kernel.org/r/20191214220259.621996-5-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-21rtc: pcf2127: handle boot-enabled watchdog featureMartin Hundebøll
Linux should handle when the pcf2127 watchdog feature is enabled by the bootloader. This is done by checking the watchdog timer value during init, and set the WDOG_HW_RUNNING flag if the value differs from zero. Signed-off-by: Martin Hundebøll <martin@geanix.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20191021080838.2789-1-martin@geanix.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-27rtc: pcf2127: bugfix: watchdog build dependencyBruno Thomsen
Disable watchdog registation when kernel is build without watchdog functionality, and enable watchdog core otherwise. This removes compile errors like the one below: drivers/rtc/rtc-pcf2127.o: in function `pcf2127_probe.constprop.3': rtc-pcf2127.c:(.text.unlikely+0x2c8): undefined reference to `devm_watchdog_register_device' Watchdog feature in chip will always be configured as this is safe to do in both cases and minimize code churn. Reported-by: Hulk Robot <hulkci@huawei.com> Reported-by: YueHaibing <yuehaibing@huawei.com> Fixes: bbc597561ce1 ("rtc: pcf2127: add watchdog feature support") Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190827143656.4734-1-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-27rtc: pcf2127: add tamper detection supportBruno Thomsen
Add support for integrated tamper detection function in both PCF2127 and PCF2129 chips. This patch implements the feature by adding an additional timestamp0 file to sysfs device path. This file contains seconds since epoch, if an event occurred, or is empty, if none occurred. Interface should match ISL1208 and RV3028 RTC drivers. Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-5-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-27rtc: pcf2127: add watchdog feature supportBruno Thomsen
Add partial support for the watchdog functionality of both PCF2127 and PCF2129 chips. The programmable watchdog timer is currently using a fixed clock source of 1Hz. This result in a selectable range of 1-255 seconds, which covers most embedded Linux use-cases. Clock sources of 4096Hz, 64Hz and 1/60Hz is mostly useful in MCU use-cases. Countdown timer not available when using watchdog feature. Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20190822131936.18772-4-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-23rtc: pcf2127: bugfix: read rtc disables watchdogBruno Thomsen
The previous fix listed bulk read of registers as root cause of accendential disabling of watchdog, since the watchdog counter register (WD_VAL) was zeroed. Fixes: 3769a375ab83 rtc: pcf2127: bulk read only date and time registers. Tested with the same PCF2127 chip as Sean reveled root cause of WD_VAL register value zeroing was caused by reading CTRL2 register which is one of the watchdog feature control registers. So the solution is to not read the first two control registers (CTRL1 and CTRL2) in pcf2127_rtc_read_time as they are not needed anyway. Size of local buf variable is kept to allow easy usage of register defines to improve readability of code. Debug trace line was updated after CTRL1 and CTRL2 are no longer read from the chip. Also replaced magic numbers in buf access with register defines. Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-3-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-23rtc: pcf2127: cleanup register and bit definesBruno Thomsen
Cleanup of defines to follow kernel coding style and increase code readability by using same register and bit define style. Change PCF2127_REG_RAM_{addr_MSB,wrt_cmd,rd_cmd} to upper case as kernel coding guide section 12 'Macros, Enums and RTL' states "Names of macros defining constants and labels in enums are capitalized". Improve readability of RAM register comment by making whole sentences. Remove parentheses from register defines as they are only used for expressions and not constants. As there are no clear style for name of registers and bits in the kernel drivers, I suggest the following for at least this driver, but hopefully also other RTC drivers. Register name should follow this convention: [chip]_REG_[reg name] 0xXX Bit name should follow this convention, so it clearly states which chip register it's part of: [chip]_BIT_[reg name]_[bit name] BIT(X) Additionally I suggest bit defines are always placed right below its corresponding register define and using an extra tab indentation for the BIT(X) part. This will visually make it easy to see that bit defines are part of the complete register definition. Rename PCF2127_OSF to PCF2127_BIT_SC_OSF and move it right below PCF2127_REG_SC. This will improve readability of bit checks as it's easy to verify that it uses the correct register. Move end of line comments above register defines as it's more like a heading for 1 register define and up to 8 bit defines or a collection of registers that are close related like timestamp split across 6 registers. Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-2-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-23rtc: pcf2127: convert to devm_rtc_allocate_deviceBruno Thomsen
This allows further improvement of the driver. Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20190822131936.18772-1-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-07rtc: pcf2127: fix a kmemleak caused in pcf2127_i2c_gather_writeXulin Sun
pcf2127_i2c_gather_write() allocates memory as local variable for i2c_master_send(), after finishing the master transfer, the allocated memory should be freed. The kmemleak is reported: unreferenced object 0xffff80231e7dba80 (size 64): comm "hwclock", pid 27762, jiffies 4296880075 (age 356.944s) hex dump (first 32 bytes): 03 00 12 03 19 02 11 13 00 80 98 18 00 00 ff ff ................ 00 50 00 00 00 00 00 00 02 00 00 00 00 00 00 00 .P.............. backtrace: [<ffff000008221398>] create_object+0xf8/0x278 [<ffff000008a96264>] kmemleak_alloc+0x74/0xa0 [<ffff00000821070c>] __kmalloc+0x1ac/0x348 [<ffff0000087ed1dc>] pcf2127_i2c_gather_write+0x54/0xf8 [<ffff0000085fd9d4>] _regmap_raw_write+0x464/0x850 [<ffff0000085fe3f4>] regmap_bulk_write+0x1a4/0x348 [<ffff0000087ed32c>] pcf2127_rtc_set_time+0xac/0xe8 [<ffff0000087eaad8>] rtc_set_time+0x80/0x138 [<ffff0000087ebfb0>] rtc_dev_ioctl+0x398/0x610 [<ffff00000823f2c0>] do_vfs_ioctl+0xb0/0x848 [<ffff00000823fae4>] SyS_ioctl+0x8c/0xa8 [<ffff000008083ac0>] el0_svc_naked+0x34/0x38 [<ffffffffffffffff>] 0xffffffffffffffff Signed-off-by: Xulin Sun <xulin.sun@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-11rtc: pcf2127: add support for accessing internal static RAMUwe Kleine-König
The PCF2127 has 512 bytes of internal static RAM and this patch expands the driver to access this memory. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-03-02rtc: stop validating rtc_time in .read_timeAlexandre Belloni
The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2017-02-23rtc: pcf2127: bulk read only date and time registers.Sean Nyekjaer
Read control registers one by one and bulk read time registers. This fixes when the clock is read, the watchdog counter register is zeroed. Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-14rtc: pcf2127: add pcf2129 device idAkinobu Mita
There are only a few differences between PCF2127 and PCF2129 (PCF2127 has 512 bytes of general purpose SRAM and count-down timer). The rtc-pcf2127 driver currently doesn't use the PCF2127 specific functionality and Kconfig help text already says this driver supports PCF2127/29, so we can simply add pcf2129 to device id list. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-14rtc: pcf2127: add support for spi interfaceAkinobu Mita
pcf2127 has selectable I2C-bus and SPI-bus interface support. This adds support for SPI interface. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-14rtc: pcf2127: convert to use regmapAkinobu Mita
pcf2127 has selectable I2C-bus and SPI-bus interface support. Currently rtc-pcf2127 driver only supports I2C. This is preparation for support for SPI interface. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-11-08rtc: pcf2127: remove useless driver versionUwe Kleine-König
A driver version is only really sensible for oot drivers. Also the dev_info about having found a chip only signals that allocating the driver data succeeded and so isn't worth much. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-11-08rtc: pcf2127: fix reading uninitialized value on RTC_READ_VL ioctlUwe Kleine-König
The flag reported on the RTC_READ_VL ioctl is only initialized when the date is read out. So the voltage low value doesn't represent reality but the status at the time the date was read (or 0 if the date was not read yet). Moreover when userspace requests a value via an ioctl there is no added benefit to also make a prosa representation of this (and other) values appear in the kernel log so remove the calls to dev_info and the driver data members to track their state. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-11-03rtc: pcf2127: make module license match the file headerUwe Kleine-König
The header of the pcf2127 driver specifies GPL v2 only as license, so use "GPL v2" as module license specifier instead of "GPL" as the latter means "GNU Public License v2 or later". Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: Drop owner assignment from i2c_driverKrzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: pcf2127: use OFS flag to detect unreliable date and warn the userAndrea Scian
The PCF2127 datasheet states that it's wrong to say that the date in unreliable if BLF (battery low flag) is set but instead, OSF (seconds register) should be used to check if oscillator, for any reason, stopped. Battery may be low (usually below 2V5 threshold) but the date may be anyway correct (typically date is unreliable when input voltage is below 1V2). Signed-off-by: Andrea Scian <andrea.scian@dave.eu> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: use rtc_valid_tm() error code when reading date/timeAndrea Scian
There's a wrong comment in some RTC drivers that say it's better to ignore rtc_valid_tm() when reading RTC timestamp. However this is wrong and is better to return to the userspace the error if timestamp is not valid. Signed-off-by: Andrea Scian <andrea.scian@dave.eu> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2014-01-23drivers/rtc/rtc-pcf2127.c: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERODuan Jiong
Fix a coccinelle error regarding usage of IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO. Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-pcf2127.c: remove empty functionSachin Kamat
The 'remove' function is empty and does not do anything. Delete it. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03rtc: add NXP PCF2127 support (i2c)Renaud Cerrato
Added support for NXP PCF2127 RTC (i2c). [akpm@linux-foundation.org: fix typo, fix warnings] Signed-off-by: Renaud Cerrato <r.cerrato@til-technologies.fr> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>