drm/dsi: Use peripheral's channel for DCS commands
authorThierry Reding <treding@nvidia.com>
Mon, 21 Jul 2014 10:28:25 +0000 (12:28 +0200)
committerThierry Reding <treding@nvidia.com>
Tue, 22 Jul 2014 07:06:32 +0000 (09:06 +0200)
When executing DCS commands, use the channel associated with the DSI
peripheral rather than one explicitly specified in the function call.
Devices shouldn't be able to step on each others' toes like this.

Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/drm_mipi_dsi.c
drivers/gpu/drm/panel/panel-s6e8aa0.c
include/drm/drm_mipi_dsi.h

index 6d2fd2077daef0f9a83b73a7aa75d29a500a1721..6aa6a9e95570690360d191953d1566ad55227809 100644 (file)
@@ -201,16 +201,15 @@ EXPORT_SYMBOL(mipi_dsi_detach);
 /**
  * mipi_dsi_dcs_write - send DCS write command
  * @dsi: DSI device
- * @channel: virtual channel
  * @data: pointer to the command followed by parameters
  * @len: length of @data
  */
-ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel,
-                          const void *data, size_t len)
+ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
+                           size_t len)
 {
        const struct mipi_dsi_host_ops *ops = dsi->host->ops;
        struct mipi_dsi_msg msg = {
-               .channel = channel,
+               .channel = dsi->channel,
                .tx_buf = data,
                .tx_len = len
        };
@@ -239,19 +238,18 @@ EXPORT_SYMBOL(mipi_dsi_dcs_write);
 /**
  * mipi_dsi_dcs_read - send DCS read request command
  * @dsi: DSI device
- * @channel: virtual channel
  * @cmd: DCS read command
  * @data: pointer to read buffer
  * @len: length of @data
  *
  * Function returns number of read bytes or error code.
  */
-ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
-                         u8 cmd, void *data, size_t len)
+ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
+                         size_t len)
 {
        const struct mipi_dsi_host_ops *ops = dsi->host->ops;
        struct mipi_dsi_msg msg = {
-               .channel = channel,
+               .channel = dsi->channel,
                .type = MIPI_DSI_DCS_READ,
                .tx_buf = &cmd,
                .tx_len = 1,
index beb43492b6492c41735955617d7f21d087bd2fdd..5502ef6bc07464ba6c058e2f3cdf3d2661ab61c5 100644 (file)
@@ -138,7 +138,7 @@ static void s6e8aa0_dcs_write(struct s6e8aa0 *ctx, const void *data, size_t len)
        if (ctx->error < 0)
                return;
 
-       ret = mipi_dsi_dcs_write(dsi, dsi->channel, data, len);
+       ret = mipi_dsi_dcs_write(dsi, data, len);
        if (ret < 0) {
                dev_err(ctx->dev, "error %zd writing dcs seq: %*ph\n", ret, len,
                        data);
@@ -154,7 +154,7 @@ static int s6e8aa0_dcs_read(struct s6e8aa0 *ctx, u8 cmd, void *data, size_t len)
        if (ctx->error < 0)
                return ctx->error;
 
-       ret = mipi_dsi_dcs_read(dsi, dsi->channel, cmd, data, len);
+       ret = mipi_dsi_dcs_read(dsi, cmd, data, len);
        if (ret < 0) {
                dev_err(ctx->dev, "error %d reading dcs seq(%#x)\n", ret, cmd);
                ctx->error = ret;
index 4b01127819106d95725bad479702ea84a1b34be2..7b5e1a9244e156d16e37753ea1110b156362a629 100644 (file)
@@ -127,10 +127,10 @@ struct mipi_dsi_device {
 
 int mipi_dsi_attach(struct mipi_dsi_device *dsi);
 int mipi_dsi_detach(struct mipi_dsi_device *dsi);
-ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel,
-                          const void *data, size_t len);
-ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
-                         u8 cmd, void *data, size_t len);
+ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
+                           size_t len);
+ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
+                         size_t len);
 
 /**
  * struct mipi_dsi_driver - DSI driver