From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrzej Hajda Subject: Re: [PATCH 2/4] drm/dsi: Use peripheral's channel for DCS commands Date: Tue, 22 Jul 2014 09:30:08 +0200 Message-ID: <53CE1300.80109@samsung.com> References: <1406013141-18552-1-git-send-email-thierry.reding@gmail.com> <1406013141-18552-2-git-send-email-thierry.reding@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTP id DE4776E4B1 for ; Tue, 22 Jul 2014 00:30:38 -0700 (PDT) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9300JP3RII4W20@mailout2.w1.samsung.com> for dri-devel@lists.freedesktop.org; Tue, 22 Jul 2014 08:30:18 +0100 (BST) In-reply-to: <1406013141-18552-2-git-send-email-thierry.reding@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Thierry Reding Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 07/22/2014 09:12 AM, Thierry Reding wrote: > From: Thierry Reding > > 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. > > Signed-off-by: Thierry Reding There could be a problem with devices associated with more than one channel, but this is theoretical problem as for now, so: Acked-by: Andrzej Hajda Regards Andrzej > --- > drivers/gpu/drm/drm_mipi_dsi.c | 14 ++++++-------- > drivers/gpu/drm/panel/panel-s6e8aa0.c | 4 ++-- > include/drm/drm_mipi_dsi.h | 8 ++++---- > 3 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c > index 6d2fd2077dae..6aa6a9e95570 100644 > --- a/drivers/gpu/drm/drm_mipi_dsi.c > +++ b/drivers/gpu/drm/drm_mipi_dsi.c > @@ -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, > diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c > index beb43492b649..5502ef6bc074 100644 > --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c > +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c > @@ -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; > diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h > index 4b0112781910..7b5e1a9244e1 100644 > --- a/include/drm/drm_mipi_dsi.h > +++ b/include/drm/drm_mipi_dsi.h > @@ -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