Commit Graph

4509 Commits

Author SHA1 Message Date
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Linus Torvalds
0e287d31b6 RTC for 6.13
New drivers:
  - Amlogic A4 and A5 RTC
  - Marvell 88PM886 PMIC RTC
  - Renesas RTCA-3 for Renesas RZ/G3S
 
 Drivers:
  - ab-eoz9: fix temperature and alarm support
  - cmos: improve locking behaviour
  - isl12022: add alarm support
  - m48t59: improve epoch handling
  - mt6359: add range
  - rzn1: fix BCD conversions and simplify driver
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEBqsFVZXh8s/0O5JiY6TcMGxwOjIFAmdKJY4ACgkQY6TcMGxw
 OjJvKhAAmxWzgm5wXTtzNdO/GvmlXehTQ+vdUbhldIGTDKekT2Dr4ijwAI/JOKJt
 CDasXOQw2jEQg1NyxMmcBHtEol6866pUW9+tMFwYi2SxphOfhMbuw7bQNpOPCWUS
 rK3y/sbz0CrHPaGv9RcAxSpzCboXNWCaIGE/JPC/3nhnlSYwW2XZMLxCVTJ1ixAV
 S0Z4CtwCo3E7t6+i1ZY0Lm1AXze9xOuEWF+r9x5TonpetY8z94EcB8xniHfLbrpZ
 1hpwewihyG7pJzvJr7+Q8Ze8P6m/LbohBk7TbzG035ILBSbUu6UHysQCocMgsz8j
 M4yOTTKPwprdc9DrhtykEK4sx+fF1V5tJV+Nl1sljpQco6PNWu+JP6BFrRR8OH0w
 OwmNytgLQux0+rtWjMMuyXYkSKJssTTrpZqpVRud/jf/IVyowQxbCQnTUK8WSm6v
 1cqI4KnVcUFx+kp0BeLJz4a31O8VeMhj+YYqruFhaGdhwMYimXp8X9ZMxZkCVpMa
 OlmtswPvBkN1b/+w72aOXBmrWFYafICZZY7MAViEzVHM0yoIVwEzSfBToT7hvV7h
 w2LFSvHqLIChnUYYEQUlCh7xXhUks7fwbyRG/2n/0G1We7ZsEKIlPXCmhRl0e2R+
 TGgkfUjczJ5z48m0oSy62yj1bmKVvtVdsJ/Ua5192eSxqBCTv78=
 =Q4/G
 -----END PGP SIGNATURE-----

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

Pull RTC updates from Alexandre Belloni:
 "New drivers:
   - Amlogic A4 and A5 RTC
   - Marvell 88PM886 PMIC RTC
   - Renesas RTCA-3 for Renesas RZ/G3S

  Driver updates:
   - ab-eoz9: fix temperature and alarm support
   - cmos: improve locking behaviour
   - isl12022: add alarm support
   - m48t59: improve epoch handling
   - mt6359: add range
   - rzn1: fix BCD conversions and simplify driver"

* tag 'rtc-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (38 commits)
  rtc: ab-eoz9: don't fail temperature reads on undervoltage notification
  rtc: rzn1: reduce register access
  rtc: rzn1: drop superfluous wday calculation
  m68k: mvme147, mvme16x: Adopt rtc-m48t59 platform driver
  rtc: brcmstb-waketimer: don't include 'pm_wakeup.h' directly
  rtc: m48t59: Use platform_data struct for year offset value
  rtc: ab-eoz9: fix abeoz9_rtc_read_alarm
  rtc: rv3028: fix RV3028_TS_COUNT type
  rtc: rzn1: update Michel's email
  rtc: rzn1: fix BCD to rtc_time conversion errors
  rtc: amlogic-a4: fix compile error
  rtc: amlogic-a4: drop error messages
  MAINTAINERS: Add an entry for Amlogic RTC driver
  rtc: support for the Amlogic on-chip RTC
  dt-bindings: rtc: Add Amlogic A4 and A5 RTC
  rtc: add driver for Marvell 88PM886 PMIC RTC
  rtc: check if __rtc_read_time was successful in rtc_timer_do_work()
  rtc: pcf8563: Switch to regmap
  rtc: pcf8563: Sort headers alphabetically
  rtc: abx80x: Fix WDT bit position of the status register
  ...
2024-11-30 11:18:16 -08:00
Maxime Chevallier
e0779a0dcf rtc: ab-eoz9: don't fail temperature reads on undervoltage notification
The undervoltage flags reported by the RTC are useful to know if the
time and date are reliable after a reboot. Although the threshold VLOW1
indicates that the thermometer has been shutdown and time compensation
is off, it doesn't mean that the temperature readout is currently
impossible.

As the system is running, the RTC voltage is now fully established and
we can read the temperature.

