drivers: regulator: shell: drop PMIC conditional options

The regulator API supports all voltage/current ops, so there's no need
to guard them under "PMIC". If a particular driver doesn't support the
operations it will just return -ENOSYS and the command will fail.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-11-11 12:59:50 +01:00 committed by Carles Cufí
commit 6dd395ddeb

View file

@ -53,9 +53,7 @@ static int cmd_reg_dis(const struct shell *sh, size_t argc, char **argv)
return 0; return 0;
} }
static int cmd_set_vol(const struct shell *sh, size_t argc, char **argv)
#if CONFIG_REGULATOR_PMIC
static int cmd_pmic_set_vol(const struct shell *sh, size_t argc, char **argv)
{ {
int lvol, uvol, ret; int lvol, uvol, ret;
const struct device *reg_dev; const struct device *reg_dev;
@ -83,7 +81,7 @@ static int cmd_pmic_set_vol(const struct shell *sh, size_t argc, char **argv)
return 0; return 0;
} }
static int cmd_pmic_set_ilim(const struct shell *sh, size_t argc, char **argv) static int cmd_set_ilim(const struct shell *sh, size_t argc, char **argv)
{ {
int lcur, ucur, ret; int lcur, ucur, ret;
const struct device *reg_dev; const struct device *reg_dev;
@ -111,18 +109,6 @@ static int cmd_pmic_set_ilim(const struct shell *sh, size_t argc, char **argv)
return 0; return 0;
} }
SHELL_STATIC_SUBCMD_SET_CREATE(pmic_set,
SHELL_CMD_ARG(set_vol, NULL, "Set voltage (in mV)\n"
"Usage: set_vol <device> <low limit (uV)> <high limit (uV)>",
cmd_pmic_set_vol, 4, 0),
SHELL_CMD_ARG(set_current, NULL, "Set current limit( in mA)\n"
"Usage: set_current <device> <low limit (uA)> <high limit (uA)>",
cmd_pmic_set_ilim, 4, 0),
SHELL_SUBCMD_SET_END
);
#endif /* CONFIG_REGULATOR_PMIC */
SHELL_STATIC_SUBCMD_SET_CREATE(regulator_set, SHELL_STATIC_SUBCMD_SET_CREATE(regulator_set,
SHELL_CMD_ARG(enable, NULL, SHELL_CMD_ARG(enable, NULL,
"Enable regulator\n" "Enable regulator\n"
@ -130,9 +116,12 @@ SHELL_STATIC_SUBCMD_SET_CREATE(regulator_set,
SHELL_CMD_ARG(disable, NULL, SHELL_CMD_ARG(disable, NULL,
"Disable regulator\n" "Disable regulator\n"
"Usage: disable <device>", cmd_reg_dis, 2, 0), "Usage: disable <device>", cmd_reg_dis, 2, 0),
#if CONFIG_REGULATOR_PMIC SHELL_CMD_ARG(set_vol, NULL, "Set voltage (in mV)\n"
SHELL_CMD(pmic, &pmic_set, "PMIC management", NULL), "Usage: set_vol <device> <low limit (uV)> <high limit (uV)>",
#endif cmd_set_vol, 4, 0),
SHELL_CMD_ARG(set_current, NULL, "Set current limit( in mA)\n"
"Usage: set_current <device> <low limit (uA)> <high limit (uA)>",
cmd_set_ilim, 4, 0),
SHELL_SUBCMD_SET_END SHELL_SUBCMD_SET_END
); );