Skip to content

KSTR-SAMA5D27: Support for charger control

Marcin Wcisło requested to merge kstr-charger into linux-6.5-ce

KSTR-SAMA5D27: Support for charger control

Sysfs

This device tree entry exposes some charging information in the user space at

/sys/devices/platform/ahb/ahb:apb/fc018000.flexcom/fc018600.i2c/i2c-0/0-005b/act8945a-charger/power_supply/act8945a-charger

Below is the list of all files provided, along with the API documentation quoted from Documentation/ABI/testing/sysfs-class-power and a comment about how it applies to the act8945a driver specifically.

  • type:

    Describes the main type of the supply.
    
    Access: Read
    Valid values: "Battery", "UPS", "Mains", "USB", "Wireless"

    Supported values:

    • "Battery",
    • "Mains",
    • "USB"
  • status:

    Represents the charging status of the battery. Normally this
    is read-only reporting although for some supplies this can be
    used to enable/disable charging to the battery.
    
    Access: Read, Write
    Valid values:
    	      "Unknown", "Charging", "Discharging",
    	      "Not charging", "Full"

    The file is actually read only, the driver not allowing to control the charging phase. Supported values:

    • "Charging"
    • "Full"
    • "Discharging"
    • "Not charging"
  • capacity_level:

    Coarse representation of battery capacity.
    
    Access: Read
    Valid values:
    	      "Unknown", "Critical", "Low", "Normal", "High",
    	      "Full"

    All values are supported by the driver.

  • charge_type:

    Represents the type of charging currently being applied to the
    battery. "Trickle", "Fast", and "Standard" all mean different
    charging speeds. "Adaptive" means that the charger uses some
    algorithm to adjust the charge rate dynamically, without
    any user configuration required. "Custom" means that the charger
    uses the charge_control_* properties as configuration for some
    different algorithm. "Long Life" means the charger reduces its
    charging rate in order to prolong the battery health. "Bypass"
    means the charger bypasses the charging path around the
    integrated converter allowing for a "smart" wall adaptor to
    perform the power conversion externally.
    
    Access: Read, Write
    Valid values:
    	      "Unknown", "N/A", "Trickle", "Fast", "Standard",
    	      "Adaptive", "Custom", "Long Life", "Bypass"

    The file is actually read-only, driver not allowing to change the charging type. Supported values:

    • "N/A",
    • "Fast"
    • "Trickle"
    • "Unknown"
  • health:

    Reports the health of the battery or battery side of charger
    functionality.
    
    Access: Read
    Valid values:
    	      "Unknown", "Good", "Overheat", "Dead",
    	      "Over voltage", "Unspecified failure", "Cold",
    	      "Watchdog timer expire", "Safety timer expire",
    	      "Over current", "Calibration required", "Warm",
    	      "Cool", "Hot", "No battery"

    Supported values:

    • "Good"
    • "Over voltage"
    • "Safety timer expire"
    • "Overheat"
    • "Unknown"
  • current_max:

    Battery:
      Reports the maximum IBAT current allowed into the battery.
    
    USB:
      Reports the maximum IBUS current the supply can support.
    
    Access: Read
    Valid values: Represented in microamps

    In cases of

    • unplugged USB,
    • unplugged battery,
    • both battery and USB plugged, battery fully charged,

    this value is always 0. Otherwise the charging current is given.

  • technology:

    Describes the battery technology supported by the supply.
    
    Access: Read
    Valid values:
    	      "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe",
    	      "NiCd", "LiMn"

    Always "Li-ion".

  • manufacturer:

    Reports the name of the device manufacturer.
    
    Access: Read
    Valid values: Represented as string

    Always "Active-semi".

  • model_name:

    Reports the name of the device model.
    
    Access: Read
    Valid values: Represented as string

    Always "ACT8945A"

Example

Real world values of some of the files in 3 different powering scenarios.

  Scenario 1 Scenario 2 Scenario 3
USB Plugged Plugged Unplugged
Battery Plugged Unplugged Plugged
`capacity_level` Full Normal Critical
`charge_type` N/A Unknown N/A
`health` Good Overheat Good
`status` Full Not charging Discharging
`type` Mains Mains Battery

Charging parameters

Setting of the configuration parameters

  • active-semi,input-voltage-threshold-microvolt,
  • active-semi,precondition-timeout,
  • active-semi,total-timeout,

is done at the time of driver's probe, is statically determined by the device tree, and cannot be changed using the driver. To change it use i2cset on the associated act8945a registers OVPSET, PRETIMO, TOTTIMO, respectively.

Edited by Marcin Wcisło

Merge request reports

Loading