[PATCH v3 3/7] rtc: rtc-tps6594x: Add support for TPS6594X PMIC RTC
Krzysztof Kozlowski
krzysztof.kozlowski at linaro.org
Wed Nov 9 00:49:18 PST 2022
On 09/11/2022 07:55, Matt Ranostay wrote:
> From: Keerthy <j-keerthy at ti.com>
>
> Add support for TPS6594X PMIC RTC. However, currently only get/set of
> time + date functionality is supported.
>
> Signed-off-by: Keerthy <j-keerthy at ti.com>
> Signed-off-by: Matt Ranostay <mranostay at ti.com>
> ---
> drivers/rtc/Kconfig | 10 ++
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-tps6594x.c | 181 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 192 insertions(+)
> create mode 100644 drivers/rtc/rtc-tps6594x.c
>
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 35298c651730..0adb2c2570b8 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -588,6 +588,16 @@ config RTC_DRV_TPS65910
> This driver can also be built as a module. If so, the module
> will be called rtc-tps65910.
>
> +config RTC_DRV_TPS6594X
> + tristate "TI TPS6594X RTC driver"
> + depends on MFD_TPS6594X
Perhaps: || COMPILE_TEST
(and test it)
> + help
> + If you say yes here you get support for the RTC of TI TPS6594X series PMIC
> + chips.
> +
> + This driver can also be built as a module. If so, the module
> + will be called rtc-tps6594x.
> +
(...)
> +
> +static int tps6594x_rtc_probe(struct platform_device *pdev)
> +{
> + struct tps6594x *tps6594x = dev_get_drvdata(pdev->dev.parent);
> + struct tps6594x_rtc *tps6594x_rtc = NULL;
> + int ret;
> +
> + tps6594x_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tps6594x_rtc), GFP_KERNEL);
That's not Linux coding style. Line is too long - wrapping is at 80.
sizeof(*), not struct.
> + if (!tps6594x_rtc)
> + return -ENOMEM;
> +
> + tps6594x_rtc->dev = &pdev->dev;
> + platform_set_drvdata(pdev, tps6594x_rtc);
> +
> + /* Start RTC */
> + ret = regmap_update_bits(tps6594x->regmap, TPS6594X_RTC_CTRL_1,
> + TPS6594X_RTC_CTRL_REG_STOP_RTC,
> + TPS6594X_RTC_CTRL_REG_STOP_RTC);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "RTC_CTRL write failed, err = %d\n", ret);
> + return ret;
> + }
> +
> + tps6594x_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
> + &tps6594x_rtc_ops, THIS_MODULE);
> + if (IS_ERR(tps6594x_rtc->rtc)) {
> + ret = PTR_ERR(tps6594x_rtc->rtc);
> + dev_err(&pdev->dev, "RTC register failed, err = %d\n", ret);
> + return ret;
return dev_err_probe
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list