diff mbox series

[2/6] drm/panel: simple: Support panels with HPD where HPD isn't connected

Message ID 20181022204639.8558-2-dianders@chromium.org (mailing list archive)
State New, archived
Headers show
Series [1/6] dt-bindings: drm/panel: simple: Add no-hpd property | expand

Commit Message

Doug Anderson Oct. 22, 2018, 8:46 p.m. UTC
Some eDP panels that are designed to be always connected to a board
use their HPD signal to signal that they've finished powering on and
they're ready to be talked to.

However, for various reasons it's possible that the HPD signal from
the panel isn't actually hooked up.  In the case where the HPD isn't
hooked up you can look at the timing diagram on the panel datasheet
and insert a delay for the maximum amount of time that the HPD might
take to come up.

Let's add support in simple-panel for this concept.

At the moment we will co-opt the existing "prepare" delay to keep
track of the delay and we'll use a boolean to specify that a given
panel should only apply the delay if the "no-hpd" property was
specified.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/panel/panel-simple.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Sean Paul Oct. 25, 2018, 6:08 p.m. UTC | #1
On Mon, Oct 22, 2018 at 01:46:35PM -0700, Douglas Anderson wrote:
> Some eDP panels that are designed to be always connected to a board
> use their HPD signal to signal that they've finished powering on and
> they're ready to be talked to.
> 
> However, for various reasons it's possible that the HPD signal from
> the panel isn't actually hooked up.  In the case where the HPD isn't
> hooked up you can look at the timing diagram on the panel datasheet
> and insert a delay for the maximum amount of time that the HPD might
> take to come up.
> 
> Let's add support in simple-panel for this concept.
> 
> At the moment we will co-opt the existing "prepare" delay to keep
> track of the delay and we'll use a boolean to specify that a given
> panel should only apply the delay if the "no-hpd" property was
> specified.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
>  drivers/gpu/drm/panel/panel-simple.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 97964f7f2ace..38c646fb55fd 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -63,12 +63,15 @@ struct panel_desc {
>  	 *           turn the display off (no content is visible)
>  	 * @unprepare: the time (in milliseconds) that it takes for the panel
>  	 *             to power itself down completely
> +	 * @prepare_delay_only_if_no_hpd: The prepare delay should only be done
> +	 *                                if we know Hot Plug Detect isn't used.

I think it'd be more clear if we just had a new 'hpd_absent_delay' which is
added to prepare if no_hpd is true.

Sean

>  	 */
>  	struct {
>  		unsigned int prepare;
>  		unsigned int enable;
>  		unsigned int disable;
>  		unsigned int unprepare;
> +		bool prepare_delay_only_if_no_hpd;
>  	} delay;
>  
>  	u32 bus_format;
> @@ -79,6 +82,7 @@ struct panel_simple {
>  	struct drm_panel base;
>  	bool prepared;
>  	bool enabled;
> +	bool no_hpd;
>  
>  	const struct panel_desc *desc;
>  
> @@ -215,7 +219,8 @@ static int panel_simple_prepare(struct drm_panel *panel)
>  
>  	gpiod_set_value_cansleep(p->enable_gpio, 1);
>  
> -	if (p->desc->delay.prepare)
> +	if (p->desc->delay.prepare &&
> +	    (!p->desc->delay.prepare_delay_only_if_no_hpd || p->no_hpd))
>  		msleep(p->desc->delay.prepare);
>  
>  	p->prepared = true;
> @@ -305,6 +310,8 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
>  	panel->prepared = false;
>  	panel->desc = desc;
>  
> +	panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd");
> +
>  	panel->supply = devm_regulator_get(dev, "power");
>  	if (IS_ERR(panel->supply))
>  		return PTR_ERR(panel->supply);
> -- 
> 2.19.1.568.g152ad8e336-goog
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 97964f7f2ace..38c646fb55fd 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -63,12 +63,15 @@  struct panel_desc {
 	 *           turn the display off (no content is visible)
 	 * @unprepare: the time (in milliseconds) that it takes for the panel
 	 *             to power itself down completely
+	 * @prepare_delay_only_if_no_hpd: The prepare delay should only be done
+	 *                                if we know Hot Plug Detect isn't used.
 	 */
 	struct {
 		unsigned int prepare;
 		unsigned int enable;
 		unsigned int disable;
 		unsigned int unprepare;
+		bool prepare_delay_only_if_no_hpd;
 	} delay;
 
 	u32 bus_format;
@@ -79,6 +82,7 @@  struct panel_simple {
 	struct drm_panel base;
 	bool prepared;
 	bool enabled;
+	bool no_hpd;
 
 	const struct panel_desc *desc;
 
@@ -215,7 +219,8 @@  static int panel_simple_prepare(struct drm_panel *panel)
 
 	gpiod_set_value_cansleep(p->enable_gpio, 1);
 
-	if (p->desc->delay.prepare)
+	if (p->desc->delay.prepare &&
+	    (!p->desc->delay.prepare_delay_only_if_no_hpd || p->no_hpd))
 		msleep(p->desc->delay.prepare);
 
 	p->prepared = true;
@@ -305,6 +310,8 @@  static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
 	panel->prepared = false;
 	panel->desc = desc;
 
+	panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd");
+
 	panel->supply = devm_regulator_get(dev, "power");
 	if (IS_ERR(panel->supply))
 		return PTR_ERR(panel->supply);