All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available
@ 2019-04-01 12:33 Peter Ujfalusi
  2019-04-02 11:21 ` Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2019-04-01 12:33 UTC (permalink / raw)
  To: tomi.valkeinen, laurent.pinchart, a.hajda, jsarha; +Cc: airlied, dri-devel

In case either the HPD gpio is not specified or when the HPD gpio can not
be used as interrupt we should tell the core that the HPD needs to be
polled for detecting hotplug.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index 285be4a0f4bd..6fc831eb3804 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -31,6 +31,7 @@ struct tfp410 {
 
 	struct i2c_adapter	*ddc;
 	struct gpio_desc	*hpd;
+	int			hpd_irq;
 	struct delayed_work	hpd_work;
 	struct gpio_desc	*powerdown;
 
@@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)
 		return -ENODEV;
 	}
 
-	if (dvi->hpd)
+	if (dvi->hpd_irq >= 0)
 		dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
+	else
+		dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
 
 	drm_connector_helper_add(&dvi->connector,
 				 &tfp410_con_helper_funcs);
@@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)
 		return PTR_ERR(dvi->powerdown);
 	}
 
-	if (dvi->hpd) {
+	if (dvi->hpd)
+		dvi->hpd_irq = gpiod_to_irq(dvi->hpd);
+	else
+		dvi->hpd_irq = -ENXIO;
+
+	if (dvi->hpd_irq >= 0) {
 		INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func);
 
-		ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd),
+		ret = devm_request_threaded_irq(dev, dvi->hpd_irq,
 			NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING |
 			IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 			"hdmi-hpd", dvi);
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available
  2019-04-01 12:33 [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available Peter Ujfalusi
@ 2019-04-02 11:21 ` Laurent Pinchart
  2019-04-02 13:10   ` Peter Ujfalusi
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2019-04-02 11:21 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: airlied, dri-devel, tomi.valkeinen, jsarha

Hi Peter,

Thank you for the patch.

On Mon, Apr 01, 2019 at 03:33:42PM +0300, Peter Ujfalusi wrote:
> In case either the HPD gpio is not specified or when the HPD gpio can not
> be used as interrupt we should tell the core that the HPD needs to be
> polled for detecting hotplug.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> index 285be4a0f4bd..6fc831eb3804 100644
> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> @@ -31,6 +31,7 @@ struct tfp410 {
>  
>  	struct i2c_adapter	*ddc;
>  	struct gpio_desc	*hpd;
> +	int			hpd_irq;
>  	struct delayed_work	hpd_work;
>  	struct gpio_desc	*powerdown;
>  
> @@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)
>  		return -ENODEV;
>  	}
>  
> -	if (dvi->hpd)
> +	if (dvi->hpd_irq >= 0)

Do you need a new hpd_irq field ? Can't you just test dvi->hpd as done
today, simply adding the else clause to this if ?

>  		dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
> +	else
> +		dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
>  
>  	drm_connector_helper_add(&dvi->connector,
>  				 &tfp410_con_helper_funcs);
> @@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)
>  		return PTR_ERR(dvi->powerdown);
>  	}
>  
> -	if (dvi->hpd) {
> +	if (dvi->hpd)
> +		dvi->hpd_irq = gpiod_to_irq(dvi->hpd);
> +	else
> +		dvi->hpd_irq = -ENXIO;
> +
> +	if (dvi->hpd_irq >= 0) {
>  		INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func);
>  
> -		ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd),
> +		ret = devm_request_threaded_irq(dev, dvi->hpd_irq,
>  			NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING |
>  			IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>  			"hdmi-hpd", dvi);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available
  2019-04-02 11:21 ` Laurent Pinchart
@ 2019-04-02 13:10   ` Peter Ujfalusi
  2019-04-04 14:09     ` Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2019-04-02 13:10 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: airlied, dri-devel, tomi.valkeinen, jsarha



