MFD: TPS65217: Add new mfd device for TPS65217
Quoted 2 lines · AnilKumar Ch
The TPS65217 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components:
I can't help but thinking that there ought to be more code sharing between the various TI PMIC drivers.
Review
Quoted 6 lines
(quoted diff) +6
-0+static int tps65217_i2c_read_device(struct tps65217_dev *tps65217, char reg, + int bytes, void *dest) +{ + struct i2c_client *i2c = tps65217->i2c_client; + struct i2c_msg xfer[2]; + int ret;
Use regmap for the register I/O, this will save a lot of code and will also give access to things like the register cache code.
Review
Quoted 3 lines
(quoted diff) +3
-0+ tps65217 = kzalloc(sizeof(struct tps65217_dev), GFP_KERNEL); + if (tps65217 == NULL) + return -ENOMEM;
Use devm_kzalloc(), it saves all the unwinding code.
Review
Quoted 2 lines
(quoted diff) +2
-0+/* All register addresses */ +#define TPS65217_REG_CHIPID 0X00
You should verify this as part of the probe() routine - read it back to make sure it's what's expected, and log the chip revision too in case it is useful for diagnostics.
Hi Mark,
Thanks for reviewing these patches.
Quoted 7 lines · Mark Brown
Quoted 2 lines · AnilKumar Ch
The TPS65217 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components:
I can't help but thinking that there ought to be more code sharing between the various TI PMIC drivers.
Quoted 10 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+static int tps65217_i2c_read_device(struct tps65217_dev *tps65217, char reg, + int bytes, void *dest) +{ + struct i2c_client *i2c = tps65217->i2c_client; + struct i2c_msg xfer[2]; + int ret;Use regmap for the register I/O, this will save a lot of code and will also give access to things like the register cache code.
All the I2C read and writes moved to regmap read and writes.
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ tps65217 = kzalloc(sizeof(struct tps65217_dev), GFP_KERNEL); + if (tps65217 == NULL) + return -ENOMEM;Use
devm_kzalloc(), it saves all the unwinding code.
Changed kzalloc to devm_kzalloc
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+/* All register addresses */ +#define TPS65217_REG_CHIPID 0X00You should verify this as part of the
probe()routine - read it back to make sure it's what's expected, and log the chip revision too in case it is useful for diagnostics.
Added chip verification code to mfd probe and printing the regulator ID & version number.
Thanks
AnilKumar
Hi Mark,
Quoted 11 lines
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+/* All register addresses */ +#define TPS65217_REG_CHIPID 0X00You should verify this as part of the
probe()routine - read it back to make sure it's what's expected, and log the chip revision too in case it is useful for diagnostics.Added chip verification code to mfd probe and printing the regulator ID & version number.
TPS65217 has two versions A and B.
i. TPS65217A - not supporting DVFS on AM335X
ii. TPS65217B - supports DVFS on AM335X
Right now I am supporting the version B but not A since I am testing DVFS on AM335X.
I have BeagleBone with me having TPS65217B, but the CHIPID reads 0x70 (corresponds to TPS65217A)!
I am discussing with hardware folks on what to do about this, but for now I will skip interpreting the CHIPID. I can print it out for reference though.
Thanks
AnilKumar
Quoted 3 lines · Chimata
I am discussing with hardware folks on what to do about this, but for now I will skip interpreting the CHIPID. I can print it out for reference though.
Logging for diagnostics is probably enough - it'll verify that register access to the device and mean that the value is available if it's useful for debugging problems.