Skip to contentSkip to conversation

regulator: support Silergy SY8824C/SY8824E etc.

PATCH Superseded Jisheng Zhang 2 participants 13 messages Aug 27, 2019 – Aug 28, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover regulator: support Silergy SY8824C/SY8824E etc.

Add support for Silergy SY8824C/SY8824E/SY20276/SY20278 regulator.

Jisheng Zhang (8):
regulator: add binding for the SY8824C voltage regulator
regulator: add support for SY8824C regulator
dt-bindings: sy8824x: Document SY8824E support
regulator: sy8824x: add SY8824E support
dt-bindings: sy8824x: Document SY20276 support
regulator: sy8824x: add SY20276 support
dt-bindings: sy8824x: Document SY20278 support
regulator: sy8824x: add SY20278 support

 .../devicetree/bindings/regulator/sy8824x.txt |  24 ++
 drivers/regulator/Kconfig                     |   7 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/sy8824x.c                   | 231 ++++++++++++++++++
 4 files changed, 263 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/sy8824x.txt
 create mode 100644 drivers/regulator/sy8824x.c
Signature · 1 line
2.23.0.rc1
#1 lore raw

PATCH 1/8 regulator: add binding for the SY8824C voltage regulator

SY8824C is an I2C-controlled adjustable voltage regulator made by Silergy Corp.

Add its device tree binding.

---
 .../devicetree/bindings/regulator/sy8824x.txt | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/sy8824x.txt
