mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
This commit is contained in:
commit
1ad13028e5
@ -323,13 +323,14 @@ static ssize_t regulator_uA_show(struct device *dev,
|
|||||||
}
|
}
|
||||||
static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL);
|
static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL);
|
||||||
|
|
||||||
static ssize_t regulator_name_show(struct device *dev,
|
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
|
||||||
struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev = dev_get_drvdata(dev);
|
struct regulator_dev *rdev = dev_get_drvdata(dev);
|
||||||
|
|
||||||
return sprintf(buf, "%s\n", rdev_get_name(rdev));
|
return sprintf(buf, "%s\n", rdev_get_name(rdev));
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(name);
|
||||||
|
|
||||||
static ssize_t regulator_print_opmode(char *buf, int mode)
|
static ssize_t regulator_print_opmode(char *buf, int mode)
|
||||||
{
|
{
|
||||||
@ -489,15 +490,16 @@ static ssize_t regulator_total_uA_show(struct device *dev,
|
|||||||
}
|
}
|
||||||
static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL);
|
static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL);
|
||||||
|
|
||||||
static ssize_t regulator_num_users_show(struct device *dev,
|
static ssize_t num_users_show(struct device *dev, struct device_attribute *attr,
|
||||||
struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev = dev_get_drvdata(dev);
|
struct regulator_dev *rdev = dev_get_drvdata(dev);
|
||||||
return sprintf(buf, "%d\n", rdev->use_count);
|
return sprintf(buf, "%d\n", rdev->use_count);
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(num_users);
|
||||||
|
|
||||||
static ssize_t regulator_type_show(struct device *dev,
|
static ssize_t type_show(struct device *dev, struct device_attribute *attr,
|
||||||
struct device_attribute *attr, char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev = dev_get_drvdata(dev);
|
struct regulator_dev *rdev = dev_get_drvdata(dev);
|
||||||
|
|
||||||
@ -509,6 +511,7 @@ static ssize_t regulator_type_show(struct device *dev,
|
|||||||
}
|
}
|
||||||
return sprintf(buf, "unknown\n");
|
return sprintf(buf, "unknown\n");
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(type);
|
||||||
|
|
||||||
static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
|
static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
@ -632,12 +635,13 @@ static DEVICE_ATTR(bypass, 0444,
|
|||||||
* These are the only attributes are present for all regulators.
|
* These are the only attributes are present for all regulators.
|
||||||
* Other attributes are a function of regulator functionality.
|
* Other attributes are a function of regulator functionality.
|
||||||
*/
|
*/
|
||||||
static struct device_attribute regulator_dev_attrs[] = {
|
static struct attribute *regulator_dev_attrs[] = {
|
||||||
__ATTR(name, 0444, regulator_name_show, NULL),
|
&dev_attr_name.attr,
|
||||||
__ATTR(num_users, 0444, regulator_num_users_show, NULL),
|
&dev_attr_num_users.attr,
|
||||||
__ATTR(type, 0444, regulator_type_show, NULL),
|
&dev_attr_type.attr,
|
||||||
__ATTR_NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(regulator_dev);
|
||||||
|
|
||||||
static void regulator_dev_release(struct device *dev)
|
static void regulator_dev_release(struct device *dev)
|
||||||
{
|
{
|
||||||
@ -648,7 +652,7 @@ static void regulator_dev_release(struct device *dev)
|
|||||||
static struct class regulator_class = {
|
static struct class regulator_class = {
|
||||||
.name = "regulator",
|
.name = "regulator",
|
||||||
.dev_release = regulator_dev_release,
|
.dev_release = regulator_dev_release,
|
||||||
.dev_attrs = regulator_dev_attrs,
|
.dev_groups = regulator_dev_groups,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Calculate the new optimum regulator operating mode based on the new total
|
/* Calculate the new optimum regulator operating mode based on the new total
|
||||||
@ -1238,7 +1242,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
|
|||||||
|
|
||||||
/* Internal regulator request function */
|
/* Internal regulator request function */
|
||||||
static struct regulator *_regulator_get(struct device *dev, const char *id,
|
static struct regulator *_regulator_get(struct device *dev, const char *id,
|
||||||
int exclusive)
|
bool exclusive)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev;
|
struct regulator_dev *rdev;
|
||||||
struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);
|
struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);
|
||||||
@ -1344,7 +1348,7 @@ out:
|
|||||||
*/
|
*/
|
||||||
struct regulator *regulator_get(struct device *dev, const char *id)
|
struct regulator *regulator_get(struct device *dev, const char *id)
|
||||||
{
|
{
|
||||||
return _regulator_get(dev, id, 0);
|
return _regulator_get(dev, id, false);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(regulator_get);
|
EXPORT_SYMBOL_GPL(regulator_get);
|
||||||
|
|
||||||
@ -1405,7 +1409,7 @@ EXPORT_SYMBOL_GPL(devm_regulator_get);
|
|||||||
*/
|
*/
|
||||||
struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
|
struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
|
||||||
{
|
{
|
||||||
return _regulator_get(dev, id, 1);
|
return _regulator_get(dev, id, true);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(regulator_get_exclusive);
|
EXPORT_SYMBOL_GPL(regulator_get_exclusive);
|
||||||
|
|
||||||
@ -1890,8 +1894,9 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
|
|||||||
rdev->deferred_disables++;
|
rdev->deferred_disables++;
|
||||||
mutex_unlock(&rdev->mutex);
|
mutex_unlock(&rdev->mutex);
|
||||||
|
|
||||||
ret = schedule_delayed_work(&rdev->disable_work,
|
ret = queue_delayed_work(system_power_efficient_wq,
|
||||||
msecs_to_jiffies(ms));
|
&rdev->disable_work,
|
||||||
|
msecs_to_jiffies(ms));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
else
|
else
|
||||||
@ -3835,8 +3840,11 @@ void regulator_unregister(struct regulator_dev *rdev)
|
|||||||
if (rdev == NULL)
|
if (rdev == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rdev->supply)
|
if (rdev->supply) {
|
||||||
|
while (rdev->use_count--)
|
||||||
|
regulator_disable(rdev->supply);
|
||||||
regulator_put(rdev->supply);
|
regulator_put(rdev->supply);
|
||||||
|
}
|
||||||
mutex_lock(®ulator_list_mutex);
|
mutex_lock(®ulator_list_mutex);
|
||||||
debugfs_remove_recursive(rdev->debugfs);
|
debugfs_remove_recursive(rdev->debugfs);
|
||||||
flush_work(&rdev->disable_work.work);
|
flush_work(&rdev->disable_work.work);
|
||||||
|
@ -369,8 +369,11 @@ static inline int regulator_count_voltages(struct regulator *regulator)
|
|||||||
static inline int regulator_set_voltage_tol(struct regulator *regulator,
|
static inline int regulator_set_voltage_tol(struct regulator *regulator,
|
||||||
int new_uV, int tol_uV)
|
int new_uV, int tol_uV)
|
||||||
{
|
{
|
||||||
return regulator_set_voltage(regulator,
|
if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
|
||||||
new_uV - tol_uV, new_uV + tol_uV);
|
return 0;
|
||||||
|
else
|
||||||
|
return regulator_set_voltage(regulator,
|
||||||
|
new_uV - tol_uV, new_uV + tol_uV);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
|
static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
|
||||||
|
Loading…
Reference in New Issue
Block a user