All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <morbidrsa@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm@vger.kernel.org
Subject: Re: Determining wich PWM to use
Date: Sun, 4 Aug 2013 20:51:37 +0200	[thread overview]
Message-ID: <20130804185137.GA10948@sauron> (raw)
In-Reply-To: <20130804110346.GA20305@manwe>

On Sun, Aug 04, 2013 at 01:03:47PM +0200, Thierry Reding wrote:
> On Sat, Jul 27, 2013 at 12:18:24PM +0200, Johannes Thumshirn wrote:
> > Hi list,
> > 
> > I'm currently working on a pwm driver for the BCM2853 (the SoC used on the
> > RaspberryPi). It has two PWM modules, so my question is, how do I determine
> > which PWM to use in the .enable, .disable and .configure functions?
> 
> It depends on what you mean by "two PWM modules". Does it have one
> controller with two PWM outputs or does it have two controllers with one
> or more outputs?
> 
> If you have one controller with multiple outputs, which seems to be the
> case looking at the driver, then the struct pwm_device's .hwpwm field
> contains the per-chip index of the PWM channel.
> 
> > If someone wants to have have a look at the preliminary code (far from being
> > submittable and only compile tested) it can be found here:
> > 
> > https://github.com/morbidrsa/linux/blob/rpi-pwm/drivers/pwm/pwm-bcm2835.c
> 
> From a quick glance that looks pretty good already. Feel free to send it
> to the mailing list for review anytime.
> 
> > 2nd short question, is it considered good practice to encapsulate registers in
> > structs? I've seen this a lot on powerpc code.
> 
> It's not very common. I certainly prefer the standard way of using
> writel(value, base + offset) and readl(base + offset), or a variation of
> that using driver-specific accessors such as you've done in the above-
> mentioned code.
> 
> Thierry


Thanks. I'll try to get the code submittable till the end of the moth.

Johannes

      reply	other threads:[~2013-08-04 18:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-27 10:18 Determining wich PWM to use Johannes Thumshirn
2013-08-04 11:03 ` Thierry Reding
2013-08-04 18:51   ` Johannes Thumshirn [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=20130804185137.GA10948@sauron \
    --to=morbidrsa@gmail.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.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.