Skip to contentSkip to conversation

drm/msm/dsi: do not install irq handler before power up the host

PATCH Superseded Dmitry Baryshkov 3 participants 14 messages Sep 21, 2021 – Oct 2, 2021

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dsi: do not install irq handler before power up the host

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +12 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
 		return ret;
 	}
 
-	ret = devm_request_irq(&pdev->dev, msm_host->irq,
-			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-			"dsi_isr", msm_host);
-	if (ret < 0) {
-		DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-				msm_host->irq, ret);
-		return ret;
-	}
-
 	msm_host->dev = dev;
 	ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
 	if (ret) {
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
 	if (msm_host->disp_en_gpio)
 		gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+	ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+			"dsi_isr", msm_host);
+	if (ret < 0) {
+		DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+				msm_host->irq, ret);
+		return ret;
+	}
+
+
 	msm_host->power_on = true;
 	mutex_unlock(&msm_host->dev_mutex);
 
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host)
 		goto unlock_ret;
 	}
 
+	devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
 	dsi_ctrl_config(msm_host, false, NULL, NULL);
 
 	if (msm_host->disp_en_gpio)
Signature · 1 line
2.30.2
#1 lore raw
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream happening when like you said the bootloader leaves the DSI host in unknown state. Just one question below.

Quoted 31 lines
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct 
 mipi_dsi_host *host,
 		return ret;
 	}
 
-	ret = devm_request_irq(&pdev->dev, msm_host->irq,
-			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-			"dsi_isr", msm_host);
-	if (ret < 0) {
-		DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-				msm_host->irq, ret);
-		return ret;
-	}
-
 	msm_host->dev = dev;
 	ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
 	if (ret) {
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host 
 *host,
 	if (msm_host->disp_en_gpio)
 		gpiod_set_value(msm_host->disp_en_gpio, 1);
 

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host · line 2417

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+	ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+			"dsi_isr", msm_host);
+	if (ret < 0) {
+		DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+				msm_host->irq, ret);
+		return ret;
+	}
+
+

Do you want to move this to msm_dsi_host_enable()?
So without the controller being enabled it is still in unknown state? Also do you want to do this after dsi0 and dsi1 are initialized to account for dual dsi cases?

Quoted 13 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
 	msm_host->power_on = true;
 	mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host 
 *host)
 		goto unlock_ret;
 	}
 
+	devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
 	dsi_ctrl_config(msm_host, false, NULL, NULL);
 

if (msm_host->disp_en_gpio)

#2 lore raw

Hi,

Quoted 50 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream happening
when like you said the bootloader leaves the DSI host in unknown state. Just one question below.

Quoted 31 lines
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
              return ret;
      }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-                             msm_host->irq, ret);
-             return ret;
-     }
-
      msm_host->dev = dev;
      ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
      if (ret) {
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
      if (msm_host->disp_en_gpio)
              gpiod_set_value(msm_host->disp_en_gpio, 1);
 
Quoted 13 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host *host, · line 2416

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()?
So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
      msm_host->power_on = true;
      mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
              goto unlock_ret;
      }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
      dsi_ctrl_config(msm_host, false, NULL, NULL);
 
      if (msm_host->disp_en_gpio)
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
Quoted 70 lines · Dmitry Baryshkov

Hi,

Quoted 50 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream happening
when like you said the bootloader leaves the DSI host in unknown state. Just one question below.

Quoted 31 lines
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
              return ret;
      }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-                             msm_host->irq, ret);
-             return ret;
-     }
-
      msm_host->dev = dev;
      ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
      if (ret) {
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
      if (msm_host->disp_en_gpio)
              gpiod_set_value(msm_host->disp_en_gpio, 1);
 
Quoted 13 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host *host, · line 2416

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()?
So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 7 lines
Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

We have seen cases where misconfiguration has caused interrupts to storm only on one DSI in some cases. So yes, I would prefer this is done after both are configured.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
      msm_host->power_on = true;
      mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
              goto unlock_ret;
      }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
      dsi_ctrl_config(msm_host, false, NULL, NULL);
 
      if (msm_host->disp_en_gpio)
