All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Bo Shen <voice.shen@atmel.com>
Cc: plagnioj@jcrosoft.com, linux-pwm@vger.kernel.org,
	devicetree@vger.kernel.org, nicolas.ferre@atmel.com,
	linux-kernel@vger.kernel.org,
	alexandre.belloni@free-electrons.com, galak@codeaurora.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 1/2] PWM: atmel-pwm: add PWM controller driver
Date: Wed, 11 Dec 2013 16:21:20 +0100	[thread overview]
Message-ID: <20131211152119.GD31617@ulmo.nvidia.com> (raw)
In-Reply-To: <52A67A71.6020404@atmel.com>

[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]

On Tue, Dec 10, 2013 at 10:20:33AM +0800, Bo Shen wrote:
> Hi Thierry,
> 
> On 12/03/2013 11:09 AM, Bo Shen wrote:
> >>>+        atmel_pwm->chip.of_xlate = of_pwm_xlate_with_flags;
> >>>+        atmel_pwm->chip.of_pwm_n_cells = 3;
> >>>+        atmel_pwm->chip.base = -1;
> >>>+    } else {
> >>>+        atmel_pwm->chip.base = pdev->id;
> >>
> >>That's not correct. The chip cannot be tied to pdev->id, because that ID
> >>is the instance number of the device. So typically you would have
> >>devices name like this:
> >>
> >>    atmel-pwm.0
> >>    atmel-pwm.1
> >>    ...
> >>
> >>Now, if you have that, then you won't be able to register the second
> >>instance because the first instance will already have requested PWMs
> >>0-3, and setting .base to 1 will cause PWMs 1-4 to be requested, which
> >>intersects with the range of the first instance.
> >>
> >>The same applies of course if you have other PWM controllers in the
> >>system which have similar instance names.
> >>
> >>So the right thing to do here is to provide that number via platform
> >>data so that platform code can define it, knowing in advance all ranges
> >>for all other PWM controllers and thereby make sure there's no
> >>intersection.
> >
> >OK, I will fix this.
> 
> After read deeply of PWM framework, for non device tree, I think we'd better
> let the PWM core to choose chip.base as device tree, while not pass a number
> through platform data to it. Or else, it will confuse the user to set the
> chip.base, must set it in correct value to avoid intersection. And, actually
> we won't use chip.base in driver itself.

Yes, that should work as well, if you make sure that every user actually
has the PWM lookup table and doesn't rely on a fixed global index to
retrieve the PWM channel.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 1/2] PWM: atmel-pwm: add PWM controller driver
Date: Wed, 11 Dec 2013 16:21:20 +0100	[thread overview]
Message-ID: <20131211152119.GD31617@ulmo.nvidia.com> (raw)
In-Reply-To: <52A67A71.6020404@atmel.com>

On Tue, Dec 10, 2013 at 10:20:33AM +0800, Bo Shen wrote:
> Hi Thierry,
> 
> On 12/03/2013 11:09 AM, Bo Shen wrote:
> >>>+        atmel_pwm->chip.of_xlate = of_pwm_xlate_with_flags;
> >>>+        atmel_pwm->chip.of_pwm_n_cells = 3;
> >>>+        atmel_pwm->chip.base = -1;
> >>>+    } else {
> >>>+        atmel_pwm->chip.base = pdev->id;
> >>
> >>That's not correct. The chip cannot be tied to pdev->id, because that ID
> >>is the instance number of the device. So typically you would have
> >>devices name like this:
> >>
> >>    atmel-pwm.0
> >>    atmel-pwm.1
> >>    ...
> >>
> >>Now, if you have that, then you won't be able to register the second
> >>instance because the first instance will already have requested PWMs
> >>0-3, and setting .base to 1 will cause PWMs 1-4 to be requested, which
> >>intersects with the range of the first instance.
> >>
> >>The same applies of course if you have other PWM controllers in the
> >>system which have similar instance names.
> >>
> >>So the right thing to do here is to provide that number via platform
> >>data so that platform code can define it, knowing in advance all ranges
> >>for all other PWM controllers and thereby make sure there's no
> >>intersection.
> >
> >OK, I will fix this.
> 
> After read deeply of PWM framework, for non device tree, I think we'd better
> let the PWM core to choose chip.base as device tree, while not pass a number
> through platform data to it. Or else, it will confuse the user to set the
> chip.base, must set it in correct value to avoid intersection. And, actually
> we won't use chip.base in driver itself.

Yes, that should work as well, if you make sure that every user actually
has the PWM lookup table and doesn't rely on a fixed global index to
retrieve the PWM channel.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131211/68d9a67b/attachment.sig>

  reply	other threads:[~2013-12-11 15:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18  9:13 [PATCH v8 1/2] PWM: atmel-pwm: add PWM controller driver Bo Shen
2013-11-18  9:13 ` Bo Shen
2013-11-18  9:13 ` Bo Shen
2013-11-18  9:13 ` [PATCH v8 2/2] PWM: atmel-pwm: add device tree binding document Bo Shen
2013-11-18  9:13   ` Bo Shen
2013-11-18  9:13   ` Bo Shen
2013-12-02  8:01 ` [PATCH v8 1/2] PWM: atmel-pwm: add PWM controller driver Bo Shen
2013-12-02  8:01   ` Bo Shen
2013-12-02  8:01   ` Bo Shen
2013-12-02 10:59 ` Thierry Reding
2013-12-02 10:59   ` Thierry Reding
2013-12-03  3:09   ` Bo Shen
2013-12-03  3:09     ` Bo Shen
2013-12-03  3:09     ` Bo Shen
2013-12-03  9:43     ` Thierry Reding
2013-12-03  9:43       ` Thierry Reding
     [not found]       ` <20131203094326.GB21178-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-12-04  2:59         ` Bo Shen
2013-12-04  2:59           ` Bo Shen
2013-12-04  2:59           ` Bo Shen
2013-12-04 10:03           ` Thierry Reding
2013-12-04 10:03             ` Thierry Reding
2013-12-05  1:11             ` Bo Shen
2013-12-05  1:11               ` Bo Shen
2013-12-05  1:11               ` Bo Shen
2013-12-06 13:02               ` Thierry Reding
2013-12-06 13:02                 ` Thierry Reding
2013-12-06 13:02                 ` Thierry Reding
     [not found]     ` <529D4B58.9020700-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2013-12-10  2:20       ` Bo Shen
2013-12-10  2:20         ` Bo Shen
2013-12-10  2:20         ` Bo Shen
2013-12-11 15:21         ` Thierry Reding [this message]
2013-12-11 15:21           ` Thierry Reding

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=20131211152119.GD31617@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=voice.shen@atmel.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.