Skip to contentSkip to conversation

clk: Combine MAX77686 and MAX77802 driver and extend for MAX77620

PATCH Applied Laxman Dewangan 3 participants 15 messages Jun 17, 2016 – Aug 15, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover clk: Combine MAX77686 and MAX77802 driver and extend for MAX77620

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Part of common code utilisation, there is 3 files for these chips clock driver, one for common and two files for driver registration.

Combine both drivers into single file and move common code into same common file reduces the 2 files and make max77686 and max77802 clock driver in single fine. This driver does not depends on the parent driver structure. The regmap handle is acquired through regmap APIs for the register access.

After comining the driver and DT files, extend the support to MAX77620.

This series is based on discussion from the series

	clk: max77620: Add clock driver for MAX77620/MAX20024

On this series, it is proposed to combine all files together.

Changes form V1:
- Incorporated all review comment.
- Collected Testedby/reviewed by.

Changes from V2:
- Nit fixes and colleced all RB/TB

Laxman Dewangan (4):
clk: max77686: Combine Maxim max77686 and max77802 driver
clk: Combine DT binding doc for max77686 and max77802
clk: max77686: Add DT binding details for PMIC MAX77620
clk: max77686: Add support for MAX77620 clocks

 .../devicetree/bindings/clock/maxim,max77686.txt   | 118 ++++++++--
 .../devicetree/bindings/clock/maxim,max77802.txt   |  44 ----
 drivers/clk/Kconfig                                |  18 +-
 drivers/clk/Makefile                               |   2 -
 drivers/clk/clk-max-gen.c                          | 194 ---------------
 drivers/clk/clk-max-gen.h                          |  32 ---
 drivers/clk/clk-max77686.c                         | 262 ++++++++++++++++++++-
 drivers/clk/clk-max77802.c                         |  96 --------
 include/dt-bindings/clock/maxim,max77620.h         |  21 ++
 9 files changed, 368 insertions(+), 419 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/maxim,max77802.txt
 delete mode 100644 drivers/clk/clk-max-gen.c
 delete mode 100644 drivers/clk/clk-max-gen.h
 delete mode 100644 drivers/clk/clk-max77802.c
 create mode 100644 include/dt-bindings/clock/maxim,max77620.h
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/4 clk: max77686: Combine Maxim max77686 and max77802 driver

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Part of common code utilisation, there is 3 files for these chips clock driver, one for common and two files for driver registration.

Combine both drivers into single file and move common code into same common file reduces the 2 files and make max77686 and max77802 clock driver in single fine. This driver does not depends on the parent driver structure. The regmap handle is acquired through regmap APIs for the register access.

This combination of driver helps on adding clock driver for different Maxim PMICs which has similar clock IP like MAX77620 and MAX20024.

---
Changes from V1:
- Collected RB and TB from Javier.
- Change the max_gen to max77686.
- Rename structure and avoid duplication for reg and mask.
- Taken care of comment from Krzysztof on coding.

Changes from V2:
- COllected RBs.

---
 drivers/clk/Kconfig        |  15 +--
 drivers/clk/Makefile       |   2 -
 drivers/clk/clk-max-gen.c  | 194 -----------------------------------
 drivers/clk/clk-max-gen.h  |  32 ------
 drivers/clk/clk-max77686.c | 244 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/clk/clk-max77802.c |  96 ------------------
 6 files changed, 234 insertions(+), 349 deletions(-)
 delete mode 100644 drivers/clk/clk-max-gen.c
 delete mode 100644 drivers/clk/clk-max-gen.h
 delete mode 100644 drivers/clk/clk-max77802.c
drivers/clk/Kconfig +2 -13
index 98efbfc..6afad74 100644
@@ -31,22 +31,11 @@ config COMMON_CLK_WM831X
 
 source "drivers/clk/versatile/Kconfig"
 
-config COMMON_CLK_MAX_GEN
-        bool
-
 config COMMON_CLK_MAX77686
-	tristate "Clock driver for Maxim 77686 MFD"
-	depends on MFD_MAX77686
-	select COMMON_CLK_MAX_GEN
-	---help---
-	  This driver supports Maxim 77686 crystal oscillator clock. 
-
-config COMMON_CLK_MAX77802
-	tristate "Clock driver for Maxim 77802 PMIC"
+	tristate "Clock driver for Maxim 77686/77802 MFD"
 	depends on MFD_MAX77686
