From: "Janusz Użycki" <j.uzycki@elproma.com.pl>
To: Philipp Zabel <p.zabel@pengutronix.de>,
Mike Turquette <mturquette@linaro.org>,
Thierry Reding <thierry.reding@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pwm@vger.kernel.org
Subject: Re: [PATCH v2] clk: Add PWM clock driver
Date: Thu, 04 Dec 2014 19:00:18 +0100 [thread overview]
Message-ID: <5480A132.2010103@elproma.com.pl> (raw)
In-Reply-To: <1415007078-7947-1-git-send-email-p.zabel@pengutronix.de>
Hi,
W dniu 2014-11-03 o 10:31, Philipp Zabel pisze:
> Some board designers, when running out of clock output pads, decide to
> (mis)use PWM output pads to provide a clock to external components.
> This driver supports this practice by providing an adapter between the
> PWM and clock bindings in the device tree. As the PWM bindings specify
> the period in the device tree, this is a fixed clock.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> I'm resending this because last time the linux-pwm list was not in Cc:
> So far I have not received any comments on the patch itself. I have used
> it on a BoundaryDevices Nitrogen6X board to produce a master clock for
> the OV5640 MIPI CSI-2 camera module.
>
> Changes since v1:
> - none (rebased onto v3.18-rc3)
> ---
> .../devicetree/bindings/clock/pwm-clock.txt | 23 +++++
> drivers/clk/Kconfig | 7 ++
> drivers/clk/Makefile | 1 +
> drivers/clk/clk-pwm.c | 110 +++++++++++++++++++++
> 4 files changed, 141 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/clock/pwm-clock.txt
> create mode 100644 drivers/clk/clk-pwm.c
>
> diff --git a/Documentation/devicetree/bindings/clock/pwm-clock.txt b/Documentation/devicetree/bindings/clock/pwm-clock.txt
> new file mode 100644
> index 0000000..d127d17
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/pwm-clock.txt
> @@ -0,0 +1,23 @@
> +Binding for an external clock signal driven by a PWM pin.
> +
> +This binding uses the common clock binding[1] and the common PWM binding[2].
> +
> +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
> +[2] Documentation/devicetree/bindings/pwm/pwm.txt
> +
> +Required properties:
> +- compatible : shall be "pwm-clock".
> +- #clock-cells : from common clock binding; shall be set to 0.
> +- pwms : from common PWM binding; this determines the clock frequency
> + via the PWM period given in the pwm-specifier.
> +
> +Optional properties:
> +- clock-output-names : From common clock binding.
> +
> +Example:
> + clock {
> + compatible = "pwm-clock";
> + #clock-cells = <0>;
> + clock-output-names = "mipi_mclk";
> + pwms = <&pwm2 0 40>; /* 1 / 40 ns = 25 MHz */
Before I asked about [MHz/kHz] <-> [ns] conversion problem but I didn't
noticed
you've just used [ns] in dt. As Thierry wrote:
"Also the PWM chips will most likely use the concept of period and
duty-cycle
internally anyway, so it will convert back from Hz/percentage to nanoseconds
and fall victim to similar rounding effects."
Unfortunately I discovered that many pwm drivers are buggy around upper
freqs limit.
The example is pwm-mxs.c. PWM has 24MHz clock. There is no problem to set
registers directly for 12MHz 50% output (period_cycles=2-1=1,
inactive_c=1, active_c=0).
When I set pwm-mxs period to 83ns / duty to 42ns the output is low because
it sets inactive_c=0!
For 125ns/63ns I got about 6MHz instead of 8MHz, and +width=42ns.
When I set 42ns/42ns I got 12MHz 50%.
It means new patches for pwms...
I will test the patch backported to 3.14 using the mxs platform.
However as I wrote I need to patch pwm-mxs first.
> [...]
>
> +static struct platform_driver clk_pwm_driver = {
> + .probe = clk_pwm_probe,
> + .driver = {
> + .name = "pwm-clock",
> + .owner = THIS_MODULE,
AFAIR new drivers don't need to set .owner.
thanks
Janusz
> + .of_match_table = of_match_ptr(clk_pwm_dt_ids),
> + },
> +};
> +
> +module_platform_driver(clk_pwm_driver);
next prev parent reply other threads:[~2014-12-04 18:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 9:31 [PATCH v2] clk: Add PWM clock driver Philipp Zabel
2014-11-03 9:31 ` Philipp Zabel
[not found] ` <1415007078-7947-1-git-send-email-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-25 7:07 ` Mike Turquette
2014-11-25 7:07 ` Mike Turquette
2014-11-25 7:56 ` Philipp Zabel
2014-12-04 18:00 ` Janusz Użycki [this message]
2014-12-08 20:03 ` Janusz Użycki
[not found] ` <54860426.3020400-9tnw74Q4ehaHKKo6LODCOg@public.gmane.org>
2014-12-09 9:15 ` Philipp Zabel
2014-12-09 9:15 ` Philipp Zabel
2014-12-09 13:09 ` Janusz Użycki
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=5480A132.2010103@elproma.com.pl \
--to=j.uzycki@elproma.com.pl \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.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.