#4 lore raw
Quoted 78 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 77 lines · Dmitry Baryshkov

Hi,

Quoted 58 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 7 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the

host is

Quoted 4 lines

in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream happening
when like you said the bootloader leaves the DSI host in unknown state. Just one question below.

Quoted 10 lines

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------

  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index e269df285136..cd842347a6b1 100644

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1959

Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -5
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
                return ret;
        }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: 

%d\n",

Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -4
-                             msm_host->irq, ret);
-             return ret;
-     }
-
        msm_host->dev = dev;
        ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);

       if (ret) {

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host · line 2412

Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
        if (msm_host->disp_en_gpio)
                gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to 

request IRQ%u: %d\n",

Quoted 8 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host *host, · line 2416

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -0
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()?
So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

Quoted 6 lines
Quoted 3 lines

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

We have seen cases where misconfiguration has caused interrupts to storm only on one DSI in some cases. So yes, I would prefer this is done after both are configured.

I've checked. The power_on is called from dsi_mgr_bridge_pre_enable() when both DSI hosts should be bound.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
        msm_host->power_on = true;
        mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
                goto unlock_ret;
        }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
        dsi_ctrl_config(msm_host, false, NULL, NULL);
 

       if (msm_host->disp_en_gpio)

Signature · 2 lines
With best wishes
Dmitry
#5 lore raw
Quoted 79 lines · Dmitry Baryshkov
Quoted 78 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 77 lines · Dmitry Baryshkov

Hi,

Quoted 50 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream happening
when like you said the bootloader leaves the DSI host in unknown state. Just one question below.

Quoted 31 lines

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------

  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
                return ret;
        }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-                             msm_host->irq, ret);
-             return ret;
-     }
-
        msm_host->dev = dev;
        ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);

       if (ret) {

drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
        if (msm_host->disp_en_gpio)
                gpiod_set_value(msm_host->disp_en_gpio, 1);
 
Quoted 13 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host *host, · line 2416

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()?
So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 6 lines
Quoted 3 lines

We have seen cases where misconfiguration has caused interrupts to storm only on one DSI in some cases. So yes, I would prefer this is done after both are configured.

I've checked. The power_on is called from dsi_mgr_bridge_pre_enable() when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that we need to have called msm_dsi_host_power_on() for both the hosts so that both are put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) 342 {
********************************
364 ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy);
365 if (ret) {
366 pr_err("%s: power on host %d failed, %d\n", __func__, id, ret);
367 goto host_on_fail;
368 }
369
370 if (is_bonded_dsi && msm_dsi1) {
371 ret = msm_dsi_host_power_on(msm_dsi1->host,
372 &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy);
373 if (ret) {
374 pr_err("%s: power on host1 failed, %d\n",
375 __func__, ret);
376 goto host1_on_fail;
377 }
378 }

< move the irq enable here >
**********************************

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
        msm_host->power_on = true;
        mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
                goto unlock_ret;
        }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
        dsi_ctrl_config(msm_host, false, NULL, NULL);
 

       if (msm_host->disp_en_gpio)

#6 lore raw
Quoted 121 lines · On Tue, 28 Sept 2021 at 03:22, <[email protected]> wrote:
Quoted 82 lines · Dmitry Baryshkov
Quoted 81 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 80 lines · Dmitry Baryshkov

Hi,

Quoted 52 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream
happening
when like you said the bootloader leaves the DSI host in unknown state.
Just one question below.

Quoted 31 lines
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
              return ret;
      }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-                             msm_host->irq, ret);