-	select COMMON_CLK_MAX_GEN
 	---help---
-	  This driver supports Maxim 77802 crystal oscillator clock.
+	  This driver supports Maxim 77686/77802 crystal oscillator clock.
 
 config COMMON_CLK_RK808
 	tristate "Clock driver for RK808"
drivers/clk/Makefile +0 -2
index dcc5e69..0a3a91b 100644
@@ -26,9 +26,7 @@ obj-$(CONFIG_ARCH_CLPS711X)		+= clk-clps711x.o
 obj-$(CONFIG_ARCH_EFM32)		+= clk-efm32gg.o
 obj-$(CONFIG_ARCH_HIGHBANK)		+= clk-highbank.o
 obj-$(CONFIG_MACH_LOONGSON32)		+= clk-ls1x.o
-obj-$(CONFIG_COMMON_CLK_MAX_GEN)	+= clk-max-gen.o
 obj-$(CONFIG_COMMON_CLK_MAX77686)	+= clk-max77686.o
-obj-$(CONFIG_COMMON_CLK_MAX77802)	+= clk-max77802.o
 obj-$(CONFIG_ARCH_MB86S7X)		+= clk-mb86s7x.o
 obj-$(CONFIG_ARCH_MOXART)		+= clk-moxart.o
 obj-$(CONFIG_ARCH_NOMADIK)		+= clk-nomadik.o
drivers/clk/clk-max-gen.c deleted +0 -194

194 lines not on this page · raw message

drivers/clk/clk-max-gen.h deleted +0 -32
deleted file mode 100644
index 997e86f..0000000
@@ -1,32 +0,0 @@
-/*
- * clk-max-gen.h - Generic clock driver for Maxim PMICs clocks
- *
- * Copyright (C) 2014 Google, Inc
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __CLK_MAX_GEN_H__
-#define __CLK_MAX_GEN_H__
-
-#include <linux/types.h>
-#include <linux/device.h>
-#include <linux/clkdev.h>
-#include <linux/regmap.h>
-#include <linux/platform_device.h>
-
-int max_gen_clk_probe(struct platform_device *pdev, struct regmap *regmap,
-		      u32 reg, struct clk_init_data *clks_init, int num_init);
-int max_gen_clk_remove(struct platform_device *pdev, int num_init);
-extern struct clk_ops max_gen_clk_ops;
-
-#endif /* __CLK_MAX_GEN_H__ */
drivers/clk/clk-max77686.c +232 -12

278 lines not on this page · raw message

drivers/clk/clk-max77802.c deleted +0 -96

96 lines not on this page · raw message

Signature · 1 line
2.1.4
Applied
#2 lore raw

Re: [PATCH V3 1/4] clk: max77686: Combine Maxim max77686 and max77802 driver

Quoted 24 lines · Laxman Dewangan

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Part of common code utilisation, there is 3 files for these chips clock driver, one for common and two files for driver registration.

Combine both drivers into single file and move common code into same common file reduces the 2 files and make max77686 and max77802 clock driver in single fine. This driver does not depends on the parent driver structure. The regmap handle is acquired through regmap APIs for the register access.

This combination of driver helps on adding clock driver for different Maxim PMICs which has similar clock IP like MAX77620 and MAX20024.

Quoted 1 line

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw

PATCH v3 2/4 clk: Combine DT binding doc for max77686 and max77802

In reply to Laxman Dewangan

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Define the common DT binding file for the clocks of Maxim PMICs MAX77686 and MAX77802. For this, remove the separate DT binding document file for maxim,max77802 and move all information to maxim,max77686 DT binding document.

---
Changes from V1:
- Rewrite description to remvoe ref to driver.
- Taken care of comment from Krzysztof on the supported clocks and DT bindings.

Changes from V2:
- Collected RBs.

---
 .../devicetree/bindings/clock/maxim,max77686.txt   | 82 ++++++++++++++++------
 .../devicetree/bindings/clock/maxim,max77802.txt   | 44 ------------
 2 files changed, 59 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/maxim,max77802.txt
