Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: panel: jd9365da-h3: fix reset signal polarity

In jadard_prepare() a reset pulse is generated with the following
statements (delays ommited for clarity):

gpiod_set_value(jadard->reset, 1); --> Deassert reset
gpiod_set_value(jadard->reset, 0); --> Assert reset for 10ms
gpiod_set_value(jadard->reset, 1); --> Deassert reset

However, specifying second argument of "0" to gpiod_set_value() means to
deassert the GPIO, and "1" means to assert it. If the reset signal is
defined as GPIO_ACTIVE_LOW in the DTS, the above statements will
incorrectly generate the reset pulse (inverted) and leave it asserted
(LOW) at the end of jadard_prepare().

Fix reset behavior by inverting gpiod_set_value() second argument
in jadard_prepare(). Also modify second argument to devm_gpiod_get()
in jadard_dsi_probe() to assert the reset when probing.

Do not modify it in jadard_unprepare() as it is already properly
asserted with "1", which seems to be the intended behavior.

Fixes: 6b818c533dd8 ("drm: panel: Add Jadard JD9365DA-H3 DSI panel")
Cc: stable@vger.kernel.org
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240927135306.857617-1-hugo@hugovil.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240927135306.857617-1-hugo@hugovil.com

authored by

Hugo Villeneuve and committed by
Neil Armstrong
a8972d5a e00a2e5d

+4 -4
+4 -4
drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
··· 109 109 if (jadard->desc->lp11_to_reset_delay_ms) 110 110 msleep(jadard->desc->lp11_to_reset_delay_ms); 111 111 112 - gpiod_set_value(jadard->reset, 1); 112 + gpiod_set_value(jadard->reset, 0); 113 113 msleep(5); 114 114 115 - gpiod_set_value(jadard->reset, 0); 115 + gpiod_set_value(jadard->reset, 1); 116 116 msleep(10); 117 117 118 - gpiod_set_value(jadard->reset, 1); 118 + gpiod_set_value(jadard->reset, 0); 119 119 msleep(130); 120 120 121 121 ret = jadard->desc->init(jadard); ··· 1130 1130 dsi->format = desc->format; 1131 1131 dsi->lanes = desc->lanes; 1132 1132 1133 - jadard->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); 1133 + jadard->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 1134 1134 if (IS_ERR(jadard->reset)) { 1135 1135 DRM_DEV_ERROR(&dsi->dev, "failed to get our reset GPIO\n"); 1136 1136 return PTR_ERR(jadard->reset);