-             return ret;
-     }
-
      msm_host->dev = dev;
      ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
      if (ret) {
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
      if (msm_host->disp_en_gpio)
              gpiod_set_value(msm_host->disp_en_gpio, 1);
 
Quoted 14 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host *host, · line 2416

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()? So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 8 lines
Quoted 5 lines

We have seen cases where misconfiguration has caused interrupts to storm only
on one DSI in some cases. So yes, I would prefer this is done after both are
configured.

I've checked. The power_on is called from dsi_mgr_bridge_pre_enable() when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that
we need to have called msm_dsi_host_power_on() for both the hosts so that both are
put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) 342 {
********************************
364 ret = msm_dsi_host_power_on(host, &phy_shared_timings[id],
is_bonded_dsi, msm_dsi->phy);
365 if (ret) {
366 pr_err("%s: power on host %d failed, %d\n", __func__, id, ret);
367 goto host_on_fail;
368 }
369
370 if (is_bonded_dsi && msm_dsi1) {
371 ret = msm_dsi_host_power_on(msm_dsi1->host,
372 &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy);
373 if (ret) {
374 pr_err("%s: power on host1 failed, %d\n",
375 __func__, ret);
376 goto host1_on_fail;
377 }
378 }

Quoted 2 lines

< move the irq enable here >
**********************************

Ah, I see your point. What about moving to msm_dsi_host_enable() then?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
      msm_host->power_on = true;
      mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
              goto unlock_ret;
      }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
      dsi_ctrl_config(msm_host, false, NULL, NULL);
 
      if (msm_host->disp_en_gpio)
Signature · 2 lines
With best wishes
Dmitry
#7 lore raw
Quoted 122 lines · Dmitry Baryshkov
Quoted 121 lines · On Tue, 28 Sept 2021 at 03:22, <[email protected]> wrote:
Quoted 82 lines · Dmitry Baryshkov
Quoted 81 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 80 lines · Dmitry Baryshkov

Hi,

Quoted 52 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream
happening
when like you said the bootloader leaves the DSI host in unknown state.
Just one question below.

Quoted 31 lines
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
              return ret;
      }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-                             msm_host->irq, ret);
-             return ret;
-     }
-
      msm_host->dev = dev;
      ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
      if (ret) {
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
      if (msm_host->disp_en_gpio)
              gpiod_set_value(msm_host->disp_en_gpio, 1);
 
Quoted 14 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host · line 2417

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()? So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 8 lines
Quoted 5 lines

We have seen cases where misconfiguration has caused interrupts to storm only
on one DSI in some cases. So yes, I would prefer this is done after both are
configured.

I've checked. The power_on is called from dsi_mgr_bridge_pre_enable() when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that
we need to have called msm_dsi_host_power_on() for both the hosts so that both are
put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) 342 {
********************************
364 ret = msm_dsi_host_power_on(host, &phy_shared_timings[id],
is_bonded_dsi, msm_dsi->phy);
365 if (ret) {
366 pr_err("%s: power on host %d failed, %d\n", __func__, id, ret);
367 goto host_on_fail;
368 }
369
370 if (is_bonded_dsi && msm_dsi1) {
371 ret = msm_dsi_host_power_on(msm_dsi1->host,
372 &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy);
373 if (ret) {
374 pr_err("%s: power on host1 failed, %d\n",
375 __func__, ret);
376 goto host1_on_fail;
377 }
378 }

Quoted 4 lines
Quoted 2 lines

< move the irq enable here >
**********************************

Ah, I see your point. What about moving to msm_dsi_host_enable() then?

Yes, I had suggested this a few replies ago. But only at the dsi_msgr we know if DSI1 is also done. So you can do it right after it in below location?

427 if (is_dual_dsi && msm_dsi1) {
428 ret = msm_dsi_host_enable(msm_dsi1->host);
429 if (ret) {
430 pr_err("%s: enable host1 failed, %d\n", __func__, ret);
431 goto host1_en_fail;
432 }
433 }

<enable_irq here? >

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
      msm_host->power_on = true;
      mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
              goto unlock_ret;
      }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
      dsi_ctrl_config(msm_host, false, NULL, NULL);
 
      if (msm_host->disp_en_gpio)
#8 lore raw
Quoted 150 lines · On 28/09/2021 04:19, [email protected] wrote:
Quoted 133 lines · Dmitry Baryshkov
Quoted 132 lines · On Tue, 28 Sept 2021 at 03:22, <[email protected]> wrote:
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 6 lines · Dmitry Baryshkov

Hi,

Quoted 3 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 1 line · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If

this

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the

