Skip to contentSkip to conversation

rtc: pcf8563: add CLKOUT to common clock framework

PATCH Superseded Heiko Schocher 3 participants 6 messages Oct 16, 2015

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rtc: pcf8563: add CLKOUT to common clock framework

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.

---

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
Documentation/devicetree/bindings/rtc/pcf8563.txt new file +28 -0
new file mode 100644
index 0000000..cdb81ef
@@ -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>;
+};
drivers/rtc/rtc-pcf8563.c +163 -1

194 lines not on this page · raw message

Signature · 6 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Heiko,

[auto build test WARNING on abelloni/rtc-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Heiko-Schocher/rtc-pcf8563-add-CLKOUT-to-common-clock-framework/20151016-160221
config: parisc-allyesconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=parisc

All warnings (new ones prefixed by >>):

drivers/rtc/rtc-pcf8563.c:87:17: error: field 'clkout_hw' has incomplete type

     struct clk_hw  clkout_hw;
                    ^
   In file included from arch/parisc/include/asm/bug.h:4:0,
                    from include/linux/bug.h:4,
                    from include/linux/io.h:23,
                    from include/linux/clk-provider.h:14,
                    from drivers/rtc/rtc-pcf8563.c:17:
   drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_recalc_rate':
   include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:418:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
>> include/linux/kernel.h:811:48: warning: (near initialization for 'pcf8563')
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:418:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
   drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_set_rate':
   include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:445:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
>> include/linux/kernel.h:811:48: warning: (near initialization for 'pcf8563')
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:445:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
   drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_control':
   include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:469:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
>> include/linux/kernel.h:811:48: warning: (near initialization for 'pcf8563')
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:469:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
   drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_is_prepared':
   include/linux/kernel.h:811:48: warning: initialization from incompatible pointer type
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:498:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
>> include/linux/kernel.h:811:48: warning: (near initialization for 'pcf8563')
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
   drivers/rtc/rtc-pcf8563.c:406:35: note: in expansion of macro 'container_of'
    #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
                                      ^
   drivers/rtc/rtc-pcf8563.c:498:28: note: in expansion of macro 'clkout_hw_to_pcf8563'
     struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);
                               ^
   drivers/rtc/rtc-pcf8563.c: At top level:
   drivers/rtc/rtc-pcf8563.c:509:21: error: variable 'pcf8563_clkout_ops' has initializer but incomplete type
    static const struct clk_ops pcf8563_clkout_ops = {
                        ^
   drivers/rtc/rtc-pcf8563.c:510:2: error: unknown field 'prepare' specified in initializer
     .prepare = pcf8563_clkout_prepare,
     ^
   drivers/rtc/rtc-pcf8563.c:510:2: warning: excess elements in struct initializer
>> drivers/rtc/rtc-pcf8563.c:510:2: warning: (near initialization for 'pcf8563_clkout_ops')
   drivers/rtc/rtc-pcf8563.c:511:2: error: unknown field 'unprepare' specified in initializer
     .unprepare = pcf8563_clkout_unprepare,
     ^
   drivers/rtc/rtc-pcf8563.c:511:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-pcf8563.c:511:2: warning: (near initialization for 'pcf8563_clkout_ops')
   drivers/rtc/rtc-pcf8563.c:512:2: error: unknown field 'is_prepared' specified in initializer
     .is_prepared = pcf8563_clkout_is_prepared,
     ^
   drivers/rtc/rtc-pcf8563.c:512:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-pcf8563.c:512:2: warning: (near initialization for 'pcf8563_clkout_ops')
   drivers/rtc/rtc-pcf8563.c:513:2: error: unknown field 'recalc_rate' specified in initializer
     .recalc_rate = pcf8563_clkout_recalc_rate,
     ^
   drivers/rtc/rtc-pcf8563.c:513:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-pcf8563.c:513:2: warning: (near initialization for 'pcf8563_clkout_ops')
   drivers/rtc/rtc-pcf8563.c:514:2: error: unknown field 'round_rate' specified in initializer
     .round_rate = pcf8563_clkout_round_rate,
     ^
   drivers/rtc/rtc-pcf8563.c:514:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-pcf8563.c:514:2: warning: (near initialization for 'pcf8563_clkout_ops')
   drivers/rtc/rtc-pcf8563.c:515:2: error: unknown field 'set_rate' specified in initializer
     .set_rate = pcf8563_clkout_set_rate,
     ^
   drivers/rtc/rtc-pcf8563.c:515:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-pcf8563.c:515:2: warning: (near initialization for 'pcf8563_clkout_ops')
   drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_register_clk':
   drivers/rtc/rtc-pcf8563.c:523:23: error: storage size of 'init' isn't known
     struct clk_init_data init;
                          ^
   drivers/rtc/rtc-pcf8563.c:535:15: error: 'CLK_IS_ROOT' undeclared (first use in this function)
     init.flags = CLK_IS_ROOT;
                  ^
   drivers/rtc/rtc-pcf8563.c:535:15: note: each undeclared identifier is reported only once for each function it appears in
   drivers/rtc/rtc-pcf8563.c:544:2: error: implicit declaration of function 'clk_register' [-Werror=implicit-function-declaration]
     clk = clk_register(&client->dev, &pcf8563->clkout_hw);
     ^
   drivers/rtc/rtc-pcf8563.c:547:3: error: implicit declaration of function 'of_clk_add_provider' [-Werror=implicit-function-declaration]
      of_clk_add_provider(node, of_clk_src_simple_get, clk);
      ^
   drivers/rtc/rtc-pcf8563.c:547:29: error: 'of_clk_src_simple_get' undeclared (first use in this function)
      of_clk_add_provider(node, of_clk_src_simple_get, clk);
                                ^
   drivers/rtc/rtc-pcf8563.c:523:23: warning: unused variable 'init' [-Wunused-variable]
     struct clk_init_data init;
                          ^

cc1: some warnings being treated as errors

vim +/pcf8563_clkout_ops +510 drivers/rtc/rtc-pcf8563.c

503 if (ret < 0)
504 return ret;
505
506 return !!(buf & PCF8563_REG_CLKO_FE);
507 }
508

 > 509	static const struct clk_ops pcf8563_clkout_ops = {
 > 510		.prepare = pcf8563_clkout_prepare,

511 .unprepare = pcf8563_clkout_unprepare,
512 .is_prepared = pcf8563_clkout_is_prepared,
513 .recalc_rate = pcf8563_clkout_recalc_rate,

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Signature · 9 lines
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
#2 lore raw
In reply to Heiko Schocher
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Heiko,

[auto build test WARNING on abelloni/rtc-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Heiko-Schocher/rtc-pcf8563-add-CLKOUT-to-common-clock-framework/20151016-160221
config: sh-ap325rxa_defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh

All warnings (new ones prefixed by >>):

drivers/rtc/rtc-pcf8563.c:87:17: error: field 'clkout_hw' has incomplete type drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_recalc_rate':
drivers/rtc/rtc-pcf8563.c:418:28: warning: initialization from incompatible pointer type [enabled by default]

>> drivers/rtc/rtc-pcf8563.c:418:28: warning: (near initialization for 'pcf8563') [enabled by default]

drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_set_rate':
drivers/rtc/rtc-pcf8563.c:445:28: warning: initialization from incompatible pointer type [enabled by default] drivers/rtc/rtc-pcf8563.c:445:28: warning: (near initialization for 'pcf8563') [enabled by default] drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_control':
drivers/rtc/rtc-pcf8563.c:469:28: warning: initialization from incompatible pointer type [enabled by default] drivers/rtc/rtc-pcf8563.c:469:28: warning: (near initialization for 'pcf8563') [enabled by default] drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_is_prepared':
drivers/rtc/rtc-pcf8563.c:498:28: warning: initialization from incompatible pointer type [enabled by default] drivers/rtc/rtc-pcf8563.c:498:28: warning: (near initialization for 'pcf8563') [enabled by default] drivers/rtc/rtc-pcf8563.c: At top level:
drivers/rtc/rtc-pcf8563.c:509:21: error: variable 'pcf8563_clkout_ops' has initializer but incomplete type drivers/rtc/rtc-pcf8563.c:510:2: error: unknown field 'prepare' specified in initializer drivers/rtc/rtc-pcf8563.c:510:2: warning: excess elements in struct initializer [enabled by default] drivers/rtc/rtc-pcf8563.c:510:2: warning: (near initialization for 'pcf8563_clkout_ops') [enabled by default] drivers/rtc/rtc-pcf8563.c:511:2: error: unknown field 'unprepare' specified in initializer drivers/rtc/rtc-pcf8563.c:511:2: warning: excess elements in struct initializer [enabled by default] drivers/rtc/rtc-pcf8563.c:511:2: warning: (near initialization for 'pcf8563_clkout_ops') [enabled by default] drivers/rtc/rtc-pcf8563.c:512:2: error: unknown field 'is_prepared' specified in initializer drivers/rtc/rtc-pcf8563.c:512:2: warning: excess elements in struct initializer [enabled by default] drivers/rtc/rtc-pcf8563.c:512:2: warning: (near initialization for 'pcf8563_clkout_ops') [enabled by default] drivers/rtc/rtc-pcf8563.c:513:2: error: unknown field 'recalc_rate' specified in initializer drivers/rtc/rtc-pcf8563.c:513:2: warning: excess elements in struct initializer [enabled by default] drivers/rtc/rtc-pcf8563.c:513:2: warning: (near initialization for 'pcf8563_clkout_ops') [enabled by default] drivers/rtc/rtc-pcf8563.c:514:2: error: unknown field 'round_rate' specified in initializer drivers/rtc/rtc-pcf8563.c:514:2: warning: excess elements in struct initializer [enabled by default] drivers/rtc/rtc-pcf8563.c:514:2: warning: (near initialization for 'pcf8563_clkout_ops') [enabled by default] drivers/rtc/rtc-pcf8563.c:515:2: error: unknown field 'set_rate' specified in initializer drivers/rtc/rtc-pcf8563.c:515:2: warning: excess elements in struct initializer [enabled by default] drivers/rtc/rtc-pcf8563.c:515:2: warning: (near initialization for 'pcf8563_clkout_ops') [enabled by default] drivers/rtc/rtc-pcf8563.c: In function 'pcf8563_clkout_register_clk':
drivers/rtc/rtc-pcf8563.c:523:23: error: storage size of 'init' isn't known
drivers/rtc/rtc-pcf8563.c:535:15: error: 'CLK_IS_ROOT' undeclared (first use in this function) drivers/rtc/rtc-pcf8563.c:535:15: note: each undeclared identifier is reported only once for each function it appears in drivers/rtc/rtc-pcf8563.c:544:2: error: implicit declaration of function 'clk_register' [-Werror=implicit-function-declaration] drivers/rtc/rtc-pcf8563.c:547:3: error: implicit declaration of function 'of_clk_add_provider' [-Werror=implicit-function-declaration] drivers/rtc/rtc-pcf8563.c:547:29: error: 'of_clk_src_simple_get' undeclared (first use in this function) drivers/rtc/rtc-pcf8563.c:523:23: warning: unused variable 'init' [-Wunused-variable]
cc1: some warnings being treated as errors

vim +/pcf8563 +418 drivers/rtc/rtc-pcf8563.c

402 /*
403 * Handling of the clkout
404 */
405
406 #define clkout_hw_to_pcf8563(_hw) container_of(_hw, struct pcf8563, clkout_hw)
407
408 static int clkout_rates[] = {
409 32768,
410 1024,
411 32,
412 1,
413 };
414
415 static unsigned long pcf8563_clkout_recalc_rate(struct clk_hw *hw,
416 unsigned long parent_rate)
417 {

 > 418		struct pcf8563 *pcf8563 = clkout_hw_to_pcf8563(hw);

419 struct i2c_client *client = pcf8563->client;
420 unsigned char buf;
421 int ret = pcf8563_read_block_data(client, PCF8563_REG_CLKO, 1, &buf);
422
423 if (ret < 0)
424 return 0;
425
426 buf &= PCF8563_REG_CLKO_F_MASK;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw
In reply to Heiko Schocher

Hi,

Quoted 44 lines · Heiko Schocher

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.

---

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
Documentation/devicetree/bindings/rtc/pcf8563.txt new file +18 -0
new file mode 100644
index 0000000..cdb81ef
@@ -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>;

Documentation/devicetree/bindings/rtc/pcf8563.txt line 28

Quoted 10 lines
Documentation/devicetree/bindings/rtc/pcf8563.txt new file +10 -0
+	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.

Quoted 5 lines
Documentation/devicetree/bindings/rtc/pcf8563.txt new file +5 -0
+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;

Documentation/devicetree/bindings/rtc/pcf8563.txt

Quoted 10 lines
Documentation/devicetree/bindings/rtc/pcf8563.txt new file +10 -0
+	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.

Documentation/devicetree/bindings/rtc/pcf8563.txt

Quoted 7 lines
Documentation/devicetree/bindings/rtc/pcf8563.txt new file +3 -0
+	/* 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.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw
Quoted 11 lines · Alexandre Belloni
Quoted 11 lines
drivers/rtc/rtc-pcf8563.c +11 -0
+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;
Quoted 8 lines

drivers/rtc/rtc-pcf8563.c static int pcf8563_irq_enable(struct device *dev, unsigned int enabled) · line 532

Quoted 4 lines
drivers/rtc/rtc-pcf8563.c +4 -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.

I'm rethinking about your comment about breaking existing boards. I'd say that probably nobody is using the output from the rtc but maybe (highly unlikely) some are configuring it from the bootloader and in that case it is not nice to undo that configuration. Let's keep that block here as long as it works fine for you.

Signature · 7 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Hello Alexandre,

Am 16.10.2015 um 13:00 schrieb Alexandre Belloni:

Quoted 21 lines · Alexandre Belloni
Quoted 11 lines
Quoted 11 lines
drivers/rtc/rtc-pcf8563.c +11 -0
+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;
Quoted 8 lines

drivers/rtc/rtc-pcf8563.c static int pcf8563_irq_enable(struct device *dev, unsigned int enabled) · line 532

Quoted 4 lines
drivers/rtc/rtc-pcf8563.c +4 -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.

Quoted 5 lines

I'm rethinking about your comment about breaking existing boards. I'd say that probably nobody is using the output from the rtc but maybe (highly unlikely) some are configuring it from the bootloader and in that case it is not nice to undo that configuration. Let's keep that block here as long as it works fine for you.

Ok, so I have also a better feeling with it ... removing it back ;-)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany