mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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 <chiang.brian@inventec.com> Link: https://lore.kernel.org/r/20250619064223.3165523-3-chiang.brian@inventec.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
		
							parent
							
								
									a6945f39d9
								
							
						
					
					
						commit
						75ca1e5875
					
				
					 2 changed files with 39 additions and 6 deletions
				
			
		| 
						 | 
					@ -43,6 +43,14 @@ Supported chips:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Datasheet: https://www.ti.com/lit/gpn/TPS53681
 | 
					    Datasheet: https://www.ti.com/lit/gpn/TPS53681
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * Texas Instruments TPS53685
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Prefix: 'tps53685'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Addresses scanned: -
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Datasheet: https://www.ti.com/lit/gpn/TPS53685
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  * Texas Instruments TPS53688
 | 
					  * Texas Instruments TPS53688
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Prefix: 'tps53688'
 | 
					    Prefix: 'tps53688'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@
 | 
				
			||||||
#include "pmbus.h"
 | 
					#include "pmbus.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum chips {
 | 
					enum chips {
 | 
				
			||||||
	tps53647, tps53667, tps53676, tps53679, tps53681, tps53688
 | 
						tps53647, tps53667, tps53676, tps53679, tps53681, tps53685, tps53688
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TPS53647_PAGE_NUM		1
 | 
					#define TPS53647_PAGE_NUM		1
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,8 @@ enum chips {
 | 
				
			||||||
#define TPS53679_PROT_VR13_5MV		0x07 /* VR13.0 mode, 5-mV DAC */
 | 
					#define TPS53679_PROT_VR13_5MV		0x07 /* VR13.0 mode, 5-mV DAC */
 | 
				
			||||||
#define TPS53679_PAGE_NUM		2
 | 
					#define TPS53679_PAGE_NUM		2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TPS53681_DEVICE_ID		0x81
 | 
					#define TPS53681_DEVICE_ID     "\x81"
 | 
				
			||||||
 | 
					#define TPS53685_DEVICE_ID     "TIShP"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TPS53681_PMBUS_REVISION		0x33
 | 
					#define TPS53681_PMBUS_REVISION		0x33
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,10 +87,12 @@ static int tps53679_identify_phases(struct i2c_client *client,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tps53679_identify_chip(struct i2c_client *client,
 | 
					static int tps53679_identify_chip(struct i2c_client *client,
 | 
				
			||||||
				  u8 revision, u16 id)
 | 
									  u8 revision, char *id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	u8 buf[I2C_SMBUS_BLOCK_MAX];
 | 
						u8 buf[I2C_SMBUS_BLOCK_MAX];
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
						int buf_len;
 | 
				
			||||||
 | 
						int id_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = pmbus_read_byte_data(client, 0, PMBUS_REVISION);
 | 
						ret = pmbus_read_byte_data(client, 0, PMBUS_REVISION);
 | 
				
			||||||
	if (ret < 0)
 | 
						if (ret < 0)
 | 
				
			||||||
| 
						 | 
					@ -102,8 +105,14 @@ static int tps53679_identify_chip(struct i2c_client *client,
 | 
				
			||||||
	ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf);
 | 
						ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf);
 | 
				
			||||||
	if (ret < 0)
 | 
						if (ret < 0)
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
	if (ret != 1 || buf[0] != id) {
 | 
					
 | 
				
			||||||
		dev_err(&client->dev, "Unexpected device ID 0x%x\n", buf[0]);
 | 
						/* Adjust length if null terminator if present */
 | 
				
			||||||
 | 
						buf_len = (buf[ret - 1] != '\x00' ? ret : ret - 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						id_len = strlen(id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (buf_len != id_len || strncmp(id, buf, id_len)) {
 | 
				
			||||||
 | 
							dev_err(&client->dev, "Unexpected device ID: %*ph\n", ret, buf);
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -117,7 +126,7 @@ static int tps53679_identify_chip(struct i2c_client *client,
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int tps53679_identify_multiphase(struct i2c_client *client,
 | 
					static int tps53679_identify_multiphase(struct i2c_client *client,
 | 
				
			||||||
					struct pmbus_driver_info *info,
 | 
										struct pmbus_driver_info *info,
 | 
				
			||||||
					int pmbus_rev, int device_id)
 | 
										int pmbus_rev, char *device_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,6 +147,16 @@ static int tps53679_identify(struct i2c_client *client,
 | 
				
			||||||
	return tps53679_identify_mode(client, info);
 | 
						return tps53679_identify_mode(client, info);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int tps53685_identify(struct i2c_client *client,
 | 
				
			||||||
 | 
								     struct pmbus_driver_info *info)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						info->func[1] |= PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
 | 
				
			||||||
 | 
								 PMBUS_HAVE_STATUS_INPUT;
 | 
				
			||||||
 | 
						info->format[PSC_VOLTAGE_OUT] = linear;
 | 
				
			||||||
 | 
						return tps53679_identify_chip(client, TPS53681_PMBUS_REVISION,
 | 
				
			||||||
 | 
										   TPS53685_DEVICE_ID);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tps53681_identify(struct i2c_client *client,
 | 
					static int tps53681_identify(struct i2c_client *client,
 | 
				
			||||||
			     struct pmbus_driver_info *info)
 | 
								     struct pmbus_driver_info *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -263,6 +282,10 @@ static int tps53679_probe(struct i2c_client *client)
 | 
				
			||||||
		info->identify = tps53681_identify;
 | 
							info->identify = tps53681_identify;
 | 
				
			||||||
		info->read_word_data = tps53681_read_word_data;
 | 
							info->read_word_data = tps53681_read_word_data;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
						case tps53685:
 | 
				
			||||||
 | 
							info->pages = TPS53679_PAGE_NUM;
 | 
				
			||||||
 | 
							info->identify = tps53685_identify;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -277,6 +300,7 @@ static const struct i2c_device_id tps53679_id[] = {
 | 
				
			||||||
	{"tps53676", tps53676},
 | 
						{"tps53676", tps53676},
 | 
				
			||||||
	{"tps53679", tps53679},
 | 
						{"tps53679", tps53679},
 | 
				
			||||||
	{"tps53681", tps53681},
 | 
						{"tps53681", tps53681},
 | 
				
			||||||
 | 
						{"tps53685", tps53685},
 | 
				
			||||||
	{"tps53688", tps53688},
 | 
						{"tps53688", tps53688},
 | 
				
			||||||
	{}
 | 
						{}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -289,6 +313,7 @@ static const struct of_device_id __maybe_unused tps53679_of_match[] = {
 | 
				
			||||||
	{.compatible = "ti,tps53676", .data = (void *)tps53676},
 | 
						{.compatible = "ti,tps53676", .data = (void *)tps53676},
 | 
				
			||||||
	{.compatible = "ti,tps53679", .data = (void *)tps53679},
 | 
						{.compatible = "ti,tps53679", .data = (void *)tps53679},
 | 
				
			||||||
	{.compatible = "ti,tps53681", .data = (void *)tps53681},
 | 
						{.compatible = "ti,tps53681", .data = (void *)tps53681},
 | 
				
			||||||
 | 
						{.compatible = "ti,tps53685", .data = (void *)tps53685},
 | 
				
			||||||
	{.compatible = "ti,tps53688", .data = (void *)tps53688},
 | 
						{.compatible = "ti,tps53688", .data = (void *)tps53688},
 | 
				
			||||||
	{}
 | 
						{}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue