diff options
author | Joel Selvaraj <jo@jsfamily.in> | 2022-06-01 13:54:09 +0530 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2022-06-24 22:34:39 +0200 |
commit | 2a9e9daf75231c2f577209af5ec62aecdf7ca7af (patch) | |
tree | f341f7f75006dd62fef8f1e1a9cc996710bc6de9 | |
parent | c5ec5fa3931675e583aada31db1453038f7b76a4 (diff) | |
download | linux-2a9e9daf75231c2f577209af5ec62aecdf7ca7af.tar.gz linux-2a9e9daf75231c2f577209af5ec62aecdf7ca7af.tar.bz2 linux-2a9e9daf75231c2f577209af5ec62aecdf7ca7af.zip |
drm/mipi-dsi: Introduce mipi_dsi_dcs_write_seq macro
A helper macro that can be used to simplify sending DCS commands.
It is useful in scenarios like panel initialization which can sometimes
involve sending lot of DCS commands.
Signed-off-by: Joel Selvaraj <jo@jsfamily.in>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/BY5PR02MB700952493EEB6F0E77DC8416D9DF9@BY5PR02MB7009.namprd02.prod.outlook.com
-rw-r--r-- | include/drm/drm_mipi_dsi.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 51e09a1a106a..91a164bdd8f3 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -296,6 +296,23 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi, u16 *brightness); /** + * mipi_dsi_dcs_write_seq - transmit a DCS command with payload + * @dsi: DSI peripheral device + * @cmd: Command + * @seq: buffer containing data to be transmitted + */ +#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do { \ + static const u8 d[] = { cmd, seq }; \ + struct device *dev = &dsi->dev; \ + int ret; \ + ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err_ratelimited(dev, "sending command %#02x failed: %d\n", cmd, ret); \ + return ret; \ + } \ + } while (0) + +/** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver * @probe: callback for device binding |