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

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Sat Sep 25 19:44:59 UTC 2021


On 21/09/2021 21:26, Andrzej Hajda wrote:
> W dniu 21.09.2021 o 18:22, Dmitry Baryshkov pisze:
>> 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.

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).

> 
> 
> Regards
> 
> Andrzej
> 
> 
> 
>>
>> Fixes: a689554ba6ed ("drm/msm: Initial add DSI connector support")
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
>> ---
>>    drivers/gpu/drm/msm/dsi/dsi_host.c | 21 ++++++++++++---------
>>    1 file changed, 12 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> index e269df285136..cd842347a6b1 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
>> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> @@ -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)


-- 
With best wishes
Dmitry


More information about the dri-devel mailing list