Skip to contentSkip to conversation

Add rockchip RK808 pmic driver

PATCH Superseded Chris Zhong 5 participants 15 messages Sep 4, 2014 – Sep 9, 2014

Subsystems (3)

v9 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v9 cover Add rockchip RK808 pmic driver

This is the initial version of the RK808 PMIC. This is a power management IC for multimedia products.

It provides regulators that are able to supply power to processor cores and other components. The chip provides other modules including RTC, Clockout

Changes in v9:
Adviced by Dmitry
- if(rk808_rtc->irq < 0), return rk808_rtc->irq
Adviced by Doug
- add reg_np

Changes in v8:
Adviced by Doug
- coding style
- fix regmap_update_bits()
- if(rk808_rtc->irq < 0) return err num
Adviced by Mike
-rename "control" to "enable"
-define RK808_NR_OUTPUT 2
Adviced by Doug
- remove rk808_regulator_dts() function
- remove the check about "client->dev.of_node"

Changes in v7:
Adviced by doug
- read rtc time from shadowed registers
Adviced by Dmitry
- use CONFIG_PM_SLEEP replace CONFIG_PM
- use SIMPLE_DEV_PM_OPS replace dev_pm_ops
- fix dev_warn
- coding style
Adviced by Heiko
- remove rtc_ctl
Adviced by doug
-fix coding style problems
- remove pdata struct from header file, add rk808_regulator struct

Changes in v6:
Adviced by doug
- move RTC_READSEL setting into probe
Adviced by doug
- use correct argument call of_clk_add_provider in probe
- remove the redundant code

Changes in v5:
- fixed a bug about set_time failed
Adviced by doug
- add some error checking in probe
- move "rockchip,rk808.h" into the patch about dt-bindings
- re-edit base on Mark's branch

Changes in v4:
- use &client->dev replace rk808->dev
Adviced by doug
- add "clock-output-names" propertiey
- add a header file "rockchip,rk808.h"
- use &client->dev replace rk808->dev

Changes in v3:
- fix compile err

Changes in v2:
Adviced by javier.martinez
- Add a separate clock driver, rather than in RTC driver Adviced by javier.martinez
- separated from rtc-rk808.c
Adviced by Mark Browm:
- change of_find_node_by_name to find_child_by_name
- use RK808_NUM_REGULATORS as the name of the constant
- create a pdata when missing platform data
- use the rk808_reg name to supply_regulator name
- replace regulator_register with devm_regulator_register
- some other problem with coding style

Chris Zhong (3):
RTC: RK808: add RTC driver for RK808
clk: RK808: Add clkout driver for RK808
regulator: RK808: Remove pdata from the regulator

 drivers/clk/Kconfig                 |    9 +
 drivers/clk/Makefile                |    1 +
 drivers/clk/clk-rk808.c             |  164 ++++++++++++++
 drivers/regulator/rk808-regulator.c |   91 ++------
 drivers/rtc/Kconfig                 |   10 +
 drivers/rtc/Makefile                |    1 +
 drivers/rtc/rtc-rk808.c             |  426 +++++++++++++++++++++++++++++++++++
 7 files changed, 629 insertions(+), 73 deletions(-)
 create mode 100644 drivers/clk/clk-rk808.c
 create mode 100644 drivers/rtc/rtc-rk808.c
Signature · 6 lines
1.7.9.5

--
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

PATCH v9 1/3 RTC: RK808: add RTC driver for RK808

Adding RTC driver for supporting RTC device present inside RK808 PMIC.

---

Changes in v9:
Adviced by Dmitry
- if(rk808_rtc->irq < 0), return rk808_rtc->irq

Changes in v8:
Adviced by Doug
- coding style
- fix regmap_update_bits()
- if(rk808_rtc->irq < 0) return err num

Changes in v7:
Adviced by doug
- read rtc time from shadowed registers
Adviced by Dmitry
- use CONFIG_PM_SLEEP replace CONFIG_PM
- use SIMPLE_DEV_PM_OPS replace dev_pm_ops
- fix dev_warn
- coding style
Adviced by Heiko
- remove rtc_ctl

Changes in v6:
Adviced by doug
- move RTC_READSEL setting into probe

Changes in v5:
- fixed a bug about set_time failed

Changes in v4:
- use &client->dev replace rk808->dev

