All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Cc: devicetree@vger.kernel.org, Paul Barker <pbarker@konsulko.com>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Igor Opaniuk <igor.opaniuk@toradex.com>,
	Philippe Schenker <philippe.schenker@toradex.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Rob Herring <robh+dt@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/6] dt-bindings: pwm: document the PWM no-flag
Date: Tue, 7 Apr 2020 13:18:42 +0200	[thread overview]
Message-ID: <20200407111842.hp7mhrlsuesa74ep@pengutronix.de> (raw)
In-Reply-To: <CAGgjyvH5nmnXH068QTNPKzsjocNXfEP_yh0HO=L-oGaqQdYRuA@mail.gmail.com>

On Tue, Apr 07, 2020 at 01:51:42PM +0300, Oleksandr Suvorov wrote:
> On Tue, Apr 7, 2020 at 9:17 AM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > On Sun, Apr 05, 2020 at 10:22:42PM +0300, Oleksandr Suvorov wrote:
> > > Add the description of PWM_NOFLAGS flag property.
> > >
> > > Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
> >
> > As I already wrote in reply to the v1 series I'd prefer a name for 0
> > that explicitly handles normal polarity.
> 
> Uwe, AFAIU, there is no flag that forces normal polarity, the normal polarity
> is the default state if there is no flag to invert the polarity is set.

Yes, that's the status quo.

> '0' value in the bit flags cell really means there are no flags set
> for the PWM instance.

For me the relevance of giving 0 a name is mostly for human consumption.
Currently there is only a single flag encoded in the number in question.
But as soon as we add another, say PWM_AUTOSTART we have the following
possible settings:

	PWM_NOFLAGS
	PWM_POLARITY_INVERTED
	PWM_AUTOSTART
	PWM_POLARITY_INVERTED | PWM_AUTOSTART

Then for the first two a reader doesn't see if autostart is not in use
because the dt author doesn't know this feature (e.g. because autostart
is too new) or if they don't want autostart at all.

If however we had PWM_POLARITY_NORMAL and PWM_NO_AUTOSTART to complement
PWM_POLARITY_INVERTED and PWM_AUTOSTART every flag's setting could be
explicit and if there is a device tree that only has

	PWM_POLARITY_NORMAL

it would be obvious that nobody thought enough about autostarting to
explicitly mention it.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Oleksandr Suvorov
	<oleksandr.suvorov-2KBjVHiyJgBBDgjK7y7TUQ@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Paul Barker <pbarker-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
	Marcel Ziswiler
	<marcel.ziswiler-2KBjVHiyJgBBDgjK7y7TUQ@public.gmane.org>,
	Igor Opaniuk
	<igor.opaniuk-2KBjVHiyJgBBDgjK7y7TUQ@public.gmane.org>,
	Philippe Schenker
	<philippe.schenker-2KBjVHiyJgBBDgjK7y7TUQ@public.gmane.org>,
	Laurent Pinchart
	<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-pwm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH v2 2/6] dt-bindings: pwm: document the PWM no-flag
Date: Tue, 7 Apr 2020 13:18:42 +0200	[thread overview]
Message-ID: <20200407111842.hp7mhrlsuesa74ep@pengutronix.de> (raw)
In-Reply-To: <CAGgjyvH5nmnXH068QTNPKzsjocNXfEP_yh0HO=L-oGaqQdYRuA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, Apr 07, 2020 at 01:51:42PM +0300, Oleksandr Suvorov wrote:
> On Tue, Apr 7, 2020 at 9:17 AM Uwe Kleine-König
> <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> >
> > On Sun, Apr 05, 2020 at 10:22:42PM +0300, Oleksandr Suvorov wrote:
> > > Add the description of PWM_NOFLAGS flag property.
> > >
> > > Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov-2KBjVHiyJgBBDgjK7y7TUQ@public.gmane.org>
> >
> > As I already wrote in reply to the v1 series I'd prefer a name for 0
> > that explicitly handles normal polarity.
> 
> Uwe, AFAIU, there is no flag that forces normal polarity, the normal polarity
> is the default state if there is no flag to invert the polarity is set.

Yes, that's the status quo.

> '0' value in the bit flags cell really means there are no flags set
> for the PWM instance.

For me the relevance of giving 0 a name is mostly for human consumption.
Currently there is only a single flag encoded in the number in question.
But as soon as we add another, say PWM_AUTOSTART we have the following
possible settings:

	PWM_NOFLAGS
	PWM_POLARITY_INVERTED
	PWM_AUTOSTART
	PWM_POLARITY_INVERTED | PWM_AUTOSTART

Then for the first two a reader doesn't see if autostart is not in use
because the dt author doesn't know this feature (e.g. because autostart
is too new) or if they don't want autostart at all.

If however we had PWM_POLARITY_NORMAL and PWM_NO_AUTOSTART to complement
PWM_POLARITY_INVERTED and PWM_AUTOSTART every flag's setting could be
explicit and if there is a device tree that only has

	PWM_POLARITY_NORMAL

it would be obvious that nobody thought enough about autostarting to
explicitly mention it.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

  reply	other threads:[~2020-04-07 11:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05 19:22 [RFC PATCH v2 0/6] Add PWM_NOFLAGS property flag Oleksandr Suvorov
2020-04-05 19:22 ` Oleksandr Suvorov
2020-04-05 19:22 ` [RFC PATCH v2 1/6] dt-bindings: pwm: add PWM_NOFLAGS definition Oleksandr Suvorov
2020-04-05 19:22 ` [RFC PATCH v2 2/6] dt-bindings: pwm: document the PWM no-flag Oleksandr Suvorov
2020-04-07  6:16   ` Uwe Kleine-König
2020-04-07  6:16     ` Uwe Kleine-König
2020-04-07 10:51     ` Oleksandr Suvorov
2020-04-07 10:51       ` Oleksandr Suvorov
2020-04-07 11:18       ` Uwe Kleine-König [this message]
2020-04-07 11:18         ` Uwe Kleine-König
2020-04-07 14:55         ` Oleksandr Suvorov
2020-04-05 19:22 ` [RFC PATCH v2 3/6] arm64: dts: pwm: replace flag 1 with PWM_POLARITY_INVERTED Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22 ` [RFC PATCH v2 4/6] arm64: dts: pwm: replace flag 0 with PWM_NOFLAGS Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-09 12:14   ` Krzysztof Kozlowski
2020-04-09 12:14     ` Krzysztof Kozlowski
2020-04-09 12:14     ` Krzysztof Kozlowski
2020-04-09 12:14     ` Krzysztof Kozlowski
2020-04-05 19:22 ` [RFC PATCH v2 5/6] arm: dts: pwm: replace flag 1 with PWM_POLARITY_INVERTED Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22 ` [RFC PATCH v2 6/6] arm: dts: pwm: replace flag 0 with PWM_NOFLAGS Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-05 19:22   ` Oleksandr Suvorov
2020-04-09 12:14   ` Krzysztof Kozlowski
2020-04-09 12:14     ` Krzysztof Kozlowski
2020-04-09 12:14     ` Krzysztof Kozlowski
2020-04-09 12:14     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200407111842.hp7mhrlsuesa74ep@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=igor.opaniuk@toradex.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=marcel.ziswiler@toradex.com \
    --cc=oleksandr.suvorov@toradex.com \
    --cc=pbarker@konsulko.com \
    --cc=philippe.schenker@toradex.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.