[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54340857.9000409@wwwdotorg.org>
Date: Tue, 07 Oct 2014 08:35:51 -0700
From: Stephen Warren <swarren@...dotorg.org>
To: Bart Tanghe <bart.tanghe@...masmore.be>, thierry.reding@...il.com
CC: matt.porter@...aro.org, linux-kernel@...r.kernel.org,
linux-pwm@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org
Subject: Re: [PATCH v6]pwm: add BCM2835 PWM driver
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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists