Skip to contentSkip to conversation

drm: bridge: icn6211: Only warn on invalid chip IDs

PATCH In review Brandon Cheo Fusi 4 participants 7 messages Apr 18, 2023 – Apr 22, 2023

Subsystems (5)
lore
Share & tools
lore
maintainer
#1 lore raw
In reply to Brandon Cheo Fusi
Quoted 16 lines · Brandon Cheo Fusi

Avoid aborting chip configuration after reading invalid IDs and instead issue a warning. I have a bunch of these chips and they all report "Vendor=0x00 Device=0x00:0x00 Version=0x00" but are successfully configured and go on to work just fine.

---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +0 -0
index 0e37840cd..39de9a7c7 100644

drivers/gpu/drm/bridge/chipone-icn6211.c static void chipone_atomic_enable(struct drm_bridge *bridge, · line 364

Quoted 6 lines
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -2
@@ -361,8 +361,7 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
                id[0], id[1], id[2], id[3]);
 
        if (id[0] != 0xc1 || id[1] != 0x62 || id[2] != 0x11) {
-               dev_dbg(icn->dev, "Invalid Chip IDs, aborting configuration\n");
-               return;
+               dev_warn(icn->dev, "Invalid Chip IDs, configuration may fail\n");

Did you test I2C-Configured ICN6211 or non-I2C-Configured? if it's later then better to fix a valid ID for it or if it doesn't support ID then a handle via quirk would be a proper solution.

Jagan.

#2 lore raw
Quoted 20 lines · Jagan Teki
Quoted 18 lines · Brandon Cheo Fusi

Avoid aborting chip configuration after reading invalid IDs and instead issue a warning. I have a bunch of these chips and they all report "Vendor=0x00 Device=0x00:0x00 Version=0x00" but are successfully configured and go on to work just fine.

---
  drivers/gpu/drm/bridge/chipone-icn6211.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +0 -0
index 0e37840cd..39de9a7c7 100644
@@ -361,8 +361,7 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
                 id[0], id[1], id[2], id[3]);
 
Quoted 8 lines

drivers/gpu/drm/bridge/chipone-icn6211.c static void chipone_atomic_enable(struct drm_bridge *bridge, · line 364

Quoted 4 lines
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -2
         if (id[0] != 0xc1 || id[1] != 0x62 || id[2] != 0x11) {
-               dev_dbg(icn->dev, "Invalid Chip IDs, aborting configuration\n");
-               return;
+               dev_warn(icn->dev, "Invalid Chip IDs, configuration may fail\n");

Did you test I2C-Configured ICN6211 or non-I2C-Configured? if it's later then better to fix a valid ID for it or if it doesn't support ID then a handle via quirk would be a proper solution.

The ICN6211 should always be accessible via either option. If the ID readout does not work, the bug is likely in broken DSI command mode on whatever DSI host is used, or, the ICN6211 clock are misconfigured.

#4 lore raw

PATCH 2/3 drm: bridge: icn6211: Allow selection of video mode

In reply to Brandon Cheo Fusi

The DSI burst mode is more energy efficient than the DSI sync pulse mode, but doesn't always work with some DSI controllers (like sunxi's). Let the user specify the video mode as a dt property, like in
https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/167105/1/panel-bananapi-s070wv20-icn6211.c

---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 29 ++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +27 -2
index 39de9a7c7..ec720ca1b 100644
@@ -512,6 +512,7 @@ static int chipone_dsi_attach(struct chipone *icn)
 {
 	struct mipi_dsi_device *dsi = icn->dsi;
 	struct device *dev = icn->dev;
+	u32 video_mode;
 	int dsi_lanes, ret;
 
 	dsi_lanes = drm_of_get_data_lanes_count_ep(dev->of_node, 0, 0, 1, 4);
@@ -526,8 +527,32 @@ static int chipone_dsi_attach(struct chipone *icn)
 		icn->dsi->lanes = dsi_lanes;
 
 	dsi->format = MIPI_DSI_FMT_RGB888;
-	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM
+					| MIPI_DSI_MODE_NO_EOT_PACKET;
+	/*
+	 *	If the 'video-mode' property does not exist in DT or is invalid,
+	 *	default to non-burst mode with sync event
+	 */
+	ret = of_property_read_u32_index(dev->of_node, "video-mode", 0, &video_mode);
+	if (!ret) {
+		switch (video_mode) {
+		case 0:
+			/* burst mode */
+			dsi->mode_flags |= MIPI_DSI_MODE_VIDEO_BURST;
+			break;
+		case 1:
+			/* non-burst mode with sync pulse */
+			dsi->mode_flags |= MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
+			break;
+		case 2:
+			/* non-burst mode with sync event */
+			break;
+		default:
+			dev_warn(dev, "invalid video mode %d\n", video_mode);
+			break;
+		}
+	}
+
 	dsi->hs_rate = 500000000;
 	dsi->lp_rate = 16000000;
 
Signature · 1 line
2.30.2
#0 lore raw

PATCH 1/3 drm: bridge: icn6211: Only warn on invalid chip IDs

Avoid aborting chip configuration after reading invalid IDs and instead issue a warning. I have a bunch of these chips and they all report "Vendor=0x00 Device=0x00:0x00 Version=0x00" but are successfully configured and go on to work just fine.

---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -2
index 0e37840cd..39de9a7c7 100644
@@ -361,8 +361,7 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
 		id[0], id[1], id[2], id[3]);
 
 	if (id[0] != 0xc1 || id[1] != 0x62 || id[2] != 0x11) {
-		dev_dbg(icn->dev, "Invalid Chip IDs, aborting configuration\n");
-		return;
+		dev_warn(icn->dev, "Invalid Chip IDs, configuration may fail\n");
 	}
 
 	/* Get the DPI flags from the bridge state. */
Signature · 1 line
2.30.2
#5 lore raw

PATCH 3/3 dt-bindings: display: bridge: icn6211: Add video-mode property

Document the 'video-mode' property for specifying the DSI video mode and update the example.

---
 .../bindings/display/bridge/chipone,icn6211.yaml   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml +13 -1
index 5fb54375a..1f9335496 100644
@@ -36,6 +36,16 @@ properties:
   enable-gpios:
     description: Bridge EN pin, chip is reset when EN is low.
 
+  video-mode:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2 ]
+    description:
+      DSI video mode.
+      0 - burst mode
+      1 - non-burst mode with sync pulse
+      2 - non-burst mode with sync event.
+      Defaults to 2.
+
   vdd1-supply:
     description: A 1.8V/2.5V/3.3V supply that power the MIPI RX.
 
