Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Hardware monitoring driver for PMBus devices
0004  *
0005  * Copyright (c) 2010, 2011 Ericsson AB.
0006  */
0007 
0008 #ifndef _PMBUS_H_
0009 #define _PMBUS_H_
0010 
0011 #include <linux/bits.h>
0012 
0013 /* flags */
0014 
0015 /*
0016  * PMBUS_SKIP_STATUS_CHECK
0017  *
0018  * During register detection, skip checking the status register for
0019  * communication or command errors.
0020  *
0021  * Some PMBus chips respond with valid data when trying to read an unsupported
0022  * register. For such chips, checking the status register is mandatory when
0023  * trying to determine if a chip register exists or not.
0024  * Other PMBus chips don't support the STATUS_CML register, or report
0025  * communication errors for no explicable reason. For such chips, checking
0026  * the status register must be disabled.
0027  */
0028 #define PMBUS_SKIP_STATUS_CHECK BIT(0)
0029 
0030 /*
0031  * PMBUS_WRITE_PROTECTED
0032  * Set if the chip is write protected and write protection is not determined
0033  * by the standard WRITE_PROTECT command.
0034  */
0035 #define PMBUS_WRITE_PROTECTED   BIT(1)
0036 
0037 /*
0038  * PMBUS_NO_CAPABILITY
0039  *
0040  * Some PMBus chips don't respond with valid data when reading the CAPABILITY
0041  * register. For such chips, this flag should be set so that the PMBus core
0042  * driver doesn't use CAPABILITY to determine it's behavior.
0043  */
0044 #define PMBUS_NO_CAPABILITY         BIT(2)
0045 
0046 /*
0047  * PMBUS_READ_STATUS_AFTER_FAILED_CHECK
0048  *
0049  * Some PMBus chips end up in an undefined state when trying to read an
0050  * unsupported register. For such chips, it is necessary to reset the
0051  * chip pmbus controller to a known state after a failed register check.
0052  * This can be done by reading a known register. By setting this flag the
0053  * driver will try to read the STATUS register after each failed
0054  * register check. This read may fail, but it will put the chip in a
0055  * known state.
0056  */
0057 #define PMBUS_READ_STATUS_AFTER_FAILED_CHECK    BIT(3)
0058 
0059 /*
0060  * PMBUS_NO_WRITE_PROTECT
0061  *
0062  * Some PMBus chips respond with invalid data when reading the WRITE_PROTECT
0063  * register. For such chips, this flag should be set so that the PMBus core
0064  * driver doesn't use the WRITE_PROTECT command to determine its behavior.
0065  */
0066 #define PMBUS_NO_WRITE_PROTECT          BIT(4)
0067 
0068 /*
0069  * PMBUS_USE_COEFFICIENTS_CMD
0070  *
0071  * When this flag is set the PMBus core driver will use the COEFFICIENTS
0072  * register to initialize the coefficients for the direct mode format.
0073  */
0074 #define PMBUS_USE_COEFFICIENTS_CMD      BIT(5)
0075 
0076 struct pmbus_platform_data {
0077     u32 flags;      /* Device specific flags */
0078 
0079     /* regulator support */
0080     int num_regulators;
0081     struct regulator_init_data *reg_init_data;
0082 };
0083 
0084 #endif /* _PMBUS_H_ */