From: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> 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 <dbrownell@xxxxxxxxxxxxxxxxxxxxx> --- 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(-) --- a/Documentation/ABI/testing/sysfs-class-regulator +++ b/Documentation/ABI/testing/sysfs-class-regulator @@ -95,6 +95,7 @@ Description: 'normal' 'idle' 'standby' + 'off' 'unknown' The modes are described in include/linux/regulator/consumer.h --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -280,6 +280,8 @@ static ssize_t regulator_print_opmode(ch return 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"); } --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -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 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html