Documentation/devicetree/bindings/clock/maxim,max77686.txt +59 -23
index 9c40739..4d973b5 100644
@@ -1,11 +1,15 @@
-Binding for Maxim MAX77686 32k clock generator block
+Binding for Maxim MAX77686/MAX77802 32k clock generator block
 
-This is a part of device tree bindings of MAX77686 multi-function device.
-More information can be found in bindings/mfd/max77686.txt file.
+This is a part of device tree bindings of MAX77686/MAX77802 multi-function
+device. More information can be found in bindings/mfd/max77686.txt file for
+MAX77686 and bindings/mfd/max77802.txt for MAX77802.
 
 The MAX77686 contains three 32.768khz clock outputs that can be controlled
 (gated/ungated) over I2C.
 
+The MAX77802 contains two 32.768khz clock outputs that can be controlled
+(gated/ungated) over I2C.
+
 Following properties should be presend in main device node of the MFD chip.
 
 Required properties:
@@ -17,30 +21,62 @@ Optional properties:
 
 Each clock is assigned an identifier and client nodes can use this identifier
 to specify the clock which they consume. Following indices are allowed:
-    - 0: 32khz_ap clock,
-    - 1: 32khz_cp clock,
-    - 2: 32khz_pmic clock.
+    - 0: 32khz_ap clock (max77686, max77802),
+    - 1: 32khz_cp clock (max77686, max77802),
+    - 2: 32khz_pmic clock (max77686).
 
 Clocks are defined as preprocessor macros in dt-bindings/clock/maxim,max77686.h
-header and can be used in device tree sources.
+header for MAX77686 and dt-bindings/clock/maxim,max77802.h for MAX77802 and can
+be used in device tree sources.
+
+Example:
+
+1. With MAX77686:
+
+#include <dt-bindings/clock/maxim,max77686.h>
+/* ... */
+
+	Node of the MFD chip
+		max77686: max77686@09 {
+			compatible = "maxim,max77686";
+			interrupt-parent = <&wakeup_eint>;
+			interrupts = <26 0>;
+			reg = <0x09>;
+			#clock-cells = <1>;
+
+			/* ... */
+		};
+
+	Clock consumer node
+
+		foo@0 {
+			compatible = "bar,foo";
+			/* ... */
+			clock-names = "my-clock";
+			clocks = <&max77686 MAX77686_CLK_PMIC>;
+		};
+
+2. With MAX77802:
 
-Example: Node of the MFD chip
+#include <dt-bindings/clock/maxim,max77802.h>
+/* ... */
 
-	max77686: max77686@09 {
-		compatible = "maxim,max77686";
-		interrupt-parent = <&wakeup_eint>;
-		interrupts = <26 0>;
-		reg = <0x09>;
-		#clock-cells = <1>;
+	Node of the MFD chip
+		max77802: max77802@09 {
+			compatible = "maxim,max77802";
+			interrupt-parent = <&wakeup_eint>;
+			interrupts = <26 0>;
+			reg = <0x09>;
+			#clock-cells = <1>;
 
-		/* ... */
-	};
+			/* ... */
+		};
 
-Example: Clock consumer node
+	Clock consumer node
 
-	foo@0 {
-		compatible = "bar,foo";
-		/* ... */
-		clock-names = "my-clock";
-		clocks = <&max77686 MAX77686_CLK_PMIC>;
-	};
+		foo@0 {
+			compatible = "bar,foo";
+			/* ... */
+			clock-names = "my-clock";
+			clocks = <&max77802 MAX77802_CLK_32K_AP>;
+		};
Documentation/devicetree/bindings/clock/maxim,max77802.txt deleted +0 -44

44 lines not on this page · raw message

Signature · 1 line
2.1.4
maintainer
#4 lore raw

Re: [PATCH V3 2/4] clk: Combine DT binding doc for max77686 and max77802

Quoted 42 lines · Laxman Dewangan

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Define the common DT binding file for the clocks of Maxim PMICs MAX77686 and MAX77802. For this, remove the separate DT binding document file for maxim,max77802 and move all information to maxim,max77686 DT binding document.

