Commit graph

11 commits

Author SHA1 Message Date
Alexandre Belloni
2d433e9c89 rtc: rv3032: add ACPI support
The RV-3032 has been assigned the MCRY3032 ACPI ID.

Link: https://lore.kernel.org/r/20230214202716.565749-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-02-22 12:31:38 +01:00
Alexandre Belloni
c4b12f89f5 rtc: rv3032: use IRQ flags obtained from fwnode
Allow the IRQ type to be passed from the device tree if available as there
may be components changing the trigger type of the interrupt between the
RTC and the IRQ controller.

Link: https://lore.kernel.org/r/20230123200217.1236011-11-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-02-01 09:13:35 +01:00
Alexandre Belloni
ac86964ff9 rtc: rv3032: let the core handle the alarm resolution
Let the RTC core know the resolution of the alarm is a minute.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211107225458.111068-3-alexandre.belloni@bootlin.com
2021-11-10 00:45:57 +01:00
Alexandre Belloni
6084eac38e rtc: rv3032: allow setting BSM
Backup Switch Mode is currently set properly when the trickle charger is
enabled. However, in the case of a non-rechargeable battery, it is
necessary to be able to enable it, only allow that when the trickle charger
is disabled.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211018151933.76865-8-alexandre.belloni@bootlin.com
2021-10-18 17:20:50 +02:00
Dan Carpenter
c3336b8ac6 rtc: rv3032: fix error handling in rv3032_clkout_set_rate()
Do not call rv3032_exit_eerd() if the enter function fails but don't
forget to call the exit when the enter succeeds.

Fixes: 2eeaa532ac ("rtc: rv3032: Add a driver for Microcrystal RV-3032")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211012101028.GT2083@kadam
2021-10-15 21:07:23 +02:00
Alexandre Belloni
94428ac9aa rtc: rv3032: quiet maybe-unused variable warning
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-17-alexandre.belloni@bootlin.com
2021-02-06 00:58:25 +01:00
Alexandre Belloni
19588d50a2 rtc: rv3032: constify rv3032_rtc_ops
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-16-alexandre.belloni@bootlin.com
2021-01-16 23:19:27 +01:00
Bartosz Golaszewski
fdcfd85433 rtc: rework rtc_register_device() resource management
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-19 12:50:12 +01:00
Bartosz Golaszewski
3a905c2d95 rtc: add devm_ prefix to rtc_nvmem_register()
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-11-19 12:50:11 +01:00
Alexandre Belloni
767fbb7102 rtc: rv3032: fix nvram nvmem priv pointer
The nvmem priv pointer is set to rv3032 but the rv3032_nvram_write and
rv3032_nvram_read expect the regmap pointer.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201108223710.1574331-1-alexandre.belloni@bootlin.com
2020-11-15 00:51:34 +01:00
Alexandre Belloni
2eeaa532ac rtc: rv3032: Add a driver for Microcrystal RV-3032
New driver for the Microcrystal RV-3032, including support for:
 - Date/time
 - Alarms
 - Low voltage detection
 - Trickle charge
 - Trimming
 - Clkout
 - RAM
 - EEPROM
 - Temperature sensor

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201013144110.1942218-3-alexandre.belloni@bootlin.com
2020-10-19 22:47:56 +02:00