Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-17 Thread Tommaso Merciai
On Tue, Jan 11, 2022 at 09:21:51PM +0100, Tommaso Merciai wrote:
> On Sun, Jan 09, 2022 at 03:44:07PM -0300, Fabio Estevam wrote:
> > Hi Tommaso,
> > 
> > On Sat, Jan 8, 2022 at 4:17 PM Tommaso Merciai  
> > wrote:
> > 
> > > Hi Fabio,
> > > If you need some test let me know. Whitch filesystem are you using?
> > 
> > I am using a rootfs generated by Buildroot.
> > 
> > The issue I see seems to be hotplug-related.
> > 
> > cat /sys/class/drm/card1-HDMI-A-1/status
> > 
> > not always match with the real state of the HDMI cable.
> > 
> > > In the next days I will investigate on this issue.
> > > Let me know.
> > 
> > Thanks
> 
> Hi Fabio,
> Got it, I'll try to reproduce the issue on my side and let you know.
> 
> Thanks,
> Tommaso

Hi Fabio,
I'm working on bring up urt,umsh-8596md-20t lvds kit panel, but after enable
following node I get the following error:

+   backlight_display: backlight-display {
+   compatible = "pwm-backlight";
+   pwms = <&pwm4 0 500>;
+   brightness-levels = <0 4 8 16 32 64 128 255>;
+   default-brightness-level = <32>;
+   };
+
leds {
compatible = "gpio-leds";

@@ -70,6 +77,17 @@ reg_wlan: regulator-wlan {
startup-delay-us = <7>;
enable-active-high;
};
+
+   panel {
+   compatible = "urt,umsh-8596md-20t";
+   backlight = <&backlight_display>;
+
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <&display_out>;
+   };
+   };
+   };
 };

 &fec1 {
@@ -196,6 +214,12 @@ pinctrl_bt_reg: btreggrp {
;
};

+   pinctrl_pwm4: pwm4grp-1 {
+   fsl,pins = <
+   MX6SX_PAD_SD1_DATA1__PWM4_OUT 0x110b0
+   >;
+   };
+
pinctrl_enet1: enet1grp {
fsl,pins =
,
@@ -316,6 +340,40 @@ pinctrl_usdhc3: usdhc3grp {
,
;
};
+
+   pinctrl_lcd: lcdgrp {
+   fsl,pins = <
+   MX6SX_PAD_LCD1_DATA00__LCDIF1_DATA_0 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA01__LCDIF1_DATA_1 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA02__LCDIF1_DATA_2 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA03__LCDIF1_DATA_3 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA04__LCDIF1_DATA_4 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA05__LCDIF1_DATA_5 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA06__LCDIF1_DATA_6 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA07__LCDIF1_DATA_7 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA08__LCDIF1_DATA_8 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA09__LCDIF1_DATA_9 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA10__LCDIF1_DATA_10 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA11__LCDIF1_DATA_11 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA12__LCDIF1_DATA_12 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA13__LCDIF1_DATA_13 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA14__LCDIF1_DATA_14 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA15__LCDIF1_DATA_15 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA16__LCDIF1_DATA_16 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA17__LCDIF1_DATA_17 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA18__LCDIF1_DATA_18 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA19__LCDIF1_DATA_19 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA20__LCDIF1_DATA_20 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA21__LCDIF1_DATA_21 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA22__LCDIF1_DATA_22 0x4001b0b0
+   MX6SX_PAD_LCD1_DATA23__LCDIF1_DATA_23 0x4001b0b0
+   MX6SX_PAD_LCD1_CLK__LCDIF1_CLK  0x4001b0b0
+   MX6SX_PAD_LCD1_ENABLE__LCDIF1_ENABLE 0x4001b0b0
+   MX6SX_PAD_LCD1_VSYNC__LCDIF1_VSYNC 0x4001b0b0
+   MX6SX_PAD_LCD1_HSYNC__LCDIF1_HSYNC 0x4001b0b0
+   MX6SX_PAD_LCD1_RESET__GPIO3_IO_27 0x4001b0b0
+   >;
+   };
 };

 &uart1 {
@@ -408,3 +466,22 @@ wlcore: wlcore@2 {
tcxo-clock-frequency = <2600>;
};
 };
+
+&lcdif1 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_lcd>;
+   status = "okay";
+
+   port {
+   display_out: endpoint {
+   remote-endpoint = <&panel_in>;
+   };
+   };
+};
+
+&pwm4 {
+   #pwm-cells = <2>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&

Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-17 Thread Tommaso Merciai
On Sun, Jan 16, 2022 at 10:27:19AM -0300, Fabio Estevam wrote:
> Hi Tommaso,
> 
> On Sat, Jan 15, 2022 at 8:23 PM Tommaso Merciai  
> wrote:
> 
> > Hi Fabio,
> > I'm working on bring up urt,umsh-8596md-20t lvds kit panel, but after enable
> > following node I get the following error:
> 
> I assume you are trying to connect an external panel via connector CN3.

Hi Fabio,
Right.

> 
> This connector is for LVDS panel, not parallel.

Yep, for that I try also urt,umsh-8596md-19t without success.

> 
> The eLCDIF parallel interface is connected to the TDA19988.

Thanks for the info.
> 
> Anyway, this is a different topic. My goal here is to fix the kernel
> warning when using the TDA19988 HDMI output.

My bad sorry, I'm looking for a second HDMI Display for try to reproduce
the issue on my side. Meanwhile I'm working on lvds.

Thanks,
Tommaso

> 
> Thanks


Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-16 Thread Fabio Estevam
Hi Tommaso,

On Sat, Jan 15, 2022 at 8:23 PM Tommaso Merciai  wrote:

> Hi Fabio,
> I'm working on bring up urt,umsh-8596md-20t lvds kit panel, but after enable
> following node I get the following error:

I assume you are trying to connect an external panel via connector CN3.

This connector is for LVDS panel, not parallel.

The eLCDIF parallel interface is connected to the TDA19988.

Anyway, this is a different topic. My goal here is to fix the kernel
warning when using the TDA19988 HDMI output.

Thanks


Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-12 Thread Tommaso Merciai
On Sun, Jan 09, 2022 at 03:44:07PM -0300, Fabio Estevam wrote:
> Hi Tommaso,
> 
> On Sat, Jan 8, 2022 at 4:17 PM Tommaso Merciai  wrote:
> 
> > Hi Fabio,
> > If you need some test let me know. Whitch filesystem are you using?
> 
> I am using a rootfs generated by Buildroot.
> 
> The issue I see seems to be hotplug-related.
> 
> cat /sys/class/drm/card1-HDMI-A-1/status
> 
> not always match with the real state of the HDMI cable.
> 
> > In the next days I will investigate on this issue.
> > Let me know.
> 
> Thanks

Hi Fabio,
Got it, I'll try to reproduce the issue on my side and let you know.

Thanks,
Tommaso


Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-10 Thread Tommaso Merciai
On Mon, Jan 03, 2022 at 09:35:14AM -0300, Fabio Estevam wrote:
> Hi Laurent,
> 
> On Mon, Jan 3, 2022 at 8:48 AM Laurent Pinchart
>  wrote:
> 
> > With the comment from 2/2 taken into account,
> >
> > Reviewed-by: Laurent Pinchart 
> 
> Thanks for the review. I addressed your feedback and sent v2.
> 
> I noticed a problem when removing/inserting the HDMI cable.
> 
> If I boot the board with the HDMI cable connected, then after
> removal/insertion of the HDMI cable, the following
> kernel warning is observed:
> 
> # [   23.201080] [ cut here ]
> [   23.207275] WARNING: CPU: 0 PID: 56 at
> drivers/gpu/drm/drm_atomic_helper.c:1514
> drm_atomic_helper_wait_for_vblanks.part.0+0x27c/0x294
> [   23.221469] [CRTC:35:crtc-0] vblank wait timed out
> [   23.226448] Modules linked in:
> [   23.230255] CPU: 0 PID: 56 Comm: kworker/0:3 Not tainted
> 5.15.12-3-g27f29fb60028 #94
> [   23.238508] Hardware name: Freescale i.MX6 SoloX (Device Tree)
> [   23.244457] Workqueue: events output_poll_execute
> [   23.249377] [] (unwind_backtrace) from []
> (show_stack+0x10/0x14)
> [   23.257316] [] (show_stack) from []
> (dump_stack_lvl+0x58/0x70)
> [   23.265059] [] (dump_stack_lvl) from []
> (__warn+0xd8/0x114)
> [   23.272533] [] (__warn) from []
> (warn_slowpath_fmt+0x90/0xc4)
> [   23.280166] [] (warn_slowpath_fmt) from []
> (drm_atomic_helper_wait_for_vblanks.part.0+0x27c/0x294)
> [   23.291054] []
> (drm_atomic_helper_wait_for_vblanks.part.0) from []
> (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
> [   23.303150] [] (drm_atomic_helper_commit_tail_rpm) from
> [] (commit_tail+0x9c/0x190)
> [   23.312717] [] (commit_tail) from []
> (drm_atomic_helper_commit+0x158/0x18c)
> [   23.321588] [] (drm_atomic_helper_commit) from
> [] (drm_client_modeset_commit_atomic+0x238/0x284)
> [   23.332314] [] (drm_client_modeset_commit_atomic) from
> [] (drm_client_modeset_commit_locked+0x60/0x1cc)
> [   23.343615] [] (drm_client_modeset_commit_locked) from
> [] (drm_client_modeset_commit+0x24/0x40)
> [   23.354218] [] (drm_client_modeset_commit) from
> [] (__drm_fb_helper_restore_fbdev_mode_unlocked+0x9c/0xc8)
> [   23.365803] []
> (__drm_fb_helper_restore_fbdev_mode_unlocked) from []
> (drm_fb_helper_set_par+0x38/0x68)
> [   23.377015] [] (drm_fb_helper_set_par) from []
> (drm_fb_helper_hotplug_event.part.0+0xa4/0xc0)
> [   23.387443] [] (drm_fb_helper_hotplug_event.part.0) from
> [] (drm_client_dev_hotplug+0x6c/0xb4)
> [   23.397959] [] (drm_client_dev_hotplug) from []
> (output_poll_execute+0x200/0x21c)
> [   23.407346] [] (output_poll_execute) from []
> (process_one_work+0x298/0x7cc)
> [   23.416224] [] (process_one_work) from []
> (worker_thread+0x30/0x50c)
> [   23.424479] [] (worker_thread) from []
> (kthread+0x154/0x17c)
> [   23.432039] [] (kthread) from []
> (ret_from_fork+0x14/0x38)
> [   23.439413] Exception stack(0xc42a1fb0 to 0xc42a1ff8)
> [   23.444588] 1fa0: 
>   
> [   23.452888] 1fc0:     
>   
> [   23.461182] 1fe0:     0013 
> [   23.468734] irq event stamp: 43775
> [   23.472305] hardirqs last  enabled at (43783): []
> __up_console_sem+0x50/0x60
> [   23.480785] hardirqs last disabled at (43792): []
> __up_console_sem+0x3c/0x60
> [   23.489224] softirqs last  enabled at (43774): []
> __do_softirq+0x2ec/0x5a4
> [   23.497163] softirqs last disabled at (43747): []
> irq_exit+0x18c/0x210
> [   23.505106] ---[ end trace 86572327287ca501 ]---
> 
> I haven't managed to fix this yet, but if you have any suggestions,
> please let me know.
> 
> Thanks,
> 
> Fabio Estevam

Hi Fabio,
If you need some test let me know. Whitch filesystem are you using?
In the next days I will investigate on this issue.
Let me know.

Thanks,
Tommaso


Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-09 Thread Fabio Estevam
Hi Tommaso,

On Sat, Jan 8, 2022 at 4:17 PM Tommaso Merciai  wrote:

> Hi Fabio,
> If you need some test let me know. Whitch filesystem are you using?

I am using a rootfs generated by Buildroot.

The issue I see seems to be hotplug-related.

cat /sys/class/drm/card1-HDMI-A-1/status

not always match with the real state of the HDMI cable.

> In the next days I will investigate on this issue.
> Let me know.

Thanks


Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-03 Thread Fabio Estevam
Hi Laurent,

On Mon, Jan 3, 2022 at 8:48 AM Laurent Pinchart
 wrote:

> With the comment from 2/2 taken into account,
>
> Reviewed-by: Laurent Pinchart 

Thanks for the review. I addressed your feedback and sent v2.

I noticed a problem when removing/inserting the HDMI cable.

If I boot the board with the HDMI cable connected, then after
removal/insertion of the HDMI cable, the following
kernel warning is observed:

# [   23.201080] [ cut here ]
[   23.207275] WARNING: CPU: 0 PID: 56 at
drivers/gpu/drm/drm_atomic_helper.c:1514
drm_atomic_helper_wait_for_vblanks.part.0+0x27c/0x294
[   23.221469] [CRTC:35:crtc-0] vblank wait timed out
[   23.226448] Modules linked in:
[   23.230255] CPU: 0 PID: 56 Comm: kworker/0:3 Not tainted
5.15.12-3-g27f29fb60028 #94
[   23.238508] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[   23.244457] Workqueue: events output_poll_execute
[   23.249377] [] (unwind_backtrace) from []
(show_stack+0x10/0x14)
[   23.257316] [] (show_stack) from []
(dump_stack_lvl+0x58/0x70)
[   23.265059] [] (dump_stack_lvl) from []
(__warn+0xd8/0x114)
[   23.272533] [] (__warn) from []
(warn_slowpath_fmt+0x90/0xc4)
[   23.280166] [] (warn_slowpath_fmt) from []
(drm_atomic_helper_wait_for_vblanks.part.0+0x27c/0x294)
[   23.291054] []
(drm_atomic_helper_wait_for_vblanks.part.0) from []
(drm_atomic_helper_commit_tail_rpm+0x5c/0x6c)
[   23.303150] [] (drm_atomic_helper_commit_tail_rpm) from
[] (commit_tail+0x9c/0x190)
[   23.312717] [] (commit_tail) from []
(drm_atomic_helper_commit+0x158/0x18c)
[   23.321588] [] (drm_atomic_helper_commit) from
[] (drm_client_modeset_commit_atomic+0x238/0x284)
[   23.332314] [] (drm_client_modeset_commit_atomic) from
[] (drm_client_modeset_commit_locked+0x60/0x1cc)
[   23.343615] [] (drm_client_modeset_commit_locked) from
[] (drm_client_modeset_commit+0x24/0x40)
[   23.354218] [] (drm_client_modeset_commit) from
[] (__drm_fb_helper_restore_fbdev_mode_unlocked+0x9c/0xc8)
[   23.365803] []
(__drm_fb_helper_restore_fbdev_mode_unlocked) from []
(drm_fb_helper_set_par+0x38/0x68)
[   23.377015] [] (drm_fb_helper_set_par) from []
(drm_fb_helper_hotplug_event.part.0+0xa4/0xc0)
[   23.387443] [] (drm_fb_helper_hotplug_event.part.0) from
[] (drm_client_dev_hotplug+0x6c/0xb4)
[   23.397959] [] (drm_client_dev_hotplug) from []
(output_poll_execute+0x200/0x21c)
[   23.407346] [] (output_poll_execute) from []
(process_one_work+0x298/0x7cc)
[   23.416224] [] (process_one_work) from []
(worker_thread+0x30/0x50c)
[   23.424479] [] (worker_thread) from []
(kthread+0x154/0x17c)
[   23.432039] [] (kthread) from []
(ret_from_fork+0x14/0x38)
[   23.439413] Exception stack(0xc42a1fb0 to 0xc42a1ff8)
[   23.444588] 1fa0: 
  
[   23.452888] 1fc0:     
  
[   23.461182] 1fe0:     0013 
[   23.468734] irq event stamp: 43775
[   23.472305] hardirqs last  enabled at (43783): []
__up_console_sem+0x50/0x60
[   23.480785] hardirqs last disabled at (43792): []
__up_console_sem+0x3c/0x60
[   23.489224] softirqs last  enabled at (43774): []
__do_softirq+0x2ec/0x5a4
[   23.497163] softirqs last disabled at (43747): []
irq_exit+0x18c/0x210
[   23.505106] ---[ end trace 86572327287ca501 ]---

I haven't managed to fix this yet, but if you have any suggestions,
please let me know.

Thanks,

Fabio Estevam


Re: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations

2022-01-03 Thread Laurent Pinchart
Hi Fabio,

Thank you for the patch.

On Thu, Dec 30, 2021 at 10:39:29PM -0300, Fabio Estevam wrote:
> Use the atomic version of the enable/disable operations to continue the
> transition to the atomic API, started with the introduction of
> .atomic_get_input_bus_fmts(). This will be needed to access the mode
> from the atomic state.
> 
> Based on Laurent's commit a6ea7d268a63("drm: bridge: ti-sn65dsi83:
> Switch to atomic operations").
> 
> Tested on a imx6sx-udoo-neo board.
> 
> Suggested-by: Marek Vasut 
> Signed-off-by: Fabio Estevam 

With the comment from 2/2 taken into account,

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/i2c/tda998x_drv.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
> b/drivers/gpu/drm/i2c/tda998x_drv.c
> index b7ec6c374fbd..adaa985af87e 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -1395,7 +1395,8 @@ static enum drm_mode_status 
> tda998x_bridge_mode_valid(struct drm_bridge *bridge,
>   return MODE_OK;
>  }
>  
> -static void tda998x_bridge_enable(struct drm_bridge *bridge)
> +static void tda998x_bridge_atomic_enable(struct drm_bridge *bridge,
> +   struct drm_bridge_state 
> *old_bridge_state)
>  {
>   struct tda998x_priv *priv = bridge_to_tda998x_priv(bridge);
>  
> @@ -1413,7 +1414,8 @@ static void tda998x_bridge_enable(struct drm_bridge 
> *bridge)
>   }
>  }
>  
> -static void tda998x_bridge_disable(struct drm_bridge *bridge)
> +static void tda998x_bridge_atomic_disable(struct drm_bridge *bridge,
> +struct drm_bridge_state 
> *old_bridge_state)
>  {
>   struct tda998x_priv *priv = bridge_to_tda998x_priv(bridge);
>  
> @@ -1680,9 +1682,9 @@ static const struct drm_bridge_funcs 
> tda998x_bridge_funcs = {
>   .attach = tda998x_bridge_attach,
>   .detach = tda998x_bridge_detach,
>   .mode_valid = tda998x_bridge_mode_valid,
> - .disable = tda998x_bridge_disable,
> + .atomic_disable = tda998x_bridge_atomic_disable,
>   .mode_set = tda998x_bridge_mode_set,
> - .enable = tda998x_bridge_enable,
> + .atomic_enable = tda998x_bridge_atomic_enable,
>  };
>  
>  /* I2C driver functions */

-- 
Regards,

Laurent Pinchart