Skip to contentSkip to conversation

drm: bridge: dw-mipi-dsi: Drop panel_bridge post_disable call

PATCH In review Marek Vasut 3 participants 7 messages May 13, 2023 – May 16, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: bridge: dw-mipi-dsi: Drop panel_bridge post_disable call

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -9
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
 	 */
 	dw_mipi_dsi_set_mode(dsi, 0);
 
-	/*
-	 * TODO Only way found to call panel-bridge post_disable &
-	 * panel unprepare before the dsi "final" disable...
-	 * This needs to be fixed in the drm_bridge framework and the API
-	 * needs to be updated to manage our own call chains...
-	 */
-	if (dsi->panel_bridge->funcs->post_disable)
-		dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-
 	if (phy_ops->power_off)
 		phy_ops->power_off(dsi->plat_data->priv_data);
 
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 45 lines · Marek Vasut

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
  1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -2
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
  	 */
  	dw_mipi_dsi_set_mode(dsi, 0);
 
-	/*
-	 * TODO Only way found to call panel-bridge post_disable &

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge, · line 864

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -7
-	 * panel unprepare before the dsi "final" disable...
-	 * This needs to be fixed in the drm_bridge framework and the API
-	 * needs to be updated to manage our own call chains...
-	 */
-	if (dsi->panel_bridge->funcs->post_disable)
-		dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-
  	if (phy_ops->power_off)
  		phy_ops->power_off(dsi->plat_data->priv_data);
 

Waiting a few days before applying

#2 lore raw
In reply to Marek Vasut

Hi Marek and Neil,

Quoted 43 lines · Marek Vasut

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
         */
        dw_mipi_dsi_set_mode(dsi, 0);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge, · line 870

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -9
 
-       /*
-        * TODO Only way found to call panel-bridge post_disable &
-        * panel unprepare before the dsi "final" disable...
-        * This needs to be fixed in the drm_bridge framework and the API
-        * needs to be updated to manage our own call chains...
-        */
-       if (dsi->panel_bridge->funcs->post_disable)
-               dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-

If my understanding was correct, the controller set the low-speed DCS in pre_enable and high-speed DCS in enable. So I'm thinking this explicit post_disable still needs to revert the operation within the bridge chain. I didn't test this but trying to understand how the existing behaviour is satisfied if we drop this.

Thanks,
Jagan.

#3 lore raw
Quoted 47 lines · Jagan Teki

Hi Marek and Neil,

Quoted 44 lines · Marek Vasut

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
  1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
          */
         dw_mipi_dsi_set_mode(dsi, 0);
 
Quoted 15 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge, · line 870

Quoted 9 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -9
-       /*
-        * TODO Only way found to call panel-bridge post_disable &
-        * panel unprepare before the dsi "final" disable...
-        * This needs to be fixed in the drm_bridge framework and the API
-        * needs to be updated to manage our own call chains...
-        */
-       if (dsi->panel_bridge->funcs->post_disable)
-               dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-

If my understanding was correct, the controller set the low-speed DCS in pre_enable and high-speed DCS in enable. So I'm thinking this explicit post_disable still needs to revert the operation within the bridge chain. I didn't test this but trying to understand how the existing behaviour is satisfied if we drop this.

Did I miss a panel_bridge pre_enable call somewhere in the driver ? Where is it ?

#4 lore raw
Quoted 65 lines · Marek Vasut
Quoted 47 lines · Jagan Teki

Hi Marek and Neil,

Quoted 44 lines · Marek Vasut

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
  1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
          */
         dw_mipi_dsi_set_mode(dsi, 0);
 
Quoted 15 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge, · line 870

Quoted 9 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -9
-       /*
-        * TODO Only way found to call panel-bridge post_disable &
-        * panel unprepare before the dsi "final" disable...
-        * This needs to be fixed in the drm_bridge framework and the API
-        * needs to be updated to manage our own call chains...
-        */
-       if (dsi->panel_bridge->funcs->post_disable)
-               dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-

If my understanding was correct, the controller set the low-speed DCS in pre_enable and high-speed DCS in enable. So I'm thinking this explicit post_disable still needs to revert the operation within the bridge chain. I didn't test this but trying to understand how the existing behaviour is satisfied if we drop this.

Quoted 2 lines

