linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] clk: clk-cdce925: Add regulator support
@ 2019-06-28  3:19 Phil Reid
  2019-06-28  3:19 ` [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation Phil Reid
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Phil Reid @ 2019-06-28  3:19 UTC (permalink / raw)
  To: mturquette, sboyd, robh+dt, mark.rutland, preid, linux-clk, devicetree

The cdce925 power supplies could be controllable on some platforms.
Enable them before communicating with the cdce925.

Changes from V1
- Add devicetree updates


Phil Reid (2):
  dt-bindings: clock: cdce925: Add regulator documentation
  clk: clk-cdce925: Add regulator support

 .../devicetree/bindings/clock/ti,cdce925.txt       |  4 +++
 drivers/clk/clk-cdce925.c                          | 34 ++++++++++++++++++++++
 2 files changed, 38 insertions(+)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation
  2019-06-28  3:19 [PATCH v2 0/2] clk: clk-cdce925: Add regulator support Phil Reid
@ 2019-06-28  3:19 ` Phil Reid
  2019-07-22 18:18   ` Rob Herring
  2019-09-06 17:32   ` Stephen Boyd
  2019-06-28  3:19 ` [PATCH v2 2/2] clk: clk-cdce925: Add regulator support Phil Reid
  2019-08-05  8:26 ` [PATCH v2 0/2] " Phil Reid
  2 siblings, 2 replies; 8+ messages in thread
From: Phil Reid @ 2019-06-28  3:19 UTC (permalink / raw)
  To: mturquette, sboyd, robh+dt, mark.rutland, preid, linux-clk, devicetree

The cdce925 has two separate supply pins. Document the bindings
for them.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 Documentation/devicetree/bindings/clock/ti,cdce925.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/ti,cdce925.txt b/Documentation/devicetree/bindings/clock/ti,cdce925.txt
index 0d01f2d..26544c8 100644
--- a/Documentation/devicetree/bindings/clock/ti,cdce925.txt
+++ b/Documentation/devicetree/bindings/clock/ti,cdce925.txt
@@ -24,6 +24,8 @@ Required properties:
 Optional properties:
  - xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a
                  board, or to compensate for external influences.
+- vdd-supply: A regulator node for Vdd
+- vddout-supply: A regulator node for Vddout
 
 For all PLL1, PLL2, ... an optional child node can be used to specify spread
 spectrum clocking parameters for a board.
@@ -41,6 +43,8 @@ Example:
 		clocks = <&xtal_27Mhz>;
 		#clock-cells = <1>;
 		xtal-load-pf = <5>;
+		vdd-supply = <&1v8-reg>;
+		vddout-supply = <&3v3-reg>;
 		/* PLL options to get SSC 1% centered */
 		PLL2 {
 			spread-spectrum = <4>;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] clk: clk-cdce925: Add regulator support
  2019-06-28  3:19 [PATCH v2 0/2] clk: clk-cdce925: Add regulator support Phil Reid
  2019-06-28  3:19 ` [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation Phil Reid
@ 2019-06-28  3:19 ` Phil Reid
  2019-09-06 17:32   ` Stephen Boyd
  2019-08-05  8:26 ` [PATCH v2 0/2] " Phil Reid
  2 siblings, 1 reply; 8+ messages in thread
From: Phil Reid @ 2019-06-28  3:19 UTC (permalink / raw)
  To: mturquette, sboyd, robh+dt, mark.rutland, preid, linux-clk, devicetree

The cdce925 power supplies could be controllable on some platforms.
Enable them before communicating with the cdce925.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 drivers/clk/clk-cdce925.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c
index a98b3f19..2678ee6 100644
--- a/drivers/clk/clk-cdce925.c
+++ b/drivers/clk/clk-cdce925.c
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/gcd.h>
 
@@ -602,6 +603,30 @@ static int cdce925_regmap_i2c_read(void *context,
 	return &data->clk[idx].hw;
 }
 
