This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TPS65217: Signaling loss of AC or On Battery to am335x / Linux

Part Number: TPS65217

Tool/software: Linux

We are planning to use a supercap as our battery power to handle a 1-2 second power loss.  The supercap won't be large enough to power the entire system, so when AC is lost, we need to signal the Linux software on the am335x to enter Standby (i.e.  echo standby > /sys/power/state).

Is there an interrupt or some mechanism to get this signal in software?  Or do we need to bring an interrupt line to a GPIO to signal the loss of AC?

Is there a better way to implement this?  I know the tps65217 device tree has ti,pmic-shutdown-controller, but we want to go to a low power state and try to survive the 1-2 second power loss.

Thanks,
Matt

  • Hi Matt,

    Yes there is an interrupt mechanism available. There is a status register,0x0A, that monitors the state of the input supplies, but it has to be actively read by the system. This can be triggered by an interrupt from the PMIC as you mentioned, as the INT register, 0x02, shows the ACM bit is unmasked by default.

    Please also refer to this document for handling power-loss conditions: http://www.ti.com/lit/an/slva901/slva901.pdf

    Best Regards,

    Rick S.

  • Thanks, Rick!

    I did some digging into the datasheet and the tps65217.c kernel driver. I see the code support for the AC and USB interrupts, but not sure how to access them from userspace. I'm on the Beaglebone Black, kernel 4.6.69 from the processor-SDK built with Arago.

    In sysfs, I see:

    /sys/devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-bl
    /sys/devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-pmic
    /sys/devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-pwrbutton
    /sys/devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-charger


    # cat /sys/devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-charger/power/runtime_status
    unsupported


    I see that there's a powerbutton driver for:

    e2e.ti.com/.../641645

    And a charger driver that monitors the AC and USB interrupts:

    patchwork.ozlabs.org/.../

    But I don't think it exports anything to user space, like the powerbutton driver does.

    Is it possible to access the AC and USB interrupts from userspace currently?

    Thanks,
    Matt
  • Hi Matt,

    Unfortunately for Linux inquiries I'd recommend re-posting in the Sitara forum, as they are much more familiar with driver support.

    Best Regards,

    Rick S.