diff options
author | Wen Yi <wyi@nvidia.com> | 2011-03-21 17:11:34 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-04-01 19:25:15 -0700 |
commit | 24cfb0288a82d27ff77d89579e1c0e43dcd8a46f (patch) | |
tree | 2e9ae4f17ad99343d89863670310f6708a6b45f5 /drivers/video | |
parent | 87f5fb73c936229d2fd8c99a50fca296ed372554 (diff) |
video: tegra: dc: synchronize pwm config and dc state
There is a race condition between fb_blank and pwm_update_status
that could cause kernel panic. The solution is to synchronize
the function tegra_dc_config_pwm with dc->lock.
Bug 803498
Change-Id: I9323cb223aa8feb92f56d0025b2d97ab3b8d1752
Reviewed-on: http://git-master/r/23776
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/tegra/dc/dc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 68681aefce12..6bdb79bbc79b 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -834,6 +834,12 @@ tegra_dc_config_pwm(struct tegra_dc *dc, struct tegra_dc_pwm_params *cfg) { unsigned int ctrl; + mutex_lock(&dc->lock); + if (!dc->enabled) { + mutex_unlock(&dc->lock); + return; + } + ctrl = ((cfg->period << PM_PERIOD_SHIFT) | (cfg->clk_div << PM_CLK_DIVIDER_SHIFT) | cfg->clk_select); @@ -849,8 +855,9 @@ tegra_dc_config_pwm(struct tegra_dc *dc, struct tegra_dc_pwm_params *cfg) break; default: dev_err(&dc->ndev->dev, "Error\n"); - return; + break; } + mutex_unlock(&dc->lock); } EXPORT_SYMBOL(tegra_dc_config_pwm); |