known

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

state.

Move the request/free_irq calls into

msm_dsi_host_power_on/_off calls,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so that we can be sure that the interrupt is delivered when

the host is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector

support")

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 1 line

This is a valid change and we have seen interrupt storms in downstream
happening
when like you said the bootloader leaves the DSI host in unknown state.
Just one question below.

Quoted 14 lines

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------

  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
                return ret;
        }
 
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1956

Quoted 2 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -2
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | 

IRQF_ONESHOT,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1959

Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -3
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request 

IRQ%u: %d\n",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct

Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -4
-                             msm_host->irq, ret);
-             return ret;
-     }
-
        msm_host->dev = dev;
        ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);

       if (ret) {

drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct 

mipi_dsi_host

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2409

Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
 *host,
        if (msm_host->disp_en_gpio)
                gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | 

IRQF_ONESHOT,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2412

Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -0
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to 

request IRQ%u: %d\n",

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2417

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -0
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()? So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the

state

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 8 lines
Quoted 5 lines

We have seen cases where misconfiguration has caused interrupts to storm only
on one DSI in some cases. So yes, I would prefer this is done after both are
configured.

I've checked. The power_on is called from dsi_mgr_bridge_pre_enable() when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that
we need to have called msm_dsi_host_power_on() for both the hosts so that both are
put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
342 {
********************************
364     ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy);
365     if (ret) {
366             pr_err("%s: power on host %d failed, %d\n", __func__, id, ret); 367             goto host_on_fail;
368     }
369
370     if (is_bonded_dsi && msm_dsi1) {
371             ret = msm_dsi_host_power_on(msm_dsi1->host,
372                             &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy); 373             if (ret) {
374                     pr_err("%s: power on host1 failed, %d\n",
375                                                     __func__, ret);
376                     goto host1_on_fail;
377             }
378     }

Quoted 4 lines
Quoted 2 lines

< move the irq enable here >
**********************************

Ah, I see your point. What about moving to msm_dsi_host_enable() then?

Yes, I had suggested this a few replies ago. But only at the dsi_msgr we know if DSI1 is also done. So you can do it right after it in below location?

427     if (is_dual_dsi && msm_dsi1) {
428         ret = msm_dsi_host_enable(msm_dsi1->host);
429         if (ret) {
430             pr_err("%s: enable host1 failed, %d\n", __func__, ret); 431             goto host1_en_fail;
432         }
433     }

Quoted 1 line

<enable_irq here? >

If there is DSI1, it was also powered on/programmed at the time of msm_dsi_host_enable, so enabling IRQs from it should be safe. Do you see any pitfalls from enabling the irq from that function?

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_off(struct

Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
        msm_host->power_on = true;
        mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct 

mipi_dsi_host

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_off(struct · line 2444

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
 *host)
                goto unlock_ret;
        }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, 

msm_host);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
+
        dsi_ctrl_config(msm_host, false, NULL, NULL);
 

       if (msm_host->disp_en_gpio)

Signature · 2 lines
With best wishes
Dmitry
#9 lore raw
Quoted 140 lines · Dmitry Baryshkov
Quoted 139 lines · On 28/09/2021 04:19, [email protected] wrote:
Quoted 122 lines · Dmitry Baryshkov
Quoted 121 lines · On Tue, 28 Sept 2021 at 03:22, <[email protected]> wrote:
Quoted 82 lines · Dmitry Baryshkov
Quoted 81 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 80 lines · Dmitry Baryshkov

Hi,

Quoted 52 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 11 lines · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")

This is a valid change and we have seen interrupt storms in downstream
happening
when like you said the bootloader leaves the DSI host in unknown state.
Just one question below.

