From f25360d98491203b1691e63b89c251a0c2f57a8a Mon Sep 17 00:00:00 2001 From: raghavendra ambadas Date: Thu, 2 Apr 2020 12:29:12 +0530 Subject: fbdev: msm: Fix race condition during te_irq calls Add lock to synchronize te_irq calls from both the dsi blank/unblank and wait4pingpong function calls. Change-Id: If59e7efe55ff8f7f9eb61d6297aefedb857e7abf Signed-off-by: Raghavendra Ambadas --- drivers/video/fbdev/msm/mdss_dsi.c | 1 + drivers/video/fbdev/msm/mdss_panel.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c index cc5f21131809..bffbb731dd4a 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.c +++ b/drivers/video/fbdev/msm/mdss_dsi.c @@ -3685,6 +3685,7 @@ static int mdss_dsi_ctrl_probe(struct platform_device *pdev) pdata = &ctrl_pdata->panel_data; init_completion(&pdata->te_done); + mutex_init(&pdata->te_mutex); if (pdata->panel_info.type == MIPI_CMD_PANEL) { if (!te_irq_registered) { rc = devm_request_irq(&pdev->dev, diff --git a/drivers/video/fbdev/msm/mdss_panel.h b/drivers/video/fbdev/msm/mdss_panel.h index 200acc5e61aa..bc2513296fd8 100644 --- a/drivers/video/fbdev/msm/mdss_panel.h +++ b/drivers/video/fbdev/msm/mdss_panel.h @@ -1014,6 +1014,7 @@ struct mdss_panel_data { int panel_te_gpio; bool is_te_irq_enabled; + struct mutex te_mutex; struct completion te_done; }; @@ -1033,6 +1034,7 @@ static inline void panel_update_te_irq(struct mdss_panel_data *pdata, return; } + mutex_lock(&pdata->te_mutex); if (enable && !pdata->is_te_irq_enabled) { enable_irq(gpio_to_irq(pdata->panel_te_gpio)); pdata->is_te_irq_enabled = true; @@ -1040,6 +1042,8 @@ static inline void panel_update_te_irq(struct mdss_panel_data *pdata, disable_irq(gpio_to_irq(pdata->panel_te_gpio)); pdata->is_te_irq_enabled = false; } + mutex_unlock(&pdata->te_mutex); + } /** -- cgit v1.2.3