Changes in v3: None
Changes in v2:
Adviced by javier.martinez
- Add a separate clock driver, rather than in RTC driver

 drivers/rtc/Kconfig     |   10 ++
 drivers/rtc/Makefile    |    1 +
 drivers/rtc/rtc-rk808.c |  426 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 437 insertions(+)
 create mode 100644 drivers/rtc/rtc-rk808.c
drivers/rtc/Kconfig +10 -0
index a168e96..aeab9d9 100644
@@ -288,6 +288,16 @@ config RTC_DRV_MAX77686
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-max77686.
 
+config RTC_DRV_RK808
+	tristate "Rockchip RK808 RTC"
+	depends on MFD_RK808
+	help
+	  If you say yes here you will get support for the
+	  RTC of RK808 PMIC.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rk808-rtc.
+
 config RTC_DRV_RS5C372
 	tristate "Ricoh R2025S/D, RS5C372A/B, RV5C386, RV5C387A"
 	help
drivers/rtc/Makefile +1 -0
index 56f061c..91fe4647 100644
@@ -109,6 +109,7 @@ obj-$(CONFIG_RTC_DRV_PUV3)	+= rtc-puv3.o
 obj-$(CONFIG_RTC_DRV_PXA)	+= rtc-pxa.o
 obj-$(CONFIG_RTC_DRV_R9701)	+= rtc-r9701.o
 obj-$(CONFIG_RTC_DRV_RC5T583)	+= rtc-rc5t583.o
+obj-$(CONFIG_RTC_DRV_RK808)	+= rtc-rk808.o
 obj-$(CONFIG_RTC_DRV_RP5C01)	+= rtc-rp5c01.o
 obj-$(CONFIG_RTC_DRV_RS5C313)	+= rtc-rs5c313.o
 obj-$(CONFIG_RTC_DRV_RS5C348)	+= rtc-rs5c348.o
drivers/rtc/rtc-rk808.c new file +426 -0

426 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Reviewed-by Tested-by on v9 1/3
#2 lore raw

Re: [PATCH v9 1/3] RTC: RK808: add RTC driver for RK808

Chris,

Quoted 6 lines · Chris Zhong

Adding RTC driver for supporting RTC device present inside RK808 PMIC.

drivers/rtc/rtc-rk808.c line 396

Quoted 4 lines
drivers/rtc/rtc-rk808.c new file +4 -0
+       rk808_rtc->irq = platform_get_irq(pdev, 0);
+       if (rk808_rtc->irq < 0) {
+               dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
+                       rk808_rtc->irq);

Technically you shouldn't print the error if it's -EPROBE_DEFER. ...but I think that's really unlikely here (I can't imagine any real cases where the interrupt parent for RK808 would actually be deferred) so I won't push it.
--
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

#3 lore raw

Re: [PATCH v9 1/3] RTC: RK808: add RTC driver for RK808

Quoted 19 lines · Doug Anderson

Chris,

Quoted 6 lines · Chris Zhong

Adding RTC driver for supporting RTC device present inside RK808 PMIC.

drivers/rtc/rtc-rk808.c line 396

Quoted 4 lines
drivers/rtc/rtc-rk808.c new file +4 -0
+       rk808_rtc->irq = platform_get_irq(pdev, 0);
+       if (rk808_rtc->irq < 0) {
+               dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
+                       rk808_rtc->irq);
Quoted 4 lines

Technically you shouldn't print the error if it's -EPROBE_DEFER. ...but I think that's really unlikely here (I can't imagine any real cases where the interrupt parent for RK808 would actually be deferred) so I won't push it.

Doug, platform_get_irq() simply iterates through IRQ resources assigned to the device, which are populated at platform device creation time. The only error it returns ever is -ENXIO, so we are fine here.

Thanks.

Signature · 5 lines
Dmitry
--
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
#4 lore raw

Re: [PATCH v9 1/3] RTC: RK808: add RTC driver for RK808

Dmitry,

Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Doug Anderson

Chris,

Quoted 6 lines · Chris Zhong

Adding RTC driver for supporting RTC device present inside RK808 PMIC.

Quoted 4 lines
drivers/rtc/rtc-rk808.c new file +4 -0
+       rk808_rtc->irq = platform_get_irq(pdev, 0);
+       if (rk808_rtc->irq < 0) {
+               dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
+                       rk808_rtc->irq);
Quoted 8 lines
Quoted 4 lines

Technically you shouldn't print the error if it's -EPROBE_DEFER. ...but I think that's really unlikely here (I can't imagine any real cases where the interrupt parent for RK808 would actually be deferred) so I won't push it.

Doug, platform_get_irq() simply iterates through IRQ resources assigned to the device, which are populated at platform device creation time. The only error it returns ever is -ENXIO, so we are fine here.

I think maybe you're looking at older source code? The source code I have for mainline Linux specifically includes code handling EPROBE_DEFER in platform_get_irq().

-Doug

#5 lore raw

Re: [PATCH v9 1/3] RTC: RK808: add RTC driver for RK808

Quoted 29 lines · Doug Anderson

Dmitry,

Quoted 25 lines · Dmitry Torokhov
Quoted 23 lines · Doug Anderson

Chris,

Quoted 6 lines · Chris Zhong

Adding RTC driver for supporting RTC device present inside RK808 PMIC.

drivers/rtc/rtc-rk808.c line 396

Quoted 4 lines
drivers/rtc/rtc-rk808.c new file +4 -0
+       rk808_rtc->irq = platform_get_irq(pdev, 0);
+       if (rk808_rtc->irq < 0) {
+               dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
+                       rk808_rtc->irq);

Technically you shouldn't print the error if it's -EPROBE_DEFER. ...but I think that's really unlikely here (I can't imagine any real cases where the interrupt parent for RK808 would actually be deferred) so I won't push it.

Quoted 7 lines
Quoted 3 lines

Doug, platform_get_irq() simply iterates through IRQ resources assigned to the device, which are populated at platform device creation time. The only error it returns ever is -ENXIO, so we are fine here.

I think maybe you're looking at older source code? The source code I have for mainline Linux specifically includes code handling EPROBE_DEFER in platform_get_irq().

Ah, indeed. That -EPROBE_DEFER monstrosity keeps spreading :(

Signature · 5 lines
Dmitry
--
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
#6 lore raw

PATCH v9 2/3 clk: RK808: Add clkout driver for RK808

In reply to Chris Zhong

---

Changes in v9: None
Changes in v8:
Adviced by Mike
-rename "control" to "enable"
-define RK808_NR_OUTPUT 2

Changes in v7:
Adviced by doug
-fix coding style problems

Changes in v6:
Adviced by doug
- use correct argument call of_clk_add_provider in probe

Changes in v5:
Adviced by doug
- add some error checking in probe
- move "rockchip,rk808.h" into the patch about dt-bindings

Changes in v4:
Adviced by doug
- add "clock-output-names" propertiey
- add a header file "rockchip,rk808.h"

Changes in v3:
- fix compile err

Changes in v2:
Adviced by javier.martinez
- separated from rtc-rk808.c

 drivers/clk/Kconfig     |    9 +++
 drivers/clk/Makefile    |    1 +
 drivers/clk/clk-rk808.c |  164 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)
 create mode 100644 drivers/clk/clk-rk808.c
drivers/clk/Kconfig +9 -0
index cfd3af7..84e0590 100644
@@ -38,6 +38,15 @@ config COMMON_CLK_MAX77686
 	---help---
 	  This driver supports Maxim 77686 crystal oscillator clock. 
 
+config COMMON_CLK_RK808
+	tristate "Clock driver for RK808"
+	depends on MFD_RK808
+	---help---
+	  This driver supports RK808 crystal oscillator clock. These
+	  multi-function devices have two fixed-rate oscillators,
+	  clocked at 32KHz each. Clkout1 is always on, Clkout2 can off
+	  by control register.
+
 config COMMON_CLK_SI5351
 	tristate "Clock driver for SiLabs 5351A/B/C"
 	depends on I2C
drivers/clk/Makefile +1 -0
index f537a0b..99f53d5 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_ARCH_NOMADIK)		+= clk-nomadik.o
 obj-$(CONFIG_ARCH_NSPIRE)		+= clk-nspire.o
 obj-$(CONFIG_COMMON_CLK_PALMAS)		+= clk-palmas.o
 obj-$(CONFIG_CLK_PPC_CORENET)		+= clk-ppc-corenet.o
+obj-$(CONFIG_COMMON_CLK_RK808)		+= clk-rk808.o
 obj-$(CONFIG_COMMON_CLK_S2MPS11)	+= clk-s2mps11.o
 obj-$(CONFIG_COMMON_CLK_SI5351)		+= clk-si5351.o
 obj-$(CONFIG_COMMON_CLK_SI570)		+= clk-si570.o
drivers/clk/clk-rk808.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#7 lore raw

