Merge tag 'regulator-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
"Lots and lots of fixes from Axel and some others here, plus some
framework enhancements which continue the theme of factoring code out
of the drivers and into the core.
- Initial framework support for GPIO controlled enable signals,
saving a bunch of code in drivers.
- Move fixed regulator enable time and voltage mapping table
specifications to data.
- Used some of the recent framework enhancements to make voltage
change notifications more useful, passing the voltage in as an
argument to the notification.
- Fixed the pattern used for finding individual regulators on a
device to not rely on the node name, supporting the use of multiple
PMICs of the same type in the system.
- New drivers for Maxim MAX77686, TI LP872x and LP8788, Samsung
S2MPS11, and Wolfson Arizona microphone supplies and LDOs."
* tag 'regulator-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (176 commits)
regulator: add new lp8788 regulator driver
regulator: mc13xxx: Remove extern function declaration for mc13xxx_sw_regulator
regulator: tps65910: set input_supply on desc unconditionally
regulator: palmas: Fix calcuating selector in palmas_map_voltage_smps
regulator: lp872x: Simplify implementation of lp872x_find_regulator_init_data()
regulator: twl: Fix list_voltate for twl6030ldo_ops
regulator: twl: Convert twl6030ldo_ops to [get|set]_voltage_sel
regulator: twl: Fix the formula to calculate vsel and voltage for twl6030ldo
regulator: s5m8767: Properly handle gpio_request failure
regulator: max8997: Properly handle gpio_request failure
regulator: tps62360: use devm_* for gpio request
regulator: tps6586x: add support for input supply
regulator: tps65217: Add device tree support
regulator: aat2870: Remove unused min_uV and max_uV from struct aat2870_regulator
regulator: aat2870: Convert to regulator_list_voltage_table
regulator: da9052: initialize of_node param for regulator register
regulator: Add REGULATOR_STATUS_UNDEFINED.
regulator: Fix a typo in regulator_mode_to_status() core function.
regulator: s2mps11: Use sec_reg_write rather than sec_reg_update when mask is 0xff
regulator: s2mps11: Fix wrong setting for config.dev
...
This commit is contained in:
@@ -347,6 +347,7 @@ struct s5m_platform_data {
|
||||
bool buck_voltage_lock;
|
||||
|
||||
int buck_gpios[3];
|
||||
int buck_ds[3];
|
||||
int buck2_voltage[8];
|
||||
bool buck2_gpiodvs;
|
||||
int buck3_voltage[8];
|
||||
@@ -369,6 +370,10 @@ struct s5m_platform_data {
|
||||
bool buck2_ramp_enable;
|
||||
bool buck3_ramp_enable;
|
||||
bool buck4_ramp_enable;
|
||||
|
||||
int buck2_init;
|
||||
int buck3_init;
|
||||
int buck4_init;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_MFD_S5M_CORE_H */
|
||||
|
||||
@@ -217,7 +217,8 @@ enum tps65217_regulator_id {
|
||||
* Board data may be used to initialize regulator.
|
||||
*/
|
||||
struct tps65217_board {
|
||||
struct regulator_init_data *tps65217_init_data;
|
||||
struct regulator_init_data *tps65217_init_data[TPS65217_NUM_REGULATOR];
|
||||
struct device_node *of_node[TPS65217_NUM_REGULATOR];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -227,11 +228,6 @@ struct tps65217_board {
|
||||
* @max_uV: minimum micro volts
|
||||
* @vsel_to_uv: Function pointer to get voltage from selector
|
||||
* @uv_to_vsel: Function pointer to get selector from voltage
|
||||
* @table: Table for non-uniform voltage step-size
|
||||
* @table_len: Length of the voltage table
|
||||
* @enable_mask: Regulator enable mask bits
|
||||
* @set_vout_reg: Regulator output voltage set register
|
||||
* @set_vout_mask: Regulator output voltage set mask
|
||||
*
|
||||
* This data is used to check the regualtor voltage limits while setting.
|
||||
*/
|
||||
@@ -241,11 +237,6 @@ struct tps_info {
|
||||
int max_uV;
|
||||
int (*vsel_to_uv)(unsigned int vsel);
|
||||
int (*uv_to_vsel)(int uV, unsigned int *vsel);
|
||||
const int *table;
|
||||
unsigned int table_len;
|
||||
unsigned int enable_mask;
|
||||
unsigned int set_vout_reg;
|
||||
unsigned int set_vout_mask;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -880,4 +880,10 @@ static inline int tps65910_reg_clear_bits(struct tps65910 *tps65910, u8 reg,
|
||||
return regmap_update_bits(tps65910->regmap, reg, mask, 0);
|
||||
}
|
||||
|
||||
static inline int tps65910_reg_update_bits(struct tps65910 *tps65910, u8 reg,
|
||||
u8 mask, u8 val)
|
||||
{
|
||||
return regmap_update_bits(tps65910->regmap, reg, mask, val);
|
||||
}
|
||||
|
||||
#endif /* __LINUX_MFD_TPS65910_H */
|
||||
|
||||
@@ -290,6 +290,12 @@ static inline int regulator_set_voltage(struct regulator *regulator,
|
||||
}
|
||||
|
||||
static inline int regulator_get_voltage(struct regulator *regulator)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int regulator_is_supported_voltage(struct regulator *regulator,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ enum regulator_status {
|
||||
REGULATOR_STATUS_NORMAL,
|
||||
REGULATOR_STATUS_IDLE,
|
||||
REGULATOR_STATUS_STANDBY,
|
||||
/* in case that any other status doesn't apply */
|
||||
REGULATOR_STATUS_UNDEFINED,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -67,6 +69,8 @@ enum regulator_status {
|
||||
*
|
||||
* @enable_time: Time taken for the regulator voltage output voltage to
|
||||
* stabilise after being enabled, in microseconds.
|
||||
* @set_ramp_delay: Set the ramp delay for the regulator. The driver should
|
||||
* select ramp delay equal to or less than(closest) ramp_delay.
|
||||
* @set_voltage_time_sel: Time taken for the regulator voltage output voltage
|
||||
* to stabilise after being set to a new value, in microseconds.
|
||||
* The function provides the from and to voltage selector, the
|
||||
@@ -113,6 +117,7 @@ struct regulator_ops {
|
||||
|
||||
/* Time taken to enable or set voltage on the regulator */
|
||||
int (*enable_time) (struct regulator_dev *);
|
||||
int (*set_ramp_delay) (struct regulator_dev *, int ramp_delay);
|
||||
int (*set_voltage_time_sel) (struct regulator_dev *,
|
||||
unsigned int old_selector,
|
||||
unsigned int new_selector);
|
||||
@@ -170,11 +175,15 @@ enum regulator_type {
|
||||
*
|
||||
* @min_uV: Voltage given by the lowest selector (if linear mapping)
|
||||
* @uV_step: Voltage increase with each selector (if linear mapping)
|
||||
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
|
||||
* @volt_table: Voltage mapping table (if table based mapping)
|
||||
*
|
||||
* @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
|
||||
* @vsel_mask: Mask for register bitfield used for selector
|
||||
* @enable_reg: Register for control when using regmap enable/disable ops
|
||||
* @enable_mask: Mask for control when using regmap enable/disable ops
|
||||
*
|
||||
* @enable_time: Time taken for initial enable of regulator (in uS).
|
||||
*/
|
||||
struct regulator_desc {
|
||||
const char *name;
|
||||
@@ -188,11 +197,16 @@ struct regulator_desc {
|
||||
|
||||
unsigned int min_uV;
|
||||
unsigned int uV_step;
|
||||
unsigned int ramp_delay;
|
||||
|
||||
const unsigned int *volt_table;
|
||||
|
||||
unsigned int vsel_reg;
|
||||
unsigned int vsel_mask;
|
||||
unsigned int enable_reg;
|
||||
unsigned int enable_mask;
|
||||
|
||||
unsigned int enable_time;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -208,6 +222,9 @@ struct regulator_desc {
|
||||
* @of_node: OpenFirmware node to parse for device tree bindings (may be
|
||||
* NULL).
|
||||
* @regmap: regmap to use for core regmap helpers
|
||||
* @ena_gpio: GPIO controlling regulator enable.
|
||||
* @ena_gpio_invert: Sense for GPIO enable control.
|
||||
* @ena_gpio_flags: Flags to use when calling gpio_request_one()
|
||||
*/
|
||||
struct regulator_config {
|
||||
struct device *dev;
|
||||
@@ -215,6 +232,10 @@ struct regulator_config {
|
||||
void *driver_data;
|
||||
struct device_node *of_node;
|
||||
struct regmap *regmap;
|
||||
|
||||
int ena_gpio;
|
||||
unsigned int ena_gpio_invert:1;
|
||||
unsigned int ena_gpio_flags;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -253,6 +274,10 @@ struct regulator_dev {
|
||||
void *reg_data; /* regulator_dev data */
|
||||
|
||||
struct dentry *debugfs;
|
||||
|
||||
int ena_gpio;
|
||||
unsigned int ena_gpio_invert:1;
|
||||
unsigned int ena_gpio_state:1;
|
||||
};
|
||||
|
||||
struct regulator_dev *
|
||||
@@ -271,6 +296,8 @@ int regulator_mode_to_status(unsigned int);
|
||||
|
||||
int regulator_list_voltage_linear(struct regulator_dev *rdev,
|
||||
unsigned int selector);
|
||||
int regulator_list_voltage_table(struct regulator_dev *rdev,
|
||||
unsigned int selector);
|
||||
int regulator_map_voltage_linear(struct regulator_dev *rdev,
|
||||
int min_uV, int max_uV);
|
||||
int regulator_map_voltage_iterate(struct regulator_dev *rdev,
|
||||
@@ -280,6 +307,9 @@ int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
|
||||
int regulator_is_enabled_regmap(struct regulator_dev *rdev);
|
||||
int regulator_enable_regmap(struct regulator_dev *rdev);
|
||||
int regulator_disable_regmap(struct regulator_dev *rdev);
|
||||
int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
|
||||
unsigned int old_selector,
|
||||
unsigned int new_selector);
|
||||
|
||||
void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ struct regulator_init_data;
|
||||
/**
|
||||
* struct fixed_voltage_config - fixed_voltage_config structure
|
||||
* @supply_name: Name of the regulator supply
|
||||
* @input_supply: Name of the input regulator supply
|
||||
* @microvolts: Output voltage of regulator
|
||||
* @gpio: GPIO to use for enable control
|
||||
* set to -EINVAL if not used
|
||||
@@ -46,6 +47,7 @@ struct regulator_init_data;
|
||||
*/
|
||||
struct fixed_voltage_config {
|
||||
const char *supply_name;
|
||||
const char *input_supply;
|
||||
int microvolts;
|
||||
int gpio;
|
||||
unsigned startup_delay;
|
||||
@@ -58,14 +60,17 @@ struct fixed_voltage_config {
|
||||
struct regulator_consumer_supply;
|
||||
|
||||
#if IS_ENABLED(CONFIG_REGULATOR)
|
||||
struct platform_device *regulator_register_fixed(int id,
|
||||
struct regulator_consumer_supply *supplies, int num_supplies);
|
||||
struct platform_device *regulator_register_always_on(int id, const char *name,
|
||||
struct regulator_consumer_supply *supplies, int num_supplies, int uv);
|
||||
#else
|
||||
static inline struct platform_device *regulator_register_fixed(int id,
|
||||
struct regulator_consumer_supply *supplies, int num_supplies)
|
||||
static inline struct platform_device *regulator_register_always_on(int id, const char *name,
|
||||
struct regulator_consumer_supply *supplies, int num_supplies, int uv)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \
|
||||
"fixed-dummy", s, ns, 0)
|
||||
|
||||
#endif
|
||||
|
||||
90
include/linux/regulator/lp872x.h
Normal file
90
include/linux/regulator/lp872x.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2012 Texas Instruments
|
||||
*
|
||||
* Author: Milo(Woogyom) Kim <milo.kim@ti.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LP872X_REGULATOR_H__
|
||||
#define __LP872X_REGULATOR_H__
|
||||
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#define LP872X_MAX_REGULATORS 9
|
||||
|
||||
enum lp872x_regulator_id {
|
||||
LP8720_ID_BASE,
|
||||
LP8720_ID_LDO1 = LP8720_ID_BASE,
|
||||
LP8720_ID_LDO2,
|
||||
LP8720_ID_LDO3,
|
||||
LP8720_ID_LDO4,
|
||||
LP8720_ID_LDO5,
|
||||
LP8720_ID_BUCK,
|
||||
|
||||
LP8725_ID_BASE,
|
||||
LP8725_ID_LDO1 = LP8725_ID_BASE,
|
||||
LP8725_ID_LDO2,
|
||||
LP8725_ID_LDO3,
|
||||
LP8725_ID_LDO4,
|
||||
LP8725_ID_LDO5,
|
||||
LP8725_ID_LILO1,
|
||||
LP8725_ID_LILO2,
|
||||
LP8725_ID_BUCK1,
|
||||
LP8725_ID_BUCK2,
|
||||
|
||||
LP872X_ID_MAX,
|
||||
};
|
||||
|
||||
enum lp872x_dvs_state {
|
||||
DVS_LOW = GPIOF_OUT_INIT_LOW,
|
||||
DVS_HIGH = GPIOF_OUT_INIT_HIGH,
|
||||
};
|
||||
|
||||
enum lp872x_dvs_sel {
|
||||
SEL_V1,
|
||||
SEL_V2,
|
||||
};
|
||||
|
||||
/**
|
||||
* lp872x_dvs
|
||||
* @gpio : gpio pin number for dvs control
|
||||
* @vsel : dvs selector for buck v1 or buck v2 register
|
||||
* @init_state : initial dvs pin state
|
||||
*/
|
||||
struct lp872x_dvs {
|
||||
int gpio;
|
||||
enum lp872x_dvs_sel vsel;
|
||||
enum lp872x_dvs_state init_state;
|
||||
};
|
||||
|
||||
/**
|
||||
* lp872x_regdata
|
||||
* @id : regulator id
|
||||
* @init_data : init data for each regulator
|
||||
*/
|
||||
struct lp872x_regulator_data {
|
||||
enum lp872x_regulator_id id;
|
||||
struct regulator_init_data *init_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* lp872x_platform_data
|
||||
* @general_config : the value of LP872X_GENERAL_CFG register
|
||||
* @update_config : if LP872X_GENERAL_CFG register is updated, set true
|
||||
* @regulator_data : platform regulator id and init data
|
||||
* @dvs : dvs data for buck voltage control
|
||||
*/
|
||||
struct lp872x_platform_data {
|
||||
u8 general_config;
|
||||
bool update_config;
|
||||
struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
|
||||
struct lp872x_dvs *dvs;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -92,6 +92,7 @@ struct regulator_state {
|
||||
* mode.
|
||||
* @initial_state: Suspend state to set by default.
|
||||
* @initial_mode: Mode to set at startup.
|
||||
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
|
||||
*/
|
||||
struct regulation_constraints {
|
||||
|
||||
@@ -125,6 +126,8 @@ struct regulation_constraints {
|
||||
/* mode to set on startup */
|
||||
unsigned int initial_mode;
|
||||
|
||||
unsigned int ramp_delay;
|
||||
|
||||
/* constraint flags */
|
||||
unsigned always_on:1; /* regulator never off when system is on */
|
||||
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
|
||||
|
||||
Reference in New Issue
Block a user