linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Bart Tanghe <bart.tanghe@thomasmore.be>, thierry.reding@gmail.com
Cc: matt.porter@linaro.org, linux-kernel@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH v6]pwm: add BCM2835 PWM driver
Date: Tue, 07 Oct 2014 08:35:51 -0700	[thread overview]
Message-ID: <54340857.9000409@wwwdotorg.org> (raw)
In-Reply-To: <1412690665-15416-1-git-send-email-bart.tanghe@thomasmore.be>

On 10/07/2014 07:04 AM, Bart Tanghe wrote:
> Add pwm driver for Broadcom BCM2835 processor (Raspberry Pi)

Just a few nits below,

> diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c

> +#define PWM_CONTROL_MASK	0xff
> +#define PWM_MODE		0x80		/* set timer in pwm mode */
> +#define DEFAULT		0xff		/* set timer in default mode */

BTW, it'd be nice to say default *what*. Perhaps DEFAULT_PWM_MODE?

> +static int bcm2835_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
> +{
> +	struct bcm2835_pwm *pc = to_bcm2835_pwm(chip);
> +	u32 value;
> +
> +	value = readl(pc->base);
> +	value &= ~(PWM_CONTROL_MASK << PWM_CONTROL_STRIDE * pwm->hwpwm);
> +	value |= (PWM_MODE << (PWM_CONTROL_STRIDE * pwm->hwpwm));

Presence/absence of brackets around the STRIDE*pwm calculation is still
inconsistent here, and in other places.

> +static void bcm2835_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
> +{
> +	struct bcm2835_pwm *pc = to_bcm2835_pwm(chip);
> +	u32 value;
> +
> +	value = readl(pc->base);
> +	value &= (~DEFAULT << (PWM_CONTROL_STRIDE * pwm->hwpwm));

Why clear the "DEFAULT" bits here; why not use PWM_CONTROL_MASK?

      parent reply	other threads:[~2014-10-07 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 14:04 [PATCH v6]pwm: add BCM2835 PWM driver Bart Tanghe
2014-10-07 14:14 ` Marc Kleine-Budde
2014-10-07 15:35 ` Stephen Warren [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=54340857.9000409@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=bart.tanghe@thomasmore.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=matt.porter@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).