diff mbox series

[v6,02/21] drm/bridge: adv7511: Register and attach our DSI device at probe

Message ID 20211025151536.1048186-3-maxime@cerno.tech (mailing list archive)
State Not Applicable
Headers show
Series drm/bridge: Make panel and bridge probe order consistent | expand

Commit Message

Maxime Ripard Oct. 25, 2021, 3:15 p.m. UTC
In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Maxime Ripard Oct. 27, 2021, 8:09 p.m. UTC | #1
On Mon, 25 Oct 2021 17:15:17 +0200, Maxime Ripard wrote:
> In order to avoid any probe ordering issue, the best practice is to move
> the secondary MIPI-DSI device registration and attachment to the
> MIPI-DSI host at probe time. Let's do this.
> 
> 

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime
Marek Szyprowski Oct. 29, 2021, 6:23 a.m. UTC | #2
Hi,

On 25.10.2021 17:15, Maxime Ripard wrote:
> In order to avoid any probe ordering issue, the best practice is to move
> the secondary MIPI-DSI device registration and attachment to the
> MIPI-DSI host at probe time. Let's do this.
>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> Tested-by: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

This patch landed in linux-next as commit 864c49a31d6b ("drm/bridge: 
adv7511: Register and attach our DSI device at probe"). Sadly it causes 
endless probe-fail-defer loop on DragonBoard 410c board 
(arch/arm64/boot/dts/qcom/apq8016-sbc.dts):

qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: PMIC 
REV: 1      CODEC Version: 1
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget ADC1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget ADC1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX3 overwritten
debugfs: File 'Capture' in directory 'dapm' already present!
adv7511 3-0039: failed to find dsi host
adv7511 3-0039: supply dvdd not found, using dummy regulator
adv7511 3-0039: supply pvdd not found, using dummy regulator
adv7511 3-0039: supply a2vdd not found, using dummy regulator
debugfs: Directory '7708000.audio-controller' with parent 'DB410c' 
already present!
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: PMIC 
REV: 1      CODEC Version: 1
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget ADC1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget ADC1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX3 overwritten
debugfs: File 'Capture' in directory 'dapm' already present!
adv7511 3-0039: failed to find dsi host
adv7511 3-0039: supply dvdd not found, using dummy regulator
adv7511 3-0039: supply pvdd not found, using dummy regulator
adv7511 3-0039: supply a2vdd not found, using dummy regulator
debugfs: Directory '7708000.audio-controller' with parent 'DB410c' 
already present!
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: PMIC 
REV: 1      CODEC Version: 1
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget ADC1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget ADC1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
sink widget PDM_RX1 overwritten
qcom,pm8916-wcd-spmi-codec 200f000.spmi:pmic@1:audio-codec@f000: ASoC: 
source widget PDM_RX3 overwritten
debugfs: File 'Capture' in directory 'dapm' already present!
adv7511 3-0039: failed to find dsi host
adv7511 3-0039: supply dvdd not found, using dummy regulator
adv7511 3-0039: supply pvdd not found, using dummy regulator
adv7511 3-0039: supply a2vdd not found, using dummy regulator
debugfs: Directory '7708000.audio-controller' with parent 'DB410c' 
already present!

...

Reverting it on top of linux next-20211028 'fixes' this issue.

> ---
>   drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> index 9e3585f23cf1..f8e5da148599 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -910,9 +910,6 @@ static int adv7511_bridge_attach(struct drm_bridge *bridge,
>   			return ret;
>   	}
>   
> -	if (adv->type == ADV7533 || adv->type == ADV7535)
> -		ret = adv7533_attach_dsi(adv);
> -
>   	if (adv->i2c_main->irq)
>   		regmap_write(adv->regmap, ADV7511_REG_INT_ENABLE(0),
>   			     ADV7511_INT0_HPD);
> @@ -1288,8 +1285,18 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
>   	drm_bridge_add(&adv7511->bridge);
>   
>   	adv7511_audio_init(dev, adv7511);
> +
> +	if (adv7511->type == ADV7533 || adv7511->type == ADV7535) {
> +		ret = adv7533_attach_dsi(adv7511);
> +		if (ret)
> +			goto err_unregister_audio;
> +	}
> +
>   	return 0;
>   
> +err_unregister_audio:
> +	adv7511_audio_exit(adv7511);
> +	drm_bridge_remove(&adv7511->bridge);
>   err_unregister_cec:
>   	i2c_unregister_device(adv7511->i2c_cec);
>   	clk_disable_unprepare(adv7511->cec_clk);

Best regards
Maxime Ripard Oct. 29, 2021, 8:05 a.m. UTC | #3
Hi Marek,

On Fri, Oct 29, 2021 at 08:23:45AM +0200, Marek Szyprowski wrote:
> Hi,
> 
> On 25.10.2021 17:15, Maxime Ripard wrote:
> > In order to avoid any probe ordering issue, the best practice is to move
> > the secondary MIPI-DSI device registration and attachment to the
> > MIPI-DSI host at probe time. Let's do this.
> >
> > Acked-by: Sam Ravnborg <sam@ravnborg.org>
> > Tested-by: John Stultz <john.stultz@linaro.org>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>
> This patch landed in linux-next as commit 864c49a31d6b ("drm/bridge:
> adv7511: Register and attach our DSI device at probe"). Sadly it causes
> endless probe-fail-defer loop on DragonBoard 410c board
> (arch/arm64/boot/dts/qcom/apq8016-sbc.dts):

I'm sorry to hear that (but would have been surprised if it didn't occur)

This is supposed to be fixed by 8f59ee9a570c ("drm/msm/dsi: Adjust probe
order"). Do you have that patch applied?

Maxime
Marek Szyprowski Oct. 29, 2021, 8:36 a.m. UTC | #4
Hi Mexime,

On 29.10.2021 10:05, Maxime Ripard wrote:
> On Fri, Oct 29, 2021 at 08:23:45AM +0200, Marek Szyprowski wrote:
>> On 25.10.2021 17:15, Maxime Ripard wrote:
>>> In order to avoid any probe ordering issue, the best practice is to move
>>> the secondary MIPI-DSI device registration and attachment to the
>>> MIPI-DSI host at probe time. Let's do this.
>>>
>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>>> Tested-by: John Stultz <john.stultz@linaro.org>
>>> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>> This patch landed in linux-next as commit 864c49a31d6b ("drm/bridge:
>> adv7511: Register and attach our DSI device at probe"). Sadly it causes
>> endless probe-fail-defer loop on DragonBoard 410c board
>> (arch/arm64/boot/dts/qcom/apq8016-sbc.dts):
> I'm sorry to hear that (but would have been surprised if it didn't occur)
>
> This is supposed to be fixed by 8f59ee9a570c ("drm/msm/dsi: Adjust probe
> order"). Do you have that patch applied?

Yes, I did my test directly on linux next-20211028, which also contains 
it. What might be important in my case, my DragonBoard 410c doesn't have 
any display attached.

I've also noticed the following error during boot:

[   23.847651] msm_mdp 1a01000.mdp: Adding to iommu group 3
[   23.866044] msm_mdp 1a01000.mdp: No interconnect support may cause 
display underflows!
[   23.957949] irq: no irq domain found for mdss@1a00000 !
[   23.958014] msm_dsi 1a98000.dsi: failed to request IRQ0: -22
[   23.962229] msm_dsi: probe of 1a98000.dsi failed with error -22

The above errors appeared in next-20211028 for the first time. I assume 
that they are related.

Best regards
Maxime Ripard Oct. 29, 2021, 8:46 a.m. UTC | #5
On Fri, Oct 29, 2021 at 10:36:00AM +0200, Marek Szyprowski wrote:
> Hi Mexime,
> 
> On 29.10.2021 10:05, Maxime Ripard wrote:
> > On Fri, Oct 29, 2021 at 08:23:45AM +0200, Marek Szyprowski wrote:
> >> On 25.10.2021 17:15, Maxime Ripard wrote:
> >>> In order to avoid any probe ordering issue, the best practice is to move
> >>> the secondary MIPI-DSI device registration and attachment to the
> >>> MIPI-DSI host at probe time. Let's do this.
> >>>
> >>> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> >>> Tested-by: John Stultz <john.stultz@linaro.org>
> >>> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> >> This patch landed in linux-next as commit 864c49a31d6b ("drm/bridge:
> >> adv7511: Register and attach our DSI device at probe"). Sadly it causes
> >> endless probe-fail-defer loop on DragonBoard 410c board
> >> (arch/arm64/boot/dts/qcom/apq8016-sbc.dts):
> > I'm sorry to hear that (but would have been surprised if it didn't occur)
> >
> > This is supposed to be fixed by 8f59ee9a570c ("drm/msm/dsi: Adjust probe
> > order"). Do you have that patch applied?
> 
> Yes, I did my test directly on linux next-20211028, which also contains 
> it. What might be important in my case, my DragonBoard 410c doesn't have 
> any display attached.
> 
> I've also noticed the following error during boot:
> 
> [   23.847651] msm_mdp 1a01000.mdp: Adding to iommu group 3
> [   23.866044] msm_mdp 1a01000.mdp: No interconnect support may cause 
> display underflows!
> [   23.957949] irq: no irq domain found for mdss@1a00000 !
> [   23.958014] msm_dsi 1a98000.dsi: failed to request IRQ0: -22
> [   23.962229] msm_dsi: probe of 1a98000.dsi failed with error -22
> 
> The above errors appeared in next-20211028 for the first time. I assume 
> that they are related.

Yeah, it's likely that the DSI host cannot probe anymore, and the DSI
bridge thus cannot find its DSI host. Rob, do you know what could be
going on?

Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 9e3585f23cf1..f8e5da148599 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -910,9 +910,6 @@  static int adv7511_bridge_attach(struct drm_bridge *bridge,
 			return ret;
 	}
 
-	if (adv->type == ADV7533 || adv->type == ADV7535)
-		ret = adv7533_attach_dsi(adv);
-
 	if (adv->i2c_main->irq)
 		regmap_write(adv->regmap, ADV7511_REG_INT_ENABLE(0),
 			     ADV7511_INT0_HPD);
@@ -1288,8 +1285,18 @@  static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	drm_bridge_add(&adv7511->bridge);
 
 	adv7511_audio_init(dev, adv7511);
+
+	if (adv7511->type == ADV7533 || adv7511->type == ADV7535) {
+		ret = adv7533_attach_dsi(adv7511);
+		if (ret)
+			goto err_unregister_audio;
+	}
+
 	return 0;
 
+err_unregister_audio:
+	adv7511_audio_exit(adv7511);
+	drm_bridge_remove(&adv7511->bridge);
 err_unregister_cec:
 	i2c_unregister_device(adv7511->i2c_cec);
 	clk_disable_unprepare(adv7511->cec_clk);