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.

TPS65217: How to modify a register value using the Linux driver

Part Number: TPS65217

Hello Support,

Currently, we are using the PMIC TPS65217C Linux driver and we need to modify the default value of the register CHGCONFIG3 (Address = 0x06) to change the charge current from 500mA (10b) to 300mA (00b).

Question: How can we change the value of this register using the driver? So far, we have been doing it by using "i2cset" tool (i2cset -y -f 0 0x24 0x06 0x32) but we would prefer to do it with the driver. We are using kernel 5.4.20.

root@srouter:~# uname -a
Linux srouter 5.4.20-g738552d0b0 #1 PREEMPT Fri Apr 3 18:50:34 UTC 2020 armv7l GNU/Linux
root@srouter:/sys/class/i2c-adapter/i2c-0/0-0024# ls -al drwxr-xr-x 8 root root 0 Mar 31 13:50 . drwxr-xr-x 8 root root 0 Mar 31 13:50 .. lrwxrwxrwx 1 root root 0 Apr 7 12:21 driver -> ../../../../../../../../../bus/i2c/drivers/tps65217 -r--r--r-- 1 root root 4096 Apr 7 12:21 modalias -r--r--r-- 1 root root 4096 Apr 7 12:21 name lrwxrwxrwx 1 root root 0 Apr 7 12:21 of_node -> ../../../../../../../../../firmware/devicetree/base/ocp/interconnect@44c00000/segment@200000/target-module@b000/i2c@0/tps@24 drwxr-xr-x 2 root root 0 Apr 7 12:21 power drwxr-xr-x 9 root root 0 Mar 31 13:50 regulator lrwxrwxrwx 1 root root 0 Mar 31 13:50 subsystem -> ../../../../../../../../../bus/i2c drwxr-xr-x 3 root root 0 Mar 31 13:50 tps65217-bl drwxr-xr-x 3 root root 0 Mar 31 13:50 tps65217-charger drwxr-xr-x 3 root root 0 Mar 31 13:50 tps65217-pmic drwxr-xr-x 3 root root 0 Mar 31 13:50 tps65217-pwrbutton -rw-r--r-- 1 root root 4096 Mar 31 13:50 uevent root@srouter:/sys/class/i2c-adapter/i2c-0/0-0024#
root@srouter:/sys/class/i2c-adapter/i2c-0/0-0024/tps65217-charger# ls -al drwxr-xr-x 3 root root 0 Dec 31 1969 . drwxr-xr-x 8 root root 0 Dec 31 1969 .. -rw-r--r-- 1 root root 4096 Apr 7 12:13 driver_override -r--r--r-- 1 root root 4096 Apr 7 12:13 modalias lrwxrwxrwx 1 root root 0 Apr 7 12:13 of_node -> ../../../../../../../firmware/devicetree/base/ocp/i2c@44e0b000/tps@24/charger drwxr-xr-x 2 root root 0 Apr 7 12:13 power lrwxrwxrwx 1 root root 0 Dec 31 1969 subsystem -> ../../../../../../../bus/platform -rw-r--r-- 1 root root 4096 Dec 31 1969 uevent

We would appreciate any help you guys can provide us with this.

  • Juan,

    I do not know if the driver has the ability to set individual registers inside the PMIC. When I am modifying PMIC registers, I also use the Linux "i2cset" command and type everything in manually (slave address, register address, data).

    I am going to re-assign this question to the AM335x Sitara processors team to see if they have written any shorter commands using the PMIC driver.

    If I understand correctly, you only want to change the Fast-charge current limit (in CHGCONFIG3 register) from 500mA to 300mA.

  • Hello Brian,

    Yes, all we want to do is change Fast-charge current limit (in CHGCONFIG3 register) from 500mA to 300mA without using "i2cset".

    Thanks,

  • Hello Juan,

    Apologies for the delayed response. TI's Processor SDKs up through SDK 6.1 still use Linux 4.19, so I will base my answer on software from AM335x Linux Processor SDK 6.1.

    Off the top of my head, I am not aware of a way to explicitly set the CHGCONFIG3 register from Linux. One option you could try is to edit the device tree entry for the TPS65217 by setting regulator-max-microamp. (see device tree bindings documentation Documentation/devicetree/bindings/regulator/tps65217.txt and Documentation/devicetree/bindings/regulator/regulator.txt)

    Regards,

    Nick