+ *
+ * Return: The number of bytes transmitted on success or a negative
error code
+ * on failure.
+ */
+ssize_t mipi_dsi_generic_write_raw_multi(struct
mipi_dsi_multi_context *ctx,
+ u8 type, const void *payload, size_t size)
+{
+ struct mipi_dsi_device *dsi = ctx->dsi;
+ struct mipi_dsi_msg msg = {
+ .channel = dsi->channel,
+ .tx_buf = payload,
+ .tx_len = size,
+ .type = type,
+ };
+ ssize_t ret;
+
+ if (ctx->accum_err)
+ return 0;
+
+ ret = mipi_dsi_device_transfer(dsi, &msg);
+ if (ret < 0) {
+ ctx->accum_err = ret;
+ dev_err(&dsi->dev, "sending generic data %*ph failed: %zd\n",
+ (int)size, payload, ret);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL(mipi_dsi_generic_write_raw_multi);
+
/**
* mipi_dsi_generic_read() - receive data using a generic read packet
* @dsi: DSI peripheral device
* @params: buffer containing the request parameters
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 71d121aeef24..fb23f4e3b94e 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -287,8 +287,10 @@ ssize_t mipi_dsi_generic_write(struct
mipi_dsi_device *dsi, const void *payload,
int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi,
const void *payload, size_t size);
void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx,
const void *payload, size_t size);
+ssize_t mipi_dsi_generic_write_raw_multi(struct
mipi_dsi_multi_context *ctx, u8 type,
+ const void *payload, size_t size);
ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const
void *params,
size_t num_params, void *data, size_t size);
#define mipi_dsi_msleep(ctx, delay) \
@@ -432,8 +434,22 @@ void mipi_dsi_dcs_set_tear_on_multi(struct
mipi_dsi_multi_context *ctx,
static const u8 d[] = { cmd, seq }; \
mipi_dsi_dcs_write_buffer_multi(ctx, d, ARRAY_SIZE(d)); \
} while (0)
+/**
+ * mipi_dsi_dcs_write_long_multi - transmit a DCS long command with
payload
+ * @ctx: Context for multiple DSI transactions
+ * @cmd: Commands
+ * @seq: buffer containing data to be transmitted
+ */
+#define mipi_dsi_dcs_write_long_multi(ctx, cmd,
seq...) \
+ do { \
+ static const u8 d[] = { cmd, seq }; \
+ mipi_dsi_generic_write_raw_multi(ctx, \
+ MIPI_DSI_DCS_LONG_WRITE, \
+ d, ARRAY_SIZE(d)); \
+ } while (0)
+
/**
* struct mipi_dsi_driver - DSI driver
* @driver: device driver model driver
* @probe: callback for device binding
--
2.45.0