On 06/02/2019 06:33:39+0000, oliver.r...@wago.com wrote:
> >> +  switch (rs5c->type) {
> >> +  case rtc_r2025sd:
> >> +  case rtc_r2221tl:
> >> +          if (ctrl2 & R2x2x_CTRL2_VDET)
> >> +                  dev_warn(&client->dev, "rtc battery voltage drop below 
> >> threshold detected.\n");
> > 
> > VDET doesn't mean anything specific regarding timekeeping so I wouldn't 
> > warn here.
> 
> VDET means in case the chip is powered by a battery, that is about to die 
> sometime soon, it gives you heads up.

Yes but my statement stands true, this doesn't have any direct
implication regarding timekeeping.

There is the RTC_VL_READ ioctl to check voltage low. It is not weel
designed but this is what we have now.

> > 
> >> +          if (ctrl2 & R2x2x_CTRL2_PON)
> >> +                  dev_warn(&client->dev, "rtc battery voltage drop to 
> >> zero detected.\n");
> > 
> > You should return -EINVAL directly here
> 
> The PON implies the XSTP bit, so I only return from there, just to print all 
> the warning messages, but I can return directly from here if you want.

As you said, PON implies XSTP so I'm not sure it is valuable to have both
warnings.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to