All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Thierry Reding
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Cc: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	Richard Purdie <rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org>,
	Matthias Kaehlcke
	<matthias-RprLehDfhQ3k1uMJSBkQmQ@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Kurt Van Dijck <kurt.van.dijck-/BeEPy95v10@public.gmane.org>
Subject: RE: [RFC 2/7] pwm: Allow chips to support multiple PWMs.
Date: Tue, 20 Dec 2011 14:32:52 -0800	[thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF176BE92E67@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <1324377138-32129-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>

Thierry Reding wrote at Tuesday, December 20, 2011 3:32 AM:
> This commit modifies the PWM core to support multiple PWMs per struct
> pwm_chip. It achieves this in a similar way to how gpiolib works, by
> allowing PWM ranges to be requested dynamically (pwm_chip.base == -1) or
> starting at a given offset (pwm_chip.base >= 0). A chip specifies how

Echoing my previous comment: >0 would be better than >=0 here.

> many PWMs it controls using the npwm member. Each of the functions in
> the pwm_ops structure gets an additional argument that specified the PWM
> number (it can be converted to a per-chip index by subtracting the
> chip's base).

I think it'd be much more convenient for drivers if the PWM core passed
the device-relative PWM ID to the driver functions instead of the global
PWM ID; the common case is going to be for the driver to want to index
into some local array using the value, which means all drivers will have
to subtract the chip base. I doubt many drivers will care about the global
ID at all, and if they do, they can add the base back on.

> The total maximum number of PWM devices is currently fixed to 64, but
> can easily be made configurable via Kconfig.

GPIO (and IRQ?) have static sized arrays for this kind of purpose too,
and I'm pretty sure I've seen discussions that this was a mistake, or
at least something that will hopefully be reworked. pinctrl was similar,
but it was requested this be reworked, and now I think the pin ID ->
pin descriptor table is a radix tree.

In other words, can you do away with NR_PWM, and make it completely
dynamic?

-- 
nvpublic

  parent reply	other threads:[~2011-12-20 22:32 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 10:32 [RFC 0/7] Add PWM device-tree support Thierry Reding
     [not found] ` <1324377138-32129-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 10:32   ` [RFC 1/7] PWM: add pwm framework support Thierry Reding
     [not found]     ` <1324377138-32129-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 22:13       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF176BE92E50-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-21  0:54           ` Mark Brown
2011-12-20 10:32   ` [RFC 2/7] pwm: Allow chips to support multiple PWMs Thierry Reding
     [not found]     ` <1324377138-32129-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 22:32       ` Stephen Warren [this message]
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF176BE92E67-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-21  7:51           ` Thierry Reding
     [not found]             ` <20111221075141.GB542-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2011-12-21 14:09               ` Thierry Reding
     [not found]                 ` <20111221140944.GA30666-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2011-12-21 16:55                   ` Stephen Warren
     [not found]                     ` <74CDBE0F657A3D45AFBB94109FB122FF176BE92FEC-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-22  6:57                       ` Thierry Reding
2011-12-20 10:32   ` [RFC 3/7] of: Add PWM support Thierry Reding
     [not found]     ` <1324377138-32129-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 22:45       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF176BE92E6A-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-21  8:09           ` Thierry Reding
2011-12-20 10:32   ` [RFC 4/7] arm: tegra: Fix PWM clock programming Thierry Reding
     [not found]     ` <1324377138-32129-5-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 22:57       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF176BE92E7E-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-21  9:12           ` Thierry Reding
     [not found]             ` <20111221091227.GE542-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2011-12-21 16:44               ` Stephen Warren
2011-12-20 10:32   ` [RFC 5/7] arm: tegra: Provide clock for only one PWM controller Thierry Reding
     [not found]     ` <1324377138-32129-6-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 22:57       ` Stephen Warren
2011-12-20 10:32   ` [RFC 6/7] pwm: Add Tegra2 SoC support Thierry Reding
     [not found]     ` <1324377138-32129-7-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 22:29       ` Olof Johansson
     [not found]         ` <CAOesGMibzg80rpeUMt-RTyz=0cffHtZmUe09XDdODNKwZmsX2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-21  7:19           ` Thierry Reding
2011-12-20 23:23       ` Stephen Warren
2011-12-20 10:32   ` [RFC 7/7] pwm-backlight: Add rudimentary device-tree support Thierry Reding
     [not found]     ` <1324377138-32129-8-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2011-12-20 23:33       ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF176BE92EBE-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-21  9:32           ` Thierry Reding
     [not found]             ` <20111221093257.GF542-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2011-12-21 18:20               ` Stephen Warren
     [not found]                 ` <74CDBE0F657A3D45AFBB94109FB122FF176BE9302E-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-21 19:04                   ` Mitch Bradley
     [not found]                     ` <4EF22DCB.10502-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2011-12-22  7:45                       ` Thierry Reding
2011-12-20 13:24   ` [RFC 0/7] Add PWM " Rob Herring
     [not found]     ` <4EF08C9E.9020302-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-20 13:41       ` 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=74CDBE0F657A3D45AFBB94109FB122FF176BE92E67@HQMAIL01.nvidia.com \
    --to=swarren-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=kurt.van.dijck-/BeEPy95v10@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matthias-RprLehDfhQ3k1uMJSBkQmQ@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.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.