From: Javier Martinez Canillas Date: Mon, 2 Jan 2023 20:25:42 +0000 (+0100) Subject: drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro X-Git-Tag: v6.6.17~3937^2~23^2~1048 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9015ce593204f487bcb3069c5908155ccc59f30;p=platform%2Fkernel%2Flinux-rpi.git drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Many panel drivers define dsi_dcs_write_seq() and dsi_generic_write_seq() macros to send DCS commands and generic write packets respectively, with the payload specified as a list of parameters instead of using arrays. There's already a macro for the former, introduced by commit 2a9e9daf75231 ("drm/mipi-dsi: Introduce mipi_dsi_dcs_write_seq macro") so drivers can be changed to use that. But there isn't one yet for the latter, let's add it. Signed-off-by: Javier Martinez Canillas Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20230102202542.3494677-2-javierm@redhat.com --- diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index e9d1e8a..4f503d9 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -298,6 +298,24 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi, u16 *brightness); /** + * mipi_dsi_generic_write_seq - transmit data using a generic write packet + * @dsi: DSI peripheral device + * @seq: buffer containing the payload + */ +#define mipi_dsi_generic_write_seq(dsi, seq...) \ + do { \ + static const u8 d[] = { seq }; \ + struct device *dev = &dsi->dev; \ + int ret; \ + ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err_ratelimited(dev, "transmit data failed: %d\n", \ + ret); \ + return ret; \ + } \ + } while (0) + +/** * mipi_dsi_dcs_write_seq - transmit a DCS command with payload * @dsi: DSI peripheral device * @cmd: Command