Commit graph

4393 commits

Author SHA1 Message Date
Linus Torvalds
d2f51b3516 RTC for 6.7
Subsytem:
  - convert platform drivers to remove_new
  - prevent modpost warnings for unremovable platform drivers
 
 New driver:
  - Mstar SSD202D
 
 Drivers:
  - brcmstb-waketimer: support level alarm_irq
  - ep93xx: add DT support
  - rtc7301: support byte-addressed IO
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEBqsFVZXh8s/0O5JiY6TcMGxwOjIFAmVIF7AACgkQY6TcMGxw
 OjItMg/7B+cMYofdX7xuZ0QRCMRw0Op+wz1wBXdZPlUW/Bbha5A7FM4oVQYr6dCo
 8rpeD+0d4DaLX5BwJZof5YUlLoD+sw9hr++isHU7xZ040ieqFleH1LfNqCMGtF+1
 tML6bJfip7wz25Rs+E9l+oNo3W8LwAI1n5CbSB+KDAZU46P6DBqvH4rgyOFPQkR2
 xwogNCYHSpgEFnKii6TVRMksvab0kA4kVA1Dhj7CEpOnchN0rK/Jfl7KEsftXAr8
 0m74C9/Q7t6vgC2w4rM0m5XDWpCARUKUVAQwGJ/3kXagkMANrlYJclcN9jiOdqN9
 DtWYvFibtPrGKv/6B4JTRezlDzqjLgOqb+jS6BK6p5NWg4Mh8mHG4SK8SNJdaNK9
 htUzfiKSXW7n3HBPsX/xyysIhoUCQjdsHScxEOTN7n1xpnhbDQ0dKAJv2goe4UVS
 mik/hKbJrfHVduvQigUdrqRraiPF/A9XbjG8Q+WwPwAHpuSa/vks/49aScvUliJK
 i/YCNDW7KbCpjbYyA8tKOCghOXwjRzWJazP2FEpbgP06H9oNG/I/+v70Zh9AHK+t
 6/x4ec7xGQj0NkaGLjKTw04z/EO4TI3NWx+Bt2LdIpzOpM6h5HiwGR4aR3CQ+5wT
 NA5F4yaFQWaSsQoXPBpQivoExEa46Ib5QaA3iVdSo4U9OdGGNj0=
 =4rbF
 -----END PGP SIGNATURE-----

Merge tag 'rtc-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "There is a new driver for the RTC of the Mstar SSD202D SoC. The
  rtc7301 driver gains support for byte addresses to support the
  USRobotics USR8200. Then we have many non user visible changes and
  typo fixes.

  Summary:

  Subsytem:
   - convert platform drivers to remove_new
   - prevent modpost warnings for unremovable platform drivers

  New driver:
   - Mstar SSD202D

  Drivers:
   - brcmstb-waketimer: support level alarm_irq
   - ep93xx: add DT support
   - rtc7301: support byte-addressed IO"

* tag 'rtc-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (28 commits)
  dt-bindings: rtc: Add Mstar SSD202D RTC
  rtc: Add support for the SSD202D RTC
  rtc: at91rm9200: annotate at91_rtc_remove with __exit again
  dt-bindings: rtc: microcrystal,rv3032: Document wakeup-source property
  dt-bindings: rtc: pcf8523: Convert to YAML
  dt-bindings: rtc: mcp795: move to trivial-rtc
  rtc: ep93xx: add DT support for Cirrus EP93xx
  dt-bindings: rtc: Add Cirrus EP93xx
  dt-bindings: rtc: pcf2123: convert to YAML
  rtc: efi: fixed typo in efi_procfs()
  rtc: omap: Use device_get_match_data()
  rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
  rtc: rtc7301: Support byte-addressed IO
  rtc: rtc7301: Rewrite bindings in schema
  rtc: sh: Convert to platform remove callback returning void
  rtc: pxa: Convert to platform remove callback returning void
  rtc: mv: Convert to platform remove callback returning void
  rtc: imxdi: Convert to platform remove callback returning void
  rtc: at91rm9200: Convert to platform remove callback returning void
  rtc: pcap: Drop no-op remove function
  ...
