• Marek Vasut's avatar
    power: supply: bq25890: Add HiZ mode support · c688e0c4
    Marek Vasut authored
    The bq25890 is capable of disconnecting itself from the external supply,
    in which case the system is supplied only from the battery. This can be
    useful e.g. to test the pure battery operation, or draw no power from
    USB port.
    
    Implement support for this mode, which can be toggled by writing 0 or
    non-zero to sysfs 'online' attribute, to select either offline or online
    mode.
    
    The IRQ handler has to be triggered to update chip state, as switching
    to and from HiZ mode does not generate an interrupt automatically.
    
    The IRQ handler reinstates the HiZ mode in case a cable is replugged by
    the user, the chip itself clears the HiZ mode bit when cable is plugged
    in by the user and the chip detects PG bad-to-good transition.
    Signed-off-by: default avatarMarek Vasut <marex@denx.de>
    [hdegoede@redhat.com: Replace "&" with "&&" in a boolean check]
    Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
    c688e0c4
bq25890_charger.c 40.9 KB