1. 15 Aug, 2023 1 commit
    • Rasmus Villemoes's avatar
      rtc: isl12022: remove wrong warning for low battery level · 4d6af37c
      Rasmus Villemoes authored
      There are multiple problems with this warning.
      
      First of all, it triggers way too often, in fact nearly on every boot,
      because the SR_LBAT85/SR_LBAT75 bits have another meaning when in
      battery backup mode. Quoting from the data sheet:
      
        LOW BATTERY INDICATOR 85% BIT (LBAT85)
      
        In Normal Mode (VDD), this bit indicates when the battery level has
        dropped below the pre-selected trip levels. [...] The LBAT85
        detection happens automatically once every minute when seconds
        register reaches 59.
      
        In Battery Mode (VBAT), this bit indicates the device has entered
        into battery mode by polling once every 10 minutes. The LBAT85
        detection happens automatically once when the minute register
        reaches x9h or x0h minutes.
      
      Similar wording applies to the LBAT75 bit.
      
      This means that if the device is powered off for more than 10 minutes,
      the LBAT85 bit is guaranteed to be set. Upon power-on, unless we're
      close enough to the end of a minute and/or the boot is slow enough
      that the second register passes 59, the LBAT85 bit is still set when
      the kernel (or early userspace) reads the RTC to set the system's
      wallclock time.
      
      Another minor problem is with the bit logic. If the 75% level is
      reached, logically we're also below 85%, so both bits would most
      likely be set. So even if the battery is below 75%, the warning would
      still say "voltage dropped below 85%".
      
      A third problem is that the driver and current DT binding offer no way
      to indicate the nominal battery level and/or settings of the Battery
      Level Monitor Trip Bits. Since the default value of the VB85TP[2:0] and
      VB75TP[2:0] bits are 000, this means the actual setting of the
      LBAT85/LBAT75 bits in VDD mode doesn't happen until the battery is below
      2.125V/1.875V, which for a standard 3V battery is way too late.
      
      A fourth problem is emitting this warning from ->read_time:
      util-linux' hwclock will, in the absence of support for getting an
      interrupt when the seconds counter is updated, issue
      ioctl(RTC_RD_TIME) in a busy-loop until it sees a change in the
      seconds field. In that case, if the battery low bits are set (either
      genuinely, more than a minute after boot, due to the battery actually
      being low, or as above, bogusly shortly after boot), the kernel log is
      swamped with hundreds of identical warnings.
      
      Subsequent patches will add such bindings and driver support, and also
      proper support for RTC_VL_READ. For now, remove the broken warning.
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Link: https://lore.kernel.org/r/20230615105826.411953-2-linux@rasmusvillemoes.dkSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      4d6af37c
  2. 10 Aug, 2023 3 commits
  3. 27 Jul, 2023 31 commits
  4. 09 Jul, 2023 5 commits