From: Thierry Reding <thierry.reding@avionic-design.de>
To: "Philip, Avinash" <avinashphilip@ti.com>
Cc: "grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
"rob@landley.net" <rob@landley.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"Nori, Sekhar" <nsekhar@ti.com>,
"Hebbar, Gururaja" <gururaja.hebbar@ti.com>
Subject: Re: [PATCH 2/2] pwm: pwm-tiehrpwm: Add device-tree binding support for EHRPWM driver
Date: Mon, 8 Oct 2012 15:50:08 +0200 [thread overview]
Message-ID: <20121008135008.GB26525@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <518397C60809E147AF5323E0420B992E3E9CA1ED@DBDE01.ent.ti.com>
[-- Attachment #1: Type: text/plain, Size: 2687 bytes --]
On Mon, Oct 08, 2012 at 01:31:20PM +0000, Philip, Avinash wrote:
> On Tue, Oct 02, 2012 at 11:41:43, Thierry Reding wrote:
> > On Wed, Sep 26, 2012 at 04:57:43PM +0530, Philip, Avinash wrote:
[...]
> > > +- reg: physical base address and size of the registers map. For am33xx,
> > > + 2 register maps are present (EHRPWM register space & PWM subsystem common
> > > + config space). Order should be maintained with EHRPWM register map as first
> > > + entry & PWM subsystem common config space as second entry.
> > > +
> > > +Optional properties:
> > > +- ti,hwmods: Name of the hwmod associated to the EHRPWM:
> > > + "ehrpwm<x>", <x> being the 0-based instance number from the HW spec
> >
> > I don't see where this property is used. There is no code in this patch
> > that parses it.
>
> This data used by omap_hwmod layer to create platform devices. This is part
> of omap hwmod implementation.
Okay. I've heard about hwmod but I wasn't aware of how it was used in
the context of device tree.
> > > +static struct pwm_device *of_ehrpwm_xlate(struct pwm_chip *chip,
> > > + const struct of_phandle_args *args)
> > > +{
> > > + struct pwm_device *pwm;
> > > +
> > > + if (chip->of_pwm_n_cells < PWM_CELL_SIZE)
> > > + return ERR_PTR(-EINVAL);
> > > +
> > > + if (args->args[0] >= chip->npwm)
> > > + return ERR_PTR(-EINVAL);
> > > +
> > > + pwm = pwm_request_from_chip(chip, args->args[0], NULL);
> > > + if (IS_ERR(pwm))
> > > + return pwm;
> > > +
> > > + pwm_set_period(pwm, args->args[1]);
> > > + pwm_set_polarity(pwm, args->args[2]);
> > > + return pwm;
> > > +}
> >
> > This is an exact duplicate of the ECAP's of_xlate(). Maybe we should
> > make this part of the PWM core. If so it is probably safer to define the
> > values for the third cell as flags, where the polarity is encoded in bit
> > 0, and make the function handle this accordingly to allow other bits to
> > be added in the future.
>
> Custom of_xlate support is provided as suggested while the discussion of
> "Adding support for configuring polarity in PWM framework".
> https://lkml.org/lkml/2012/7/16/177
>
> without custom of_xlate() support, PWM drivers has to populate
> chip->of_pwm_n_cells = x;
> as this is hard coded to 2 in pwm/core.c.
>
> if (!chip->of_xlate) {
> chip->of_xlate = of_pwm_simple_xlate;
> chip->of_pwm_n_cells = 2;
It's absolutely fine to provide a custom implementation. All I'm saying
is that we should add a 3-cell variant of of_pwm_simple_xlate() instead
of having to duplicate it for every chip that supports inversion of the
polarity.
Maybe something like of_pwm_xlate_with_flags()?
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2012-10-08 13:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 11:27 [PATCH 0/2] DT binding support for ECAP & " Philip, Avinash
2012-09-26 11:27 ` [PATCH 1/2] pwm: pwm-tiecap: Add device-tree binding support for APWM driver Philip, Avinash
2012-10-02 6:00 ` Thierry Reding
2012-10-02 7:16 ` Sekhar Nori
2012-10-02 8:07 ` Thierry Reding
2012-10-02 8:27 ` Sekhar Nori
2012-10-08 13:31 ` Philip, Avinash
2012-10-08 13:39 ` Thierry Reding
2012-10-09 12:36 ` Philip, Avinash
2012-10-09 12:48 ` Thierry Reding
2012-09-26 11:27 ` [PATCH 2/2] pwm: pwm-tiehrpwm: Add device-tree binding support for EHRPWM driver Philip, Avinash
2012-10-02 6:11 ` Thierry Reding
2012-10-08 13:31 ` Philip, Avinash
2012-10-08 13:50 ` Thierry Reding [this message]
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=20121008135008.GB26525@avionic-0098.mockup.avionic-design.de \
--to=thierry.reding@avionic-design.de \
--cc=avinashphilip@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=gururaja.hebbar@ti.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
/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
all inboxes | Powered by JetHome®