Documentation/devicetree/bindings/regulator/sy8824x.txt new file +20 -0
new file mode 100644
index 000000000000..ff8d1af04f7b
@@ -0,0 +1,20 @@
+SY8824C Voltage regulator
+
+Required properties:
+- compatible: Must be "silergy,sy8824c"
+- reg: I2C slave address
+
+Any property defined as part of the core regulator binding, defined in
+./regulator.txt, can also be used.
+
+Example:
+
+	vcore: regulator@00 {
+		compatible = "silergy,sy8824c";
+		reg = <0x66>;
+		regulator-name = "vcore";
+		regulator-min-microvolt = <800000>;
+		regulator-max-microvolt = <1150000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
Signature · 1 line
2.23.0.rc1
#2 lore raw

PATCH 2/8 regulator: add support for SY8824C regulator

In reply to Jisheng Zhang

SY8824C is an I2C attached single output regulator made by Silergy Corp, which is used on several Synaptics berlin platforms to control the power supply of the ARM cores.

Add a driver for it.

---
 drivers/regulator/Kconfig   |   7 ++
 drivers/regulator/Makefile  |   1 +
 drivers/regulator/sy8824x.c | 192 ++++++++++++++++++++++++++++++++++++
 3 files changed, 200 insertions(+)
 create mode 100644 drivers/regulator/sy8824x.c
drivers/regulator/Kconfig +7 -0
index b57093d7c01f..e8093a909e85 100644
@@ -906,6 +906,13 @@ config REGULATOR_SY8106A
 	help
 	  This driver supports SY8106A single output regulator.
 
+config REGULATOR_SY8824X
+	tristate "Silergy SY8824C regulator"
+	depends on I2C && (OF || COMPILE_TEST)
+	select REGMAP_I2C
+	help
+	  This driver supports SY8824C single output regulator.
+
 config REGULATOR_TPS51632
 	tristate "TI TPS51632 Power Regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index eef73b5a35a4..922bf975070f 100644
@@ -111,6 +111,7 @@ obj-$(CONFIG_REGULATOR_STM32_PWR) += stm32-pwr.o
 obj-$(CONFIG_REGULATOR_STPMIC1) += stpmic1_regulator.o
 obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o
 obj-$(CONFIG_REGULATOR_SY8106A) += sy8106a-regulator.o
+obj-$(CONFIG_REGULATOR_SY8824X) += sy8824x.o
 obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o
drivers/regulator/sy8824x.c new file +192 -0

192 lines not on this page · raw message

Signature · 1 line
2.23.0.rc1
maintainer
#3 lore raw

Re: [PATCH 2/8] regulator: add support for SY8824C regulator

On Tue, Aug 27, 2019 at 08:45:33AM +0000, Jisheng Zhang wrote:

This looks mostly good and I'll apply it, a couple of small things though:

drivers/regulator/sy8824x.c line 4

Quoted 5 lines
drivers/regulator/sy8824x.c new file +4 -0
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SY8824C regulator driver
+ *

Please send a patch which updates the entire comment block to be C++ style so it looks consistent.

drivers/regulator/sy8824x.c line 19

Quoted 3 lines
drivers/regulator/sy8824x.c new file +3 -0
+#define BUCK_EN		(1 << 7)
+#define MODE		(1 << 6)
+

Please also add prefixes to these to namespace them, especially MODE is likely to collide with something later.

#4 lore raw

Re: [PATCH 2/8] regulator: add support for SY8824C regulator

Hi Mark,

Quoted 5 lines · On Tue, 27 Aug 2019 20:44:37 +0100 Mark Brown wrote:

On Tue, Aug 27, 2019 at 08:45:33AM +0000, Jisheng Zhang wrote:

This looks mostly good and I'll apply it, a couple of small things though:

Quoted 8 lines

drivers/regulator/sy8824x.c line 4

Quoted 5 lines
drivers/regulator/sy8824x.c new file +4 -0
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SY8824C regulator driver
+ *  

Please send a patch which updates the entire comment block to be C++ style so it looks consistent.

Do you mean update the following style

A:

// SPDX-License-Identifier: GPL-2.0
/*
* SY8824C regulator driver
* ...

as B:

// SPDX-License-Identifier: GPL-2.0
// SY8824C regulator driver
// ...

I'm not sure which style is correct. But I see B is commonly used in lots .c source files in other dirs, such as kernel/ mm/ etc.

Could you please clarify?

Thanks

Quoted 7 lines

drivers/regulator/sy8824x.c line 19

Quoted 4 lines
drivers/regulator/sy8824x.c new file +3 -0
+#define BUCK_EN		(1 << 7)
+#define MODE		(1 << 6)
+  

Please also add prefixes to these to namespace them, especially MODE is likely to collide with something later.

good idea. Will do in newer version

#5 lore raw

Re: [PATCH 2/8] regulator: add support for SY8824C regulator

Quoted 28 lines · On Wed, 28 Aug 2019 11:27:05 +0800 Jisheng Zhang wrote:

Hi Mark,

Quoted 5 lines · On Tue, 27 Aug 2019 20:44:37 +0100 Mark Brown wrote:

On Tue, Aug 27, 2019 at 08:45:33AM +0000, Jisheng Zhang wrote:

This looks mostly good and I'll apply it, a couple of small things though:

Quoted 8 lines

drivers/regulator/sy8824x.c line 4

Quoted 5 lines
drivers/regulator/sy8824x.c new file +4 -0
@@ -0,0 +1,192 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SY8824C regulator driver
+ *    

Please send a patch which updates the entire comment block to be C++ style so it looks consistent.

Do you mean update the following style

A:

// SPDX-License-Identifier: GPL-2.0
/*
* SY8824C regulator driver
* ...

Quoted 7 lines

as B:

// SPDX-License-Identifier: GPL-2.0
// SY8824C regulator driver
// ...

I'm not sure which style is correct. But I see B is commonly used

sorry, typo. I mean "I see A is commonly used ..."

Quoted 15 lines

in lots .c source files in other dirs, such as kernel/ mm/ etc.

Could you please clarify?

Thanks

Quoted 7 lines

drivers/regulator/sy8824x.c line 19

Quoted 4 lines
drivers/regulator/sy8824x.c new file +3 -0
+#define BUCK_EN		(1 << 7)
+#define MODE		(1 << 6)
+    

Please also add prefixes to these to namespace them, especially MODE is likely to collide with something later.

good idea. Will do in newer version

maintainer
#6 lore raw

Re: [PATCH 2/8] regulator: add support for SY8824C regulator

In reply to Jisheng Zhang
Quoted 15 lines · Jisheng Zhang
Quoted 3 lines · On Tue, 27 Aug 2019 20:44:37 +0100 Mark Brown wrote:

Please send a patch which updates the entire comment block to be C++ style so it looks consistent.

Do you mean update the following style

A:

// SPDX-License-Identifier: GPL-2.0
/*
* SY8824C regulator driver
* ...

Quoted 8 lines

as B:

// SPDX-License-Identifier: GPL-2.0
// SY8824C regulator driver
// ...

I'm not sure which style is correct. But I see B is commonly used in lots .c source files in other dirs, such as kernel/ mm/ etc.

Yes, please - update to style B.

#7 lore raw

PATCH 3/8 dt-bindings: sy8824x: Document SY8824E support

In reply to Jisheng Zhang

SY8824E is an I2C-controlled adjustable voltage regulator made by Silergy Corp. The only difference between SY8824C and SY8824E is the vsel_min.

---
 Documentation/devicetree/bindings/regulator/sy8824x.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/regulator/sy8824x.txt +4 -2
index ff8d1af04f7b..31fefa3baa71 100644
@@ -1,7 +1,9 @@
-SY8824C Voltage regulator
+SY8824C/SY8824E Voltage regulator
 
 Required properties:
-- compatible: Must be "silergy,sy8824c"
+- compatible: Must be one of the following.
+	"silergy,sy8824c"
+	"silergy,sy8824e"
 - reg: I2C slave address
 
 Any property defined as part of the core regulator binding, defined in
Signature · 1 line
2.23.0.rc1
#8 lore raw

PATCH 4/8 regulator: sy8824x: add SY8824E support

In reply to Jisheng Zhang

The only difference between SY8824E and SY8824C/D is the vsel_min.

---
 drivers/regulator/Kconfig   |  2 +-
 drivers/regulator/sy8824x.c | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/regulator/Kconfig +1 -1
index e8093a909e85..b70a0a07795b 100644
@@ -907,7 +907,7 @@ config REGULATOR_SY8106A
 	  This driver supports SY8106A single output regulator.
 
 config REGULATOR_SY8824X
-	tristate "Silergy SY8824C regulator"
+	tristate "Silergy SY8824C/SY8824E regulator"
 	depends on I2C && (OF || COMPILE_TEST)
 	select REGMAP_I2C
 	help
drivers/regulator/sy8824x.c +15 -2
index 2d8a61ca6643..b1438d94eee2 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * SY8824C regulator driver
+ * SY8824C/SY8824E regulator driver
  *
  * Copyright (C) 2019 Synaptics Incorporated
  *
@@ -162,11 +162,24 @@ static const struct sy8824_config sy8824c_cfg = {
 	.vsel_count = 64,
 };
 
+static const struct sy8824_config sy8824e_cfg = {
+	.vol_reg = 0x00,
+	.mode_reg = 0x00,
+	.enable_reg = 0x00,
+	.vsel_min = 700000,
+	.vsel_step = 12500,
+	.vsel_count = 64,
+};
+
 static const struct of_device_id sy8824_dt_ids[] = {
 	{
 		.compatible = "silergy,sy8824c",
 		.data = &sy8824c_cfg
 	},
+	{
+		.compatible = "silergy,sy8824e",
+		.data = &sy8824e_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
@@ -188,5 +201,5 @@ static struct i2c_driver sy8824_regulator_driver = {
 module_i2c_driver(sy8824_regulator_driver);
 
 MODULE_AUTHOR("Jisheng Zhang <[email protected]>");
-MODULE_DESCRIPTION("SY8824C regulator driver");
+MODULE_DESCRIPTION("SY8824C/SY8824E regulator driver");
 MODULE_LICENSE("GPL v2");
Signature · 1 line
2.23.0.rc1
#9 lore raw

PATCH 5/8 dt-bindings: sy8824x: Document SY20276 support

In reply to Jisheng Zhang

SY20276 is an I2C-controlled adjustable voltage regulator made by Silergy Corp. The differences between SY8824C and SY20276 are different vsel_min, vsel_step, vsel_count and regs for mode/enable.

---
 Documentation/devicetree/bindings/regulator/sy8824x.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/regulator/sy8824x.txt +2 -1
index 31fefa3baa71..28600541b5de 100644
@@ -1,9 +1,10 @@
-SY8824C/SY8824E Voltage regulator
+SY8824C/SY8824E/SY20276 Voltage regulator
 
 Required properties:
 - compatible: Must be one of the following.
 	"silergy,sy8824c"
 	"silergy,sy8824e"
+	"silergy,sy20276"
 - reg: I2C slave address
 
 Any property defined as part of the core regulator binding, defined in
Signature · 1 line
2.23.0.rc1
#10 lore raw

PATCH 6/8 regulator: sy8824x: add SY20276 support

In reply to Jisheng Zhang

The differences between SY8824C and SY20276 are different vsel_min, vsel_step, vsel_count and regs for mode/enable.

---
 drivers/regulator/sy8824x.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/regulator/sy8824x.c +13 -0
index b1438d94eee2..9410c3470870 100644
@@ -171,6 +171,15 @@ static const struct sy8824_config sy8824e_cfg = {
 	.vsel_count = 64,
 };
 
+static const struct sy8824_config sy20276_cfg = {
+	.vol_reg = 0x00,
+	.mode_reg = 0x01,
+	.enable_reg = 0x01,
+	.vsel_min = 600000,
+	.vsel_step = 10000,
+	.vsel_count = 128,
+};
+
 static const struct of_device_id sy8824_dt_ids[] = {
 	{
 		.compatible = "silergy,sy8824c",
@@ -180,6 +189,10 @@ static const struct of_device_id sy8824_dt_ids[] = {
 		.compatible = "silergy,sy8824e",
 		.data = &sy8824e_cfg
 	},
+	{
+		.compatible = "silergy,sy20276",
+		.data = &sy20276_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
Signature · 1 line
2.23.0.rc1
#11 lore raw

PATCH 7/8 dt-bindings: sy8824x: Document SY20278 support

In reply to Jisheng Zhang

SY20276 is an I2C-controlled adjustable voltage regulator made by Silergy Corp. The differences between SY8824C and SY20278 are different regs for mode/enable.

---
 Documentation/devicetree/bindings/regulator/sy8824x.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/regulator/sy8824x.txt +1 -0
index 28600541b5de..c5e95850c427 100644
@@ -5,6 +5,7 @@ Required properties:
 	"silergy,sy8824c"
 	"silergy,sy8824e"
 	"silergy,sy20276"
+	"silergy,sy20278"
 - reg: I2C slave address
 
 Any property defined as part of the core regulator binding, defined in
Signature · 1 line
2.23.0.rc1
#12 lore raw

PATCH 8/8 regulator: sy8824x: add SY20278 support

In reply to Jisheng Zhang

The differences between SY8824C and SY20278 are different regs for mode/enable.

---
 drivers/regulator/sy8824x.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/regulator/sy8824x.c +13 -0
index 9410c3470870..1a7fa4865491 100644
@@ -180,6 +180,15 @@ static const struct sy8824_config sy20276_cfg = {
 	.vsel_count = 128,
 };
 
+static const struct sy8824_config sy20278_cfg = {
+	.vol_reg = 0x00,
+	.mode_reg = 0x01,
+	.enable_reg = 0x01,
+	.vsel_min = 762500,
+	.vsel_step = 12500,
+	.vsel_count = 64,
+};
+
 static const struct of_device_id sy8824_dt_ids[] = {
 	{
 		.compatible = "silergy,sy8824c",
@@ -193,6 +202,10 @@ static const struct of_device_id sy8824_dt_ids[] = {
 		.compatible = "silergy,sy20276",
 		.data = &sy20276_cfg
 	},
+	{
+		.compatible = "silergy,sy20278",
+		.data = &sy20278_cfg
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
Signature · 1 line
2.23.0.rc1