Fixes: 67075b63cc ("rtc: add AB-RTCMC-32.768kHz-EOZ9 RTC support")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://lore.kernel.org/r/20241122101031.68916-3-maxime.chevallier@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-25 23:34:12 +01:00
Wolfram Sang
3ed345c948 rtc: rzn1: reduce register access
This RTC has special 32bit registers which return multiple of the same
8bit registers at once. Use these to minimize register access. Also, do
the to/from BCD conversions right away, so 'tm' always contains values
as described in time.h.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20241122101448.4374-3-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-25 23:32:50 +01:00
Wolfram Sang
692f983b2d rtc: rzn1: drop superfluous wday calculation
The week register simply counts from 0 to 6 where the numbers do not
even represent a specific weekday. So we can adopt 'tm_wday' numbering
of the RTC core without converting it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20241122101448.4374-2-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-25 23:32:50 +01:00
Linus Torvalds
80739fd00c - Several drivers, including atmel-flexcom/rk8xx-core, palmas, and
tps65010, have undergone minor code improvements to enhance consistency and
   fix race conditions.
 
 - The syscon driver now utilizes the regmap max_register_is_0 capability
   for consistent register map configuration across syscons of all sizes.
 
 - New device support has been added for QCS8300, qcs615, SA8255p, and
   samsung,s2dos05, expanding the range of compatible hardware.
 
 - The cros_ec driver now supports loading cros_ec_ucsi on supported ECs
   and avoids loading the charger with UCSI, streamlining functionality.
 
 - The bd96801 driver now utilizes the more modern maple tree register
   cache, improving performance.
 
 - The da9052-spi driver has undergone a fix to change the read-mask to
   write-mask, preventing potential issues.
 
 - Unused declarations in max77693 have been removed, and support for
   samsung,s2dos05 has been added, enhancing code clarity and device compatibility.
 
 - Error handling in cs42l43 has been fixed to avoid unbalanced regulator
   put and ensure proper synchronization during driver removal.
 
 - The wcd934x driver now uses MODULE_DEVICE_TABLE() instead of
   MODULE_ALIAS(), improving code consistency.
 
 - Documentation for qcom,tcsr, syscon, and atmel-smc has been updated
   and reorganized for better clarity and maintainability.
 
 - The intel_soc_pmic_bxtwc driver has undergone significant improvements,
   including the use of IRQ domains for various devices, fixing IRQ domain names
   duplication, and code refactoring for better consistency and maintainability.
 
 - The ipaq-micro driver has received a fix for a missing break statement in
   the default case, enhancing code robustness.
 
 - Support for the AXP323 PMIC has been added to the axp20x driver, along
   with ensuring a clear relationship between IDs and model names, and allowing
   multiple regulators, broadening hardware compatibility.
 
 - The cs42l43 driver now disables IRQs during suspend for improved power
   management.
 
 - The adp5585 driver has reduced its dependencies by dropping the obsolete
   dependency on COMPILE_TEST.
 
 - Initial support for the MT6328 PMIC has been added to the mt6397 driver,
   expanding the range of supported hardware.
 
 - The rtc-bd70528 driver has been simplified by dropping the IC name from
   IRQ, improving code readability.
 
 - Documentation for qcom,spmi-pmic, ti,twl, and zii,rave-sp has been
   updated to enhance clarity and incorporate new features.
 
 - The rt5033 driver has received a fix for a missing regmap_del_irq_chip()
   in the error handling path.
 
 - New device support has been added for MSM8917, and the
   intel_soc_pmic_crc driver now supports non-ACPI instantiated i2c_client.
 
 - The 88pm886 driver has added support for the RTC cell, and the tqmx86
   driver has improved its GPIO IRQ setup and added I2C IRQ support,
   increasing functionality.
 
 - The sprd,sc2731 DT schema has been updated and converted to YAML format
   for better readability and maintainability.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmc/KQQACgkQUa+KL4f8
 d2E0Gg//blIYrtUgGy5xEwR8WIobYtAxBo+AMX1tSgh4Hs4u/SFhy4cE7no+M3J2
 Id5gQJscuz3k4sH0raoUMp2NRFyI8lD8Y9xRBTDE+KV/FbdL1KHfmTun2NY1zG7U
 LIop39HsJkJ0Z06lnyBf61QK6SmlzT8vXbJmK4mYf8wgBX7iFDZ0FMZHP2uW5k/Z
 UV8nyQalwerG+jOGXfQkVDXF8YKToqPtqsFWTJ1Yn5gs1SCd6dyusDNYqUDuW4Ng
 dbu/4wt3mspliTOnBTPnXlcVsCNefhtbCWxyBpaA3luK9ciMdX7cZ8wei1xkFcwK
 5bXPjXsFiiUbDX0l/6eS1h676k1JQl5iABlhGXHJm/GMcN9fdNFCQL/2rtJ4iSfW
 0CoYjERfm6OyHF0Wiuk3I8x/AARWKXtDEjktGXUL0do7NBqJgB3ISme8x8b5hW4l
 HO6MmsFmHxHbIlb+kCTTCtXa5R1Sdca/8qrPxMb+B89X3eOtF7sjVgS9dwkLNCGp
 hqP0K2IGNaRw+EDlXCBaWrbq7x0kpup6o+nooViU0Pj9fFjEdZlCLyu22+kjl04V
 Lfe3x9wMXBrHVrPynoaQp6+57QlWfpM0uuKJWoaKlCoJTh8UbFcWWkDqr6I/pDur
 EtfSwOO8uVuS8m/FMAs0m/+zrWfHAvjAbAHFCKBu/vKaD5DvxeI=
 =YP3r
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:

 - Several drivers, including atmel-flexcom/rk8xx-core, palmas, and
   tps65010, have undergone minor code improvements to enhance
   consistency and fix race conditions.

 - The syscon driver now utilizes the regmap max_register_is_0
   capability for consistent register map configuration across syscons
   of all sizes.

 - New device support has been added for QCS8300, qcs615, SA8255p, and
   samsung,s2dos05, expanding the range of compatible hardware.

 - The cros_ec driver now supports loading cros_ec_ucsi on supported ECs
   and avoids loading the charger with UCSI, streamlining functionality.

 - The bd96801 driver now utilizes the more modern maple tree register
   cache, improving performance.

 - The da9052-spi driver has undergone a fix to change the read-mask to
   write-mask, preventing potential issues.

 - Unused declarations in max77693 have been removed, and support for
   samsung,s2dos05 has been added, enhancing code clarity and device
   compatibility.

 - Error handling in cs42l43 has been fixed to avoid unbalanced
   regulator put and ensure proper synchronization during driver
   removal.

 - The wcd934x driver now uses MODULE_DEVICE_TABLE() instead of
   MODULE_ALIAS(), improving code consistency.

 - Documentation for qcom,tcsr, syscon, and atmel-smc has been updated
   and reorganized for better clarity and maintainability.

 - The intel_soc_pmic_bxtwc driver has undergone significant
   improvements, including the use of IRQ domains for various devices,
   fixing IRQ domain names duplication, and code refactoring for better
   consistency and maintainability.

 - The ipaq-micro driver has received a fix for a missing break
   statement in the default case, enhancing code robustness.

 - Support for the AXP323 PMIC has been added to the axp20x driver,
   along with ensuring a clear relationship between IDs and model names,
   and allowing multiple regulators, broadening hardware compatibility.

 - The cs42l43 driver now disables IRQs during suspend for improved
   power management.

 - The adp5585 driver has reduced its dependencies by dropping the
   obsolete dependency on COMPILE_TEST.

 - Initial support for the MT6328 PMIC has been added to the mt6397
   driver, expanding the range of supported hardware.

 - The rtc-bd70528 driver has been simplified by dropping the IC name
   from IRQ, improving code readability.

 - Documentation for qcom,spmi-pmic, ti,twl, and zii,rave-sp has been
   updated to enhance clarity and incorporate new features.

 - The rt5033 driver has received a fix for a missing
   regmap_del_irq_chip() in the error handling path.

 - New device support has been added for MSM8917, and the
   intel_soc_pmic_crc driver now supports non-ACPI instantiated
   i2c_client.

 - The 88pm886 driver has added support for the RTC cell, and the tqmx86
   driver has improved its GPIO IRQ setup and added I2C IRQ support,
   increasing functionality.

 - The sprd,sc2731 DT schema has been updated and converted to YAML
   format for better readability and maintainability.

