17ebd8b66SMauro Carvalho Chehab================================== 27ebd8b66SMauro Carvalho ChehabPMBus core driver and internal API 37ebd8b66SMauro Carvalho Chehab================================== 47ebd8b66SMauro Carvalho Chehab 57ebd8b66SMauro Carvalho ChehabIntroduction 67ebd8b66SMauro Carvalho Chehab============ 77ebd8b66SMauro Carvalho Chehab 87ebd8b66SMauro Carvalho Chehab[from pmbus.org] The Power Management Bus (PMBus) is an open standard 97ebd8b66SMauro Carvalho Chehabpower-management protocol with a fully defined command language that facilitates 107ebd8b66SMauro Carvalho Chehabcommunication with power converters and other devices in a power system. The 117ebd8b66SMauro Carvalho Chehabprotocol is implemented over the industry-standard SMBus serial interface and 127ebd8b66SMauro Carvalho Chehabenables programming, control, and real-time monitoring of compliant power 137ebd8b66SMauro Carvalho Chehabconversion products. This flexible and highly versatile standard allows for 147ebd8b66SMauro Carvalho Chehabcommunication between devices based on both analog and digital technologies, and 157ebd8b66SMauro Carvalho Chehabprovides true interoperability which will reduce design complexity and shorten 167ebd8b66SMauro Carvalho Chehabtime to market for power system designers. Pioneered by leading power supply and 177ebd8b66SMauro Carvalho Chehabsemiconductor companies, this open power system standard is maintained and 187ebd8b66SMauro Carvalho Chehabpromoted by the PMBus Implementers Forum (PMBus-IF), comprising 30+ adopters 197ebd8b66SMauro Carvalho Chehabwith the objective to provide support to, and facilitate adoption among, users. 207ebd8b66SMauro Carvalho Chehab 217ebd8b66SMauro Carvalho ChehabUnfortunately, while PMBus commands are standardized, there are no mandatory 227ebd8b66SMauro Carvalho Chehabcommands, and manufacturers can add as many non-standard commands as they like. 237ebd8b66SMauro Carvalho ChehabAlso, different PMBUs devices act differently if non-supported commands are 247ebd8b66SMauro Carvalho Chehabexecuted. Some devices return an error, some devices return 0xff or 0xffff and 257ebd8b66SMauro Carvalho Chehabset a status error flag, and some devices may simply hang up. 267ebd8b66SMauro Carvalho Chehab 277ebd8b66SMauro Carvalho ChehabDespite all those difficulties, a generic PMBus device driver is still useful 287ebd8b66SMauro Carvalho Chehaband supported since kernel version 2.6.39. However, it was necessary to support 297ebd8b66SMauro Carvalho Chehabdevice specific extensions in addition to the core PMBus driver, since it is 307ebd8b66SMauro Carvalho Chehabsimply unknown what new device specific functionality PMBus device developers 317ebd8b66SMauro Carvalho Chehabcome up with next. 327ebd8b66SMauro Carvalho Chehab 337ebd8b66SMauro Carvalho ChehabTo make device specific extensions as scalable as possible, and to avoid having 347ebd8b66SMauro Carvalho Chehabto modify the core PMBus driver repeatedly for new devices, the PMBus driver was 357ebd8b66SMauro Carvalho Chehabsplit into core, generic, and device specific code. The core code (in 367ebd8b66SMauro Carvalho Chehabpmbus_core.c) provides generic functionality. The generic code (in pmbus.c) 377ebd8b66SMauro Carvalho Chehabprovides support for generic PMBus devices. Device specific code is responsible 387ebd8b66SMauro Carvalho Chehabfor device specific initialization and, if needed, maps device specific 397ebd8b66SMauro Carvalho Chehabfunctionality into generic functionality. This is to some degree comparable 407ebd8b66SMauro Carvalho Chehabto PCI code, where generic code is augmented as needed with quirks for all kinds 417ebd8b66SMauro Carvalho Chehabof devices. 427ebd8b66SMauro Carvalho Chehab 437ebd8b66SMauro Carvalho ChehabPMBus device capabilities auto-detection 447ebd8b66SMauro Carvalho Chehab======================================== 457ebd8b66SMauro Carvalho Chehab 467ebd8b66SMauro Carvalho ChehabFor generic PMBus devices, code in pmbus.c attempts to auto-detect all supported 477ebd8b66SMauro Carvalho ChehabPMBus commands. Auto-detection is somewhat limited, since there are simply too 487ebd8b66SMauro Carvalho Chehabmany variables to consider. For example, it is almost impossible to autodetect 497ebd8b66SMauro Carvalho Chehabwhich PMBus commands are paged and which commands are replicated across all 507ebd8b66SMauro Carvalho Chehabpages (see the PMBus specification for details on multi-page PMBus devices). 517ebd8b66SMauro Carvalho Chehab 527ebd8b66SMauro Carvalho ChehabFor this reason, it often makes sense to provide a device specific driver if not 537ebd8b66SMauro Carvalho Chehaball commands can be auto-detected. The data structures in this driver can be 547ebd8b66SMauro Carvalho Chehabused to inform the core driver about functionality supported by individual 557ebd8b66SMauro Carvalho Chehabchips. 567ebd8b66SMauro Carvalho Chehab 577ebd8b66SMauro Carvalho ChehabSome commands are always auto-detected. This applies to all limit commands 587ebd8b66SMauro Carvalho Chehab(lcrit, min, max, and crit attributes) as well as associated alarm attributes. 597ebd8b66SMauro Carvalho ChehabLimits and alarm attributes are auto-detected because there are simply too many 607ebd8b66SMauro Carvalho Chehabpossible combinations to provide a manual configuration interface. 617ebd8b66SMauro Carvalho Chehab 627ebd8b66SMauro Carvalho ChehabPMBus internal API 637ebd8b66SMauro Carvalho Chehab================== 647ebd8b66SMauro Carvalho Chehab 657ebd8b66SMauro Carvalho ChehabThe API between core and device specific PMBus code is defined in 667ebd8b66SMauro Carvalho Chehabdrivers/hwmon/pmbus/pmbus.h. In addition to the internal API, pmbus.h defines 677ebd8b66SMauro Carvalho Chehabstandard PMBus commands and virtual PMBus commands. 687ebd8b66SMauro Carvalho Chehab 697ebd8b66SMauro Carvalho ChehabStandard PMBus commands 707ebd8b66SMauro Carvalho Chehab----------------------- 717ebd8b66SMauro Carvalho Chehab 727ebd8b66SMauro Carvalho ChehabStandard PMBus commands (commands values 0x00 to 0xff) are defined in the PMBUs 737ebd8b66SMauro Carvalho Chehabspecification. 747ebd8b66SMauro Carvalho Chehab 757ebd8b66SMauro Carvalho ChehabVirtual PMBus commands 767ebd8b66SMauro Carvalho Chehab---------------------- 777ebd8b66SMauro Carvalho Chehab 787ebd8b66SMauro Carvalho ChehabVirtual PMBus commands are provided to enable support for non-standard 797ebd8b66SMauro Carvalho Chehabfunctionality which has been implemented by several chip vendors and is thus 807ebd8b66SMauro Carvalho Chehabdesirable to support. 817ebd8b66SMauro Carvalho Chehab 827ebd8b66SMauro Carvalho ChehabVirtual PMBus commands start with command value 0x100 and can thus easily be 837ebd8b66SMauro Carvalho Chehabdistinguished from standard PMBus commands (which can not have values larger 847ebd8b66SMauro Carvalho Chehabthan 0xff). Support for virtual PMBus commands is device specific and thus has 857ebd8b66SMauro Carvalho Chehabto be implemented in device specific code. 867ebd8b66SMauro Carvalho Chehab 877ebd8b66SMauro Carvalho ChehabVirtual commands are named PMBUS_VIRT_xxx and start with PMBUS_VIRT_BASE. All 887ebd8b66SMauro Carvalho Chehabvirtual commands are word sized. 897ebd8b66SMauro Carvalho Chehab 907ebd8b66SMauro Carvalho ChehabThere are currently two types of virtual commands. 917ebd8b66SMauro Carvalho Chehab 927ebd8b66SMauro Carvalho Chehab- READ commands are read-only; writes are either ignored or return an error. 937ebd8b66SMauro Carvalho Chehab- RESET commands are read/write. Reading reset registers returns zero 947ebd8b66SMauro Carvalho Chehab (used for detection), writing any value causes the associated history to be 957ebd8b66SMauro Carvalho Chehab reset. 967ebd8b66SMauro Carvalho Chehab 977ebd8b66SMauro Carvalho ChehabVirtual commands have to be handled in device specific driver code. Chip driver 987ebd8b66SMauro Carvalho Chehabcode returns non-negative values if a virtual command is supported, or a 997ebd8b66SMauro Carvalho Chehabnegative error code if not. The chip driver may return -ENODATA or any other 1007ebd8b66SMauro Carvalho ChehabLinux error code in this case, though an error code other than -ENODATA is 1017ebd8b66SMauro Carvalho Chehabhandled more efficiently and thus preferred. Either case, the calling PMBus 1027ebd8b66SMauro Carvalho Chehabcore code will abort if the chip driver returns an error code when reading 1037ebd8b66SMauro Carvalho Chehabor writing virtual registers (in other words, the PMBus core code will never 1047ebd8b66SMauro Carvalho Chehabsend a virtual command to a chip). 1057ebd8b66SMauro Carvalho Chehab 1067ebd8b66SMauro Carvalho ChehabPMBus driver information 1077ebd8b66SMauro Carvalho Chehab------------------------ 1087ebd8b66SMauro Carvalho Chehab 1097ebd8b66SMauro Carvalho ChehabPMBus driver information, defined in struct pmbus_driver_info, is the main means 1107ebd8b66SMauro Carvalho Chehabfor device specific drivers to pass information to the core PMBus driver. 1117ebd8b66SMauro Carvalho ChehabSpecifically, it provides the following information. 1127ebd8b66SMauro Carvalho Chehab 1137ebd8b66SMauro Carvalho Chehab- For devices supporting its data in Direct Data Format, it provides coefficients 1147ebd8b66SMauro Carvalho Chehab for converting register values into normalized data. This data is usually 1157ebd8b66SMauro Carvalho Chehab provided by chip manufacturers in device datasheets. 1167ebd8b66SMauro Carvalho Chehab- Supported chip functionality can be provided to the core driver. This may be 1177ebd8b66SMauro Carvalho Chehab necessary for chips which react badly if non-supported commands are executed, 1187ebd8b66SMauro Carvalho Chehab and/or to speed up device detection and initialization. 1197ebd8b66SMauro Carvalho Chehab- Several function entry points are provided to support overriding and/or 1207ebd8b66SMauro Carvalho Chehab augmenting generic command execution. This functionality can be used to map 1217ebd8b66SMauro Carvalho Chehab non-standard PMBus commands to standard commands, or to augment standard 1227ebd8b66SMauro Carvalho Chehab command return values with device specific information. 1237ebd8b66SMauro Carvalho Chehab 1247ebd8b66SMauro Carvalho ChehabAPI functions 1257ebd8b66SMauro Carvalho Chehab============= 1267ebd8b66SMauro Carvalho Chehab 1277ebd8b66SMauro Carvalho ChehabFunctions provided by chip driver 1287ebd8b66SMauro Carvalho Chehab--------------------------------- 1297ebd8b66SMauro Carvalho Chehab 1307ebd8b66SMauro Carvalho ChehabAll functions return the command return value (read) or zero (write) if 1317ebd8b66SMauro Carvalho Chehabsuccessful. A return value of -ENODATA indicates that there is no manufacturer 1327ebd8b66SMauro Carvalho Chehabspecific command, but that a standard PMBus command may exist. Any other 1337ebd8b66SMauro Carvalho Chehabnegative return value indicates that the commands does not exist for this 1347ebd8b66SMauro Carvalho Chehabchip, and that no attempt should be made to read or write the standard 1357ebd8b66SMauro Carvalho Chehabcommand. 1367ebd8b66SMauro Carvalho Chehab 1377ebd8b66SMauro Carvalho ChehabAs mentioned above, an exception to this rule applies to virtual commands, 1387ebd8b66SMauro Carvalho Chehabwhich *must* be handled in driver specific code. See "Virtual PMBus Commands" 1397ebd8b66SMauro Carvalho Chehababove for more details. 1407ebd8b66SMauro Carvalho Chehab 1417ebd8b66SMauro Carvalho ChehabCommand execution in the core PMBus driver code is as follows:: 1427ebd8b66SMauro Carvalho Chehab 1437ebd8b66SMauro Carvalho Chehab if (chip_access_function) { 1447ebd8b66SMauro Carvalho Chehab status = chip_access_function(); 1457ebd8b66SMauro Carvalho Chehab if (status != -ENODATA) 1467ebd8b66SMauro Carvalho Chehab return status; 1477ebd8b66SMauro Carvalho Chehab } 1487ebd8b66SMauro Carvalho Chehab if (command >= PMBUS_VIRT_BASE) /* For word commands/registers only */ 1497ebd8b66SMauro Carvalho Chehab return -EINVAL; 1507ebd8b66SMauro Carvalho Chehab return generic_access(); 1517ebd8b66SMauro Carvalho Chehab 1527ebd8b66SMauro Carvalho ChehabChip drivers may provide pointers to the following functions in struct 1537ebd8b66SMauro Carvalho Chehabpmbus_driver_info. All functions are optional. 1547ebd8b66SMauro Carvalho Chehab 1557ebd8b66SMauro Carvalho Chehab:: 1567ebd8b66SMauro Carvalho Chehab 1577ebd8b66SMauro Carvalho Chehab int (*read_byte_data)(struct i2c_client *client, int page, int reg); 1587ebd8b66SMauro Carvalho Chehab 1597ebd8b66SMauro Carvalho ChehabRead byte from page <page>, register <reg>. 1607ebd8b66SMauro Carvalho Chehab<page> may be -1, which means "current page". 1617ebd8b66SMauro Carvalho Chehab 1627ebd8b66SMauro Carvalho Chehab 1637ebd8b66SMauro Carvalho Chehab:: 1647ebd8b66SMauro Carvalho Chehab 16543f33b6eSGuenter Roeck int (*read_word_data)(struct i2c_client *client, int page, int phase, 16643f33b6eSGuenter Roeck int reg); 1677ebd8b66SMauro Carvalho Chehab 16843f33b6eSGuenter RoeckRead word from page <page>, phase <pase>, register <reg>. If the chip does not 16943f33b6eSGuenter Roecksupport multiple phases, the phase parameter can be ignored. If the chip 17043f33b6eSGuenter Roecksupports multiple phases, a phase value of 0xff indicates all phases. 1717ebd8b66SMauro Carvalho Chehab 1727ebd8b66SMauro Carvalho Chehab:: 1737ebd8b66SMauro Carvalho Chehab 1747ebd8b66SMauro Carvalho Chehab int (*write_word_data)(struct i2c_client *client, int page, int reg, 1757ebd8b66SMauro Carvalho Chehab u16 word); 1767ebd8b66SMauro Carvalho Chehab 1777ebd8b66SMauro Carvalho ChehabWrite word to page <page>, register <reg>. 1787ebd8b66SMauro Carvalho Chehab 1797ebd8b66SMauro Carvalho Chehab:: 1807ebd8b66SMauro Carvalho Chehab 1817ebd8b66SMauro Carvalho Chehab int (*write_byte)(struct i2c_client *client, int page, u8 value); 1827ebd8b66SMauro Carvalho Chehab 1837ebd8b66SMauro Carvalho ChehabWrite byte to page <page>, register <reg>. 1847ebd8b66SMauro Carvalho Chehab<page> may be -1, which means "current page". 1857ebd8b66SMauro Carvalho Chehab 1867ebd8b66SMauro Carvalho Chehab:: 1877ebd8b66SMauro Carvalho Chehab 1887ebd8b66SMauro Carvalho Chehab int (*identify)(struct i2c_client *client, struct pmbus_driver_info *info); 1897ebd8b66SMauro Carvalho Chehab 1907ebd8b66SMauro Carvalho ChehabDetermine supported PMBus functionality. This function is only necessary 1917ebd8b66SMauro Carvalho Chehabif a chip driver supports multiple chips, and the chip functionality is not 1927ebd8b66SMauro Carvalho Chehabpre-determined. It is currently only used by the generic pmbus driver 1937ebd8b66SMauro Carvalho Chehab(pmbus.c). 1947ebd8b66SMauro Carvalho Chehab 1957ebd8b66SMauro Carvalho ChehabFunctions exported by core driver 1967ebd8b66SMauro Carvalho Chehab--------------------------------- 1977ebd8b66SMauro Carvalho Chehab 1987ebd8b66SMauro Carvalho ChehabChip drivers are expected to use the following functions to read or write 1997ebd8b66SMauro Carvalho ChehabPMBus registers. Chip drivers may also use direct I2C commands. If direct I2C 2007ebd8b66SMauro Carvalho Chehabcommands are used, the chip driver code must not directly modify the current 2017ebd8b66SMauro Carvalho Chehabpage, since the selected page is cached in the core driver and the core driver 2027ebd8b66SMauro Carvalho Chehabwill assume that it is selected. Using pmbus_set_page() to select a new page 2037ebd8b66SMauro Carvalho Chehabis mandatory. 2047ebd8b66SMauro Carvalho Chehab 2057ebd8b66SMauro Carvalho Chehab:: 2067ebd8b66SMauro Carvalho Chehab 20743f33b6eSGuenter Roeck int pmbus_set_page(struct i2c_client *client, u8 page, u8 phase); 2087ebd8b66SMauro Carvalho Chehab 20943f33b6eSGuenter RoeckSet PMBus page register to <page> and <phase> for subsequent commands. 21043f33b6eSGuenter RoeckIf the chip does not support multiple phases, the phase parameter is 21143f33b6eSGuenter Roeckignored. Otherwise, a phase value of 0xff selects all phases. 2127ebd8b66SMauro Carvalho Chehab 2137ebd8b66SMauro Carvalho Chehab:: 2147ebd8b66SMauro Carvalho Chehab 21543f33b6eSGuenter Roeck int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 phase, 21643f33b6eSGuenter Roeck u8 reg); 2177ebd8b66SMauro Carvalho Chehab 21843f33b6eSGuenter RoeckRead word data from <page>, <phase>, <reg>. Similar to 21943f33b6eSGuenter Roecki2c_smbus_read_word_data(), but selects page and phase first. If the chip does 22043f33b6eSGuenter Roecknot support multiple phases, the phase parameter is ignored. Otherwise, a phase 22143f33b6eSGuenter Roeckvalue of 0xff selects all phases. 2227ebd8b66SMauro Carvalho Chehab 2237ebd8b66SMauro Carvalho Chehab:: 2247ebd8b66SMauro Carvalho Chehab 2257ebd8b66SMauro Carvalho Chehab int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, 2267ebd8b66SMauro Carvalho Chehab u16 word); 2277ebd8b66SMauro Carvalho Chehab 2287ebd8b66SMauro Carvalho ChehabWrite word data to <page>, <reg>. Similar to i2c_smbus_write_word_data(), but 2297ebd8b66SMauro Carvalho Chehabselects page first. 2307ebd8b66SMauro Carvalho Chehab 2317ebd8b66SMauro Carvalho Chehab:: 2327ebd8b66SMauro Carvalho Chehab 2337ebd8b66SMauro Carvalho Chehab int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); 2347ebd8b66SMauro Carvalho Chehab 2357ebd8b66SMauro Carvalho ChehabRead byte data from <page>, <reg>. Similar to i2c_smbus_read_byte_data(), but 2367ebd8b66SMauro Carvalho Chehabselects page first. <page> may be -1, which means "current page". 2377ebd8b66SMauro Carvalho Chehab 2387ebd8b66SMauro Carvalho Chehab:: 2397ebd8b66SMauro Carvalho Chehab 2407ebd8b66SMauro Carvalho Chehab int pmbus_write_byte(struct i2c_client *client, int page, u8 value); 2417ebd8b66SMauro Carvalho Chehab 2427ebd8b66SMauro Carvalho ChehabWrite byte data to <page>, <reg>. Similar to i2c_smbus_write_byte(), but 2437ebd8b66SMauro Carvalho Chehabselects page first. <page> may be -1, which means "current page". 2447ebd8b66SMauro Carvalho Chehab 2457ebd8b66SMauro Carvalho Chehab:: 2467ebd8b66SMauro Carvalho Chehab 2477ebd8b66SMauro Carvalho Chehab void pmbus_clear_faults(struct i2c_client *client); 2487ebd8b66SMauro Carvalho Chehab 2497ebd8b66SMauro Carvalho ChehabExecute PMBus "Clear Fault" command on all chip pages. 2507ebd8b66SMauro Carvalho ChehabThis function calls the device specific write_byte function if defined. 2517ebd8b66SMauro Carvalho ChehabTherefore, it must _not_ be called from that function. 2527ebd8b66SMauro Carvalho Chehab 2537ebd8b66SMauro Carvalho Chehab:: 2547ebd8b66SMauro Carvalho Chehab 2557ebd8b66SMauro Carvalho Chehab bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); 2567ebd8b66SMauro Carvalho Chehab 2577ebd8b66SMauro Carvalho ChehabCheck if byte register exists. Return true if the register exists, false 2587ebd8b66SMauro Carvalho Chehabotherwise. 2597ebd8b66SMauro Carvalho ChehabThis function calls the device specific write_byte function if defined to 2607ebd8b66SMauro Carvalho Chehabobtain the chip status. Therefore, it must _not_ be called from that function. 2617ebd8b66SMauro Carvalho Chehab 2627ebd8b66SMauro Carvalho Chehab:: 2637ebd8b66SMauro Carvalho Chehab 2647ebd8b66SMauro Carvalho Chehab bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); 2657ebd8b66SMauro Carvalho Chehab 2667ebd8b66SMauro Carvalho ChehabCheck if word register exists. Return true if the register exists, false 2677ebd8b66SMauro Carvalho Chehabotherwise. 2687ebd8b66SMauro Carvalho ChehabThis function calls the device specific write_byte function if defined to 2697ebd8b66SMauro Carvalho Chehabobtain the chip status. Therefore, it must _not_ be called from that function. 2707ebd8b66SMauro Carvalho Chehab 2717ebd8b66SMauro Carvalho Chehab:: 2727ebd8b66SMauro Carvalho Chehab 2737ebd8b66SMauro Carvalho Chehab int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, 2747ebd8b66SMauro Carvalho Chehab struct pmbus_driver_info *info); 2757ebd8b66SMauro Carvalho Chehab 2767ebd8b66SMauro Carvalho ChehabExecute probe function. Similar to standard probe function for other drivers, 2777ebd8b66SMauro Carvalho Chehabwith the pointer to struct pmbus_driver_info as additional argument. Calls 2787ebd8b66SMauro Carvalho Chehabidentify function if supported. Must only be called from device probe 2797ebd8b66SMauro Carvalho Chehabfunction. 2807ebd8b66SMauro Carvalho Chehab 2817ebd8b66SMauro Carvalho Chehab:: 2827ebd8b66SMauro Carvalho Chehab 2837ebd8b66SMauro Carvalho Chehab void pmbus_do_remove(struct i2c_client *client); 2847ebd8b66SMauro Carvalho Chehab 2857ebd8b66SMauro Carvalho ChehabExecute driver remove function. Similar to standard driver remove function. 2867ebd8b66SMauro Carvalho Chehab 2877ebd8b66SMauro Carvalho Chehab:: 2887ebd8b66SMauro Carvalho Chehab 2897ebd8b66SMauro Carvalho Chehab const struct pmbus_driver_info 2907ebd8b66SMauro Carvalho Chehab *pmbus_get_driver_info(struct i2c_client *client); 2917ebd8b66SMauro Carvalho Chehab 2927ebd8b66SMauro Carvalho ChehabReturn pointer to struct pmbus_driver_info as passed to pmbus_do_probe(). 2937ebd8b66SMauro Carvalho Chehab 2947ebd8b66SMauro Carvalho Chehab 2957ebd8b66SMauro Carvalho ChehabPMBus driver platform data 2967ebd8b66SMauro Carvalho Chehab========================== 2977ebd8b66SMauro Carvalho Chehab 2987ebd8b66SMauro Carvalho ChehabPMBus platform data is defined in include/linux/pmbus.h. Platform data 2997ebd8b66SMauro Carvalho Chehabcurrently only provides a flag field with a single bit used:: 3007ebd8b66SMauro Carvalho Chehab 3017ebd8b66SMauro Carvalho Chehab #define PMBUS_SKIP_STATUS_CHECK (1 << 0) 3027ebd8b66SMauro Carvalho Chehab 3037ebd8b66SMauro Carvalho Chehab struct pmbus_platform_data { 3047ebd8b66SMauro Carvalho Chehab u32 flags; /* Device specific flags */ 3057ebd8b66SMauro Carvalho Chehab }; 3067ebd8b66SMauro Carvalho Chehab 3077ebd8b66SMauro Carvalho Chehab 3087ebd8b66SMauro Carvalho ChehabFlags 3097ebd8b66SMauro Carvalho Chehab----- 3107ebd8b66SMauro Carvalho Chehab 3117ebd8b66SMauro Carvalho ChehabPMBUS_SKIP_STATUS_CHECK 3127ebd8b66SMauro Carvalho Chehab During register detection, skip checking the status register for 3137ebd8b66SMauro Carvalho Chehab communication or command errors. 3147ebd8b66SMauro Carvalho Chehab 3157ebd8b66SMauro Carvalho ChehabSome PMBus chips respond with valid data when trying to read an unsupported 3167ebd8b66SMauro Carvalho Chehabregister. For such chips, checking the status register is mandatory when 3177ebd8b66SMauro Carvalho Chehabtrying to determine if a chip register exists or not. 3187ebd8b66SMauro Carvalho ChehabOther PMBus chips don't support the STATUS_CML register, or report 3197ebd8b66SMauro Carvalho Chehabcommunication errors for no explicable reason. For such chips, checking the 3207ebd8b66SMauro Carvalho Chehabstatus register must be disabled. 3217ebd8b66SMauro Carvalho Chehab 3227ebd8b66SMauro Carvalho ChehabSome i2c controllers do not support single-byte commands (write commands with 3237ebd8b66SMauro Carvalho Chehabno data, i2c_smbus_write_byte()). With such controllers, clearing the status 3247ebd8b66SMauro Carvalho Chehabregister is impossible, and the PMBUS_SKIP_STATUS_CHECK flag must be set. 325