From: Douglas Anderson <dianders@chromium.org> To: Thierry Reding <thierry.reding@gmail.com>, Sam Ravnborg <sam@ravnborg.org> Cc: Rob Clark <robdclark@chromium.org>, Stephen Boyd <swboyd@chromium.org>, Douglas Anderson <dianders@chromium.org>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>, Linus Walleij <linus.walleij@linaro.org>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] drm/panel-simple: Undo enable if HPD never asserts Date: Fri, 15 Jan 2021 14:44:16 -0800 [thread overview] Message-ID: <20210115144345.v2.1.I33fcbd64ab409cfe4f9491bf449f51925a4d3281@changeid> (raw) In-Reply-To: <20210115224420.1635017-1-dianders@chromium.org> If the HPD signal never asserts in panel_simple_prepare() and we return an error, we should unset the enable GPIO and disable the regulator to make it consistent for the caller. At the moment I have some hardware where HPD sometimes doesn't assert. Obviously that needs to be debugged, but this patch makes it so that if I add a retry that I can make things work. Fixes: 48834e6084f1 ("drm/panel-simple: Support hpd-gpios for delaying prepare()") Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Stephen: I didn't take your Reviewed-by tag since I made a small change. If you're OK with this change please re-add. Changes in v2: - Set the "unprepared_time" so if we retry we give the proper delay. drivers/gpu/drm/panel/panel-simple.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 71ae200ac48a..581ab6810b70 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -406,7 +406,7 @@ static int panel_simple_prepare(struct drm_panel *panel) if (IS_ERR(p->hpd_gpio)) { err = panel_simple_get_hpd_gpio(panel->dev, p, false); if (err) - return err; + goto error; } err = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio, @@ -418,13 +418,20 @@ static int panel_simple_prepare(struct drm_panel *panel) if (err) { dev_err(panel->dev, "error waiting for hpd GPIO: %d\n", err); - return err; + goto error; } } p->prepared_time = ktime_get(); return 0; + +error: + gpiod_set_value_cansleep(p->enable_gpio, 0); + regulator_disable(p->supply); + p->unprepared_time = ktime_get(); + + return err; } static int panel_simple_enable(struct drm_panel *panel) -- 2.30.0.284.gd98b1dd5eaa7-goog
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: Thierry Reding <thierry.reding@gmail.com>, Sam Ravnborg <sam@ravnborg.org> Cc: Rob Clark <robdclark@chromium.org>, David Airlie <airlied@linux.ie>, linux-kernel@vger.kernel.org, Douglas Anderson <dianders@chromium.org>, dri-devel@lists.freedesktop.org, Stephen Boyd <swboyd@chromium.org> Subject: [PATCH v2 1/5] drm/panel-simple: Undo enable if HPD never asserts Date: Fri, 15 Jan 2021 14:44:16 -0800 [thread overview] Message-ID: <20210115144345.v2.1.I33fcbd64ab409cfe4f9491bf449f51925a4d3281@changeid> (raw) In-Reply-To: <20210115224420.1635017-1-dianders@chromium.org> If the HPD signal never asserts in panel_simple_prepare() and we return an error, we should unset the enable GPIO and disable the regulator to make it consistent for the caller. At the moment I have some hardware where HPD sometimes doesn't assert. Obviously that needs to be debugged, but this patch makes it so that if I add a retry that I can make things work. Fixes: 48834e6084f1 ("drm/panel-simple: Support hpd-gpios for delaying prepare()") Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Stephen: I didn't take your Reviewed-by tag since I made a small change. If you're OK with this change please re-add. Changes in v2: - Set the "unprepared_time" so if we retry we give the proper delay. drivers/gpu/drm/panel/panel-simple.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 71ae200ac48a..581ab6810b70 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -406,7 +406,7 @@ static int panel_simple_prepare(struct drm_panel *panel) if (IS_ERR(p->hpd_gpio)) { err = panel_simple_get_hpd_gpio(panel->dev, p, false); if (err) - return err; + goto error; } err = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio, @@ -418,13 +418,20 @@ static int panel_simple_prepare(struct drm_panel *panel) if (err) { dev_err(panel->dev, "error waiting for hpd GPIO: %d\n", err); - return err; + goto error; } } p->prepared_time = ktime_get(); return 0; + +error: + gpiod_set_value_cansleep(p->enable_gpio, 0); + regulator_disable(p->supply); + p->unprepared_time = ktime_get(); + + return err; } static int panel_simple_enable(struct drm_panel *panel) -- 2.30.0.284.gd98b1dd5eaa7-goog _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-01-15 22:45 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-15 22:44 [PATCH v2 0/5] drm/panel-simple: Patches for N116BCA-EA1 Douglas Anderson 2021-01-15 22:44 ` Douglas Anderson 2021-01-15 22:44 ` Douglas Anderson [this message] 2021-01-15 22:44 ` [PATCH v2 1/5] drm/panel-simple: Undo enable if HPD never asserts Douglas Anderson 2021-01-15 22:49 ` Stephen Boyd 2021-01-15 22:49 ` Stephen Boyd 2021-01-15 22:44 ` [PATCH v2 2/5] drm/panel-simple: Don't wait longer for HPD than hpd_absent_delay Douglas Anderson 2021-01-15 22:44 ` Douglas Anderson 2021-01-25 20:26 ` Stephen Boyd 2021-01-25 20:26 ` Stephen Boyd 2021-01-15 22:44 ` [PATCH v2 3/5] drm/panel-simple: Retry if we timeout waiting for HPD Douglas Anderson 2021-01-15 22:44 ` Douglas Anderson 2021-01-25 20:28 ` Stephen Boyd 2021-01-25 20:28 ` Stephen Boyd 2021-01-27 21:11 ` Doug Anderson 2021-01-27 21:11 ` Doug Anderson 2021-01-15 22:44 ` [PATCH v2 4/5] dt-bindings: dt-bindings: display: simple: Add N116BCA-EA1 Douglas Anderson 2021-01-15 22:44 ` Douglas Anderson 2021-01-15 22:59 ` Doug Anderson 2021-01-15 22:59 ` Doug Anderson 2021-01-25 20:29 ` Stephen Boyd 2021-01-25 20:29 ` Stephen Boyd 2021-02-08 21:50 ` Rob Herring 2021-02-08 21:50 ` Rob Herring 2021-01-15 22:44 ` [PATCH v2 5/5] drm/panel-simple: " Douglas Anderson 2021-01-15 22:44 ` Douglas Anderson 2021-01-25 20:29 ` Stephen Boyd 2021-01-25 20:29 ` Stephen Boyd 2021-03-05 15:42 ` [PATCH v2 0/5] drm/panel-simple: Patches for N116BCA-EA1 Doug Anderson 2021-03-05 15:42 ` Doug Anderson 2021-03-10 23:25 ` Linus Walleij 2021-03-10 23:25 ` Linus Walleij 2021-03-10 23:47 ` Doug Anderson 2021-03-10 23:47 ` Doug Anderson 2021-03-11 0:57 ` Linus Walleij 2021-03-11 0:57 ` Linus Walleij 2021-03-11 1:01 ` Doug Anderson 2021-03-11 1:01 ` Doug Anderson 2021-03-11 16:20 ` Linus Walleij 2021-03-11 16:20 ` Linus Walleij 2021-03-11 16:15 ` Linus Walleij 2021-03-11 16:15 ` Linus Walleij
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210115144345.v2.1.I33fcbd64ab409cfe4f9491bf449f51925a4d3281@changeid \ --to=dianders@chromium.org \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=linus.walleij@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=robdclark@chromium.org \ --cc=sam@ravnborg.org \ --cc=swboyd@chromium.org \ --cc=thierry.reding@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.