linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: imx: set can_sleep flag for imx_pwm_v2
@ 2014-05-23  5:48 Shawn Guo
  2014-05-23  6:40 ` Liu Ying
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn Guo @ 2014-05-23  5:48 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
---
 drivers/pwm/pwm-imx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index d797c7b84c3f..ab3809fb36a7 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -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;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] pwm: imx: set can_sleep flag for imx_pwm_v2
  2014-05-23  5:48 [PATCH] pwm: imx: set can_sleep flag for imx_pwm_v2 Shawn Guo
@ 2014-05-23  6:40 ` Liu Ying
  2014-05-23  7:05   ` Shawn Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Ying @ 2014-05-23  6:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Shawn,

On 05/23/2014 01:48 PM, Shawn Guo wrote:
> 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.
> 
> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
> ---
>  drivers/pwm/pwm-imx.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> index d797c7b84c3f..ab3809fb36a7 100644
> --- a/drivers/pwm/pwm-imx.c
> +++ b/drivers/pwm/pwm-imx.c
> @@ -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?

-- 
Liu Ying

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] pwm: imx: set can_sleep flag for imx_pwm_v2
  2014-05-23  6:40 ` Liu Ying
@ 2014-05-23  7:05   ` Shawn Guo
  0 siblings, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2014-05-23  7:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 23, 2014 at 02:40:04PM +0800, Liu Ying wrote:
> Hi Shawn,
> 
> On 05/23/2014 01:48 PM, Shawn Guo wrote:
> > 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.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
> > ---
> >  drivers/pwm/pwm-imx.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> > index d797c7b84c3f..ab3809fb36a7 100644
> > --- a/drivers/pwm/pwm-imx.c
> > +++ b/drivers/pwm/pwm-imx.c
> > @@ -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?

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

Will send v2 shortly.

Shawn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-23  7:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23  5:48 [PATCH] pwm: imx: set can_sleep flag for imx_pwm_v2 Shawn Guo
2014-05-23  6:40 ` Liu Ying
2014-05-23  7:05   ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).