On 02/04/2019 14.21, Laurent Pinchart wrote:
> Hi Peter,
> 
> Thank you for the patch.
> 
> On Mon, Apr 01, 2019 at 03:33:42PM +0300, Peter Ujfalusi wrote:
>> In case either the HPD gpio is not specified or when the HPD gpio can not
>> be used as interrupt we should tell the core that the HPD needs to be
>> polled for detecting hotplug.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>>  drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++---
>>  1 file changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
>> index 285be4a0f4bd..6fc831eb3804 100644
>> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
>> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
>> @@ -31,6 +31,7 @@ struct tfp410 {
>>  
>>  	struct i2c_adapter	*ddc;
>>  	struct gpio_desc	*hpd;
>> +	int			hpd_irq;
>>  	struct delayed_work	hpd_work;
>>  	struct gpio_desc	*powerdown;
>>  
>> @@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)
>>  		return -ENODEV;
>>  	}
>>  
>> -	if (dvi->hpd)
>> +	if (dvi->hpd_irq >= 0)
> 
> Do you need a new hpd_irq field ? Can't you just test dvi->hpd as done
> today, simply adding the else clause to this if ?

We can have hpd GPIO, but the GPIO might not be usable for interrupt.

> 
>>  		dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
>> +	else
>> +		dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
>>  
>>  	drm_connector_helper_add(&dvi->connector,
>>  				 &tfp410_con_helper_funcs);
>> @@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)
>>  		return PTR_ERR(dvi->powerdown);
>>  	}
>>  
>> -	if (dvi->hpd) {
>> +	if (dvi->hpd)
>> +		dvi->hpd_irq = gpiod_to_irq(dvi->hpd);
>> +	else
>> +		dvi->hpd_irq = -ENXIO;
>> +
>> +	if (dvi->hpd_irq >= 0) {
>>  		INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func);
>>  
>> -		ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd),
>> +		ret = devm_request_threaded_irq(dev, dvi->hpd_irq,
>>  			NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING |
>>  			IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>>  			"hdmi-hpd", dvi);
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available
  2019-04-02 13:10   ` Peter Ujfalusi
@ 2019-04-04 14:09     ` Laurent Pinchart
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2019-04-04 14:09 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: airlied, dri-devel, tomi.valkeinen, jsarha

Hi Peter,

On Tue, Apr 02, 2019 at 04:10:41PM +0300, Peter Ujfalusi wrote:
> On 02/04/2019 14.21, Laurent Pinchart wrote:
> > On Mon, Apr 01, 2019 at 03:33:42PM +0300, Peter Ujfalusi wrote:
> >> In case either the HPD gpio is not specified or when the HPD gpio can not
> >> be used as interrupt we should tell the core that the HPD needs to be
> >> polled for detecting hotplug.
> >>
> >> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> >> ---
> >>  drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++---
> >>  1 file changed, 11 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> >> index 285be4a0f4bd..6fc831eb3804 100644
> >> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
> >> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> >> @@ -31,6 +31,7 @@ struct tfp410 {
> >>  
> >>  	struct i2c_adapter	*ddc;
> >>  	struct gpio_desc	*hpd;
> >> +	int			hpd_irq;
> >>  	struct delayed_work	hpd_work;
> >>  	struct gpio_desc	*powerdown;
> >>  
> >> @@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)
> >>  		return -ENODEV;
> >>  	}
> >>  
> >> -	if (dvi->hpd)
> >> +	if (dvi->hpd_irq >= 0)
> > 
> > Do you need a new hpd_irq field ? Can't you just test dvi->hpd as done
> > today, simply adding the else clause to this if ?
> 
> We can have hpd GPIO, but the GPIO might not be usable for interrupt.

Ah, good point. I hadn't understood that from the commit message. Maybe
an additional sentence pointing out that not all GPIOs can be used as
IRQs would be useful.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> >>  		dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
> >> +	else
> >> +		dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
> >>  
> >>  	drm_connector_helper_add(&dvi->connector,
> >>  				 &tfp410_con_helper_funcs);
> >> @@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)
> >>  		return PTR_ERR(dvi->powerdown);
> >>  	}
> >>  
> >> -	if (dvi->hpd) {
> >> +	if (dvi->hpd)
> >> +		dvi->hpd_irq = gpiod_to_irq(dvi->hpd);
> >> +	else
> >> +		dvi->hpd_irq = -ENXIO;
> >> +
> >> +	if (dvi->hpd_irq >= 0) {
> >>  		INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func);
> >>  
> >> -		ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd),
> >> +		ret = devm_request_threaded_irq(dev, dvi->hpd_irq,
> >>  			NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING |
> >>  			IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> >>  			"hdmi-hpd", dvi);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-04 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 12:33 [PATCH] drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available Peter Ujfalusi
2019-04-02 11:21 ` Laurent Pinchart
2019-04-02 13:10   ` Peter Ujfalusi
2019-04-04 14:09     ` Laurent Pinchart

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.