Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114280
b: refs/heads/master
c: bc558a6
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Oct 13, 2008
1 parent cca0be6 commit e027a5d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 42fad570b666256a3fd009e23e74cbb365a29ca8
refs/heads/master: bc558a60b58f638ee0188affb627d4894a97b1c7
13 changes: 13 additions & 0 deletions trunk/Documentation/ABI/testing/sysfs-class-regulator
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ Description:
platform code.


What: /sys/class/regulator/.../name
Date: October 2008
KernelVersion: 2.6.28
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
Description:
Each regulator directory will contain a field called
name. This holds a string identifying the regulator for
display purposes.

NOTE: this will be empty if no suitable name is provided
by platform or regulator drivers.


What: /sys/class/regulator/.../num_users
Date: April 2008
KernelVersion: 2.6.26
Expand Down
18 changes: 18 additions & 0 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,22 @@ static ssize_t regulator_uA_show(struct device *dev,
return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev));
}

static ssize_t regulator_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct regulator_dev *rdev = dev_get_drvdata(dev);
const char *name;

if (rdev->constraints->name)
name = rdev->constraints->name;
else if (rdev->desc->name)
name = rdev->desc->name;
else
name = "";

return sprintf(buf, "%s\n", name);
}

static ssize_t regulator_opmode_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -473,7 +489,9 @@ static ssize_t regulator_suspend_standby_state_show(struct device *dev,
else
return sprintf(buf, "disabled\n");
}

static struct device_attribute regulator_dev_attrs[] = {
__ATTR(name, 0444, regulator_name_show, NULL),
__ATTR(microvolts, 0444, regulator_uV_show, NULL),
__ATTR(microamps, 0444, regulator_uA_show, NULL),
__ATTR(opmode, 0444, regulator_opmode_show, NULL),
Expand Down

0 comments on commit e027a5d

Please sign in to comment.