[PATCH 4/4] commands: mipi_dsi: add command for easier DCS experimentation
Sascha Hauer
s.hauer at pengutronix.de
Mon Nov 9 01:24:59 PST 2026
On 2026-11-08 11:10, Ahmad Fatoum wrote:
> +static int do_mipi_dsi(int argc, char *argv[])
> +{
> + struct mipi_dsi_opts opts = { .peripheral = -1 };
> + struct mipi_dsi_device *dsi;
> + struct device *dev;
> + bool list = false, verbose = false, lpm = false, hs = false;
> + unsigned long mode_flags;
> + unsigned int channel, vc = UINT_MAX;
> + int opt, ret;
> +
> + dev = list_first_entry_or_null(&mipi_dsi_bus_type.device_list,
> + struct device, bus_list);
> +
> + while ((opt = getopt(argc, argv, "c:d:gHilLn:p:vw")) > 0) {
> + switch (opt) {
> + case 'c':
> + ret = kstrtouint(optarg, 0, &vc);
> + if (ret)
> + return ret;
> + if (vc > 3)
> + return -EINVAL;
> + break;
> + case 'd':
> + dev = bus_find_device(&mipi_dsi_bus_type, NULL,
> + optarg, device_match_name);
> + break;
> + case 'g':
> + opts.generic = true;
> + break;
> + case 'H':
> + hs = true;
> + break;
> + case 'i':
> + opts.info = true;
> + break;
> + case 'l':
> + list = true;
> + break;
> + case 'L':
> + lpm = true;
> + break;
> + case 'n':
> + ret = kstrtouint(optarg, 0, &opts.len);
> + if (ret)
> + return ret;
> + if (!opts.len || opts.len > MIPI_DSI_CMD_MAX_LEN)
> + return -EINVAL;
> + break;
> + case 'p':
> + if (!strcmp(optarg, "on"))
> + opts.peripheral = 1;
> + else if (!strcmp(optarg, "off"))
> + opts.peripheral = 0;
> + else
> + return COMMAND_ERROR_USAGE;
> + break;
> + case 'v':
> + verbose = true;
> + break;
> + case 'w':
> + opts.write = true;
> + break;
> + default:
> + return COMMAND_ERROR_USAGE;
> + }
> + }
> +
> + if (list || verbose) {
> + mipi_dsi_list(verbose);
> + return 0;
> + }
-v intuitively reads as "verbose", at the -v option even results in a
variable named verbose. I think it would be clearer to use -v as "Do
what you ordered to, with verbose output", rather then "list devices
verbosely"
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list