From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Heiko Schocher <hs@denx.de>
Cc: linux-kernel@vger.kernel.org, Georg.Soffel@bosch-si.com,
rtc-linux@googlegroups.com,
Alessandro Zummo <a.zummo@towertech.it>,
devicetree@vger.kernel.org
Subject: [rtc-linux] Re: [PATCH v2] rtc: pcf8563: add CLKOUT to common clock framework
Date: Fri, 16 Oct 2015 12:54:46 +0200 [thread overview]
Message-ID: <20151016105446.GK3421@piout.net> (raw)
In-Reply-To: <1444982369-26046-1-git-send-email-hs@denx.de>
Hi,
On 16/10/2015 at 09:59:29 +0200, Heiko Schocher wrote :
> Add the clkout output clk to the common clock framework.
> Disable the CLKOUT of the RTC after power-up.
> After power-up/reset of the RTC, CLKOUT is enabled by default,
> with CLKOUT enabled the RTC chip has 2-3 times higher power
> consumption.
>
> Signed-off-by: Heiko Schocher <hs@denx.de>
> ---
>
> Changes in v2:
> - add comments from Alexandre Belloni
> - remove the DT property, instead
> register for the CLKOUT a clk in the common
> clk framework. The clk is disabled by default.
>
> Documentation/devicetree/bindings/rtc/pcf8563.txt | 28 ++++
> drivers/rtc/rtc-pcf8563.c | 164 +++++++++++++++++++++-
> 2 files changed, 191 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/rtc/pcf8563.txt
>
> diff --git a/Documentation/devicetree/bindings/rtc/pcf8563.txt b/Documentation/devicetree/bindings/rtc/pcf8563.txt
> new file mode 100644
> index 0000000..cdb81ef
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/pcf8563.txt
> @@ -0,0 +1,28 @@
> +* Philips PCF8563/Epson RTC8564 Real Time Clock
> +
> +Philips PCF8563/Epson RTC8564 Real Time Clock
> +
> +Required properties:
> +see: Documentation/devicetree/bindings/i2c/trivial-devices.txt
> +
> +Optional property:
> +- #clock-cells: Should be 1.
> +- clocks: Reference to the clock entry.
> +- clock-output-names:
> + overwrite the default clock name "pcf8563-clkout"
> +
> +Example:
> +
> +rtcclk: rtcclk {
> + compatible = "fixed-clock";
> + #clock-cells = <1>;
> + clock-frequency = <1>;
> + clock-output-names = "rtcclk";
> +};
> +
> +pcf8563@51 {
> + compatible = "nxp,pcf8563";
> + reg = <0x51>;
> + #clock-cells = <1>;
> + clocks = <&rtcclk 0>;
> +};
You don't seem to be using rtcclk, I would remove it from the example.
> +static struct clk *pcf8563_clkout_register_clk(struct pcf8563 *pcf8563)
> +{
> + struct i2c_client *client = pcf8563->client;
> + struct device_node *node = client->dev.of_node;
> + struct clk *clk;
> + struct clk_init_data init;
> + int ret;
> + unsigned char buf;
> +
> + /* disable the clkout output */
> + buf = 0;
> + ret = pcf8563_write_block_data(client, PCF8563_REG_CLKO, 1, &buf);
> + if (ret < 0)
> + return ERR_PTR(ret);
> +
Isn't that done automatically for an unused clock? However, I would do
that in the probe as you will have to sprinkle some #ifdef
CONFIG_COMMON_CLK after seeing the kbuild report.
>
> + /* register clk in common clk framework */
> + pcf8563_clkout_register_clk(pcf8563);
> +
> /* the pcf8563 alarm only supports a minute accuracy */
> pcf8563->rtc->uie_unsupported = 1;
>
You probably need to unregister the clock at some point. Maybe using
devm_clk_register() is the best thing to do.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Heiko Schocher <hs@denx.de>
Cc: linux-kernel@vger.kernel.org, Georg.Soffel@bosch-si.com,
rtc-linux@googlegroups.com,
Alessandro Zummo <a.zummo@towertech.it>,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2] rtc: pcf8563: add CLKOUT to common clock framework
Date: Fri, 16 Oct 2015 12:54:46 +0200 [thread overview]
Message-ID: <20151016105446.GK3421@piout.net> (raw)
In-Reply-To: <1444982369-26046-1-git-send-email-hs@denx.de>
Hi,
On 16/10/2015 at 09:59:29 +0200, Heiko Schocher wrote :
> Add the clkout output clk to the common clock framework.
> Disable the CLKOUT of the RTC after power-up.
> After power-up/reset of the RTC, CLKOUT is enabled by default,
> with CLKOUT enabled the RTC chip has 2-3 times higher power
> consumption.
>
> Signed-off-by: Heiko Schocher <hs@denx.de>
> ---
>
> Changes in v2:
> - add comments from Alexandre Belloni
> - remove the DT property, instead
> register for the CLKOUT a clk in the common
> clk framework. The clk is disabled by default.
>
> Documentation/devicetree/bindings/rtc/pcf8563.txt | 28 ++++
> drivers/rtc/rtc-pcf8563.c | 164 +++++++++++++++++++++-
> 2 files changed, 191 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/rtc/pcf8563.txt
>
> diff --git a/Documentation/devicetree/bindings/rtc/pcf8563.txt b/Documentation/devicetree/bindings/rtc/pcf8563.txt
> new file mode 100644
> index 0000000..cdb81ef
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/pcf8563.txt
> @@ -0,0 +1,28 @@
> +* Philips PCF8563/Epson RTC8564 Real Time Clock
> +
> +Philips PCF8563/Epson RTC8564 Real Time Clock
> +
> +Required properties:
> +see: Documentation/devicetree/bindings/i2c/trivial-devices.txt
> +
> +Optional property:
> +- #clock-cells: Should be 1.
> +- clocks: Reference to the clock entry.
> +- clock-output-names:
> + overwrite the default clock name "pcf8563-clkout"
> +
> +Example:
> +
> +rtcclk: rtcclk {
> + compatible = "fixed-clock";
> + #clock-cells = <1>;
> + clock-frequency = <1>;
> + clock-output-names = "rtcclk";
> +};
> +
> +pcf8563@51 {
> + compatible = "nxp,pcf8563";
> + reg = <0x51>;
> + #clock-cells = <1>;
> + clocks = <&rtcclk 0>;
> +};
You don't seem to be using rtcclk, I would remove it from the example.
> +static struct clk *pcf8563_clkout_register_clk(struct pcf8563 *pcf8563)
> +{
> + struct i2c_client *client = pcf8563->client;
> + struct device_node *node = client->dev.of_node;
> + struct clk *clk;
> + struct clk_init_data init;
> + int ret;
> + unsigned char buf;
> +
> + /* disable the clkout output */
> + buf = 0;
> + ret = pcf8563_write_block_data(client, PCF8563_REG_CLKO, 1, &buf);
> + if (ret < 0)
> + return ERR_PTR(ret);
> +
Isn't that done automatically for an unused clock? However, I would do
that in the probe as you will have to sprinkle some #ifdef
CONFIG_COMMON_CLK after seeing the kbuild report.
>
> + /* register clk in common clk framework */
> + pcf8563_clkout_register_clk(pcf8563);
> +
> /* the pcf8563 alarm only supports a minute accuracy */
> pcf8563->rtc->uie_unsupported = 1;
>
You probably need to unregister the clock at some point. Maybe using
devm_clk_register() is the best thing to do.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-10-16 10:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 7:59 [rtc-linux] [PATCH v2] rtc: pcf8563: add CLKOUT to common clock framework Heiko Schocher
2015-10-16 7:59 ` Heiko Schocher
2015-10-16 7:59 ` Heiko Schocher
2015-10-16 10:22 ` [rtc-linux] " kbuild test robot
2015-10-16 10:22 ` kbuild test robot
2015-10-16 10:22 ` kbuild test robot
2015-10-16 10:46 ` [rtc-linux] " kbuild test robot
2015-10-16 10:46 ` kbuild test robot
2015-10-16 10:46 ` kbuild test robot
2015-10-16 10:54 ` Alexandre Belloni [this message]
2015-10-16 10:54 ` Alexandre Belloni
2015-10-16 11:00 ` [rtc-linux] " Alexandre Belloni
2015-10-16 11:00 ` Alexandre Belloni
2015-10-16 11:00 ` Alexandre Belloni
2015-10-16 11:31 ` [rtc-linux] " Heiko Schocher
2015-10-16 11:31 ` Heiko Schocher
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=20151016105446.GK3421@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=Georg.Soffel@bosch-si.com \
--cc=a.zummo@towertech.it \
--cc=devicetree@vger.kernel.org \
--cc=hs@denx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rtc-linux@googlegroups.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.