Re: [PATCH v9 2/3] clk: RK808: Add clkout driver for RK808

Hi Chris,

drivers/clk/clk-rk808.c line 157

Quoted 13 lines · Chris Zhong
drivers/clk/clk-rk808.c new file +13 -0
+	rk808_clkout->clk_data.clks = clk_table;
+	rk808_clkout->clk_data.clk_num = RK808_NR_OUTPUT;
+
+	return of_clk_add_provider(node, of_clk_src_onecell_get,
+				   &rk808_clkout->clk_data);
+}
+
+static struct platform_driver rk808_clkout_driver = {
+	.probe = rk808_clkout_probe,
+	.driver		= {
+		.name	= "rk808-clkout",
+	},
+};

Shouldn't there also be:

static int rk808_clkout_probe(struct platform_device *pdev)

{
	of_clk_del_provider(pdev->dev.of_node);

	/* The rest of resources are managed ones */

	return 0;
}

Thanks.

Signature · 5 lines
Dmitry
--
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
#8 lore raw

Re: [PATCH v9 2/3] clk: RK808: Add clkout driver for RK808

Am Donnerstag, 4. September 2014, 10:40:24 schrieb Dmitry Torokhov:

Quoted 19 lines

Hi Chris,

drivers/clk/clk-rk808.c line 157

Quoted 13 lines · Chris Zhong
drivers/clk/clk-rk808.c new file +13 -0
+	rk808_clkout->clk_data.clks = clk_table;
+	rk808_clkout->clk_data.clk_num = RK808_NR_OUTPUT;
+
+	return of_clk_add_provider(node, of_clk_src_onecell_get,
+				   &rk808_clkout->clk_data);
+}
+
+static struct platform_driver rk808_clkout_driver = {
+	.probe = rk808_clkout_probe,
+	.driver		= {
+		.name	= "rk808-clkout",
+	},
+};

Shouldn't there also be:

Quoted 1 line

static int rk808_clkout_probe(struct platform_device *pdev)

^^ remove

Just to prevent confusion. And you're right there of course.

Heiko

Quoted 9 lines
{
	of_clk_del_provider(pdev->dev.of_node);

	/* The rest of resources are managed ones */

	return 0;
}

Thanks.

#9 lore raw

Re: [PATCH v9 2/3] clk: RK808: Add clkout driver for RK808

Quoted 20 lines · Heiko Stübner

Am Donnerstag, 4. September 2014, 10:40:24 schrieb Dmitry Torokhov:

Quoted 19 lines

Hi Chris,

drivers/clk/clk-rk808.c line 157

Quoted 13 lines · Chris Zhong
drivers/clk/clk-rk808.c new file +13 -0
+	rk808_clkout->clk_data.clks = clk_table;
+	rk808_clkout->clk_data.clk_num = RK808_NR_OUTPUT;
+
+	return of_clk_add_provider(node, of_clk_src_onecell_get,
+				   &rk808_clkout->clk_data);
+}
+
+static struct platform_driver rk808_clkout_driver = {
+	.probe = rk808_clkout_probe,
+	.driver		= {
+		.name	= "rk808-clkout",
+	},
+};

Shouldn't there also be:

Quoted 4 lines
Quoted 1 line

static int rk808_clkout_probe(struct platform_device *pdev)

^^ remove

Just to prevent confusion. And you're right there of course.

Ah, yes, stupid cut-and-paste...

Signature · 5 lines
Dmitry
--
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
#10 lore raw

Re: [PATCH v9 2/3] clk: RK808: Add clkout driver for RK808

In reply to Chris Zhong

Quoting Chris Zhong (2014-09-03 18:12:38)

Quoted 5 lines
drivers/clk/clk-rk808.c new file +5 -0
+static int rk808_clkout1_is_prepared(struct clk_hw *hw)
+{
+       return 1;
+}
+

<snip>

drivers/clk/clk-rk808.c line 86

Quoted 4 lines
drivers/clk/clk-rk808.c new file +4 -0
+static const struct clk_ops rk808_clkout1_ops = {
+       .is_prepared = rk808_clkout1_is_prepared,
+       .recalc_rate = rk808_clkout_recalc_rate,
+};

Hi Chris,

I do not see a need clkout1 to have a .is_prepared callback. You should be fine only having a .recalc_rate.

Regards,
Mike
--
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

#11 lore raw

PATCH v9 3/3 regulator: RK808: Remove pdata from the regulator

In reply to Chris Zhong

---

Changes in v9:
Adviced by Doug
- add reg_np

Changes in v8:
Adviced by Doug
- remove rk808_regulator_dts() function
- remove the check about "client->dev.of_node"

Changes in v7:
- remove pdata struct from header file, add rk808_regulator struct

Changes in v6:
- remove the redundant code

Changes in v5:
- re-edit base on Mark's branch

Changes in v4:
- use &client->dev replace rk808->dev

Changes in v3: None
Changes in v2:
Adviced by Mark Browm:
- change of_find_node_by_name to find_child_by_name
- use RK808_NUM_REGULATORS as the name of the constant
- create a pdata when missing platform data
- use the rk808_reg name to supply_regulator name
- replace regulator_register with devm_regulator_register
- some other problem with coding style

 drivers/regulator/rk808-regulator.c |   91 +++++++----------------------------
 1 file changed, 18 insertions(+), 73 deletions(-)
drivers/regulator/rk808-regulator.c +18 -73
index e372008..0d5afc4 100644
@@ -3,8 +3,8 @@
  *
  * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
  *
- * Author: Chris Zhong <[email protected]>
- * Author: Zhang Qing <[email protected]>
+ * Author: Chris Zhong<[email protected]>
+ * Author: Zhang Qing<[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -14,24 +14,16 @@
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
- *
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
-#include <linux/err.h>
-#include <linux/platform_device.h>
 #include <linux/mfd/rk808.h>
-#include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/of_regulator.h>
-#include <linux/regmap.h>
-#include <linux/slab.h>
-/*
- * Field Definitions.
- */
+
+/* Field Definitions */
 #define RK808_BUCK_VSEL_MASK	0x3f
 #define RK808_BUCK4_VSEL_MASK	0xf
 #define RK808_LDO_VSEL_MASK	0x1f
@@ -50,10 +42,6 @@ static const int buck_contr_base_addr[] = {
 	RK808_BUCK4_CONFIG_REG,
 };
 
-#define rk808_BUCK_SET_VOL_REG(x) (buck_set_vol_base_addr[x])
-#define rk808_BUCK_CONTR_REG(x) (buck_contr_base_addr[x])
-#define rk808_LDO_SET_VOL_REG(x) (ldo_set_vol_base_addr[x])
-
 static const int ldo_set_vol_base_addr[] = {
 	RK808_LDO1_ON_VSEL_REG,
 	RK808_LDO2_ON_VSEL_REG,
@@ -65,9 +53,7 @@ static const int ldo_set_vol_base_addr[] = {
 	RK808_LDO8_ON_VSEL_REG,
 };
 
-/*
- * rk808 voltage number
- */
+/* rk808 voltage number */
 static const struct regulator_linear_range rk808_buck_voltage_ranges[] = {
 	REGULATOR_LINEAR_RANGE(700000, 0, 63, 12500),
 };
@@ -308,77 +294,35 @@ static struct of_regulator_match rk808_reg_matches[] = {
 	[RK808_ID_SWITCH2]	= { .name = "SWITCH_REG2" },
 };
 
-static int rk808_regulator_dts(struct i2c_client *client,
-			       struct rk808_board *pdata)
-{
-	struct device_node *np, *reg_np;
-	int i, ret;
-
-	np = client->dev.of_node;
-	if (!np) {
-		dev_err(&client->dev, "could not find pmic sub-node\n");
-		return -ENXIO;
-	}
-
-	reg_np = of_get_child_by_name(np, "regulators");
-	if (!reg_np)
-		return -ENXIO;
-
-	ret = of_regulator_match(&client->dev, reg_np, rk808_reg_matches,
-				 RK808_NUM_REGULATORS);
-	if (ret < 0) {
-		dev_err(&client->dev,
-			"failed to parse regulator data: %d\n", ret);
-		return ret;
-	}
-
-	for (i = 0; i < RK808_NUM_REGULATORS; i++) {
-		if (!rk808_reg_matches[i].init_data ||
-		    !rk808_reg_matches[i].of_node)
-			continue;
-
-		pdata->rk808_init_data[i] = rk808_reg_matches[i].init_data;
-		pdata->of_node[i] = rk808_reg_matches[i].of_node;
-	}
-
-	return 0;
-}
-
 static int rk808_regulator_probe(struct platform_device *pdev)
 {
 	struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
 	struct i2c_client *client = rk808->i2c;
-	struct rk808_board *pdata = dev_get_platdata(&client->dev);
+	struct device_node *reg_np;
 	struct regulator_config config = {};
 	struct regulator_dev *rk808_rdev;
-	struct regulator_init_data *reg_data;
-	int i = 0;
-	int ret = 0;
+	int ret, i;
 
-	if (!pdata) {
-		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
-		if (!pdata)
-			return -ENOMEM;
-	}
+	reg_np = of_get_child_by_name(client->dev.of_node, "regulators");
+	if (!reg_np)
+		return -ENXIO;
 
-	ret = rk808_regulator_dts(client, pdata);
-	if (ret)
+	ret = of_regulator_match(&client->dev, reg_np, rk808_reg_matches,
+				 RK808_NUM_REGULATORS);
+	if (ret < 0)
 		return ret;
 
 	/* Instantiate the regulators */
 	for (i = 0; i < RK808_NUM_REGULATORS; i++) {
-		reg_data = pdata->rk808_init_data[i];
-		if (!reg_data)
+		if (!rk808_reg_matches[i].init_data ||
+		    !rk808_reg_matches[i].of_node)
 			continue;
 
 		config.dev = &client->dev;
 		config.driver_data = rk808;
 		config.regmap = rk808->regmap;
-
-		if (client->dev.of_node)
-			config.of_node = pdata->of_node[i];
-
-		config.init_data = reg_data;
+		config.of_node = rk808_reg_matches[i].of_node;
+		config.init_data = rk808_reg_matches[i].init_data;
 
 		rk808_rdev = devm_regulator_register(&pdev->dev,
 						     &rk808_reg[i], &config);
@@ -388,6 +332,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
 			return PTR_ERR(rk808_rdev);
 		}
 	}
+
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
Reviewed-by Tested-by on v9 3/3
#12 lore raw

Re: [PATCH v9 3/3] regulator: RK808: Remove pdata from the regulator

Chris,

Quoted 36 lines · Chris Zhong

---

Changes in v9:
Adviced by Doug
- add reg_np

Changes in v8:
Adviced by Doug
- remove rk808_regulator_dts() function
- remove the check about "client->dev.of_node"

Changes in v7:
- remove pdata struct from header file, add rk808_regulator struct

Changes in v6:
- remove the redundant code

Changes in v5:
- re-edit base on Mark's branch

Changes in v4:
- use &client->dev replace rk808->dev

Changes in v3: None
Changes in v2:
Adviced by Mark Browm:
- change of_find_node_by_name to find_child_by_name
- use RK808_NUM_REGULATORS as the name of the constant
- create a pdata when missing platform data
- use the rk808_reg name to supply_regulator name
- replace regulator_register with devm_regulator_register
- some other problem with coding style

Quoted 2 lines
 drivers/regulator/rk808-regulator.c |   91 +++++++----------------------------
 1 file changed, 18 insertions(+), 73 deletions(-)

--
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

#13 lore raw

Re: [PATCH v9 3/3] regulator: RK808: Remove pdata from the regulator

In reply to Chris Zhong

Hi,

Quoted 4 lines · Chris Zhong

- * Author: Chris Zhong <[email protected]>
- * Author: Zhang Qing <[email protected]>
+ * Author: Chris Zhong<[email protected]>
+ * Author: Zhang Qing<[email protected]>

As Dmitry pointed out, you probably shouldn't have changed these lines--they were good like they were.

-Doug
--
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

#14 lore raw
In reply to Chris Zhong

Hi Chris,

Am Donnerstag, 4. September 2014, 09:12:36 schrieb Chris Zhong:

Quoted 8 lines

This is the initial version of the RK808 PMIC. This is a power management IC for multimedia products.

It provides regulators that are able to supply power to processor cores and other components. The chip provides other modules including RTC, Clockout

Quoted 4 lines

Chris Zhong (3):
RTC: RK808: add RTC driver for RK808
clk: RK808: Add clkout driver for RK808
regulator: RK808: Remove pdata from the regulator

It looks like the rk808 driver that is currently in the regulator tree [0] is producing compile errors. After applying your regulator patch from this series it again compiles - and works.

So could you try to fast track this please? If you're short on time you could also just fix the small comment you received for patch3 and send it alone without the first two.

Heiko

[0]
https://git.kernel.org/cgit/linux/kernel/git/broonie/regulator.git/log/?h=topic/rk808