xref: /linux/drivers/hwmon/pmbus/pmbus.h (revision 9c1ed8941d30fd6252e84a9941e6507e497d242b)
19d2ecfb7SGuenter Roeck /*
29d2ecfb7SGuenter Roeck  * pmbus.h - Common defines and structures for PMBus devices
39d2ecfb7SGuenter Roeck  *
49d2ecfb7SGuenter Roeck  * Copyright (c) 2010, 2011 Ericsson AB.
59d2ecfb7SGuenter Roeck  *
69d2ecfb7SGuenter Roeck  * This program is free software; you can redistribute it and/or modify
79d2ecfb7SGuenter Roeck  * it under the terms of the GNU General Public License as published by
89d2ecfb7SGuenter Roeck  * the Free Software Foundation; either version 2 of the License, or
99d2ecfb7SGuenter Roeck  * (at your option) any later version.
109d2ecfb7SGuenter Roeck  *
119d2ecfb7SGuenter Roeck  * This program is distributed in the hope that it will be useful,
129d2ecfb7SGuenter Roeck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
139d2ecfb7SGuenter Roeck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
149d2ecfb7SGuenter Roeck  * GNU General Public License for more details.
159d2ecfb7SGuenter Roeck  *
169d2ecfb7SGuenter Roeck  * You should have received a copy of the GNU General Public License
179d2ecfb7SGuenter Roeck  * along with this program; if not, write to the Free Software
189d2ecfb7SGuenter Roeck  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
199d2ecfb7SGuenter Roeck  */
209d2ecfb7SGuenter Roeck 
219d2ecfb7SGuenter Roeck #ifndef PMBUS_H
229d2ecfb7SGuenter Roeck #define PMBUS_H
239d2ecfb7SGuenter Roeck 
249d2ecfb7SGuenter Roeck /*
259d2ecfb7SGuenter Roeck  * Registers
269d2ecfb7SGuenter Roeck  */
279d2ecfb7SGuenter Roeck #define PMBUS_PAGE			0x00
289d2ecfb7SGuenter Roeck #define PMBUS_OPERATION			0x01
299d2ecfb7SGuenter Roeck #define PMBUS_ON_OFF_CONFIG		0x02
309d2ecfb7SGuenter Roeck #define PMBUS_CLEAR_FAULTS		0x03
319d2ecfb7SGuenter Roeck #define PMBUS_PHASE			0x04
329d2ecfb7SGuenter Roeck 
339d2ecfb7SGuenter Roeck #define PMBUS_CAPABILITY		0x19
349d2ecfb7SGuenter Roeck #define PMBUS_QUERY			0x1A
359d2ecfb7SGuenter Roeck 
369d2ecfb7SGuenter Roeck #define PMBUS_VOUT_MODE			0x20
379d2ecfb7SGuenter Roeck #define PMBUS_VOUT_COMMAND		0x21
389d2ecfb7SGuenter Roeck #define PMBUS_VOUT_TRIM			0x22
399d2ecfb7SGuenter Roeck #define PMBUS_VOUT_CAL_OFFSET		0x23
409d2ecfb7SGuenter Roeck #define PMBUS_VOUT_MAX			0x24
419d2ecfb7SGuenter Roeck #define PMBUS_VOUT_MARGIN_HIGH		0x25
429d2ecfb7SGuenter Roeck #define PMBUS_VOUT_MARGIN_LOW		0x26
439d2ecfb7SGuenter Roeck #define PMBUS_VOUT_TRANSITION_RATE	0x27
449d2ecfb7SGuenter Roeck #define PMBUS_VOUT_DROOP		0x28
459d2ecfb7SGuenter Roeck #define PMBUS_VOUT_SCALE_LOOP		0x29
469d2ecfb7SGuenter Roeck #define PMBUS_VOUT_SCALE_MONITOR	0x2A
479d2ecfb7SGuenter Roeck 
489d2ecfb7SGuenter Roeck #define PMBUS_COEFFICIENTS		0x30
499d2ecfb7SGuenter Roeck #define PMBUS_POUT_MAX			0x31
509d2ecfb7SGuenter Roeck 
519d2ecfb7SGuenter Roeck #define PMBUS_FAN_CONFIG_12		0x3A
529d2ecfb7SGuenter Roeck #define PMBUS_FAN_COMMAND_1		0x3B
539d2ecfb7SGuenter Roeck #define PMBUS_FAN_COMMAND_2		0x3C
549d2ecfb7SGuenter Roeck #define PMBUS_FAN_CONFIG_34		0x3D
559d2ecfb7SGuenter Roeck #define PMBUS_FAN_COMMAND_3		0x3E
569d2ecfb7SGuenter Roeck #define PMBUS_FAN_COMMAND_4		0x3F
579d2ecfb7SGuenter Roeck 
589d2ecfb7SGuenter Roeck #define PMBUS_VOUT_OV_FAULT_LIMIT	0x40
599d2ecfb7SGuenter Roeck #define PMBUS_VOUT_OV_FAULT_RESPONSE	0x41
609d2ecfb7SGuenter Roeck #define PMBUS_VOUT_OV_WARN_LIMIT	0x42
619d2ecfb7SGuenter Roeck #define PMBUS_VOUT_UV_WARN_LIMIT	0x43
629d2ecfb7SGuenter Roeck #define PMBUS_VOUT_UV_FAULT_LIMIT	0x44
639d2ecfb7SGuenter Roeck #define PMBUS_VOUT_UV_FAULT_RESPONSE	0x45
649d2ecfb7SGuenter Roeck #define PMBUS_IOUT_OC_FAULT_LIMIT	0x46
659d2ecfb7SGuenter Roeck #define PMBUS_IOUT_OC_FAULT_RESPONSE	0x47
669d2ecfb7SGuenter Roeck #define PMBUS_IOUT_OC_LV_FAULT_LIMIT	0x48
679d2ecfb7SGuenter Roeck #define PMBUS_IOUT_OC_LV_FAULT_RESPONSE	0x49
689d2ecfb7SGuenter Roeck #define PMBUS_IOUT_OC_WARN_LIMIT	0x4A
699d2ecfb7SGuenter Roeck #define PMBUS_IOUT_UC_FAULT_LIMIT	0x4B
709d2ecfb7SGuenter Roeck #define PMBUS_IOUT_UC_FAULT_RESPONSE	0x4C
719d2ecfb7SGuenter Roeck 
729d2ecfb7SGuenter Roeck #define PMBUS_OT_FAULT_LIMIT		0x4F
739d2ecfb7SGuenter Roeck #define PMBUS_OT_FAULT_RESPONSE		0x50
749d2ecfb7SGuenter Roeck #define PMBUS_OT_WARN_LIMIT		0x51
759d2ecfb7SGuenter Roeck #define PMBUS_UT_WARN_LIMIT		0x52
769d2ecfb7SGuenter Roeck #define PMBUS_UT_FAULT_LIMIT		0x53
779d2ecfb7SGuenter Roeck #define PMBUS_UT_FAULT_RESPONSE		0x54
789d2ecfb7SGuenter Roeck #define PMBUS_VIN_OV_FAULT_LIMIT	0x55
799d2ecfb7SGuenter Roeck #define PMBUS_VIN_OV_FAULT_RESPONSE	0x56
809d2ecfb7SGuenter Roeck #define PMBUS_VIN_OV_WARN_LIMIT		0x57
819d2ecfb7SGuenter Roeck #define PMBUS_VIN_UV_WARN_LIMIT		0x58
829d2ecfb7SGuenter Roeck #define PMBUS_VIN_UV_FAULT_LIMIT	0x59
839d2ecfb7SGuenter Roeck 
849d2ecfb7SGuenter Roeck #define PMBUS_IIN_OC_FAULT_LIMIT	0x5B
859d2ecfb7SGuenter Roeck #define PMBUS_IIN_OC_WARN_LIMIT		0x5D
869d2ecfb7SGuenter Roeck 
879d2ecfb7SGuenter Roeck #define PMBUS_POUT_OP_FAULT_LIMIT	0x68
889d2ecfb7SGuenter Roeck #define PMBUS_POUT_OP_WARN_LIMIT	0x6A
899d2ecfb7SGuenter Roeck #define PMBUS_PIN_OP_WARN_LIMIT		0x6B
909d2ecfb7SGuenter Roeck 
919d2ecfb7SGuenter Roeck #define PMBUS_STATUS_BYTE		0x78
929d2ecfb7SGuenter Roeck #define PMBUS_STATUS_WORD		0x79
939d2ecfb7SGuenter Roeck #define PMBUS_STATUS_VOUT		0x7A
949d2ecfb7SGuenter Roeck #define PMBUS_STATUS_IOUT		0x7B
959d2ecfb7SGuenter Roeck #define PMBUS_STATUS_INPUT		0x7C
969d2ecfb7SGuenter Roeck #define PMBUS_STATUS_TEMPERATURE	0x7D
979d2ecfb7SGuenter Roeck #define PMBUS_STATUS_CML		0x7E
989d2ecfb7SGuenter Roeck #define PMBUS_STATUS_OTHER		0x7F
999d2ecfb7SGuenter Roeck #define PMBUS_STATUS_MFR_SPECIFIC	0x80
1009d2ecfb7SGuenter Roeck #define PMBUS_STATUS_FAN_12		0x81
1019d2ecfb7SGuenter Roeck #define PMBUS_STATUS_FAN_34		0x82
1029d2ecfb7SGuenter Roeck 
1039d2ecfb7SGuenter Roeck #define PMBUS_READ_VIN			0x88
1049d2ecfb7SGuenter Roeck #define PMBUS_READ_IIN			0x89
1059d2ecfb7SGuenter Roeck #define PMBUS_READ_VCAP			0x8A
1069d2ecfb7SGuenter Roeck #define PMBUS_READ_VOUT			0x8B
1079d2ecfb7SGuenter Roeck #define PMBUS_READ_IOUT			0x8C
1089d2ecfb7SGuenter Roeck #define PMBUS_READ_TEMPERATURE_1	0x8D
1099d2ecfb7SGuenter Roeck #define PMBUS_READ_TEMPERATURE_2	0x8E
1109d2ecfb7SGuenter Roeck #define PMBUS_READ_TEMPERATURE_3	0x8F
1119d2ecfb7SGuenter Roeck #define PMBUS_READ_FAN_SPEED_1		0x90
1129d2ecfb7SGuenter Roeck #define PMBUS_READ_FAN_SPEED_2		0x91
1139d2ecfb7SGuenter Roeck #define PMBUS_READ_FAN_SPEED_3		0x92
1149d2ecfb7SGuenter Roeck #define PMBUS_READ_FAN_SPEED_4		0x93
1159d2ecfb7SGuenter Roeck #define PMBUS_READ_DUTY_CYCLE		0x94
1169d2ecfb7SGuenter Roeck #define PMBUS_READ_FREQUENCY		0x95
1179d2ecfb7SGuenter Roeck #define PMBUS_READ_POUT			0x96
1189d2ecfb7SGuenter Roeck #define PMBUS_READ_PIN			0x97
1199d2ecfb7SGuenter Roeck 
1209d2ecfb7SGuenter Roeck #define PMBUS_REVISION			0x98
1219d2ecfb7SGuenter Roeck #define PMBUS_MFR_ID			0x99
1229d2ecfb7SGuenter Roeck #define PMBUS_MFR_MODEL			0x9A
1239d2ecfb7SGuenter Roeck #define PMBUS_MFR_REVISION		0x9B
1249d2ecfb7SGuenter Roeck #define PMBUS_MFR_LOCATION		0x9C
1259d2ecfb7SGuenter Roeck #define PMBUS_MFR_DATE			0x9D
1269d2ecfb7SGuenter Roeck #define PMBUS_MFR_SERIAL		0x9E
1279d2ecfb7SGuenter Roeck 
1289d2ecfb7SGuenter Roeck /*
1299d2ecfb7SGuenter Roeck  * CAPABILITY
1309d2ecfb7SGuenter Roeck  */
1319d2ecfb7SGuenter Roeck #define PB_CAPABILITY_SMBALERT		(1<<4)
1329d2ecfb7SGuenter Roeck #define PB_CAPABILITY_ERROR_CHECK	(1<<7)
1339d2ecfb7SGuenter Roeck 
1349d2ecfb7SGuenter Roeck /*
1359d2ecfb7SGuenter Roeck  * VOUT_MODE
1369d2ecfb7SGuenter Roeck  */
1379d2ecfb7SGuenter Roeck #define PB_VOUT_MODE_MODE_MASK		0xe0
1389d2ecfb7SGuenter Roeck #define PB_VOUT_MODE_PARAM_MASK		0x1f
1399d2ecfb7SGuenter Roeck 
1409d2ecfb7SGuenter Roeck #define PB_VOUT_MODE_LINEAR		0x00
1419d2ecfb7SGuenter Roeck #define PB_VOUT_MODE_VID		0x20
1429d2ecfb7SGuenter Roeck #define PB_VOUT_MODE_DIRECT		0x40
1439d2ecfb7SGuenter Roeck 
1449d2ecfb7SGuenter Roeck /*
1459d2ecfb7SGuenter Roeck  * Fan configuration
1469d2ecfb7SGuenter Roeck  */
1479d2ecfb7SGuenter Roeck #define PB_FAN_2_PULSE_MASK		((1 << 0) | (1 << 1))
1489d2ecfb7SGuenter Roeck #define PB_FAN_2_RPM			(1 << 2)
1499d2ecfb7SGuenter Roeck #define PB_FAN_2_INSTALLED		(1 << 3)
1509d2ecfb7SGuenter Roeck #define PB_FAN_1_PULSE_MASK		((1 << 4) | (1 << 5))
1519d2ecfb7SGuenter Roeck #define PB_FAN_1_RPM			(1 << 6)
1529d2ecfb7SGuenter Roeck #define PB_FAN_1_INSTALLED		(1 << 7)
1539d2ecfb7SGuenter Roeck 
1549d2ecfb7SGuenter Roeck /*
1559d2ecfb7SGuenter Roeck  * STATUS_BYTE, STATUS_WORD (lower)
1569d2ecfb7SGuenter Roeck  */
1579d2ecfb7SGuenter Roeck #define PB_STATUS_NONE_ABOVE		(1<<0)
1589d2ecfb7SGuenter Roeck #define PB_STATUS_CML			(1<<1)
1599d2ecfb7SGuenter Roeck #define PB_STATUS_TEMPERATURE		(1<<2)
1609d2ecfb7SGuenter Roeck #define PB_STATUS_VIN_UV		(1<<3)
1619d2ecfb7SGuenter Roeck #define PB_STATUS_IOUT_OC		(1<<4)
1629d2ecfb7SGuenter Roeck #define PB_STATUS_VOUT_OV		(1<<5)
1639d2ecfb7SGuenter Roeck #define PB_STATUS_OFF			(1<<6)
1649d2ecfb7SGuenter Roeck #define PB_STATUS_BUSY			(1<<7)
1659d2ecfb7SGuenter Roeck 
1669d2ecfb7SGuenter Roeck /*
1679d2ecfb7SGuenter Roeck  * STATUS_WORD (upper)
1689d2ecfb7SGuenter Roeck  */
1699d2ecfb7SGuenter Roeck #define PB_STATUS_UNKNOWN		(1<<8)
1709d2ecfb7SGuenter Roeck #define PB_STATUS_OTHER			(1<<9)
1719d2ecfb7SGuenter Roeck #define PB_STATUS_FANS			(1<<10)
1729d2ecfb7SGuenter Roeck #define PB_STATUS_POWER_GOOD_N		(1<<11)
1739d2ecfb7SGuenter Roeck #define PB_STATUS_WORD_MFR		(1<<12)
1749d2ecfb7SGuenter Roeck #define PB_STATUS_INPUT			(1<<13)
1759d2ecfb7SGuenter Roeck #define PB_STATUS_IOUT_POUT		(1<<14)
1769d2ecfb7SGuenter Roeck #define PB_STATUS_VOUT			(1<<15)
1779d2ecfb7SGuenter Roeck 
1789d2ecfb7SGuenter Roeck /*
1799d2ecfb7SGuenter Roeck  * STATUS_IOUT
1809d2ecfb7SGuenter Roeck  */
1819d2ecfb7SGuenter Roeck #define PB_POUT_OP_WARNING		(1<<0)
1829d2ecfb7SGuenter Roeck #define PB_POUT_OP_FAULT		(1<<1)
1839d2ecfb7SGuenter Roeck #define PB_POWER_LIMITING		(1<<2)
1849d2ecfb7SGuenter Roeck #define PB_CURRENT_SHARE_FAULT		(1<<3)
1859d2ecfb7SGuenter Roeck #define PB_IOUT_UC_FAULT		(1<<4)
1869d2ecfb7SGuenter Roeck #define PB_IOUT_OC_WARNING		(1<<5)
1879d2ecfb7SGuenter Roeck #define PB_IOUT_OC_LV_FAULT		(1<<6)
1889d2ecfb7SGuenter Roeck #define PB_IOUT_OC_FAULT		(1<<7)
1899d2ecfb7SGuenter Roeck 
1909d2ecfb7SGuenter Roeck /*
1919d2ecfb7SGuenter Roeck  * STATUS_VOUT, STATUS_INPUT
1929d2ecfb7SGuenter Roeck  */
1939d2ecfb7SGuenter Roeck #define PB_VOLTAGE_UV_FAULT		(1<<4)
1949d2ecfb7SGuenter Roeck #define PB_VOLTAGE_UV_WARNING		(1<<5)
1959d2ecfb7SGuenter Roeck #define PB_VOLTAGE_OV_WARNING		(1<<6)
1969d2ecfb7SGuenter Roeck #define PB_VOLTAGE_OV_FAULT		(1<<7)
1979d2ecfb7SGuenter Roeck 
1989d2ecfb7SGuenter Roeck /*
1999d2ecfb7SGuenter Roeck  * STATUS_INPUT
2009d2ecfb7SGuenter Roeck  */
2019d2ecfb7SGuenter Roeck #define PB_PIN_OP_WARNING		(1<<0)
2029d2ecfb7SGuenter Roeck #define PB_IIN_OC_WARNING		(1<<1)
2039d2ecfb7SGuenter Roeck #define PB_IIN_OC_FAULT			(1<<2)
2049d2ecfb7SGuenter Roeck 
2059d2ecfb7SGuenter Roeck /*
2069d2ecfb7SGuenter Roeck  * STATUS_TEMPERATURE
2079d2ecfb7SGuenter Roeck  */
2089d2ecfb7SGuenter Roeck #define PB_TEMP_UT_FAULT		(1<<4)
2099d2ecfb7SGuenter Roeck #define PB_TEMP_UT_WARNING		(1<<5)
2109d2ecfb7SGuenter Roeck #define PB_TEMP_OT_WARNING		(1<<6)
2119d2ecfb7SGuenter Roeck #define PB_TEMP_OT_FAULT		(1<<7)
2129d2ecfb7SGuenter Roeck 
2139d2ecfb7SGuenter Roeck /*
2149d2ecfb7SGuenter Roeck  * STATUS_FAN
2159d2ecfb7SGuenter Roeck  */
2169d2ecfb7SGuenter Roeck #define PB_FAN_AIRFLOW_WARNING		(1<<0)
2179d2ecfb7SGuenter Roeck #define PB_FAN_AIRFLOW_FAULT		(1<<1)
2189d2ecfb7SGuenter Roeck #define PB_FAN_FAN2_SPEED_OVERRIDE	(1<<2)
2199d2ecfb7SGuenter Roeck #define PB_FAN_FAN1_SPEED_OVERRIDE	(1<<3)
2209d2ecfb7SGuenter Roeck #define PB_FAN_FAN2_WARNING		(1<<4)
2219d2ecfb7SGuenter Roeck #define PB_FAN_FAN1_WARNING		(1<<5)
2229d2ecfb7SGuenter Roeck #define PB_FAN_FAN2_FAULT		(1<<6)
2239d2ecfb7SGuenter Roeck #define PB_FAN_FAN1_FAULT		(1<<7)
2249d2ecfb7SGuenter Roeck 
2259d2ecfb7SGuenter Roeck /*
2269d2ecfb7SGuenter Roeck  * CML_FAULT_STATUS
2279d2ecfb7SGuenter Roeck  */
2289d2ecfb7SGuenter Roeck #define PB_CML_FAULT_OTHER_MEM_LOGIC	(1<<0)
2299d2ecfb7SGuenter Roeck #define PB_CML_FAULT_OTHER_COMM		(1<<1)
2309d2ecfb7SGuenter Roeck #define PB_CML_FAULT_PROCESSOR		(1<<3)
2319d2ecfb7SGuenter Roeck #define PB_CML_FAULT_MEMORY		(1<<4)
2329d2ecfb7SGuenter Roeck #define PB_CML_FAULT_PACKET_ERROR	(1<<5)
2339d2ecfb7SGuenter Roeck #define PB_CML_FAULT_INVALID_DATA	(1<<6)
2349d2ecfb7SGuenter Roeck #define PB_CML_FAULT_INVALID_COMMAND	(1<<7)
2359d2ecfb7SGuenter Roeck 
2369d2ecfb7SGuenter Roeck enum pmbus_sensor_classes {
2379d2ecfb7SGuenter Roeck 	PSC_VOLTAGE_IN = 0,
2389d2ecfb7SGuenter Roeck 	PSC_VOLTAGE_OUT,
2399d2ecfb7SGuenter Roeck 	PSC_CURRENT_IN,
2409d2ecfb7SGuenter Roeck 	PSC_CURRENT_OUT,
2419d2ecfb7SGuenter Roeck 	PSC_POWER,
2429d2ecfb7SGuenter Roeck 	PSC_TEMPERATURE,
2439d2ecfb7SGuenter Roeck 	PSC_FAN,
2449d2ecfb7SGuenter Roeck 	PSC_NUM_CLASSES		/* Number of power sensor classes */
2459d2ecfb7SGuenter Roeck };
2469d2ecfb7SGuenter Roeck 
2479d2ecfb7SGuenter Roeck #define PMBUS_PAGES	32	/* Per PMBus specification */
2489d2ecfb7SGuenter Roeck 
2499d2ecfb7SGuenter Roeck /* Functionality bit mask */
2509d2ecfb7SGuenter Roeck #define PMBUS_HAVE_VIN		(1 << 0)
2519d2ecfb7SGuenter Roeck #define PMBUS_HAVE_VCAP		(1 << 1)
2529d2ecfb7SGuenter Roeck #define PMBUS_HAVE_VOUT		(1 << 2)
2539d2ecfb7SGuenter Roeck #define PMBUS_HAVE_IIN		(1 << 3)
2549d2ecfb7SGuenter Roeck #define PMBUS_HAVE_IOUT		(1 << 4)
2559d2ecfb7SGuenter Roeck #define PMBUS_HAVE_PIN		(1 << 5)
2569d2ecfb7SGuenter Roeck #define PMBUS_HAVE_POUT		(1 << 6)
2579d2ecfb7SGuenter Roeck #define PMBUS_HAVE_FAN12	(1 << 7)
2589d2ecfb7SGuenter Roeck #define PMBUS_HAVE_FAN34	(1 << 8)
2599d2ecfb7SGuenter Roeck #define PMBUS_HAVE_TEMP		(1 << 9)
2609d2ecfb7SGuenter Roeck #define PMBUS_HAVE_TEMP2	(1 << 10)
2619d2ecfb7SGuenter Roeck #define PMBUS_HAVE_TEMP3	(1 << 11)
2629d2ecfb7SGuenter Roeck #define PMBUS_HAVE_STATUS_VOUT	(1 << 12)
2639d2ecfb7SGuenter Roeck #define PMBUS_HAVE_STATUS_IOUT	(1 << 13)
2649d2ecfb7SGuenter Roeck #define PMBUS_HAVE_STATUS_INPUT	(1 << 14)
2659d2ecfb7SGuenter Roeck #define PMBUS_HAVE_STATUS_TEMP	(1 << 15)
2669d2ecfb7SGuenter Roeck #define PMBUS_HAVE_STATUS_FAN12	(1 << 16)
2679d2ecfb7SGuenter Roeck #define PMBUS_HAVE_STATUS_FAN34	(1 << 17)
2689d2ecfb7SGuenter Roeck 
2691061d851SGuenter Roeck enum pmbus_data_format { linear = 0, direct, vid };
2701061d851SGuenter Roeck 
2719d2ecfb7SGuenter Roeck struct pmbus_driver_info {
2729d2ecfb7SGuenter Roeck 	int pages;		/* Total number of pages */
2731061d851SGuenter Roeck 	enum pmbus_data_format format[PSC_NUM_CLASSES];
2749d2ecfb7SGuenter Roeck 	/*
2759d2ecfb7SGuenter Roeck 	 * Support one set of coefficients for each sensor type
2769d2ecfb7SGuenter Roeck 	 * Used for chips providing data in direct mode.
2779d2ecfb7SGuenter Roeck 	 */
2789d2ecfb7SGuenter Roeck 	int m[PSC_NUM_CLASSES];	/* mantissa for direct data format */
2799d2ecfb7SGuenter Roeck 	int b[PSC_NUM_CLASSES];	/* offset */
2809d2ecfb7SGuenter Roeck 	int R[PSC_NUM_CLASSES];	/* exponent */
2819d2ecfb7SGuenter Roeck 
2829d2ecfb7SGuenter Roeck 	u32 func[PMBUS_PAGES];	/* Functionality, per page */
2839d2ecfb7SGuenter Roeck 	/*
2849d2ecfb7SGuenter Roeck 	 * The following functions map manufacturing specific register values
2859d2ecfb7SGuenter Roeck 	 * to PMBus standard register values. Specify only if mapping is
2869d2ecfb7SGuenter Roeck 	 * necessary.
2879d2ecfb7SGuenter Roeck 	 */
2889d2ecfb7SGuenter Roeck 	int (*read_byte_data)(struct i2c_client *client, int page, int reg);
28946243f3aSGuenter Roeck 	int (*read_word_data)(struct i2c_client *client, int page, int reg);
29046243f3aSGuenter Roeck 	int (*write_word_data)(struct i2c_client *client, int page, int reg,
29146243f3aSGuenter Roeck 			       u16 word);
2929d2ecfb7SGuenter Roeck 	/*
2939d2ecfb7SGuenter Roeck 	 * The identify function determines supported PMBus functionality.
2949d2ecfb7SGuenter Roeck 	 * This function is only necessary if a chip driver supports multiple
2959d2ecfb7SGuenter Roeck 	 * chips, and the chip functionality is not pre-determined.
2969d2ecfb7SGuenter Roeck 	 */
2979d2ecfb7SGuenter Roeck 	int (*identify)(struct i2c_client *client,
2989d2ecfb7SGuenter Roeck 			struct pmbus_driver_info *info);
2999d2ecfb7SGuenter Roeck };
3009d2ecfb7SGuenter Roeck 
3019d2ecfb7SGuenter Roeck /* Function declarations */
3029d2ecfb7SGuenter Roeck 
3039d2ecfb7SGuenter Roeck int pmbus_set_page(struct i2c_client *client, u8 page);
3049d2ecfb7SGuenter Roeck int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg);
30546243f3aSGuenter Roeck int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word);
306*9c1ed894SGuenter Roeck int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg);
3079d2ecfb7SGuenter Roeck void pmbus_clear_faults(struct i2c_client *client);
3089d2ecfb7SGuenter Roeck bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);
3099d2ecfb7SGuenter Roeck bool pmbus_check_word_register(struct i2c_client *client, int page, int reg);
3109d2ecfb7SGuenter Roeck int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
3119d2ecfb7SGuenter Roeck 		   struct pmbus_driver_info *info);
3129d2ecfb7SGuenter Roeck int pmbus_do_remove(struct i2c_client *client);
3139d2ecfb7SGuenter Roeck const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client
3149d2ecfb7SGuenter Roeck 						      *client);
3159d2ecfb7SGuenter Roeck 
3169d2ecfb7SGuenter Roeck #endif /* PMBUS_H */
317