Lines Matching +full:force +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2014-2015 Samsung Electronics
9 #include <dm/uclass-internal.h>
29 int ret = -ENXIO; in do_dev()
47 printf("%s: no regulator platform data!\n", currdev->name); in do_dev()
51 printf("dev: %s @ %s\n", uc_pdata->name, currdev->name); in do_dev()
73 pr_err("Regulator: %s - missing platform data!\n", currdev->name); in curr_dev_and_platdata()
77 if (!allow_type_fixed && (*uc_pdata)->type == REGULATOR_TYPE_FIXED) { in curr_dev_and_platdata()
91 printf("| %-*.*s| %-*.*s| %s\n", in do_list()
93 LIMIT_OFNAME, LIMIT_OFNAME, "regulator-name", in do_list()
102 printf("| %-*.*s| %-*.*s| %s\n", in do_list()
103 LIMIT_DEVNAME, LIMIT_DEVNAME, dev->name, in do_list()
104 LIMIT_OFNAME, LIMIT_OFNAME, uc_pdata->name, in do_list()
105 dev->parent->name); in do_list()
113 printf("%-*s", LIMIT_INFO, name); in constraint()
127 static const char *get_mode_name(struct dm_regulator_mode *mode, in get_mode_name() argument
131 while (mode_count--) { in get_mode_name()
132 if (mode->id == mode_id) in get_mode_name()
133 return mode->name; in get_mode_name()
134 mode++; in get_mode_name()
154 parent_uc = dev_get_uclass_name(dev->parent); in do_info()
156 printf("%s\n%-*s %s\n%-*s %s\n%-*s %s\n%-*s %s\n%-*s\n", in do_info()
158 LIMIT_INFO, "* regulator-name:", uc_pdata->name, in do_info()
159 LIMIT_INFO, "* device name:", dev->name, in do_info()
160 LIMIT_INFO, "* parent name:", dev->parent->name, in do_info()
164 constraint(" - min uV:", uc_pdata->min_uV, NULL); in do_info()
165 constraint(" - max uV:", uc_pdata->max_uV, NULL); in do_info()
166 constraint(" - min uA:", uc_pdata->min_uA, NULL); in do_info()
167 constraint(" - max uA:", uc_pdata->max_uA, NULL); in do_info()
168 constraint(" - always on:", uc_pdata->always_on, in do_info()
169 uc_pdata->always_on ? "true" : "false"); in do_info()
170 constraint(" - boot on:", uc_pdata->boot_on, in do_info()
171 uc_pdata->boot_on ? "true" : "false"); in do_info()
177 constraint(" - mode id:", modes->id, modes->name); in do_info()
185 int current, value, mode; in do_status_detail() local
189 printf("Regulator %s status:\n", uc_pdata->name); in do_status_detail()
200 mode = regulator_get_mode(dev); in do_status_detail()
201 mode_name = get_mode_name(uc_pdata->mode, uc_pdata->mode_count, mode); in do_status_detail()
202 constraint(" * mode id:", mode, mode_name); in do_status_detail()
208 int current, value, mode; in do_status_line() local
216 mode = regulator_get_mode(dev); in do_status_line()
217 mode_name = get_mode_name(pdata->mode, pdata->mode_count, mode); in do_status_line()
218 printf("%-20s %-10s ", pdata->name, enabled ? "enabled" : "disabled"); in do_status_line()
222 printf("%10s ", "-"); in do_status_line()
226 printf("%10s ", "-"); in do_status_line()
227 if (mode >= 0) in do_status_line()
228 printf("%-10s", mode_name); in do_status_line()
230 printf("%-10s", "-"); in do_status_line()
240 if (currdev && (argc < 2 || strcmp(argv[1], "-a"))) { in do_status()
249 printf("%-20s %-10s %10s %10s %-10s\n", "Name", "Enabled", "uV", "mA", in do_status()
250 "Mode"); in do_status()
263 int force; in do_value() local
273 printf("Regulator: %s - can't get the Voltage!\n", in do_value()
274 uc_pdata->name); in do_value()
283 force = !strcmp("-f", argv[2]); in do_value()
285 force = 0; in do_value()
288 if ((value < uc_pdata->min_uV || value > uc_pdata->max_uV) && !force) { in do_value()
290 uc_pdata->min_uV, uc_pdata->max_uV); in do_value()
294 if (!force) in do_value()
299 printf("Regulator: %s - can't set the Voltage!\n", in do_value()
300 uc_pdata->name); in do_value()
321 printf("Regulator: %s - can't get the Current!\n", in do_current()
322 uc_pdata->name); in do_current()
331 if (current < uc_pdata->min_uA || current > uc_pdata->max_uA) { in do_current()
338 printf("Regulator: %s - can't set the Current!\n", in do_current()
339 uc_pdata->name); in do_current()
350 int mode; in do_mode() local
360 printf("Regulator: %s - can't get the operation mode!\n", in do_mode()
361 uc_pdata->name); in do_mode()
365 printf("mode id: %d\n", ret); in do_mode()
369 mode = simple_strtoul(argv[1], NULL, 0); in do_mode()
371 ret = regulator_set_mode(dev, mode); in do_mode()
373 printf("Regulator: %s - can't set the operation mode!\n", in do_mode()
374 uc_pdata->name); in do_mode()
393 printf("Regulator: %s - can't enable!\n", uc_pdata->name); in do_enable()
412 printf("Regulator: %s - can't disable!\n", uc_pdata->name); in do_disable()
426 U_BOOT_CMD_MKENT(mode, 2, 1, do_mode, "", ""),
436 argc--; in do_regulator()
440 if (cmd == NULL || argc > cmd->maxargs) in do_regulator()
443 return cmd->cmd(cmdtp, flag, argc, argv); in do_regulator()
448 "list - list UCLASS regulator devices\n"
449 "regulator dev [regulator-name] - show/[set] operating regulator device\n"
450 "regulator info - print constraints info\n"
451 "regulator status [-a] - print operating status [for all]\n"
452 "regulator value [val] [-f] - print/[set] voltage value [uV] (force)\n"
453 "regulator current [val] - print/[set] current value [uA]\n"
454 "regulator mode [id] - print/[set] operating mode id\n"
455 "regulator enable - enable the regulator output\n"
456 "regulator disable - disable the regulator output\n"