All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v3 2/2] pwm: Add support for pwm nexus dt bindings
Date: Wed, 5 Feb 2025 18:19:30 +0100	[thread overview]
Message-ID: <20250205181930.3b800a13@bootlin.com> (raw)
In-Reply-To: <6js6k6xz3vuqshq2pfwqifby4t5q54ftztxxw2rau4j23xx2y5@u5xubi6v3uil>

Hi Uwe,

On Wed, 5 Feb 2025 17:29:30 +0100
Uwe Kleine-König <ukleinek@kernel.org> wrote:

> Hello Hervé,
> 
> On Wed, Feb 05, 2025 at 02:37:37PM +0100, Herve Codina wrote:
> > On Wed, 5 Feb 2025 12:38:32 +0100
> > Uwe Kleine-König <ukleinek@kernel.org> wrote:  
> > > Does this also work if &soc_pwm2 has #pwm-cells = <2>? Would I need just
> > > 
> > > 	pwm-map = <0 0 0 &soc_pwm1 1 0 0>,
> > > 		  <1 0 0 &soc_pwm2 4 0>,
> > > 		  <2 0 0 &soc_pwm1 3 0 0>;  
> > 
> > Yes, exactly.
> >   
> > > 
> > > then and
> > > 
> > > 	pwms = <&connector 1 57000 0>;
> > > 
> > > would then have the same effect as
> > > 
> > > 	pwms = <&soc_pwm2 4 57000>  
> > 
> > Yes, the last 0 (or any other values) in pwms = <&connector 1 57000 0> is
> > simply dropped in the translation (#pwm-cells = 3 in connector nexus to
> > #pwm-cells = 2 in soc_pwm1 node).
> > 
> > In more generic terms, it works in translation from #pwm-cells = N to
> > #pwm-cells = M by simply dropping the last N-M values.
> > 
> > Also note that even if values are dropped, you need to have them set when
> > you point the nexus node because #pwm-cells = 3 is set in the connector
> > node and need to be fixed and usable for all the entries in the
> > pwm-map table.  
> 
> Makes sense.
> 
> > > and the 0 is dropped then? Could I adapt the mapping that the effect is
> > > 
> > > 	pwms = <&soc_pwm2 57000 0>  
> > 
> > In this one, I think you miss the PWM number
> > 
> > If I read correctly this line you ask for the PWM 57000 from the soc_pwm2
> > controller. This doesn't make sense :)  
> 
> Some pwm chip devices with only a single output line use this. The first
> paramter is the default period (which is passed in the 2nd parameter
> normally) and the 2nd paramter are flags (normally the 3rd parameter).
> Back then the rationale was that for such hardware, the line index is
> zero always anyhow, and so could better be skipped.
> 
> Compare of_pwm_xlate_with_flags() to of_pwm_single_xlate(). pwm-pxa is
> the single offender using the latter. Thinking about that, it's easy
> enough to fix without breaking compatibility. I'll tackle that.
> 
> So for a PWM on pxa `<&soc_pwm2 57000 0>` works fine.

I see. In this case, a parameter shift during translation would be needed to
skip the PWM line index in the translated arguments. This is not currently
neither described in device-tree specicication [0] nor handled in the common
code of_parse_phandle_with_args_map() in the kernel.

This use case can appear for resources other than PWMs and IMHO it should be
nice to have it supported.

I think this support should proposed out of this series adding support for
PWM nexus nodes.

Is it blocking for this current series ?

[0] https://github.com/devicetree-org/devicetree-specification/releases/download/v0.4/devicetree-specification-v0.4.pdf

Best regards,
Hervé

  reply	other threads:[~2025-02-05 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05  9:55 [PATCH v3 0/2] pwm: Add support for pwm nexus node Herve Codina
2025-02-05  9:55 ` [PATCH v3 1/2] dt-bindings: pwm: Add support for PWM " Herve Codina
2025-02-11 20:56   ` Rob Herring
2025-02-05  9:55 ` [PATCH v3 2/2] pwm: Add support for pwm nexus dt bindings Herve Codina
2025-02-05 11:38   ` Uwe Kleine-König
2025-02-05 13:37     ` Herve Codina
2025-02-05 16:29       ` Uwe Kleine-König
2025-02-05 17:19         ` Herve Codina [this message]
2025-02-05 18:09           ` Uwe Kleine-König
2025-02-12  8:25 ` [PATCH v3 0/2] pwm: Add support for pwm nexus node 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=20250205181930.3b800a13@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=ukleinek@kernel.org \
    /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.