power: smb135x-charger: runtime detect charger type and revision
The current driver expects the version be passed via device tree node.
Maintaining accurate device tree info could get cumbersome as more
hardware variants are added.
Instead detect the type of the charger (version) and its hardware
revision at runtime as follows.
Reg4F bits 0 through 3 determine the hardware revision as follows
bitvalue hw revision
1 rev1
2 rev1.1
3 rev2
5 rev2.1
If reg34 bit 7 is set then it is a smb1356.
If not then detecting smb1357/smb1358/smb1359 is based on hw revision.
If hw revision is older than rev2, then read reg2A bits 7 and 6 for
version. If hw revision is equal or newer than rev2 then read reg32
bit 1 and 0 for version.
The type (version) is as shown
bit_value version
0 smb1359
1 smb1357
2 smb1358
Also updated the workaround flags as per the hw revision and
usb current values and dc current values as per the version.
CRs-Fixed: 614447
Change-Id: Ib71b8bc0adb22f295375433a2971e5ec12bdbcb1
Signed-off-by:
Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Loading
Please register or sign in to comment