[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202303280929448e41808d@mail.local>
Date: Tue, 28 Mar 2023 11:29:44 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Esteban Blanc <eblanc@...libre.com>
Cc: linus.walleij@...aro.org, lgirdwood@...il.com, broonie@...nel.org,
a.zummo@...ertech.it, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-rtc@...r.kernel.org,
jpanis@...libre.com, jneanne@...libre.com, sterzik@...com,
u-kumar1@...com
Subject: Re: [PATCH v2 1/3] rtc: tps6594: add driver for TPS6594 PMIC RTC
Hello,
On 28/03/2023 11:14:46+0200, Esteban Blanc wrote:
> + /* Start rtc */
> + ret = regmap_set_bits(tps->regmap, TPS6594_REG_RTC_CTRL_1,
> + TPS6594_BIT_STOP_RTC);
> + if (ret < 0)
> + return ret;
> +
> + mdelay(100);
> +
> + /*
> + * RTC should be running now. Check if this is the case.
> + * If not it might be a missing oscillator.
> + */
> + ret = regmap_test_bits(tps->regmap, TPS6594_REG_RTC_STATUS,
> + TPS6594_BIT_RUN);
> + if (ret < 0)
> + return ret;
> + if (ret == 0)
> + return -ENODEV;
> +
> + /* Stop RTC until first call to `tps6594_rtc_set_time */
> + ret = regmap_clear_bits(tps->regmap, TPS6594_REG_RTC_CTRL_1,
> + TPS6594_BIT_STOP_RTC);
> + if (ret < 0)
> + return ret;
> +
This whole block must not be executed when the RTC is already running,
else, you are stopping a perfectly running RTC.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists