Skip to contentSkip to conversation

drm/bridge/synopsys: dsi: Add fix & warning in dsi_host_transfer()

PATCH Applied Philippe Cornu 3 participants 8 messages Jan 25, 2018 – Jan 30, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover drm/bridge/synopsys: dsi: Add fix & warning in dsi_host_transfer()

Add a fix & a warning in the dsi_host_transfer().

Version 2:
- Simplify the 2 patches following comments from Brian Norris.
- Swap the 2 patches as the return value is only on tx and in case of rx requests the warning is there.

Version 1:
- Initial commit

Philippe Cornu (2):
drm/bridge/synopsys: dsi: Add a warning msg on dsi read requests drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value

 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Signature · 1 line
2.15.1
#1 lore raw

PATCH v2 1/2 drm/bridge/synopsys: dsi: Add a warning msg on dsi read requests

The dcs/generic dsi read feature is not yet implemented so it is important to warn the host_transfer() caller in case of read operation requests.

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6 -0
index daec7881be6d..72ecaeb40822 100644
@@ -405,6 +405,12 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
 	struct mipi_dsi_packet packet;
 	int ret;
 
+	if (msg->rx_buf || msg->rx_len) {
+		/* TODO dw drv improvements: implement read feature */
+		dev_warn(dsi->dev, "read operations not yet implemented\n");
+		return -EINVAL;
+	}
+
 	ret = mipi_dsi_create_packet(&packet, msg);
 	if (ret) {
 		dev_err(dsi->dev, "failed to create packet: %d\n", ret);
Signature · 1 line
2.15.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] drm/bridge/synopsys: dsi: Add a warning msg on dsi read requests

Quoted 5 lines · Philippe Cornu

The dcs/generic dsi read feature is not yet implemented so it is important to warn the host_transfer() caller in case of read operation requests.

Awesome, thanks.

Quoted 24 lines
---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6 -0
index daec7881be6d..72ecaeb40822 100644
@@ -405,6 +405,12 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
 	struct mipi_dsi_packet packet;
 	int ret;
 
