Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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 PMBus devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2010, 2011 Ericsson AB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/pmbus.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) struct pmbus_device_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	int pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) static const struct i2c_device_id pmbus_id[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * Find sensor groups and status registers on each page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static void pmbus_find_sensor_groups(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 				     struct pmbus_driver_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	int page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	/* Sensors detected on page 0 only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_VIN))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		info->func[0] |= PMBUS_HAVE_VIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_VCAP))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		info->func[0] |= PMBUS_HAVE_VCAP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_IIN))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		info->func[0] |= PMBUS_HAVE_IIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_PIN))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		info->func[0] |= PMBUS_HAVE_PIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	if (info->func[0]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	    && pmbus_check_byte_register(client, 0, PMBUS_STATUS_INPUT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		info->func[0] |= PMBUS_HAVE_STATUS_INPUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_12) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	    pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		info->func[0] |= PMBUS_HAVE_FAN12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_12))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 			info->func[0] |= PMBUS_HAVE_STATUS_FAN12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	if (pmbus_check_byte_register(client, 0, PMBUS_FAN_CONFIG_34) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	    pmbus_check_word_register(client, 0, PMBUS_READ_FAN_SPEED_3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		info->func[0] |= PMBUS_HAVE_FAN34;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 			info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		info->func[0] |= PMBUS_HAVE_TEMP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		info->func[0] |= PMBUS_HAVE_TEMP2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		info->func[0] |= PMBUS_HAVE_TEMP3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			     | PMBUS_HAVE_TEMP3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	    && pmbus_check_byte_register(client, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 					 PMBUS_STATUS_TEMPERATURE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	/* Sensors detected on all pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	for (page = 0; page < info->pages; page++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			info->func[page] |= PMBUS_HAVE_VOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			if (pmbus_check_byte_register(client, page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 						      PMBUS_STATUS_VOUT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 				info->func[page] |= PMBUS_HAVE_STATUS_VOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		if (pmbus_check_word_register(client, page, PMBUS_READ_IOUT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			info->func[page] |= PMBUS_HAVE_IOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 			if (pmbus_check_byte_register(client, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 						      PMBUS_STATUS_IOUT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 				info->func[page] |= PMBUS_HAVE_STATUS_IOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		if (pmbus_check_word_register(client, page, PMBUS_READ_POUT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			info->func[page] |= PMBUS_HAVE_POUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * Identify chip parameters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static int pmbus_identify(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 			  struct pmbus_driver_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	if (!info->pages) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		 * Check if the PAGE command is supported. If it is,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		 * keep setting the page number until it fails or until the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		 * maximum number of pages has been reached. Assume that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		 * this is the number of pages supported by the chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			int page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			for (page = 1; page < PMBUS_PAGES; page++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 				if (pmbus_set_page(client, page, 0xff) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 					break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			pmbus_set_page(client, 0, 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			info->pages = page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			info->pages = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		pmbus_clear_faults(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		int vout_mode, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		if (vout_mode >= 0 && vout_mode != 0xff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 			switch (vout_mode >> 5) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 			case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 				info->format[PSC_VOLTAGE_OUT] = vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 				for (i = 0; i < info->pages; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 					info->vrm_version[i] = vr11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 				info->format[PSC_VOLTAGE_OUT] = direct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 				ret = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 				goto abort;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	 * We should check if the COEFFICIENTS register is supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	 * If it is, and the chip is configured for direct mode, we can read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 * the coefficients from the chip, one set per group of sensor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 * registers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 * To do this, we will need access to a chip which actually supports the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	 * COEFFICIENTS command, since the command is too complex to implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	 * without testing it. Until then, abort if a chip configured for direct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	 * mode was detected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	if (info->format[PSC_VOLTAGE_OUT] == direct) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		ret = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		goto abort;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	/* Try to find sensor groups  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	pmbus_find_sensor_groups(client, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) abort:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return ret;
^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 int pmbus_probe(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct pmbus_driver_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct pmbus_platform_data *pdata = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	struct device *dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	struct pmbus_device_info *device_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	if (!info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	device_info = (struct pmbus_device_info *)i2c_match_id(pmbus_id, client)->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 				     GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		if (!pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 			return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		pdata->flags = PMBUS_SKIP_STATUS_CHECK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	info->pages = device_info->pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	info->identify = pmbus_identify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	dev->platform_data = pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	return pmbus_do_probe(client, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static const struct pmbus_device_info pmbus_info_one = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	.pages = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	.flags = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static const struct pmbus_device_info pmbus_info_zero = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	.pages = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	.flags = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) static const struct pmbus_device_info pmbus_info_one_skip = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	.pages = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	.flags = PMBUS_SKIP_STATUS_CHECK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  * Use driver_data to set the number of pages supported by the chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static const struct i2c_device_id pmbus_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	{"adp4000", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	{"bmr453", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	{"bmr454", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	{"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	{"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	{"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	{"max20796", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	{"mdt040", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	{"ncp4200", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	{"ncp4208", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	{"pdt003", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	{"pdt006", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	{"pdt012", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	{"pmbus", (kernel_ulong_t)&pmbus_info_zero},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	{"sgd009", (kernel_ulong_t)&pmbus_info_one_skip},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	{"tps40400", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	{"tps544b20", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	{"tps544b25", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	{"tps544c20", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	{"tps544c25", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	{"udt020", (kernel_ulong_t)&pmbus_info_one},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) MODULE_DEVICE_TABLE(i2c, pmbus_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* This is the driver that will be inserted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static struct i2c_driver pmbus_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		   .name = "pmbus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		   },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	.probe_new = pmbus_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	.remove = pmbus_do_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	.id_table = pmbus_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) module_i2c_driver(pmbus_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) MODULE_AUTHOR("Guenter Roeck");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) MODULE_DESCRIPTION("Generic PMBus driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_LICENSE("GPL");