summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rv3028.c
Commit message (Collapse)AuthorAgeFilesLines
* rtc: rv3028: add ACPI supportAlexandre Belloni2023-02-221-0/+7
| | | | | | | The RV-3028 has been assigned the MCRY3028 ACPI ID. Link: https://lore.kernel.org/r/20230214202653.565647-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv3028: Use IRQ flags obtained from device tree if availableWadim Egorov2022-12-151-1/+12
| | | | | | | | | | | | | | Make the interrupt pin of the RV3028 usable with GPIO controllers without level type IRQs support, such as the TI Davinci GPIO controller. Therefore, allow the IRQ type to be passed from the device tree if available. Based on commit d4785b46345c ("rtc: pcf2127: use IRQ flags obtained from device tree if available") Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Link: https://lore.kernel.org/r/20221208133605.4193907-1-w.egorov@phytec.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv3028: Fix codestyle errorsKe Sun2022-10-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Compiler warnings: drivers/rtc/rtc-rv3028.c: In function 'rv3028_param_set': drivers/rtc/rtc-rv3028.c:559:20: warning: statement will never be executed [-Wswitch-unreachable] 559 | u8 mode; | ^~~~ drivers/rtc/rtc-rv3028.c: In function 'rv3028_param_get': drivers/rtc/rtc-rv3028.c:526:21: warning: statement will never be executed [-Wswitch-unreachable] 526 | u32 value; | ^~~~~ Fix it by moving the variable declaration to the beginning of the function. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: linux-rtc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reported-by: k2ci <kernel-bot@kylinos.cn> Signed-off-by: Ke Sun <sunke@kylinos.cn> Link: https://lore.kernel.org/r/20221008071321.1799971-1-sunke@kylinos.cn Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv3028: add BSM supportAlexandre Belloni2021-10-181-0/+74
| | | | | | | | | Backup Switch Mode controls how the RTC decides when to switch to the backup power supply. As it is disabled by default, provide a way to enable and configure it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211018151933.76865-7-alexandre.belloni@bootlin.com
* rtc: rv3028: correct weekday register usageHeiko Schocher2021-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | The datasheet for the rv3028 says the weekday has exact 3 bits and in chapter 3.4.0 for the "3h–Weekday" register it says: """ This register holds the current day of the week. Each value represents one weekday that is assigned by the user. Values will range from 0 to 6 The weekday counter is simply a 3-bit counter which counts up to 6 and then resets to 0. """ So do not code weekday bitwise instead, use the raw values from 0-6. Tested on "PHYTEC phyBOARD-Pollux i.MX8MP" board. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210309134719.1494062-1-hs@denx.de
* rtc: rv3028: quiet maybe-unused variable warningAlexandre Belloni2021-02-061-1/+1
| | | | | | | When CONFIG_OF is disabled then the matching table is not referenced. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210202112219.3610853-15-alexandre.belloni@bootlin.com
* rtc: rv3028: remove useless warning messagesAlexandre Belloni2021-02-061-9/+1
| | | | | | | | Remove voltage low messages as userspace has a proper way to get the information and react on it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210126221435.2152339-2-alexandre.belloni@bootlin.com
* rtc: rv3028: fix PORF handlingAlexandre Belloni2021-02-061-0/+2
| | | | | | | | | The PORF bit is cleared on interrupts which prevents the driver to know when the time and date are invalid. Stop clearing PORF in the interrupt handler. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210126221435.2152339-1-alexandre.belloni@bootlin.com
* rtc: rv3028: constify rv3028_rtc_opsAlexandre Belloni2021-01-161-5/+6
| | | | | | | | | Use RTC_FEATURE_ALARM to signal to the core whether alarms are available instead of changing the global struct rtc_class_ops, allowing to make it const. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210110231752.1418816-14-alexandre.belloni@bootlin.com
* rtc: rework rtc_register_device() resource managementBartosz Golaszewski2020-11-191-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
* rtc: add devm_ prefix to rtc_nvmem_register()Bartosz Golaszewski2020-11-191-2/+2
| | | | | | | | | | | 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
* rtc: rv3028: ensure ram configuration registers are savedAlexandre Belloni2020-10-151-9/+67
| | | | | | | | | If RV3028_CTRL1_EERD is not set (this is the default), the RTC will refresh the RAM configuration registers from the EEPROM at midnight. It is necessary to save the RAM registers back to EEPROM after modifying them. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-4-alexandre.belloni@bootlin.com
* rtc: rv3028: factorize EERD bit handlingAlexandre Belloni2020-10-151-59/+59
| | | | | | | | Both rv3028_eeprom_write and rv3028_eeprom_read enable EERD before sending commands to the EEPROM and restore it afterwards. Factorize this code. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-3-alexandre.belloni@bootlin.com
* rtc: rv3028: fix trickle resistor valuesAlexandre Belloni2020-10-151-1/+1
| | | | | | | | Version 1.0 of the application manual had the wrong resistor values. Fix them according to version 1.1 Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-2-alexandre.belloni@bootlin.com
* rtc: rv3028: fix clock output supportAlexandre Belloni2020-10-151-10/+9
| | | | | | | | | | | | rv3028_clkout_set_rate unconditionally sets RV3028_CLKOUT_CLKOE but clk_set_rate may be called with the clock disabled. Ensure the clock is kept disabled if it was not yet enabled. Also, the actual rate was overwritten when enabling the clock, properly write to the register only once. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201009153101.721149-1-alexandre.belloni@bootlin.com
* rtc: rv3028: Add missed check for devm_regmap_init_i2c()Chuhong Yuan2020-05-301-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 <hslester96@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200528103950.912353-1-hslester96@gmail.com
* rtc: rv3028: return meaningful value for RTC_VL_READAlexandre Belloni2019-12-181-9/+2
| | | | | | | | RV3028_STATUS_PORF means the voltage dropped too low and data has been lost. Link: https://lore.kernel.org/r/20191214220259.621996-14-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv3028: remove RTC_VL_CLR handlingAlexandre Belloni2019-12-181-6/+0
| | | | | | | | | Remove RTC_VL_CLR handling because it is a disservice to userspace as it removes the important information that the RTC data is invalid. This may lead userspace to set an invalid system time later on. Link: https://lore.kernel.org/r/20191214220259.621996-13-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv3028: add clkout supportParthiban Nallathambi2019-10-191-0/+146
| | | | | | | | | | rv3028 provides clkout (enabled by default). Add clkout to clock framework source and control from device tree for variable frequency with enable and disable functionality. Signed-off-by: Parthiban Nallathambi <pn@denx.de> Link: https://lore.kernel.org/r/20191018100425.1687979-1-pn@denx.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: remove superfluous error messageAlexandre Belloni2019-08-211-2/+1
| | | | | | | | | The RTC core now has error messages in case of registration failure, there is no need to have other messages in the drivers. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190818220041.17833-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: rv3028: add new driverAlexandre Belloni2019-02-171-0/+732
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>