Re: [PATCH] rtc: rs5c372: Add RTC_VL_READ, RTC_VL_CLR ioctls

From: Alexandre Belloni
Date: Wed Nov 10 2021 - 09:27:48 EST


On 10/11/2021 15:03:49+0100, Camel Guo wrote:
> > On 10/11/2021 12:54:54+0100, Camel Guo wrote:
> > > From: Camel Guo <camelg@xxxxxxxx>
> > > +     switch (cmd) {
> > > +     case RTC_VL_READ:
> > > +             flags = 0;
> > > +
> > > +             switch (rs5c->type) {
> > > +             case rtc_r2025sd:
> > > +             case rtc_r2221tl:
> > > +                     if ((rs5c->type == rtc_r2025sd && !(ctrl2 & R2x2x_CTRL2_XSTP)) ||
> > > +                             (rs5c->type == rtc_r2221tl &&  (ctrl2 & R2x2x_CTRL2_XSTP))) {
> > > +                             flags |= RTC_VL_DATA_INVALID;
> > > +                     }
> > > +                     if (ctrl2 & R2x2x_CTRL2_VDET)
> > > +                             flags |= RTC_VL_ACCURACY_LOW;
> >
> > Shouldn't that be RTC_VL_BACKUP_LOW?
>
> Some drivers (e.g: rv3029_ioctl and rv8803_ioctl) use RTC_VL_ACCURACY_LOW,
> but some other drivers (e.g: abx80x_ioctl, pcf2127_rtc_ioctl and
> pcf8523_rtc_ioctl) use RTC_VL_BACKUP_LOW instead. Is there any guideline or
> document telling the differences between them?
>

RTC_VL_BACKUP_LOW: The backup voltage is low
RTC_VL_ACCURACY_LOW: the primary or backup voltage is low, temperature
compensation (or similar) has stopped

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