From: Thierry Reding <thierry.reding@gmail.com>
To: Chew Chiau Ee <chiau.ee.chew@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Chew Kean Ho <kean.ho.chew@intel.com>,
Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] pwm: add support for Intel Low Power Subsystem PWM
Date: Tue, 18 Mar 2014 16:28:56 +0100 [thread overview]
Message-ID: <20140318152855.GA7237@mithrandir> (raw)
In-Reply-To: <1393599057-26451-1-git-send-email-chiau.ee.chew@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2000 bytes --]
On Fri, Feb 28, 2014 at 10:50:57PM +0800, Chew Chiau Ee wrote:
> From: Mika Westerberg <mika.westerberg@linux.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@linux.intel.com>
> Signed-off-by: Chew, Kean Ho <kean.ho.chew@intel.com>
> Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
> Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.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.
> +MODULE_DESCRIPTION("PWM driver for Intel LPSS");
> +MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
> +MODULE_LICENSE("GPLv2");
I think this needs to be "GPL v2".
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-03-18 15:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 14:50 [PATCH v2] pwm: add support for Intel Low Power Subsystem PWM Chew Chiau Ee
2014-03-12 6:42 ` Mika Westerberg
2014-03-18 15:28 ` Thierry Reding [this message]
2014-03-19 1:25 ` Chew, Chiau Ee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140318152855.GA7237@mithrandir \
--to=thierry.reding@gmail.com \
--cc=chiau.ee.chew@intel.com \
--cc=kean.ho.chew@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rebecca.swee.fun.chang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox