regulator can report "off"
PATCH 3/3 regulator can report "off"
From: David Brownell <[email protected]>
Add REGULATOR_MODE_OFF (zero) as a valid option ...
Update the display of regulator_ops.get_mode() values to report the mode as "off" if it's neither an error (negative number) nor one of the defined REGISTER_MODE_* constants.
Signed-off-by David Brownell <[email protected]>
--- Documentation/ABI/testing/sysfs-class-regulator | 1 + drivers/regulator/core.c | 2 ++ include/linux/regulator/consumer.h | 12 +++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-class-regulator +1 -0
@@ -95,6 +95,7 @@ Description: 'normal' 'idle' 'standby' + 'off' 'unknown' The modes are described in include/linux/regulator/consumer.h
drivers/regulator/core.c +2 -0
@@ -280,6 +280,8 @@ static ssize_t regulator_print_opmode(chreturn sprintf (buf,"idle\n" );case REGULATOR_MODE_STANDBY :return sprintf (buf,"standby\n" ); +case REGULATOR_MODE_OFF : +return sprintf (buf,"off\n" ); }return sprintf (buf,"unknown\n" ); }
include/linux/regulator/consumer.h +11 -1
@@ -71,9 +71,19 @@* NOTE: Most regulators will only support a subset of these modes. Some * will only just support NORMAL. * -* These modes can be OR'ed together to make up a mask of valid register modes. +* These modes can be OR'ed together to make up a mask of the modes which +* may be passed, one at a time, to regulator_set_mode(). +* +* Additionally, two more regulator states are reported in some cases +* by regulator_get_mode(): +* +* OFF Regulator supplies no current or voltage; very efficient. +* +* error These values are indicated by negative errno codes, and +* represent various out-of-regulation states. */ +#define REGULATOR_MODE_OFF 0x0#define REGULATOR_MODE_FAST 0x1#define REGULATOR_MODE_NORMAL 0x2#define REGULATOR_MODE_IDLE 0x4