Quoted 31 lines

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------

  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
                return ret;
        }
 
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-                             msm_host->irq, ret);
-             return ret;
-     }
-
        msm_host->dev = dev;
        ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);

       if (ret) {

drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host
 *host,
        if (msm_host->disp_en_gpio)
                gpiod_set_value(msm_host->disp_en_gpio, 1);
 
Quoted 14 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct mipi_dsi_host · line 2417

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
+     ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()? So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the state is known at the end of the power_on().

Quoted 3 lines

Also do you want to do this after dsi0 and dsi1 are initialized to account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 8 lines
Quoted 5 lines

We have seen cases where misconfiguration has caused interrupts to storm only
on one DSI in some cases. So yes, I would prefer this is done after both are
configured.

I've checked. The power_on is called from dsi_mgr_bridge_pre_enable() when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that
we need to have called msm_dsi_host_power_on() for both the hosts so that both are
put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
342 {
********************************
364     ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy);
365     if (ret) {
366             pr_err("%s: power on host %d failed, %d\n", __func__, id, ret); 367             goto host_on_fail;
368     }
369
370     if (is_bonded_dsi && msm_dsi1) {
371             ret = msm_dsi_host_power_on(msm_dsi1->host,
372                             &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy); 373             if (ret) {
374                     pr_err("%s: power on host1 failed, %d\n",
375                                                     __func__, ret);
376                     goto host1_on_fail;
377             }
378     }

Quoted 4 lines
Quoted 2 lines

< move the irq enable here >
**********************************

Ah, I see your point. What about moving to msm_dsi_host_enable() then?

Yes, I had suggested this a few replies ago. But only at the dsi_msgr we know if DSI1 is also done. So you can do it right after it in below location?

427     if (is_dual_dsi && msm_dsi1) {
428         ret = msm_dsi_host_enable(msm_dsi1->host);
429         if (ret) {
430             pr_err("%s: enable host1 failed, %d\n", __func__, ret); 431             goto host1_en_fail;
432         }
433     }

Quoted 5 lines
Quoted 1 line

<enable_irq here? >

If there is DSI1, it was also powered on/programmed at the time of msm_dsi_host_enable, so enabling IRQs from it should be safe. Do you see any pitfalls from enabling the irq from that function?

Just about symmetry. We will enable_irq() for DSI0 when DSI0 and DSI1 are powered on But for DSI1, we will enable it when its powered ON but not enabled. Hence i thought its better this way.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
        msm_host->power_on = true;
        mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host
 *host)
                goto unlock_ret;
        }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
        dsi_ctrl_config(msm_host, false, NULL, NULL);
 

       if (msm_host->disp_en_gpio)

#10 lore raw
Quoted 157 lines · On 28/09/2021 04:33, [email protected] wrote:
Quoted 156 lines · Dmitry Baryshkov
Quoted 154 lines · On 28/09/2021 04:19, [email protected] wrote:
Quoted 136 lines · Dmitry Baryshkov
Quoted 135 lines · On Tue, 28 Sept 2021 at 03:22, <[email protected]> wrote:
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 6 lines · Dmitry Baryshkov

Hi,

Quoted 3 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 1 line · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader.

If this

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the

known

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

state.

Move the request/free_irq calls into

msm_dsi_host_power_on/_off calls,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so that we can be sure that the interrupt is delivered when

the host is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector

support")

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 1 line

This is a valid change and we have seen interrupt storms in downstream
happening
when like you said the bootloader leaves the DSI host in unknown state.
Just one question below.

Quoted 14 lines

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------

  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
                return ret;
        }
 
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1956

Quoted 2 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -2
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | 

IRQF_ONESHOT,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1959

Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -3
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request 