2023-11-05 18:49:40 -08:00
Rafał Miłecki
2cc3b37f5b nvmem: add explicit config option to read old syntax fixed OF cells
Binding for fixed NVMEM cells defined directly as NVMEM device subnodes
has been deprecated. It has been replaced by the "fixed-layout" NVMEM
layout binding.

New syntax is meant to be clearer and should help avoiding imprecise
bindings.

NVMEM subsystem already supports the new binding. It should be a good
idea to limit support for old syntax to existing drivers that actually
support & use it (we can't break backward compatibility!). That way we
additionally encourage new bindings & drivers to ignore deprecated
binding.

It wasn't clear (to me) if rtc and w1 code actually uses old syntax
fixed cells. I enabled them to don't risk any breakage.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
[for meson-{efuse,mx-efuse}.c]
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[for mtk-efuse.c, nvmem/core.c, nvmem-provider.h]
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[MT8192, MT8195 Chromebooks]
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[for microchip-otpc.c]
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[SAMA7G5-EK]
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21 19:19:06 +02:00
Romain Perier
ebf6255868 rtc: Add support for the SSD202D RTC
Newer SigmaStar SSD202D SoCs contain a Real Time Clock, capable of
running while the system is sleeping (battery powered), this is not the
case with the other RTC on older SoCs. This adds basic support for this
RTC block.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Co-developed-by: Daniel Palmer <daniel@0x0f.com>
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Link: https://lore.kernel.org/r/20230913151606.69494-2-romain.perier@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-16 16:54:15 +02:00
Alexandre Belloni
e2f57bf827 rtc: at91rm9200: annotate at91_rtc_remove with __exit again
Having the driver as a builtin after dropping the __exit annotation results
in:

>> drivers/rtc/rtc-at91rm9200.c:561:13: warning: 'at91_rtc_remove' defined but not used [-Wunused-function]
     561 | static void at91_rtc_remove(struct platform_device *pdev)
         |             ^~~~~~~~~~~~~~~

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310160705.vlElNOGb-lkp@intel.com/
Link: https://lore.kernel.org/r/20231016041816.246426-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-16 06:33:00 +02:00
Nikita Shubin
1d70f9fe5f rtc: ep93xx: add DT support for Cirrus EP93xx
Add OF ID match table.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Link: https://lore.kernel.org/r/20230915-ep93xx-v4-14-a1d779dcec10@maquefel.me
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-15 23:17:05 +02:00
Maxim Korotkov
f5f4c982f7 rtc: efi: fixed typo in efi_procfs()
After the first check of the value of the "eft" variable
it does not change, it is obvious that a copy-paste
error was made here and the value of variable "alm"
should be checked here.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 501385f2a7 ("rtc: efi: add efi_procfs in efi_rtc_ops")
Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>
Link: https://lore.kernel.org/r/20231006090444.306729-1-korotkov.maxim.s@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-15 23:01:08 +02:00
Rob Herring
3c8bdc20a4 rtc: omap: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231009211356.3242037-12-robh@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-15 22:38:50 +02:00
Javier Carrasco
2be36c09b6 rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
The current implementation passes PIN_IO_INTA_OUT (2) as a mask and
PIN_IO_INTAPM (GENMASK(1, 0)) as a value.
Swap the variables to assign mask and value the right way.

This error was first introduced with the alarm support. For better or
worse it worked as expected because 0x02 was applied as a mask to 0x03,
resulting 0x02 anyway. This will of course not work for any other value.

Fixes: e5aac267a1 ("rtc: pcf85363: add alarm support")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20231013-topic-pcf85363_regmap_update_bits-v1-1-c454f016f71f@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-15 22:37:57 +02:00
Linus Walleij
8c767e9c1e rtc: rtc7301: Support byte-addressed IO
The old RTC7301 driver in OpenWrt used byte access, but the
current mainline Linux driver uses 32bit word access.

Make this configurable using device properties using the
standard property "reg-io-width" in e.g. device tree.

This is needed for the USRobotics USR8200 which has the
chip connected using byte accesses.

Debugging and testing by Howard Harte.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Link: https://lore.kernel.org/r/20231010-rtc-7301-regwidth-v3-2-ade586b62794@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-15 22:37:25 +02:00
Uwe Kleine-König
f4d571b31b rtc: sh: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
e288cfe8f2 rtc: pxa: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-12-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
ede66fb37f rtc: mv: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-11-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
482ca730a4 rtc: imxdi: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
48bc8830fb rtc: at91rm9200: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
94a2da3e6b rtc: pcap: Drop no-op remove function
A remove callback that just returns 0 is equivalent to no callback at
all as can be seen in platform_remove(). So simplify accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-8-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
141626dbc2 rtc: sh: Mark driver struct with __refdata to prevent section mismatch warning
As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
47712bc294 rtc: pxa: Mark driver struct with __refdata to prevent section mismatch warning
As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
5621f28b01 rtc: mv: Mark driver struct with __refdata to prevent section mismatch warning
As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
e6d44306e4 rtc: imxdi: Mark driver struct with __refdata to prevent section mismatch warning
As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
5dbde0727a rtc: at91rm9200: Mark driver struct with __refdata to prevent section mismatch warning
As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent a section mismatch warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Uwe Kleine-König
2e2ad6393b rtc: imxdi: Soften dependencies for improved compile coverage
The driver compiles fine on x86_64, so soften the dependencies to
ARCH_MXC || COMPILE_TEST.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231002080529.2535610-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-13 12:29:08 +02:00
Doug Berger
e005a9b35b rtc: brcmstb-waketimer: support level alarm_irq
Some devices (e.g. BCM72112) use an alarm_irq interrupt that is
connected to a level interrupt controller rather than an edge
interrupt controller. In this case, the interrupt cannot be left
enabled by the irq handler while preserving the hardware wake-up
signal on wake capable devices or an interrupt storm will occur.

The alarm_expired flag is introduced to allow the disabling of
the interrupt when an alarm expires and to support balancing the
calls to disable_irq() and enable_irq() in accordance with the
existing design.

Fixes: 24304a8715 ("rtc: brcmstb-waketimer: allow use as non-wake alarm")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20230830224747.1663044-1-opendmb@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-02 00:13:57 +02:00
Alexandre Belloni
d4277fa4a1 rtc: sh: silence warning
Silence:
drivers/rtc/rtc-sh.c:517:58: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 3 [-Wformat-truncation=]

Link: https://lore.kernel.org/r/20230911095052.1292869-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-10-01 22:31:59 +02:00
Linus Torvalds
ff6e6ded54 RTC for 6.6
Subsystem:
  - Add a way for drivers to tell the core the supported alarm range is smaller
    than the date range. This is not used yet but will be useful for the
    alarmtimers in the next release.
  - fix Wvoid-pointer-to-enum-cast warnings
  - remove redundant of_match_ptr()
  - stop warning for invalid alarms when the alarm is disabled
 
 Drivers:
  - isl12022: allow setting the trip level for battery level detection
  - pcf2127: add support for PCF2131 and multiple timestamps
  - stm32: time precision improvement, many fixes
  - twl: NVRAM support
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEBqsFVZXh8s/0O5JiY6TcMGxwOjIFAmT6M14ACgkQY6TcMGxw
 OjKE3Q/+N7OMaTeJcqk1c5JEFZukOIYGZnogDSAvOF5mP9Y0TBlc/+UD5V6SgPLG
 B0oQfAEbYoo5e9VRCawIXBuE1fFA4AsHd6yc4395pEB5OZPpYcdvEWHfB1MQCKSy
 /sQ2xeevdOLtpHxqjK2cN1crlWOo1YACuUoXgN1IvOgtLC7NKxH77q+I9gvhNWiy
 P/U9gCRR7ji/GZ5LssOi9+rTj5gi8eeW6R9WzPfARAljGZwgMY2dzZWDmmq5gKJn
 VTLeoxbvsMNgM5G72sUlSBeeN1lPFIIknx3+DU4+v9JqSklI1GarySfnFqRqIDp6
 JQKicAfv+PXbrqJliUGUvU5O0JTDjpsRI23ridKQ/jFaBkk8k26jXehK5IYUBO+A
 xvIsTZgSn53oGMoAZFSUGTIC4m0KDCQ6Wu0rCDr1OCecds2ueYfBHfCOj5rNvBdE
 ZAb/m0tquX5hkVuLqGt7Wn32PdpsPA9noz4cdgtDkNLL2juEYwBHUUBnuuHsEEzR
 dDoKdcm3q+KA9PEW0ftLb069UQ1ddca2Y8Mxp79Xt3mQhg28BMWV9h9qyPdicS5W
 Cti54qplG7EP5SRqsyqh6KH91ZfJFMbyb+ivEEQlYeOK45IFLkGXjVBZmHRPuZaV
 tjbNkp74asaftpMIB9kiW82JdJDUNGKYjYbSyssAWABTDbRlpGc=
 =4kkJ
 -----END PGP SIGNATURE-----

Merge tag 'rtc-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "Subsystem:

   - Add a way for drivers to tell the core the supported alarm range is
     smaller than the date range. This is not used yet but will be
     useful for the alarmtimers in the next release.

   - fix Wvoid-pointer-to-enum-cast warnings

   - remove redundant of_match_ptr()

   - stop warning for invalid alarms when the alarm is disabled

  Drivers:

   - isl12022: allow setting the trip level for battery level detection

   - pcf2127: add support for PCF2131 and multiple timestamps

   - stm32: time precision improvement, many fixes

   - twl: NVRAM support"

* tag 'rtc-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (73 commits)
  dt-bindings: rtc: ds3231: Remove text binding
  rtc: wm8350: remove unnecessary messages
  rtc: twl: remove unnecessary messages
  rtc: sun6i: remove unnecessary message
  rtc: stop warning for invalid alarms when the alarm is disabled
  rtc: twl: add NVRAM support
  rtc: pcf85363: Allow to wake up system without IRQ
  rtc: m48t86: add DT support for m48t86
  dt-bindings: rtc: Add ST M48T86
  rtc: pcf2127: remove useless check
  rtc: rzn1: Report maximum alarm limit to rtc core
  rtc: ds1305: Report maximum alarm limit to rtc core
  rtc: tps6586x: Report maximum alarm limit to rtc core
  rtc: cmos: Report supported alarm limit to rtc infrastructure
  rtc: cros-ec: Detect and report supported alarm window size
  rtc: Add support for limited alarm timer offsets
  rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()
  MAINTAINERS: remove obsolete pattern in RTC SUBSYSTEM section
  rtc: tps65910: Remove redundant dev_warn() and do not check for 0 return after calling platform_get_irq()
  rtc: omap: Do not check for 0 return after calling platform_get_irq()
  ...
2023-09-07 16:07:35 -07:00
Alexandre Belloni
d844c64bbc rtc: wm8350: remove unnecessary messages
The RTC core already prints a message when the RTC is registered and when
registering fails, it is not necessary to have more in the driver.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230827221643.544259-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-09-06 01:26:04 +02:00
Alexandre Belloni
8805baceb0 rtc: twl: remove unnecessary messages
The RTC core already prints a message when the RTC is registered and when
registering fails, it is not necessary to have more in the driver.

Link: https://lore.kernel.org/r/20230827221643.544259-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-09-06 01:26:04 +02:00
Alexandre Belloni
94ec1f06d0 rtc: sun6i: remove unnecessary message
The core already print a message once the rtc is successfully registered,
it is not necessary to print an other one.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/20230827221643.544259-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-09-06 01:26:04 +02:00
Alexandre Belloni
348c11a7d7 rtc: stop warning for invalid alarms when the alarm is disabled
When the alarm is not enabled, it may never have been set and so we can't
expect it to be valid. This will prevent the apparition of boot messages
like this one:

rtc rtc0: invalid alarm value: 2023-7-8 45:85:85

Link: https://lore.kernel.org/r/20230827221532.543353-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-09-06 01:25:15 +02:00
Ladislav Michl
7130856f56 rtc: twl: add NVRAM support
Export SRAM using nvmem.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/ZDf7qZTiml0ijD2g@lenoch
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-28 00:09:20 +02:00
Mike Looijmans
1e786b0370 rtc: pcf85363: Allow to wake up system without IRQ
When wakeup-source is set in the devicetree, set up the device for
using the output as interrupt instead of clock. This is similar to
how other RTC devices handle this.

This allows the clock chip to turn on the board when wired to do
so in hardware.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/20230821072013.7072-1-mike.looijmans@topic.nl
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-28 00:05:45 +02:00
Nikita Shubin
6ec3f5ec2e rtc: m48t86: add DT support for m48t86
Add OF ID match table.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/lkml/20230601054549.10843-12-nikita.shubin@maquefel.me/
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Link: https://lore.kernel.org/r/20230823-m48t86_device_tree-v2-2-21ff275f949d@maquefel.me
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-28 00:01:51 +02:00
Alexandre Belloni
eeeb77716f rtc: pcf2127: remove useless check
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-27 23:53:06 +02:00
Guenter Roeck
2b0386d578 rtc: rzn1: Report maximum alarm limit to rtc core
RZN1 only supports alarms up to one week in the future.
Report the limit to the RTC core and use the reported limit
to validate the requested alarm time when setting it.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20230817225537.4053865-8-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-27 23:50:22 +02:00
Guenter Roeck
46b79ac0b4 rtc: ds1305: Report maximum alarm limit to rtc core
DS1305 only supports alarms up to 24 hours in the future.
Report the limit to the RTC core, and use the reported limit
to validate the requested alarm time when setting it.

If the alarm is too large when trying to set an alarm, return -ERANGE
instead of -EDOM to align with error codes returned by other rtc drivers.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230817225537.4053865-7-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-27 23:50:22 +02:00
Guenter Roeck
3637bbdc8a rtc: tps6586x: Report maximum alarm limit to rtc core
tps6586x only supports alarms up to 16,383 seconds in the future.
Report the limit to the RTC core.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230817225537.4053865-6-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-27 23:50:22 +02:00
Guenter Roeck
2546e7083f rtc: cmos: Report supported alarm limit to rtc infrastructure
The alarm window supported by the cmos RTC depends on the chip
and its configuration. Report the limit to the RTC core.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230817225537.4053865-5-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-27 23:50:22 +02:00
Guenter Roeck
00c3092d88 rtc: cros-ec: Detect and report supported alarm window size
The RTC on some older Chromebooks can only handle alarms less than
24 hours in the future. The only way to find out is to try to set
an alarm further in the future. If that fails, assume that the RTC
connected to the EC can only handle less than 24 hours of alarm
window, and report that value to the RTC core.

After that change, it is no longer necessary to limit the alarm time
when setting it. Report any excessive alarms to the caller instead.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230817225537.4053865-4-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-27 23:50:22 +02:00
Biju Das
f45d32d2cd rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()
The XTOSCB bit is not bit 0, but xtosb_val is either 0 or 1. If it is 1,
test will never succeed. Fix this issue by using double negation.

While at it, remove unnecessary blank line from probe().

Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://lore.kernel.org/all/ZN4BgzG2xmzOzdFZ@duo.ucw.cz/
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Pavel Machek <pavel@denx.de>
Link: https://lore.kernel.org/r/20230817161038.407960-1-biju.das.jz@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-27 23:48:32 +02:00
Ruan Jinjie
dac7837848 rtc: tps65910: Remove redundant dev_warn() and do not check for 0 return after calling platform_get_irq()
It is not possible for platform_get_irq() to return 0. Use the
return value from platform_get_irq().

And there is no need to call the dev_warn() function directly to print
a custom message when handling an error from platform_get_irq()
function as it is going to display an appropriate error message
in case of a failure.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230803080713.4061782-3-ruanjinjie@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17 01:17:34 +02:00
Ruan Jinjie
4d349a5793 rtc: omap: Do not check for 0 return after calling platform_get_irq()
It is not possible for platform_get_irq() to return 0. Use the
return value from platform_get_irq().

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230803080713.4061782-2-ruanjinjie@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17 01:17:34 +02:00
Samuel Holland
ed17a2bcbb rtc: da9063: Mark the alarm IRQ as a wake IRQ
This keeps the IRQ enabled during system suspend, if the RTC's wakeup
source is enabled. Since the IRQ is not required to wake from shutdown,
continue to add the wakeup source even if registering the wakeirq fails.
See commit 029d3a6f2f ("rtc: da9063: add as wakeup source").

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20230717190937.1301509-1-samuel.holland@sifive.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17 01:09:50 +02:00
Hugo Villeneuve
58dffa96e6 rtc: pcf2127: remove unused function argument
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-17 01:01:51 +02:00
Hugo Villeneuve
e4163fc59d rtc: pcf2127: add error checking when disabling POR0
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-17 01:01:24 +02:00
Dan Carpenter
4e5eb7ef73 rtc: pcf2127: fix error code in pcf2127_enable_ts()
This error path accidentally returns success.  Return -EINVAL instead.

Fixes: 420cc9e850 ("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-08-17 00:58:35 +02:00
Linus Walleij
d890cfc25f rtc: ds2404: Convert to GPIO descriptors
This converts the DS2404 to use GPIO descriptors instead of
hard-coded global GPIO numbers.

The platform data can be deleted because there are no in-tree
users and it only contained GPIO numbers which are now
passed using descriptor tables (or device tree or ACPI).

The driver was rewritten to use a state container for the
device driver state (struct ds2404 *chip) and pass that
around instead of using a global singleton storage for the
GPIO handles.

When declaring GPIO descriptor tables or other hardware
descriptions for the RTC driver, implementers should take care
to flag the RESET line as active low, such as by using the
GPIOD_ACTIVE_LOW flag in the descriptor table.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230807-descriptors-rtc-v1-1-ce0f9187576e@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17 00:55:56 +02:00
Nathan Chancellor
2cf2a1acc6 rtc: stm32: Use NOIRQ_SYSTEM_SLEEP_PM_OPS()
After the switch to SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() and a subsequent
fix, stm32_rtc_{suspend,resume}() are unused when CONFIG_PM_SLEEP is not
set because SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is a no-op in that
configuration:

  drivers/rtc/rtc-stm32.c:904:12: error: 'stm32_rtc_resume' defined but not used [-Werror=unused-function]
    904 | static int stm32_rtc_resume(struct device *dev)
        |            ^~~~~~~~~~~~~~~~
  drivers/rtc/rtc-stm32.c:894:12: error: 'stm32_rtc_suspend' defined but not used [-Werror=unused-function]
    894 | static int stm32_rtc_suspend(struct device *dev)
        |            ^~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

The non-"SET_" version of this macro, NOIRQ_SYSTEM_SLEEP_PM_OPS(), is
designed to handle this situation by only assigning the callbacks when
CONFIG_PM_SLEEP is set while allowing the functions to appear used to
the compiler. Switch to that macro to resolve the warnings. There is no
functional change with this, as SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is
defined using NOIRQ_SYSTEM_SLEEP_PM_OPS() when CONFIG_PM_SLEEP is set.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230815-rtc-stm32-unused-pm-funcs-v1-1-82eb8e02d903@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-17 00:53:00 +02:00
Krzysztof Kozlowski
e5aabfbc09 rtc: rs5c372: fix Wvoid-pointer-to-enum-cast warning
'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

  rtc-rs5c372.c:829:19: error: cast to smaller integer type 'enum rtc_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810103902.151145-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-16 01:32:08 +02:00
Krzysztof Kozlowski
4ebbd46305 rtc: jz4740: fix Wvoid-pointer-to-enum-cast warning
'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

  rtc-jz4740.c:352:14: error: cast to smaller integer type 'enum jz4740_rtc_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810103902.151145-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-16 01:32:08 +02:00
Krzysztof Kozlowski
fbbeae0af5 rtc: rv8803: fix Wvoid-pointer-to-enum-cast warning
'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

  rtc-rv8803.c:648:18: error: cast to smaller integer type 'enum rv8803_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810103902.151145-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-16 01:32:08 +02:00
Krzysztof Kozlowski
737055e117 rtc: ds1307: fix Wvoid-pointer-to-enum-cast warning
'type' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

  rtc-ds1307.c:1747:18: error: cast to smaller integer type 'enum ds_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810103902.151145-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-08-16 01:32:08 +02:00