diff mbox series

[3/5] drm/bridge: tc358762: Instruct DSI host to generate HSE packets

Message ID 20230615201902.566182-3-marex@denx.de (mailing list archive)
State Accepted
Headers show
Series [1/5] drm/bridge: tc358762: Split register programming from pre-enable to enable | expand

Commit Message

Marek Vasut June 15, 2023, 8:19 p.m. UTC
This bridge seems to need the HSE packet, otherwise the image is
shifted up and corrupted at the bottom. This makes the bridge
work with Samsung DSIM on i.MX8MM and i.MX8MP.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@gmail.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Robert Foss <rfoss@kernel.org>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/tc358762.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sam Ravnborg June 16, 2023, 7:03 p.m. UTC | #1
On Thu, Jun 15, 2023 at 10:19:00PM +0200, Marek Vasut wrote:
> This bridge seems to need the HSE packet, otherwise the image is
> shifted up and corrupted at the bottom. This makes the bridge
> work with Samsung DSIM on i.MX8MM and i.MX8MP.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

(Not that I know the register or such, but the patch looks good).

> ---
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Robert Foss <rfoss@kernel.org>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/bridge/tc358762.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
> index 5e00c08b99540..77f2ec9de9e59 100644
> --- a/drivers/gpu/drm/bridge/tc358762.c
> +++ b/drivers/gpu/drm/bridge/tc358762.c
> @@ -241,7 +241,7 @@ static int tc358762_probe(struct mipi_dsi_device *dsi)
>  	dsi->lanes = 1;
>  	dsi->format = MIPI_DSI_FMT_RGB888;
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
> -			  MIPI_DSI_MODE_LPM;
> +			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_VIDEO_HSE;
>  
>  	ret = tc358762_parse_dt(ctx);
>  	if (ret < 0)
> -- 
> 2.39.2
Marc Kleine-Budde Nov. 16, 2023, 4:06 p.m. UTC | #2
Hey Marek,

On 15.06.2023 22:19:00, Marek Vasut wrote:
> This bridge seems to need the HSE packet, otherwise the image is
> shifted up and corrupted at the bottom. This makes the bridge
> work with Samsung DSIM on i.MX8MM and i.MX8MP.

I'm using v6.6 (which includes this series) on an i.MX8MP with the 7inch
Rspi Panel ("powertip,ph800480t013-idf02"), but I cannot get a stable
image.

With an unmodified imx8mp clock tree the lower 1/4 of the image sheers
to the left.

With 24.75 MHz on the media_disp1_pix and media_mipi_phy1_ref and 792
MHz on video_pll1_out, the image is not static, but wobbly and it's
wrapped around half of the image.

    video_pll1_ref_sel                1        1        0    24000000          0     0  50000         Y
       video_pll1                     1        1        0   792000000          0     0  50000         Y
          video_pll1_bypass           1        1        0   792000000          0     0  50000         Y
             video_pll1_out           2        2        0   792000000          0     0  50000         Y
                media_mipi_phy1_ref       1        1        0    24750000          0     0  50000         Y
                   media_mipi_phy1_ref_root       0        0        0    24750000          0     0  50000         Y
                media_disp2_pix       0        0        0   792000000          0     0  50000         N
                   media_disp2_pix_root_clk       0        0        0   792000000          0     0  50000         N
                media_disp1_pix       1        1        0    24750000          0     0  50000         Y
                   media_disp1_pix_root_clk       1        1        0    24750000          0     0  50000         Y

Do you have a working device tree for such a setup? regards, Marc

Relevant DT snipped for my setup:

&{/} {
	panel {
		compatible = "powertip,ph800480t013-idf02";
		power-supply = <&attiny>;
		backlight = <&attiny>;

		port {
			panel_in: endpoint {
				remote-endpoint = <&bridge_out>;
			};
		};
	};
};

&mipi_dsi {
	samsung,esc-clock-frequency = <54000000>;
	assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
				 <&clk IMX8MP_VIDEO_PLL1_OUT>;
	assigned-clock-rates = <200000000>, <24750000>;
	status = "okay";

	bridge@0 {
		compatible = "toshiba,tc358762";
		reg = <0>;
		vddc-supply = <&attiny>;
		reset-gpio = <&attiny 0 0>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;

				bridge_in: endpoint {
					remote-endpoint = <&dsi_out>;
				};
			};

			port@1 {
				reg = <1>;

				bridge_out: endpoint {
					remote-endpoint = <&panel_in>;
				};
			};
		};
	};

	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;

			dsi_out: endpoint {
				data-lanes = <1 2>;
				remote-endpoint = <&bridge_in>;
			};
		};
	};
};