IRQ%u: %d\n",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct

Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -4
-                             msm_host->irq, ret);
-             return ret;
-     }
-
        msm_host->dev = dev;
        ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);

       if (ret) {

drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct 

mipi_dsi_host

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2408

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
 *host,
        if (msm_host->disp_en_gpio)
                gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+     ret = devm_request_irq(&msm_host->pdev->dev, 

msm_host->irq,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2409

Quoted 1 line
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | 

IRQF_ONESHOT,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2412

Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -0
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to 

request IRQ%u: %d\n",

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2417

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -0
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()? So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so the

state

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

is known at the end of the power_on().

Quoted 1 line

Also do you want to do this after dsi0 and dsi1 are

initialized to

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

Quoted 7 lines
Quoted 5 lines

We have seen cases where misconfiguration has caused interrupts to storm only
on one DSI in some cases. So yes, I would prefer this is done after both are
configured.

I've checked. The power_on is called from

dsi_mgr_bridge_pre_enable()

Quoted 1 line

when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that
we need to have called msm_dsi_host_power_on() for both the hosts so that both are
put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
342 {
********************************
364     ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy);
365     if (ret) {
366             pr_err("%s: power on host %d failed, %d\n", __func__, id, ret); 367             goto host_on_fail;
368     }
369
370     if (is_bonded_dsi && msm_dsi1) {
371             ret = msm_dsi_host_power_on(msm_dsi1->host,
372                             &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy); 373             if (ret) {
374                     pr_err("%s: power on host1 failed, %d\n",
375                                                     __func__, ret);
376                     goto host1_on_fail;
377             }
378     }

Quoted 4 lines
Quoted 2 lines

< move the irq enable here >
**********************************

Ah, I see your point. What about moving to msm_dsi_host_enable() then?

Yes, I had suggested this a few replies ago. But only at the dsi_msgr we know if DSI1 is also done. So you can do it right after it in below location?

427     if (is_dual_dsi && msm_dsi1) {
428         ret = msm_dsi_host_enable(msm_dsi1->host);
429         if (ret) {
430             pr_err("%s: enable host1 failed, %d\n", __func__, ret); 431             goto host1_en_fail;
432         }
433     }

<enable_irq here? >

Quoted 7 lines
Quoted 3 lines

If there is DSI1, it was also powered on/programmed at the time of msm_dsi_host_enable, so enabling IRQs from it should be safe. Do you see any pitfalls from enabling the irq from that function?

Just about symmetry. We will enable_irq() for DSI0 when DSI0 and DSI1 are powered on But for DSI1, we will enable it when its powered ON but not enabled. Hence i thought its better this way.

Ah. Then it would be better to call it between power_on() and enable(). I'll send v3.

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_off(struct

Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
        msm_host->power_on = true;
        mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct 

mipi_dsi_host

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_off(struct · line 2444

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
 *host)
                goto unlock_ret;
        }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, 

msm_host);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
+
        dsi_ctrl_config(msm_host, false, NULL, NULL);
 

       if (msm_host->disp_en_gpio)

Signature · 2 lines
With best wishes
Dmitry
#11 lore raw
Quoted 164 lines · Dmitry Baryshkov
Quoted 163 lines · On 28/09/2021 04:33, [email protected] wrote:
Quoted 161 lines · Dmitry Baryshkov
Quoted 155 lines · On 28/09/2021 04:19, [email protected] wrote:
Quoted 138 lines · Dmitry Baryshkov
Quoted 137 lines · On Tue, 28 Sept 2021 at 03:22, <[email protected]> wrote:
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · On 21/09/2021 23:52, [email protected] wrote:
Quoted 6 lines · Dmitry Baryshkov

Hi,

Quoted 3 lines · On Tue, 21 Sept 2021 at 20:01, <[email protected]> wrote:
Quoted 1 line · Dmitry Baryshkov

The DSI host might be left in some state by the bootloader.

If this

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

state generates an IRQ, it might hang the system by holding

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

interrupt line before the driver sets up the DSI host to

the known

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

state.

Move the request/free_irq calls into

msm_dsi_host_power_on/_off calls,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so that we can be sure that the interrupt is delivered when

the host is

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

in the known state.

Fixes a689554ba6ed ("drm/msm: Initial add DSI connector

support")

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 1 line

This is a valid change and we have seen interrupt storms in downstream
happening
when like you said the bootloader leaves the DSI host in unknown state.
Just one question below.

Quoted 14 lines

---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------

  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct
 mipi_dsi_host *host,
                return ret;
        }
 
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1956

Quoted 2 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -2
-     ret = devm_request_irq(&pdev->dev, msm_host->irq,
-                     dsi_host_irq, IRQF_TRIGGER_HIGH | 

IRQF_ONESHOT,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_modeset_init(struct · line 1959

Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -3
-                     "dsi_isr", msm_host);
-     if (ret < 0) {
-             DRM_DEV_ERROR(&pdev->dev, "failed to request 

IRQ%u: %d\n",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct

Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -4
-                             msm_host->irq, ret);
-             return ret;
-     }
-
        msm_host->dev = dev;
        ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);

       if (ret) {

drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct 

mipi_dsi_host

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2408

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
 *host,
        if (msm_host->disp_en_gpio)
                gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+     ret = devm_request_irq(&msm_host->pdev->dev, 

msm_host->irq,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2409

Quoted 1 line
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
+                     dsi_host_irq, IRQF_TRIGGER_HIGH | 

IRQF_ONESHOT,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2412

Quoted 3 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -0
+                     "dsi_isr", msm_host);
+     if (ret < 0) {
+             DRM_DEV_ERROR(&msm_host->pdev->dev, "failed 

to request IRQ%u: %d\n",

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_on(struct · line 2417

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -0
+                             msm_host->irq, ret);
+             return ret;
+     }
+
+

Do you want to move this to msm_dsi_host_enable()? So without the controller being enabled it is still in unknown state?

msm_dsi_host_power_on() reconfigures the host registers, so

the state

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

is known at the end of the power_on().

Quoted 1 line

Also do you want to do this after dsi0 and dsi1 are

initialized to

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

account for
dual dsi cases?

I don't think this should matter. The host won't generate 'extra' interrupts in such case, will it?

We have seen cases where misconfiguration has caused interrupts to storm only
on one DSI in some cases. So yes, I would prefer this is done

after

Quoted 4 lines
Quoted 2 lines

both are
configured.

I've checked. The power_on is called from

dsi_mgr_bridge_pre_enable()

Quoted 1 line

when both DSI hosts should be bound.

DSI being bound is enough? I thought the issue we are trying to address is that
we need to have called msm_dsi_host_power_on() for both the hosts so that both are
put in the known state before requesting the irq.

OR in other words move the irq_enable() to below location.

341 static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
342 {
********************************
364     ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy);
365     if (ret) {
366             pr_err("%s: power on host %d failed, %d\n", __func__, id, ret); 367             goto host_on_fail;
368     }
369
370     if (is_bonded_dsi && msm_dsi1) {
371             ret = msm_dsi_host_power_on(msm_dsi1->host,
372                             &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy); 373             if (ret) {
374                     pr_err("%s: power on host1 failed, %d\n",
375                                                     __func__, ret);
376                     goto host1_on_fail;
377             }
378     }

Quoted 4 lines
Quoted 2 lines

< move the irq enable here >
**********************************

Ah, I see your point. What about moving to msm_dsi_host_enable() then?

Yes, I had suggested this a few replies ago. But only at the dsi_msgr we know if DSI1 is also done. So you can do it right after it in below location?

427     if (is_dual_dsi && msm_dsi1) {
428         ret = msm_dsi_host_enable(msm_dsi1->host);
429         if (ret) {
430             pr_err("%s: enable host1 failed, %d\n", __func__, ret); 431             goto host1_en_fail;
432         }
433     }

Quoted 1 line

<enable_irq here? >

If there is DSI1, it was also powered on/programmed at the time of msm_dsi_host_enable, so enabling IRQs from it should be safe. Do you see any pitfalls from enabling the irq from that function?

Quoted 5 lines
Quoted 3 lines

Just about symmetry. We will enable_irq() for DSI0 when DSI0 and DSI1 are powered on But for DSI1, we will enable it when its powered ON but not enabled. Hence i thought its better this way.

Ah. Then it would be better to call it between power_on() and enable(). I'll send v3.

V3 sent, moving the enable_irq() out of msm_dsi_host_power_on.

Quoted 22 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_off(struct

Quoted 9 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
        msm_host->power_on = true;
        mutex_unlock(&msm_host->dev_mutex);
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct 

mipi_dsi_host

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/msm/dsi/dsi_host.c int msm_dsi_host_power_off(struct · line 2444

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
 *host)
                goto unlock_ret;
        }
 
+     devm_free_irq(&msm_host->pdev->dev, msm_host->irq, 

msm_host);

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -0
+
        dsi_ctrl_config(msm_host, false, NULL, NULL);
 

       if (msm_host->disp_en_gpio)

Signature · 2 lines
With best wishes
Dmitry
#12 lore raw
In reply to Dmitry Baryshkov

W dniu 21.09.2021 o 18:22, Dmitry Baryshkov pisze:

Quoted 8 lines

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

The established practice is to request IRQ in probe, to avoid auto-enabling use IRQF_NO_AUTOEN flag.

Then you can call enable_irq in power-on.

Regards

Andrzej

Quoted 53 lines
Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")
---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +12 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
  		return ret;
  	}
 
-	ret = devm_request_irq(&pdev->dev, msm_host->irq,
-			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-			"dsi_isr", msm_host);
-	if (ret < 0) {
-		DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-				msm_host->irq, ret);
-		return ret;
-	}
-
  	msm_host->dev = dev;
  	ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
  	if (ret) {
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
  	if (msm_host->disp_en_gpio)
  		gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+	ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+			"dsi_isr", msm_host);
+	if (ret < 0) {
+		DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+				msm_host->irq, ret);
+		return ret;
+	}
+
+
  	msm_host->power_on = true;
  	mutex_unlock(&msm_host->dev_mutex);
 
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host)
  		goto unlock_ret;
  	}
 
