Skip to content

Commit 5c4381e

Browse files
committed
drm/panel: panel-simple: Get rid of hacky HPD chicken-and-egg code
When I added support for the hpd-gpio to simple-panel in commit 48834e6 ("drm/panel-simple: Support hpd-gpios for delaying prepare()"), I added a special case to handle a circular dependency I was running into on the ti-sn65dsi86 bridge chip. On my board the hpd-gpio is actually provided by the bridge chip. That was causing some circular dependency problems that I had to work around by getting the hpd-gpio late. I've now reorganized the ti-sn65dsi86 bridge chip driver to be a collection of sub-drivers. Now the GPIO part can probe separately and that breaks the chain. Let's get rid of the old code to clean things up. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Sean Paul <seanpaul@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210423095743.v5.10.I40eeedc23459d1e3fc96fa6cdad775d88c6e706c@changeid
1 parent bf73537 commit 5c4381e

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

drivers/gpu/drm/panel/panel-simple.c

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -366,26 +366,18 @@ static int panel_simple_unprepare(struct drm_panel *panel)
366366
return 0;
367367
}
368368

369-
static int panel_simple_get_hpd_gpio(struct device *dev,
370-
struct panel_simple *p, bool from_probe)
369+
static int panel_simple_get_hpd_gpio(struct device *dev, struct panel_simple *p)
371370
{
372371
int err;
373372

374373
p->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN);
375374
if (IS_ERR(p->hpd_gpio)) {
376375
err = PTR_ERR(p->hpd_gpio);
377376

378-
/*
379-
* If we're called from probe we won't consider '-EPROBE_DEFER'
380-
* to be an error--we'll leave the error code in "hpd_gpio".
381-
* When we try to use it we'll try again. This allows for
382-
* circular dependencies where the component providing the
383-
* hpd gpio needs the panel to init before probing.
384-
*/
385-
if (err != -EPROBE_DEFER || !from_probe) {
377+
if (err != -EPROBE_DEFER)
386378
dev_err(dev, "failed to get 'hpd' GPIO: %d\n", err);
387-
return err;
388-
}
379+
380+
return err;
389381
}
390382

391383
return 0;
@@ -416,12 +408,6 @@ static int panel_simple_prepare_once(struct panel_simple *p)
416408
msleep(delay);
417409

418410
if (p->hpd_gpio) {
419-
if (IS_ERR(p->hpd_gpio)) {
420-
err = panel_simple_get_hpd_gpio(dev, p, false);
421-
if (err)
422-
goto error;
423-
}
424-
425411
if (p->desc->delay.hpd_absent_delay)
426412
hpd_wait_us = p->desc->delay.hpd_absent_delay * 1000UL;
427413
else
@@ -682,7 +668,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
682668

683669
panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd");
684670
if (!panel->no_hpd) {
685-
err = panel_simple_get_hpd_gpio(dev, panel, true);
671+
err = panel_simple_get_hpd_gpio(dev, panel);
686672
if (err)
687673
return err;
688674
}

0 commit comments

Comments
 (0)