imx-drm: imx-tve: don't call sleeping functions beneath enable_lock spinlock
Enable lock claims that it is serializing tve_enable/disable calls. However, DRM already serialises mode sets with a mutex, which prevents encoder/connector functions being called concurrently. Secondly, holding a spinlock while calling clk_prepare_enable() is wrong; it will cause a might_sleep() warning should that debugging be enabled. So, let's just get rid of the enable_lock. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4ae078d58a
commit
bd5121bbb6
|
@ -114,7 +114,6 @@ struct imx_tve {
|
||||||
struct drm_encoder encoder;
|
struct drm_encoder encoder;
|
||||||
struct imx_drm_encoder *imx_drm_encoder;
|
struct imx_drm_encoder *imx_drm_encoder;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
spinlock_t enable_lock; /* serializes tve_enable/disable */
|
|
||||||
spinlock_t lock; /* register lock */
|
spinlock_t lock; /* register lock */
|
||||||
bool enabled;
|
bool enabled;
|
||||||
int mode;
|
int mode;
|
||||||
|
@ -146,10 +145,8 @@ __releases(&tve->lock)
|
||||||
|
|
||||||
static void tve_enable(struct imx_tve *tve)
|
static void tve_enable(struct imx_tve *tve)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
spin_lock_irqsave(&tve->enable_lock, flags);
|
|
||||||
if (!tve->enabled) {
|
if (!tve->enabled) {
|
||||||
tve->enabled = true;
|
tve->enabled = true;
|
||||||
clk_prepare_enable(tve->clk);
|
clk_prepare_enable(tve->clk);
|
||||||
|
@ -169,23 +166,18 @@ static void tve_enable(struct imx_tve *tve)
|
||||||
TVE_CD_SM_IEN |
|
TVE_CD_SM_IEN |
|
||||||
TVE_CD_LM_IEN |
|
TVE_CD_LM_IEN |
|
||||||
TVE_CD_MON_END_IEN);
|
TVE_CD_MON_END_IEN);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&tve->enable_lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tve_disable(struct imx_tve *tve)
|
static void tve_disable(struct imx_tve *tve)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
spin_lock_irqsave(&tve->enable_lock, flags);
|
|
||||||
if (tve->enabled) {
|
if (tve->enabled) {
|
||||||
tve->enabled = false;
|
tve->enabled = false;
|
||||||
ret = regmap_update_bits(tve->regmap, TVE_COM_CONF_REG,
|
ret = regmap_update_bits(tve->regmap, TVE_COM_CONF_REG,
|
||||||
TVE_IPU_CLK_EN | TVE_EN, 0);
|
TVE_IPU_CLK_EN | TVE_EN, 0);
|
||||||
clk_disable_unprepare(tve->clk);
|
clk_disable_unprepare(tve->clk);
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&tve->enable_lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tve_setup_tvout(struct imx_tve *tve)
|
static int tve_setup_tvout(struct imx_tve *tve)
|
||||||
|
@ -601,7 +593,6 @@ static int imx_tve_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
tve->dev = &pdev->dev;
|
tve->dev = &pdev->dev;
|
||||||
spin_lock_init(&tve->lock);
|
spin_lock_init(&tve->lock);
|
||||||
spin_lock_init(&tve->enable_lock);
|
|
||||||
|
|
||||||
ddc_node = of_parse_phandle(np, "ddc", 0);
|
ddc_node = of_parse_phandle(np, "ddc", 0);
|
||||||
if (ddc_node) {
|
if (ddc_node) {
|
||||||
|
|
Loading…
Reference in New Issue