---
Changes from V1:
- Rewrite description to remvoe ref to driver.
- Taken care of comment from Krzysztof on the supported clocks and DT bindings.

Changes from V2:
- Collected RBs.

---
 .../devicetree/bindings/clock/maxim,max77686.txt   | 82 ++++++++++++++++------
 .../devicetree/bindings/clock/maxim,max77802.txt   | 44 ------------
 2 files changed, 59 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/maxim,max77802.txt
Documentation/devicetree/bindings/clock/maxim,max77686.txt +4 -3
index 9c40739..4d973b5 100644
@@ -1,11 +1,15 @@
-Binding for Maxim MAX77686 32k clock generator block
+Binding for Maxim MAX77686/MAX77802 32k clock generator block
 
-This is a part of device tree bindings of MAX77686 multi-function device.
-More information can be found in bindings/mfd/max77686.txt file.
+This is a part of device tree bindings of MAX77686/MAX77802 multi-function
+device. More information can be found in bindings/mfd/max77686.txt file for
+MAX77686 and bindings/mfd/max77802.txt for MAX77802.

Documentation/devicetree/bindings/clock/maxim,max77686.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/clock/maxim,max77686.txt +3 -0
 
 The MAX77686 contains three 32.768khz clock outputs that can be controlled
 (gated/ungated) over I2C.
 
+The MAX77802 contains two 32.768khz clock outputs that can be controlled
+(gated/ungated) over I2C.
+
 Following properties should be presend in main device node of the MFD chip.
 
 Required properties:

I'd expect to see compatible strings updated...

Quoted 1 line
Documentation/devicetree/bindings/clock/maxim,max77686.txt +0 -0
@@ -17,30 +21,62 @@ Optional properties:
#5 lore raw

Re: [PATCH V3 2/4] clk: Combine DT binding doc for max77686 and max77802

Quoted 47 lines · Rob Herring
Quoted 46 lines · Laxman Dewangan

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Define the common DT binding file for the clocks of Maxim PMICs MAX77686 and MAX77802. For this, remove the separate DT binding document file for maxim,max77802 and move all information to maxim,max77686 DT binding document.

---
Changes from V1:
- Rewrite description to remvoe ref to driver.
- Taken care of comment from Krzysztof on the supported clocks and DT bindings.

Changes from V2:
- Collected RBs.

---
  .../devicetree/bindings/clock/maxim,max77686.txt   | 82 ++++++++++++++++------
  .../devicetree/bindings/clock/maxim,max77802.txt   | 44 ------------
  2 files changed, 59 insertions(+), 67 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/clock/maxim,max77802.txt

Documentation/devicetree/bindings/clock/maxim,max77686.txt +4 -3
index 9c40739..4d973b5 100644
@@ -1,11 +1,15 @@
-Binding for Maxim MAX77686 32k clock generator block
+Binding for Maxim MAX77686/MAX77802 32k clock generator block
 
-This is a part of device tree bindings of MAX77686 multi-function device.
-More information can be found in bindings/mfd/max77686.txt file.
+This is a part of device tree bindings of MAX77686/MAX77802 multi-function
+device. More information can be found in bindings/mfd/max77686.txt file for
+MAX77686 and bindings/mfd/max77802.txt for MAX77802.
 
  The MAX77686 contains three 32.768khz clock outputs that can be controlled
  (gated/ungated) over I2C.
 
Quoted 8 lines

Documentation/devicetree/bindings/clock/maxim,max77686.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/clock/maxim,max77686.txt +3 -0
+The MAX77802 contains two 32.768khz clock outputs that can be controlled
+(gated/ungated) over I2C.
+
  Following properties should be presend in main device node of the MFD chip.
 
  Required properties:

I'd expect to see compatible strings updated...

There is no separate compatible string for clock. The clock nodes is the parent node only and the compatible described in the parent DT binding doc.

Do we also need to add same thing here?

#6 lore raw

Re: [PATCH V3 2/4] clk: Combine DT binding doc for max77686 and max77802

Hi Rob,