+static void cdce925_regulator_disable(void *regulator)
+{
+	regulator_disable(regulator);
+}
+
+static int cdce925_regulator_enable(struct device *dev, const char *name)
+{
+	struct regulator *regulator;
+	int err;
+
+	regulator = devm_regulator_get(dev, name);
+	if (IS_ERR(regulator))
+		return PTR_ERR(regulator);
+
+	err = regulator_enable(regulator);
+	if (err) {
+		dev_err(dev, "Failed to enable %s: %d\n", name, err);
+		return err;
+	}
+
+	return devm_add_action_or_reset(dev, cdce925_regulator_disable,
+					regulator);
+}
+
 /* The CDCE925 uses a funky way to read/write registers. Bulk mode is
  * just weird, so just use the single byte mode exclusively. */
 static struct regmap_bus regmap_cdce925_bus = {
@@ -630,6 +655,15 @@ static int cdce925_probe(struct i2c_client *client,
 	};
 
 	dev_dbg(&client->dev, "%s\n", __func__);
+
+	err = cdce925_regulator_enable(&client->dev, "vdd");
+	if (err)
+		return err;
+
+	err = cdce925_regulator_enable(&client->dev, "vddout");
+	if (err)
+		return err;
+
 	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation
  2019-06-28  3:19 ` [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation Phil Reid
@ 2019-07-22 18:18   ` Rob Herring
  2019-09-06 17:32   ` Stephen Boyd
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2019-07-22 18:18 UTC (permalink / raw)
  To: Phil Reid
  Cc: mturquette, sboyd, robh+dt, mark.rutland, preid, linux-clk, devicetree

On Fri, 28 Jun 2019 11:19:09 +0800, Phil Reid wrote:
> The cdce925 has two separate supply pins. Document the bindings
> for them.
> 
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---
>  Documentation/devicetree/bindings/clock/ti,cdce925.txt | 4 ++++
>  1 file changed, 4 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] clk: clk-cdce925: Add regulator support
  2019-06-28  3:19 [PATCH v2 0/2] clk: clk-cdce925: Add regulator support Phil Reid
  2019-06-28  3:19 ` [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation Phil Reid
  2019-06-28  3:19 ` [PATCH v2 2/2] clk: clk-cdce925: Add regulator support Phil Reid
@ 2019-08-05  8:26 ` Phil Reid
  2019-09-06 17:31   ` Stephen Boyd
  2 siblings, 1 reply; 8+ messages in thread
From: Phil Reid @ 2019-08-05  8:26 UTC (permalink / raw)
  To: mturquette, sboyd, robh+dt, mark.rutland, linux-clk, devicetree

On 28/06/2019 11:19, Phil Reid wrote:
> The cdce925 power supplies could be controllable on some platforms.
> Enable them before communicating with the cdce925.
> 
> Changes from V1
> - Add devicetree updates
> 
> 
> Phil Reid (2):
>    dt-bindings: clock: cdce925: Add regulator documentation
>    clk: clk-cdce925: Add regulator support
> 
>   .../devicetree/bindings/clock/ti,cdce925.txt       |  4 +++
>   drivers/clk/clk-cdce925.c                          | 34 ++++++++++++++++++++++
>   2 files changed, 38 insertions(+)
> 

Any more feedback on this series?

-- 
Regards
Phil Reid


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] clk: clk-cdce925: Add regulator support
  2019-08-05  8:26 ` [PATCH v2 0/2] " Phil Reid
@ 2019-09-06 17:31   ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2019-09-06 17:31 UTC (permalink / raw)
  To: Phil Reid, devicetree, linux-clk, mark.rutland, mturquette, robh+dt

Quoting Phil Reid (2019-08-05 01:26:41)
> On 28/06/2019 11:19, Phil Reid wrote:
> > The cdce925 power supplies could be controllable on some platforms.
> > Enable them before communicating with the cdce925.
> > 
> > Changes from V1
> > - Add devicetree updates
> > 
> > 
> > Phil Reid (2):
> >    dt-bindings: clock: cdce925: Add regulator documentation
> >    clk: clk-cdce925: Add regulator support
> > 
> >   .../devicetree/bindings/clock/ti,cdce925.txt       |  4 +++
> >   drivers/clk/clk-cdce925.c                          | 34 ++++++++++++++++++++++
> >   2 files changed, 38 insertions(+)
> > 
> 
> Any more feedback on this series?
> 

Don't think so. Thanks!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation
  2019-06-28  3:19 ` [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation Phil Reid
  2019-07-22 18:18   ` Rob Herring
@ 2019-09-06 17:32   ` Stephen Boyd
  1 sibling, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2019-09-06 17:32 UTC (permalink / raw)
  To: devicetree, linux-clk, mark.rutland, mturquette, preid, robh+dt

Quoting Phil Reid (2019-06-27 20:19:09)
> The cdce925 has two separate supply pins. Document the bindings
> for them.
> 
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---

Applied to clk-next


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] clk: clk-cdce925: Add regulator support
  2019-06-28  3:19 ` [PATCH v2 2/2] clk: clk-cdce925: Add regulator support Phil Reid
@ 2019-09-06 17:32   ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2019-09-06 17:32 UTC (permalink / raw)
  To: devicetree, linux-clk, mark.rutland, mturquette, preid, robh+dt

Quoting Phil Reid (2019-06-27 20:19:10)
> The cdce925 power supplies could be controllable on some platforms.
> Enable them before communicating with the cdce925.
> 
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---

Applied to clk-next


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-09-06 17:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28  3:19 [PATCH v2 0/2] clk: clk-cdce925: Add regulator support Phil Reid
2019-06-28  3:19 ` [PATCH v2 1/2] dt-bindings: clock: cdce925: Add regulator documentation Phil Reid
2019-07-22 18:18   ` Rob Herring
2019-09-06 17:32   ` Stephen Boyd
2019-06-28  3:19 ` [PATCH v2 2/2] clk: clk-cdce925: Add regulator support Phil Reid
2019-09-06 17:32   ` Stephen Boyd
2019-08-05  8:26 ` [PATCH v2 0/2] " Phil Reid
2019-09-06 17:31   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).