[PATCH] drivers: rtc: rv3028: check and update PORF flag during probe

Karthikeyan Krishnasamy posted 1 patch 1 year, 10 months ago
drivers/rtc/rtc-rv3028.c | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH] drivers: rtc: rv3028: check and update PORF flag during probe
Posted by Karthikeyan Krishnasamy 1 year, 10 months ago
PORF flag is set during power reset and voltage drop below Vpor
data in rtc device is no longer valid if PORF flag is set
and software must reset to 0, in order to perform sanity
check on rtc data

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
---
 drivers/rtc/rtc-rv3028.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
index 2f001c59c61d..e9699ff0c4e8 100644
--- a/drivers/rtc/rtc-rv3028.c
+++ b/drivers/rtc/rtc-rv3028.c
@@ -951,6 +951,13 @@ static int rv3028_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
+	if (status & RV3028_STATUS_PORF) {
+		ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS,
+					 RV3028_STATUS_PORF, 0);
+		if (ret < 0)
+			return ret;
+	}
+
 	if (status & RV3028_STATUS_AF)
 		dev_warn(&client->dev, "An alarm may have been missed.\n");
 
-- 
2.34.1
Re: [PATCH] drivers: rtc: rv3028: check and update PORF flag during probe
Posted by Alexandre Belloni 1 year, 10 months ago
On 29/03/2024 15:49:40+0530, Karthikeyan Krishnasamy wrote:
> PORF flag is set during power reset and voltage drop below Vpor
> data in rtc device is no longer valid if PORF flag is set
> and software must reset to 0, in order to perform sanity
> check on rtc data
> 
> Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
> ---
>  drivers/rtc/rtc-rv3028.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
> index 2f001c59c61d..e9699ff0c4e8 100644
> --- a/drivers/rtc/rtc-rv3028.c
> +++ b/drivers/rtc/rtc-rv3028.c
> @@ -951,6 +951,13 @@ static int rv3028_probe(struct i2c_client *client)
>  	if (ret < 0)
>  		return ret;
>  
> +	if (status & RV3028_STATUS_PORF) {
> +		ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS,
> +					 RV3028_STATUS_PORF, 0);
> +		if (ret < 0)
> +			return ret;
> +	}
> +

This breaks the workflow, you must set the time to reset PORF.

>  	if (status & RV3028_STATUS_AF)
>  		dev_warn(&client->dev, "An alarm may have been missed.\n");
>  
> -- 
> 2.34.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Re: [PATCH] drivers: rtc: rv3028: check and update PORF flag during probe
Posted by karthikeyan 1 year, 10 months ago
Agreed. Thanks for clarification.

Regards,
Karthikeyan Krishnasamy


On 3/29/24 15:58, Alexandre Belloni wrote:
> On 29/03/2024 15:49:40+0530, Karthikeyan Krishnasamy wrote:
>> PORF flag is set during power reset and voltage drop below Vpor
>> data in rtc device is no longer valid if PORF flag is set
>> and software must reset to 0, in order to perform sanity
>> check on rtc data
>>
>> Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
>> ---
>>   drivers/rtc/rtc-rv3028.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
>> index 2f001c59c61d..e9699ff0c4e8 100644
>> --- a/drivers/rtc/rtc-rv3028.c
>> +++ b/drivers/rtc/rtc-rv3028.c
>> @@ -951,6 +951,13 @@ static int rv3028_probe(struct i2c_client *client)
>>   	if (ret < 0)
>>   		return ret;
>>   
>> +	if (status & RV3028_STATUS_PORF) {
>> +		ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS,
>> +					 RV3028_STATUS_PORF, 0);
>> +		if (ret < 0)
>> +			return ret;
>> +	}
>> +
> 
> This breaks the workflow, you must set the time to reset PORF.
> 
>>   	if (status & RV3028_STATUS_AF)
>>   		dev_warn(&client->dev, "An alarm may have been missed.\n");
>>   
>> -- 
>> 2.34.1
>>
>