Quoted 32 lines · Laxman Dewangan
Quoted 20 lines · Rob Herring
Quoted 19 lines · Laxman Dewangan
Documentation/devicetree/bindings/clock/maxim,max77686.txt +1 -1
index 9c40739..4d973b5 100644
@@ -1,11 +1,15 @@
-Binding for Maxim MAX77686 32k clock generator block
+Binding for Maxim MAX77686/MAX77802 32k clock generator block
  -This is a part of device tree bindings of MAX77686 multi-function 

device.

Documentation/devicetree/bindings/clock/maxim,max77686.txt +1 -1
-More information can be found in bindings/mfd/max77686.txt file.
+This is a part of device tree bindings of MAX77686/MAX77802 

multi-function
+device. More information can be found in bindings/mfd/max77686.txt file for
+MAX77686 and bindings/mfd/max77802.txt for MAX77802.
The MAX77686 contains three 32.768khz clock outputs that can be
controlled
(gated/ungated) over I2C.

Quoted 9 lines
Quoted 7 lines

+The MAX77802 contains two 32.768khz clock outputs that can be
controlled

Documentation/devicetree/bindings/clock/maxim,max77686.txt +2 -0
+(gated/ungated) over I2C.
+
  Following properties should be presend in main device node of the 

MFD chip.
Required properties:

I'd expect to see compatible strings updated...

Quoted 4 lines

There is no separate compatible string for clock. The clock nodes is the parent node only and the compatible described in the parent DT binding doc.

Do we also need to add same thing here?

Are you fine with the above? As there is no compatible string for clock (clock does not have separate node), do I still need to add explicitly here?

#7 lore raw

Re: [PATCH V3 2/4] clk: Combine DT binding doc for max77686 and max77802

Hi,

Quoted 15 lines · Laxman Dewangan

Hi Rob,

Quoted 12 lines · Laxman Dewangan
Quoted 9 lines · Rob Herring
Quoted 6 lines · Laxman Dewangan

+
Following properties should be presend in main device node of the
MFD chip.
Required properties:

I'd expect to see compatible strings updated...

Quoted 7 lines
Quoted 4 lines

There is no separate compatible string for clock. The clock nodes is the parent node only and the compatible described in the parent DT binding doc.

Do we also need to add same thing here?

Are you fine with the above? As there is no compatible string for clock (clock does not have separate node), do I still need to add explicitly here?

Can you please help here to review? If required, I can rebase and re-send the patches.

Thanks,
Laxman

maintainer Acked-by
#8 lore raw

Re: [PATCH V3 2/4] clk: Combine DT binding doc for max77686 and max77802

Quoted 30 lines · Laxman Dewangan

Hi,

Quoted 27 lines · Laxman Dewangan

Hi Rob,

Quoted 21 lines · Laxman Dewangan
Quoted 5 lines · Rob Herring
Quoted 3 lines · Laxman Dewangan
Quoted 7 lines
Quoted 4 lines

+
Following properties should be presend in main device node of the MFD
chip.
Required properties:

I'd expect to see compatible strings updated...

There is no separate compatible string for clock. The clock nodes is the parent node only and the compatible described in the parent DT binding doc.

Do we also need to add same thing here?

Quoted 7 lines
Quoted 3 lines

Are you fine with the above? As there is no compatible string for clock (clock does not have separate node), do I still need to add explicitly here?

Can you please help here to review? If required, I can rebase and re-send the patches.

It is fine.

Applied
#9 lore raw

Re: [PATCH V3 2/4] clk: Combine DT binding doc for max77686 and max77802

In reply to Laxman Dewangan
Quoted 9 lines · Laxman Dewangan

The clock IP used on the Maxim PMICs max77686 and max77802 are same. The configuration of clock register is also same except the number of clocks.

Define the common DT binding file for the clocks of Maxim PMICs MAX77686 and MAX77802. For this, remove the separate DT binding document file for maxim,max77802 and move all information to maxim,max77686 DT binding document.

Quoted 7 lines

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#10 lore raw

PATCH v3 3/4 clk: max77686: Add DT binding details for PMIC MAX77620

In reply to Laxman Dewangan

Maxim has used the same clock IP on multiple PMICs like MAX77686, MAX77802, MAX77620. Only differences are the number of clocks from these PMICs like MAX77686 has 3 clocks output, MAX776802 have two clock output and MAX77620 has one clock output.

Add clock binding details and DT example for the MAX77620.

---
Changes from V1:
- Use proper comment for the ::::
- Added dt binding preprocessor file as maxim,max77620.h for max77620 inline with the other chip.
- Refer the dt binding header for the supported clock index.

Changes from V2:
- Collected RBs.

---
 .../devicetree/bindings/clock/maxim,max77686.txt   | 52 +++++++++++++++++-----
 include/dt-bindings/clock/maxim,max77620.h         | 21 +++++++++
 2 files changed, 63 insertions(+), 10 deletions(-)
 create mode 100644 include/dt-bindings/clock/maxim,max77620.h
Documentation/devicetree/bindings/clock/maxim,max77686.txt +42 -10
index 4d973b5..8398a3a 100644
@@ -1,14 +1,24 @@
-Binding for Maxim MAX77686/MAX77802 32k clock generator block
+Binding for Maxim MAX77686/MAX77802/MAX77620 32k clock generator block
 
-This is a part of device tree bindings of MAX77686/MAX77802 multi-function
-device. More information can be found in bindings/mfd/max77686.txt file for
-MAX77686 and bindings/mfd/max77802.txt for MAX77802.
+This is a part of device tree bindings of MAX77686/MAX77802/MAX77620
+multi-function device. More information can be found in MFD DT binding
+doc as follows:
+	bindings/mfd/max77686.txt for MAX77686 and
+	bindings/mfd/max77802.txt for MAX77802 and
+	bindings/mfd/max77620.txt for MAX77620.
 
 The MAX77686 contains three 32.768khz clock outputs that can be controlled
-(gated/ungated) over I2C.
+(gated/ungated) over I2C. Clocks are defined as preprocessor macros in
+dt-bindings/clock/maxim,max77686.h.
+
 
 The MAX77802 contains two 32.768khz clock outputs that can be controlled
-(gated/ungated) over I2C.
+(gated/ungated) over I2C. Clocks are defined as preprocessor macros in
+dt-bindings/clock/maxim,max77802.h.
+
+The MAX77686 contains one 32.768khz clock outputs that can be controlled
+(gated/ungated) over I2C. Clocks are defined as preprocessor macros in
+dt-bindings/clock/maxim,max77620.h.
 
 Following properties should be presend in main device node of the MFD chip.
 
@@ -21,13 +31,12 @@ Optional properties:
 
 Each clock is assigned an identifier and client nodes can use this identifier
 to specify the clock which they consume. Following indices are allowed:
-    - 0: 32khz_ap clock (max77686, max77802),
+    - 0: 32khz_ap clock (max77686, max77802), 32khz_out0 (max77620)
     - 1: 32khz_cp clock (max77686, max77802),
     - 2: 32khz_pmic clock (max77686).
 
-Clocks are defined as preprocessor macros in dt-bindings/clock/maxim,max77686.h
-header for MAX77686 and dt-bindings/clock/maxim,max77802.h for MAX77802 and can
-be used in device tree sources.
+Clocks are defined as preprocessor macros in above dt-binding header for
+respective chips.
 
 Example:
 
@@ -80,3 +89,26 @@ Example:
 			clock-names = "my-clock";
 			clocks = <&max77802 MAX77802_CLK_32K_AP>;
 		};
+
+
+3. With MAX77620:
+
+#include <dt-bindings/clock/maxim,max77620.h>
+/* ... */
+
+	Node of the MFD chip
+		max77620: max77620@3c {
+			compatible = "maxim,max77620";
+			reg = <0x3c>;
+			#clock-cells = <1>;
+			/* ... */
+		};
+
+	Clock consumer node
+
+		foo@0 {
+			compatible = "bar,foo";
+			/* ... */
+			clock-names = "my-clock";
+			clocks = <&max77620 MAX77620_CLK_32K_OUT0>;
+		};
include/dt-bindings/clock/maxim,max77620.h new file +21 -0
new file mode 100644
index 0000000..82aba28
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Device Tree binding constants clocks for the Maxim 77620 PMIC.
+ */
+
+#ifndef _DT_BINDINGS_CLOCK_MAXIM_MAX77620_CLOCK_H
+#define _DT_BINDINGS_CLOCK_MAXIM_MAX77620_CLOCK_H
+
+/* Fixed rate clocks. */
+
+#define MAX77620_CLK_32K_OUT0		0
+
+/* Total number of clocks. */
+#define MAX77620_CLKS_NUM		(MAX77620_CLK_32K_OUT0 + 1)
+
+#endif /* _DT_BINDINGS_CLOCK_MAXIM_MAX77620_CLOCK_H */
Signature · 1 line
2.1.4
maintainer
#11 lore raw