* tag 'mfd-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (62 commits)
  dt-bindings: mfd: bd71828: Use charger resistor in mOhm instead of MOhm
  dt-bindings: mfd: sprd,sc2731: Convert to YAML
  mfd: tqmx86: Add I2C IRQ support
  mfd: tqmx86: Make IRQ setup errors non-fatal
  mfd: tqmx86: Refactor GPIO IRQ setup
  mfd: tqmx86: Improve gpio_irq module parameter description
  mfd: tqmx86: Add board definitions for TQMx120UC, TQMx130UC and TQMxE41S
  mfd: 88pm886: Add the RTC cell
  dt-bindings: mfd: Add Realtek RTL9300 switch peripherals
  mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client
  mfd: intel_soc_pmic_*: Consistently use filename as driver name
  dt-bindings: mfd: qcom,tcsr: Add compatible for MSM8917
  mfd: rt5033: Fix missing regmap_del_irq_chip()
  mfd: cgbc-core: Fix error handling paths in cgbc_init_device()
  dt-bindings: mfd: aspeed: Support for AST2700
  mfd: Switch back to struct platform_driver::remove()
  dt-bindings: mfd: qcom,spmi-pmic: Document PMICs added in SM8750
  mfd: rtc: bd7xxxx Drop IC name from IRQ
  mfd: mt6397: Add initial support for MT6328
  mfd: adp5585: Drop obsolete dependency on COMPILE_TEST
  ...
2024-11-22 16:19:47 -08:00
Wolfram Sang
5b42edefd7 rtc: brcmstb-waketimer: don't include 'pm_wakeup.h' directly
The header clearly states that it does not want to be included directly,
only via 'device.h'. 'platform_device.h' works equally well. Remove the
direct inclusion.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20241118072917.3853-14-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-18 14:47:40 +01:00
Finn Thain
a06e4a9306 rtc: m48t59: Use platform_data struct for year offset value
Instead of hard-coded values and ifdefs, store the year offset in the
platform_data struct.