@@ -97,7 +107,8 @@ examples:
       bridge@0 {
         compatible = "chipone,icn6211";
         reg = <0>;
-        enable-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+        enable-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>;
+        video-mode = <0>;
 
         ports {
           #address-cells = <1>;
@@ -107,6 +118,7 @@ examples:
             reg = <0>;
 
             bridge_in_dsi: endpoint {
+              data-lanes = <1 2 3 4>;
               remote-endpoint = <&dsi_out_bridge>;
             };
           };
Signature · 1 line
2.30.2
#6 lore raw

Re: [PATCH 3/3] dt-bindings: display: bridge: icn6211: Add video-mode property

Quoted 4 lines · Brandon Cheo Fusi

Document the 'video-mode' property for specifying the DSI video mode and update the example.

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

No tests will be run here as you ignored DT list (and other entries).

Please resend.

Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml properties: · line 39

Quoted 13 lines
---
 .../bindings/display/bridge/chipone,icn6211.yaml   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml +1 -0
index 5fb54375a..1f9335496 100644
@@ -36,6 +36,16 @@ properties:
   enable-gpios:
     description: Bridge EN pin, chip is reset when EN is low.
 
+  video-mode:

Is it a common property? Lack of vendor prefix suggests it, so where does it come from?

Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml properties: · line 46

Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml +7 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2 ]
+    description:
+      DSI video mode.
+      0 - burst mode
+      1 - non-burst mode with sync pulse
+      2 - non-burst mode with sync event.

Why not string?

Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml properties: · line 47

Quoted 1 line
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml +1 -0
+      Defaults to 2.

default:
Don't repeat constraints in free form text.

Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml examples: · line 110

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml +2 -1
+
   vdd1-supply:
     description: A 1.8V/2.5V/3.3V supply that power the MIPI RX.
 
@@ -97,7 +107,8 @@ examples:
       bridge@0 {
         compatible = "chipone,icn6211";
         reg = <0>;
-        enable-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+        enable-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>;

Drop unrelated changes.

Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml examples: · line 124

Quoted 12 lines
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml +2 -0
+        video-mode = <0>;
 
         ports {
           #address-cells = <1>;
@@ -107,6 +118,7 @@ examples:
             reg = <0>;
 
             bridge_in_dsi: endpoint {
+              data-lanes = <1 2 3 4>;
               remote-endpoint = <&dsi_out_bridge>;
             };
           };

Best regards,
Krzysztof

maintainer
#3 lore raw
In reply to Marek Vasut

Hi Brandon,

Quoted 31 lines · Marek Vasut
Quoted 20 lines · Jagan Teki
Quoted 18 lines · Brandon Cheo Fusi

Avoid aborting chip configuration after reading invalid IDs and instead issue a warning. I have a bunch of these chips and they all report "Vendor=0x00 Device=0x00:0x00 Version=0x00" but are successfully configured and go on to work just fine.

---
  drivers/gpu/drm/bridge/chipone-icn6211.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +0 -0
index 0e37840cd..39de9a7c7 100644
@@ -361,8 +361,7 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
                 id[0], id[1], id[2], id[3]);
 
Quoted 8 lines

drivers/gpu/drm/bridge/chipone-icn6211.c static void chipone_atomic_enable(struct drm_bridge *bridge, · line 364

Quoted 4 lines
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -2
         if (id[0] != 0xc1 || id[1] != 0x62 || id[2] != 0x11) {
-               dev_dbg(icn->dev, "Invalid Chip IDs, aborting configuration\n");
-               return;
+               dev_warn(icn->dev, "Invalid Chip IDs, configuration may fail\n");

Did you test I2C-Configured ICN6211 or non-I2C-Configured? if it's later then better to fix a valid ID for it or if it doesn't support ID then a handle via quirk would be a proper solution.

Quoted 3 lines

The ICN6211 should always be accessible via either option. If the ID readout does not work, the bug is likely in broken DSI command mode on whatever DSI host is used, or, the ICN6211 clock are misconfigured.

Look like Marek was correct, please check your DSI host->transfer support MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM if it is implemented then the readid would pass.

Jagan.