&media_blk_ctrl {
	assigned-clock-rates = <500000000>, <200000000>,
			       <0>, <0>, <792000000>;
};
Marek Vasut Nov. 16, 2023, 6:17 p.m. UTC | #3
On 11/16/23 17:06, Marc Kleine-Budde wrote:
> Hey Marek,
> 
> On 15.06.2023 22:19:00, Marek Vasut wrote:
>> This bridge seems to need the HSE packet, otherwise the image is
>> shifted up and corrupted at the bottom. This makes the bridge
>> work with Samsung DSIM on i.MX8MM and i.MX8MP.
> 
> I'm using v6.6 (which includes this series) on an i.MX8MP with the 7inch
> Rspi Panel ("powertip,ph800480t013-idf02"), but I cannot get a stable
> image.
> 
> With an unmodified imx8mp clock tree the lower 1/4 of the image sheers
> to the left.
> 
> With 24.75 MHz on the media_disp1_pix and media_mipi_phy1_ref and 792
> MHz on video_pll1_out, the image is not static, but wobbly and it's
> wrapped around half of the image.
> 
>      video_pll1_ref_sel                1        1        0    24000000          0     0  50000         Y
>         video_pll1                     1        1        0   792000000          0     0  50000         Y
>            video_pll1_bypass           1        1        0   792000000          0     0  50000         Y
>               video_pll1_out           2        2        0   792000000          0     0  50000         Y
>                  media_mipi_phy1_ref       1        1        0    24750000          0     0  50000         Y
>                     media_mipi_phy1_ref_root       0        0        0    24750000          0     0  50000         Y
>                  media_disp2_pix       0        0        0   792000000          0     0  50000         N
>                     media_disp2_pix_root_clk       0        0        0   792000000          0     0  50000         N
>                  media_disp1_pix       1        1        0    24750000          0     0  50000         Y
>                     media_disp1_pix_root_clk       1        1        0    24750000          0     0  50000         Y
> 
> Do you have a working device tree for such a setup? regards, Marc

This seems to be what I used last time I tried (notice the 
samsung,burst-clock-frequency = <720000000>; ), but this was a few 
months ago:

/ {
         panel {
                 compatible = "powertip,ph800480t013-idf02";
                 backlight = <&attiny>;
                 enable-gpio = <&attiny 0 GPIO_ACTIVE_HIGH>;
                 power-supply = <&attiny>;

                 port {
                         panel_in: endpoint {
                                 remote-endpoint = <&bridge_out>;
                         };
                 };
         };
};

&mipi_dsi {
         /*
          * This is DSIM PLL frequency, DSI HS clock lane frequency
          * is half of the "samsung,burst-clock-frequency" value.
          */
         samsung,burst-clock-frequency = <720000000>;
         status = "okay";

         bridge@0 {
                 compatible = "toshiba,tc358762";
                 reg = <0>;
                 vddc-supply = <&attiny>;
                 #address-cells = <1>;
                 #size-cells = <0>;
                 status = "okay";

                 port@0 {
                         reg = <0>;
                         bridge_in: endpoint {
                                 data-lanes = <1>;
                                 remote-endpoint = <&dsi_out>;
                         };
                 };

                 port@1 {
                         reg = <1>;
                         bridge_out: endpoint {
                                 remote-endpoint = <&panel_in>;
                         };
                 };
         };
};

&dsi_out {
         data-lanes = <1>;
         remote-endpoint = <&bridge_in>;
};

&i2cmuxed0 {
         #address-cells = <1>;
         #size-cells = <0>;

         touchscreen: touchscreen@38 {
                 compatible = "edt,edt-ft5406";
                 reg = <0x38>;
                 reset-gpios = <&attiny 1 GPIO_ACTIVE_LOW>;
                 /*
                  * Disabled, since the IRQ line is not on
                  * the FPC cable, so we cannot get touch
                  * IRQs unless its connected otherwise. In
                  * that case, add entry like this one and
                  * enable below.
                  *
                  * interrupt-parent = <&gpiog>;
                  * interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
                  */
                 status = "disabled";
         };

         attiny: regulator@45 {
                 compatible = 
"raspberrypi,7inch-touchscreen-panel-regulator";
                 gpio-controller;
                 #gpio-cells = <2>;
                 reg = <0x45>;
         };
};

&pwm1 {
         status = "okay";
};

&lcdif1 {
         status = "okay";
};
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 5e00c08b99540..77f2ec9de9e59 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -241,7 +241,7 @@  static int tc358762_probe(struct mipi_dsi_device *dsi)
 	dsi->lanes = 1;
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-			  MIPI_DSI_MODE_LPM;
+			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_VIDEO_HSE;
 
 	ret = tc358762_parse_dt(ctx);
 	if (ret < 0)