rtc: tps6594: Add driver for TPS6594 RTC
PATCH v8 1/1 rtc: tps6594: Add driver for TPS6594 RTC
TPS6594 PMIC is a MFD. This patch adds support for the RTC found inside TPS6594 family of PMIC.
Alarm is also supported.
---
Notes:
This patch was picked from a series since there is no dependency between the two patches.
Changes since v7:
https://lore.kernel.org/lkml/[email protected]/
- Remove useless variable and comment
- Fix a typo
Here is the old cover-letter:
TPS6594 is a Power Management IC which provides regulators and others features like GPIOs, RTC, watchdog, ESMs (Error Signal Monitor), and PFSM (Pre-configurable Finite State Machine). The SoC and the PMIC can communicate through the I2C or SPI interfaces.
TPS6594 is the super-set device while TPS6593 and LP8764 are derivatives.
This series adds support to TI TPS6594 PMIC and its derivatives.
This should be applied on top of other patch series:
- https://lore.kernel.org/all/[email protected]/
For core MFD driver. The necessary part of this patch series is already applied in linux-next.
The features implemented in this series are:
- RTC (child device)
- Pinmux/GPIO (child device)
- Regulator (child device)
RTC description:
The TPS6594 family has an RTC built-in, except for LP8764. It provides time and an alarm.
Pinmux/GPIO:
TPS6594 family has 11 GPIOs. Those GPIO can also serve different functions such as I2C or SPI interface, watchdog disable functions. The driver provides both pinmuxing for the functions and GPIO capability.
Regulator:
TPS6594/TPS6593: 5 BUCKs and 4LDOs
LP8764: 4 BUCKs and no LDO
Bucks can be used in multipahse mode.
Regulators were applied to linux-next by Mark Brown on 06/06/2023 so this patch has been dropped from the patch series.
There were some pending comments from Andy Shevchenko so a follow up patch will be sent later.
Changes since v1:
https://lore.kernel.org/all/[email protected]/
Rtc:
- Removed struct tps6594_rtc.
- Removed some dev_err messages.
- Removed some comments.
- Remove some whitespaces in comments and error messages.
- Check if RTC is running before reading a timestamp in read_rtc.
- Stop RTC at the end of probe to wait for a timestamp to be set.
- Add default MFD_TPS6594 to Kconfig.
Pinctrl:
- Removed #define DEBUG.
- Add default MFD_TPS6594 to Kconfig.
- Fix typo and reword help message of Kconfig.
Regulators:
Further to Mark Brown review:
- File header whole block C++ style.
- Configuring modes not supported: omit all mode operations
- Log the error before notifying.
- Request the interrupts while registering the regulators (then remove the lookup function).
Further to Matti review:
- Postponed: devm_regulator_irq_helper() and regulator_irq_map_event_simple() can probably be used but code. refactoring is not so trivial. This can be done later as an enhancement after this patch list is merged.
Buck Multi phase management:
- Multiphase property can take an array when 2 multi phase buck, buck12 and buck34.
- Configuration multi phase buck34 without multiphase buck12 is not supported (when only one multiphase, must be buck12). Not clear from the spec but confirmed by TI.
- Supported multiphase conficurations: buck12, buck123, buck1234, buck12 + buck34.
- All interrupts are attached to the multiphase buck (ie: for regulator buck12, buck1 & buck2 interrupts are registered).
Changes since v2:
https://lore.kernel.org/all/[email protected]/
Rtc:
- Add logic to avoid reinitializing a working clock.
- Fix some multiline comments format.
Regulators:
Further to Mark Brown review:
- Log the error before notifying.
- Request the interrupts while registering the regulators. Further to Krzysztof Kozlowski:
https://lore.kernel.org/all/[email protected]/
- Remove ti, multi-phase-id property which is redundant with buck dts naming rules.
Changes since v3:
https://lore.kernel.org/lkml/[email protected]/
RTC:
- Add wakeup source
Pinctrl:
- Switch to GPIO_REGMAP framework
Change since v4:
https://lore.kernel.org/lkml/[email protected]/
Update Copyright notice date
Reorder includes
RTC:
- Rework some comments, fixing punctuation and style
- Use NANO macro from units.h for PPB_MULT
- Rework to use bitwise types
- Remove unnecessary casts
- Add SAFETY comments
- Use dev_err_probe(...) instead of print then return
Pinctrl:
- Reword help message and add module name in Kconfig
- Rework code to use struct pinfunction and PINCTRL_PINFUNCTION() macro
- Remove unnecessary casts
- Use dev_err_probe(...) instead of print then return
- Replace TPS6594_REG_GPIO1_CONF with a comment for TPS6594_REG_GPIOX_CONF
Regulators:
- nits: Add missing tabs, standard spaces, group "buck_multi".
- Use OF dedicated of_node_cmp API instead of standard strcmp.
- Use devm_kmalloc_array(...) API instead of devm_kmalloc(...) wherever possible.
- return dev_err_probe(...) wherever possible.
Changes since v5:
https://lore.kernel.org/lkml/[email protected]/
Pinctrl:
- Rework code for clarity
- Rework macro to fix checkpatch macro argument reuse
- Coding style fixes
- Reword some comments
Rtc:
- Grammar fixes
- Removed unused macros
- Use type MIN/MAX macro instead of magic numbers
- Fix return code in calibration
- Use cpu_to_le16 and le16_to_cpu APIs instead of casting.
- Reintroduce mdelay before reading BIT_RUN as otherwise both AM62 and J784S4 will report a -ENODEV on a working RTC.
Changes since v6:
https://lore.kernel.org/all/[email protected]/
Pinctrl:
- Remove a comment
drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-tps6594.c | 447 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 460 insertions(+) create mode 100644 drivers/rtc/rtc-tps6594.c
drivers/rtc/Kconfig +12 -0
@@ -578,6 +578,18 @@ config RTC_DRV_TPS6586X along with alarm. This driver supports the RTC driver for the TPS6586X RTC module. +config RTC_DRV_TPS6594 + tristate "TI TPS6594 RTC driver" + depends on MFD_TPS6594 + default MFD_TPS6594 + help + TI Power Management IC TPS6594 supports RTC functionality + along with alarm. This driver supports the RTC driver for + the TPS6594 RTC module. + + This driver can also be built as a module. If so, the module + will be called rtc-tps6594. + config RTC_DRV_TPS65910 tristate "TI TPS65910 RTC driver" depends on MFD_TPS65910
drivers/rtc/Makefile +1 -0
@@ -175,6 +175,7 @@ obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o obj-$(CONFIG_RTC_DRV_TI_K3) += rtc-ti-k3.o obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o +obj-$(CONFIG_RTC_DRV_TPS6594) += rtc-tps6594.o obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o obj-$(CONFIG_RTC_DRV_VT8500) += rtc-vt8500.o
drivers/rtc/rtc-tps6594.c new file +447 -0
447 lines not on this page · raw message
Signature · 1 line
2.40.1
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.
Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.
Thanks for your time Andy,
--
Esteban Blanc
BayLibre
Quoted 7 lines · Esteban Blanc
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.
Quoted 7 lines
Quoted 3 lines
Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.
Ah, that was not reflected in the changelog...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Alexandre Belloni
maintainerQuoted 12 lines · Andy Shevchenko
Quoted 11 lines · Esteban Blanc
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Quoted 5 lines
Quoted 3 lines
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.Ah, that was not reflected in the changelog...
For the record, I'm using b4 but it was not clear which path the patches would take.
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 13 lines · Alexandre Belloni
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Esteban Blanc
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.Ah, that was not reflected in the changelog...
For the record, I'm using b4 but it was not clear which path the patches would take.
You mean in the initial series? You take it by direct message-id with -P _. Or did I misunderstand the problem?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Alexandre Belloni
maintainerQuoted 19 lines · Andy Shevchenko
Quoted 17 lines · Alexandre Belloni
Quoted 16 lines · Andy Shevchenko
Quoted 14 lines · Esteban Blanc
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Ah, that was not reflected in the changelog...
For the record, I'm using b4 but it was not clear which path the patches would take.
You mean in the initial series? You take it by direct message-id with -P _. Or did I misunderstand the problem?
No I mean it was not clear whether I should take the patch or it would get through MFD.
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Esteban Blanc
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Esteban Blanc
Notes:
This patch was picked from a series since there is no dependency between the two patches.Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Quoted 5 lines
Quoted 3 lines
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.Ah, that was not reflected in the changelog...
Just after the line you quoted, there is "Changes since v7". Maybe I should have put it near the other ones. Sorry about that.
Best regards,
Signature · 2 lines
Esteban Blanc BayLibre
Quoted 4 lines · Esteban Blanc
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Esteban Blanc
Quoted 1 line · Andy Shevchenko
On Thu, Nov 2, 2023 at 3:26 PM Esteban Blanc <[email protected]> wrote:
...
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Notes:
This patch was picked from a series since there is no dependency between the two patches.Not sure if RTC maintainer uses the b4 tool, but as I said in previous email for pinctrl change, there is no need to resend. b4 has an ability to select patches from the series to be applied.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Oh that's good to know, I was not aware of that.
I resent it because there was some minor nits that I fixed on both patches.Ah, that was not reflected in the changelog...
Just after the line you quoted, there is "Changes since v7". Maybe I should have put it near the other ones. Sorry about that.
It's me who misinterpreted that as changes _in_ v7. Thanks for clarifying.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · Esteban Blanc
TPS6594 PMIC is a MFD. This patch adds support for the RTC found inside TPS6594 family of PMIC.
Alarm is also supported.
Signed-off-by Esteban Blanc <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
...
drivers/rtc/rtc-tps6594.c line 444
Quoted 10 lines
drivers/rtc/rtc-tps6594.c new file +10
-0+ +static struct platform_driver tps6594_rtc_driver = { + .probe = tps6594_rtc_probe, + .driver = { + .name ="tps6594-rtc" , + }, +}; + +module_platform_driver (tps6594_rtc_driver); +MODULE_ALIAS ("platform:tps6594-rtc" );
You should not need MODULE_ALIAS() in normal cases. If you need it, usually it means your device ID table is wrong (e.g. misses either entries or MODULE_DEVICE_TABLE()). MODULE_ALIAS() is not a substitute for incomplete ID table.
This applies also to your other driver: pinctrl. Maybe to all your drivers... Don't use MODULE_ALIAS() as substitute for missing tables.
Best regards,
Krzysztof