Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] Preexisting calls to sleeping functions in atomic context callback 
paths.
--

commit e9444612d599575c476a8af0ea940cddf9416e28
Author: Svyatoslav Ryhel <[email protected]>

gpu/drm: bridge: tc358768: Add delay after PLL setup

This commit adds a 20ms delay after tc358768_setup_pll() in
tc358768_bridge_atomic_pre_enable() to allow the PLL to settle, fixing an
issue where the bridge claims PLL lock but produces no DSI video output.

> diff --git a/drivers/gpu/drm/bridge/tc358768.c 
> b/drivers/gpu/drm/bridge/tc358768.c
> index 0f2820b373029..ea358c8da0e99 100644
> --- a/drivers/gpu/drm/bridge/tc358768.c
> +++ b/drivers/gpu/drm/bridge/tc358768.c
> @@ -824,6 +824,9 @@ static void tc358768_bridge_atomic_pre_enable(struct 
> drm_bridge *bridge,
>               return;
>       }

[Severity: High]
This isn't a bug introduced by this patch, but does calling
tc358768_setup_pll() and tc358768_hw_enable() from the atomic pre_enable
callback risk sleeping in atomic context?

Looking at tc358768_setup_pll() in drivers/gpu/drm/bridge/tc358768.c, it
calls usleep_range():

tc358768_setup_pll()
    /* wait for lock */
    usleep_range(1000, 2000);

Additionally, earlier in tc358768_bridge_atomic_pre_enable(), there is a
call to tc358768_hw_enable() which also contains sleeping functions:

tc358768_hw_enable()
    gpiod_set_value_cansleep(priv->reset_gpio, 0);

    /* wait for encoder clocks to stabilize */
    usleep_range(1000, 2000);

A similar issue exists in tc358768_bridge_atomic_disable(), which directly
calls msleep(50):

tc358768_bridge_atomic_disable()
    /* wait at least for one frame */
    msleep(50);

Since the drm bridge atomic pre_enable and disable callbacks run in atomic
context during non-blocking commits, can these sleeping calls cause kernel
warnings or deadlocks?

>  
> +     /* Allow the PLL to settle */
> +     mdelay(20);
> +
>       drm_display_mode_to_videomode(mode, &vm);
>  
>       dsiclk = priv->dsiclk;

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to