linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Flavio Suligoi <f.suligoi@asem.it>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-acpi@vger.kernel.org,
	Jonathan Corbet <corbet@lwn.net>,
	Lee Jones <lee.jones@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>
Subject: Re: [PATCH v2 2/7] pwm: core: Always require PWM flags to be provided
Date: Mon, 7 Jun 2021 14:49:01 +0300	[thread overview]
Message-ID: <YL4HrZTb+fmW4UTf@smile.fi.intel.com> (raw)
In-Reply-To: <YL3zDUWsY9mUW0eQ@smile.fi.intel.com>

On Mon, Jun 07, 2021 at 01:21:01PM +0300, Andy Shevchenko wrote:
> On Mon, Jun 07, 2021 at 01:15:20PM +0300, Andy Shevchenko wrote:
> > On Mon, Jun 07, 2021 at 11:53:24AM +0200, Uwe Kleine-König wrote:
> > > On Mon, Jun 07, 2021 at 12:02:37PM +0300, Andy Shevchenko wrote:
> > > > On Sun, Jun 06, 2021 at 11:30:54PM +0200, Uwe Kleine-König wrote:
> > > > > On Mon, May 31, 2021 at 10:49:42PM +0300, Andy Shevchenko wrote:
> > > > > > It makes little sense to make PWM flags optional since in case
> > > > > > of multi-channel consumer the flags can be optional only for
> > > > > > the last listed channel.
> > > > > 
> > > > > I think the same holds true for dt references.
> > > > 
> > > > Can you elaborate this? I haven't got what you are talking about, not a DT
> > > > expert here.
> > > 
> > > Ah no, I mixed that up. While the function that parses the phandle is
> > > flexible, for each pwm controller the number of arguments is fixed, so
> > > 
> > > 	pwms = <&pwm1 100000 &pwm2 100000 &pwm3 1000000>;
> > > 
> > > cannot be interpreted as 3-argument references to two PWMs. This is
> > > different to ACPI (I guess, not an ACPI expert here :-) because &pwm1
> > > "knows" if it needs 1 or 2 additional parameters (#pwm-cells).
> > 
> > It's not about ACPI, it's about "the ACPI glue layer in Linux kernel".
> > Used API is a part of it and it does allow only two cases, either NULL entry
> > (by having 0 as an argument) or full-length supplied tuple (in case of PWM it's
> > 3, so, means 4 parameters.
> > 
> > Let's consider examples:
> > 
> > (0, 0, x3, y3, z3, t3) // NULL, NULL, PWM3
> > (x1, y1, z1, t1, 0, x3, y3, z3, t3) // PWM1, NULL, PWM3
> > 
> > So, making last parameter "flexible" will work only for the last tuple in the
> > array.
> > 
> > Read this [1] for further information.
> > 
> > [1]: https://elixir.bootlin.com/linux/latest/source/drivers/acpi/property.c#L629
> 
> Hmm... I have read the actual implementation and it seems it's possible to have
> flexible array, so this patch needs to be reconsidered.

I was thinking more about it and what we have here is positional-dependent
arguments. Either way we might end up in the same situation (when we need to
parse arguments based on their positions, rather than always have them being
present). So, while I won't change documentation example (to be more stricter
there), I will drop this change.

Also, the PWM initial state doesn't include duty cycle. Any explanations why is
that?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-06-07 11:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 19:49 [PATCH v2 1/7] docs: firmware-guide: ACPI: Add a PWM example Andy Shevchenko
2021-05-31 19:49 ` [PATCH v2 2/7] pwm: core: Always require PWM flags to be provided Andy Shevchenko
2021-06-06 21:30   ` Uwe Kleine-König
2021-06-07  9:02     ` Andy Shevchenko
2021-06-07  9:53       ` Uwe Kleine-König
2021-06-07 10:15         ` Andy Shevchenko
2021-06-07 10:21           ` Andy Shevchenko
2021-06-07 11:49             ` Andy Shevchenko [this message]
2021-06-07 14:11               ` Uwe Kleine-König
2021-05-31 19:49 ` [PATCH v2 3/7] pwm: core: Convert to use fwnode for matching Andy Shevchenko
2021-05-31 19:49 ` [PATCH v2 4/7] pwm: core: Reuse fwnode_to_pwmchip() in ACPI case Andy Shevchenko
2021-05-31 19:49 ` [PATCH v2 5/7] pwm: core: Unify fwnode checks in the module Andy Shevchenko
2021-05-31 19:49 ` [PATCH v2 6/7] pwm: core: Remove unused devm_pwm_put() Andy Shevchenko
2021-06-06 21:40   ` Uwe Kleine-König
2021-05-31 19:49 ` [PATCH v2 7/7] pwm: core: Simplify some devm_*pwm*() functions Andy Shevchenko
2021-06-06 21:45   ` 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=YL4HrZTb+fmW4UTf@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=f.suligoi@asem.it \
    --cc=lee.jones@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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).