Wiki

This version (03 Apr 2018 10:16) was approved by spopa.

ADP5061 I2C Linear Battery Charger Linux Driver

Supported Devices

Evaluation Boards

Source Code

Status

Source Mainlined?
git [No]

Files

Devicetree

Required devicetree properties:

  • compatible: should be “adi,adp5061”
  • reg: i2c address of the device
	adp5061@14 {
		    compatible = "adi,adp5061";
		    reg = <0x14>;
	};

Driver testing

This specifies any shell prompt running on the target

root:/> cd /sys/class/power_supply
root:/sys/class/power_supply> ls
adp5061

root:/sys/class/power_supply>cd adp5061
root:/sys/class/power_supply/adp5061> ls -l
-r--r--r-- 1 root root 4096 Apr  2 14:25 capacity_level
-rw-r--r-- 1 root root 4096 Apr  2 14:25 charge_term_current
-r--r--r-- 1 root root 4096 Apr  2 14:25 charge_type
-rw-r--r-- 1 root root 4096 Apr  2 14:25 charging_enabled
-rw-r--r-- 1 root root 4096 Apr  2 14:25 charging_vlim_enabled
-rw-r--r-- 1 root root 4096 Apr  2 14:25 constant_charge_current
-rw-r--r-- 1 root root 4096 Apr  2 14:25 constant_charge_voltage_max
lrwxrwxrwx 1 root root    0 Apr  2 14:25 device -> ../../../0-0014
-rw-r--r-- 1 root root 4096 Apr  2 14:25 input_current_limit
drwxr-xr-x 2 root root    0 Apr  2 14:25 power
-rw-r--r-- 1 root root 4096 Apr  2 14:25 precharge_current
-r--r--r-- 1 root root 4096 Apr  2 14:25 present
-r--r--r-- 1 root root 4096 Apr  2 14:25 status
lrwxrwxrwx 1 root root    0 Apr  2 14:25 subsystem -> ../../../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Apr  2 14:25 type
-rw-r--r-- 1 root root 4096 Apr  2 14:25 uevent
-rw-r--r-- 1 root root 4096 Apr  2 14:25 voltage_avg
-rw-r--r-- 1 root root 4096 Apr  2 14:25 voltage_max
-rw-r--r-- 1 root root 4096 Apr  2 14:25 voltage_min

Show Charger status

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat status
Charging

Show charge type

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat charge_type
Fast

Show the battery status

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat capacity_level
Normal

Enable Charging

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat charging_enabled
0
root:/sys/class/power_supply/adp5061> echo 1 > charging_enabled
root:/sys/class/power_supply/adp5061> cat charging_enabled
1

Enable Charging Voltage Limit

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat charging_vlim_enabled
0
root:/sys/class/power_supply/adp5061> echo 1 > charging_vlim_enabled
root:/sys/class/power_supply/adp5061> cat charging_vlim_enabled
1

Show Termination Voltage (VTRM)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat voltage_max
4200000

Set Termination Voltage (VTRM)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> echo 3800000 > voltage_max 
root:/sys/class/power_supply/adp5061> cat voltage_max
3800000

Set the Input Current Limit into VINx (ILIM)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat input_current_limit
100000
root:/sys/class/power_supply/adp5061> echo 200000 > input_current_limit
root:/sys/class/power_supply/adp5061> cat input_current_limit
200000

Set the Trickle to Fast Charge Threshold (VTRK_DEAD)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat voltage_min
2500000
root:/sys/class/power_supply/adp5061> echo 200000 > voltage_min
root:/sys/class/power_supply/adp5061> cat voltage_min
200000

Set the Charging Voltage Limit (CHG_VLIM)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat constant_charge_voltage_max
3200000
root:/sys/class/power_supply/adp5061> echo 3800000 > constant_charge_voltage_max
root:/sys/class/power_supply/adp5061> cat constant_charge_voltage_max
3800000

Set the Constant Charge Current (ICHG)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat constant_charge_current
750000
root:/sys/class/power_supply/adp5061> echo 500000 > constant_charge_current
root:/sys/class/power_supply/adp5061> cat constant_charge_current
500000

Set the Trickle and Weak Charge Currents (ITRK_DEAD)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat precharge_current
20000
root:/sys/class/power_supply/adp5061> echo 10000 > precharge_current
root:/sys/class/power_supply/adp5061> cat precharge_current
10000

Set the VWEAK Threshold

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat voltage_avg
3000000
root:/sys/class/power_supply/adp5061> echo 3400000 > voltage_avg
root:/sys/class/power_supply/adp5061> cat voltage_avg
3400000

Set Termination Current (IEND)

This specifies any shell prompt running on the target

root:/sys/class/power_supply/adp5061> cat charge_term_current
52500
root:/sys/class/power_supply/adp5061> echo 72500 > charge_term_current
root:/sys/class/power_supply/adp5061> cat charge_term_current
72500 

More Information

Need help?

resources/tools-software/linux-drivers-all/battery-charger/adp5061.txt · Last modified: 03 Apr 2018 10:15 by spopa