Re: [PATCH V3 3/4] clk: max77686: Add DT binding details for PMIC MAX77620

Quoted 52 lines · Laxman Dewangan

Maxim has used the same clock IP on multiple PMICs like MAX77686, MAX77802, MAX77620. Only differences are the number of clocks from these PMICs like MAX77686 has 3 clocks output, MAX776802 have two clock output and MAX77620 has one clock output.

Add clock binding details and DT example for the MAX77620.

---
Changes from V1:
- Use proper comment for the ::::
- Added dt binding preprocessor file as maxim,max77620.h for max77620 inline with the other chip.
- Refer the dt binding header for the supported clock index.

Changes from V2:
- Collected RBs.

---
 .../devicetree/bindings/clock/maxim,max77686.txt   | 52 +++++++++++++++++-----
 include/dt-bindings/clock/maxim,max77620.h         | 21 +++++++++
 2 files changed, 63 insertions(+), 10 deletions(-)
 create mode 100644 include/dt-bindings/clock/maxim,max77620.h
Documentation/devicetree/bindings/clock/maxim,max77686.txt +10 -5
index 4d973b5..8398a3a 100644
@@ -1,14 +1,24 @@
-Binding for Maxim MAX77686/MAX77802 32k clock generator block
+Binding for Maxim MAX77686/MAX77802/MAX77620 32k clock generator block
 
-This is a part of device tree bindings of MAX77686/MAX77802 multi-function
-device. More information can be found in bindings/mfd/max77686.txt file for
-MAX77686 and bindings/mfd/max77802.txt for MAX77802.
+This is a part of device tree bindings of MAX77686/MAX77802/MAX77620
+multi-function device. More information can be found in MFD DT binding
+doc as follows:
+	bindings/mfd/max77686.txt for MAX77686 and
+	bindings/mfd/max77802.txt for MAX77802 and
+	bindings/mfd/max77620.txt for MAX77620.
 
 The MAX77686 contains three 32.768khz clock outputs that can be controlled
-(gated/ungated) over I2C.
+(gated/ungated) over I2C. Clocks are defined as preprocessor macros in
+dt-bindings/clock/maxim,max77686.h.
+
 

Documentation/devicetree/bindings/clock/maxim,max77686.txt line 23

Quoted 10 lines
Documentation/devicetree/bindings/clock/maxim,max77686.txt +6 -1
 The MAX77802 contains two 32.768khz clock outputs that can be controlled
-(gated/ungated) over I2C.
+(gated/ungated) over I2C. Clocks are defined as preprocessor macros in
+dt-bindings/clock/maxim,max77802.h.
+
+The MAX77686 contains one 32.768khz clock outputs that can be controlled
+(gated/ungated) over I2C. Clocks are defined as preprocessor macros in
+dt-bindings/clock/maxim,max77620.h.
 
 Following properties should be presend in main device node of the MFD chip.

Same here. compatible string? Examples are not sufficient to document things.

Rob

Applied
#12 lore raw

Re: [PATCH V3 3/4] clk: max77686: Add DT binding details for PMIC MAX77620

In reply to Laxman Dewangan
Quoted 7 lines · Laxman Dewangan

Maxim has used the same clock IP on multiple PMICs like MAX77686, MAX77802, MAX77620. Only differences are the number of clocks from these PMICs like MAX77686 has 3 clocks output, MAX776802 have two clock output and MAX77620 has one clock output.

Add clock binding details and DT example for the MAX77620.

Quoted 7 lines

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#13 lore raw

PATCH v3 4/4 clk: max77686: Add support for MAX77620 clocks

In reply to Laxman Dewangan