+	devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
  	dsi_ctrl_config(msm_host, false, NULL, NULL);
 
  	if (msm_host->disp_en_gpio)
#13 lore raw
Quoted 11 lines · Andrzej Hajda

W dniu 21.09.2021 o 18:22, Dmitry Baryshkov pisze:

Quoted 8 lines

The DSI host might be left in some state by the bootloader. If this state generates an IRQ, it might hang the system by holding the interrupt line before the driver sets up the DSI host to the known state.

Move the request/free_irq calls into msm_dsi_host_power_on/_off calls, so that we can be sure that the interrupt is delivered when the host is in the known state.

Quoted 4 lines

The established practice is to request IRQ in probe, to avoid auto-enabling use IRQF_NO_AUTOEN flag.

Then you can call enable_irq in power-on.

Nice idea, thank you! I somehow missed addition of IRQF_NO_AUTOEN. I've used it in v2 ([PATCH v2] drm/msm/dsi: do not enable irq handler before powering up the host).

Quoted 61 lines

Regards

Andrzej

Quoted 53 lines
Fixes a689554ba6ed ("drm/msm: Initial add DSI connector support")
---
   drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
   1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +12 -9
index e269df285136..cd842347a6b1 100644
@@ -1951,15 +1951,6 @@ int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
   		return ret;
   	}
 
