1. 15 Aug, 2023 3 commits
    • Rasmus Villemoes's avatar
      dt-bindings: rtc: isl12022: add bindings for battery alarm trip levels · 69b569c1
      Rasmus Villemoes authored
      The isl12022 has a built-in support for monitoring the voltage of the
      backup battery, and setting bits in the status register when that
      voltage drops below two predetermined levels (usually 85% and 75% of
      the nominal voltage). However, since it can operate at wide range of
      battery voltages (2.5V - 5.5V), one must configure those trip levels
      according to which battery is used on a given board.
      
      Add bindings for defining these two trip levels. While the register
      and bit names suggest that they should correspond to 85% and 75% of
      the nominal battery voltage, the data sheet also says
      
        There are total of 7 levels that could be selected for the first
        alarm. Any of the of levels could be selected as the first alarm
        with no reference as to nominal Battery voltage level.
      
      Hence this provides the hardware designer the ability to choose values
      based on the discharge characteristics of the battery chosen for the
      given product, rather than just having one battery-microvolt property
      and having the driver choose levels close to 0.85/0.75 times that.
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/20230615105826.411953-4-linux@rasmusvillemoes.dkSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      69b569c1
    • Rasmus Villemoes's avatar
      dt-bindings: rtc: Move isil,isl12022 from trivial-rtc.yaml into own schema file · ffc00528
      Rasmus Villemoes authored
      Move the isil,isl12022 RTC bindings from trivial-rtc.yaml into its own
      intersil,isl12022.yaml file, in preparation for adding more bindings.
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
      Link: https://lore.kernel.org/r/20230615105826.411953-3-linux@rasmusvillemoes.dkSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      ffc00528
    • 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 3 commits