Re: [PATCH 4/8] pwm: max7360: Add MAX7360 PWM support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu Dec 19, 2024 at 10:53 PM CET, Uwe Kleine-König wrote:
> Hello,
>
> On Thu, Dec 19, 2024 at 05:21:21PM +0100, mathieu.dubois-briand@xxxxxxxxxxx wrote:
> > From: Kamel Bouhara <kamel.bouhara@xxxxxxxxxxx>
> > 
> > +	int ret;
> > +
> > +	if (state->polarity != PWM_POLARITY_NORMAL)
> > +		return -EINVAL;
> > +
> > +	max7360_pwm = to_max7360_pwm(chip);
> > +	ret = regmap_write_bits(max7360_pwm->regmap, MAX7360_REG_GPIOCTRL,
> > +				MAX7360_PWM_CTRL_ENABLE(pwm->hwpwm),
> > +				MAX7360_PWM_CTRL_ENABLE(pwm->hwpwm));
> > +	if (ret) {
> > +		dev_err(&chip->dev, "failed to enable pwm-%d , error %d\n",
> > +			pwm->hwpwm, ret);
> > +		return ret;
> > +	}
> > +
> > +	do_div(duty_steps, MAX7360_PWM_PERIOD_NS);
> > +
> > +	ret = regmap_write(max7360_pwm->regmap, MAX7360_REG_PWMBASE + pwm->hwpwm,
> > +			   duty_steps >= 255 ? 255 : duty_steps);
> > +	if (ret) {
> > +		dev_err(&chip->dev,
> > +			"failed to apply pwm duty_cycle %llu on pwm-%d, error %d\n",
> > +			duty_steps, pwm->hwpwm, ret);
> > +		return ret;
> > +	}
>
> Huh, state->period isn't used at all. That is wrong for sure.
>

Yes this was definitely missing. Period is fixed by the chip, so I will
make sure the requested one is valid or return -EINVAL.

Thanks a lot for your review, I am preparing a new version of this
series that should address all your comments.

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux