summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-pcf2127.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-28rtc: pcf2127: remove useless checkAlexandre Belloni1-9/+0
This check is only useful when introducing support for a new RTC in the driver. Cut down the number of strings in th driver. Link: https://lore.kernel.org/r/20230827214649.537095-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17rtc: pcf2127: remove unused function argumentHugo Villeneuve1-6/+3
Fixes the following W=1 kernel build warning(s): drivers/rtc/rtc-pcf2127.c: In function ‘pcf2127_probe’: drivers/rtc/rtc-pcf2127.c:635:32: warning: unused parameter ‘name’ [-Wunused-parameter] 635 | int alarm_irq, const char *name, bool is_pcf2127) | ~~~~~~~~~~~~^~~~ Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230801190432.3340545-1-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17rtc: pcf2127: add error checking when disabling POR0Hugo Villeneuve1-1/+3
If PCF2127 device is absent from the I2C bus, or if there is a communication problem, disabling POR0 may fail silently and we still continue with probing the device. In that case, abort probe operation. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230728171211.3016019-1-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17rtc: pcf2127: fix error code in pcf2127_enable_ts()Dan Carpenter1-1/+1
This error path accidentally returns success. Return -EINVAL instead. Fixes: 420cc9e850db ("rtc: pcf2127: add support for multiple TS functions") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Reviewed-by: Hugo Villeneuve <hugo@hugovil.com> Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/55b9c84b-9d21-444f-b91a-cf9316b65833@moroto.mountain Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: add UIE support for PCF2131Hugo Villeneuve1-2/+10
The PCF2127/29 do NOT support alarms with a 1 second resolution, but the PCF2131 does. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-17-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: add flag for watchdog register value read supportHugo Villeneuve1-6/+14
The watchdog value register cannot be read on the PCF2131 after being set. Add a new flag to identify which variant has read access to this register, and use this flag to selectively test if watchdog timer was started by bootloader. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20230622145800.2442116-16-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: support generic watchdog timing configurationHugo Villeneuve1-9/+55
Introduce in the configuration structure two new values to hold the watchdog clock source and the min_hw_heartbeat_ms value. The minimum and maximum timeout values are automatically computed from the watchdog clock source value for each variant. The PCF2131 has no 1Hz watchdog clock source, as is the case for PCF2127/29. The next best choice is using a 1/4Hz clock, giving a watchdog timeout range between 4 and 1016s. By using the same register configuration as for the PCF2127/29, the 1/4Hz clock source is selected. Note: the PCF2127 datasheet gives a min/max range between 1 and 255s, but it should be between 2 and 254s, because the watchdog is triggered when the timer value reaches 1, not 0. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-15-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: adapt time/date registers write sequence for PCF2131Hugo Villeneuve1-1/+34
The sequence for updating the time/date registers is slightly different between PCF2127/29 and PCF2131. For PCF2127/29, during write operations, the time counting circuits (memory locations 03h through 09h) are automatically blocked. For PCF2131, time/date registers write access requires setting the STOP bit and sending the clear prescaler instruction (CPR). STOP then needs to be released once write operation is completed. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-14-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: add support for PCF2131 interrupts on output INT_AHugo Villeneuve1-0/+35
The PCF2127 and PCF2129 have one output interrupt pin. The PCF2131 has two, named INT_A and INT_B. The hardware support that any interrupt source can be routed to either one or both of them. Force all interrupt sources to go to the INT A pin. Support to route any interrupt source to INT A/B pins is not supported by this driver at the moment. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20230622145800.2442116-13-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: add support for PCF2131 RTCHugo Villeneuve1-21/+213
This RTC is very similar in functionality to the PCF2127/29. Basically it: -supports two new control registers at offsets 4 and 5 -supports a new reset register (not implemented in this driver) -supports 4 tamper detection functions instead of 1 -has no nvmem (like the PCF2129) -has two output interrupt pins Because of that, most of the register addresses are very different, although they still follow the same layout. For example, the tamper registers have a different base address, but the offsets are all the same. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-12-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: add support for multiple TS functionsHugo Villeneuve1-67/+201
This will simplify the implementation of new variants into this driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-11-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: adapt for CLKOUT register at any offsetHugo Villeneuve1-2/+5
This will simplify the implementation of new variants into this driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20230622145800.2442116-10-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: adapt for WD registers at any offsetHugo Villeneuve1-4/+10
This will simplify the implementation of new variants into this driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Bruno Thomsen <bruno.thomsen@gmail.com> Tested-by: Bruno Thomsen <bruno.thomsen@gmail.com> Link: https://lore.kernel.org/r/20230622145800.2442116-9-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: adapt for alarm registers at any offsetHugo Villeneuve1-9/+8
This will simplify the implementation of new variants into this driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-8-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: adapt for time/date registers at any offsetHugo Villeneuve1-4/+7
This will simplify the implementation of new variants into this driver. Some variants (PCF2131) have a 100th seconds register. This register is currently not supported in this driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-7-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: add variant-specific configuration structureHugo Villeneuve1-19/+79
Create variant-specific configuration structures to simplify the implementation of new variants into this driver. It will also avoid to have too many tests for a specific variant, or a list of variants for new devices, inside the code itself. Add configuration options for the support of the NVMEM, bit CD0 in register WD_CTL as well as the maximum number of registers for each variant, instead of hardcoding the variant (PCF2127) inside the i2c_device_id and spi_device_id structures. Also specify a different maximum number of registers (max_register) for the PCF2129. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-6-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: remove superfluous commentsHugo Villeneuve1-2/+2
Noted while reviewing new PCF2131 driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-5-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: lower message severity if setting time failsHugo Villeneuve1-2/+1
Noted while reviewing new PCF2131 driver. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-4-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: improve timestamp reading performanceHugo Villeneuve1-21/+11
Reading the 7 timetamp registers currently involves reading 25 registers solely to be able to print the content of the three control registers, in addition to the 7 timestamp registers. This print never occurs, unless the user enables dynamic debug in this driver or set CONFIG_RTC_DEBUG. Reading the timestamp registers should consist of reading 7 consecutive timestamp registers. This patch optimize the performance of reading the timestamp registers by reading 7 consecutive registers instead of 25, and dropping the print of the control registers. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-3-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: pcf2127: improve rtc_read_time() performanceHugo Villeneuve1-28/+14
Improve performance and readability of rtc_read_time() by reading only the 7 time registers, instead of reading 8 registers (additional CTRL3 register). We drop reading of CTRL3 to monitor the low battery flag, as this check is already available in the ioctl. Anyway, this check only display an info message and has no other impacts. The code readability also improves as we do not have to fiddle with buffer pointer and size arithmetic. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230622145800.2442116-2-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-06-07rtc: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230505121136.1185653-1-u.kleine-koenig@pengutronix.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-11-15rtc: pcf2127: Convert to .probe_new()Uwe Kleine-König1-11/+11
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in .probe(). The device_id array has to move up for that to work. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20221021130706.178687-7-u.kleine-koenig@pengutronix.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-03-23rtc: pcf2127: set RTC_FEATURE_ALARM_RES_2SAlexandre Belloni1-0/+1
The PCF2127 doesn't support UIE because setting an alarm to fire every second confuses the chip and the fastest we can go is an alarm every 2 seconds. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220309162301.61679-11-alexandre.belloni@bootlin.com
2022-03-23rtc: pcf2127: switch to RTC_FEATURE_UPDATE_INTERRUPTAlexandre Belloni1-1/+1
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220309162301.61679-10-alexandre.belloni@bootlin.com
2022-02-16rtc: pcf2127: fix bug when reading alarm registersHugo Villeneuve1-1/+2
The first bug is that reading the 5 alarm registers results in a read operation of 20 bytes. The reason is because the destination buffer is defined as an array of "unsigned int", and we use the sizeof() operator on this array to define the bulk read count. The second bug is that the read value is invalid, because we are indexing the destination buffer as integers (4 bytes), instead of indexing it as u8. Changing the destination buffer type to u8 fixes both problems. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220208162908.3182581-1-hugo@hugovil.com
2022-02-16rtc: pcf2127: use IRQ flags obtained from device tree if availableHugo Villeneuve1-1/+12
If the interrupt pin of the PCF2127 is routed to the input of a GPIO expander using the pca953x driver, the later will only accept an IRQ of type IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_RISING, and the IRQ request will fail. Therefore, allow the IRQ type to be passed from the device tree data if available. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220117225742.1252362-1-hugo@hugovil.com
2022-01-05rtc: pcf2127: Fix typo in commentHugo Villeneuve1-1/+1
Replace TFS2 with TSF2. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211207215626.2619819-1-hugo@hugovil.com
2021-07-10rtc: pcf2127: handle timestamp interruptsMian Yousaf Kaukab1-59/+133
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-21rtc: pcf2127: Fix the datasheet URLFabio Estevam1-1/+1
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-14rtc: pcf2127: properly set flag WD_CD for rtc chips(pcf2129, pca2129)Biwen Li1-3/+7
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 Rosenberger1-0/+17
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 Rosenberger1-0/+8
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-17rtc: pcf2127: remove pcf2127_rtc_alrm_opsAlexandre Belloni1-8/+3
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önig1-1/+2
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 Golaszewski1-1/+1
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 Golaszewski1-1/+1
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 Carpenter1-8/+4
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önig1-25/+31
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 Li1-2/+2
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 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 <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200812085114.474903-1-alexandre.belloni@bootlin.com
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 <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 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 <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 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 <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 Belloni1-4/+12
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 Belloni1-0/+2
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 Belloni1-4/+0
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 Belloni1-3/+5
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 Belloni1-4/+2
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øll1-1/+9
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 Thomsen1-0/+2
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>