This patch series add support for W552946ABA panel. This panel is used in px30-evb v11. All the patches can be applied on top of drm-fixes branch. The last patch is suppose to fix a race when the panel is built in. Tested on px30 evb
Michael Trimarchi (5): dt-bindings: vendor-prefix: add Wanchanglong Electronics Technology drm/panel: ilitek-ili9881d: add support for Wanchanglong W552946ABA panel dt-bindings: ili9881c: add compatible string for Wanchanglong w552946aba drm/panel: ilitek-ili9881c: Make gpio-reset optional drm/bridge: dw-mipi-dsi: Fix dsi registration during drm probing
.../display/panel/ilitek,ili9881c.yaml | 2 +- .../devicetree/bindings/vendor-prefixes.yaml | 2 + drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 240 +++++++++++++++++- .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 12 +- include/drm/bridge/dw_mipi_dsi.h | 2 +- 6 files changed, 257 insertions(+), 9 deletions(-)
Wanchanglong Electronics Technology is a company to provide LCD modules.
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index a867f7102c35..5c43391d8c3d 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1304,6 +1304,8 @@ patternProperties: description: Wondermedia Technologies, Inc. "^wobo,.*": description: Wobo + "^wanchanglong,.*": + description: Wanchanglong Electronics Technology(SHENZHEN)Co.,Ltd. "^x-powers,.*": description: X-Powers "^xes,.*":
W552946ABA is a panel by Wanchanglong. This panel utilizes the Ilitek ILI9881D controller.
Add this panel's initialzation sequence and timing to ILI9881D driver. Tested on px30-evb v11
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com --- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 238 +++++++++++++++++- 1 file changed, 237 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c index 0145129d7c66..d1f20758ed08 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c @@ -42,6 +42,7 @@ struct ili9881c_desc { const struct ili9881c_instr *init; const size_t init_length; const struct drm_display_mode *mode; + const unsigned long mode_flags; };
struct ili9881c { @@ -453,6 +454,213 @@ static const struct ili9881c_instr k101_im2byl02_init[] = { ILI9881C_COMMAND_INSTR(0xD3, 0x3F), /* VN0 */ };
+static const struct ili9881c_instr w552946ab_init[] = { + ILI9881C_SWITCH_PAGE_INSTR(3), + ILI9881C_COMMAND_INSTR(0x01, 0x00), + ILI9881C_COMMAND_INSTR(0x02, 0x00), + ILI9881C_COMMAND_INSTR(0x03, 0x53), + ILI9881C_COMMAND_INSTR(0x04, 0x53), + ILI9881C_COMMAND_INSTR(0x05, 0x13), + ILI9881C_COMMAND_INSTR(0x06, 0x04), + ILI9881C_COMMAND_INSTR(0x07, 0x02), + ILI9881C_COMMAND_INSTR(0x08, 0x02), + ILI9881C_COMMAND_INSTR(0x09, 0x00), + ILI9881C_COMMAND_INSTR(0x0A, 0x00), + ILI9881C_COMMAND_INSTR(0x0B, 0x00), + ILI9881C_COMMAND_INSTR(0x0C, 0x00), + ILI9881C_COMMAND_INSTR(0x0D, 0x00), + ILI9881C_COMMAND_INSTR(0x0E, 0x00), + ILI9881C_COMMAND_INSTR(0x0F, 0x00), + + ILI9881C_COMMAND_INSTR(0x10, 0x00), + ILI9881C_COMMAND_INSTR(0x11, 0x00), + ILI9881C_COMMAND_INSTR(0x12, 0x00), + ILI9881C_COMMAND_INSTR(0x13, 0x00), + ILI9881C_COMMAND_INSTR(0x14, 0x00), + ILI9881C_COMMAND_INSTR(0x15, 0x08), + ILI9881C_COMMAND_INSTR(0x16, 0x10), + ILI9881C_COMMAND_INSTR(0x17, 0x00), + ILI9881C_COMMAND_INSTR(0x18, 0x08), + ILI9881C_COMMAND_INSTR(0x19, 0x00), + ILI9881C_COMMAND_INSTR(0x1A, 0x00), + ILI9881C_COMMAND_INSTR(0x1B, 0x00), + ILI9881C_COMMAND_INSTR(0x1C, 0x00), + ILI9881C_COMMAND_INSTR(0x1D, 0x00), + ILI9881C_COMMAND_INSTR(0x1E, 0xC0), + ILI9881C_COMMAND_INSTR(0x1F, 0x80), + + ILI9881C_COMMAND_INSTR(0x20, 0x02), + ILI9881C_COMMAND_INSTR(0x21, 0x09), + ILI9881C_COMMAND_INSTR(0x22, 0x00), + ILI9881C_COMMAND_INSTR(0x23, 0x00), + ILI9881C_COMMAND_INSTR(0x24, 0x00), + ILI9881C_COMMAND_INSTR(0x25, 0x00), + ILI9881C_COMMAND_INSTR(0x26, 0x00), + ILI9881C_COMMAND_INSTR(0x27, 0x00), + ILI9881C_COMMAND_INSTR(0x28, 0x55), + ILI9881C_COMMAND_INSTR(0x29, 0x03), + ILI9881C_COMMAND_INSTR(0x2A, 0x00), + ILI9881C_COMMAND_INSTR(0x2B, 0x00), + ILI9881C_COMMAND_INSTR(0x2C, 0x00), + ILI9881C_COMMAND_INSTR(0x2D, 0x00), + ILI9881C_COMMAND_INSTR(0x2E, 0x00), + ILI9881C_COMMAND_INSTR(0x2F, 0x00), + + ILI9881C_COMMAND_INSTR(0x30, 0x00), + ILI9881C_COMMAND_INSTR(0x31, 0x00), + ILI9881C_COMMAND_INSTR(0x32, 0x00), + ILI9881C_COMMAND_INSTR(0x33, 0x00), + ILI9881C_COMMAND_INSTR(0x34, 0x04), + ILI9881C_COMMAND_INSTR(0x35, 0x05), + ILI9881C_COMMAND_INSTR(0x36, 0x05), + ILI9881C_COMMAND_INSTR(0x37, 0x00), + ILI9881C_COMMAND_INSTR(0x38, 0x3C), + ILI9881C_COMMAND_INSTR(0x39, 0x35), + ILI9881C_COMMAND_INSTR(0x3A, 0x00), + ILI9881C_COMMAND_INSTR(0x3B, 0x40), + ILI9881C_COMMAND_INSTR(0x3C, 0x00), + ILI9881C_COMMAND_INSTR(0x3D, 0x00), + ILI9881C_COMMAND_INSTR(0x3E, 0x00), + ILI9881C_COMMAND_INSTR(0x3F, 0x00), + + ILI9881C_COMMAND_INSTR(0x40, 0x00), + ILI9881C_COMMAND_INSTR(0x41, 0x88), + ILI9881C_COMMAND_INSTR(0x42, 0x00), + ILI9881C_COMMAND_INSTR(0x43, 0x00), + ILI9881C_COMMAND_INSTR(0x44, 0x1F), + + ILI9881C_COMMAND_INSTR(0x50, 0x01), + ILI9881C_COMMAND_INSTR(0x51, 0x23), + ILI9881C_COMMAND_INSTR(0x52, 0x45), + ILI9881C_COMMAND_INSTR(0x53, 0x67), + ILI9881C_COMMAND_INSTR(0x54, 0x89), + ILI9881C_COMMAND_INSTR(0x55, 0xaB), + ILI9881C_COMMAND_INSTR(0x56, 0x01), + ILI9881C_COMMAND_INSTR(0x57, 0x23), + ILI9881C_COMMAND_INSTR(0x58, 0x45), + ILI9881C_COMMAND_INSTR(0x59, 0x67), + ILI9881C_COMMAND_INSTR(0x5A, 0x89), + ILI9881C_COMMAND_INSTR(0x5B, 0xAB), + ILI9881C_COMMAND_INSTR(0x5C, 0xCD), + ILI9881C_COMMAND_INSTR(0x5D, 0xEF), + ILI9881C_COMMAND_INSTR(0x5E, 0x03), + ILI9881C_COMMAND_INSTR(0x5F, 0x14), + + ILI9881C_COMMAND_INSTR(0x60, 0x15), + ILI9881C_COMMAND_INSTR(0x61, 0x0C), + ILI9881C_COMMAND_INSTR(0x62, 0x0D), + ILI9881C_COMMAND_INSTR(0x63, 0x0E), + ILI9881C_COMMAND_INSTR(0x64, 0x0F), + ILI9881C_COMMAND_INSTR(0x65, 0x10), + ILI9881C_COMMAND_INSTR(0x66, 0x11), + ILI9881C_COMMAND_INSTR(0x67, 0x08), + ILI9881C_COMMAND_INSTR(0x68, 0x02), + ILI9881C_COMMAND_INSTR(0x69, 0x0A), + ILI9881C_COMMAND_INSTR(0x6A, 0x02), + ILI9881C_COMMAND_INSTR(0x6B, 0x02), + ILI9881C_COMMAND_INSTR(0x6C, 0x02), + ILI9881C_COMMAND_INSTR(0x6D, 0x02), + ILI9881C_COMMAND_INSTR(0x6E, 0x02), + ILI9881C_COMMAND_INSTR(0x6F, 0x02), + + ILI9881C_COMMAND_INSTR(0x70, 0x02), + ILI9881C_COMMAND_INSTR(0x71, 0x02), + ILI9881C_COMMAND_INSTR(0x72, 0x06), + ILI9881C_COMMAND_INSTR(0x73, 0x02), + ILI9881C_COMMAND_INSTR(0x74, 0x02), + ILI9881C_COMMAND_INSTR(0x75, 0x14), + ILI9881C_COMMAND_INSTR(0x76, 0x15), + ILI9881C_COMMAND_INSTR(0x77, 0x0F), + ILI9881C_COMMAND_INSTR(0x78, 0x0E), + ILI9881C_COMMAND_INSTR(0x79, 0x0D), + ILI9881C_COMMAND_INSTR(0x7A, 0x0C), + ILI9881C_COMMAND_INSTR(0x7B, 0x11), + ILI9881C_COMMAND_INSTR(0x7C, 0x10), + ILI9881C_COMMAND_INSTR(0x7D, 0x06), + ILI9881C_COMMAND_INSTR(0x7E, 0x02), + ILI9881C_COMMAND_INSTR(0x7F, 0x0A), + + ILI9881C_COMMAND_INSTR(0x80, 0x02), + ILI9881C_COMMAND_INSTR(0x81, 0x02), + ILI9881C_COMMAND_INSTR(0x82, 0x02), + ILI9881C_COMMAND_INSTR(0x83, 0x02), + ILI9881C_COMMAND_INSTR(0x84, 0x02), + ILI9881C_COMMAND_INSTR(0x85, 0x02), + ILI9881C_COMMAND_INSTR(0x86, 0x02), + ILI9881C_COMMAND_INSTR(0x87, 0x02), + ILI9881C_COMMAND_INSTR(0x88, 0x08), + ILI9881C_COMMAND_INSTR(0x89, 0x02), + ILI9881C_COMMAND_INSTR(0x8A, 0x02), + + ILI9881C_SWITCH_PAGE_INSTR(4), + ILI9881C_COMMAND_INSTR(0x00, 0x80), + ILI9881C_COMMAND_INSTR(0x70, 0x00), + ILI9881C_COMMAND_INSTR(0x71, 0x00), + ILI9881C_COMMAND_INSTR(0x66, 0xFE), + ILI9881C_COMMAND_INSTR(0x82, 0x15), + ILI9881C_COMMAND_INSTR(0x84, 0x15), + ILI9881C_COMMAND_INSTR(0x85, 0x15), + ILI9881C_COMMAND_INSTR(0x3a, 0x24), + ILI9881C_COMMAND_INSTR(0x32, 0xAC), + ILI9881C_COMMAND_INSTR(0x8C, 0x80), + ILI9881C_COMMAND_INSTR(0x3C, 0xF5), + ILI9881C_COMMAND_INSTR(0x88, 0x33), + + ILI9881C_SWITCH_PAGE_INSTR(1), + ILI9881C_COMMAND_INSTR(0x22, 0x0A), + ILI9881C_COMMAND_INSTR(0x31, 0x00), + ILI9881C_COMMAND_INSTR(0x53, 0x78), + ILI9881C_COMMAND_INSTR(0x50, 0x5B), + ILI9881C_COMMAND_INSTR(0x51, 0x5B), + ILI9881C_COMMAND_INSTR(0x60, 0x20), + ILI9881C_COMMAND_INSTR(0x61, 0x00), + ILI9881C_COMMAND_INSTR(0x62, 0x0D), + ILI9881C_COMMAND_INSTR(0x63, 0x00), + + ILI9881C_COMMAND_INSTR(0xA0, 0x00), + ILI9881C_COMMAND_INSTR(0xA1, 0x10), + ILI9881C_COMMAND_INSTR(0xA2, 0x1C), + ILI9881C_COMMAND_INSTR(0xA3, 0x13), + ILI9881C_COMMAND_INSTR(0xA4, 0x15), + ILI9881C_COMMAND_INSTR(0xA5, 0x26), + ILI9881C_COMMAND_INSTR(0xA6, 0x1A), + ILI9881C_COMMAND_INSTR(0xA7, 0x1D), + ILI9881C_COMMAND_INSTR(0xA8, 0x67), + ILI9881C_COMMAND_INSTR(0xA9, 0x1C), + ILI9881C_COMMAND_INSTR(0xAA, 0x29), + ILI9881C_COMMAND_INSTR(0xAB, 0x5B), + ILI9881C_COMMAND_INSTR(0xAC, 0x26), + ILI9881C_COMMAND_INSTR(0xAD, 0x28), + ILI9881C_COMMAND_INSTR(0xAE, 0x5C), + ILI9881C_COMMAND_INSTR(0xAF, 0x30), + ILI9881C_COMMAND_INSTR(0xB0, 0x31), + ILI9881C_COMMAND_INSTR(0xB1, 0x2E), + ILI9881C_COMMAND_INSTR(0xB2, 0x32), + ILI9881C_COMMAND_INSTR(0xB3, 0x00), + + ILI9881C_COMMAND_INSTR(0xC0, 0x00), + ILI9881C_COMMAND_INSTR(0xC1, 0x10), + ILI9881C_COMMAND_INSTR(0xC2, 0x1C), + ILI9881C_COMMAND_INSTR(0xC3, 0x13), + ILI9881C_COMMAND_INSTR(0xC4, 0x15), + ILI9881C_COMMAND_INSTR(0xC5, 0x26), + ILI9881C_COMMAND_INSTR(0xC6, 0x1A), + ILI9881C_COMMAND_INSTR(0xC7, 0x1D), + ILI9881C_COMMAND_INSTR(0xC8, 0x67), + ILI9881C_COMMAND_INSTR(0xC9, 0x1C), + ILI9881C_COMMAND_INSTR(0xCA, 0x29), + ILI9881C_COMMAND_INSTR(0xCB, 0x5B), + ILI9881C_COMMAND_INSTR(0xCC, 0x26), + ILI9881C_COMMAND_INSTR(0xCD, 0x28), + ILI9881C_COMMAND_INSTR(0xCE, 0x5C), + ILI9881C_COMMAND_INSTR(0xCF, 0x30), + ILI9881C_COMMAND_INSTR(0xD0, 0x31), + ILI9881C_COMMAND_INSTR(0xD1, 0x2E), + ILI9881C_COMMAND_INSTR(0xD2, 0x32), + ILI9881C_COMMAND_INSTR(0xD3, 0x00), + ILI9881C_SWITCH_PAGE_INSTR(0), +}; + static inline struct ili9881c *panel_to_ili9881c(struct drm_panel *panel) { return container_of(panel, struct ili9881c, panel); @@ -603,6 +811,23 @@ static const struct drm_display_mode k101_im2byl02_default_mode = { .height_mm = 217, };
+static const struct drm_display_mode w552946aba_default_mode = { + .clock = 64000, + + .hdisplay = 720, + .hsync_start = 720 + 40, + .hsync_end = 720 + 40 + 10, + .htotal = 720 + 40 + 10 + 40, + + .vdisplay = 1280, + .vsync_start = 1280 + 22, + .vsync_end = 1280 + 22 + 4, + .vtotal = 1280 + 22 + 4 + 11, + + .width_mm = 68, + .height_mm = 121, +}; + static int ili9881c_get_modes(struct drm_panel *panel, struct drm_connector *connector) { @@ -670,7 +895,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
drm_panel_add(&ctx->panel);
- dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE; + dsi->mode_flags = ctx->desc->mode_flags; dsi->format = MIPI_DSI_FMT_RGB888; dsi->lanes = 4;
@@ -691,17 +916,28 @@ static const struct ili9881c_desc lhr050h41_desc = { .init = lhr050h41_init, .init_length = ARRAY_SIZE(lhr050h41_init), .mode = &lhr050h41_default_mode, + .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE, };
static const struct ili9881c_desc k101_im2byl02_desc = { .init = k101_im2byl02_init, .init_length = ARRAY_SIZE(k101_im2byl02_init), .mode = &k101_im2byl02_default_mode, + .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE, +}; + +static const struct ili9881c_desc w552946aba_desc = { + .init = w552946ab_init, + .init_length = ARRAY_SIZE(w552946ab_init), + .mode = &w552946aba_default_mode, + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET, };
static const struct of_device_id ili9881c_of_match[] = { { .compatible = "bananapi,lhr050h41", .data = &lhr050h41_desc }, { .compatible = "feixin,k101-im2byl02", .data = &k101_im2byl02_desc }, + { .compatible = "wanchanglong,w552946aba", .data = &w552946aba_desc }, { } }; MODULE_DEVICE_TABLE(of, ili9881c_of_match);
It utilizes an Ilitek ILI9881D controller chip, but its compatible with ili9881c so should be added to ilitek,ili9881c file.
Add the compatible string for it.
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com --- .../devicetree/bindings/display/panel/ilitek,ili9881c.yaml | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml index b2fcec4f22fd..2d4a5643a785 100644 --- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml +++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml @@ -15,6 +15,7 @@ properties: - enum: - bananapi,lhr050h41 - feixin,k101-im2byl02 + - wanchanglong,w552946aba - const: ilitek,ili9881c
backlight: true
Depends in how logic is connected to the board the gpio is not stricly required.
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com --- .../devicetree/bindings/display/panel/ilitek,ili9881c.yaml | 1 - drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml index 2d4a5643a785..07789d554889 100644 --- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml +++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml @@ -27,7 +27,6 @@ required: - compatible - power-supply - reg - - reset-gpios
additionalProperties: false
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c index d1f20758ed08..103a16018975 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c @@ -883,7 +883,7 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi) return PTR_ERR(ctx->power); }
- ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); + ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ctx->reset)) { dev_err(&dsi->dev, "Couldn't get our reset GPIO\n"); return PTR_ERR(ctx->reset);
The dsi registration is implemented in rockchip platform driver. The attach can be called before the probe is terminated and therefore we need to be sure that corresponding entry during attach is valid
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +++++++- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 12 ++++++++---- include/drm/bridge/dw_mipi_dsi.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index e44e18a0112a..44b211be15fc 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -362,8 +362,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->device_found = true; }
+ /* + * NOTE: the dsi registration is implemented in + * platform driver, that to say dsi would be exist after + * probe is terminated. The call is done before the end of probe + * so we need to pass the dsi to the platform driver. + */ if (pdata->host_ops && pdata->host_ops->attach) { - ret = pdata->host_ops->attach(pdata->priv_data, device); + ret = pdata->host_ops->attach(pdata->priv_data, device, dsi); if (ret < 0) return ret; } diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index a2262bee5aa4..32ddc8642ec1 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -997,7 +997,8 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = { };
static int dw_mipi_dsi_rockchip_host_attach(void *priv_data, - struct mipi_dsi_device *device) + struct mipi_dsi_device *device, + struct dw_mipi_dsi *dmd) { struct dw_mipi_dsi_rockchip *dsi = priv_data; struct device *second; @@ -1005,6 +1006,8 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
mutex_lock(&dsi->usage_mutex);
+ dsi->dmd = dmd; + if (dsi->usage_mode != DW_DSI_USAGE_IDLE) { DRM_DEV_ERROR(dsi->dev, "dsi controller already in use\n"); mutex_unlock(&dsi->usage_mutex); @@ -1280,6 +1283,7 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; + struct dw_mipi_dsi *dmd; struct dw_mipi_dsi_rockchip *dsi; struct phy_provider *phy_provider; struct resource *res; @@ -1391,9 +1395,9 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) if (IS_ERR(phy_provider)) return PTR_ERR(phy_provider);
- dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); - if (IS_ERR(dsi->dmd)) { - ret = PTR_ERR(dsi->dmd); + dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); + if (IS_ERR(dmd)) { + ret = PTR_ERR(dmd); if (ret != -EPROBE_DEFER) DRM_DEV_ERROR(dev, "Failed to probe dw_mipi_dsi: %d\n", ret); diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index bda8aa7c2280..cf81f19806ad 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -41,7 +41,7 @@ struct dw_mipi_dsi_phy_ops {
struct dw_mipi_dsi_host_ops { int (*attach)(void *priv_data, - struct mipi_dsi_device *dsi); + struct mipi_dsi_device *dsi, struct dw_mipi_dsi *dmd); int (*detach)(void *priv_data, struct mipi_dsi_device *dsi); };
Hi Michael,
I fail to follow the logic in this patch.
On Sat, Oct 16, 2021 at 10:22:32AM +0000, Michael Trimarchi wrote:
The dsi registration is implemented in rockchip platform driver. The attach can be called before the probe is terminated and therefore we need to be sure that corresponding entry during attach is valid
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +++++++- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 12 ++++++++---- include/drm/bridge/dw_mipi_dsi.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index e44e18a0112a..44b211be15fc 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -362,8 +362,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->device_found = true; }
- /*
* NOTE: the dsi registration is implemented in
* platform driver, that to say dsi would be exist after
* probe is terminated. The call is done before the end of probe
* so we need to pass the dsi to the platform driver.
if (pdata->host_ops && pdata->host_ops->attach) {*/
ret = pdata->host_ops->attach(pdata->priv_data, device);
if (ret < 0) return ret; }ret = pdata->host_ops->attach(pdata->priv_data, device, dsi);
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index a2262bee5aa4..32ddc8642ec1 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -997,7 +997,8 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = { };
static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
struct mipi_dsi_device *device)
struct mipi_dsi_device *device,
struct dw_mipi_dsi *dmd)
{ struct dw_mipi_dsi_rockchip *dsi = priv_data; struct device *second; @@ -1005,6 +1006,8 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
mutex_lock(&dsi->usage_mutex);
- dsi->dmd = dmd;
- if (dsi->usage_mode != DW_DSI_USAGE_IDLE) { DRM_DEV_ERROR(dsi->dev, "dsi controller already in use\n"); mutex_unlock(&dsi->usage_mutex);
@@ -1280,6 +1283,7 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node;
- struct dw_mipi_dsi *dmd; struct dw_mipi_dsi_rockchip *dsi; struct phy_provider *phy_provider; struct resource *res;
@@ -1391,9 +1395,9 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) if (IS_ERR(phy_provider)) return PTR_ERR(phy_provider);
- dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata);
- if (IS_ERR(dsi->dmd)) {
ret = PTR_ERR(dsi->dmd);
- dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata);
- if (IS_ERR(dmd)) {
ret = PTR_ERR(dmd);
The memory pointed to by dmd is allocated in dw_mipi_dsi_probe(), but the pointer is not saved here. We rely on the attach operation to save the dmd pointer.
In other words - the attach operation must be called before we call dw_mipi_dsi_rockchip_remove(), which uses the dmd member.
This all looks wrong to me - are we papering over some other issue here?
Sam
Hi Sam
On Sat, Oct 16, 2021 at 2:25 PM Sam Ravnborg sam@ravnborg.org wrote:
Hi Michael,
I fail to follow the logic in this patch.
On Sat, Oct 16, 2021 at 10:22:32AM +0000, Michael Trimarchi wrote:
The dsi registration is implemented in rockchip platform driver. The attach can be called before the probe is terminated and therefore we need to be sure that corresponding entry during attach is valid
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +++++++- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 12 ++++++++---- include/drm/bridge/dw_mipi_dsi.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index e44e18a0112a..44b211be15fc 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -362,8 +362,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->device_found = true; }
/*
* NOTE: the dsi registration is implemented in
* platform driver, that to say dsi would be exist after
* probe is terminated. The call is done before the end of probe
* so we need to pass the dsi to the platform driver.
*/ if (pdata->host_ops && pdata->host_ops->attach) {
ret = pdata->host_ops->attach(pdata->priv_data, device);
ret = pdata->host_ops->attach(pdata->priv_data, device, dsi); if (ret < 0) return ret; }
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index a2262bee5aa4..32ddc8642ec1 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -997,7 +997,8 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = { };
static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
struct mipi_dsi_device *device)
struct mipi_dsi_device *device,
struct dw_mipi_dsi *dmd)
{ struct dw_mipi_dsi_rockchip *dsi = priv_data; struct device *second; @@ -1005,6 +1006,8 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
mutex_lock(&dsi->usage_mutex);
dsi->dmd = dmd;
if (dsi->usage_mode != DW_DSI_USAGE_IDLE) { DRM_DEV_ERROR(dsi->dev, "dsi controller already in use\n"); mutex_unlock(&dsi->usage_mutex);
@@ -1280,6 +1283,7 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node;
struct dw_mipi_dsi *dmd; struct dw_mipi_dsi_rockchip *dsi; struct phy_provider *phy_provider; struct resource *res;
@@ -1391,9 +1395,9 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) if (IS_ERR(phy_provider)) return PTR_ERR(phy_provider);
dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata);
if (IS_ERR(dsi->dmd)) {
ret = PTR_ERR(dsi->dmd);
dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata);
if (IS_ERR(dmd)) {
ret = PTR_ERR(dmd);
The memory pointed to by dmd is allocated in dw_mipi_dsi_probe(), but the pointer is not saved here. We rely on the attach operation to save the dmd pointer.
In other words - the attach operation must be called before we call dw_mipi_dsi_rockchip_remove(), which uses the dmd member.
This all looks wrong to me - are we papering over some other issue
Ok, it's wrong. I was not expecting that call.Anyway this was my path on linux-next
dw_mipi_dsi_rockchip_probe dw_mipi_dsi_probe -->start call
dw_mipi_dsi_rockchip_host_attach <-- this was not able to use dmd
dw_mipi_dsi_probe -> exit from the call
Michael
here?
Sam
Hi
Forget this one I can not replicate. We have another problem
9862.010474] Hardware name: Rockchip PX30 EVB (DT) [ 9862.015738] Call trace: [ 9862.018471] dump_backtrace+0x0/0x19c [ 9862.022586] show_stack+0x1c/0x70 [ 9862.026305] dump_stack_lvl+0x68/0x84 [ 9862.030408] dump_stack+0x1c/0x38 [ 9862.034125] ili9881c_unprepare+0x1c/0x4c [ 9862.038619] drm_panel_unprepare+0x2c/0x4c [ 9862.043212] panel_bridge_post_disable+0x18/0x24 [ 9862.048390] dw_mipi_dsi_bridge_post_disable+0x3c/0xf0 [ 9862.054153] drm_atomic_bridge_chain_post_disable+0x8c/0xd0 [ 9862.060399] disable_outputs+0x120/0x31c [ 9862.064785] drm_atomic_helper_commit_tail_rpm+0x28/0xa0 [ 9862.070734] commit_tail+0xa4/0x184 [ 9862.074642] drm_atomic_helper_commit+0x164/0x37c [ 9862.079902] drm_atomic_commit+0x50/0x60 [ 9862.084298] drm_atomic_helper_disable_all+0x1fc/0x210 [ 9862.090053] drm_atomic_helper_shutdown+0x80/0x130 [ 9862.095419] rockchip_drm_platform_shutdown+0x1c/0x30 [ 9862.101081] platform_shutdown+0x28/0x40 [ 9862.105477] device_shutdown+0x15c/0x330 [ 9862.109877] __do_sys_reboot+0x214/0x294 [ 9862.114273] __arm64_sys_reboot+0x28/0x3c [ 9862.118765] invoke_syscall+0x48/0x114 [ 9862.122969] el0_svc_common.constprop.0+0x44/0xec [ 9862.128241] do_el0_svc+0x28/0x90 [ 9862.131958] el0_svc+0x20/0x60 [ 9862.135381] el0t_64_sync_handler+0x1a8/0x1b0 [ 9862.140263] el0t_64_sync+0x1a0/0x1a4 [ 9862.145769] CPU: 0 PID: 1 Comm: systemd-shutdow Tainted: G W 5.15.0-rc5 #1 [ 9862.154957] Hardware name: Rockchip PX30 EVB (DT) [ 9862.160221] Call trace: [ 9862.162954] dump_backtrace+0x0/0x19c [ 9862.167068] show_stack+0x1c/0x70 [ 9862.170787] dump_stack_lvl+0x68/0x84 [ 9862.174895] dump_stack+0x1c/0x38 [ 9862.178611] ili9881c_unprepare+0x1c/0x4c [ 9862.183103] drm_panel_unprepare+0x2c/0x4c [ 9862.187695] panel_bridge_post_disable+0x18/0x24 [ 9862.192872] drm_atomic_bridge_chain_post_disable+0x8c/0xd0 [ 9862.199117] disable_outputs+0x120/0x31c [ 9862.203512] drm_atomic_helper_commit_tail_rpm+0x28/0xa0 [ 9862.209461] commit_tail+0xa4/0x184 [ 9862.213368] drm_atomic_helper_commit+0x164/0x37c [ 9862.218629] drm_atomic_commit+0x50/0x60 [ 9862.223025] drm_atomic_helper_disable_all+0x1fc/0x210 [ 9862.228781] drm_atomic_helper_shutdown+0x80/0x130 [ 9862.234147] rockchip_drm_platform_shutdown+0x1c/0x30 [ 9862.239810] platform_shutdown+0x28/0x40 [ 9862.244205] device_shutdown+0x15c/0x330 [ 9862.248603] __do_sys_reboot+0x214/0x294 [ 9862.253000] __arm64_sys_reboot+0x28/0x3c [ 9862.257492] invoke_syscall+0x48/0x114 [ 9862.261696] el0_svc_common.constprop.0+0x44/0xec [ 9862.266970] do_el0_svc+0x28/0x90 [ 9862.270687] el0_svc+0x20/0x60 [ 9862.274111] el0t_64_sync_handler+0x1a8/0x1b0 [ 9862.278992] el0t_64_sync+0x1a0/0x1a4 [ 9862.283296] ------------[ cut here ]------------ [ 9862.288490] unbalanced disables for vcc3v3_lcd [ 9862.293555] WARNING: CPU: 0 PID: 1 at drivers/regulator/core.c:2851 _regulator_disable+0xd4/0x190
The panel can be disable two times.
/* * TODO Only way found to call panel-bridge post_disable & * panel unprepare before the dsi "final" disable... * This needs to be fixed in the drm_bridge framework and the API * needs to be updated to manage our own call chains... */ if (dsi->panel_bridge->funcs->post_disable) dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
Is this comment relevant?
Michael
On Sat, Oct 16, 2021 at 3:32 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Hi Sam
On Sat, Oct 16, 2021 at 2:25 PM Sam Ravnborg sam@ravnborg.org wrote:
Hi Michael,
I fail to follow the logic in this patch.
On Sat, Oct 16, 2021 at 10:22:32AM +0000, Michael Trimarchi wrote:
The dsi registration is implemented in rockchip platform driver. The attach can be called before the probe is terminated and therefore we need to be sure that corresponding entry during attach is valid
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 +++++++- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 12 ++++++++---- include/drm/bridge/dw_mipi_dsi.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index e44e18a0112a..44b211be15fc 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -362,8 +362,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, dsi->device_found = true; }
/*
* NOTE: the dsi registration is implemented in
* platform driver, that to say dsi would be exist after
* probe is terminated. The call is done before the end of probe
* so we need to pass the dsi to the platform driver.
*/ if (pdata->host_ops && pdata->host_ops->attach) {
ret = pdata->host_ops->attach(pdata->priv_data, device);
ret = pdata->host_ops->attach(pdata->priv_data, device, dsi); if (ret < 0) return ret; }
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index a2262bee5aa4..32ddc8642ec1 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -997,7 +997,8 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = { };
static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
struct mipi_dsi_device *device)
struct mipi_dsi_device *device,
struct dw_mipi_dsi *dmd)
{ struct dw_mipi_dsi_rockchip *dsi = priv_data; struct device *second; @@ -1005,6 +1006,8 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
mutex_lock(&dsi->usage_mutex);
dsi->dmd = dmd;
if (dsi->usage_mode != DW_DSI_USAGE_IDLE) { DRM_DEV_ERROR(dsi->dev, "dsi controller already in use\n"); mutex_unlock(&dsi->usage_mutex);
@@ -1280,6 +1283,7 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node;
struct dw_mipi_dsi *dmd; struct dw_mipi_dsi_rockchip *dsi; struct phy_provider *phy_provider; struct resource *res;
@@ -1391,9 +1395,9 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) if (IS_ERR(phy_provider)) return PTR_ERR(phy_provider);
dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata);
if (IS_ERR(dsi->dmd)) {
ret = PTR_ERR(dsi->dmd);
dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata);
if (IS_ERR(dmd)) {
ret = PTR_ERR(dmd);
The memory pointed to by dmd is allocated in dw_mipi_dsi_probe(), but the pointer is not saved here. We rely on the attach operation to save the dmd pointer.
In other words - the attach operation must be called before we call dw_mipi_dsi_rockchip_remove(), which uses the dmd member.
This all looks wrong to me - are we papering over some other issue
Ok, it's wrong. I was not expecting that call.Anyway this was my path on linux-next
dw_mipi_dsi_rockchip_probe dw_mipi_dsi_probe -->start call
dw_mipi_dsi_rockchip_host_attach <-- this was not able to use dmd
dw_mipi_dsi_probe -> exit from the call
Michael
here?
Sam
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com
Hi Michael,
On Sat, Oct 16, 2021 at 10:22:27AM +0000, Michael Trimarchi wrote:
This patch series add support for W552946ABA panel. This panel is used in px30-evb v11. All the patches can be applied on top of drm-fixes branch. The last patch is suppose to fix a race when the panel is built in. Tested on px30 evb
Michael Trimarchi (5): dt-bindings: vendor-prefix: add Wanchanglong Electronics Technology drm/panel: ilitek-ili9881d: add support for Wanchanglong W552946ABA panel dt-bindings: ili9881c: add compatible string for Wanchanglong w552946aba drm/panel: ilitek-ili9881c: Make gpio-reset optional
The four patches has been applied to drm-misc-next.
drm/bridge: dw-mipi-dsi: Fix dsi registration during drm probing
This patch looks like it does not belong in this series. Anyway - commented on it as I did not understand the code.
Sam
Hi Sam
On Sat, Oct 16, 2021 at 2:27 PM Sam Ravnborg sam@ravnborg.org wrote:
Hi Michael,
On Sat, Oct 16, 2021 at 10:22:27AM +0000, Michael Trimarchi wrote:
This patch series add support for W552946ABA panel. This panel is used in px30-evb v11. All the patches can be applied on top of drm-fixes branch. The last patch is suppose to fix a race when the panel is built in. Tested on px30 evb
Michael Trimarchi (5): dt-bindings: vendor-prefix: add Wanchanglong Electronics Technology drm/panel: ilitek-ili9881d: add support for Wanchanglong W552946ABA panel dt-bindings: ili9881c: add compatible string for Wanchanglong w552946aba drm/panel: ilitek-ili9881c: Make gpio-reset optional
The four patches has been applied to drm-misc-next.
I sent another fix on the same panel. Are those patches queued on some tree?
drm/bridge: dw-mipi-dsi: Fix dsi registration during drm probing
This patch looks like it does not belong in this series. Anyway - commented on it as I did not understand the code.
Sam
Michael
Hi Michael,
On Thu, Nov 04, 2021 at 02:19:33PM +0100, Michael Nazzareno Trimarchi wrote:
Hi Sam
On Sat, Oct 16, 2021 at 2:27 PM Sam Ravnborg sam@ravnborg.org wrote:
Hi Michael,
On Sat, Oct 16, 2021 at 10:22:27AM +0000, Michael Trimarchi wrote:
This patch series add support for W552946ABA panel. This panel is used in px30-evb v11. All the patches can be applied on top of drm-fixes branch. The last patch is suppose to fix a race when the panel is built in. Tested on px30 evb
Michael Trimarchi (5): dt-bindings: vendor-prefix: add Wanchanglong Electronics Technology drm/panel: ilitek-ili9881d: add support for Wanchanglong W552946ABA panel dt-bindings: ili9881c: add compatible string for Wanchanglong w552946aba drm/panel: ilitek-ili9881c: Make gpio-reset optional
The four patches has been applied to drm-misc-next.
I sent another fix on the same panel. Are those patches queued on some tree?
The patches was applied to drm-misc-next branch of the drm-misc tree. Around -rc2 time you will see these patches in -next.
Sam
dri-devel@lists.freedesktop.org