-	ret = devm_request_irq(&pdev->dev, msm_host->irq,
-			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-			"dsi_isr", msm_host);
-	if (ret < 0) {
-		DRM_DEV_ERROR(&pdev->dev, "failed to request IRQ%u: %d\n",
-				msm_host->irq, ret);
-		return ret;
-	}
-
   	msm_host->dev = dev;
   	ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
   	if (ret) {
@@ -2413,6 +2404,16 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
   	if (msm_host->disp_en_gpio)
   		gpiod_set_value(msm_host->disp_en_gpio, 1);
 
+	ret = devm_request_irq(&msm_host->pdev->dev, msm_host->irq,
+			dsi_host_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+			"dsi_isr", msm_host);
+	if (ret < 0) {
+		DRM_DEV_ERROR(&msm_host->pdev->dev, "failed to request IRQ%u: %d\n",
+				msm_host->irq, ret);
+		return ret;
+	}
+
+
   	msm_host->power_on = true;
   	mutex_unlock(&msm_host->dev_mutex);
 
@@ -2439,6 +2440,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host)
   		goto unlock_ret;
   	}
 
+	devm_free_irq(&msm_host->pdev->dev, msm_host->irq, msm_host);
+
   	dsi_ctrl_config(msm_host, false, NULL, NULL);
 
   	if (msm_host->disp_en_gpio)
Signature · 2 lines
With best wishes
Dmitry