Tested-by: Daniel Palmer <daniel@0x0f.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Tested-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Andreas Larsson <andreas@gaisler.com>
Link: https://lore.kernel.org/r/665c3526184a8d0c4a6373297d8e7d9a12591d8b.1731450735.git.fthain@linux-m68k.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-18 14:31:57 +01:00
Alexandre Belloni
fb1283bfa2 rtc: ab-eoz9: fix abeoz9_rtc_read_alarm
abeoz9_rtc_read_alarm assumes we always read the alarm in 12-hour mode
while abeoz9_rtc_set_alarm will always set it in 24-hour mode.

We could support 12-hour mode in both functions but it seems very unlikely
that the RTC would be set to 12-hour mode now as the driver has been
setting it to 24-hour mode for a while now. The setting is undefined at
power-up and unchanged by subsequent resets which doesn't help us.

Link: https://lore.kernel.org/r/20241112151119.3451611-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-18 12:14:37 +01:00
Alexandre Belloni
bb3d498f01 rtc: rv3028: fix RV3028_TS_COUNT type
Read RV3028_TS_COUNT in an unsigned int so static checkers stop reporting a
mismatch between the format specifier and the type.

Reported-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20241111104711.3170865-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-18 12:14:13 +01:00
Wolfram Sang
1f7a0c6483 rtc: rzn1: update Michel's email
The Renesas address bounces, use the alternative one.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20241114193450.13982-1-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-18 12:05:19 +01:00
Wolfram Sang
55727188df rtc: rzn1: fix BCD to rtc_time conversion errors
tm_mon describes months from 0 to 11, but the register contains BCD from
1 to 12. tm_year contains years since 1900, but the BCD contains 20XX.
Apply the offsets when converting these numbers.

Fixes: deeb4b5393 ("rtc: rzn1: Add new RTC driver")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20241113113032.27409-1-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-18 12:04:59 +01:00
Xianwei Zhao
6cc79a6295 rtc: amlogic-a4: fix compile error
When compile rtc-a4, build error as following:
ERROR: modpost: drivers/rtc/rtc-amlogic-a4: struct of_device_id is
not terminated with a NULL entry!
This commit is to fix it.

Fixes: c89ac9182e ("rtc: support for the Amlogic on-chip RTC")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://lore.kernel.org/r/20241113-fix_a4_rtc-v1-1-307af26449a8@amlogic.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-13 21:48:27 +01:00
Alexandre Belloni
eb4ffa4001 rtc: amlogic-a4: drop error messages
Drop error message because there is a high probability they will never be
seen and the final user action is clear, the time has to be set again.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20241112143652.3445648-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-12 17:43:21 +01:00
Yiting Deng
c89ac9182e rtc: support for the Amlogic on-chip RTC
This is the third amlogic driver. The RTC hardware of A4 SoC is different
from the previous one. This RTC hardware includes a timing function and
an alarm function. But the existing has only timing function, alarm
function is using the system clock to implement a virtual alarm. Add
the RTC driver to support it.

Signed-off-by: Yiting Deng <yiting.deng@amlogic.com>
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
Link: https://lore.kernel.org/r/20241112-rtc-v6-2-a71b60d2f354@amlogic.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-12 15:05:31 +01:00
Karel Balej
82ee16cfb2 rtc: add driver for Marvell 88PM886 PMIC RTC
RTC lives on the chip's base register page. Add the relevant register
definitions and implement a basic set/read time functionality. Tested
with the samsung,coreprimevelte smartphone which contains this PMIC and
whose vendor kernel tree has also served as the sole reference for this.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20241012193345.18594-2-balejk@matfyz.cz
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 23:37:50 +01:00
Yongliang Gao
e8ba8a2bc4 rtc: check if __rtc_read_time was successful in rtc_timer_do_work()
If the __rtc_read_time call fails,, the struct rtc_time tm; may contain
uninitialized data, or an illegal date/time read from the RTC hardware.

When calling rtc_tm_to_ktime later, the result may be a very large value
(possibly KTIME_MAX). If there are periodic timers in rtc->timerqueue,
they will continually expire, may causing kernel softlockup.

Fixes: 6610e0893b ("RTC: Rework RTC code to use timerqueue for events")
Signed-off-by: Yongliang Gao <leonylgao@tencent.com>
Acked-by: Jingqun Li <jingqunli@tencent.com>
Link: https://lore.kernel.org/r/20241011043153.3788112-1-leonylgao@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 23:10:54 +01:00
Nobuhiro Iwamatsu
00f1bb9b84 rtc: pcf8563: Switch to regmap
Switch the i2c_transfer methods to regmap APIs.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20241010084949.3351182-3-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 22:13:39 +01:00
Nobuhiro Iwamatsu
b263d7c102 rtc: pcf8563: Sort headers alphabetically
Sort headers in alphabetical order.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20241010084949.3351182-2-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 22:13:38 +01:00
Nobuhiro Iwamatsu
10e078b273 rtc: abx80x: Fix WDT bit position of the status register
The WDT bit in the status register is 5, not 6. This fixes from 6 to 5.

Link: https://abracon.com/Support/AppsManuals/Precisiontiming/AB08XX-Application-Manual.pdf
Link: https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-1805-C3_App-Manual.pdf
Fixes: 749e36d0a0 ("rtc: abx80x: add basic watchdog support")
Cc: Jeremy Gebben <jgebben@sweptlaser.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20241008041737.1640633-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 22:10:26 +01:00
AngeloGioacchino Del Regno
d6f471a747 rtc: mt6359: Use RTC_TC_DOW hardware register for wday
Instead of calculating the number of full days since Sunday with
(days + 4) % 7, read (and write) that to the RTC Day-of-week Time
Counter register (RTC_TC_DOW).

