Commit 3c523d7d authored by Thierry Reding's avatar Thierry Reding

drm/dsi: Use peripheral's channel for DCS commands

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: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 371c359f
...@@ -201,16 +201,15 @@ EXPORT_SYMBOL(mipi_dsi_detach); ...@@ -201,16 +201,15 @@ EXPORT_SYMBOL(mipi_dsi_detach);
/** /**
* mipi_dsi_dcs_write - send DCS write command * mipi_dsi_dcs_write - send DCS write command
* @dsi: DSI device * @dsi: DSI device
* @channel: virtual channel
* @data: pointer to the command followed by parameters * @data: pointer to the command followed by parameters
* @len: length of @data * @len: length of @data
*/ */
ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel, ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
const void *data, size_t len) size_t len)
{ {
const struct mipi_dsi_host_ops *ops = dsi->host->ops; const struct mipi_dsi_host_ops *ops = dsi->host->ops;
struct mipi_dsi_msg msg = { struct mipi_dsi_msg msg = {
.channel = channel, .channel = dsi->channel,
.tx_buf = data, .tx_buf = data,
.tx_len = len .tx_len = len
}; };
...@@ -239,19 +238,18 @@ EXPORT_SYMBOL(mipi_dsi_dcs_write); ...@@ -239,19 +238,18 @@ EXPORT_SYMBOL(mipi_dsi_dcs_write);
/** /**
* mipi_dsi_dcs_read - send DCS read request command * mipi_dsi_dcs_read - send DCS read request command
* @dsi: DSI device * @dsi: DSI device
* @channel: virtual channel
* @cmd: DCS read command * @cmd: DCS read command
* @data: pointer to read buffer * @data: pointer to read buffer
* @len: length of @data * @len: length of @data
* *
* Function returns number of read bytes or error code. * Function returns number of read bytes or error code.
*/ */
ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel, ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
u8 cmd, void *data, size_t len) size_t len)
{ {
const struct mipi_dsi_host_ops *ops = dsi->host->ops; const struct mipi_dsi_host_ops *ops = dsi->host->ops;
struct mipi_dsi_msg msg = { struct mipi_dsi_msg msg = {
.channel = channel, .channel = dsi->channel,
.type = MIPI_DSI_DCS_READ, .type = MIPI_DSI_DCS_READ,
.tx_buf = &cmd, .tx_buf = &cmd,
.tx_len = 1, .tx_len = 1,
......
...@@ -138,7 +138,7 @@ static void s6e8aa0_dcs_write(struct s6e8aa0 *ctx, const void *data, size_t len) ...@@ -138,7 +138,7 @@ static void s6e8aa0_dcs_write(struct s6e8aa0 *ctx, const void *data, size_t len)
if (ctx->error < 0) if (ctx->error < 0)
return; return;
ret = mipi_dsi_dcs_write(dsi, dsi->channel, data, len); ret = mipi_dsi_dcs_write(dsi, data, len);
if (ret < 0) { if (ret < 0) {
dev_err(ctx->dev, "error %zd writing dcs seq: %*ph\n", ret, len, dev_err(ctx->dev, "error %zd writing dcs seq: %*ph\n", ret, len,
data); data);
...@@ -154,7 +154,7 @@ static int s6e8aa0_dcs_read(struct s6e8aa0 *ctx, u8 cmd, void *data, size_t len) ...@@ -154,7 +154,7 @@ static int s6e8aa0_dcs_read(struct s6e8aa0 *ctx, u8 cmd, void *data, size_t len)
if (ctx->error < 0) if (ctx->error < 0)
return ctx->error; 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) { if (ret < 0) {
dev_err(ctx->dev, "error %d reading dcs seq(%#x)\n", ret, cmd); dev_err(ctx->dev, "error %d reading dcs seq(%#x)\n", ret, cmd);
ctx->error = ret; ctx->error = ret;
......
...@@ -127,10 +127,10 @@ struct mipi_dsi_device { ...@@ -127,10 +127,10 @@ struct mipi_dsi_device {
int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_attach(struct mipi_dsi_device *dsi);
int mipi_dsi_detach(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, ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
const void *data, size_t len); size_t len);
ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel, ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
u8 cmd, void *data, size_t len); size_t len);
/** /**
* struct mipi_dsi_driver - DSI driver * struct mipi_dsi_driver - DSI driver
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment