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.tan...@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
pgprTgfkNsWf6.pgp
Description: PGP signature