Skip to content

Commit 75ca1e5

Browse files
BrianChiang0425groeck
authored andcommitted
hwmon: (pmbus/tps53679) Add support for TPS53685
The TPS53685 is a fully AMD SVI3 compliant step down controller with trans-inductor voltage regulator(TLVR) topology support, dual channels, built-in non-volatile memory (NVM), PMBus interface, and full compatible with TI NexFET smart power stages. Add support for it to the tps53679 driver. Signed-off-by: Chiang Brian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent a6945f3 commit 75ca1e5

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

Documentation/hwmon/tps53679.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ Supported chips:
4343

4444
Datasheet: https://www.ti.com/lit/gpn/TPS53681
4545

46+
* Texas Instruments TPS53685
47+
48+
Prefix: 'tps53685'
49+
50+
Addresses scanned: -
51+
52+
Datasheet: https://www.ti.com/lit/gpn/TPS53685
53+
4654
* Texas Instruments TPS53688
4755

4856
Prefix: 'tps53688'

drivers/hwmon/pmbus/tps53679.c

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "pmbus.h"
1717

1818
enum chips {
19-
tps53647, tps53667, tps53676, tps53679, tps53681, tps53688
19+
tps53647, tps53667, tps53676, tps53679, tps53681, tps53685, tps53688
2020
};
2121

2222
#define TPS53647_PAGE_NUM 1
@@ -31,7 +31,8 @@ enum chips {
3131
#define TPS53679_PROT_VR13_5MV 0x07 /* VR13.0 mode, 5-mV DAC */
3232
#define TPS53679_PAGE_NUM 2
3333

34-
#define TPS53681_DEVICE_ID 0x81
34+
#define TPS53681_DEVICE_ID "\x81"
35+
#define TPS53685_DEVICE_ID "TIShP"
3536

3637
#define TPS53681_PMBUS_REVISION 0x33
3738

@@ -86,10 +87,12 @@ static int tps53679_identify_phases(struct i2c_client *client,
8687
}
8788

8889
static int tps53679_identify_chip(struct i2c_client *client,
89-
u8 revision, u16 id)
90+
u8 revision, char *id)
9091
{
9192
u8 buf[I2C_SMBUS_BLOCK_MAX];
9293
int ret;
94+
int buf_len;
95+
int id_len;
9396

9497
ret = pmbus_read_byte_data(client, 0, PMBUS_REVISION);
9598
if (ret < 0)
@@ -102,8 +105,14 @@ static int tps53679_identify_chip(struct i2c_client *client,
102105
ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf);
103106
if (ret < 0)
104107
return ret;
105-
if (ret != 1 || buf[0] != id) {
106-
dev_err(&client->dev, "Unexpected device ID 0x%x\n", buf[0]);
108+
109+
/* Adjust length if null terminator if present */
110+
buf_len = (buf[ret - 1] != '\x00' ? ret : ret - 1);
111+
112+
id_len = strlen(id);
113+
114+
if (buf_len != id_len || strncmp(id, buf, id_len)) {
115+
dev_err(&client->dev, "Unexpected device ID: %*ph\n", ret, buf);
107116
return -ENODEV;
108117
}
109118
return 0;
@@ -117,7 +126,7 @@ static int tps53679_identify_chip(struct i2c_client *client,
117126
*/
118127
static int tps53679_identify_multiphase(struct i2c_client *client,
119128
struct pmbus_driver_info *info,
120-
int pmbus_rev, int device_id)
129+
int pmbus_rev, char *device_id)
121130
{
122131
int ret;
123132

@@ -138,6 +147,16 @@ static int tps53679_identify(struct i2c_client *client,
138147
return tps53679_identify_mode(client, info);
139148
}
140149

150+
static int tps53685_identify(struct i2c_client *client,
151+
struct pmbus_driver_info *info)
152+
{
153+
info->func[1] |= PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
154+
PMBUS_HAVE_STATUS_INPUT;
155+
info->format[PSC_VOLTAGE_OUT] = linear;
156+
return tps53679_identify_chip(client, TPS53681_PMBUS_REVISION,
157+
TPS53685_DEVICE_ID);
158+
}
159+
141160
static int tps53681_identify(struct i2c_client *client,
142161
struct pmbus_driver_info *info)
143162
{
@@ -263,6 +282,10 @@ static int tps53679_probe(struct i2c_client *client)
263282
info->identify = tps53681_identify;
264283
info->read_word_data = tps53681_read_word_data;
265284
break;
285+
case tps53685:
286+
info->pages = TPS53679_PAGE_NUM;
287+
info->identify = tps53685_identify;
288+
break;
266289
default:
267290
return -ENODEV;
268291
}
@@ -277,6 +300,7 @@ static const struct i2c_device_id tps53679_id[] = {
277300
{"tps53676", tps53676},
278301
{"tps53679", tps53679},
279302
{"tps53681", tps53681},
303+
{"tps53685", tps53685},
280304
{"tps53688", tps53688},
281305
{}
282306
};
@@ -289,6 +313,7 @@ static const struct of_device_id __maybe_unused tps53679_of_match[] = {
289313
{.compatible = "ti,tps53676", .data = (void *)tps53676},
290314
{.compatible = "ti,tps53679", .data = (void *)tps53679},
291315
{.compatible = "ti,tps53681", .data = (void *)tps53681},
316+
{.compatible = "ti,tps53685", .data = (void *)tps53685},
292317
{.compatible = "ti,tps53688", .data = (void *)tps53688},
293318
{}
294319
};

0 commit comments

Comments
 (0)