Some transformation (addition and subtraction for set/get) is
still done, as this register's range is [1..7], while the tm_wday
in struct tm's range is [0..6].

Please note that this was added only to set_time() and read_time()
callbacks because set_alarm() and read_alarm() are setting a bit
in RTC_AL_MASK to ignore DOW for RTC HW alarms for unknown reasons.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240923100010.97470-4-angelogioacchino.delregno@collabora.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 22:00:35 +01:00
AngeloGioacchino Del Regno
34bbdc12d0 rtc: mt6359: Add RTC hardware range and add support for start-year
Add the RTC hardware range parameters to enable the possibility
of using the `start-year` devicetree property which, if present,
will set the start_secs parameter by overriding the defaults
that this driver is setting;

To keep compatibility with (hence have the same date/time reading
as) the old behavior, set:
 - range_min to 1900-01-01 00:00:00
 - range_max to 2027-12-31 23:59:59 (HW year max range is 0-127)
 - start_secs defaulting to 1968-01-02 00:00:00

Please note that the oddness of starting from January 2nd is not
a hardware quirk and it's done only to get the same date/time
reading as an RTC which time was set before this commit.

Also remove the RTC_MIN_YEAR_OFFSET addition and subtraction in
callbacks set_time() and read_time() respectively, as now this
is already done by the API.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>
Link: https://lore.kernel.org/r/20240923100010.97470-3-angelogioacchino.delregno@collabora.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 22:00:34 +01:00
Peng Fan
60f0108bcc rtc: bbnsm: add remove hook
Without remove hook to clear wake irq, there will be kernel dump when
doing module test.
"bbnsm_rtc 44440000.bbnsm:rtc: wake irq already initialized"

Add remove hook to clear wake irq and set wakeup to false.

Fixes: eb7b85853c ("rtc: bbnsm: Add the bbnsm rtc support")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20241111071130.1099978-1-peng.fan@oss.nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 11:47:58 +01:00
Esben Haabendal
5a36826a59 rtc: isl12022: Replace uint8_t types with u8
Keep coding style consistent, by using kernel integer types instead of
standard types.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/r/20240913-rtc-isl12022-alarm-irq-v2-3-37309d939723@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 00:06:46 +01:00
Esben Haabendal
c62d658e52 rtc: isl12022: Add alarm support
The ISL12022 RTC has a combined INT/fOUT pin, which can be used for alarm
interrupt when frequency output is not enabled.

The device-tree bindings should ensure that interrupt and clock output is
not enabled at the same time.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/r/20240913-rtc-isl12022-alarm-irq-v2-2-37309d939723@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 00:06:46 +01:00
Esben Haabendal
d4a6161f24 rtc: isl12022: Prepare for extending rtc device drvdata
Add a struct to hold the regmap pointer, so more information can be added.

