Skip to contentSkip to conversation

pwm: imx: set can_sleep flag for imx_pwm_v2

PATCH New Shawn Guo 2 participants 3 messages May 23, 2014

Subsystems (2)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/1 pwm: imx: set can_sleep flag for imx_pwm_v2

The .config() hook of imx_pwm_data_v2 calls clk_get_rate() which might sleep, so we need to set can_sleep flag on it.

---
 drivers/pwm/pwm-imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pwm/pwm-imx.c +3 -0
index d797c7b84c3f..ab3809fb36a7 100644
@@ -272,6 +272,9 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	imx->config = data->config;
 	imx->set_enable = data->set_enable;
 
+	if (data == &imx_pwm_data_v2)
+		imx->chip.can_sleep = true;
+
 	ret = pwmchip_add(&imx->chip);
 	if (ret < 0)
 		return ret;
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 pwm: imx: set can_sleep flag for imx_pwm_v2

Hi Shawn,

Quoted 14 lines · Shawn Guo

The .config() hook of imx_pwm_data_v2 calls clk_get_rate() which might sleep, so we need to set can_sleep flag on it.

---
 drivers/pwm/pwm-imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pwm/pwm-imx.c +0 -0
index d797c7b84c3f..ab3809fb36a7 100644

drivers/pwm/pwm-imx.c static int imx_pwm_probe(struct platform_device *pdev) · line 280

Quoted 9 lines
drivers/pwm/pwm-imx.c +3 -0
@@ -272,6 +272,9 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	imx->config = data->config;
 	imx->set_enable = data->set_enable;
 
+	if (data == &imx_pwm_data_v2)
+		imx->chip.can_sleep = true;
+
 	ret = pwmchip_add(&imx->chip);
 	if (ret < 0)
 		return ret;

clk_prepare_enable()/clk_disable_unprepare() called in imx_pwm_config() may sleep.

So, the can_sleep flag should be true for both i.MX PWM v1 and v2, right?

Signature · 1 line
Liu Ying
author
#2 lore raw

PATCH 1/1 pwm: imx: set can_sleep flag for imx_pwm_v2

Quoted 29 lines · Liu Ying

Hi Shawn,

Quoted 14 lines · Shawn Guo

The .config() hook of imx_pwm_data_v2 calls clk_get_rate() which might sleep, so we need to set can_sleep flag on it.

---
 drivers/pwm/pwm-imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pwm/pwm-imx.c +0 -0
index d797c7b84c3f..ab3809fb36a7 100644

drivers/pwm/pwm-imx.c static int imx_pwm_probe(struct platform_device *pdev) · line 280

Quoted 9 lines
drivers/pwm/pwm-imx.c +3 -0
@@ -272,6 +272,9 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	imx->config = data->config;
 	imx->set_enable = data->set_enable;
 
+	if (data == &imx_pwm_data_v2)
+		imx->chip.can_sleep = true;
+
 	ret = pwmchip_add(&imx->chip);
 	if (ret < 0)
 		return ret;

clk_prepare_enable()/clk_disable_unprepare() called in imx_pwm_config() may sleep.

Quoted 1 line

So, the can_sleep flag should be true for both i.MX PWM v1 and v2, right?

Yes, you're right. I missed that. Thanks for pointing it out.

Will send v2 shortly.

Shawn