^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Hardware monitoring driver for Texas Instruments TPS53679
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2017 Vadim Pasternak <vadimp@mellanox.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/bits.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "pmbus.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum chips {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) tps53647, tps53667, tps53679, tps53681, tps53688
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define TPS53647_PAGE_NUM 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define TPS53679_PROT_VR12_5MV 0x01 /* VR12.0 mode, 5-mV DAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define TPS53679_PROT_VR12_5_10MV 0x02 /* VR12.5 mode, 10-mV DAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define TPS53679_PROT_VR13_10MV 0x04 /* VR13.0 mode, 10-mV DAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define TPS53679_PROT_IMVP8_5MV 0x05 /* IMVP8 mode, 5-mV DAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define TPS53679_PROT_VR13_5MV 0x07 /* VR13.0 mode, 5-mV DAC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define TPS53679_PAGE_NUM 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define TPS53681_DEVICE_ID 0x81
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define TPS53681_PMBUS_REVISION 0x33
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define TPS53681_MFR_SPECIFIC_20 0xe4 /* Number of phases, per page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static const struct i2c_device_id tps53679_id[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static int tps53679_identify_mode(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct pmbus_driver_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 vout_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int i, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) for (i = 0; i < info->pages; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* Read the register with VOUT scaling value.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) ret = pmbus_read_byte_data(client, i, PMBUS_VOUT_MODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) vout_params = ret & GENMASK(4, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) switch (vout_params) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) case TPS53679_PROT_VR13_10MV:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) case TPS53679_PROT_VR12_5_10MV:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) info->vrm_version[i] = vr13;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) case TPS53679_PROT_VR13_5MV:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) case TPS53679_PROT_VR12_5MV:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) case TPS53679_PROT_IMVP8_5MV:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) info->vrm_version[i] = vr12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static int tps53679_identify_phases(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct pmbus_driver_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* On TPS53681, only channel A provides per-phase output current */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) ret = pmbus_read_byte_data(client, 0, TPS53681_MFR_SPECIFIC_20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) info->phases[0] = (ret & 0x07) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) static int tps53679_identify_chip(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) u8 revision, u16 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) u8 buf[I2C_SMBUS_BLOCK_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) ret = pmbus_read_byte_data(client, 0, PMBUS_REVISION);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) if (ret != revision) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) dev_err(&client->dev, "Unexpected PMBus revision 0x%x\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) if (ret != 1 || buf[0] != id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) dev_err(&client->dev, "Unexpected device ID 0x%x\n", buf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * Common identification function for chips with multi-phase support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * Since those chips have special configuration registers, we want to have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * some level of reassurance that we are really talking with the chip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * being probed. Check PMBus revision and chip ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static int tps53679_identify_multiphase(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct pmbus_driver_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) int pmbus_rev, int device_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) ret = tps53679_identify_chip(client, pmbus_rev, device_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) ret = tps53679_identify_mode(client, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) return tps53679_identify_phases(client, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static int tps53679_identify(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) struct pmbus_driver_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) return tps53679_identify_mode(client, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static int tps53681_identify(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) struct pmbus_driver_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) return tps53679_identify_multiphase(client, info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) TPS53681_PMBUS_REVISION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) TPS53681_DEVICE_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static int tps53681_read_word_data(struct i2c_client *client, int page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int phase, int reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * For reading the total output current (READ_IOUT) for all phases,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * the chip datasheet is a bit vague. It says "PHASE must be set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * FFh to access all phases simultaneously. PHASE may also be set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * 80h readack (!) the total phase current".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * Experiments show that the command does _not_ report the total
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * current for all phases if the phase is set to 0xff. Instead, it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * appears to report the current of one of the phases. Override phase
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * parameter with 0x80 when reading the total output current on page 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) if (reg == PMBUS_READ_IOUT && page == 0 && phase == 0xff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) return pmbus_read_word_data(client, page, 0x80, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) return -ENODATA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static struct pmbus_driver_info tps53679_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .format[PSC_VOLTAGE_IN] = linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) .format[PSC_VOLTAGE_OUT] = vid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .format[PSC_TEMPERATURE] = linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) .format[PSC_CURRENT_OUT] = linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) .format[PSC_POWER] = linear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) PMBUS_HAVE_STATUS_INPUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) PMBUS_HAVE_POUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) PMBUS_HAVE_POUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) .pfunc[0] = PMBUS_HAVE_IOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) .pfunc[1] = PMBUS_HAVE_IOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) .pfunc[2] = PMBUS_HAVE_IOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) .pfunc[3] = PMBUS_HAVE_IOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) .pfunc[4] = PMBUS_HAVE_IOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) .pfunc[5] = PMBUS_HAVE_IOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static int tps53679_probe(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) struct device *dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct pmbus_driver_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) enum chips chip_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if (dev->of_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) chip_id = (enum chips)of_device_get_match_data(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) chip_id = i2c_match_id(tps53679_id, client)->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) info = devm_kmemdup(dev, &tps53679_info, sizeof(*info), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (!info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) switch (chip_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) case tps53647:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) case tps53667:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) info->pages = TPS53647_PAGE_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) info->identify = tps53679_identify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) case tps53679:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) case tps53688:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) info->pages = TPS53679_PAGE_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) info->identify = tps53679_identify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) case tps53681:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) info->pages = TPS53679_PAGE_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) info->phases[0] = 6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) info->identify = tps53681_identify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) info->read_word_data = tps53681_read_word_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) return pmbus_do_probe(client, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static const struct i2c_device_id tps53679_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {"tps53647", tps53647},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) {"tps53667", tps53667},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) {"tps53679", tps53679},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) {"tps53681", tps53681},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {"tps53688", tps53688},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) MODULE_DEVICE_TABLE(i2c, tps53679_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static const struct of_device_id __maybe_unused tps53679_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) {.compatible = "ti,tps53647", .data = (void *)tps53647},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {.compatible = "ti,tps53667", .data = (void *)tps53667},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) {.compatible = "ti,tps53679", .data = (void *)tps53679},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {.compatible = "ti,tps53681", .data = (void *)tps53681},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {.compatible = "ti,tps53688", .data = (void *)tps53688},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) MODULE_DEVICE_TABLE(of, tps53679_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static struct i2c_driver tps53679_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .name = "tps53679",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .of_match_table = of_match_ptr(tps53679_of_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .probe_new = tps53679_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .remove = pmbus_do_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) .id_table = tps53679_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) module_i2c_driver(tps53679_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) MODULE_AUTHOR("Vadim Pasternak <vadimp@mellanox.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) MODULE_DESCRIPTION("PMBus driver for Texas Instruments TPS53679");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) MODULE_LICENSE("GPL");