This is morally a revert of commit f525b210e9 ("rtc: isl12022: Get rid of
unneeded private struct isl12022").

Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/r/20240913-rtc-isl12022-alarm-irq-v2-1-37309d939723@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-11 00:06:46 +01:00
Nobuhiro Iwamatsu
49fd6f907f rtc: rtc-mc146818-lib: Use is_leap_year instead of calculate leap years
The is_leap_year() for determining leap year is provided in rtc lib.
This uses is_leap_year() instead of its own leap year determination
routine.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Maciej W. Rozycki <macro@orcam.me.uk>
Link: https://lore.kernel.org/r/20241007233618.1442937-1-nobuhiro1.iwamatsu@toshiba.co.jp
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-10 23:02:43 +01:00
Jinjie Ruan
b6cd7adec0 rtc: st-lpc: Use IRQF_NO_AUTOEN flag in request_irq()
If request_irq() fails in st_rtc_probe(), there is no need to enable
the irq, and if it succeeds, disable_irq() after request_irq() still has
a time gap in which interrupts can come.

request_irq() with IRQF_NO_AUTOEN flag will disable IRQ auto-enable when
request IRQ.

Fixes: b5b2bdfc28 ("rtc: st: Add new driver for ST's LPC RTC")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20240912033727.3013951-1-ruanjinjie@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-10 23:01:59 +01:00
Tóth János
5127135f73 rtc: Makefile: Replace spaces with tab.
Fix a style error.

Signed-off-by: Tóth János <gomba007@gmail.com>
Link: https://lore.kernel.org/r/20240930-rtc-makefile-spaces-v1-1-e936e0a7b02a@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-10 22:59:21 +01:00
Uwe Kleine-König
e5eab1aeae rtc: Switch back to struct platform_driver::remove()
After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/rtc to use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20241007205803.444994-6-u.kleine-koenig@baylibre.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-10 22:58:28 +01:00
Claudiu Beznea
8f315a5c73 rtc: renesas-rtca3: Fix compilation error on RISC-V
Fix the following compilation errors when building the RTCA3 for RISCV:

../drivers/rtc/rtc-renesas-rtca3.c:270:23: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  270 |         tm->tm_sec = bcd2bin(FIELD_GET(RTCA3_RSECCNT_SEC, sec));
      |                              ^
../drivers/rtc/rtc-renesas-rtca3.c:369:23: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  369 |         tm->tm_sec = bcd2bin(FIELD_GET(RTCA3_RSECAR_SEC, sec));
      |                              ^
../drivers/rtc/rtc-renesas-rtca3.c:476:11: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  476 |         cycles = FIELD_GET(RTCA3_RADJ_ADJ, radj);
      |                  ^
../drivers/rtc/rtc-renesas-rtca3.c:523:9: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  523 |         radj = FIELD_PREP(RTCA3_RADJ_ADJ, abs(cycles));
      |                ^
../drivers/rtc/rtc-renesas-rtca3.c:658:8: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  658 |         val = FIELD_PREP(RTCA3_RCR1_PES, RTCA3_RCR1_PES_1_64_SEC);
      |               ^

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20241101095720.2247815-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-10 22:09:01 +01:00
Matti Vaittinen
9b15062cc0 mfd: rtc: bd7xxxx Drop IC name from IRQ
A few ROHM PMICs have an RTC block which can be controlled by the
rtc-bd70528 driver. The RTC driver needs the alarm interrupt information
from the parent MFD driver. The MFD driver provides the interrupt
information as a set of named interrupts, where the name is of form:
<PMIC model>-rtc-alm-<x>, where x is an alarm block number.

>From the RTC driver point of view it is irrelevant what the PMIC name
is. It is sufficient to know this is alarm interrupt for a block X. The
PMIC model information is carried to RTC via the platform device ID.
Hence, having the PMIC model in the interrupt name is only making things
more complex because the RTC driver needs to request differently named
interrupts on different PMICs, making code unnecessary complicated.

Simplify this slightly by always using the RTC driver name 'bd70528' as
the prefix for alarm interrupts, no matter what the exact PMIC model is,
and always request the alarm interrupts of same name no matter what the
PMIC model is.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/ZvVNCfk10ih0YFLW@fedora
Signed-off-by: Lee Jones <lee@kernel.org>
2024-11-01 15:53:05 +00:00
Dmitry Torokhov
0a6efab33e rtc: cmos: avoid taking rtc_lock for extended period of time
On my device reading entirety of /sys/devices/pnp0/00:03/cmos_nvram0/nvmem
takes about 9 msec during which time interrupts are off on the CPU that
does the read and the thread that performs the read can not be migrated
or preempted by another higher priority thread (RT or not).

Allow readers and writers be preempted by taking and releasing rtc_lock
spinlock for each individual byte read or written rather than once per
read/write request.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Link: https://lore.kernel.org/r/Zxv8QWR21AV4ztC5@google.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-01 00:19:22 +01:00
Claudiu Beznea
d448837760 rtc: renesas-rtca3: Add driver for RTCA-3 available on Renesas RZ/G3S SoC
The RTC IP (RTCA-3) available on the Renesas RZ/G3S SoC has calendar count
mode and binary count mode (selectable though RCR2.CNTMD) capabilities,
alarm capabilities, clock error correction capabilities. It can generate
alarm, period, carry interrupts.

Add a driver for RTCA-3 IP. The driver implements calendar count mode (as
the conversion b/w RTC and system time is simpler, done with bcd2bin(),
bin2bcd()), read and set time, read and set alarm, read and set
an offset.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20241030110120.332802-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-11-01 00:16:17 +01:00
Al Viro
5f60d5f6bb move asm/unaligned.h to linux/unaligned.h
asm/unaligned.h is always an include of asm-generic/unaligned.h;
might as well move that thing to linux/unaligned.h and include
that - there's nothing arch-specific in that header.

auto-generated by the following:

for i in `git grep -l -w asm/unaligned.h`; do
	sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
done
for i in `git grep -l -w asm-generic/unaligned.h`; do
	sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
done
git mv include/asm-generic/unaligned.h include/linux/unaligned.h
git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
2024-10-02 17:23:23 -04:00
Al Viro
cb787f4ac0 [tree-wide] finally take no_llseek out
no_llseek had been defined to NULL two years ago, in commit 868941b144
("fs: remove no_llseek")

To quote that commit,

  At -rc1 we'll need do a mechanical removal of no_llseek -

  git grep -l -w no_llseek | grep -v porting.rst | while read i; do
	sed -i '/\<no_llseek\>/d' $i
  done

  would do it.

Unfortunately, that hadn't been done.  Linus, could you do that now, so
that we could finally put that thing to rest? All instances are of the
form
	.llseek = no_llseek,
so it's obviously safe.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-09-27 08:18:43 -07:00
Linus Torvalds
b2149f948c RTC for 6.12
New driver:
  - DFRobot SD2405AL
 
 Drivers:
  - stm32: add alarm A out and LSCO support
  - sun6i: disable automatic clock input switching
  - m48t59: set range
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEBqsFVZXh8s/0O5JiY6TcMGxwOjIFAmbzMJ8ACgkQY6TcMGxw
 OjIVpw//YU/pOMIjD7I+cVcedK8UNGSP5GKlpd/4rK8sN7U3MiowbnvpSQT8rHvG
 N8WaRUjKkZRV6+Yo8iX5JQXacGTFv/WFfqQDCr3QgnU934AGibQT4WAQCooc8IrP
 fKB3Wzljcdr5cZZCWL5IBDiB6P7oWRdbdAHvwQUeTDMbF8zFd2ortLKDdCdHykXd
 iiK8gDDh7iVt2eiQ8duhhvruQXMLmxc7GdNNkTG/hhO6kis4sMUuwNwf+ifuO0fD
 00HOJr0wEJkje5CeTlcU+R2z2Nf3PMnQMMyQzrQnoUv0AEaTcUDx4MiNN9YZ7Kds
 IGkJpVkH5UCMT2RyvVuKVcL2OWA9m2RP63NVfq1iV+lmFRf7neJlQ4Ul/sYcMaL8
 wEL8UwIx4ya61O7mIZT8wI4ntl0yNm+hJw5r2yrIX1Cb7BACK4g0PzK6SoOOsMwN
 xbDkMrFQlpQm5YNL1vSV7ojFYvBwbvJXJfU3WTxF9V0O5RgqFFUSn/mlYog/DCZD
 zenPXYBQo4tp6Jkmg2A8J5g1R/274PQf08k4IQo4HTqtkjHyNRMEILDnneFX8Q0r
 f5W0k1HaWeYR8k08n6XI8A12lAj232RoGvFAtwaxRrqaEM5I5plcwrZIsMcpLSfK
 z0qnreEs9OAL2ZxNUYNNpWyphT4X3IDDSpRkh0Vj0chwgu1IQwo=
 =sjE7
 -----END PGP SIGNATURE-----

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

Pull RTC updates from Alexandre Belloni:
 "More conversions of DT bindings to yaml. There is one new driver, for
  the DFRobot SD2405AL and support for important features of the stm32
  RTC. Summary:

  New driver:
   - DFRobot SD2405AL

  Drivers:
   - stm32: add alarm A out and LSCO support
   - sun6i: disable automatic clock input switching
   - m48t59: set range"

* tag 'rtc-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
  rtc: rc5t619: use proper module tables
  rtc: m48t59: set range
  dt-bindings: rtc: microcrystal,rv3028: add #clock-cells property
  rtc: m48t59: Remove division condition with direct comparison
  rtc: at91sam9: fix OF node leak in probe() error path
  rtc: sun6i: disable automatic clock input switching
  dt-bindings: rtc: Drop non-trivial duplicate compatibles
  dt-bindings: vendor-prefixes: Add DFRobot.
  dt-bindings: rtc: Add support for SD2405AL.
  rtc: Add driver for SD2405AL
  rtc: s35390a: Drop vendorless compatible string from match table
  rtc: twl: convert comma to semicolon
  dt-bindings: rtc: sprd,sc2731-rtc: convert to YAML
  rtc: stm32: add alarm A out feature
  rtc: stm32: add Low Speed Clock Output (LSCO) support
  rtc: stm32: add pinctrl and pinmux interfaces
  dt-bindings: rtc: stm32: describe pinmux nodes
2024-09-25 14:38:37 -07:00
Andreas Kemnade
6902862149 rtc: rc5t619: use proper module tables
Avoid requiring MODULE_ALIASES by declaring proper device id tables.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://lore.kernel.org/r/20240918212159.1191637-1-andreas@kemnade.info
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-22 01:17:35 +02:00
Alexandre Belloni
b242650dfa rtc: m48t59: set range
The m48t59 leap year calculation will fail in 2100

Link: https://lore.kernel.org/r/20240911224836.1571831-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-22 01:17:10 +02:00
Abhishek Tamboli
60a06efc56 rtc: m48t59: Remove division condition with direct comparison
Replace 'year / 100' with a direct comparison 'year >= 100'
in m48t59_rtc_set_time() function. Improve the code clarity
and eliminate division overhead.

Fix the following smatch warning:
drivers/rtc/rtc-m48t59.c:135 m48t59_rtc_set_time() warn:
replace divide condition 'year / 100' with 'year >= 100'

Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>
Link: https://lore.kernel.org/r/20240809155631.548044-1-abhishektamboli9@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-12 00:36:53 +02:00
Krzysztof Kozlowski
73580e2ee6 rtc: at91sam9: fix OF node leak in probe() error path
Driver is leaking an OF node reference obtained from
of_parse_phandle_with_fixed_args().

Fixes: 43e112bb3d ("rtc: at91sam9: make use of syscon/regmap to access GPBR registers")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240825183103.102904-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-12 00:33:33 +02:00
Michael Walle
80bf13c07c rtc: sun6i: disable automatic clock input switching
The V3(s) will detect a valid external low frequency clock and if it is
not present will automatically switch to the internal one. This might
hide bugs and (hardware) configuration errors. It's even worse because
the internal RTC runs significantly slower (32.000Hz vs 32.768Hz).
Fortunately for us, the V3(s) has an (undocumented) bypass of this
switching and the driver already supports it by setting the
.has_auto_swt flag.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20240730194905.2587202-1-mwalle@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-12 00:33:33 +02:00
Tóth János
5af858acea rtc: Add driver for SD2405AL
Add support for the DFRobot SD2405AL I2C RTC Module.

Datasheet:
	https://image.dfrobot.com/image/data/TOY0021/SD2405AL%20datasheet%20(Angelo%20v0.1).pdf

Product:
	https://www.dfrobot.com/product-1600.html

To instantiate (assuming device is connected to I2C-1)
as root:
	echo sd2405al 0x32 > /sys/bus/i2c/devices/i2c-1/new_device
as user:
	echo 'sd2405al 0x32' | sudo tee /sys/class/i2c-adapter/i2c-1/new_device

The driver is tested with:
	+ hwclock
	+ tools/testing/selftests/rtc/setdate
	+ tools/testing/selftests/rtc/rtctest

Reviewed-by: Csókás Bence <csokas.bence@prolan.hu>
Signed-off-by: Tóth János <gomba007@gmail.com>
Link: https://lore.kernel.org/r/20240830-rtc-sd2405al-v7-1-2f7102621b1d@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-12 00:33:24 +02:00
Rob Herring (Arm)
da1531ecf1 rtc: s35390a: Drop vendorless compatible string from match table
There's no need to list "s35390a" in the DT match table. The I2C core
will strip any vendor prefix and match against the i2c_device_id table
which has an "s35390a" entry.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240826191321.1410668-1-robh@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-12 00:15:49 +02:00
Chen Ni
2d611fbe9a rtc: twl: convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Fixes: 7130856f56 ("rtc: twl: add NVRAM support")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://lore.kernel.org/r/20240716030252.400340-1-nichen@iscas.ac.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-09-12 00:08:09 +02:00
Peng Fan
3008598ef3 rtc: support i.MX95 BBM RTC
The BBM module provides RTC feature. To i.MX95, this module is managed by
System Manager and exported System Control Management Interface(SCMI).
Linux could use i.MX SCMI BBM Extension protocol to use RTC feature.

This driver is to use SCMI interface to get/set RTC.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Message-Id: <20240823-imx95-bbm-misc-v2-v8-6-e600ed9e9271@nxp.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2024-08-28 21:54:51 +01:00
Valentin Caron
04dcadb87d rtc: stm32: add alarm A out feature
STM32 RTC can pulse some SOC pins when an RTC alarm expires.
This patch adds this functionality for alarm A. The pulse can out on three
pins RTC_OUT1, RTC_OUT2, RTC_OUT2_RMP (PC13, PB2, PI8 on stm32mp15)
(PC13, PB2, PI1 on stm32mp13) (PC13, PF4/PF6, PI8 on stm32mp25).

This patch only adds the functionality for devices which are using
st,stm32mp1-rtc and st,stm32mp25-rtc compatible.

Add "alarm-a" in pinmux functions.

Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240722160022.454226-5-valentin.caron@foss.st.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-08-14 11:37:07 +02:00
Valentin Caron
bb7b0df2be rtc: stm32: add Low Speed Clock Output (LSCO) support
RTC is able to output on a pin the "LSE" internal clock.

STM32 RTC is now registered as a clock provider.
It provides rtc_lsco clock, that means RTC_LSCO is output on either
RTC_OUT1 or RTC_OUT2_RMP, depending on pinmux DT property.
The clock is marked as CLK_IGNORE_UNUSED and CLK_IS_CRITICAL because
RTC_LSCO can be early required by devices needed it to init.

Add LSCO in pinmux functions.

Add "stm32_rtc_clean_outs" to disable LSCO. As RTC is part of "backup"
power domain, it is not reset during shutdown or reboot. So force LSCO
disable at probe.

Co-developed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20240722160022.454226-4-valentin.caron@foss.st.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-08-14 11:37:07 +02:00
Valentin Caron
16ad2bc09e rtc: stm32: add pinctrl and pinmux interfaces
STM32 RTC is capable to handle 3 specific pins of the soc.
"out1, out2 and out2_rmp". To handle this, we use pinctrl framework.
There is a single pin per group.

Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240722160022.454226-3-valentin.caron@foss.st.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-08-14 11:37:07 +02:00
Valentin Caron
efa9c5be2c rtc: stm32: add new st,stm32mp25-rtc compatible and check RIF configuration
Introduce new st,stm32mp25-rtc compatible. It is based on st,stm32mp1-rtc.

Difference is that stm32mp25 soc implements a triple protection on RTC
registers:
- Secure bit based protection
- Privileged context based protection
- Compartment ID filtering based protection
This driver will now check theses configurations before probing to avoid
exceptions and fake reads on register.

At this time, driver needs only to check two resources: INIT and ALARM_A.
Other resources are not used.

Resource isolation framework (RIF) is a comprehensive set of hardware
blocks designed to enforce and manage isolation of STM32 hardware
resources, like memory and peripherals.

Link: https://www.st.com/resource/en/reference_manual/rm0457-stm32mp25xx-advanced-armbased-3264bit-mpus-stmicroelectronics.pdf#page=4081
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20240708153434.416287-3-valentin.caron@foss.st.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2024-07-10 17:15:33 +02:00