dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler
@ 2023-07-27 10:01 Pin-yen Lin
  2023-08-01  9:37 ` Neil Armstrong
  2023-08-03  8:32 ` Neil Armstrong
  0 siblings, 2 replies; 3+ messages in thread
From: Pin-yen Lin @ 2023-07-27 10:01 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter
  Cc: Pin-yen Lin, linux-kernel, dri-devel

On system resume, the driver might call it6505_poweron directly if the
runtime PM hasn't been enabled. In such case, pm_runtime_get_if_in_use
will always return 0 because dev->power.runtime_status stays at
RPM_SUSPENDED, and the IRQ will never be handled.

Use it6505->powered from the driver struct fixes this because it always
gets updated when it6505_poweron is called.

Fixes: 5eb9a4314053 ("drm/bridge: it6505: Guard bridge power in IRQ handler")
Signed-off-by: Pin-yen Lin <treapking@chromium.org>

---

 drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 6c2fcd8b8780..2f300f5ca051 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2517,9 +2517,11 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
 	};
 	int int_status[3], i;
 
-	if (it6505->enable_drv_hold || pm_runtime_get_if_in_use(dev) <= 0)
+	if (it6505->enable_drv_hold || !it6505->powered)
 		return IRQ_HANDLED;
 
+	pm_runtime_get_sync(dev);
+
 	int_status[0] = it6505_read(it6505, INT_STATUS_01);
 	int_status[1] = it6505_read(it6505, INT_STATUS_02);
 	int_status[2] = it6505_read(it6505, INT_STATUS_03);
-- 
2.41.0.487.g6d72f3e995-goog


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

* Re: [PATCH] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler
  2023-07-27 10:01 [PATCH] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler Pin-yen Lin
@ 2023-08-01  9:37 ` Neil Armstrong
  2023-08-03  8:32 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-08-01  9:37 UTC (permalink / raw)
  To: Pin-yen Lin, Andrzej Hajda, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, David Airlie, Daniel Vetter
  Cc: linux-kernel, dri-devel

On 27/07/2023 12:01, Pin-yen Lin wrote:
> On system resume, the driver might call it6505_poweron directly if the
> runtime PM hasn't been enabled. In such case, pm_runtime_get_if_in_use
> will always return 0 because dev->power.runtime_status stays at
> RPM_SUSPENDED, and the IRQ will never be handled.
> 
> Use it6505->powered from the driver struct fixes this because it always
> gets updated when it6505_poweron is called.
> 
> Fixes: 5eb9a4314053 ("drm/bridge: it6505: Guard bridge power in IRQ handler")
> Signed-off-by: Pin-yen Lin <treapking@chromium.org>
> 
> ---
> 
>   drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 6c2fcd8b8780..2f300f5ca051 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -2517,9 +2517,11 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
>   	};
>   	int int_status[3], i;
>   
> -	if (it6505->enable_drv_hold || pm_runtime_get_if_in_use(dev) <= 0)
> +	if (it6505->enable_drv_hold || !it6505->powered)
>   		return IRQ_HANDLED;
>   
> +	pm_runtime_get_sync(dev);
> +
>   	int_status[0] = it6505_read(it6505, INT_STATUS_01);
>   	int_status[1] = it6505_read(it6505, INT_STATUS_02);
>   	int_status[2] = it6505_read(it6505, INT_STATUS_03);

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

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

* Re: [PATCH] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler
  2023-07-27 10:01 [PATCH] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler Pin-yen Lin
  2023-08-01  9:37 ` Neil Armstrong
@ 2023-08-03  8:32 ` Neil Armstrong
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-08-03  8:32 UTC (permalink / raw)
  To: Andrzej Hajda, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, David Airlie, Daniel Vetter, Pin-yen Lin
  Cc: linux-kernel, dri-devel

Hi,

On Thu, 27 Jul 2023 18:01:10 +0800, Pin-yen Lin wrote:
> On system resume, the driver might call it6505_poweron directly if the
> runtime PM hasn't been enabled. In such case, pm_runtime_get_if_in_use
> will always return 0 because dev->power.runtime_status stays at
> RPM_SUSPENDED, and the IRQ will never be handled.
> 
> Use it6505->powered from the driver struct fixes this because it always
> gets updated when it6505_poweron is called.
> 
> [...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-fixes)

[1/1] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=e9d699af3f65d62cf195f0e7a039400093ab2af2

-- 
Neil


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

end of thread, other threads:[~2023-08-03  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27 10:01 [PATCH] drm/bridge: it6505: Check power state with it6505->powered in IRQ handler Pin-yen Lin
2023-08-01  9:37 ` Neil Armstrong
2023-08-03  8:32 ` Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).