diff mbox

[DPU,1/2] drm/msm/dsi: check video mode engine status before waiting

Message ID 1523087405-18877-1-git-send-email-abhinavk@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Abhinav Kumar April 7, 2018, 7:50 a.m. UTC
Make sure the video mode engine is on before waiting
for the video done interrupt.

Otherwise it leads to silent timeouts increasing display
turn ON time.

Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Jordan Crouse April 9, 2018, 3:28 p.m. UTC | #1
On Sat, Apr 07, 2018 at 12:50:04AM -0700, Abhinav Kumar wrote:
> Make sure the video mode engine is on before waiting
> for the video done interrupt.
> 
> Otherwise it leads to silent timeouts increasing display
> turn ON time.
> 
> Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/dsi/dsi_host.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 7a03a94..24766c3 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -173,6 +173,7 @@ struct msm_dsi_host {
>  
>  	bool registered;
>  	bool power_on;
> +	bool enabled;
>  	int irq;
>  };
>  
> @@ -986,13 +987,18 @@ static void dsi_set_tx_power_mode(int mode, struct msm_dsi_host *msm_host)
>  
>  static void dsi_wait4video_done(struct msm_dsi_host *msm_host)
>  {
> +	u32 ret = 0;
> +
>  	dsi_intr_ctrl(msm_host, DSI_IRQ_MASK_VIDEO_DONE, 1);
>  
>  	reinit_completion(&msm_host->video_comp);
>  
> -	wait_for_completion_timeout(&msm_host->video_comp,
> +	ret = wait_for_completion_timeout(&msm_host->video_comp,
>  			msecs_to_jiffies(70));
>  
> +	if (ret <= 0)
> +		pr_err("wait for video done failed\n");
> +

Does this need to be rate limited? How often will it print?  Also, 'wait for
video done timed out" would be more descriptive for the situation.  I'm not sure
from the context if you have a pr_fmt defined for this file but if you don't you
might want to add the appropriate prefixes (or use dev_err) so the reader can
get a bit more detailed information about where to look and what is going on.

Jordan
Abhinav Kumar April 9, 2018, 9:09 p.m. UTC | #2
On 2018-04-09 08:28, Jordan Crouse wrote:
> On Sat, Apr 07, 2018 at 12:50:04AM -0700, Abhinav Kumar wrote:
>> Make sure the video mode engine is on before waiting
>> for the video done interrupt.
>> 
>> Otherwise it leads to silent timeouts increasing display
>> turn ON time.
>> 
>> Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
>> ---
>>  drivers/gpu/drm/msm/dsi/dsi_host.c | 14 ++++++++++----
>>  1 file changed, 10 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
>> b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> index 7a03a94..24766c3 100644
>> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
>> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
>> @@ -173,6 +173,7 @@ struct msm_dsi_host {
>> 
>>  	bool registered;
>>  	bool power_on;
>> +	bool enabled;
>>  	int irq;
>>  };
>> 
>> @@ -986,13 +987,18 @@ static void dsi_set_tx_power_mode(int mode, 
>> struct msm_dsi_host *msm_host)
>> 
>>  static void dsi_wait4video_done(struct msm_dsi_host *msm_host)
>>  {
>> +	u32 ret = 0;
>> +
>>  	dsi_intr_ctrl(msm_host, DSI_IRQ_MASK_VIDEO_DONE, 1);
>> 
>>  	reinit_completion(&msm_host->video_comp);
>> 
>> -	wait_for_completion_timeout(&msm_host->video_comp,
>> +	ret = wait_for_completion_timeout(&msm_host->video_comp,
>>  			msecs_to_jiffies(70));
>> 
>> +	if (ret <= 0)
>> +		pr_err("wait for video done failed\n");
>> +
> 
> Does this need to be rate limited? How often will it print?  Also, 
> 'wait for
> video done timed out" would be more descriptive for the situation.  I'm 
> not sure
> from the context if you have a pr_fmt defined for this file but if you 
> don't you
> might want to add the appropriate prefixes (or use dev_err) so the 
> reader can
> get a bit more detailed information about where to look and what is 
> going on.
> 
> Jordan
[Abhinav] With the rest of this change, this error should not happen.
This will print whenever we need to call this for waiting for each panel 
command.
The number of panel commands can vary with panel from < 10 to 100s at 
times.
But since we do not expect this to happen at all, at this point i dont 
think we need
to rate limit this.

Yes, will replace the pr_err with dev_err in V2.
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 7a03a94..24766c3 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -173,6 +173,7 @@  struct msm_dsi_host {
 
 	bool registered;
 	bool power_on;
+	bool enabled;
 	int irq;
 };
 
@@ -986,13 +987,18 @@  static void dsi_set_tx_power_mode(int mode, struct msm_dsi_host *msm_host)
 
 static void dsi_wait4video_done(struct msm_dsi_host *msm_host)
 {
+	u32 ret = 0;
+
 	dsi_intr_ctrl(msm_host, DSI_IRQ_MASK_VIDEO_DONE, 1);
 
 	reinit_completion(&msm_host->video_comp);
 
-	wait_for_completion_timeout(&msm_host->video_comp,
+	ret = wait_for_completion_timeout(&msm_host->video_comp,
 			msecs_to_jiffies(70));
 
+	if (ret <= 0)
+		pr_err("wait for video done failed\n");
+
 	dsi_intr_ctrl(msm_host, DSI_IRQ_MASK_VIDEO_DONE, 0);
 }
 
@@ -1001,7 +1007,7 @@  static void dsi_wait4video_eng_busy(struct msm_dsi_host *msm_host)
 	if (!(msm_host->mode_flags & MIPI_DSI_MODE_VIDEO))
 		return;
 
-	if (msm_host->power_on) {
+	if (msm_host->power_on && msm_host->enabled) {
 		dsi_wait4video_done(msm_host);
 		/* delay 4 ms to skip BLLP */
 		usleep_range(2000, 4000);
@@ -2203,7 +2209,7 @@  int msm_dsi_host_enable(struct mipi_dsi_host *host)
 	 *	pm_runtime_put_autosuspend(&msm_host->pdev->dev);
 	 * }
 	 */
-
+	msm_host->enabled = true;
 	return 0;
 }
 
@@ -2219,7 +2225,7 @@  int msm_dsi_host_disable(struct mipi_dsi_host *host)
 	 * Reset to disable video engine so that we can send off cmd.
 	 */
 	dsi_sw_reset(msm_host);
-
+	msm_host->enabled = false;
 	return 0;
 }