Commit graph

4062 commits

Author SHA1 Message Date
Miaoqian Lin
b520cbe5be rtc: ftrtc010: Fix error handling in ftrtc010_rtc_probe
In the error handling path, the clk_prepare_enable() function
call should be balanced by a corresponding 'clk_disable_unprepare()'
call , as already done in the remove function.

clk_disable_unprepare calls clk_disable() and clk_unprepare().
They will use IS_ERR_OR_NULL to check the argument.

Fixes: ac05fba39c ("rtc: gemini: Add optional clock handling")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220403054912.31739-1-linmq006@gmail.com
2022-05-19 12:08:17 +02:00
Yang Yingliang
d3b43eb505 rtc: mt6397: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Fixes: fc2979118f ("rtc: mediatek: Add MT6397 RTC driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220505125043.1594771-1-yangyingliang@huawei.com
2022-05-19 12:05:48 +02:00
Yang Li
e60e8a7323 rtc: rzn1: fix platform_no_drv_owner.cocci warning
Remove .owner field if calls are used which set it automatically.
./drivers/rtc/rtc-rzn1.c:411:3-8: No need to set .owner here. The core
will do it.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220518232445.79156-1-yang.lee@linux.alibaba.com
2022-05-19 11:19:30 +02:00
Yuan Can
6ddabcb106 rtc: gamecube: Add missing iounmap in gamecube_rtc_read_offset_from_sram
The hw_srnprot needs to be unmapped when gamecube_rtc_read_offset_from_sram returns.

Fixs: 86559400b3 (rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U)
Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220511071354.46202-1-yuancan@huawei.com
2022-05-18 14:52:17 +02:00
Nobuhiro Iwamatsu
a37bdde620 rtc: meson: Fix email address in MODULE_AUTHOR
Ben Dooks's email address is <ben.dooks@codethink.co.uk>.
Fix Ben Dooks's email address in MODULE_AUTHOR.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220506232850.220582-1-nobuhiro1.iwamatsu@toshiba.co.jp
2022-05-18 00:20:39 +02:00
Minghao Chi
bce7a01ada rtc: simplify the return expression of rx8025_set_offset()
Simplify the return expression.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220505022314.59822-1-chi.minghao@zte.com.cn
2022-05-18 00:18:19 +02:00
Fabio Estevam
aabfe05a82 rtc: pcf85063: Add a compatible entry for pca85073a
The PCA85073A RTC has the same programming model as the PCF85063A.

Add a compatible entry for it.

Tested on a custom i.MX6SX based board.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220419014445.341444-2-festevam@gmail.com
2022-05-18 00:15:50 +02:00
Miquel Raynal
be4a11cf98 rtc: rzn1: Add oscillator offset support
The RZN1 RTC can compensate the imprecision of the oscillator up to
approximately 190ppm.

Seconds can last slightly shorter or longer depending on the
configuration.

Below ~65ppm of correction, we can change the time spent in a second
every minute, which is the most accurate compensation that the RTC can
offer. Above, the compensation will be active every 20s.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220516082504.33913-5-miquel.raynal@bootlin.com
2022-05-17 23:11:44 +02:00
Miquel Raynal
b5ad1bf00d rtc: rzn1: Add alarm support
The RZN1 RTC can trigger an interrupt when reaching a particular date up
to 7 days ahead. Bring support for this alarm.

One drawback though, the granularity is about a minute.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220516082504.33913-4-miquel.raynal@bootlin.com
2022-05-17 23:11:44 +02:00
Michel Pollet
deeb4b5393 rtc: rzn1: Add new RTC driver
Add a basic RTC driver for the RZ/N1.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Co-developed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220516082504.33913-3-miquel.raynal@bootlin.com
2022-05-17 23:11:44 +02:00
Samuel Holland
581d6d8f48 rtc: sun6i: Add NVMEM provider
The sun6i RTC provides 32 bytes of general-purpose data registers.
They can be used to save data in the always-on RTC power domain.
The registers are writable via 32-bit MMIO accesses only.

Expose them with a NVMEM provider so they can be used by other drivers.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220413231731.56709-1-samuel@sholland.org
2022-05-17 22:49:24 +02:00
Linus Torvalds
6a34fdcca4 RTC for 5.18
Subsystem:
  - remove uie_unsupported, all users have been converted to clear
    RTC_FEATURE_UPDATE_INTERRUPT and provide a reason
  - RTCs with an alarm with a resolution of a minute are now letting the core
    handle rounding down the alarm time
  - fix use-after-free on device removal
 
 New driver:
  - OP-TEE RTC PTA
 
 Drivers:
  - sun6i: Add H616 support
  - cmos: Fix the AltCentury for AMD platforms
  - spear: set range
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEBqsFVZXh8s/0O5JiY6TcMGxwOjIFAmJGJ0wACgkQY6TcMGxw
 OjKAXQ/9EId70uY/kUQv2Ay2+NysfSFYpDoerf1V55vGyN+n/pxX14bUxTx0Ivse
 47ROcWSP94MSw9cExNvujkpY/V6xaQI3/jxWC60f5ngHzAwIArmmDdWMSLDmRJYi
 mg07Hp9bSTIgXVzBdlAJc6vSRDmznKB44TTrz6GvulLJROAy9jNJwefuxwsV9Ftl
 I6PcRtYGn5poPpp7yLi1IZ1m0gWJJVze9IsJWJjTRSzh9xAYnjOsMR5H8fyMLjh9
 1KjiHwV1c5En4HtrMrYPXOdeLTgNfCdfHaLRRhZRSE+dTK4551TbYbeG2GtKWkdR
 Xvybwik2kghde8+/sh6hhg59NGkfMkzLByc41P0VWfDEscyi3z+YXot2OOV+FfkI
 XpDPab+a2IQaGFYEa4sGVloFP4e9er5uRHRPkT6bX07plACMwV1wLSRqCK/RriV6
 HYImdP7/aA4t/OlmVdliyiyOZfO+oHX/z8hhkNbTJc5HpvgViDEKKEsOEef6OcRh
 j+p8ej6iaVt1wjYpfghHYanFzVPi98zGH0QMS9GmHbS+VetGYxzUVyKgzAsOMwYA
 RwTunNkQQqgiz+C4n2s/PDD4ZuNDFDFaEE+3RReaw/9LGkR007TCxwcNBEGde+B6
 1W4B9tNMGLI/hHulv7WYNrP/5Y/QPEuPiu+FxhwpNm5tDg1Ur70=
 =7E0a
 -----END PGP SIGNATURE-----

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

Pull RTC updates from Alexandre Belloni:
 "The bulk of the patches are about replacing the uie_unsupported struct
  rtc_device member by a feature bit.

  Subsystem:

   - remove uie_unsupported, all users have been converted to clear
     RTC_FEATURE_UPDATE_INTERRUPT and provide a reason

   - RTCs with an alarm with a resolution of a minute are now letting
     the core handle rounding down the alarm time

   - fix use-after-free on device removal

  New driver:

   - OP-TEE RTC PTA

  Drivers:

   - sun6i: Add H616 support

   - cmos: Fix the AltCentury for AMD platforms

   - spear: set range"

* tag 'rtc-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (56 commits)
  rtc: check if __rtc_read_time was successful
  rtc: gamecube: Fix refcount leak in gamecube_rtc_read_offset_from_sram
  rtc: mc146818-lib: Fix the AltCentury for AMD platforms
  rtc: optee: add RTC driver for OP-TEE RTC PTA
  rtc: pm8xxx: Return -ENODEV if set_time disallowed
  rtc: pm8xxx: Attach wake irq to device
  clk: sunxi-ng: sun6i-rtc: include clk/sunxi-ng.h
  rtc: remove uie_unsupported
  rtc: xgene: stop using uie_unsupported
  rtc: hym8563: switch to RTC_FEATURE_UPDATE_INTERRUPT
  rtc: hym8563: let the core handle the alarm resolution
  rtc: hym8563: switch to devm_rtc_allocate_device
  rtc: efi: switch to RTC_FEATURE_UPDATE_INTERRUPT
  rtc: efi: switch to devm_rtc_allocate_device
  rtc: add new RTC_FEATURE_ALARM_WAKEUP_ONLY feature
  rtc: spear: fix spear_rtc_read_time
  rtc: spear: drop uie_unsupported
  rtc: spear: set range
  rtc: spear: switch to devm_rtc_allocate_device
  rtc: pcf8563: switch to RTC_FEATURE_UPDATE_INTERRUPT
  ...
2022-04-01 09:37:18 -07:00
Tom Rix
915593a7a6 rtc: check if __rtc_read_time was successful
Clang static analysis reports this issue
interface.c:810:8: warning: Passed-by-value struct
  argument contains uninitialized data
  now = rtc_tm_to_ktime(tm);
      ^~~~~~~~~~~~~~~~~~~

tm is set by a successful call to __rtc_read_time()
but its return status is not checked.  Check if
it was successful before setting the enabled flag.
Move the decl of err to function scope.

Fixes: 2b2f5ff00f ("rtc: interface: ignore expired timers when enqueuing new timers")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220326194236.2916310-1-trix@redhat.com
2022-03-29 22:45:50 +02:00
Miaoqian Lin
4b2dc39ca0 rtc: gamecube: Fix refcount leak in gamecube_rtc_read_offset_from_sram
The of_find_compatible_node() function returns a node pointer with
refcount incremented, We should use of_node_put() on it when done
Add the missing of_node_put() to release the refcount.

Fixes: 86559400b3 ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309092225.6930-1-linmq006@gmail.com
2022-03-29 22:45:50 +02:00
Mario Limonciello
3ae8fd4157 rtc: mc146818-lib: Fix the AltCentury for AMD platforms
Setting the century forward has been failing on AMD platforms.
There was a previous attempt at fixing this for family 0x17 as part of
commit 7ad295d519 ("rtc: Fix the AltCentury value on AMD/Hygon
platform") but this was later reverted due to some problems reported
that appeared to stem from an FW bug on a family 0x17 desktop system.

The same comments mentioned in the previous commit continue to apply
to the newer platforms as well.

```
MC146818 driver use function mc146818_set_time() to set register
RTC_FREQ_SELECT(RTC_REG_A)'s bit4-bit6 field which means divider stage
reset value on Intel platform to 0x7.

While AMD/Hygon RTC_REG_A(0Ah)'s bit4 is defined as DV0 [Reference]:
DV0 = 0 selects Bank 0, DV0 = 1 selects Bank 1. Bit5-bit6 is defined
as reserved.

DV0 is set to 1, it will select Bank 1, which will disable AltCentury
register(0x32) access. As UEFI pass acpi_gbl_FADT.century 0x32
(AltCentury), the CMOS write will be failed on code:
CMOS_WRITE(century, acpi_gbl_FADT.century).

Correct RTC_REG_A bank select bit(DV0) to 0 on AMD/Hygon CPUs, it will
enable AltCentury(0x32) register writing and finally setup century as
expected.
```

However in closer examination the change previously submitted was also
modifying bits 5 & 6 which are declared reserved in the AMD documentation.
So instead modify just the DV0 bank selection bit.

Being cognizant that there was a failure reported before, split the code
change out to a static function that can also be used for exclusions if
any regressions such as Mikhail's pop up again.

Cc: Jinke Fan <fanjinke@hygon.cn>
Cc: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Link: https://lore.kernel.org/all/CABXGCsMLob0DC25JS8wwAYydnDoHBSoMh2_YLPfqm3TTvDE-Zw@mail.gmail.com/
Link: https://www.amd.com/system/files/TechDocs/51192_Bolton_FCH_RRG.pdf
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220111225750.1699-1-mario.limonciello@amd.com
2022-03-29 22:45:31 +02:00
Linus Torvalds
8350e8331b - New Drivers
- Add support for Maxim MAX77714 PMIC
 
  - Remove Drivers
    - Remove support for ST-Ericsson AB8500 DebugFS
 
  - New Device Support
    - Add support for Silergy SY7636A to Simple MFD I2C
    - Add support for MediaTek MT6366 PMIC to MT6358 IRQ
    - Add support for Charger to Intel PMIC CRC
    - Add support for Raptor Lake to Intel LPSS PCI
 
  - New Functionality
    - Add support for Reboot to Rockchip RK808
 
  - Fix-ups
    - Device Tree changes (inc. YAML conversion); silergy,sy7636a, maxim,max77843,
                                   google,cros-ec, maxim,max14577, maxim,max77802,
 				  maxim,max77714, qcom,tcsr, qcom,spmi-pmic,
 				  stericsson,ab8500, stericsson,db8500-prcmu,
 				  samsung,exynos5433-lpass, mt6397, syscon, brcm,cru
    - Visible to menuconfig; simple-mfd-i2c
    - Clean-up or clarify code; max77686, intel_soc_pmic_crc
    - Improve error handling; mc13xxx-core, stmfx, asic3
    - Pass device information to child devices; iqs62x, intel-lpss-acpi
    - Individually identify IRQ domains; intel_soc_pmic_core
    - Remove superfluous code; dbx500-prcmu, exynos-lpass
    - Staticify and constify; arizona-i2c
    - Mark sometimes used data as __maybe_unused; atmel-flexcom
    - Account for different ACPI tables on AOSP/Windows platforms; arizona-spi
    - Use provided (platform) APIs; ab8500-core
    - Trivial (whitespace, spelling); rohm-bd9576
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmI9n1YACgkQUa+KL4f8
 d2F59RAAi3zTun+i7NEvaPs4awcXgUv9ZFJmP/AcCTvKwmAnom4JHc56c86yE/Fz
 IwQ/yug60AQPMe05jw4+KxD87URLGKb/IDTzmRvnC29gwg1FR5A2bFNJ+wveK6od
 cN0r40lvHCzVASwOeF2E63RzXcWHFg+tuNq6qm+HQ6LX31MpMe/dfMOCvVm+1A50
 aOn2cnEiUw7mhEiEy0CPtd01hjBEu4QS8xzZwGu/4lHEbInDxpAakQP8ixYE0THF
 KEvR2gFS6G6wYHO3ZQOJHQJnnzL1nmLtsUX3q+5+DIKnLcY/1xofdxloHAH18i+9
 8e9nDB4TVPAHCpiSVFmPtzS7TR5ofkaYIvpxKlolBVgXGkAivYrtcQUMPEG6ZbNL
 wpe6j2IB7EeQeh0z8k9mzr6zZ3Dw5EGcytvAMP3SZAsHpy+uiZ0TOqPdFs1NXLJ7
 7rlpUhlgn2Ar5TI+z5DLeZsKSO8Lb9+X6BlXfblT0dNBclmh52suWwp1yx7hCehD
 mFm7JfkU7+/9XlzkxYqyyl/3qmmuiXfrxf5Uc96kwcczFkXli8z2Q5Jli6dmCq5+
 LE9hkLk6JC5m5QpRv8cg06sHraDbPbTnrrhf5w6txukU+HsldxcQNaJMqLhHCPQ4
 CUYWRImr0no8PJZQkslIgWaqkpQejS5UzPQbFnkQblvP2XMvOFU=
 =1xnI
 -----END PGP SIGNATURE-----

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

Pull MFD updates from Lee Jones:
 "New Drivers:
   - Add support for Maxim MAX77714 PMIC

  Removed Drivers:
   - Remove support for ST-Ericsson AB8500 DebugFS

  New Device Support:
   - Add support for Silergy SY7636A to Simple MFD I2C
   - Add support for MediaTek MT6366 PMIC to MT6358 IRQ
   - Add support for Charger to Intel PMIC CRC
   - Add support for Raptor Lake to Intel LPSS PCI

  New Functionality:
   - Add support for Reboot to Rockchip RK808

  Fix-ups:
   - Device Tree changes (includcing YAML conversion) for
     silergy,sy7636a, maxim,max77843, google,cros-ec, maxim,max14577,
     maxim,max77802, maxim,max77714, qcom,tcsr, qcom,spmi-pmic,
     stericsson,ab8500, stericsson,db8500-prcmu,
     samsung,exynos5433-lpass, mt6397, syscon, brcm,cru
   - Visible to menuconfig; simple-mfd-i2c
   - Clean-up or clarify code; max77686, intel_soc_pmic_crc
   - Improve error handling; mc13xxx-core, stmfx, asic3
   - Pass device information to child devices; iqs62x, intel-lpss-acpi
   - Individually identify IRQ domains; intel_soc_pmic_core
   - Remove superfluous code; dbx500-prcmu, exynos-lpass
   - Staticify and constify; arizona-i2c
   - Mark sometimes used data as __maybe_unused; atmel-flexcom
   - Account for different ACPI tables on AOSP/Windows platforms; arizona-spi
   - Use provided (platform) APIs; ab8500-core
   - Trivial (whitespace, spelling); rohm-bd9576"

* tag 'mfd-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (50 commits)
  dt-bindings: mfd: syscon: Add microchip,lan966x-cpu-syscon compatible
  mfd: bd9576: fix typos in comments
  mfd: Use platform_get_irq() to get the interrupt
  mfd: db8500-prcmu: Remove unused inline function
  mfd: arizona-spi: Add Android board ACPI table handling
  mfd: arizona-spi: Split Windows ACPI init code into its own function
  mfd: asic3: Add missing iounmap() on error asic3_mfd_probe
  MAINTAINERS: Rectify entry for ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS
  mfd: intel-lpss: Provide an SSP type to the driver
  dt-bindings: mfd: brcm,cru: Rename pinctrl node
  dt-bindings: Add compatibles for undocumented trivial syscons
  mfd: atmel-flexcom: Fix compilation warning
  dt-bindings: mfd: Add compatible for the MediaTek MT6366 PMIC
  dt-bindings: mfd: samsung,exynos5433-lpass: Convert to dtschema
  mfd: exynos-lpass: Drop unneeded syscon.h include
  mfd: intel-lpss: Add Intel Raptor Lake PCH-S PCI IDs
  mfd: ab8500: Drop debugfs module
  mfd: sta2x11: Use GFP_KERNEL instead of GFP_ATOMIC
  mfd: ab8500: Rewrite bindings in YAML
  mfd: qcom-spmi-pmic: Add pm8953 compatible
  ...
2022-03-25 13:56:18 -07:00
Clément Léger
81c2f059ab rtc: optee: add RTC driver for OP-TEE RTC PTA
This drivers allows to communicate with a RTC PTA handled by OP-TEE [1].
This PTA allows to query RTC information, set/get time and set/get
offset depending on the supported features.

[1] https://github.com/OP-TEE/optee_os/pull/5179

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220308133505.471601-1-clement.leger@bootlin.com
2022-03-25 11:42:50 +01:00
Loic Poulain
870c54e1a3 rtc: pm8xxx: Return -ENODEV if set_time disallowed
Having !allow_set_time is equivalent to non-implemented set_time
function, which is normally represented with -ENODEV error in RTC
subsystem.

Today we are returning -EACCES error code, which is not considered
by RTC clients as a 'non implemented' feature, and which causes NTP
to retry hw clk sync (update_rtc) indefinitely.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/1645090578-20734-1-git-send-email-loic.poulain@linaro.org
2022-03-25 11:38:33 +01:00
Loic Poulain
b5bf5b283d rtc: pm8xxx: Attach wake irq to device
Attach the interrupt as a wake-irq to the device, so that:
- A corresponding wakeup source is created (and reported in e.g
  /sys/kernel/debug/wakeup_sources).
- The power subsystem take cares of arming/disarming
  irq-wake automatically on suspend/resume.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/1645025082-6138-1-git-send-email-loic.poulain@linaro.org
2022-03-25 11:37:55 +01:00
Alexandre Belloni
1a31d63632 rtc: remove uie_unsupported
uie_unsupported is not used by any drivers anymore, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-29-alexandre.belloni@bootlin.com
2022-03-23 19:58:41 +01:00
Alexandre Belloni
ed90e3e20d rtc: xgene: stop using uie_unsupported
Remove bogus use of uie_unsupported.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-28-alexandre.belloni@bootlin.com
2022-03-23 19:58:41 +01:00
Alexandre Belloni
7e1df2f1c5 rtc: hym8563: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-27-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
e6b7d19d39 rtc: hym8563: let the core handle the alarm resolution
Set RTC_FEATURE_ALARM_RES_MINUTE, so the core knows alarms have a
resolution of a minute. Also, the core will properly round down the alarm
instead of up.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-26-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
07398602c8 rtc: hym8563: switch to devm_rtc_allocate_device
Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows
for further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-25-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
1350b94c94 rtc: efi: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.
Also the driver doesn't supports UIE because it doesn't handle interrupts
so set RTC_FEATURE_ALARM_WAKEUP_ONLY,.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-24-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
8aa7436396 rtc: efi: switch to devm_rtc_allocate_device
Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows
for further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-23-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
a87a07a111 rtc: spear: fix spear_rtc_read_time
The reference manual doesn't specify whether the registers are latched and
they probably aren't, ensure the read time and date are consistent.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20220309162301.61679-21-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
343597e29e rtc: spear: drop uie_unsupported
Since commitc9f5c7e7a84f ("rtc: rtc-spear: Provide flag for no support of
UIE mode") which was in 2012, the core changed a lot and UIE are now
supported using regular alarms. Drop uie_unsupported now to reflect that.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20220309162301.61679-20-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
f395e1d3b2 rtc: spear: set range
While the RTC can store dates from year 0000 to 9999, leap years where not
tested fro 2100. The driver currently stores tm_year directly which will
probably fail at that time or more probably in 2300.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20220309162301.61679-19-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
4fc4d3339f rtc: spear: switch to devm_rtc_allocate_device
Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows
for further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20220309162301.61679-18-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
d28a0e144e rtc: pcf8563: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-17-alexandre.belloni@bootlin.com
2022-03-23 19:58:40 +01:00
Alexandre Belloni
cf4521ed7b rtc: pcf8563: let the core handle the alarm resolution
Set RTC_FEATURE_ALARM_RES_MINUTE, so the core knows alarms have a
resolution of a minute. Also, the core will properly round down the alarm
instead of up.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-16-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
e51cdef081 rtc: pcf8523: let the core handle the alarm resolution
Set RTC_FEATURE_ALARM_RES_MINUTE, so the core knows alarms have a
resolution of a minute. Also, the core will properly round down the alarm
instead of up.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-15-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
c1325e730c rtc: pcf8523: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-14-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
a9f2d5bb66 rtc: pcf85063: set RTC_FEATURE_ALARM_RES_2S
The PCF85063 doesn't support UIE because setting an alarm to fire every
second confuses the chip and the fastest we can go is an alarm every 2
seconds.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-13-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
11316c2463 rtc: pcf85063: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-12-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
bda1027358 rtc: pcf2127: set RTC_FEATURE_ALARM_RES_2S
The PCF2127 doesn't support UIE because setting an alarm to fire every
second confuses the chip and the fastest we can go is an alarm every 2
seconds.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-11-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
689fafd5b5 rtc: pcf2127: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-10-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
c7e91f7c1b rtc: pcf2123: set RTC_FEATURE_ALARM_RES_MINUTE
Alarms have a resolution of a minute.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-9-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
fff36f7968 rtc: pcf2123: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-8-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
9659947365 rtc: opal: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-7-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
ba39374bc9 rtc: m41t80: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-6-alexandre.belloni@bootlin.com
2022-03-23 19:58:39 +01:00
Alexandre Belloni
14e6fc13a9 rtc: mpc5121: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-5-alexandre.belloni@bootlin.com
2022-03-23 19:58:38 +01:00
Alexandre Belloni
9597f8cc80 rtc: mpc5121: let the core handle the alarm resolution
Set RTC_FEATURE_ALARM_RES_MINUTE, so the core knows alarms have a
resolution of a minute. Also, the core will properly round down the alarm
instead of up.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-4-alexandre.belloni@bootlin.com
2022-03-23 19:58:38 +01:00
Alexandre Belloni
000bf045c6 rtc: ds1307: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-3-alexandre.belloni@bootlin.com
2022-03-23 19:58:38 +01:00
Alexandre Belloni
5c0a04a663 rtc: ds1685: drop no_irq
No platforms are currently setting no_irq. Anyway, letting platform_get_irq
fail is fine as this means that there is no IRQ. In that case, clear
RTC_FEATURE_ALARM so the core knows there are no alarms.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-2-alexandre.belloni@bootlin.com
2022-03-23 19:58:38 +01:00
Alexandre Belloni
9e02e8032a rtc: ds1685: switch to RTC_FEATURE_UPDATE_INTERRUPT
Stop using uie_unsupported and clear RTC_FEATURE_UPDATE_INTERRUPT instead.
There is currently a missing information as to why this is not supported on
ioc3.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220309162301.61679-1-alexandre.belloni@bootlin.com
2022-03-23 19:58:38 +01:00
Samuel Holland
1738890a31 clk: sunxi-ng: sun6i-rtc: Add support for H6
H6 supports IOSC calibration and an ext-osc32k input. Unlike newer SoCs,
it has a single parent for its fanout clock.

Add support for H6 in the CCU driver, replacing the support in the
existing early OF clock provider.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220203021736.13434-7-samuel@sholland.org
2022-03-23 19:58:38 +01:00
Samuel Holland
d91612d7f0 clk: sunxi-ng: Add support for the sun6i RTC clocks
The RTC power domain in sun6i and newer SoCs manages the 16 MHz RC
oscillator (called "IOSC" or "osc16M") and the optional 32 kHz crystal
oscillator (called "LOSC" or "osc32k"). Starting with the H6, this power
domain also handles the 24 MHz DCXO (called variously "HOSC", "dcxo24M",
or "osc24M") as well. The H6 also adds a calibration circuit for IOSC.

Later SoCs introduce further variations on the design:
 - H616 adds an additional mux for the 32 kHz fanout source.
 - R329 adds an additional mux for the RTC timekeeping clock, a clock
   for the SPI bus between power domains inside the RTC, and removes the
   IOSC calibration functionality.

Take advantage of the CCU framework to handle this increased complexity.
This driver is intended to be a drop-in replacement for the existing RTC
clock provider. So some runtime adjustment of the clock parents is
needed, both to handle hardware differences, and to support the old
binding which omitted some of the input clocks.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220203021736.13434-6-samuel@sholland.org
2022-03-23 19:58:38 +01:00
Jiasheng Jiang
43f0269b6b rtc: wm8350: Handle error for wm8350_register_irq
As the potential failure of the wm8350_register_irq(),
it should be better to check it and return error if fails.
Also, it need not free 'wm_rtc->rtc' since it will be freed
automatically.

Fixes: 077eaf5b40 ("rtc: rtc-wm8350: add support for WM8350 RTC")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220303085030.291793-1-jiasheng@iscas.ac.cn
2022-03-23 19:58:38 +01:00