summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-rv3028.c
AgeCommit message (Collapse)Author
2021-10-18rtc: rv3028: add BSM supportAlexandre Belloni
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
2021-03-15rtc: rv3028: correct weekday register usageHeiko Schocher
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
2021-02-06rtc: rv3028: quiet maybe-unused variable warningAlexandre Belloni
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
2021-02-06rtc: rv3028: remove useless warning messagesAlexandre Belloni
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
2021-02-06rtc: rv3028: fix PORF handlingAlexandre Belloni
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
2021-01-16rtc: rv3028: constify rv3028_rtc_opsAlexandre Belloni
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
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-15rtc: rv3028: ensure ram configuration registers are savedAlexandre Belloni
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
2020-10-15rtc: rv3028: factorize EERD bit handlingAlexandre Belloni
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
2020-10-15rtc: rv3028: fix trickle resistor valuesAlexandre Belloni
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
2020-10-15rtc: rv3028: fix clock output supportAlexandre Belloni
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
2020-05-30rtc: rv3028: Add missed check for devm_regmap_init_i2c()Chuhong Yuan
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
2019-12-18rtc: rv3028: return meaningful value for RTC_VL_READAlexandre Belloni
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>
2019-12-18rtc: rv3028: remove RTC_VL_CLR handlingAlexandre Belloni
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>
2019-10-19rtc: rv3028: add clkout supportParthiban Nallathambi
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>
2019-08-21rtc: remove superfluous error messageAlexandre Belloni
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>
2019-02-17rtc: rv3028: add new driverAlexandre Belloni
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>