{sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget$/translations/zh_CN/hwmon/pmbus-coremodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/zh_TW/hwmon/pmbus-coremodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/it_IT/hwmon/pmbus-coremodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/ja_JP/hwmon/pmbus-coremodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/ko_KR/hwmon/pmbus-coremodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget$/translations/sp_SP/hwmon/pmbus-coremodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(h"PMBus core driver and internal APIh]h"PMBus core driver and internal API}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh>/var/lib/git/docbuild/linux/Documentation/hwmon/pmbus-core.rsthKubh)}(hhh](h)}(h Introductionh]h Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hX[from pmbus.org] The Power Management Bus (PMBus) is an open standard power-management protocol with a fully defined command language that facilitates communication with power converters and other devices in a power system. The protocol is implemented over the industry-standard SMBus serial interface and enables programming, control, and real-time monitoring of compliant power conversion products. This flexible and highly versatile standard allows for communication between devices based on both analog and digital technologies, and provides true interoperability which will reduce design complexity and shorten time to market for power system designers. Pioneered by leading power supply and semiconductor companies, this open power system standard is maintained and promoted by the PMBus Implementers Forum (PMBus-IF), comprising 30+ adopters with the objective to provide support to, and facilitate adoption among, users.h]hX[from pmbus.org] The Power Management Bus (PMBus) is an open standard power-management protocol with a fully defined command language that facilitates communication with power converters and other devices in a power system. The protocol is implemented over the industry-standard SMBus serial interface and enables programming, control, and real-time monitoring of compliant power conversion products. This flexible and highly versatile standard allows for communication between devices based on both analog and digital technologies, and provides true interoperability which will reduce design complexity and shorten time to market for power system designers. Pioneered by leading power supply and semiconductor companies, this open power system standard is maintained and promoted by the PMBus Implementers Forum (PMBus-IF), comprising 30+ adopters with the objective to provide support to, and facilitate adoption among, users.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXuUnfortunately, while PMBus commands are standardized, there are no mandatory commands, and manufacturers can add as many non-standard commands as they like. Also, different PMBUs devices act differently if non-supported commands are executed. Some devices return an error, some devices return 0xff or 0xffff and set a status error flag, and some devices may simply hang up.h]hXuUnfortunately, while PMBus commands are standardized, there are no mandatory commands, and manufacturers can add as many non-standard commands as they like. Also, different PMBUs devices act differently if non-supported commands are executed. Some devices return an error, some devices return 0xff or 0xffff and set a status error flag, and some devices may simply hang up.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXKDespite all those difficulties, a generic PMBus device driver is still useful and supported since kernel version 2.6.39. However, it was necessary to support device specific extensions in addition to the core PMBus driver, since it is simply unknown what new device specific functionality PMBus device developers come up with next.h]hXKDespite all those difficulties, a generic PMBus device driver is still useful and supported since kernel version 2.6.39. However, it was necessary to support device specific extensions in addition to the core PMBus driver, since it is simply unknown what new device specific functionality PMBus device developers come up with next.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXsTo make device specific extensions as scalable as possible, and to avoid having to modify the core PMBus driver repeatedly for new devices, the PMBus driver was split into core, generic, and device specific code. The core code (in pmbus_core.c) provides generic functionality. The generic code (in pmbus.c) provides support for generic PMBus devices. Device specific code is responsible for device specific initialization and, if needed, maps device specific functionality into generic functionality. This is to some degree comparable to PCI code, where generic code is augmented as needed with quirks for all kinds of devices.h]hXsTo make device specific extensions as scalable as possible, and to avoid having to modify the core PMBus driver repeatedly for new devices, the PMBus driver was split into core, generic, and device specific code. The core code (in pmbus_core.c) provides generic functionality. The generic code (in pmbus.c) provides support for generic PMBus devices. Device specific code is responsible for device specific initialization and, if needed, maps device specific functionality into generic functionality. This is to some degree comparable to PCI code, where generic code is augmented as needed with quirks for all kinds of devices.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hhhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h(PMBus device capabilities auto-detectionh]h(PMBus device capabilities auto-detection}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhK,ubh)}(hXFor generic PMBus devices, code in pmbus.c attempts to auto-detect all supported PMBus commands. Auto-detection is somewhat limited, since there are simply too many variables to consider. For example, it is almost impossible to autodetect which PMBus commands are paged and which commands are replicated across all pages (see the PMBus specification for details on multi-page PMBus devices).h]hXFor generic PMBus devices, code in pmbus.c attempts to auto-detect all supported PMBus commands. Auto-detection is somewhat limited, since there are simply too many variables to consider. For example, it is almost impossible to autodetect which PMBus commands are paged and which commands are replicated across all pages (see the PMBus specification for details on multi-page PMBus devices).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hj hhubh)}(hFor this reason, it often makes sense to provide a device specific driver if not all commands can be auto-detected. The data structures in this driver can be used to inform the core driver about functionality supported by individual chips.h]hFor this reason, it often makes sense to provide a device specific driver if not all commands can be auto-detected. The data structures in this driver can be used to inform the core driver about functionality supported by individual chips.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hj hhubh)}(hX,Some commands are always auto-detected. This applies to all limit commands (lcrit, min, max, and crit attributes) as well as associated alarm attributes. Limits and alarm attributes are auto-detected because there are simply too many possible combinations to provide a manual configuration interface.h]hX,Some commands are always auto-detected. This applies to all limit commands (lcrit, min, max, and crit attributes) as well as associated alarm attributes. Limits and alarm attributes are auto-detected because there are simply too many possible combinations to provide a manual configuration interface.}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK9hj hhubeh}(h](pmbus-device-capabilities-auto-detectionah ]h"](pmbus device capabilities auto-detectionah$]h&]uh1hhhhhhhhK,ubh)}(hhh](h)}(hPMBus internal APIh]hPMBus internal API}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjMhhhhhK?ubh)}(hThe API between core and device specific PMBus code is defined in drivers/hwmon/pmbus/pmbus.h. In addition to the internal API, pmbus.h defines standard PMBus commands and virtual PMBus commands.h]hThe API between core and device specific PMBus code is defined in drivers/hwmon/pmbus/pmbus.h. In addition to the internal API, pmbus.h defines standard PMBus commands and virtual PMBus commands.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjMhhubh)}(hhh](h)}(hStandard PMBus commandsh]hStandard PMBus commands}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhjlhhhhhKFubh)}(h^Standard PMBus commands (commands values 0x00 to 0xff) are defined in the PMBUs specification.h]h^Standard PMBus commands (commands values 0x00 to 0xff) are defined in the PMBUs specification.}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKHhjlhhubeh}(h]standard-pmbus-commandsah ]h"]standard pmbus commandsah$]h&]uh1hhjMhhhhhKFubh)}(hhh](h)}(hVirtual PMBus commandsh]hVirtual PMBus commands}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKLubh)}(hVirtual PMBus commands are provided to enable support for non-standard functionality which has been implemented by several chip vendors and is thus desirable to support.h]hVirtual PMBus commands are provided to enable support for non-standard functionality which has been implemented by several chip vendors and is thus desirable to support.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjhhubh)}(hXVirtual PMBus commands start with command value 0x100 and can thus easily be distinguished from standard PMBus commands (which can not have values larger than 0xff). Support for virtual PMBus commands is device specific and thus has to be implemented in device specific code.h]hXVirtual PMBus commands start with command value 0x100 and can thus easily be distinguished from standard PMBus commands (which can not have values larger than 0xff). Support for virtual PMBus commands is device specific and thus has to be implemented in device specific code.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjhhubh)}(hnVirtual commands are named PMBUS_VIRT_xxx and start with PMBUS_VIRT_BASE. All virtual commands are word sized.h]hnVirtual commands are named PMBUS_VIRT_xxx and start with PMBUS_VIRT_BASE. All virtual commands are word sized.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjhhubh)}(h2There are currently two types of virtual commands.h]h2There are currently two types of virtual commands.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhjhhubh bullet_list)}(hhh](h list_item)}(hJREAD commands are read-only; writes are either ignored or return an error.h]h)}(hjh]hJREAD commands are read-only; writes are either ignored or return an error.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hRESET commands are read/write. Reading reset registers returns zero (used for detection), writing any value causes the associated history to be reset. h]h)}(hRESET commands are read/write. Reading reset registers returns zero (used for detection), writing any value causes the associated history to be reset.h]hRESET commands are read/write. Reading reset registers returns zero (used for detection), writing any value causes the associated history to be reset.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhK\hjhhubh)}(hX7Virtual commands have to be handled in device specific driver code. Chip driver code returns non-negative values if a virtual command is supported, or a negative error code if not. The chip driver may return -ENODATA or any other Linux error code in this case, though an error code other than -ENODATA is handled more efficiently and thus preferred. Either case, the calling PMBus core code will abort if the chip driver returns an error code when reading or writing virtual registers (in other words, the PMBus core code will never send a virtual command to a chip).h]hX7Virtual commands have to be handled in device specific driver code. Chip driver code returns non-negative values if a virtual command is supported, or a negative error code if not. The chip driver may return -ENODATA or any other Linux error code in this case, though an error code other than -ENODATA is handled more efficiently and thus preferred. Either case, the calling PMBus core code will abort if the chip driver returns an error code when reading or writing virtual registers (in other words, the PMBus core code will never send a virtual command to a chip).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjhhubeh}(h]virtual-pmbus-commandsah ]h"]virtual pmbus commandsah$]h&]uh1hhjMhhhhhKLubh)}(hhh](h)}(hPMBus driver informationh]hPMBus driver information}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj0hhhhhKkubh)}(hPMBus driver information, defined in struct pmbus_driver_info, is the main means for device specific drivers to pass information to the core PMBus driver. Specifically, it provides the following information.h]hPMBus driver information, defined in struct pmbus_driver_info, is the main means for device specific drivers to pass information to the core PMBus driver. Specifically, it provides the following information.}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKmhj0hhubj)}(hhh](j)}(hFor devices supporting its data in Direct Data Format, it provides coefficients for converting register values into normalized data. This data is usually provided by chip manufacturers in device datasheets.h]h)}(hFor devices supporting its data in Direct Data Format, it provides coefficients for converting register values into normalized data. This data is usually provided by chip manufacturers in device datasheets.h]hFor devices supporting its data in Direct Data Format, it provides coefficients for converting register values into normalized data. This data is usually provided by chip manufacturers in device datasheets.}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhjRubah}(h]h ]h"]h$]h&]uh1jhjOhhhhhNubj)}(hSupported chip functionality can be provided to the core driver. This may be necessary for chips which react badly if non-supported commands are executed, and/or to speed up device detection and initialization.h]h)}(hSupported chip functionality can be provided to the core driver. This may be necessary for chips which react badly if non-supported commands are executed, and/or to speed up device detection and initialization.h]hSupported chip functionality can be provided to the core driver. This may be necessary for chips which react badly if non-supported commands are executed, and/or to speed up device detection and initialization.}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjjubah}(h]h ]h"]h$]h&]uh1jhjOhhhhhNubj)}(hXSeveral function entry points are provided to support overriding and/or augmenting generic command execution. This functionality can be used to map non-standard PMBus commands to standard commands, or to augment standard command return values with device specific information. h]h)}(hXSeveral function entry points are provided to support overriding and/or augmenting generic command execution. This functionality can be used to map non-standard PMBus commands to standard commands, or to augment standard command return values with device specific information.h]hXSeveral function entry points are provided to support overriding and/or augmenting generic command execution. This functionality can be used to map non-standard PMBus commands to standard commands, or to augment standard command return values with device specific information.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhjubah}(h]h ]h"]h$]h&]uh1jhjOhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhKqhj0hhubeh}(h]pmbus-driver-informationah ]h"]pmbus driver informationah$]h&]uh1hhjMhhhhhKkubeh}(h]pmbus-internal-apiah ]h"]pmbus internal apiah$]h&]uh1hhhhhhhhK?ubh)}(hhh](h)}(h PEC Supporth]h PEC Support}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK}ubh)}(hXKMany PMBus devices support SMBus PEC (Packet Error Checking). If supported by both the I2C adapter and by the PMBus chip, it is by default enabled. If PEC is supported, the PMBus core driver adds an attribute named 'pec' to the I2C device. This attribute can be used to control PEC support in the communication with the PMBus chip.h]hXOMany PMBus devices support SMBus PEC (Packet Error Checking). If supported by both the I2C adapter and by the PMBus chip, it is by default enabled. If PEC is supported, the PMBus core driver adds an attribute named ‘pec’ to the I2C device. This attribute can be used to control PEC support in the communication with the PMBus chip.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h] pec-supportah ]h"] pec supportah$]h&]uh1hhhhhhhhK}ubh)}(hhh](h)}(h API functionsh]h API functions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h!Functions provided by chip driverh]h!Functions provided by chip driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXyAll functions return the command return value (read) or zero (write) if successful. A return value of -ENODATA indicates that there is no manufacturer specific command, but that a standard PMBus command may exist. Any other negative return value indicates that the commands does not exist for this chip, and that no attempt should be made to read or write the standard command.h]hXyAll functions return the command return value (read) or zero (write) if successful. A return value of -ENODATA indicates that there is no manufacturer specific command, but that a standard PMBus command may exist. Any other negative return value indicates that the commands does not exist for this chip, and that no attempt should be made to read or write the standard command.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hAs mentioned above, an exception to this rule applies to virtual commands, which *must* be handled in driver specific code. See "Virtual PMBus Commands" above for more details.h](hQAs mentioned above, an exception to this rule applies to virtual commands, which }(hjhhhNhNubhemphasis)}(h*must*h]hmust}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh] be handled in driver specific code. See “Virtual PMBus Commands” above for more details.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h?Command execution in the core PMBus driver code is as follows::h]h>Command execution in the core PMBus driver code is as follows:}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh literal_block)}(hif (chip_access_function) { status = chip_access_function(); if (status != -ENODATA) return status; } if (command >= PMBUS_VIRT_BASE) /* For word commands/registers only */ return -EINVAL; return generic_access();h]hif (chip_access_function) { status = chip_access_function(); if (status != -ENODATA) return status; } if (command >= PMBUS_VIRT_BASE) /* For word commands/registers only */ return -EINVAL; return generic_access();}hj9sbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1j7hhhKhjhhubh)}(huChip drivers may provide pointers to the following functions in struct pmbus_driver_info. All functions are optional.h]huChip drivers may provide pointers to the following functions in struct pmbus_driver_info. All functions are optional.}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hDint (*read_byte_data)(struct i2c_client *client, int page, int reg);h]hDint (*read_byte_data)(struct i2c_client *client, int page, int reg);}hjWsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hYRead byte from page , register . may be -1, which means "current page".h]h]Read byte from page , register . may be -1, which means “current page”.}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(heint (*read_word_data)(struct i2c_client *client, int page, int phase, int reg);h]heint (*read_word_data)(struct i2c_client *client, int page, int phase, int reg);}hjssbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hRead word from page , phase , register . If the chip does not support multiple phases, the phase parameter can be ignored. If the chip supports multiple phases, a phase value of 0xff indicates all phases.h]hRead word from page , phase , register . If the chip does not support multiple phases, the phase parameter can be ignored. If the chip supports multiple phases, a phase value of 0xff indicates all phases.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hfint (*write_word_data)(struct i2c_client *client, int page, int reg, u16 word);h]hfint (*write_word_data)(struct i2c_client *client, int page, int reg, u16 word);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(h*Write word to page , register .h]h*Write word to page , register .}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hAint (*write_byte)(struct i2c_client *client, int page, u8 value);h]hAint (*write_byte)(struct i2c_client *client, int page, u8 value);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hXWrite byte to page , register . may be -1, which means "current page".h]h\Write byte to page , register . may be -1, which means “current page”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hKint (*identify)(struct i2c_client *client, struct pmbus_driver_info *info);h]hKint (*identify)(struct i2c_client *client, struct pmbus_driver_info *info);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hDetermine supported PMBus functionality. This function is only necessary if a chip driver supports multiple chips, and the chip functionality is not pre-determined. It is currently only used by the generic pmbus driver (pmbus.c).h]hDetermine supported PMBus functionality. This function is only necessary if a chip driver supports multiple chips, and the chip functionality is not pre-determined. It is currently only used by the generic pmbus driver (pmbus.c).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]!functions-provided-by-chip-driverah ]h"]!functions provided by chip driverah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h!Functions exported by core driverh]h!Functions exported by core driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXChip drivers are expected to use the following functions to read or write PMBus registers. Chip drivers may also use direct I2C commands. If direct I2C commands are used, the chip driver code must not directly modify the current page, since the selected page is cached in the core driver and the core driver will assume that it is selected. Using pmbus_set_page() to select a new page is mandatory.h]hXChip drivers are expected to use the following functions to read or write PMBus registers. Chip drivers may also use direct I2C commands. If direct I2C commands are used, the chip driver code must not directly modify the current page, since the selected page is cached in the core driver and the core driver will assume that it is selected. Using pmbus_set_page() to select a new page is mandatory.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hAint pmbus_set_page(struct i2c_client *client, u8 page, u8 phase);h]hAint pmbus_set_page(struct i2c_client *client, u8 page, u8 phase);}hj sbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hSet PMBus page register to and for subsequent commands. If the chip does not support multiple phases, the phase parameter is ignored. Otherwise, a phase value of 0xff selects all phases.h]hSet PMBus page register to and for subsequent commands. If the chip does not support multiple phases, the phase parameter is ignored. Otherwise, a phase value of 0xff selects all phases.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hhint pmbus_read_word_data(struct i2c_client *client, u8 page, u8 phase, u8 reg);h]hhint pmbus_read_word_data(struct i2c_client *client, u8 page, u8 phase, u8 reg);}hj&sbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hRead word data from , , . Similar to i2c_smbus_read_word_data(), but selects page and phase first. If the chip does not support multiple phases, the phase parameter is ignored. Otherwise, a phase value of 0xff selects all phases.h]hRead word data from , , . Similar to i2c_smbus_read_word_data(), but selects page and phase first. If the chip does not support multiple phases, the phase parameter is ignored. Otherwise, a phase value of 0xff selects all phases.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hjint pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word);h]hjint pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word);}hjBsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(haWrite word data to , . Similar to i2c_smbus_write_word_data(), but selects page first.h]haWrite word data to , . Similar to i2c_smbus_write_word_data(), but selects page first.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hFint pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg);h]hFint pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg);}hj^sbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hRead byte data from , . Similar to i2c_smbus_read_byte_data(), but selects page first. may be -1, which means "current page".h]hRead byte data from , . Similar to i2c_smbus_read_byte_data(), but selects page first. may be -1, which means “current page”.}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(hDint pmbus_write_byte(struct i2c_client *client, int page, u8 value);h]hDint pmbus_write_byte(struct i2c_client *client, int page, u8 value);}hjzsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhKhjhhubh)}(hWrite byte data to , . Similar to i2c_smbus_write_byte(), but selects page first. may be -1, which means "current page".h]hWrite byte data to , . Similar to i2c_smbus_write_byte(), but selects page first. may be -1, which means “current page”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj8)}(h3void pmbus_clear_faults(struct i2c_client *client);h]h3void pmbus_clear_faults(struct i2c_client *client);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhMhjhhubh)}(hExecute PMBus "Clear Fault" command on all chip pages. This function calls the device specific write_byte function if defined. Therefore, it must _not_ be called from that function.h]hExecute PMBus “Clear Fault” command on all chip pages. This function calls the device specific write_byte function if defined. Therefore, it must _not_ be called from that function.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj8)}(hMbool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);h]hMbool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhMhjhhubh)}(hCheck if byte register exists. Return true if the register exists, false otherwise. This function calls the device specific write_byte function if defined to obtain the chip status. Therefore, it must _not_ be called from that function.h]hCheck if byte register exists. Return true if the register exists, false otherwise. This function calls the device specific write_byte function if defined to obtain the chip status. Therefore, it must _not_ be called from that function.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjhhubj8)}(hMbool pmbus_check_word_register(struct i2c_client *client, int page, int reg);h]hMbool pmbus_check_word_register(struct i2c_client *client, int page, int reg);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhMhjhhubh)}(hCheck if word register exists. Return true if the register exists, false otherwise. This function calls the device specific write_byte function if defined to obtain the chip status. Therefore, it must _not_ be called from that function.h]hCheck if word register exists. Return true if the register exists, false otherwise. This function calls the device specific write_byte function if defined to obtain the chip status. Therefore, it must _not_ be called from that function.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj8)}(hNint pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);h]hNint pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhMhjhhubh)}(hExecute probe function. Similar to standard probe function for other drivers, with the pointer to struct pmbus_driver_info as additional argument. Calls identify function if supported. Must only be called from device probe function.h]hExecute probe function. Similar to standard probe function for other drivers, with the pointer to struct pmbus_driver_info as additional argument. Calls identify function if supported. Must only be called from device probe function.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj8)}(hWconst struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client *client);h]hWconst struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client *client);}hjsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhM#hjhhubh)}(hIReturn pointer to struct pmbus_driver_info as passed to pmbus_do_probe().h]hIReturn pointer to struct pmbus_driver_info as passed to pmbus_do_probe().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hjhhubeh}(h]!functions-exported-by-core-driverah ]h"]!functions exported by core driverah$]h&]uh1hhjhhhhhKubeh}(h] api-functionsah ]h"] api functionsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hPMBus driver platform datah]hPMBus driver platform data}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2hhhhhM*ubh)}(h}PMBus platform data is defined in include/linux/pmbus.h. Platform data currently provides a flags field with four bits used::h]h|PMBus platform data is defined in include/linux/pmbus.h. Platform data currently provides a flags field with four bits used:}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hj2hhubj8)}(hX#define PMBUS_SKIP_STATUS_CHECK BIT(0) #define PMBUS_WRITE_PROTECTED BIT(1) #define PMBUS_NO_CAPABILITY BIT(2) #define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3) #define PMBUS_NO_WRITE_PROTECT BIT(4) #define PMBUS_USE_COEFFICIENTS_CMD BIT(5) #define PMBUS_OP_PROTECTED BIT(6) #define PMBUS_VOUT_PROTECTED BIT(7) struct pmbus_platform_data { u32 flags; /* Device specific flags */ /* regulator support */ int num_regulators; struct regulator_init_data *reg_init_data; };h]hX#define PMBUS_SKIP_STATUS_CHECK BIT(0) #define PMBUS_WRITE_PROTECTED BIT(1) #define PMBUS_NO_CAPABILITY BIT(2) #define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3) #define PMBUS_NO_WRITE_PROTECT BIT(4) #define PMBUS_USE_COEFFICIENTS_CMD BIT(5) #define PMBUS_OP_PROTECTED BIT(6) #define PMBUS_VOUT_PROTECTED BIT(7) struct pmbus_platform_data { u32 flags; /* Device specific flags */ /* regulator support */ int num_regulators; struct regulator_init_data *reg_init_data; };}hjQsbah}(h]h ]h"]h$]h&]jGjHuh1j7hhhM/hj2hhubh)}(hhh](h)}(hFlagsh]hFlags}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj_hhhhhMIubh)}(hPMBUS_SKIP_STATUS_CHECKh]hPMBUS_SKIP_STATUS_CHECK}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMKhj_hhubh)}(haDuring register detection, skip checking the status register for communication or command errors.h]haDuring register detection, skip checking the status register for communication or command errors.}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMMhj_hhubh)}(hX{Some PMBus chips respond with valid data when trying to read an unsupported register. For such chips, checking the status register is mandatory when trying to determine if a chip register exists or not. Other PMBus chips don't support the STATUS_CML register, or report communication errors for no explicable reason. For such chips, checking the status register must be disabled.h]hX}Some PMBus chips respond with valid data when trying to read an unsupported register. For such chips, checking the status register is mandatory when trying to determine if a chip register exists or not. Other PMBus chips don’t support the STATUS_CML register, or report communication errors for no explicable reason. For such chips, checking the status register must be disabled.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhj_hhubh)}(hSome i2c controllers do not support single-byte commands (write commands with no data, i2c_smbus_write_byte()). With such controllers, clearing the status register is impossible, and the PMBUS_SKIP_STATUS_CHECK flag must be set.h]hSome i2c controllers do not support single-byte commands (write commands with no data, i2c_smbus_write_byte()). With such controllers, clearing the status register is impossible, and the PMBUS_SKIP_STATUS_CHECK flag must be set.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMWhj_hhubh)}(hPMBUS_WRITE_PROTECTEDh]hPMBUS_WRITE_PROTECTED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM[hj_hhubh)}(hpSet if the chip is write protected and write protection is not determined by the standard WRITE_PROTECT command.h]hpSet if the chip is write protected and write protection is not determined by the standard WRITE_PROTECT command.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM]hj_hhubh)}(hPMBUS_NO_CAPABILITYh]hPMBUS_NO_CAPABILITY}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM`hj_hhubh)}(hSome PMBus chips don't respond with valid data when reading the CAPABILITY register. For such chips, this flag should be set so that the PMBus core driver doesn't use CAPABILITY to determine its behavior.h]hSome PMBus chips don’t respond with valid data when reading the CAPABILITY register. For such chips, this flag should be set so that the PMBus core driver doesn’t use CAPABILITY to determine its behavior.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMbhj_hhubh)}(h$PMBUS_READ_STATUS_AFTER_FAILED_CHECKh]h$PMBUS_READ_STATUS_AFTER_FAILED_CHECK}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMfhj_hhubh)}(h:Read the STATUS register after each failed register check.h]h:Read the STATUS register after each failed register check.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhhj_hhubh)}(hXSome PMBus chips end up in an undefined state when trying to read an unsupported register. For such chips, it is necessary to reset the chip pmbus controller to a known state after a failed register check. This can be done by reading a known register. By setting this flag the driver will try to read the STATUS register after each failed register check. This read may fail, but it will put the chip into a known state.h]hXSome PMBus chips end up in an undefined state when trying to read an unsupported register. For such chips, it is necessary to reset the chip pmbus controller to a known state after a failed register check. This can be done by reading a known register. By setting this flag the driver will try to read the STATUS register after each failed register check. This read may fail, but it will put the chip into a known state.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMjhj_hhubh)}(hPMBUS_NO_WRITE_PROTECTh]hPMBUS_NO_WRITE_PROTECT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMrhj_hhubh)}(hSome PMBus chips respond with invalid data when reading the WRITE_PROTECT register. For such chips, this flag should be set so that the PMBus core driver doesn't use the WRITE_PROTECT command to determine its behavior.h]hSome PMBus chips respond with invalid data when reading the WRITE_PROTECT register. For such chips, this flag should be set so that the PMBus core driver doesn’t use the WRITE_PROTECT command to determine its behavior.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMthj_hhubh)}(hPMBUS_USE_COEFFICIENTS_CMDh]hPMBUS_USE_COEFFICIENTS_CMD}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMxhj_hhubh)}(hWhen this flag is set the PMBus core driver will use the COEFFICIENTS register to initialize the coefficients for the direct mode format.h]hWhen this flag is set the PMBus core driver will use the COEFFICIENTS register to initialize the coefficients for the direct mode format.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMzhj_hhubh)}(hPMBUS_OP_PROTECTEDh]hPMBUS_OP_PROTECTED}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM}hj_hhubh)}(hvSet if the chip OPERATION command is protected and protection is not determined by the standard WRITE_PROTECT command.h]hvSet if the chip OPERATION command is protected and protection is not determined by the standard WRITE_PROTECT command.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj_hhubh)}(hPMBUS_VOUT_PROTECTEDh]hPMBUS_VOUT_PROTECTED}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj_hhubh)}(hySet if the chip VOUT_COMMAND command is protected and protection is not determined by the standard WRITE_PROTECT command.h]hySet if the chip VOUT_COMMAND command is protected and protection is not determined by the standard WRITE_PROTECT command.}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj_hhubeh}(h]flagsah ]h"]flagsah$]h&]uh1hhj2hhhhhMIubh)}(hhh](h)}(hModule parameterh]hModule parameter}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(h.pmbus_core.wp: PMBus write protect forced modeh]h.pmbus_core.wp: PMBus write protect forced mode}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXaPMBus may come up with a variety of write protection configuration. 'pmbus_core.wp' may be used if a particular write protection is necessary. The ability to actually alter the protection may also depend on the chip so the actual runtime write protection configuration may differ from the requested one. pmbus_core currently support the following value:h]hXePMBus may come up with a variety of write protection configuration. ‘pmbus_core.wp’ may be used if a particular write protection is necessary. The ability to actually alter the protection may also depend on the chip so the actual runtime write protection configuration may differ from the requested one. pmbus_core currently support the following value:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hhh](j)}(h0: write protection removed.h]h)}(hjh]h0: write protection removed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hl1: Disable all writes except to the WRITE_PROTECT, OPERATION, PAGE, ON_OFF_CONFIG and VOUT_COMMAND commands.h]h)}(hl1: Disable all writes except to the WRITE_PROTECT, OPERATION, PAGE, ON_OFF_CONFIG and VOUT_COMMAND commands.h]hl1: Disable all writes except to the WRITE_PROTECT, OPERATION, PAGE, ON_OFF_CONFIG and VOUT_COMMAND commands.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hO2: Disable all writes except to the WRITE_PROTECT, OPERATION and PAGE commands.h]h)}(hO2: Disable all writes except to the WRITE_PROTECT, OPERATION and PAGE commands.h]hO2: Disable all writes except to the WRITE_PROTECT, OPERATION and PAGE commands.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hX 3: Disable all writes except to the WRITE_PROTECT command. Note that protection should include the PAGE register. This may be problematic for multi-page chips, if the chips strictly follows the PMBus specification, preventing the chip from changing the active page.h]h)}(hX 3: Disable all writes except to the WRITE_PROTECT command. Note that protection should include the PAGE register. This may be problematic for multi-page chips, if the chips strictly follows the PMBus specification, preventing the chip from changing the active page.h]hX 3: Disable all writes except to the WRITE_PROTECT command. Note that protection should include the PAGE register. This may be problematic for multi-page chips, if the chips strictly follows the PMBus specification, preventing the chip from changing the active page.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]j*uh1jhhhMhjhhubeh}(h]module-parameterah ]h"]module parameterah$]h&]uh1hhj2hhhhhMubeh}(h]pmbus-driver-platform-dataah ]h"]pmbus driver platform dataah$]h&]uh1hhhhhhhhM*ubeh}(h]"pmbus-core-driver-and-internal-apiah ]h"]"pmbus core driver and internal apiah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjSerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j-j*jjjJjGjjjjj-j*jjjjj/j,jjj'j$j%j"jj|jju nametypes}(j-jjJjjj-jjj/jj'j%jjuh}(j*hjhjGj jjMjjlj*jjj0jjj,jjjj$jj"j2j|j_jju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.