[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <604BF5F4C5D71041942BC7E84ED659EA01568555@PGSMSX103.gar.corp.intel.com>
Date: Wed, 19 Mar 2014 01:25:34 +0000
From: "Chew, Chiau Ee" <chiau.ee.chew@...el.com>
To: Thierry Reding <thierry.reding@...il.com>
CC: Mika Westerberg <mika.westerberg@...ux.intel.com>,
"Chew, Kean Ho" <kean.ho.chew@...el.com>,
"Chang, Rebecca Swee Fun" <rebecca.swee.fun.chang@...el.com>,
"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] pwm: add support for Intel Low Power Subsystem PWM
> On Fri, Feb 28, 2014 at 10:50:57PM +0800, Chew Chiau Ee wrote:
> > From: Mika Westerberg <mika.westerberg@...ux.intel.com>
> >
> > Add support for Intel Low Power I/O subsystem PWM controllers found on
> > Intel BayTrail SoC.
> >
> > Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> > Signed-off-by: Chew, Kean Ho <kean.ho.chew@...el.com>
> > Signed-off-by: Chang, Rebecca Swee Fun
> > <rebecca.swee.fun.chang@...el.com>
> > Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@...el.com>
> > ---
> > drivers/pwm/Kconfig | 10 +++
> > drivers/pwm/Makefile | 1 +
> > drivers/pwm/pwm-lpss.c | 179
> > ++++++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 190 insertions(+), 0 deletions(-) create mode
> > 100644 drivers/pwm/pwm-lpss.c
>
> Sorry for taking so long to get back to you on this. Things have been somewhat
> crazy lately.
>
> This generally looks very good, but I found two issues that escaped last time.
> See below.
>
> > diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
> [...]
> > +static int pwm_lpss_config(struct pwm_chip *chip, struct pwm_device *pwm,
> > + int duty_ns, int period_ns)
> > +{
> > + struct pwm_lpss_chip *lpwm = to_lpwm(chip);
> > + u8 on_time_div;
> > + unsigned long c = clk_get_rate(lpwm->clk);
> > + unsigned long long base_unit, freq = NSECS_PER_SEC;
> > + u32 ctrl;
> > +
> > + do_div(freq, period_ns);
> > +
> > + /* The equation is: base_unit = ((freq / c) * 65536) + correction */
> > + base_unit = freq * 65536;
> > + do_div(base_unit, c);
>
> clk_get_rate() can return 0, so perhaps it would be safer to check for the
> validity of c before dividing by it. This will probably never happen for your
> driver or platform, but people may look at your driver for inspiration at some
> point, so it should still be handling this correctly.
Agreed. Will update the code accordingly.
> > +MODULE_DESCRIPTION("PWM driver for Intel LPSS");
> MODULE_AUTHOR("Mika
> > +Westerberg <mika.westerberg@...ux.intel.com>");
> > +MODULE_LICENSE("GPLv2");
>
> I think this needs to be "GPL v2".
Ok. Will update this as well.
Thanks for your review!
>
> Thierry
--
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