Did I miss a panel_bridge pre_enable call somewhere in the driver ? Where is it ?

Haa, sorry the next bridge pre_enable. driver setting the command-mode (low-speed) in mode_set so when the next bridge pre_enable is called, low-speed DCS can be sent, then the bridge enable() sets video mode (high-speed). This is where an explicit post_disable would be required, this is what I understood so far.

Jagan.

#5 lore raw
Quoted 66 lines · Jagan Teki
Quoted 65 lines · Marek Vasut
Quoted 62 lines · Jagan Teki

Hi Marek and Neil,

Quoted 43 lines · Marek Vasut

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
   1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
           */
          dw_mipi_dsi_set_mode(dsi, 0);

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge, · line 870

Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -9
 
-       /*
-        * TODO Only way found to call panel-bridge post_disable &
-        * panel unprepare before the dsi "final" disable...
-        * This needs to be fixed in the drm_bridge framework and the API
-        * needs to be updated to manage our own call chains...
-        */
-       if (dsi->panel_bridge->funcs->post_disable)
-               dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-

If my understanding was correct, the controller set the low-speed DCS in pre_enable and high-speed DCS in enable. So I'm thinking this explicit post_disable still needs to revert the operation within the bridge chain. I didn't test this but trying to understand how the existing behaviour is satisfied if we drop this.

Quoted 8 lines
Quoted 2 lines

Did I miss a panel_bridge pre_enable call somewhere in the driver ? Where is it ?

Haa, sorry the next bridge pre_enable. driver setting the command-mode (low-speed) in mode_set so when the next bridge pre_enable is called, low-speed DCS can be sent, then the bridge enable() sets video mode (high-speed). This is where an explicit post_disable would be required, this is what I understood so far.

So, in the end, all is good with this patch or is there anything missing ?

#6 lore raw
Quoted 71 lines · Marek Vasut
Quoted 69 lines · Jagan Teki
Quoted 67 lines · Marek Vasut
Quoted 47 lines · Jagan Teki

Hi Marek and Neil,

Quoted 44 lines · Marek Vasut

This panel_bridge post_disable callback is called from the bridge chain now, so drop the explicit call here. This fixes call imbalance, where this driver does not call ->pre_enable, but does call ->post_disable . In case either of the two callbacks implemented in one of the panel or bridge drivers contains any operation with refcounted object, like regulator, this would make kernel complain about the imbalance.

This can be triggered e.g. with ST7701 driver, which operates on regulators in its prepare/unprepare callbacks, which are called from pre_enable/post_disable callbacks respectively. The former is called once, the later twice, during entry to suspend.

Drop the post_disable call to fix the imbalance.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Antonio Borneo <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Vincent Abriou <[email protected]>
Cc: Yannick Fertre <[email protected]>
Cc: [email protected]

---
   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 ---------
   1 file changed, 9 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -0
index b2efecf7d1603..63ac972547361 100644
@@ -859,15 +859,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,
           */
          dw_mipi_dsi_set_mode(dsi, 0);
 
Quoted 15 lines

drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge, · line 870

Quoted 9 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -9
-       /*
-        * TODO Only way found to call panel-bridge post_disable &
-        * panel unprepare before the dsi "final" disable...
-        * This needs to be fixed in the drm_bridge framework and the API
-        * needs to be updated to manage our own call chains...
-        */
-       if (dsi->panel_bridge->funcs->post_disable)
-               dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
-

If my understanding was correct, the controller set the low-speed DCS in pre_enable and high-speed DCS in enable. So I'm thinking this explicit post_disable still needs to revert the operation within the bridge chain. I didn't test this but trying to understand how the existing behaviour is satisfied if we drop this.

Did I miss a panel_bridge pre_enable call somewhere in the driver ? Where is it ?

Quoted 7 lines
Quoted 5 lines

Haa, sorry the next bridge pre_enable. driver setting the command-mode (low-speed) in mode_set so when the next bridge pre_enable is called, low-speed DCS can be sent, then the bridge enable() sets video mode (high-speed). This is where an explicit post_disable would be required, this is what I understood so far.

So, in the end, all is good with this patch or is there anything missing ?

It is not good, explicit post_disable would required for graceful speed change as it is done in mode_set and enable.

Jagan.