[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D6J6OTNHYWN8.1PGNZILBAGCS0@bootlin.com>
Date: Mon, 23 Dec 2024 16:26:51 +0100
From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@...tlin.com>
To: Uwe Kleine-König <ukleinek@...nel.org>
Cc: "Lee Jones" <lee@...nel.org>, "Rob Herring" <robh@...nel.org>,
"Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor Dooley"
<conor+dt@...nel.org>, "Kamel Bouhara" <kamel.bouhara@...tlin.com>, "Linus
Walleij" <linus.walleij@...aro.org>, "Bartosz Golaszewski" <brgl@...ev.pl>,
"Dmitry Torokhov" <dmitry.torokhov@...il.com>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <linux-input@...r.kernel.org>,
<linux-pwm@...r.kernel.org>, Grégory Clement
<gregory.clement@...tlin.com>, "Thomas Petazzoni"
<thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH 4/8] pwm: max7360: Add MAX7360 PWM support
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@...tlin.com wrote:
> > From: Kamel Bouhara <kamel.bouhara@...tlin.com>
> >
> > + 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
Powered by blists - more mailing lists