Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1506777 > unrolled thread

[PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

Started byLukasz Majewski <l.majewski@majess.pl>
First post2016-10-24 00:00 +0200
Last post2016-10-25 09:00 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver Lukasz Majewski <l.majewski@majess.pl> - 2016-10-24 00:00 +0200
    Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to  PWMv2 driver Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-24 17:30 +0200
      Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to  PWMv2 driver Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-24 17:40 +0200
        Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to  PWMv2 driver Lukasz Majewski <l.majewski@majess.pl> - 2016-10-24 23:30 +0200
          Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to  PWMv2 driver Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-25 08:40 +0200
            Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to  PWMv2 driver Lukasz Majewski <l.majewski@majess.pl> - 2016-10-25 09:00 +0200

#1506777 — [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

FromLukasz Majewski <l.majewski@majess.pl>
Date2016-10-24 00:00 +0200
Subject[PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver
Message-ID<svyY9-6no-1@gated-at.bofh.it>
The need for set_polarity() function has been removed by implementing
PWM atomic support (apply() callback).

To indicate that the PWMv2 supports polarity inversion, new flag -
"polarity_supported" has been introduced.

Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
---
 drivers/pwm/pwm-imx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index 02d3dfd..be3034d 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -258,6 +258,7 @@ static struct pwm_ops imx_pwm_ops_v2 = {
 };
 
 struct imx_pwm_data {
+	bool polarity_supported;
 	struct pwm_ops *pwm_ops;
 };
 
@@ -266,6 +267,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = {
 };
 
 static struct imx_pwm_data imx_pwm_data_v2 = {
+	.polarity_supported = true,
 	.pwm_ops = &imx_pwm_ops_v2,
 };
 
@@ -313,7 +315,7 @@ static int imx_pwm_probe(struct platform_device *pdev)
 	imx->chip.base = -1;
 	imx->chip.npwm = 1;
 	imx->chip.can_sleep = true;
-	if (data->pwm_ops->set_polarity) {
+	if (data->polarity_supported) {
 		dev_dbg(&pdev->dev, "PWM supports output inversion\n");
 		imx->chip.of_xlate = of_pwm_xlate_with_flags;
 		imx->chip.of_pwm_n_cells = 3;
-- 
2.1.4

[toc] | [next] | [standalone]


#1507310 — Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-10-24 17:30 +0200
SubjectRe: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver
Message-ID<svPmj-ZI-51@gated-at.bofh.it>
In reply to#1506777
On Sun, 23 Oct 2016 23:45:46 +0200
Lukasz Majewski <l.majewski@majess.pl> wrote:

> The need for set_polarity() function has been removed by implementing
> PWM atomic support (apply() callback).
> 
> To indicate that the PWMv2 supports polarity inversion, new flag -
> "polarity_supported" has been introduced.
> 
> Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
> ---
>  drivers/pwm/pwm-imx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> index 02d3dfd..be3034d 100644
> --- a/drivers/pwm/pwm-imx.c
> +++ b/drivers/pwm/pwm-imx.c
> @@ -258,6 +258,7 @@ static struct pwm_ops imx_pwm_ops_v2 = {
>  };
>  
>  struct imx_pwm_data {
> +	bool polarity_supported;
>  	struct pwm_ops *pwm_ops;
>  };
>  
> @@ -266,6 +267,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = {
>  };
>  
>  static struct imx_pwm_data imx_pwm_data_v2 = {
> +	.polarity_supported = true,
>  	.pwm_ops = &imx_pwm_ops_v2,
>  };
>  
> @@ -313,7 +315,7 @@ static int imx_pwm_probe(struct platform_device *pdev)
>  	imx->chip.base = -1;
>  	imx->chip.npwm = 1;
>  	imx->chip.can_sleep = true;
> -	if (data->pwm_ops->set_polarity) {
> +	if (data->polarity_supported) {

You're still breaking backward compatibility with DTs defining
#pwm-cells = 2.

Please test the #pwm-cells value before deciding which of_xlate should
be used.

>  		dev_dbg(&pdev->dev, "PWM supports output inversion\n");
>  		imx->chip.of_xlate = of_pwm_xlate_with_flags;
>  		imx->chip.of_pwm_n_cells = 3;

[toc] | [prev] | [next] | [standalone]


#1507323 — Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-10-24 17:40 +0200
SubjectRe: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver
Message-ID<svPvY-14z-29@gated-at.bofh.it>
In reply to#1507310
On Mon, 24 Oct 2016 17:28:52 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> On Sun, 23 Oct 2016 23:45:46 +0200
> Lukasz Majewski <l.majewski@majess.pl> wrote:
> 
> > The need for set_polarity() function has been removed by implementing
> > PWM atomic support (apply() callback).
> > 
> > To indicate that the PWMv2 supports polarity inversion, new flag -
> > "polarity_supported" has been introduced.
> > 
> > Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
> > ---
> >  drivers/pwm/pwm-imx.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> > index 02d3dfd..be3034d 100644
> > --- a/drivers/pwm/pwm-imx.c
> > +++ b/drivers/pwm/pwm-imx.c
> > @@ -258,6 +258,7 @@ static struct pwm_ops imx_pwm_ops_v2 = {
> >  };
> >  
> >  struct imx_pwm_data {
> > +	bool polarity_supported;
> >  	struct pwm_ops *pwm_ops;
> >  };
> >  
> > @@ -266,6 +267,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = {
> >  };
> >  
> >  static struct imx_pwm_data imx_pwm_data_v2 = {
> > +	.polarity_supported = true,
> >  	.pwm_ops = &imx_pwm_ops_v2,
> >  };
> >  
> > @@ -313,7 +315,7 @@ static int imx_pwm_probe(struct platform_device *pdev)
> >  	imx->chip.base = -1;
> >  	imx->chip.npwm = 1;
> >  	imx->chip.can_sleep = true;
> > -	if (data->pwm_ops->set_polarity) {
> > +	if (data->polarity_supported) {  
> 
> You're still breaking backward compatibility with DTs defining
> #pwm-cells = 2.
> 
> Please test the #pwm-cells value before deciding which of_xlate should
> be used.

Nevermind, I didn't look at [1] and [2].
But still, your series is not bisectable: this change should be part of
patch 5 where you remove the ->set_polarity implementation. Otherwise,
this means you don't support polarity setting between patch 5 and 6.

> 
> >  		dev_dbg(&pdev->dev, "PWM supports output inversion\n");
> >  		imx->chip.of_xlate = of_pwm_xlate_with_flags;
> >  		imx->chip.of_pwm_n_cells = 3;  
> 

[1]http://patchwork.ozlabs.org/patch/679706/
[2]http://patchwork.ozlabs.org/patch/679707/

[toc] | [prev] | [next] | [standalone]


#1507751 — Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

FromLukasz Majewski <l.majewski@majess.pl>
Date2016-10-24 23:30 +0200
SubjectRe: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver
Message-ID<svUYG-4HF-31@gated-at.bofh.it>
In reply to#1507323

[Multipart message — attachments visible in raw view] — view raw

Hi Boris,

> On Mon, 24 Oct 2016 17:28:52 +0200
> Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> 
> > On Sun, 23 Oct 2016 23:45:46 +0200
> > Lukasz Majewski <l.majewski@majess.pl> wrote:
> > 
> > > The need for set_polarity() function has been removed by
> > > implementing PWM atomic support (apply() callback).
> > > 
> > > To indicate that the PWMv2 supports polarity inversion, new flag -
> > > "polarity_supported" has been introduced.
> > > 
> > > Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
> > > ---
> > >  drivers/pwm/pwm-imx.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> > > index 02d3dfd..be3034d 100644
> > > --- a/drivers/pwm/pwm-imx.c
> > > +++ b/drivers/pwm/pwm-imx.c
> > > @@ -258,6 +258,7 @@ static struct pwm_ops imx_pwm_ops_v2 = {
> > >  };
> > >  
> > >  struct imx_pwm_data {
> > > +	bool polarity_supported;
> > >  	struct pwm_ops *pwm_ops;
> > >  };
> > >  
> > > @@ -266,6 +267,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = {
> > >  };
> > >  
> > >  static struct imx_pwm_data imx_pwm_data_v2 = {
> > > +	.polarity_supported = true,
> > >  	.pwm_ops = &imx_pwm_ops_v2,
> > >  };
> > >  
> > > @@ -313,7 +315,7 @@ static int imx_pwm_probe(struct
> > > platform_device *pdev) imx->chip.base = -1;
> > >  	imx->chip.npwm = 1;
> > >  	imx->chip.can_sleep = true;
> > > -	if (data->pwm_ops->set_polarity) {
> > > +	if (data->polarity_supported) {  
> > 
> > You're still breaking backward compatibility with DTs defining
> > #pwm-cells = 2.
> > 
> > Please test the #pwm-cells value before deciding which of_xlate
> > should be used.
> 
> Nevermind, I didn't look at [1] and [2].

Yes, some patches are required to make this code work. Especially, I
wanted to explicitly reuse and credit work already done by
Bhuvanchandra.

> But still, your series is not bisectable: this change should be part
> of patch 5 where you remove the ->set_polarity implementation.
> Otherwise, this means you don't support polarity setting between
> patch 5 and 6.

Frankly speaking, I did it on purpose, to have operations in commits
logically separated.

I personally, do detest commits which blur the picture and are not
corresponding to one single logical change - for example remove some
large chunk of code and also add some tiny, new flag.

For me it is not a problem to have polarity disabled between patches 5
and 6, since at the end of the day we have it enabled.

Thanks for your support and review,

Best regards,

Łukasz Majewski

> 
> > 
> > >  		dev_dbg(&pdev->dev, "PWM supports output
> > > inversion\n"); imx->chip.of_xlate = of_pwm_xlate_with_flags;
> > >  		imx->chip.of_pwm_n_cells = 3;  
> > 
> 
> [1]http://patchwork.ozlabs.org/patch/679706/
> [2]http://patchwork.ozlabs.org/patch/679707/

[toc] | [prev] | [next] | [standalone]


#1508004 — Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2016-10-25 08:40 +0200
SubjectRe: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver
Message-ID<sw3yV-1WB-15@gated-at.bofh.it>
In reply to#1507751
Hi Lukasz,

On Mon, 24 Oct 2016 23:14:58 +0200
Lukasz Majewski <l.majewski@majess.pl> wrote:

> Hi Boris,
> 
> > On Mon, 24 Oct 2016 17:28:52 +0200
> > Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> >   
> > > On Sun, 23 Oct 2016 23:45:46 +0200
> > > Lukasz Majewski <l.majewski@majess.pl> wrote:
> > >   
> > > > The need for set_polarity() function has been removed by
> > > > implementing PWM atomic support (apply() callback).
> > > > 
> > > > To indicate that the PWMv2 supports polarity inversion, new flag -
> > > > "polarity_supported" has been introduced.
> > > > 
> > > > Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
> > > > ---
> > > >  drivers/pwm/pwm-imx.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> > > > index 02d3dfd..be3034d 100644
> > > > --- a/drivers/pwm/pwm-imx.c
> > > > +++ b/drivers/pwm/pwm-imx.c
> > > > @@ -258,6 +258,7 @@ static struct pwm_ops imx_pwm_ops_v2 = {
> > > >  };
> > > >  
> > > >  struct imx_pwm_data {
> > > > +	bool polarity_supported;
> > > >  	struct pwm_ops *pwm_ops;
> > > >  };
> > > >  
> > > > @@ -266,6 +267,7 @@ static struct imx_pwm_data imx_pwm_data_v1 = {
> > > >  };
> > > >  
> > > >  static struct imx_pwm_data imx_pwm_data_v2 = {
> > > > +	.polarity_supported = true,
> > > >  	.pwm_ops = &imx_pwm_ops_v2,
> > > >  };
> > > >  
> > > > @@ -313,7 +315,7 @@ static int imx_pwm_probe(struct
> > > > platform_device *pdev) imx->chip.base = -1;
> > > >  	imx->chip.npwm = 1;
> > > >  	imx->chip.can_sleep = true;
> > > > -	if (data->pwm_ops->set_polarity) {
> > > > +	if (data->polarity_supported) {    
> > > 
> > > You're still breaking backward compatibility with DTs defining
> > > #pwm-cells = 2.
> > > 
> > > Please test the #pwm-cells value before deciding which of_xlate
> > > should be used.  
> > 
> > Nevermind, I didn't look at [1] and [2].  
> 
> Yes, some patches are required to make this code work. Especially, I
> wanted to explicitly reuse and credit work already done by
> Bhuvanchandra.
> 
> > But still, your series is not bisectable: this change should be part
> > of patch 5 where you remove the ->set_polarity implementation.
> > Otherwise, this means you don't support polarity setting between
> > patch 5 and 6.  
> 
> Frankly speaking, I did it on purpose, to have operations in commits
> logically separated.
> 
> I personally, do detest commits which blur the picture and are not
> corresponding to one single logical change - for example remove some
> large chunk of code and also add some tiny, new flag.
> 
> For me it is not a problem to have polarity disabled between patches 5
> and 6, since at the end of the day we have it enabled.

It's really simple to make this series bisectable, all you have to do
is move patch 6 before patch 5. This being said, I really think you
should follow Stefan's recommendation: base your changes on mainline
and switch to the atomic hook before supporting polarity setting.

Regards,

Boris

[toc] | [prev] | [next] | [standalone]


#1508014 — Re: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver

FromLukasz Majewski <l.majewski@majess.pl>
Date2016-10-25 09:00 +0200
SubjectRe: [PATCH 6/6] pwm: imx: Introduce "polarity_supported" flag to PWMv2 driver
Message-ID<sw3Si-239-19@gated-at.bofh.it>
In reply to#1508004

[Multipart message — attachments visible in raw view] — view raw

Hi Boris,

> Hi Lukasz,
> 
> On Mon, 24 Oct 2016 23:14:58 +0200
> Lukasz Majewski <l.majewski@majess.pl> wrote:
> 
> > Hi Boris,
> > 
> > > On Mon, 24 Oct 2016 17:28:52 +0200
> > > Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> > >   
> > > > On Sun, 23 Oct 2016 23:45:46 +0200
> > > > Lukasz Majewski <l.majewski@majess.pl> wrote:
> > > >   
> > > > > The need for set_polarity() function has been removed by
> > > > > implementing PWM atomic support (apply() callback).
> > > > > 
> > > > > To indicate that the PWMv2 supports polarity inversion, new
> > > > > flag - "polarity_supported" has been introduced.
> > > > > 
> > > > > Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
> > > > > ---
> > > > >  drivers/pwm/pwm-imx.c | 4 +++-
> > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
> > > > > index 02d3dfd..be3034d 100644
> > > > > --- a/drivers/pwm/pwm-imx.c
> > > > > +++ b/drivers/pwm/pwm-imx.c
> > > > > @@ -258,6 +258,7 @@ static struct pwm_ops imx_pwm_ops_v2 = {
> > > > >  };
> > > > >  
> > > > >  struct imx_pwm_data {
> > > > > +	bool polarity_supported;
> > > > >  	struct pwm_ops *pwm_ops;
> > > > >  };
> > > > >  
> > > > > @@ -266,6 +267,7 @@ static struct imx_pwm_data
> > > > > imx_pwm_data_v1 = { };
> > > > >  
> > > > >  static struct imx_pwm_data imx_pwm_data_v2 = {
> > > > > +	.polarity_supported = true,
> > > > >  	.pwm_ops = &imx_pwm_ops_v2,
> > > > >  };
> > > > >  
> > > > > @@ -313,7 +315,7 @@ static int imx_pwm_probe(struct
> > > > > platform_device *pdev) imx->chip.base = -1;
> > > > >  	imx->chip.npwm = 1;
> > > > >  	imx->chip.can_sleep = true;
> > > > > -	if (data->pwm_ops->set_polarity) {
> > > > > +	if (data->polarity_supported) {    
> > > > 
> > > > You're still breaking backward compatibility with DTs defining
> > > > #pwm-cells = 2.
> > > > 
> > > > Please test the #pwm-cells value before deciding which of_xlate
> > > > should be used.  
> > > 
> > > Nevermind, I didn't look at [1] and [2].  
> > 
> > Yes, some patches are required to make this code work. Especially, I
> > wanted to explicitly reuse and credit work already done by
> > Bhuvanchandra.
> > 
> > > But still, your series is not bisectable: this change should be
> > > part of patch 5 where you remove the ->set_polarity
> > > implementation. Otherwise, this means you don't support polarity
> > > setting between patch 5 and 6.  
> > 
> > Frankly speaking, I did it on purpose, to have operations in commits
> > logically separated.
> > 
> > I personally, do detest commits which blur the picture and are not
> > corresponding to one single logical change - for example remove some
> > large chunk of code and also add some tiny, new flag.
> > 
> > For me it is not a problem to have polarity disabled between
> > patches 5 and 6, since at the end of the day we have it enabled.
> 
> It's really simple to make this series bisectable, all you have to do
> is move patch 6 before patch 5.

Hmm... You are right, I do wonder why I didn't get this idea from the
very beginning.

> This being said, I really think you
> should follow Stefan's recommendation: base your changes on mainline
> and switch to the atomic hook before supporting polarity setting.

I will do my best :-)

Best regards,

Łukasz Majewski

> 
> Regards,
> 
> Boris

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web