From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Barry Song <21cnbao@gmail.com>,
thierry.reding@gmail.com, linux-pwm@vger.kernel.org,
Rongjun Ying <Rongjun.ying@csr.com>, Huayi Li <Huayi.Li@csr.com>,
workgroup.linux@csr.com, Barry Song <Baohua.Song@csr.com>
Subject: Re: [PATCH v2] pwm: add CSR SiRFSoC PWM driver
Date: Thu, 30 Jan 2014 20:49:27 +0100 [thread overview]
Message-ID: <201401302049.27521.arnd@arndb.de> (raw)
In-Reply-To: <1391061145-2078-1-git-send-email-21cnbao@gmail.com>
On Thursday 30 January 2014, Barry Song wrote:
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index 7acab93..0a252f8 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -166,6 +166,15 @@ config PWM_SAMSUNG
> To compile this driver as a module, choose M here: the module
> will be called pwm-samsung.
>
> +config PWM_SIRF
> + tristate "SiRF PWM support"
> + depends on ARCH_SIRF
> + help
please make this "depends on ARCH_SIRF || COMPILE_TEST" if you can, so we
can build it on other platforms for test purposes. If you do this, you
have to list the full set of dependencies, so probably another
"depends on HAVE_CLK".
> +
> +#define to_sirf_chip(chip) container_of(chip, struct sirf_pwm, chip)
> +
> +static unsigned int sirf_pwm_ns_to_cycles(struct pwm_chip *chip, unsigned int time_ns)
> +{
> + u64 dividend;
> + unsigned int cycle;
> + /*
> + * on SiRFSoC, OSC input is const, we use it as the source to generate
> + * PWM wave
> + */
> +#define SRC_OSC_RATE 26000000ULL
> + dividend = SRC_OSC_RATE * time_ns + NSEC_PER_SEC / 2;
> + do_div(dividend, NSEC_PER_SEC);
> +
> + cycle = dividend & 0xFFFFFFFFUL;
> +
> + return cycle > 1 ? cycle : 1;
> +}
> +
Is SRC_OSC_RATE the rate of spwm->clk? If so, it would be nice to just call
clk_get_rate() here, in case you ever have a chip with a different rate.
This is a very nice driver otherwise!
Arnd
WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] pwm: add CSR SiRFSoC PWM driver
Date: Thu, 30 Jan 2014 20:49:27 +0100 [thread overview]
Message-ID: <201401302049.27521.arnd@arndb.de> (raw)
In-Reply-To: <1391061145-2078-1-git-send-email-21cnbao@gmail.com>
On Thursday 30 January 2014, Barry Song wrote:
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index 7acab93..0a252f8 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -166,6 +166,15 @@ config PWM_SAMSUNG
> To compile this driver as a module, choose M here: the module
> will be called pwm-samsung.
>
> +config PWM_SIRF
> + tristate "SiRF PWM support"
> + depends on ARCH_SIRF
> + help
please make this "depends on ARCH_SIRF || COMPILE_TEST" if you can, so we
can build it on other platforms for test purposes. If you do this, you
have to list the full set of dependencies, so probably another
"depends on HAVE_CLK".
> +
> +#define to_sirf_chip(chip) container_of(chip, struct sirf_pwm, chip)
> +
> +static unsigned int sirf_pwm_ns_to_cycles(struct pwm_chip *chip, unsigned int time_ns)
> +{
> + u64 dividend;
> + unsigned int cycle;
> + /*
> + * on SiRFSoC, OSC input is const, we use it as the source to generate
> + * PWM wave
> + */
> +#define SRC_OSC_RATE 26000000ULL
> + dividend = SRC_OSC_RATE * time_ns + NSEC_PER_SEC / 2;
> + do_div(dividend, NSEC_PER_SEC);
> +
> + cycle = dividend & 0xFFFFFFFFUL;
> +
> + return cycle > 1 ? cycle : 1;
> +}
> +
Is SRC_OSC_RATE the rate of spwm->clk? If so, it would be nice to just call
clk_get_rate() here, in case you ever have a chip with a different rate.
This is a very nice driver otherwise!
Arnd
next prev parent reply other threads:[~2014-01-30 19:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 5:52 [PATCH v2] pwm: add CSR SiRFSoC PWM driver Barry Song
2014-01-30 5:52 ` Barry Song
2014-01-30 19:49 ` Arnd Bergmann [this message]
2014-01-30 19:49 ` Arnd Bergmann
2014-01-31 12:05 ` Barry Song
2014-01-31 12:05 ` Barry Song
2014-01-31 15:23 ` Arnd Bergmann
2014-01-31 15:23 ` Arnd Bergmann
2014-02-06 10:21 ` Barry Song
2014-02-06 10:21 ` Barry Song
2014-02-06 15:27 ` Arnd Bergmann
2014-02-06 15:27 ` Arnd Bergmann
2014-02-07 2:30 ` Barry Song
2014-02-07 2:30 ` Barry Song
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=201401302049.27521.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=21cnbao@gmail.com \
--cc=Baohua.Song@csr.com \
--cc=Huayi.Li@csr.com \
--cc=Rongjun.ying@csr.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=workgroup.linux@csr.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.