lkml.org 
[lkml]   [2014]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [resend rfc v5]pwm: add BCM2835 PWM driver
On Mon, Oct 06, 2014 at 08:35:28PM -0700, Stephen Warren wrote:
> On 10/02/2014 04:41 AM, Bart Tanghe wrote:
> > Add pwm driver for Broadcom BCM2835 processor (Raspberry Pi)
> >
> > Signed-off-by: Bart Tanghe <bart.tanghe@thomasmore.be>
> > ---
> > Changes in v5:
>
> By v5, I would drop "rfc" from the email subject.

And resend as well. Use resend only if you're resending without having
made any changes.

> > diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c
>
> > +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->pwm);
> > + value |= (PWM_MODE << (PWM_CONTROL_STRIDE * pwm->pwm));
> > + writel(value, pc->base);
> > + return 0;
> > +}
> > +
> > +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 &= ~(PWM_CONTROL_MASK << PWM_CONTROL_STRIDE * pwm->pwm);
> > + value &= (~DEFAULT << (PWM_CONTROL_STRIDE * pwm->pwm));
>
> What is this second mask operation intended to do? The first mask
> operation already clears all the control bits, so clearing them again
> doesn't seem useful.

I suspend that you'll also want to use pwm->hwpwm instead of pwm->pwm.
pwm->hwpwm is the index of the PWM for the chip, whereas pwm->pwm is a
global index so the above breaks if another driver registered a PWM chip
before this driver.

Thierry
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-10-07 11:02    [W:0.049 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site