+	if (msg->rx_buf || msg->rx_len) {
+		/* TODO dw drv improvements: implement read feature */
+		dev_warn(dsi->dev, "read operations not yet implemented\n");
+		return -EINVAL;
+	}
+
 	ret = mipi_dsi_create_packet(&packet, msg);
 	if (ret) {
 		dev_err(dsi->dev, "failed to create packet: %d\n", ret);
Signature · 1 line
2.15.1
#3 lore raw

Re: [PATCH v2 1/2] drm/bridge/synopsys: dsi: Add a warning msg on dsi read requests

Quoted 11 lines · Brian Norris
Quoted 5 lines · Philippe Cornu

The dcs/generic dsi read feature is not yet implemented so it is important to warn the host_transfer() caller in case of read operation requests.

Awesome, thanks.

Queued to drm-misc-next.

Thanks,
Archit

Quoted 24 lines
Quoted 24 lines
---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6 -0
index daec7881be6d..72ecaeb40822 100644
@@ -405,6 +405,12 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
  	struct mipi_dsi_packet packet;
  	int ret;
 
+	if (msg->rx_buf || msg->rx_len) {
+		/* TODO dw drv improvements: implement read feature */
+		dev_warn(dsi->dev, "read operations not yet implemented\n");
+		return -EINVAL;
+	}
+
  	ret = mipi_dsi_create_packet(&packet, msg);
  	if (ret) {
  		dev_err(dsi->dev, "failed to create packet: %d\n", ret);
Signature · 1 line
2.15.1
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

Re: [PATCH v2 1/2] drm/bridge/synopsys: dsi: Add a warning msg on dsi read requests

Hi Archit,

And many thanks,
Philippe :-)

Quoted 46 lines · Archit Taneja
Quoted 11 lines · Brian Norris
Quoted 5 lines · Philippe Cornu

The dcs/generic dsi read feature is not yet implemented so it is important to warn the host_transfer() caller in case of read operation requests.

Awesome, thanks.

Queued to drm-misc-next.

Thanks,
Archit

Quoted 25 lines
Quoted 25 lines

---
? drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++ ? 1 file changed, 6 insertions(+)

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6 -0
index daec7881be6d..72ecaeb40822 100644
@@ -405,6 +405,12 @@ static ssize_t dw_mipi_dsi_host_transfer(struct 
 mipi_dsi_host *host,
 ????? struct mipi_dsi_packet packet;
 ????? int ret;
+??? if (msg->rx_buf || msg->rx_len) {
+??????? /* TODO dw drv improvements: implement read feature */
+??????? dev_warn(dsi->dev, "read operations not yet implemented\n");
+??????? return -EINVAL;
+??? }
+
 ????? ret = mipi_dsi_create_packet(&packet, msg);
 ????? if (ret) {
 ????????? dev_err(dsi->dev, "failed to create packet: %d\n", ret);
Signature · 1 line
2.15.1
#5 lore raw

PATCH v2 2/2 drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value

In reply to Philippe Cornu

The dw_mipi_dsi_host_transfer() must return the number of bytes transmitted/received on success instead of 0.
Note: As the read feature is not implemented, only the transmitted number of bytes is returned for the moment.

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +10 -1
index 72ecaeb40822..090bf62d1ea8 100644
@@ -419,7 +419,16 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
 
 	dw_mipi_message_config(dsi, msg);
 
-	return dw_mipi_dsi_write(dsi, &packet);
+	ret = dw_mipi_dsi_write(dsi, &packet);
+	if (ret)
+		return ret;
+
+	/*
+	 * TODO Only transmitted size is returned as actual driver does
+	 * not support dcs/generic reads. Please update return value when
+	 * delivering the read feature.
+	 */
+	return packet.size;
 }
 
 static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {
Signature · 1 line
2.15.1
Reviewed-by on v2 2/2
#6 lore raw

Re: [PATCH v2 2/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value

Quoted 6 lines · Philippe Cornu

The dw_mipi_dsi_host_transfer() must return the number of bytes transmitted/received on success instead of 0.
Note: As the read feature is not implemented, only the transmitted number of bytes is returned for the moment.

Assuming we're going with the current documented semantics (where we return # of TX bytes for writes), then:

I believe Archit was suggesting maybe changing that sometime, but that's no excuse for not matching documentation now.

Quoted 13 lines
---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -1
index 72ecaeb40822..090bf62d1ea8 100644
@@ -419,7 +419,16 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
 
 	dw_mipi_message_config(dsi, msg);
 
-	return dw_mipi_dsi_write(dsi, &packet);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, · line 431

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +10 -0
+	ret = dw_mipi_dsi_write(dsi, &packet);
+	if (ret)
+		return ret;
+
+	/*
+	 * TODO Only transmitted size is returned as actual driver does
+	 * not support dcs/generic reads. Please update return value when
+	 * delivering the read feature.
+	 */
+	return packet.size;

You're really holding my hand here, I see :) Thanks I guess.

Quoted 6 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
 }
 
 static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {
Signature · 1 line
2.15.1
#7 lore raw

Re: [PATCH v2 2/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value

Quoted 8 lines · Brian Norris
Quoted 6 lines · Philippe Cornu

The dw_mipi_dsi_host_transfer() must return the number of bytes transmitted/received on success instead of 0.
Note: As the read feature is not implemented, only the transmitted number of bytes is returned for the moment.

Quoted 7 lines

Assuming we're going with the current documented semantics (where we return # of TX bytes for writes), then:

I believe Archit was suggesting maybe changing that sometime, but that's no excuse for not matching documentation now.

Queued to drm-misc-next.

Thanks,
Archit

Quoted 33 lines
Quoted 14 lines
---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -1
index 72ecaeb40822..090bf62d1ea8 100644
@@ -419,7 +419,16 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
 
  	dw_mipi_message_config(dsi, msg);
 
-	return dw_mipi_dsi_write(dsi, &packet);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, · line 431

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +10 -0
+	ret = dw_mipi_dsi_write(dsi, &packet);
+	if (ret)
+		return ret;
+
+	/*
+	 * TODO Only transmitted size is returned as actual driver does
+	 * not support dcs/generic reads. Please update return value when
+	 * delivering the read feature.
+	 */
+	return packet.size;

You're really holding my hand here, I see :) Thanks I guess.

Quoted 6 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
  }
 
  static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {
Signature · 1 line
2.15.1
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project