hwmon: (pmbus) Add regulator support
Add support for simple on/off control of each channel. To add regulator support, the pmbus part driver needs to add regulator_desc information and number of regulators to its pmbus_driver_info struct. regulator_desc can be declared using default macro for a regulator (PMBUS_REGULATOR) that is in pmbus.h The regulator_init_data can be initialized from either platform data or the device tree. Signed-off-by: Alan Tull <atull@opensource.altera.com> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/regulator/driver.h>
|
||||
|
||||
#ifndef PMBUS_H
|
||||
#define PMBUS_H
|
||||
|
||||
@@ -185,6 +187,11 @@
|
||||
#define PMBUS_VIRT_VMON_OV_FAULT_LIMIT (PMBUS_VIRT_BASE + 34)
|
||||
#define PMBUS_VIRT_STATUS_VMON (PMBUS_VIRT_BASE + 35)
|
||||
|
||||
/*
|
||||
* OPERATION
|
||||
*/
|
||||
#define PB_OPERATION_CONTROL_ON (1<<7)
|
||||
|
||||
/*
|
||||
* CAPABILITY
|
||||
*/
|
||||
@@ -365,8 +372,27 @@ struct pmbus_driver_info {
|
||||
*/
|
||||
int (*identify)(struct i2c_client *client,
|
||||
struct pmbus_driver_info *info);
|
||||
|
||||
/* Regulator functionality, if supported by this chip driver. */
|
||||
int num_regulators;
|
||||
const struct regulator_desc *reg_desc;
|
||||
};
|
||||
|
||||
/* Regulator ops */
|
||||
|
||||
extern struct regulator_ops pmbus_regulator_ops;
|
||||
|
||||
/* Macro for filling in array of struct regulator_desc */
|
||||
#define PMBUS_REGULATOR(_name, _id) \
|
||||
[_id] = { \
|
||||
.name = (_name # _id), \
|
||||
.id = (_id), \
|
||||
.of_match = of_match_ptr(_name # _id), \
|
||||
.regulators_node = of_match_ptr("regulators"), \
|
||||
.ops = &pmbus_regulator_ops, \
|
||||
.owner = THIS_MODULE, \
|
||||
}
|
||||
|
||||
/* Function declarations */
|
||||
|
||||
void pmbus_clear_cache(struct i2c_client *client);
|
||||
|
Reference in New Issue
Block a user