Maxim Max77620 has one 32KHz clock output and the clock HW IP used on this PMIC is same as what it is there in the MAX77686.

Add clock driver support for MAX77620 on the MAX77686 driver.

---
Changes from V1:
- Updated based on changes done in first patch.

Changes from V2:
- Collected RBs
- Make uniformity on chip name like 77620/77686/77802 with sequences.

Changes from V2:
- Collected RBs.
- Nit fixes.

---
 drivers/clk/Kconfig        |  7 ++++---
 drivers/clk/clk-max77686.c | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)
drivers/clk/Kconfig +4 -3
index 6afad74..936a443 100644
@@ -32,10 +32,11 @@ config COMMON_CLK_WM831X
 source "drivers/clk/versatile/Kconfig"
 
 config COMMON_CLK_MAX77686
-	tristate "Clock driver for Maxim 77686/77802 MFD"
-	depends on MFD_MAX77686
+	tristate "Clock driver for Maxim 77620/77686/77802 MFD"
+	depends on MFD_MAX77686 || MFD_MAX77620
 	---help---
-	  This driver supports Maxim 77686/77802 crystal oscillator clock.
+	  This driver supports Maxim 77620/77686/77802 crystal oscillator
+	  clock.
 
 config COMMON_CLK_RK808
 	tristate "Clock driver for RK808"
drivers/clk/clk-max77686.c +18 -0
index 9aba3a8..19f6208 100644
@@ -25,6 +25,7 @@
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/max77620.h>
 #include <linux/mfd/max77686.h>
 #include <linux/mfd/max77686-private.h>
 #include <linux/clk-provider.h>
@@ -35,12 +36,14 @@
 
 #include <dt-bindings/clock/maxim,max77686.h>
 #include <dt-bindings/clock/maxim,max77802.h>
+#include <dt-bindings/clock/maxim,max77620.h>
 
 #define MAX77802_CLOCK_LOW_JITTER_SHIFT 0x3
 
 enum max77686_chip_name {
 	CHIP_MAX77686,
 	CHIP_MAX77802,
+	CHIP_MAX77620,
 };
 
 struct max77686_hw_clk_info {
@@ -97,6 +100,15 @@ max77686_hw_clk_info max77802_hw_clks_info[MAX77802_CLKS_NUM] = {
 	},
 };
 
+static const struct
+max77686_hw_clk_info max77620_hw_clks_info[MAX77620_CLKS_NUM] = {
+	[MAX77620_CLK_32K_OUT0] = {
+		.name = "32khz_out0",
+		.clk_reg = MAX77620_REG_CNFG1_32K,
+		.clk_enable_mask = MAX77620_CNFG1_32K_OUT0_EN,
+	},
+};
+
 static struct max77686_clk_init_data *to_max77686_clk_init_data(
 				struct clk_hw *hw)
 {
@@ -181,6 +193,11 @@ static int max77686_clk_probe(struct platform_device *pdev)
 		hw_clks = max77802_hw_clks_info;
 		break;
 
+	case CHIP_MAX77620:
+		num_clks = MAX77620_CLKS_NUM;
+		hw_clks = max77620_hw_clks_info;
+		break;
+
 	default:
 		dev_err(dev, "Unknown Chip ID\n");
 		return -EINVAL;
@@ -284,6 +301,7 @@ static int max77686_clk_remove(struct platform_device *pdev)
 static const struct platform_device_id max77686_clk_id[] = {
 	{ "max77686-clk", .driver_data = CHIP_MAX77686, },
 	{ "max77802-clk", .driver_data = CHIP_MAX77802, },
+	{ "max77620-clock", .driver_data = CHIP_MAX77620, },
 	{},
 };
 MODULE_DEVICE_TABLE(platform, max77686_clk_id);
Signature · 1 line
2.1.4
Applied
#14 lore raw

Re: [PATCH V3 4/4] clk: max77686: Add support for MAX77620 clocks

Quoted 13 lines · Laxman Dewangan

Maxim Max77620 has one 32KHz clock output and the clock HW IP used on this PMIC is same as what it is there in the MAX77686.

Add clock driver support for MAX77620 on the MAX77686 driver.

Quoted 1 line

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project