linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <thierry.reding@gmail.com>
Cc: <mark.rutland@arm.com>, <linux-pwm@vger.kernel.org>,
	<alexandre.belloni@bootlin.com>, <shc_work@mail.ru>,
	<corbet@lwn.net>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<robh+dt@kernel.org>, <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RESEND PATCH v5 8/9] pwm: add documentation for pwm push-pull mode
Date: Fri, 12 Oct 2018 13:05:50 +0000	[thread overview]
Message-ID: <f4a1f9e3-b3a8-2847-f13e-bb07dab400e6@microchip.com> (raw)
In-Reply-To: <20181012121552.GE31561@ulmo>



On 12.10.2018 15:15, Thierry Reding wrote:
> On Tue, Aug 28, 2018 at 04:01:25PM +0300, Claudiu Beznea wrote:
>> Add documentation for PWM push-pull mode.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>> Reviewed-by: Rob Herring <robh@kernel.org>
>> ---
>>  Documentation/devicetree/bindings/pwm/pwm.txt |  2 ++
>>  Documentation/pwm.txt                         | 16 ++++++++++++++++
>>  include/dt-bindings/pwm/pwm.h                 |  1 +
>>  3 files changed, 19 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pwm.txt b/Documentation/devicetree/bindings/pwm/pwm.txt
>> index 7c8aaac43f92..6a60c0fca112 100644
>> --- a/Documentation/devicetree/bindings/pwm/pwm.txt
>> +++ b/Documentation/devicetree/bindings/pwm/pwm.txt
>> @@ -49,6 +49,8 @@ Optionally, the pwm-specifier can encode a number of flags (defined in
>>  - PWM_MODE_COMPLEMENTARY: PWM complementary working mode (for PWM channels
>>  with two outputs); if not specified, the default for PWM channel will be
>>  used
>> +- PWM_MODE_PUSH_PULL: PWM push-pull working modes (for PWM channels with
>> +two outputs); if not specified the default for PWM channel will be used
> 
> What if somebody has this in the DT:
> 
> 	PWM_MODE_COMPLEMENTARY | PWM_MODE_PUSH_PULL
> 
> which one takes precedence, or do we reject it?

The first valid one will be selected.

In patch 1/1 from this series, changes added to of_pwm_xlate_with_flags()
function, there is this code:

+		for (modebit = PWMC_MODE_COMPLEMENTARY_BIT;
+		     modebit < PWMC_MODE_CNT; modebit++) {
+			unsigned long mode = BIT(modebit);
+
+			if ((args->args[2] & mode) &&
+			    pwm_mode_valid(pwm, mode)) {
+				pwm->args.mode = mode;
+				break;
+			}
+		}

And since the modes bits are defined as follows:

enum {
	PWMC_MODE_NORMAL_BIT,
	PWMC_MODE_COMPLEMENTARY_BIT,
	PWMC_MODE_PUSH_PULL_BIT,
	PWMC_MODE_CNT,
};

in your proposed scenario: PWM_MODE_COMPLEMENTARY | PWM_MODE_PUSH_PULL
the PWM_MODE_COMPLEMENTARY mode will be selected since it is the first
valid one.

> 
> Wouldn't it be preferable to either move the modes into an extra field
> within the flags field, or perhaps even add another field?

This approach was proposed in version 2 of this series and based on the
discussions I had with Rob Herring [1] I decided to use the remaining space
from cell specific to PWM flags.

Thank you,
Claudiu Beznea

[1] https://lkml.org/lkml/2018/1/22/655

> 
> I guess since Rob's already acked this, that concern may be unfounded.
> 
> Thierry
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

  reply	other threads:[~2018-10-12 13:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 13:01 [RESEND PATCH v5 0/9] extend PWM framework to support PWM modes Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 1/9] pwm: extend PWM framework with " Claudiu Beznea
2018-10-16 12:25   ` Thierry Reding
2018-10-17 12:42     ` Claudiu.Beznea
2018-10-18 15:32       ` Thierry Reding
2018-10-19 11:18         ` Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 2/9] pwm: clps711x: populate PWM mode in of_xlate function Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 3/9] pwm: cros-ec: " Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 4/9] pwm: pxa: " Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 5/9] pwm: add PWM modes Claudiu Beznea
2018-08-28 22:27   ` Rob Herring
2018-08-28 13:01 ` [RESEND PATCH v5 6/9] pwm: atmel: add pwm capabilities Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 7/9] pwm: add push-pull mode support Claudiu Beznea
2018-08-28 13:01 ` [RESEND PATCH v5 8/9] pwm: add documentation for pwm push-pull mode Claudiu Beznea
2018-10-12 12:15   ` Thierry Reding
2018-10-12 13:05     ` Claudiu.Beznea [this message]
2018-08-28 13:01 ` [RESEND PATCH v5 9/9] pwm: atmel: add push-pull mode support Claudiu Beznea
2018-09-14 16:20 ` [RESEND PATCH v5 0/9] extend PWM framework to support PWM modes Nicolas Ferre
2018-10-03 12:49   ` Nicolas Ferre
2018-10-16 12:03   ` Thierry Reding
2018-10-17 12:41     ` Claudiu.Beznea
2018-10-18 16:00       ` Thierry Reding
2018-10-19 11:18         ` Claudiu Beznea
2018-10-22  8:29 ` Uwe Kleine-König
2018-10-26 10:44   ` Claudiu.Beznea
2018-10-26 12:56     ` Uwe Kleine-König

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=f4a1f9e3-b3a8-2847-f13e-bb07dab400e6@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=shc_work@mail.ru \
    --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 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).