RE: [PATCH 9/9] drm/verisilicon: Add starfive hdmi driver
From: Hoegeun Kwon
Date: Thu Jun 22 2023 - 22:38:26 EST
Hi Keith,
There is a problem with stopping when changing modes.
Below test log
root:~> modetest -Mstarfive -c
Connectors:
id encoder status name size (mm) modes
encoders
116 115 connected HDMI-A-1 320x180 51 115
modes:
index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
#0 1280x800 59.91 1280 1328 1360 1440 800 803 809 823 71000 flags: phsync,
pvsync; type: preferred, driver
#1 1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags:
phsync, pvsync; type: driver
[...]
root:~> modetest -Mstarfive -s 116:#0 -v
setting mode 1280x800-59.91Hz on connectors 116, crtc 31
freq: 60.65Hz
freq: 59.91Hz
freq: 59.91Hz
root:~> modetest -Mstarfive -s 116:#1 -v
setting mode 1920x1080-60.00Hz on connectors 116, crtc 31
[ 94.535626] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[ 94.560985] rcu: 1-...0: (20 ticks this GP)
idle=c9bc/1/0x4000000000000000 softirq=3869/3871 fqs=1120
[ 94.589532] rcu: (detected by 3, t=5264 jiffies, g=4645, q=63
ncpus=4)
[ 94.615335] Task dump for CPU 1:
[ 94.637723] task:modetest state:R running task stack:0
pid:407 ppid:397 flags:0x00000008
[ 94.667299] Call Trace:
[ 94.689297] [<ffffffff80d1e8fc>] __schedule+0x2a8/0xa52
[ 94.714221] [<ffffffff80d1f100>] schedule+0x5a/0xdc
[ 94.738626] [<ffffffff80d25a14>] schedule_timeout+0x220/0x2a6
[ 94.763762] [<ffffffff80d2037a>] wait_for_completion+0xfe/0x126
[ 94.789073] [<ffffffff8002ffe4>] kthread_flush_worker+0x82/0xa0
> -----Original Message-----
> From: dri-devel <dri-devel-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Keith Zhao
> Sent: Friday, June 2, 2023 4:41 PM
> To: dri-devel@xxxxxxxxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; linux-riscv@xxxxxxxxxxxxxxxxxxx; linux-
> media@xxxxxxxxxxxxxxx; linaro-mm-sig@xxxxxxxxxxxxxxxx
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@xxxxxxxxxx>; Sumit Semwal
> <sumit.semwal@xxxxxxxxxx>; Emil Renner Berthing <kernel@xxxxxxxx>;
> Shengyang Chen <shengyang.chen@xxxxxxxxxxxxxxxx>; Conor Dooley
> <conor+dt@xxxxxxxxxx>; Albert Ou <aou@xxxxxxxxxxxxxxxxx>; Thomas
> Zimmermann <tzimmermann@xxxxxxx>; Jagan Teki <jagan@xxxxxxxxxx>; Rob
> Herring <robh+dt@xxxxxxxxxx>; Chris Morgan <macromorgan@xxxxxxxxxxx>; Paul
> Walmsley <paul.walmsley@xxxxxxxxxx>; Keith Zhao
> <keith.zhao@xxxxxxxxxxxxxxxx>; Bjorn Andersson <andersson@xxxxxxxxxx>;
> Changhuang Liang <changhuang.liang@xxxxxxxxxxxxxxxx>; Jack Zhu
> <jack.zhu@xxxxxxxxxxxxxxxx>; Palmer Dabbelt <palmer@xxxxxxxxxxx>; Shawn
> Guo <shawnguo@xxxxxxxxxx>; christian.koenig@xxxxxxx
> Subject: [PATCH 9/9] drm/verisilicon: Add starfive hdmi driver
>
> Add HDMI dirver for StarFive SoC JH7110.
>
> Signed-off-by: Keith Zhao <keith.zhao@xxxxxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/verisilicon/Kconfig | 11 +
> drivers/gpu/drm/verisilicon/Makefile | 1 +
> drivers/gpu/drm/verisilicon/starfive_hdmi.c | 928 ++++++++++++++++++++
> drivers/gpu/drm/verisilicon/starfive_hdmi.h | 296 +++++++
> drivers/gpu/drm/verisilicon/vs_drv.c | 6 +
> drivers/gpu/drm/verisilicon/vs_drv.h | 4 +
> 6 files changed, 1246 insertions(+)
> create mode 100644 drivers/gpu/drm/verisilicon/starfive_hdmi.c
> create mode 100644 drivers/gpu/drm/verisilicon/starfive_hdmi.h
[...]
> diff --git a/drivers/gpu/drm/verisilicon/starfive_hdmi.c
> b/drivers/gpu/drm/verisilicon/starfive_hdmi.c
> new file mode 100644
> index 000000000000..128ecca03309
> --- /dev/null
> +++ b/drivers/gpu/drm/verisilicon/starfive_hdmi.c
> @@ -0,0 +1,928 @@
[...]
> +static int starfive_hdmi_setup(struct starfive_hdmi *hdmi,
> + struct drm_display_mode *mode) {
[...]
> + return 0;
> +}
> +
> +static void starfive_hdmi_encoder_mode_set(struct drm_encoder *encoder,
> + struct drm_display_mode *mode,
> + struct drm_display_mode
*adj_mode) {
> + struct starfive_hdmi *hdmi = encoder_to_hdmi(encoder);
> +
> + starfive_hdmi_setup(hdmi, adj_mode);
When starfive_hdmi_setup runs here,
when changing the mode, a problem occurs because try to write a value to reg
in a state that is not resumed after suspend.
> +
> + memcpy(&hdmi->previous_mode, adj_mode, sizeof(hdmi-
> >previous_mode)); }
> +
> +static void starfive_hdmi_encoder_enable(struct drm_encoder *encoder) {
> + struct starfive_hdmi *hdmi = encoder_to_hdmi(encoder);
> +
> + pm_runtime_get_sync(hdmi->dev);
So if move the call point of starfive_hdmi_setup here, it works normally.
> +}
Best regards,
Hoegeun