All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/7] rk808: Add RK805 support
@ 2017-03-17  7:06 Elaine Zhang
  2017-03-17  7:06   ` Elaine Zhang
                   ` (6 more replies)
  0 siblings, 7 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

change in v4:
PATCH V4 1/7: NO change in V4
PATCH V4 2/7: rename the commit message
PATCH V4 3/7: NO change in V4
PATCH V4 4/7: Split this patch up into subsystems patch 5/7 6/7
PATCH V4 5/7: new added
PATCH V4 6/7: new added
PATCH V4 7/7: NO change in V4


change in V3:
PATCH V3 1/5: NO change in V3
PATCH V3 2/5: add rk805 RTC INT MASK define
PATCH V3 3/5: RK805 set suspend enable and disable is different from rk808
              use rk805_regs_ops and rk805_switch_ops
PATCH V3 4/5: fix up the shutdown func
              use pm_shutdown_prepare_fn to prepare shutdown
              and pm_pwroff_fn pull down gpio to shut down rk805
              it will update in the future(after rk808 support gpio func)
PATCH V3 5/5: NO change in V3

change in V2:
PATCH V2 1/5: NO change in V2
PATCH V2 2/5: add rk805 BUCK ILMAX define
PATCH V2 3/5: NO change in V2
PATCH V2 4/5: setting RK805 BUCK ILMAX in pre init
PATCH V2 5/5: Add RK805 device tree bindings document

Elaine Zhang (7):
  mfd: rk808: fix up the chip id get failed
  mfd: rk808: add rk805 regs addr and ID
  regulator: rk808: Add regulator driver for RK805
  mfd: rk808: Add RK805 support
  clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808
  rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808
  mfd: dt-bindings: Add RK805 device tree bindings document

 Documentation/devicetree/bindings/mfd/rk808.txt |  20 +++-
 drivers/clk/Kconfig                             |   4 +-
 drivers/mfd/Kconfig                             |   4 +-
 drivers/mfd/rk808.c                             | 143 +++++++++++++++++++++++-
 drivers/regulator/Kconfig                       |   4 +-
 drivers/regulator/rk808-regulator.c             | 130 +++++++++++++++++++++
 drivers/rtc/Kconfig                             |   4 +-
 include/linux/mfd/rk808.h                       | 120 ++++++++++++++++++++
 8 files changed, 414 insertions(+), 15 deletions(-)

-- 
1.9.1

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

* [PATCH v4 1/7] mfd: rk808: fix up the chip id get failed
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

the rk8xx chip id is:
((MSB << 8) | LSB) & 0xfff0

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/mfd/rk808.c       | 21 +++++++++++++++------
 include/linux/mfd/rk808.h |  1 +
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index fd087cbb0bde..3334a2a7f3fb 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client,
 	void (*pm_pwroff_fn)(void);
 	int nr_pre_init_regs;
 	int nr_cells;
-	int pm_off = 0;
+	int pm_off = 0, msb, lsb;
 	int ret;
 	int i;
 
@@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client,
 	if (!rk808)
 		return -ENOMEM;
 
-	rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB);
-	if (rk808->variant < 0) {
-		dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n",
+	/* read Chip variant */
+	msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
+	if (msb < 0) {
+		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
 			RK808_ID_MSB);
-		return rk808->variant;
+		return msb;
 	}
 
-	dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
+	lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
+	if (lsb < 0) {
+		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
+			RK808_ID_LSB);
+		return lsb;
+	}
+
+	rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
+	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
 
 	switch (rk808->variant) {
 	case RK808_ID:
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 83701ef7d3c7..54feb140c210 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -298,6 +298,7 @@ enum rk818_reg {
 #define VOUT_LO_INT	BIT(0)
 #define CLK32KOUT2_EN	BIT(0)
 
+#define RK8XX_ID_MSK			0xfff0
 enum {
 	BUCK_ILMIN_50MA,
 	BUCK_ILMIN_100MA,
-- 
1.9.1

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

* [PATCH v4 1/7] mfd: rk808: fix up the chip id get failed
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, xxx-TNX95d0MmH7DzftRWevZcw,
	Elaine Zhang, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, w.egorov-guT5V/WYfQezQB+pC5nmwQ,
	chenjh-TNX95d0MmH7DzftRWevZcw

the rk8xx chip id is:
((MSB << 8) | LSB) & 0xfff0

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 drivers/mfd/rk808.c       | 21 +++++++++++++++------
 include/linux/mfd/rk808.h |  1 +
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index fd087cbb0bde..3334a2a7f3fb 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client,
 	void (*pm_pwroff_fn)(void);
 	int nr_pre_init_regs;
 	int nr_cells;
-	int pm_off = 0;
+	int pm_off = 0, msb, lsb;
 	int ret;
 	int i;
 
@@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client,
 	if (!rk808)
 		return -ENOMEM;
 
-	rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB);
-	if (rk808->variant < 0) {
-		dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n",
+	/* read Chip variant */
+	msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
+	if (msb < 0) {
+		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
 			RK808_ID_MSB);
-		return rk808->variant;
+		return msb;
 	}
 
-	dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
+	lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
+	if (lsb < 0) {
+		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
+			RK808_ID_LSB);
+		return lsb;
+	}
+
+	rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
+	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
 
 	switch (rk808->variant) {
 	case RK808_ID:
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 83701ef7d3c7..54feb140c210 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -298,6 +298,7 @@ enum rk818_reg {
 #define VOUT_LO_INT	BIT(0)
 #define CLK32KOUT2_EN	BIT(0)
 
+#define RK8XX_ID_MSK			0xfff0
 enum {
 	BUCK_ILMIN_50MA,
 	BUCK_ILMIN_100MA,
-- 
1.9.1

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

* [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 include/linux/mfd/rk808.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)

diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 54feb140c210..a133309b52f9 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -206,6 +206,96 @@ enum rk818_reg {
 #define RK818_USB_ILMIN_2000MA		0x7
 #define RK818_USB_CHG_SD_VSEL_MASK	0x70
 
+/* RK805 */
+enum rk805_reg {
+	RK805_ID_DCDC1,
+	RK805_ID_DCDC2,
+	RK805_ID_DCDC3,
+	RK805_ID_DCDC4,
+	RK805_ID_LDO1,
+	RK805_ID_LDO2,
+	RK805_ID_LDO3,
+};
+
+/* INTERRUPT REGISTER */
+#define RK805_INT_STS_REG		0x4C
+#define RK805_INT_STS_MSK_REG		0x4D
+#define RK805_GPIO_IO_POL_REG		0x50
+#define RK805_OUT_REG			0x52
+#define RK805_ON_SOURCE_REG		0xAE
+#define RK805_OFF_SOURCE_REG		0xAF
+
+/* POWER CHANNELS ENABLE REGISTER */
+#define RK805_DCDC_EN_REG		0x23
+#define RK805_SLP_DCDC_EN_REG		0x25
+#define RK805_SLP_LDO_EN_REG		0x26
+#define RK805_LDO_EN_REG		0x27
+
+/* CONFIG REGISTER */
+#define RK805_THERMAL_REG		0x22
+
+/* BUCK AND LDO CONFIG REGISTER */
+#define RK805_BUCK_LDO_SLP_LP_EN_REG	0x2A
+#define RK805_BUCK1_CONFIG_REG		0x2E
+#define RK805_BUCK1_ON_VSEL_REG		0x2F
+#define RK805_BUCK1_SLP_VSEL_REG	0x30
+#define RK805_BUCK2_CONFIG_REG		0x32
+#define RK805_BUCK2_ON_VSEL_REG		0x33
+#define RK805_BUCK2_SLP_VSEL_REG	0x34
+#define RK805_BUCK3_CONFIG_REG		0x36
+#define RK805_BUCK4_CONFIG_REG		0x37
+#define RK805_BUCK4_ON_VSEL_REG		0x38
+#define RK805_BUCK4_SLP_VSEL_REG	0x39
+#define RK805_LDO1_ON_VSEL_REG		0x3B
+#define RK805_LDO1_SLP_VSEL_REG		0x3C
+#define RK805_LDO2_ON_VSEL_REG		0x3D
+#define RK805_LDO2_SLP_VSEL_REG		0x3E
+#define RK805_LDO3_ON_VSEL_REG		0x3F
+#define RK805_LDO3_SLP_VSEL_REG		0x40
+#define RK805_OUT_REG			0x52
+#define RK805_ON_SOURCE_REG		0xAE
+#define RK805_OFF_SOURCE_REG		0xAF
+
+#define RK805_NUM_REGULATORS		7
+
+#define RK805_PWRON_FALL_RISE_INT_EN	0x0
+#define RK805_PWRON_FALL_RISE_INT_MSK	0x81
+
+/* RK805 IRQ Definitions */
+#define RK805_IRQ_PWRON_RISE		0
+#define RK805_IRQ_VB_LOW		1
+#define RK805_IRQ_PWRON			2
+#define RK805_IRQ_PWRON_LP		3
+#define RK805_IRQ_HOTDIE		4
+#define RK805_IRQ_RTC_ALARM		5
+#define RK805_IRQ_RTC_PERIOD		6
+#define RK805_IRQ_PWRON_FALL		7
+
+#define RK805_IRQ_PWRON_RISE_MSK	BIT(0)
+#define RK805_IRQ_VB_LOW_MSK		BIT(1)
+#define RK805_IRQ_PWRON_MSK		BIT(2)
+#define RK805_IRQ_PWRON_LP_MSK		BIT(3)
+#define RK805_IRQ_HOTDIE_MSK		BIT(4)
+#define RK805_IRQ_RTC_ALARM_MSK		BIT(5)
+#define RK805_IRQ_RTC_PERIOD_MSK	BIT(6)
+#define RK805_IRQ_PWRON_FALL_MSK	BIT(7)
+
+#define RK805_PWR_RISE_INT_STATUS	BIT(0)
+#define RK805_VB_LOW_INT_STATUS		BIT(1)
+#define RK805_PWRON_INT_STATUS		BIT(2)
+#define RK805_PWRON_LP_INT_STATUS	BIT(3)
+#define RK805_HOTDIE_INT_STATUS		BIT(4)
+#define RK805_ALARM_INT_STATUS		BIT(5)
+#define RK805_PERIOD_INT_STATUS		BIT(6)
+#define RK805_PWR_FALL_INT_STATUS	BIT(7)
+
+#define RK805_BUCK1_2_ILMAX_MASK	(3 << 6)
+#define RK805_BUCK3_4_ILMAX_MASK        (3 << 3)
+#define RK805_RTC_PERIOD_INT_MASK	(1 << 6)
+#define RK805_RTC_ALARM_INT_MASK	(1 << 5)
+#define RK805_INT_ALARM_EN		(1 << 3)
+#define RK805_INT_TIMER_EN		(1 << 2)
+
 /* RK808 IRQ Definitions */
 #define RK808_IRQ_VOUT_LO	0
 #define RK808_IRQ_VB_LO		1
@@ -298,7 +388,14 @@ enum rk818_reg {
 #define VOUT_LO_INT	BIT(0)
 #define CLK32KOUT2_EN	BIT(0)
 
+#define TEMP115C			0x0c
+#define TEMP_HOTDIE_MSK			0x0c
+#define SLP_SD_MSK			(0x3 << 2)
+#define SHUTDOWN_FUN			(0x2 << 2)
+#define SLEEP_FUN			(0x1 << 2)
 #define RK8XX_ID_MSK			0xfff0
+#define FPWM_MODE			BIT(7)
+
 enum {
 	BUCK_ILMIN_50MA,
 	BUCK_ILMIN_100MA,
@@ -322,6 +419,28 @@ enum {
 };
 
 enum {
+	RK805_BUCK1_2_ILMAX_2500MA,
+	RK805_BUCK1_2_ILMAX_3000MA,
+	RK805_BUCK1_2_ILMAX_3500MA,
+	RK805_BUCK1_2_ILMAX_4000MA,
+};
+
+enum {
+	RK805_BUCK3_ILMAX_1500MA,
+	RK805_BUCK3_ILMAX_2000MA,
+	RK805_BUCK3_ILMAX_2500MA,
+	RK805_BUCK3_ILMAX_3000MA,
+};
+
+enum {
+	RK805_BUCK4_ILMAX_2000MA,
+	RK805_BUCK4_ILMAX_2500MA,
+	RK805_BUCK4_ILMAX_3000MA,
+	RK805_BUCK4_ILMAX_3500MA,
+};
+
+enum {
+	RK805_ID = 0x8050,
 	RK808_ID = 0x0000,
 	RK818_ID = 0x8181,
 };
-- 
1.9.1

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

* [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, xxx-TNX95d0MmH7DzftRWevZcw,
	Elaine Zhang, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, w.egorov-guT5V/WYfQezQB+pC5nmwQ,
	chenjh-TNX95d0MmH7DzftRWevZcw

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 include/linux/mfd/rk808.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)

diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 54feb140c210..a133309b52f9 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -206,6 +206,96 @@ enum rk818_reg {
 #define RK818_USB_ILMIN_2000MA		0x7
 #define RK818_USB_CHG_SD_VSEL_MASK	0x70
 
+/* RK805 */
+enum rk805_reg {
+	RK805_ID_DCDC1,
+	RK805_ID_DCDC2,
+	RK805_ID_DCDC3,
+	RK805_ID_DCDC4,
+	RK805_ID_LDO1,
+	RK805_ID_LDO2,
+	RK805_ID_LDO3,
+};
+
+/* INTERRUPT REGISTER */
+#define RK805_INT_STS_REG		0x4C
+#define RK805_INT_STS_MSK_REG		0x4D
+#define RK805_GPIO_IO_POL_REG		0x50
+#define RK805_OUT_REG			0x52
+#define RK805_ON_SOURCE_REG		0xAE
+#define RK805_OFF_SOURCE_REG		0xAF
+
+/* POWER CHANNELS ENABLE REGISTER */
+#define RK805_DCDC_EN_REG		0x23
+#define RK805_SLP_DCDC_EN_REG		0x25
+#define RK805_SLP_LDO_EN_REG		0x26
+#define RK805_LDO_EN_REG		0x27
+
+/* CONFIG REGISTER */
+#define RK805_THERMAL_REG		0x22
+
+/* BUCK AND LDO CONFIG REGISTER */
+#define RK805_BUCK_LDO_SLP_LP_EN_REG	0x2A
+#define RK805_BUCK1_CONFIG_REG		0x2E
+#define RK805_BUCK1_ON_VSEL_REG		0x2F
+#define RK805_BUCK1_SLP_VSEL_REG	0x30
+#define RK805_BUCK2_CONFIG_REG		0x32
+#define RK805_BUCK2_ON_VSEL_REG		0x33
+#define RK805_BUCK2_SLP_VSEL_REG	0x34
+#define RK805_BUCK3_CONFIG_REG		0x36
+#define RK805_BUCK4_CONFIG_REG		0x37
+#define RK805_BUCK4_ON_VSEL_REG		0x38
+#define RK805_BUCK4_SLP_VSEL_REG	0x39
+#define RK805_LDO1_ON_VSEL_REG		0x3B
+#define RK805_LDO1_SLP_VSEL_REG		0x3C
+#define RK805_LDO2_ON_VSEL_REG		0x3D
+#define RK805_LDO2_SLP_VSEL_REG		0x3E
+#define RK805_LDO3_ON_VSEL_REG		0x3F
+#define RK805_LDO3_SLP_VSEL_REG		0x40
+#define RK805_OUT_REG			0x52
+#define RK805_ON_SOURCE_REG		0xAE
+#define RK805_OFF_SOURCE_REG		0xAF
+
+#define RK805_NUM_REGULATORS		7
+
+#define RK805_PWRON_FALL_RISE_INT_EN	0x0
+#define RK805_PWRON_FALL_RISE_INT_MSK	0x81
+
+/* RK805 IRQ Definitions */
+#define RK805_IRQ_PWRON_RISE		0
+#define RK805_IRQ_VB_LOW		1
+#define RK805_IRQ_PWRON			2
+#define RK805_IRQ_PWRON_LP		3
+#define RK805_IRQ_HOTDIE		4
+#define RK805_IRQ_RTC_ALARM		5
+#define RK805_IRQ_RTC_PERIOD		6
+#define RK805_IRQ_PWRON_FALL		7
+
+#define RK805_IRQ_PWRON_RISE_MSK	BIT(0)
+#define RK805_IRQ_VB_LOW_MSK		BIT(1)
+#define RK805_IRQ_PWRON_MSK		BIT(2)
+#define RK805_IRQ_PWRON_LP_MSK		BIT(3)
+#define RK805_IRQ_HOTDIE_MSK		BIT(4)
+#define RK805_IRQ_RTC_ALARM_MSK		BIT(5)
+#define RK805_IRQ_RTC_PERIOD_MSK	BIT(6)
+#define RK805_IRQ_PWRON_FALL_MSK	BIT(7)
+
+#define RK805_PWR_RISE_INT_STATUS	BIT(0)
+#define RK805_VB_LOW_INT_STATUS		BIT(1)
+#define RK805_PWRON_INT_STATUS		BIT(2)
+#define RK805_PWRON_LP_INT_STATUS	BIT(3)
+#define RK805_HOTDIE_INT_STATUS		BIT(4)
+#define RK805_ALARM_INT_STATUS		BIT(5)
+#define RK805_PERIOD_INT_STATUS		BIT(6)
+#define RK805_PWR_FALL_INT_STATUS	BIT(7)
+
+#define RK805_BUCK1_2_ILMAX_MASK	(3 << 6)
+#define RK805_BUCK3_4_ILMAX_MASK        (3 << 3)
+#define RK805_RTC_PERIOD_INT_MASK	(1 << 6)
+#define RK805_RTC_ALARM_INT_MASK	(1 << 5)
+#define RK805_INT_ALARM_EN		(1 << 3)
+#define RK805_INT_TIMER_EN		(1 << 2)
+
 /* RK808 IRQ Definitions */
 #define RK808_IRQ_VOUT_LO	0
 #define RK808_IRQ_VB_LO		1
@@ -298,7 +388,14 @@ enum rk818_reg {
 #define VOUT_LO_INT	BIT(0)
 #define CLK32KOUT2_EN	BIT(0)
 
+#define TEMP115C			0x0c
+#define TEMP_HOTDIE_MSK			0x0c
+#define SLP_SD_MSK			(0x3 << 2)
+#define SHUTDOWN_FUN			(0x2 << 2)
+#define SLEEP_FUN			(0x1 << 2)
 #define RK8XX_ID_MSK			0xfff0
+#define FPWM_MODE			BIT(7)
+
 enum {
 	BUCK_ILMIN_50MA,
 	BUCK_ILMIN_100MA,
@@ -322,6 +419,28 @@ enum {
 };
 
 enum {
+	RK805_BUCK1_2_ILMAX_2500MA,
+	RK805_BUCK1_2_ILMAX_3000MA,
+	RK805_BUCK1_2_ILMAX_3500MA,
+	RK805_BUCK1_2_ILMAX_4000MA,
+};
+
+enum {
+	RK805_BUCK3_ILMAX_1500MA,
+	RK805_BUCK3_ILMAX_2000MA,
+	RK805_BUCK3_ILMAX_2500MA,
+	RK805_BUCK3_ILMAX_3000MA,
+};
+
+enum {
+	RK805_BUCK4_ILMAX_2000MA,
+	RK805_BUCK4_ILMAX_2500MA,
+	RK805_BUCK4_ILMAX_3000MA,
+	RK805_BUCK4_ILMAX_3500MA,
+};
+
+enum {
+	RK805_ID = 0x8050,
 	RK808_ID = 0x0000,
 	RK818_ID = 0x8181,
 };
-- 
1.9.1

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

* [PATCH v4 3/7] regulator: rk808: Add regulator driver for RK805
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

Add support for the rk805 regulator. The regulator module consists
of 4 DCDCs, 3 LDOs.

The output voltages are configurable and are meant to supply power
to the main processor and other components.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/regulator/Kconfig           |   4 +-
 drivers/regulator/rk808-regulator.c | 130 ++++++++++++++++++++++++++++++++++++
 2 files changed, 132 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index be06eb29c681..285e28051219 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -650,11 +650,11 @@ config REGULATOR_RC5T583
 	  outputs which can be controlled by i2c communication.
 
 config REGULATOR_RK808
-	tristate "Rockchip RK808/RK818 Power regulators"
+	tristate "Rockchip RK805/RK808/RK818 Power regulators"
 	depends on MFD_RK808
 	help
 	  Select this option to enable the power regulator of ROCKCHIP
-	  PMIC RK808 and RK818.
+	  PMIC RK805,RK808 and RK818.
 	  This driver supports the control of different power rails of device
 	  through regulator interface. The device supports multiple DCDC/LDO
 	  outputs which can be controlled by i2c communication.
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index fb44d5215e30..128c81e19ee8 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -65,6 +65,27 @@
 /* max steps for increase voltage of Buck1/2, equal 100mv*/
 #define MAX_STEPS_ONE_TIME 8
 
+#define RK805_DESC(_id, _match, _supply, _min, _max, _step, _vreg,      \
+	_vmask, _ereg, _emask, _etime)                                  \
+	[_id] = {                                                       \
+		.name           = (_match),                             \
+		.supply_name    = (_supply),                            \
+		.of_match       = of_match_ptr(_match),                 \
+		.regulators_node = of_match_ptr("regulators"),          \
+		.type           = REGULATOR_VOLTAGE,                    \
+		.id             = (_id),                                \
+		.n_voltages     = (((_max) - (_min)) / (_step) + 1),    \
+		.owner          = THIS_MODULE,                          \
+		.min_uV         = (_min) * 1000,                        \
+		.uV_step        = (_step) * 1000,                       \
+		.vsel_reg       = (_vreg),                              \
+		.vsel_mask      = (_vmask),                             \
+		.enable_reg     = (_ereg),                              \
+		.enable_mask    = (_emask),                             \
+		.enable_time    = (_etime),                             \
+		.ops            = &rk805_reg_ops,                       \
+	}
+
 #define RK8XX_DESC(_id, _match, _supply, _min, _max, _step, _vreg,	\
 	_vmask, _ereg, _emask, _etime)					\
 	[_id] = {							\
@@ -298,6 +319,28 @@ static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
 				  sel);
 }
 
+static int rk805_set_suspend_enable(struct regulator_dev *rdev)
+{
+	unsigned int reg;
+
+	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
+
+	return regmap_update_bits(rdev->regmap, reg,
+				  rdev->desc->enable_mask,
+				  rdev->desc->enable_mask);
+}
+
+static int rk805_set_suspend_disable(struct regulator_dev *rdev)
+{
+	unsigned int reg;
+
+	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
+
+	return regmap_update_bits(rdev->regmap, reg,
+				  rdev->desc->enable_mask,
+				  0);
+}
+
 static int rk808_set_suspend_enable(struct regulator_dev *rdev)
 {
 	unsigned int reg;
@@ -320,6 +363,27 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
 				  rdev->desc->enable_mask);
 }
 
+static struct regulator_ops rk805_reg_ops = {
+		.list_voltage           = regulator_list_voltage_linear,
+		.map_voltage            = regulator_map_voltage_linear,
+		.get_voltage_sel        = regulator_get_voltage_sel_regmap,
+		.set_voltage_sel        = regulator_set_voltage_sel_regmap,
+		.enable                 = regulator_enable_regmap,
+		.disable                = regulator_disable_regmap,
+		.is_enabled             = regulator_is_enabled_regmap,
+		.set_suspend_voltage    = rk808_set_suspend_voltage,
+		.set_suspend_enable     = rk805_set_suspend_enable,
+		.set_suspend_disable    = rk805_set_suspend_disable,
+};
+
+static struct regulator_ops rk805_switch_ops = {
+		.enable                 = regulator_enable_regmap,
+		.disable                = regulator_disable_regmap,
+		.is_enabled             = regulator_is_enabled_regmap,
+		.set_suspend_enable     = rk805_set_suspend_enable,
+		.set_suspend_disable    = rk805_set_suspend_disable,
+};
+
 static struct regulator_ops rk808_buck1_2_ops = {
 	.list_voltage		= regulator_list_voltage_linear,
 	.map_voltage		= regulator_map_voltage_linear,
@@ -369,6 +433,68 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
 	.set_suspend_disable	= rk808_set_suspend_disable,
 };
 
+static const struct regulator_desc rk805_reg[] = {
+	{
+		.name = "DCDC_REG1",
+		.supply_name = "vcc1",
+		.of_match = of_match_ptr("DCDC_REG1"),
+		.regulators_node = of_match_ptr("regulators"),
+		.id = RK805_ID_DCDC1,
+		.ops = &rk805_reg_ops,
+		.type = REGULATOR_VOLTAGE,
+		.min_uV = 712500,
+		.uV_step = 12500,
+		.n_voltages = 64,
+		.vsel_reg = RK805_BUCK1_ON_VSEL_REG,
+		.vsel_mask = RK818_BUCK_VSEL_MASK,
+		.enable_reg = RK805_DCDC_EN_REG,
+		.enable_mask = BIT(0),
+		.owner = THIS_MODULE,
+	}, {
+		.name = "DCDC_REG2",
+		.supply_name = "vcc2",
+		.of_match = of_match_ptr("DCDC_REG2"),
+		.regulators_node = of_match_ptr("regulators"),
+		.id = RK805_ID_DCDC2,
+		.ops = &rk805_reg_ops,
+		.type = REGULATOR_VOLTAGE,
+		.min_uV = 712500,
+		.uV_step = 12500,
+		.n_voltages = 64,
+		.vsel_reg = RK805_BUCK2_ON_VSEL_REG,
+		.vsel_mask = RK818_BUCK_VSEL_MASK,
+		.enable_reg = RK805_DCDC_EN_REG,
+		.enable_mask = BIT(1),
+		.owner = THIS_MODULE,
+	}, {
+		.name = "DCDC_REG3",
+		.supply_name = "vcc3",
+		.of_match = of_match_ptr("DCDC_REG3"),
+		.regulators_node = of_match_ptr("regulators"),
+		.id = RK805_ID_DCDC3,
+		.ops = &rk805_switch_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 1,
+		.enable_reg = RK805_DCDC_EN_REG,
+		.enable_mask = BIT(2),
+		.owner = THIS_MODULE,
+	},
+
+	RK805_DESC(RK805_ID_DCDC4, "DCDC_REG4", "vcc4", 800, 3400, 100,
+		RK805_BUCK4_ON_VSEL_REG, RK818_BUCK4_VSEL_MASK,
+		RK805_DCDC_EN_REG, BIT(3), 0),
+
+	RK805_DESC(RK805_ID_LDO1, "LDO_REG1", "vcc5", 800, 3400, 100,
+		RK805_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
+		BIT(0), 400),
+	RK805_DESC(RK805_ID_LDO2, "LDO_REG2", "vcc5", 800, 3400, 100,
+		RK805_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
+		BIT(1), 400),
+	RK805_DESC(RK805_ID_LDO3, "LDO_REG3", "vcc6", 800, 3400, 100,
+		RK805_LDO3_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
+		BIT(2), 400),
+};
+
 static const struct regulator_desc rk808_reg[] = {
 	{
 		.name = "DCDC_REG1",
@@ -625,6 +751,10 @@ static int rk808_regulator_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, pdata);
 
 	switch (rk808->variant) {
+	case RK805_ID:
+		regulators = rk805_reg;
+		nregulators = RK805_NUM_REGULATORS;
+		break;
 	case RK808_ID:
 		regulators = rk808_reg;
 		nregulators = RK808_NUM_REGULATORS;
-- 
1.9.1

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

* [PATCH v4 3/7] regulator: rk808: Add regulator driver for RK805
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, xxx-TNX95d0MmH7DzftRWevZcw,
	Elaine Zhang, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, w.egorov-guT5V/WYfQezQB+pC5nmwQ,
	chenjh-TNX95d0MmH7DzftRWevZcw

Add support for the rk805 regulator. The regulator module consists
of 4 DCDCs, 3 LDOs.

The output voltages are configurable and are meant to supply power
to the main processor and other components.

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 drivers/regulator/Kconfig           |   4 +-
 drivers/regulator/rk808-regulator.c | 130 ++++++++++++++++++++++++++++++++++++
 2 files changed, 132 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index be06eb29c681..285e28051219 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -650,11 +650,11 @@ config REGULATOR_RC5T583
 	  outputs which can be controlled by i2c communication.
 
 config REGULATOR_RK808
-	tristate "Rockchip RK808/RK818 Power regulators"
+	tristate "Rockchip RK805/RK808/RK818 Power regulators"
 	depends on MFD_RK808
 	help
 	  Select this option to enable the power regulator of ROCKCHIP
-	  PMIC RK808 and RK818.
+	  PMIC RK805,RK808 and RK818.
 	  This driver supports the control of different power rails of device
 	  through regulator interface. The device supports multiple DCDC/LDO
 	  outputs which can be controlled by i2c communication.
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index fb44d5215e30..128c81e19ee8 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -65,6 +65,27 @@
 /* max steps for increase voltage of Buck1/2, equal 100mv*/
 #define MAX_STEPS_ONE_TIME 8
 
+#define RK805_DESC(_id, _match, _supply, _min, _max, _step, _vreg,      \
+	_vmask, _ereg, _emask, _etime)                                  \
+	[_id] = {                                                       \
+		.name           = (_match),                             \
+		.supply_name    = (_supply),                            \
+		.of_match       = of_match_ptr(_match),                 \
+		.regulators_node = of_match_ptr("regulators"),          \
+		.type           = REGULATOR_VOLTAGE,                    \
+		.id             = (_id),                                \
+		.n_voltages     = (((_max) - (_min)) / (_step) + 1),    \
+		.owner          = THIS_MODULE,                          \
+		.min_uV         = (_min) * 1000,                        \
+		.uV_step        = (_step) * 1000,                       \
+		.vsel_reg       = (_vreg),                              \
+		.vsel_mask      = (_vmask),                             \
+		.enable_reg     = (_ereg),                              \
+		.enable_mask    = (_emask),                             \
+		.enable_time    = (_etime),                             \
+		.ops            = &rk805_reg_ops,                       \
+	}
+
 #define RK8XX_DESC(_id, _match, _supply, _min, _max, _step, _vreg,	\
 	_vmask, _ereg, _emask, _etime)					\
 	[_id] = {							\
@@ -298,6 +319,28 @@ static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
 				  sel);
 }
 
+static int rk805_set_suspend_enable(struct regulator_dev *rdev)
+{
+	unsigned int reg;
+
+	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
+
+	return regmap_update_bits(rdev->regmap, reg,
+				  rdev->desc->enable_mask,
+				  rdev->desc->enable_mask);
+}
+
+static int rk805_set_suspend_disable(struct regulator_dev *rdev)
+{
+	unsigned int reg;
+
+	reg = rdev->desc->enable_reg + RK808_SLP_SET_OFF_REG_OFFSET;
+
+	return regmap_update_bits(rdev->regmap, reg,
+				  rdev->desc->enable_mask,
+				  0);
+}
+
 static int rk808_set_suspend_enable(struct regulator_dev *rdev)
 {
 	unsigned int reg;
@@ -320,6 +363,27 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
 				  rdev->desc->enable_mask);
 }
 
+static struct regulator_ops rk805_reg_ops = {
+		.list_voltage           = regulator_list_voltage_linear,
+		.map_voltage            = regulator_map_voltage_linear,
+		.get_voltage_sel        = regulator_get_voltage_sel_regmap,
+		.set_voltage_sel        = regulator_set_voltage_sel_regmap,
+		.enable                 = regulator_enable_regmap,
+		.disable                = regulator_disable_regmap,
+		.is_enabled             = regulator_is_enabled_regmap,
+		.set_suspend_voltage    = rk808_set_suspend_voltage,
+		.set_suspend_enable     = rk805_set_suspend_enable,
+		.set_suspend_disable    = rk805_set_suspend_disable,
+};
+
+static struct regulator_ops rk805_switch_ops = {
+		.enable                 = regulator_enable_regmap,
+		.disable                = regulator_disable_regmap,
+		.is_enabled             = regulator_is_enabled_regmap,
+		.set_suspend_enable     = rk805_set_suspend_enable,
+		.set_suspend_disable    = rk805_set_suspend_disable,
+};
+
 static struct regulator_ops rk808_buck1_2_ops = {
 	.list_voltage		= regulator_list_voltage_linear,
 	.map_voltage		= regulator_map_voltage_linear,
@@ -369,6 +433,68 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
 	.set_suspend_disable	= rk808_set_suspend_disable,
 };
 
+static const struct regulator_desc rk805_reg[] = {
+	{
+		.name = "DCDC_REG1",
+		.supply_name = "vcc1",
+		.of_match = of_match_ptr("DCDC_REG1"),
+		.regulators_node = of_match_ptr("regulators"),
+		.id = RK805_ID_DCDC1,
+		.ops = &rk805_reg_ops,
+		.type = REGULATOR_VOLTAGE,
+		.min_uV = 712500,
+		.uV_step = 12500,
+		.n_voltages = 64,
+		.vsel_reg = RK805_BUCK1_ON_VSEL_REG,
+		.vsel_mask = RK818_BUCK_VSEL_MASK,
+		.enable_reg = RK805_DCDC_EN_REG,
+		.enable_mask = BIT(0),
+		.owner = THIS_MODULE,
+	}, {
+		.name = "DCDC_REG2",
+		.supply_name = "vcc2",
+		.of_match = of_match_ptr("DCDC_REG2"),
+		.regulators_node = of_match_ptr("regulators"),
+		.id = RK805_ID_DCDC2,
+		.ops = &rk805_reg_ops,
+		.type = REGULATOR_VOLTAGE,
+		.min_uV = 712500,
+		.uV_step = 12500,
+		.n_voltages = 64,
+		.vsel_reg = RK805_BUCK2_ON_VSEL_REG,
+		.vsel_mask = RK818_BUCK_VSEL_MASK,
+		.enable_reg = RK805_DCDC_EN_REG,
+		.enable_mask = BIT(1),
+		.owner = THIS_MODULE,
+	}, {
+		.name = "DCDC_REG3",
+		.supply_name = "vcc3",
+		.of_match = of_match_ptr("DCDC_REG3"),
+		.regulators_node = of_match_ptr("regulators"),
+		.id = RK805_ID_DCDC3,
+		.ops = &rk805_switch_ops,
+		.type = REGULATOR_VOLTAGE,
+		.n_voltages = 1,
+		.enable_reg = RK805_DCDC_EN_REG,
+		.enable_mask = BIT(2),
+		.owner = THIS_MODULE,
+	},
+
+	RK805_DESC(RK805_ID_DCDC4, "DCDC_REG4", "vcc4", 800, 3400, 100,
+		RK805_BUCK4_ON_VSEL_REG, RK818_BUCK4_VSEL_MASK,
+		RK805_DCDC_EN_REG, BIT(3), 0),
+
+	RK805_DESC(RK805_ID_LDO1, "LDO_REG1", "vcc5", 800, 3400, 100,
+		RK805_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
+		BIT(0), 400),
+	RK805_DESC(RK805_ID_LDO2, "LDO_REG2", "vcc5", 800, 3400, 100,
+		RK805_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
+		BIT(1), 400),
+	RK805_DESC(RK805_ID_LDO3, "LDO_REG3", "vcc6", 800, 3400, 100,
+		RK805_LDO3_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK805_LDO_EN_REG,
+		BIT(2), 400),
+};
+
 static const struct regulator_desc rk808_reg[] = {
 	{
 		.name = "DCDC_REG1",
@@ -625,6 +751,10 @@ static int rk808_regulator_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, pdata);
 
 	switch (rk808->variant) {
+	case RK805_ID:
+		regulators = rk805_reg;
+		nregulators = RK805_NUM_REGULATORS;
+		break;
 	case RK808_ID:
 		regulators = rk808_reg;
 		nregulators = RK808_NUM_REGULATORS;
-- 
1.9.1

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

* [PATCH v4 4/7] mfd: rk808: Add RK805 support
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

The RK805 chip is a Power Management IC (PMIC) for multimedia and handheld
devices. It contains the following components:

    - Regulators
    - RTC
    - Clocking

Both RK808 and RK805 chips are using a similar register map,
so we can reuse the RTC and Clocking functionality.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/mfd/Kconfig |   4 +-
 drivers/mfd/rk808.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 55ecdfb74d31..b410a348b756 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -892,13 +892,13 @@ config MFD_RC5T583
 	  different functionality of the device.
 
 config MFD_RK808
-	tristate "Rockchip RK808/RK818 Power Management Chip"
+	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
 	depends on I2C && OF
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	help
-	  If you say yes here you get support for the RK808 and RK818
+	  If you say yes here you get support for the RK805, RK808 and RK818
 	  Power Management chips.
 	  This driver provides common support for accessing the device
 	  through I2C interface. The device supports multiple sub-devices
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 3334a2a7f3fb..fdd4449b14b0 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -70,6 +70,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	.volatile_reg = rk808_is_volatile_reg,
 };
 
+static const struct regmap_config rk805_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = RK805_OFF_SOURCE_REG,
+	.cache_type = REGCACHE_RBTREE,
+	.volatile_reg = rk808_is_volatile_reg,
+};
+
 static const struct regmap_config rk808_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
@@ -86,6 +94,16 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	}
 };
 
+static const struct mfd_cell rk805s[] = {
+	{ .name = "rk808-clkout", },
+	{ .name = "rk808-regulator", },
+	{
+		.name = "rk808-rtc",
+		.num_resources = ARRAY_SIZE(rtc_resources),
+		.resources = &rtc_resources[0],
+	},
+};
+
 static const struct mfd_cell rk808s[] = {
 	{ .name = "rk808-clkout", },
 	{ .name = "rk808-regulator", },
@@ -106,6 +124,20 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	},
 };
 
+static const struct rk808_reg_data rk805_pre_init_reg[] = {
+	{RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
+				 RK805_BUCK1_2_ILMAX_4000MA},
+	{RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
+				 RK805_BUCK1_2_ILMAX_4000MA},
+	{RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
+				 RK805_BUCK3_ILMAX_3000MA},
+	{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
+				 RK805_BUCK4_ILMAX_3500MA},
+	{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
+	{RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
+	{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
+};
+
 static const struct rk808_reg_data rk808_pre_init_reg[] = {
 	{ RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_150MA },
 	{ RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_200MA },
@@ -135,6 +167,41 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 						    VB_LO_SEL_3500MV },
 };
 
+static const struct regmap_irq rk805_irqs[] = {
+	[RK805_IRQ_PWRON_RISE] = {
+		.mask = RK805_IRQ_PWRON_RISE_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_VB_LOW] = {
+		.mask = RK805_IRQ_VB_LOW_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_PWRON] = {
+		.mask = RK805_IRQ_PWRON_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_PWRON_LP] = {
+		.mask = RK805_IRQ_PWRON_LP_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_HOTDIE] = {
+		.mask = RK805_IRQ_HOTDIE_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_RTC_ALARM] = {
+		.mask = RK805_IRQ_RTC_ALARM_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_RTC_PERIOD] = {
+		.mask = RK805_IRQ_RTC_PERIOD_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_PWRON_FALL] = {
+		.mask = RK805_IRQ_PWRON_FALL_MSK,
+		.reg_offset = 0,
+	},
+};
+
 static const struct regmap_irq rk808_irqs[] = {
 	/* INT_STS */
 	[RK808_IRQ_VOUT_LO] = {
@@ -247,6 +314,17 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	},
 };
 
+static struct regmap_irq_chip rk805_irq_chip = {
+	.name = "rk805",
+	.irqs = rk805_irqs,
+	.num_irqs = ARRAY_SIZE(rk805_irqs),
+	.num_regs = 1,
+	.status_base = RK805_INT_STS_REG,
+	.mask_base = RK805_INT_STS_MSK_REG,
+	.ack_base = RK805_INT_STS_REG,
+	.init_ack_masked = true,
+};
+
 static const struct regmap_irq_chip rk808_irq_chip = {
 	.name = "rk808",
 	.irqs = rk808_irqs,
@@ -272,6 +350,38 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 };
 
 static struct i2c_client *rk808_i2c_client;
+
+static void rk805_shutdown_prepare(void)
+{
+	int ret;
+	struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
+
+	if (!rk808) {
+		dev_warn(&rk808_i2c_client->dev,
+			 "have no rk808, so do nothing here\n");
+		return;
+	}
+
+	/* close rtc int when power off */
+	regmap_update_bits(rk808->regmap,
+			   RK808_INT_STS_MSK_REG1,
+			   RK805_RTC_PERIOD_INT_MASK |
+			   RK805_RTC_ALARM_INT_MASK,
+			   RK805_RTC_PERIOD_INT_MASK |
+			   RK805_RTC_ALARM_INT_MASK);
+	regmap_update_bits(rk808->regmap,
+			   RK808_RTC_INT_REG,
+			   RK805_INT_ALARM_EN | RK805_INT_TIMER_EN,
+			   0);
+
+	/* pmic sleep shutdown function */
+	ret = regmap_update_bits(rk808->regmap,
+				 RK805_GPIO_IO_POL_REG,
+				 SLP_SD_MSK, SHUTDOWN_FUN);
+	if (ret)
+		dev_err(&rk808_i2c_client->dev, "power off error!\n");
+}
+
 static void rk808_device_shutdown(void)
 {
 	int ret;
@@ -309,6 +419,7 @@ static void rk818_device_shutdown(void)
 }
 
 static const struct of_device_id rk808_of_match[] = {
+	{ .compatible = "rockchip,rk805" },
 	{ .compatible = "rockchip,rk808" },
 	{ .compatible = "rockchip,rk818" },
 	{ },
@@ -323,6 +434,7 @@ static int rk808_probe(struct i2c_client *client,
 	const struct rk808_reg_data *pre_init_reg;
 	const struct mfd_cell *cells;
 	void (*pm_pwroff_fn)(void);
+	void (*pm_shutdown_prepare_fn)(void);
 	int nr_pre_init_regs;
 	int nr_cells;
 	int pm_off = 0, msb, lsb;
@@ -352,6 +464,15 @@ static int rk808_probe(struct i2c_client *client,
 	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
 
 	switch (rk808->variant) {
+	case RK805_ID:
+		rk808->regmap_cfg = &rk805_regmap_config;
+		rk808->regmap_irq_chip = &rk805_irq_chip;
+		pre_init_reg = rk805_pre_init_reg;
+		nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
+		cells = rk805s;
+		nr_cells = ARRAY_SIZE(rk805s);
+		pm_shutdown_prepare_fn = rk805_shutdown_prepare;
+		break;
 	case RK808_ID:
 		rk808->regmap_cfg = &rk808_regmap_config;
 		rk808->regmap_irq_chip = &rk808_irq_chip;
@@ -444,6 +565,7 @@ static int rk808_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id rk808_ids[] = {
+	{ "rk805" },
 	{ "rk808" },
 	{ "rk818" },
 	{ },
-- 
1.9.1

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

* [PATCH v4 4/7] mfd: rk808: Add RK805 support
@ 2017-03-17  7:06   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:06 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ, Elaine Zhang

The RK805 chip is a Power Management IC (PMIC) for multimedia and handheld
devices. It contains the following components:

    - Regulators
    - RTC
    - Clocking

Both RK808 and RK805 chips are using a similar register map,
so we can reuse the RTC and Clocking functionality.

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 drivers/mfd/Kconfig |   4 +-
 drivers/mfd/rk808.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 55ecdfb74d31..b410a348b756 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -892,13 +892,13 @@ config MFD_RC5T583
 	  different functionality of the device.
 
 config MFD_RK808
-	tristate "Rockchip RK808/RK818 Power Management Chip"
+	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
 	depends on I2C && OF
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	help
-	  If you say yes here you get support for the RK808 and RK818
+	  If you say yes here you get support for the RK805, RK808 and RK818
 	  Power Management chips.
 	  This driver provides common support for accessing the device
 	  through I2C interface. The device supports multiple sub-devices
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 3334a2a7f3fb..fdd4449b14b0 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -70,6 +70,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	.volatile_reg = rk808_is_volatile_reg,
 };
 
+static const struct regmap_config rk805_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = RK805_OFF_SOURCE_REG,
+	.cache_type = REGCACHE_RBTREE,
+	.volatile_reg = rk808_is_volatile_reg,
+};
+
 static const struct regmap_config rk808_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
@@ -86,6 +94,16 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	}
 };
 
+static const struct mfd_cell rk805s[] = {
+	{ .name = "rk808-clkout", },
+	{ .name = "rk808-regulator", },
+	{
+		.name = "rk808-rtc",
+		.num_resources = ARRAY_SIZE(rtc_resources),
+		.resources = &rtc_resources[0],
+	},
+};
+
 static const struct mfd_cell rk808s[] = {
 	{ .name = "rk808-clkout", },
 	{ .name = "rk808-regulator", },
@@ -106,6 +124,20 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	},
 };
 
+static const struct rk808_reg_data rk805_pre_init_reg[] = {
+	{RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
+				 RK805_BUCK1_2_ILMAX_4000MA},
+	{RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
+				 RK805_BUCK1_2_ILMAX_4000MA},
+	{RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
+				 RK805_BUCK3_ILMAX_3000MA},
+	{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
+				 RK805_BUCK4_ILMAX_3500MA},
+	{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
+	{RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
+	{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
+};
+
 static const struct rk808_reg_data rk808_pre_init_reg[] = {
 	{ RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_150MA },
 	{ RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_200MA },
@@ -135,6 +167,41 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 						    VB_LO_SEL_3500MV },
 };
 
+static const struct regmap_irq rk805_irqs[] = {
+	[RK805_IRQ_PWRON_RISE] = {
+		.mask = RK805_IRQ_PWRON_RISE_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_VB_LOW] = {
+		.mask = RK805_IRQ_VB_LOW_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_PWRON] = {
+		.mask = RK805_IRQ_PWRON_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_PWRON_LP] = {
+		.mask = RK805_IRQ_PWRON_LP_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_HOTDIE] = {
+		.mask = RK805_IRQ_HOTDIE_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_RTC_ALARM] = {
+		.mask = RK805_IRQ_RTC_ALARM_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_RTC_PERIOD] = {
+		.mask = RK805_IRQ_RTC_PERIOD_MSK,
+		.reg_offset = 0,
+	},
+	[RK805_IRQ_PWRON_FALL] = {
+		.mask = RK805_IRQ_PWRON_FALL_MSK,
+		.reg_offset = 0,
+	},
+};
+
 static const struct regmap_irq rk808_irqs[] = {
 	/* INT_STS */
 	[RK808_IRQ_VOUT_LO] = {
@@ -247,6 +314,17 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 	},
 };
 
+static struct regmap_irq_chip rk805_irq_chip = {
+	.name = "rk805",
+	.irqs = rk805_irqs,
+	.num_irqs = ARRAY_SIZE(rk805_irqs),
+	.num_regs = 1,
+	.status_base = RK805_INT_STS_REG,
+	.mask_base = RK805_INT_STS_MSK_REG,
+	.ack_base = RK805_INT_STS_REG,
+	.init_ack_masked = true,
+};
+
 static const struct regmap_irq_chip rk808_irq_chip = {
 	.name = "rk808",
 	.irqs = rk808_irqs,
@@ -272,6 +350,38 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
 };
 
 static struct i2c_client *rk808_i2c_client;
+
+static void rk805_shutdown_prepare(void)
+{
+	int ret;
+	struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
+
+	if (!rk808) {
+		dev_warn(&rk808_i2c_client->dev,
+			 "have no rk808, so do nothing here\n");
+		return;
+	}
+
+	/* close rtc int when power off */
+	regmap_update_bits(rk808->regmap,
+			   RK808_INT_STS_MSK_REG1,
+			   RK805_RTC_PERIOD_INT_MASK |
+			   RK805_RTC_ALARM_INT_MASK,
+			   RK805_RTC_PERIOD_INT_MASK |
+			   RK805_RTC_ALARM_INT_MASK);
+	regmap_update_bits(rk808->regmap,
+			   RK808_RTC_INT_REG,
+			   RK805_INT_ALARM_EN | RK805_INT_TIMER_EN,
+			   0);
+
+	/* pmic sleep shutdown function */
+	ret = regmap_update_bits(rk808->regmap,
+				 RK805_GPIO_IO_POL_REG,
+				 SLP_SD_MSK, SHUTDOWN_FUN);
+	if (ret)
+		dev_err(&rk808_i2c_client->dev, "power off error!\n");
+}
+
 static void rk808_device_shutdown(void)
 {
 	int ret;
@@ -309,6 +419,7 @@ static void rk818_device_shutdown(void)
 }
 
 static const struct of_device_id rk808_of_match[] = {
+	{ .compatible = "rockchip,rk805" },
 	{ .compatible = "rockchip,rk808" },
 	{ .compatible = "rockchip,rk818" },
 	{ },
@@ -323,6 +434,7 @@ static int rk808_probe(struct i2c_client *client,
 	const struct rk808_reg_data *pre_init_reg;
 	const struct mfd_cell *cells;
 	void (*pm_pwroff_fn)(void);
+	void (*pm_shutdown_prepare_fn)(void);
 	int nr_pre_init_regs;
 	int nr_cells;
 	int pm_off = 0, msb, lsb;
@@ -352,6 +464,15 @@ static int rk808_probe(struct i2c_client *client,
 	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
 
 	switch (rk808->variant) {
+	case RK805_ID:
+		rk808->regmap_cfg = &rk805_regmap_config;
+		rk808->regmap_irq_chip = &rk805_irq_chip;
+		pre_init_reg = rk805_pre_init_reg;
+		nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
+		cells = rk805s;
+		nr_cells = ARRAY_SIZE(rk805s);
+		pm_shutdown_prepare_fn = rk805_shutdown_prepare;
+		break;
 	case RK808_ID:
 		rk808->regmap_cfg = &rk808_regmap_config;
 		rk808->regmap_irq_chip = &rk808_irq_chip;
@@ -444,6 +565,7 @@ static int rk808_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id rk808_ids[] = {
+	{ "rk805" },
 	{ "rk808" },
 	{ "rk818" },
 	{ },
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v4 5/7] clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808
@ 2017-03-17  7:08   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:08 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

The RK808 and RK805 PMICs are using a similar register map.
We can reuse the clk driver for the RK805 PMIC. So let's add
the RK805 in the Kconfig description.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/clk/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 9356ab4b7d76..7ca8f02a1232 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -39,10 +39,10 @@ config COMMON_CLK_MAX77686
 	  clock.
 
 config COMMON_CLK_RK808
-	tristate "Clock driver for RK808/RK818"
+	tristate "Clock driver for RK805/RK808/RK818"
 	depends on MFD_RK808
 	---help---
-	  This driver supports RK808 and RK818 crystal oscillator clock. These
+	  This driver supports RK805, RK808 and RK818 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.
-- 
1.9.1

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

* [PATCH v4 5/7] clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808
@ 2017-03-17  7:08   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:08 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ, Elaine Zhang

The RK808 and RK805 PMICs are using a similar register map.
We can reuse the clk driver for the RK805 PMIC. So let's add
the RK805 in the Kconfig description.

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 drivers/clk/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 9356ab4b7d76..7ca8f02a1232 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -39,10 +39,10 @@ config COMMON_CLK_MAX77686
 	  clock.
 
 config COMMON_CLK_RK808
-	tristate "Clock driver for RK808/RK818"
+	tristate "Clock driver for RK805/RK808/RK818"
 	depends on MFD_RK808
 	---help---
-	  This driver supports RK808 and RK818 crystal oscillator clock. These
+	  This driver supports RK805, RK808 and RK818 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.
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v4 6/7] rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808
@ 2017-03-17  7:08   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:08 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

The RK808 and RK805 PMICs are using a similar register map.
We can reuse the rtc driver for the RK805 PMIC. So let's add
the RK805 in the Kconfig description.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/rtc/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5dc673dc9487..47d6a8df06db 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -352,11 +352,11 @@ config RTC_DRV_MAX77686
 	  will be called rtc-max77686.
 
 config RTC_DRV_RK808
-	tristate "Rockchip RK808/RK818 RTC"
+	tristate "Rockchip RK805/RK808/RK818 RTC"
 	depends on MFD_RK808
 	help
 	  If you say yes here you will get support for the
-	  RTC of RK808 and RK818 PMIC.
+	  RTC of RK805, RK808 and RK818 PMIC.
 
 	  This driver can also be built as a module. If so, the module
 	  will be called rk808-rtc.
-- 
1.9.1

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

* [PATCH v4 6/7] rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808
@ 2017-03-17  7:08   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:08 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ, Elaine Zhang

The RK808 and RK805 PMICs are using a similar register map.
We can reuse the rtc driver for the RK805 PMIC. So let's add
the RK805 in the Kconfig description.

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 drivers/rtc/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5dc673dc9487..47d6a8df06db 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -352,11 +352,11 @@ config RTC_DRV_MAX77686
 	  will be called rtc-max77686.
 
 config RTC_DRV_RK808
-	tristate "Rockchip RK808/RK818 RTC"
+	tristate "Rockchip RK805/RK808/RK818 RTC"
 	depends on MFD_RK808
 	help
 	  If you say yes here you will get support for the
-	  RTC of RK808 and RK818 PMIC.
+	  RTC of RK805, RK808 and RK818 PMIC.
 
 	  This driver can also be built as a module. If so, the module
 	  will be called rk808-rtc.
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document
@ 2017-03-17  7:08   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:08 UTC (permalink / raw)
  To: lee.jones, lgirdwood, broonie
  Cc: huangtao, xxx, linux-rockchip, linux-kernel, chenjh, robh+dt,
	mark.rutland, devicetree, w.egorov, Elaine Zhang

Add device tree bindings documentation for Rockchip's RK805 PMIC.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 Documentation/devicetree/bindings/mfd/rk808.txt | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
index 9636ae8d8d41..05eb07134483 100644
--- a/Documentation/devicetree/bindings/mfd/rk808.txt
+++ b/Documentation/devicetree/bindings/mfd/rk808.txt
@@ -1,11 +1,12 @@
 RK8XX Power Management Integrated Circuit
 
 The rk8xx family current members:
+rk805
 rk808
 rk818
 
 Required properties:
-- compatible: "rockchip,rk808", "rockchip,rk818"
+- compatible: "rockchip,rk805", "rockchip,rk808", "rockchip,rk818"
 - reg: I2C slave address
 - interrupt-parent: The parent interrupt controller.
 - interrupts: the interrupt outputs of the controller.
@@ -18,6 +19,14 @@ Optional properties:
 - rockchip,system-power-controller: Telling whether or not this pmic is controlling
   the system power.
 
+Optional RK805 properties:
+- vcc1-supply:  The input supply for DCDC_REG1
+- vcc2-supply:  The input supply for DCDC_REG2
+- vcc3-supply:  The input supply for DCDC_REG3
+- vcc4-supply:  The input supply for DCDC_REG4
+- vcc5-supply:  The input supply for LDO_REG1 and LDO_REG2
+- vcc6-supply:  The input supply for LDO_REG3
+
 Optional RK808 properties:
 - vcc1-supply:  The input supply for DCDC_REG1
 - vcc2-supply:  The input supply for DCDC_REG2
@@ -56,6 +65,15 @@ by a child node of the 'regulators' node.
 		/* standard regulator bindings here */
 	};
 
+Following regulators of the RK805 PMIC block are supported. Note that
+the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
+number as described in RK805 datasheet.
+
+	- DCDC_REGn
+		- valid values for n are 1 to 4.
+	- LDO_REGn
+		- valid values for n are 1 to 3
+
 Following regulators of the RK808 PMIC block are supported. Note that
 the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
 number as described in RK808 datasheet.
-- 
1.9.1

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

* [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document
@ 2017-03-17  7:08   ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-17  7:08 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ, Elaine Zhang

Add device tree bindings documentation for Rockchip's RK805 PMIC.

Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/rk808.txt | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
index 9636ae8d8d41..05eb07134483 100644
--- a/Documentation/devicetree/bindings/mfd/rk808.txt
+++ b/Documentation/devicetree/bindings/mfd/rk808.txt
@@ -1,11 +1,12 @@
 RK8XX Power Management Integrated Circuit
 
 The rk8xx family current members:
+rk805
 rk808
 rk818
 
 Required properties:
-- compatible: "rockchip,rk808", "rockchip,rk818"
+- compatible: "rockchip,rk805", "rockchip,rk808", "rockchip,rk818"
 - reg: I2C slave address
 - interrupt-parent: The parent interrupt controller.
 - interrupts: the interrupt outputs of the controller.
@@ -18,6 +19,14 @@ Optional properties:
 - rockchip,system-power-controller: Telling whether or not this pmic is controlling
   the system power.
 
+Optional RK805 properties:
+- vcc1-supply:  The input supply for DCDC_REG1
+- vcc2-supply:  The input supply for DCDC_REG2
+- vcc3-supply:  The input supply for DCDC_REG3
+- vcc4-supply:  The input supply for DCDC_REG4
+- vcc5-supply:  The input supply for LDO_REG1 and LDO_REG2
+- vcc6-supply:  The input supply for LDO_REG3
+
 Optional RK808 properties:
 - vcc1-supply:  The input supply for DCDC_REG1
 - vcc2-supply:  The input supply for DCDC_REG2
@@ -56,6 +65,15 @@ by a child node of the 'regulators' node.
 		/* standard regulator bindings here */
 	};
 
+Following regulators of the RK805 PMIC block are supported. Note that
+the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
+number as described in RK805 datasheet.
+
+	- DCDC_REGn
+		- valid values for n are 1 to 4.
+	- LDO_REGn
+		- valid values for n are 1 to 3
+
 Following regulators of the RK808 PMIC block are supported. Note that
 the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
 number as described in RK808 datasheet.
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 4/7] mfd: rk808: Add RK805 support
  2017-03-17  7:06   ` Elaine Zhang
@ 2017-03-20  0:19     ` kbuild test robot
  -1 siblings, 0 replies; 31+ messages in thread
From: kbuild test robot @ 2017-03-20  0:19 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: kbuild-all, lee.jones, lgirdwood, broonie, huangtao, xxx,
	linux-rockchip, linux-kernel, chenjh, robh+dt, mark.rutland,
	devicetree, w.egorov, Elaine Zhang

[-- Attachment #1: Type: text/plain, Size: 3079 bytes --]

Hi Elaine,

[auto build test WARNING on ljones-mfd/for-mfd-next]
[also build test WARNING on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Elaine-Zhang/rk808-Add-RK805-support/20170320-073457
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-randconfig-x073-201712 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/mfd/rk808.c: In function 'rk808_probe':
>> drivers/mfd/rk808.c:547:16: warning: 'pm_pwroff_fn' may be used uninitialized in this function [-Wmaybe-uninitialized]
      pm_power_off = pm_pwroff_fn;
      ~~~~~~~~~~~~~^~~~~~~~~~~~~~

vim +/pm_pwroff_fn +547 drivers/mfd/rk808.c

2eedcbfc0 Wadim Egorov    2016-08-29  531  			return ret;
2eedcbfc0 Wadim Egorov    2016-08-29  532  		}
2eedcbfc0 Wadim Egorov    2016-08-29  533  	}
f69a7cf74 Chris Zhong     2014-09-03  534  
2eedcbfc0 Wadim Egorov    2016-08-29  535  	ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,
2eedcbfc0 Wadim Egorov    2016-08-29  536  			      cells, nr_cells, NULL, 0,
d5623161a Laxman Dewangan 2016-04-08  537  			      regmap_irq_get_domain(rk808->irq_data));
f69a7cf74 Chris Zhong     2014-09-03  538  	if (ret) {
f69a7cf74 Chris Zhong     2014-09-03  539  		dev_err(&client->dev, "failed to add MFD devices %d\n", ret);
f69a7cf74 Chris Zhong     2014-09-03  540  		goto err_irq;
f69a7cf74 Chris Zhong     2014-09-03  541  	}
f69a7cf74 Chris Zhong     2014-09-03  542  
f69a7cf74 Chris Zhong     2014-09-03  543  	pm_off = of_property_read_bool(np,
f69a7cf74 Chris Zhong     2014-09-03  544  				"rockchip,system-power-controller");
f69a7cf74 Chris Zhong     2014-09-03  545  	if (pm_off && !pm_power_off) {
f69a7cf74 Chris Zhong     2014-09-03  546  		rk808_i2c_client = client;
b2e2c8509 Jianhong Chen   2016-10-17 @547  		pm_power_off = pm_pwroff_fn;
f69a7cf74 Chris Zhong     2014-09-03  548  	}
f69a7cf74 Chris Zhong     2014-09-03  549  
f69a7cf74 Chris Zhong     2014-09-03  550  	return 0;
f69a7cf74 Chris Zhong     2014-09-03  551  
f69a7cf74 Chris Zhong     2014-09-03  552  err_irq:
f69a7cf74 Chris Zhong     2014-09-03  553  	regmap_del_irq_chip(client->irq, rk808->irq_data);
f69a7cf74 Chris Zhong     2014-09-03  554  	return ret;
f69a7cf74 Chris Zhong     2014-09-03  555  }

:::::: The code at line 547 was first introduced by commit
:::::: b2e2c85091710159b305735d557f4ef4695f5dff mfd: rk808: RK818 uses DEV_OFF to power off supplies

:::::: TO: Jianhong Chen <chenjh@rock-chips.com>
:::::: CC: Lee Jones <lee.jones@linaro.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26075 bytes --]

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

* Re: [PATCH v4 4/7] mfd: rk808: Add RK805 support
@ 2017-03-20  0:19     ` kbuild test robot
  0 siblings, 0 replies; 31+ messages in thread
From: kbuild test robot @ 2017-03-20  0:19 UTC (permalink / raw)
  Cc: kbuild-all, lee.jones, lgirdwood, broonie, huangtao, xxx,
	linux-rockchip, linux-kernel, chenjh, robh+dt, mark.rutland,
	devicetree, w.egorov, Elaine Zhang

[-- Attachment #1: Type: text/plain, Size: 3079 bytes --]

Hi Elaine,

[auto build test WARNING on ljones-mfd/for-mfd-next]
[also build test WARNING on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Elaine-Zhang/rk808-Add-RK805-support/20170320-073457
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-randconfig-x073-201712 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/mfd/rk808.c: In function 'rk808_probe':
>> drivers/mfd/rk808.c:547:16: warning: 'pm_pwroff_fn' may be used uninitialized in this function [-Wmaybe-uninitialized]
      pm_power_off = pm_pwroff_fn;
      ~~~~~~~~~~~~~^~~~~~~~~~~~~~

vim +/pm_pwroff_fn +547 drivers/mfd/rk808.c

2eedcbfc0 Wadim Egorov    2016-08-29  531  			return ret;
2eedcbfc0 Wadim Egorov    2016-08-29  532  		}
2eedcbfc0 Wadim Egorov    2016-08-29  533  	}
f69a7cf74 Chris Zhong     2014-09-03  534  
2eedcbfc0 Wadim Egorov    2016-08-29  535  	ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,
2eedcbfc0 Wadim Egorov    2016-08-29  536  			      cells, nr_cells, NULL, 0,
d5623161a Laxman Dewangan 2016-04-08  537  			      regmap_irq_get_domain(rk808->irq_data));
f69a7cf74 Chris Zhong     2014-09-03  538  	if (ret) {
f69a7cf74 Chris Zhong     2014-09-03  539  		dev_err(&client->dev, "failed to add MFD devices %d\n", ret);
f69a7cf74 Chris Zhong     2014-09-03  540  		goto err_irq;
f69a7cf74 Chris Zhong     2014-09-03  541  	}
f69a7cf74 Chris Zhong     2014-09-03  542  
f69a7cf74 Chris Zhong     2014-09-03  543  	pm_off = of_property_read_bool(np,
f69a7cf74 Chris Zhong     2014-09-03  544  				"rockchip,system-power-controller");
f69a7cf74 Chris Zhong     2014-09-03  545  	if (pm_off && !pm_power_off) {
f69a7cf74 Chris Zhong     2014-09-03  546  		rk808_i2c_client = client;
b2e2c8509 Jianhong Chen   2016-10-17 @547  		pm_power_off = pm_pwroff_fn;
f69a7cf74 Chris Zhong     2014-09-03  548  	}
f69a7cf74 Chris Zhong     2014-09-03  549  
f69a7cf74 Chris Zhong     2014-09-03  550  	return 0;
f69a7cf74 Chris Zhong     2014-09-03  551  
f69a7cf74 Chris Zhong     2014-09-03  552  err_irq:
f69a7cf74 Chris Zhong     2014-09-03  553  	regmap_del_irq_chip(client->irq, rk808->irq_data);
f69a7cf74 Chris Zhong     2014-09-03  554  	return ret;
f69a7cf74 Chris Zhong     2014-09-03  555  }

:::::: The code at line 547 was first introduced by commit
:::::: b2e2c85091710159b305735d557f4ef4695f5dff mfd: rk808: RK818 uses DEV_OFF to power off supplies

:::::: TO: Jianhong Chen <chenjh@rock-chips.com>
:::::: CC: Lee Jones <lee.jones@linaro.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26075 bytes --]

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

* Re: [PATCH v4 1/7] mfd: rk808: fix up the chip id get failed
@ 2017-03-23 12:14     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:14 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood, broonie, huangtao, xxx, linux-rockchip, linux-kernel,
	chenjh, robh+dt, mark.rutland, devicetree, w.egorov

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> the rk8xx chip id is:
> ((MSB << 8) | LSB) & 0xfff0
> 
> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> ---
>  drivers/mfd/rk808.c       | 21 +++++++++++++++------
>  include/linux/mfd/rk808.h |  1 +
>  2 files changed, 16 insertions(+), 6 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index fd087cbb0bde..3334a2a7f3fb 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client,
>  	void (*pm_pwroff_fn)(void);
>  	int nr_pre_init_regs;
>  	int nr_cells;
> -	int pm_off = 0;
> +	int pm_off = 0, msb, lsb;
>  	int ret;
>  	int i;
>  
> @@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client,
>  	if (!rk808)
>  		return -ENOMEM;
>  
> -	rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB);
> -	if (rk808->variant < 0) {
> -		dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n",
> +	/* read Chip variant */
> +	msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
> +	if (msb < 0) {
> +		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
>  			RK808_ID_MSB);
> -		return rk808->variant;
> +		return msb;
>  	}
>  
> -	dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
> +	lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
> +	if (lsb < 0) {
> +		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
> +			RK808_ID_LSB);
> +		return lsb;
> +	}
> +
> +	rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
> +	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
>  
>  	switch (rk808->variant) {
>  	case RK808_ID:
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index 83701ef7d3c7..54feb140c210 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -298,6 +298,7 @@ enum rk818_reg {
>  #define VOUT_LO_INT	BIT(0)
>  #define CLK32KOUT2_EN	BIT(0)
>  
> +#define RK8XX_ID_MSK			0xfff0
>  enum {
>  	BUCK_ILMIN_50MA,
>  	BUCK_ILMIN_100MA,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 1/7] mfd: rk808: fix up the chip id get failed
@ 2017-03-23 12:14     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:14 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> the rk8xx chip id is:
> ((MSB << 8) | LSB) & 0xfff0
> 
> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>  drivers/mfd/rk808.c       | 21 +++++++++++++++------
>  include/linux/mfd/rk808.h |  1 +
>  2 files changed, 16 insertions(+), 6 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  
> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index fd087cbb0bde..3334a2a7f3fb 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client,
>  	void (*pm_pwroff_fn)(void);
>  	int nr_pre_init_regs;
>  	int nr_cells;
> -	int pm_off = 0;
> +	int pm_off = 0, msb, lsb;
>  	int ret;
>  	int i;
>  
> @@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client,
>  	if (!rk808)
>  		return -ENOMEM;
>  
> -	rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB);
> -	if (rk808->variant < 0) {
> -		dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n",
> +	/* read Chip variant */
> +	msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
> +	if (msb < 0) {
> +		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
>  			RK808_ID_MSB);
> -		return rk808->variant;
> +		return msb;
>  	}
>  
> -	dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
> +	lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
> +	if (lsb < 0) {
> +		dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
> +			RK808_ID_LSB);
> +		return lsb;
> +	}
> +
> +	rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
> +	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
>  
>  	switch (rk808->variant) {
>  	case RK808_ID:
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index 83701ef7d3c7..54feb140c210 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -298,6 +298,7 @@ enum rk818_reg {
>  #define VOUT_LO_INT	BIT(0)
>  #define CLK32KOUT2_EN	BIT(0)
>  
> +#define RK8XX_ID_MSK			0xfff0
>  enum {
>  	BUCK_ILMIN_50MA,
>  	BUCK_ILMIN_100MA,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID
@ 2017-03-23 12:15     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:15 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood, broonie, huangtao, xxx, linux-rockchip, linux-kernel,
	chenjh, robh+dt, mark.rutland, devicetree, w.egorov

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> ---
>  include/linux/mfd/rk808.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 119 insertions(+)
> 
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index 54feb140c210..a133309b52f9 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -206,6 +206,96 @@ enum rk818_reg {
>  #define RK818_USB_ILMIN_2000MA		0x7
>  #define RK818_USB_CHG_SD_VSEL_MASK	0x70
>  
> +/* RK805 */
> +enum rk805_reg {
> +	RK805_ID_DCDC1,
> +	RK805_ID_DCDC2,
> +	RK805_ID_DCDC3,
> +	RK805_ID_DCDC4,
> +	RK805_ID_LDO1,
> +	RK805_ID_LDO2,
> +	RK805_ID_LDO3,
> +};
> +
> +/* INTERRUPT REGISTER */
> +#define RK805_INT_STS_REG		0x4C
> +#define RK805_INT_STS_MSK_REG		0x4D
> +#define RK805_GPIO_IO_POL_REG		0x50
> +#define RK805_OUT_REG			0x52
> +#define RK805_ON_SOURCE_REG		0xAE
> +#define RK805_OFF_SOURCE_REG		0xAF
> +
> +/* POWER CHANNELS ENABLE REGISTER */
> +#define RK805_DCDC_EN_REG		0x23
> +#define RK805_SLP_DCDC_EN_REG		0x25
> +#define RK805_SLP_LDO_EN_REG		0x26
> +#define RK805_LDO_EN_REG		0x27
> +
> +/* CONFIG REGISTER */
> +#define RK805_THERMAL_REG		0x22
> +
> +/* BUCK AND LDO CONFIG REGISTER */
> +#define RK805_BUCK_LDO_SLP_LP_EN_REG	0x2A
> +#define RK805_BUCK1_CONFIG_REG		0x2E
> +#define RK805_BUCK1_ON_VSEL_REG		0x2F
> +#define RK805_BUCK1_SLP_VSEL_REG	0x30
> +#define RK805_BUCK2_CONFIG_REG		0x32
> +#define RK805_BUCK2_ON_VSEL_REG		0x33
> +#define RK805_BUCK2_SLP_VSEL_REG	0x34
> +#define RK805_BUCK3_CONFIG_REG		0x36
> +#define RK805_BUCK4_CONFIG_REG		0x37
> +#define RK805_BUCK4_ON_VSEL_REG		0x38
> +#define RK805_BUCK4_SLP_VSEL_REG	0x39
> +#define RK805_LDO1_ON_VSEL_REG		0x3B
> +#define RK805_LDO1_SLP_VSEL_REG		0x3C
> +#define RK805_LDO2_ON_VSEL_REG		0x3D
> +#define RK805_LDO2_SLP_VSEL_REG		0x3E
> +#define RK805_LDO3_ON_VSEL_REG		0x3F
> +#define RK805_LDO3_SLP_VSEL_REG		0x40
> +#define RK805_OUT_REG			0x52
> +#define RK805_ON_SOURCE_REG		0xAE
> +#define RK805_OFF_SOURCE_REG		0xAF

Why aren't all of these in numerical order?

> +#define RK805_NUM_REGULATORS		7
> +
> +#define RK805_PWRON_FALL_RISE_INT_EN	0x0
> +#define RK805_PWRON_FALL_RISE_INT_MSK	0x81
> +
> +/* RK805 IRQ Definitions */
> +#define RK805_IRQ_PWRON_RISE		0
> +#define RK805_IRQ_VB_LOW		1
> +#define RK805_IRQ_PWRON			2
> +#define RK805_IRQ_PWRON_LP		3
> +#define RK805_IRQ_HOTDIE		4
> +#define RK805_IRQ_RTC_ALARM		5
> +#define RK805_IRQ_RTC_PERIOD		6
> +#define RK805_IRQ_PWRON_FALL		7
> +
> +#define RK805_IRQ_PWRON_RISE_MSK	BIT(0)
> +#define RK805_IRQ_VB_LOW_MSK		BIT(1)
> +#define RK805_IRQ_PWRON_MSK		BIT(2)
> +#define RK805_IRQ_PWRON_LP_MSK		BIT(3)
> +#define RK805_IRQ_HOTDIE_MSK		BIT(4)
> +#define RK805_IRQ_RTC_ALARM_MSK		BIT(5)
> +#define RK805_IRQ_RTC_PERIOD_MSK	BIT(6)
> +#define RK805_IRQ_PWRON_FALL_MSK	BIT(7)
> +
> +#define RK805_PWR_RISE_INT_STATUS	BIT(0)
> +#define RK805_VB_LOW_INT_STATUS		BIT(1)
> +#define RK805_PWRON_INT_STATUS		BIT(2)
> +#define RK805_PWRON_LP_INT_STATUS	BIT(3)
> +#define RK805_HOTDIE_INT_STATUS		BIT(4)
> +#define RK805_ALARM_INT_STATUS		BIT(5)
> +#define RK805_PERIOD_INT_STATUS		BIT(6)
> +#define RK805_PWR_FALL_INT_STATUS	BIT(7)
> +
> +#define RK805_BUCK1_2_ILMAX_MASK	(3 << 6)
> +#define RK805_BUCK3_4_ILMAX_MASK        (3 << 3)
> +#define RK805_RTC_PERIOD_INT_MASK	(1 << 6)
> +#define RK805_RTC_ALARM_INT_MASK	(1 << 5)
> +#define RK805_INT_ALARM_EN		(1 << 3)
> +#define RK805_INT_TIMER_EN		(1 << 2)
> +
>  /* RK808 IRQ Definitions */
>  #define RK808_IRQ_VOUT_LO	0
>  #define RK808_IRQ_VB_LO		1
> @@ -298,7 +388,14 @@ enum rk818_reg {
>  #define VOUT_LO_INT	BIT(0)
>  #define CLK32KOUT2_EN	BIT(0)
>  
> +#define TEMP115C			0x0c
> +#define TEMP_HOTDIE_MSK			0x0c
> +#define SLP_SD_MSK			(0x3 << 2)
> +#define SHUTDOWN_FUN			(0x2 << 2)
> +#define SLEEP_FUN			(0x1 << 2)
>  #define RK8XX_ID_MSK			0xfff0
> +#define FPWM_MODE			BIT(7)
> +
>  enum {
>  	BUCK_ILMIN_50MA,
>  	BUCK_ILMIN_100MA,
> @@ -322,6 +419,28 @@ enum {
>  };
>  
>  enum {
> +	RK805_BUCK1_2_ILMAX_2500MA,
> +	RK805_BUCK1_2_ILMAX_3000MA,
> +	RK805_BUCK1_2_ILMAX_3500MA,
> +	RK805_BUCK1_2_ILMAX_4000MA,
> +};
> +
> +enum {
> +	RK805_BUCK3_ILMAX_1500MA,
> +	RK805_BUCK3_ILMAX_2000MA,
> +	RK805_BUCK3_ILMAX_2500MA,
> +	RK805_BUCK3_ILMAX_3000MA,
> +};
> +
> +enum {
> +	RK805_BUCK4_ILMAX_2000MA,
> +	RK805_BUCK4_ILMAX_2500MA,
> +	RK805_BUCK4_ILMAX_3000MA,
> +	RK805_BUCK4_ILMAX_3500MA,
> +};
> +
> +enum {
> +	RK805_ID = 0x8050,
>  	RK808_ID = 0x0000,
>  	RK818_ID = 0x8181,
>  };

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID
@ 2017-03-23 12:15     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:15 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>  include/linux/mfd/rk808.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 119 insertions(+)
> 
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index 54feb140c210..a133309b52f9 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -206,6 +206,96 @@ enum rk818_reg {
>  #define RK818_USB_ILMIN_2000MA		0x7
>  #define RK818_USB_CHG_SD_VSEL_MASK	0x70
>  
> +/* RK805 */
> +enum rk805_reg {
> +	RK805_ID_DCDC1,
> +	RK805_ID_DCDC2,
> +	RK805_ID_DCDC3,
> +	RK805_ID_DCDC4,
> +	RK805_ID_LDO1,
> +	RK805_ID_LDO2,
> +	RK805_ID_LDO3,
> +};
> +
> +/* INTERRUPT REGISTER */
> +#define RK805_INT_STS_REG		0x4C
> +#define RK805_INT_STS_MSK_REG		0x4D
> +#define RK805_GPIO_IO_POL_REG		0x50
> +#define RK805_OUT_REG			0x52
> +#define RK805_ON_SOURCE_REG		0xAE
> +#define RK805_OFF_SOURCE_REG		0xAF
> +
> +/* POWER CHANNELS ENABLE REGISTER */
> +#define RK805_DCDC_EN_REG		0x23
> +#define RK805_SLP_DCDC_EN_REG		0x25
> +#define RK805_SLP_LDO_EN_REG		0x26
> +#define RK805_LDO_EN_REG		0x27
> +
> +/* CONFIG REGISTER */
> +#define RK805_THERMAL_REG		0x22
> +
> +/* BUCK AND LDO CONFIG REGISTER */
> +#define RK805_BUCK_LDO_SLP_LP_EN_REG	0x2A
> +#define RK805_BUCK1_CONFIG_REG		0x2E
> +#define RK805_BUCK1_ON_VSEL_REG		0x2F
> +#define RK805_BUCK1_SLP_VSEL_REG	0x30
> +#define RK805_BUCK2_CONFIG_REG		0x32
> +#define RK805_BUCK2_ON_VSEL_REG		0x33
> +#define RK805_BUCK2_SLP_VSEL_REG	0x34
> +#define RK805_BUCK3_CONFIG_REG		0x36
> +#define RK805_BUCK4_CONFIG_REG		0x37
> +#define RK805_BUCK4_ON_VSEL_REG		0x38
> +#define RK805_BUCK4_SLP_VSEL_REG	0x39
> +#define RK805_LDO1_ON_VSEL_REG		0x3B
> +#define RK805_LDO1_SLP_VSEL_REG		0x3C
> +#define RK805_LDO2_ON_VSEL_REG		0x3D
> +#define RK805_LDO2_SLP_VSEL_REG		0x3E
> +#define RK805_LDO3_ON_VSEL_REG		0x3F
> +#define RK805_LDO3_SLP_VSEL_REG		0x40
> +#define RK805_OUT_REG			0x52
> +#define RK805_ON_SOURCE_REG		0xAE
> +#define RK805_OFF_SOURCE_REG		0xAF

Why aren't all of these in numerical order?

> +#define RK805_NUM_REGULATORS		7
> +
> +#define RK805_PWRON_FALL_RISE_INT_EN	0x0
> +#define RK805_PWRON_FALL_RISE_INT_MSK	0x81
> +
> +/* RK805 IRQ Definitions */
> +#define RK805_IRQ_PWRON_RISE		0
> +#define RK805_IRQ_VB_LOW		1
> +#define RK805_IRQ_PWRON			2
> +#define RK805_IRQ_PWRON_LP		3
> +#define RK805_IRQ_HOTDIE		4
> +#define RK805_IRQ_RTC_ALARM		5
> +#define RK805_IRQ_RTC_PERIOD		6
> +#define RK805_IRQ_PWRON_FALL		7
> +
> +#define RK805_IRQ_PWRON_RISE_MSK	BIT(0)
> +#define RK805_IRQ_VB_LOW_MSK		BIT(1)
> +#define RK805_IRQ_PWRON_MSK		BIT(2)
> +#define RK805_IRQ_PWRON_LP_MSK		BIT(3)
> +#define RK805_IRQ_HOTDIE_MSK		BIT(4)
> +#define RK805_IRQ_RTC_ALARM_MSK		BIT(5)
> +#define RK805_IRQ_RTC_PERIOD_MSK	BIT(6)
> +#define RK805_IRQ_PWRON_FALL_MSK	BIT(7)
> +
> +#define RK805_PWR_RISE_INT_STATUS	BIT(0)
> +#define RK805_VB_LOW_INT_STATUS		BIT(1)
> +#define RK805_PWRON_INT_STATUS		BIT(2)
> +#define RK805_PWRON_LP_INT_STATUS	BIT(3)
> +#define RK805_HOTDIE_INT_STATUS		BIT(4)
> +#define RK805_ALARM_INT_STATUS		BIT(5)
> +#define RK805_PERIOD_INT_STATUS		BIT(6)
> +#define RK805_PWR_FALL_INT_STATUS	BIT(7)
> +
> +#define RK805_BUCK1_2_ILMAX_MASK	(3 << 6)
> +#define RK805_BUCK3_4_ILMAX_MASK        (3 << 3)
> +#define RK805_RTC_PERIOD_INT_MASK	(1 << 6)
> +#define RK805_RTC_ALARM_INT_MASK	(1 << 5)
> +#define RK805_INT_ALARM_EN		(1 << 3)
> +#define RK805_INT_TIMER_EN		(1 << 2)
> +
>  /* RK808 IRQ Definitions */
>  #define RK808_IRQ_VOUT_LO	0
>  #define RK808_IRQ_VB_LO		1
> @@ -298,7 +388,14 @@ enum rk818_reg {
>  #define VOUT_LO_INT	BIT(0)
>  #define CLK32KOUT2_EN	BIT(0)
>  
> +#define TEMP115C			0x0c
> +#define TEMP_HOTDIE_MSK			0x0c
> +#define SLP_SD_MSK			(0x3 << 2)
> +#define SHUTDOWN_FUN			(0x2 << 2)
> +#define SLEEP_FUN			(0x1 << 2)
>  #define RK8XX_ID_MSK			0xfff0
> +#define FPWM_MODE			BIT(7)
> +
>  enum {
>  	BUCK_ILMIN_50MA,
>  	BUCK_ILMIN_100MA,
> @@ -322,6 +419,28 @@ enum {
>  };
>  
>  enum {
> +	RK805_BUCK1_2_ILMAX_2500MA,
> +	RK805_BUCK1_2_ILMAX_3000MA,
> +	RK805_BUCK1_2_ILMAX_3500MA,
> +	RK805_BUCK1_2_ILMAX_4000MA,
> +};
> +
> +enum {
> +	RK805_BUCK3_ILMAX_1500MA,
> +	RK805_BUCK3_ILMAX_2000MA,
> +	RK805_BUCK3_ILMAX_2500MA,
> +	RK805_BUCK3_ILMAX_3000MA,
> +};
> +
> +enum {
> +	RK805_BUCK4_ILMAX_2000MA,
> +	RK805_BUCK4_ILMAX_2500MA,
> +	RK805_BUCK4_ILMAX_3000MA,
> +	RK805_BUCK4_ILMAX_3500MA,
> +};
> +
> +enum {
> +	RK805_ID = 0x8050,
>  	RK808_ID = 0x0000,
>  	RK818_ID = 0x8181,
>  };

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 4/7] mfd: rk808: Add RK805 support
@ 2017-03-23 12:23     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:23 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood, broonie, huangtao, xxx, linux-rockchip, linux-kernel,
	chenjh, robh+dt, mark.rutland, devicetree, w.egorov

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> The RK805 chip is a Power Management IC (PMIC) for multimedia and handheld
> devices. It contains the following components:
> 
>     - Regulators
>     - RTC
>     - Clocking
> 
> Both RK808 and RK805 chips are using a similar register map,
> so we can reuse the RTC and Clocking functionality.
> 
> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> ---
>  drivers/mfd/Kconfig |   4 +-
>  drivers/mfd/rk808.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 124 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 55ecdfb74d31..b410a348b756 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -892,13 +892,13 @@ config MFD_RC5T583
>  	  different functionality of the device.
>  
>  config MFD_RK808
> -	tristate "Rockchip RK808/RK818 Power Management Chip"
> +	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
>  	depends on I2C && OF
>  	select MFD_CORE
>  	select REGMAP_I2C
>  	select REGMAP_IRQ
>  	help
> -	  If you say yes here you get support for the RK808 and RK818
> +	  If you say yes here you get support for the RK805, RK808 and RK818
>  	  Power Management chips.
>  	  This driver provides common support for accessing the device
>  	  through I2C interface. The device supports multiple sub-devices
> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index 3334a2a7f3fb..fdd4449b14b0 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -70,6 +70,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	.volatile_reg = rk808_is_volatile_reg,
>  };
>  
> +static const struct regmap_config rk805_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,
> +	.max_register = RK805_OFF_SOURCE_REG,
> +	.cache_type = REGCACHE_RBTREE,
> +	.volatile_reg = rk808_is_volatile_reg,
> +};
> +
>  static const struct regmap_config rk808_regmap_config = {
>  	.reg_bits = 8,
>  	.val_bits = 8,
> @@ -86,6 +94,16 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	}
>  };
>  
> +static const struct mfd_cell rk805s[] = {
> +	{ .name = "rk808-clkout", },
> +	{ .name = "rk808-regulator", },
> +	{
> +		.name = "rk808-rtc",
> +		.num_resources = ARRAY_SIZE(rtc_resources),
> +		.resources = &rtc_resources[0],
> +	},
> +};
> +
>  static const struct mfd_cell rk808s[] = {
>  	{ .name = "rk808-clkout", },
>  	{ .name = "rk808-regulator", },
> @@ -106,6 +124,20 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	},
>  };
>  
> +static const struct rk808_reg_data rk805_pre_init_reg[] = {
> +	{RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
> +				 RK805_BUCK1_2_ILMAX_4000MA},
> +	{RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
> +				 RK805_BUCK1_2_ILMAX_4000MA},
> +	{RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
> +				 RK805_BUCK3_ILMAX_3000MA},
> +	{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
> +				 RK805_BUCK4_ILMAX_3500MA},
> +	{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
> +	{RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
> +	{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
> +};
> +
>  static const struct rk808_reg_data rk808_pre_init_reg[] = {
>  	{ RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_150MA },
>  	{ RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_200MA },
> @@ -135,6 +167,41 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  						    VB_LO_SEL_3500MV },
>  };
>  
> +static const struct regmap_irq rk805_irqs[] = {
> +	[RK805_IRQ_PWRON_RISE] = {
> +		.mask = RK805_IRQ_PWRON_RISE_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_VB_LOW] = {
> +		.mask = RK805_IRQ_VB_LOW_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_PWRON] = {
> +		.mask = RK805_IRQ_PWRON_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_PWRON_LP] = {
> +		.mask = RK805_IRQ_PWRON_LP_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_HOTDIE] = {
> +		.mask = RK805_IRQ_HOTDIE_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_RTC_ALARM] = {
> +		.mask = RK805_IRQ_RTC_ALARM_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_RTC_PERIOD] = {
> +		.mask = RK805_IRQ_RTC_PERIOD_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_PWRON_FALL] = {
> +		.mask = RK805_IRQ_PWRON_FALL_MSK,
> +		.reg_offset = 0,
> +	},
> +};
> +
>  static const struct regmap_irq rk808_irqs[] = {
>  	/* INT_STS */
>  	[RK808_IRQ_VOUT_LO] = {
> @@ -247,6 +314,17 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	},
>  };
>  
> +static struct regmap_irq_chip rk805_irq_chip = {
> +	.name = "rk805",
> +	.irqs = rk805_irqs,
> +	.num_irqs = ARRAY_SIZE(rk805_irqs),
> +	.num_regs = 1,
> +	.status_base = RK805_INT_STS_REG,
> +	.mask_base = RK805_INT_STS_MSK_REG,
> +	.ack_base = RK805_INT_STS_REG,
> +	.init_ack_masked = true,
> +};
> +
>  static const struct regmap_irq_chip rk808_irq_chip = {
>  	.name = "rk808",
>  	.irqs = rk808_irqs,
> @@ -272,6 +350,38 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  };
>  
>  static struct i2c_client *rk808_i2c_client;
> +
> +static void rk805_shutdown_prepare(void)
> +{
> +	int ret;
> +	struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);

Nit: Can you switch these two around?

> +	if (!rk808) {
> +		dev_warn(&rk808_i2c_client->dev,
> +			 "have no rk808, so do nothing here\n");
> +		return;
> +	}

What's happening here?  Is it possible for rk808 to be NULL?  If so,
under what circumstances can this happen?  And is that truly an error?

> +	/* close rtc int when power off */

Use proper grammar, "Close RTC".

What is int?  I'm guessing you mean either "interrupt" or "IRQ".

> +	regmap_update_bits(rk808->regmap,
> +			   RK808_INT_STS_MSK_REG1,

"when power off" should either be "when we power off", "during
power off", or something of that nature.

> +			   RK805_RTC_PERIOD_INT_MASK |
> +			   RK805_RTC_ALARM_INT_MASK,
> +			   RK805_RTC_PERIOD_INT_MASK |
> +			   RK805_RTC_ALARM_INT_MASK);
> +	regmap_update_bits(rk808->regmap,
> +			   RK808_RTC_INT_REG,
> +			   RK805_INT_ALARM_EN | RK805_INT_TIMER_EN,
> +			   0);
> +
> +	/* pmic sleep shutdown function */

"PMIC"

'sleep' or 'shutdown' can't be both.

Looks like shutdown to me.

> +	ret = regmap_update_bits(rk808->regmap,
> +				 RK805_GPIO_IO_POL_REG,
> +				 SLP_SD_MSK, SHUTDOWN_FUN);
> +	if (ret)
> +		dev_err(&rk808_i2c_client->dev, "power off error!\n");
> +}
> +
>  static void rk808_device_shutdown(void)
>  {
>  	int ret;
> @@ -309,6 +419,7 @@ static void rk818_device_shutdown(void)
>  }
>  
>  static const struct of_device_id rk808_of_match[] = {
> +	{ .compatible = "rockchip,rk805" },
>  	{ .compatible = "rockchip,rk808" },
>  	{ .compatible = "rockchip,rk818" },
>  	{ },
> @@ -323,6 +434,7 @@ static int rk808_probe(struct i2c_client *client,
>  	const struct rk808_reg_data *pre_init_reg;
>  	const struct mfd_cell *cells;
>  	void (*pm_pwroff_fn)(void);
> +	void (*pm_shutdown_prepare_fn)(void);
>  	int nr_pre_init_regs;
>  	int nr_cells;
>  	int pm_off = 0, msb, lsb;
> @@ -352,6 +464,15 @@ static int rk808_probe(struct i2c_client *client,
>  	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
>  
>  	switch (rk808->variant) {
> +	case RK805_ID:
> +		rk808->regmap_cfg = &rk805_regmap_config;
> +		rk808->regmap_irq_chip = &rk805_irq_chip;
> +		pre_init_reg = rk805_pre_init_reg;
> +		nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
> +		cells = rk805s;
> +		nr_cells = ARRAY_SIZE(rk805s);
> +		pm_shutdown_prepare_fn = rk805_shutdown_prepare;
> +		break;
>  	case RK808_ID:
>  		rk808->regmap_cfg = &rk808_regmap_config;
>  		rk808->regmap_irq_chip = &rk808_irq_chip;
> @@ -444,6 +565,7 @@ static int rk808_remove(struct i2c_client *client)
>  }
>  
>  static const struct i2c_device_id rk808_ids[] = {
> +	{ "rk805" },
>  	{ "rk808" },
>  	{ "rk818" },
>  	{ },

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 4/7] mfd: rk808: Add RK805 support
@ 2017-03-23 12:23     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:23 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> The RK805 chip is a Power Management IC (PMIC) for multimedia and handheld
> devices. It contains the following components:
> 
>     - Regulators
>     - RTC
>     - Clocking
> 
> Both RK808 and RK805 chips are using a similar register map,
> so we can reuse the RTC and Clocking functionality.
> 
> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>  drivers/mfd/Kconfig |   4 +-
>  drivers/mfd/rk808.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 124 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 55ecdfb74d31..b410a348b756 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -892,13 +892,13 @@ config MFD_RC5T583
>  	  different functionality of the device.
>  
>  config MFD_RK808
> -	tristate "Rockchip RK808/RK818 Power Management Chip"
> +	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
>  	depends on I2C && OF
>  	select MFD_CORE
>  	select REGMAP_I2C
>  	select REGMAP_IRQ
>  	help
> -	  If you say yes here you get support for the RK808 and RK818
> +	  If you say yes here you get support for the RK805, RK808 and RK818
>  	  Power Management chips.
>  	  This driver provides common support for accessing the device
>  	  through I2C interface. The device supports multiple sub-devices
> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index 3334a2a7f3fb..fdd4449b14b0 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -70,6 +70,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	.volatile_reg = rk808_is_volatile_reg,
>  };
>  
> +static const struct regmap_config rk805_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,
> +	.max_register = RK805_OFF_SOURCE_REG,
> +	.cache_type = REGCACHE_RBTREE,
> +	.volatile_reg = rk808_is_volatile_reg,
> +};
> +
>  static const struct regmap_config rk808_regmap_config = {
>  	.reg_bits = 8,
>  	.val_bits = 8,
> @@ -86,6 +94,16 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	}
>  };
>  
> +static const struct mfd_cell rk805s[] = {
> +	{ .name = "rk808-clkout", },
> +	{ .name = "rk808-regulator", },
> +	{
> +		.name = "rk808-rtc",
> +		.num_resources = ARRAY_SIZE(rtc_resources),
> +		.resources = &rtc_resources[0],
> +	},
> +};
> +
>  static const struct mfd_cell rk808s[] = {
>  	{ .name = "rk808-clkout", },
>  	{ .name = "rk808-regulator", },
> @@ -106,6 +124,20 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	},
>  };
>  
> +static const struct rk808_reg_data rk805_pre_init_reg[] = {
> +	{RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
> +				 RK805_BUCK1_2_ILMAX_4000MA},
> +	{RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
> +				 RK805_BUCK1_2_ILMAX_4000MA},
> +	{RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
> +				 RK805_BUCK3_ILMAX_3000MA},
> +	{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
> +				 RK805_BUCK4_ILMAX_3500MA},
> +	{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
> +	{RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
> +	{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
> +};
> +
>  static const struct rk808_reg_data rk808_pre_init_reg[] = {
>  	{ RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_150MA },
>  	{ RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_200MA },
> @@ -135,6 +167,41 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  						    VB_LO_SEL_3500MV },
>  };
>  
> +static const struct regmap_irq rk805_irqs[] = {
> +	[RK805_IRQ_PWRON_RISE] = {
> +		.mask = RK805_IRQ_PWRON_RISE_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_VB_LOW] = {
> +		.mask = RK805_IRQ_VB_LOW_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_PWRON] = {
> +		.mask = RK805_IRQ_PWRON_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_PWRON_LP] = {
> +		.mask = RK805_IRQ_PWRON_LP_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_HOTDIE] = {
> +		.mask = RK805_IRQ_HOTDIE_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_RTC_ALARM] = {
> +		.mask = RK805_IRQ_RTC_ALARM_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_RTC_PERIOD] = {
> +		.mask = RK805_IRQ_RTC_PERIOD_MSK,
> +		.reg_offset = 0,
> +	},
> +	[RK805_IRQ_PWRON_FALL] = {
> +		.mask = RK805_IRQ_PWRON_FALL_MSK,
> +		.reg_offset = 0,
> +	},
> +};
> +
>  static const struct regmap_irq rk808_irqs[] = {
>  	/* INT_STS */
>  	[RK808_IRQ_VOUT_LO] = {
> @@ -247,6 +314,17 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  	},
>  };
>  
> +static struct regmap_irq_chip rk805_irq_chip = {
> +	.name = "rk805",
> +	.irqs = rk805_irqs,
> +	.num_irqs = ARRAY_SIZE(rk805_irqs),
> +	.num_regs = 1,
> +	.status_base = RK805_INT_STS_REG,
> +	.mask_base = RK805_INT_STS_MSK_REG,
> +	.ack_base = RK805_INT_STS_REG,
> +	.init_ack_masked = true,
> +};
> +
>  static const struct regmap_irq_chip rk808_irq_chip = {
>  	.name = "rk808",
>  	.irqs = rk808_irqs,
> @@ -272,6 +350,38 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>  };
>  
>  static struct i2c_client *rk808_i2c_client;
> +
> +static void rk805_shutdown_prepare(void)
> +{
> +	int ret;
> +	struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);

Nit: Can you switch these two around?

> +	if (!rk808) {
> +		dev_warn(&rk808_i2c_client->dev,
> +			 "have no rk808, so do nothing here\n");
> +		return;
> +	}

What's happening here?  Is it possible for rk808 to be NULL?  If so,
under what circumstances can this happen?  And is that truly an error?

> +	/* close rtc int when power off */

Use proper grammar, "Close RTC".

What is int?  I'm guessing you mean either "interrupt" or "IRQ".

> +	regmap_update_bits(rk808->regmap,
> +			   RK808_INT_STS_MSK_REG1,

"when power off" should either be "when we power off", "during
power off", or something of that nature.

> +			   RK805_RTC_PERIOD_INT_MASK |
> +			   RK805_RTC_ALARM_INT_MASK,
> +			   RK805_RTC_PERIOD_INT_MASK |
> +			   RK805_RTC_ALARM_INT_MASK);
> +	regmap_update_bits(rk808->regmap,
> +			   RK808_RTC_INT_REG,
> +			   RK805_INT_ALARM_EN | RK805_INT_TIMER_EN,
> +			   0);
> +
> +	/* pmic sleep shutdown function */

"PMIC"

'sleep' or 'shutdown' can't be both.

Looks like shutdown to me.

> +	ret = regmap_update_bits(rk808->regmap,
> +				 RK805_GPIO_IO_POL_REG,
> +				 SLP_SD_MSK, SHUTDOWN_FUN);
> +	if (ret)
> +		dev_err(&rk808_i2c_client->dev, "power off error!\n");
> +}
> +
>  static void rk808_device_shutdown(void)
>  {
>  	int ret;
> @@ -309,6 +419,7 @@ static void rk818_device_shutdown(void)
>  }
>  
>  static const struct of_device_id rk808_of_match[] = {
> +	{ .compatible = "rockchip,rk805" },
>  	{ .compatible = "rockchip,rk808" },
>  	{ .compatible = "rockchip,rk818" },
>  	{ },
> @@ -323,6 +434,7 @@ static int rk808_probe(struct i2c_client *client,
>  	const struct rk808_reg_data *pre_init_reg;
>  	const struct mfd_cell *cells;
>  	void (*pm_pwroff_fn)(void);
> +	void (*pm_shutdown_prepare_fn)(void);
>  	int nr_pre_init_regs;
>  	int nr_cells;
>  	int pm_off = 0, msb, lsb;
> @@ -352,6 +464,15 @@ static int rk808_probe(struct i2c_client *client,
>  	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
>  
>  	switch (rk808->variant) {
> +	case RK805_ID:
> +		rk808->regmap_cfg = &rk805_regmap_config;
> +		rk808->regmap_irq_chip = &rk805_irq_chip;
> +		pre_init_reg = rk805_pre_init_reg;
> +		nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
> +		cells = rk805s;
> +		nr_cells = ARRAY_SIZE(rk805s);
> +		pm_shutdown_prepare_fn = rk805_shutdown_prepare;
> +		break;
>  	case RK808_ID:
>  		rk808->regmap_cfg = &rk808_regmap_config;
>  		rk808->regmap_irq_chip = &rk808_irq_chip;
> @@ -444,6 +565,7 @@ static int rk808_remove(struct i2c_client *client)
>  }
>  
>  static const struct i2c_device_id rk808_ids[] = {
> +	{ "rk805" },
>  	{ "rk808" },
>  	{ "rk818" },
>  	{ },

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document
@ 2017-03-23 12:25     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:25 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood, broonie, huangtao, xxx, linux-rockchip, linux-kernel,
	chenjh, robh+dt, mark.rutland, devicetree, w.egorov

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> Add device tree bindings documentation for Rockchip's RK805 PMIC.
> 
> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> ---
>  Documentation/devicetree/bindings/mfd/rk808.txt | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
> index 9636ae8d8d41..05eb07134483 100644
> --- a/Documentation/devicetree/bindings/mfd/rk808.txt
> +++ b/Documentation/devicetree/bindings/mfd/rk808.txt
> @@ -1,11 +1,12 @@
>  RK8XX Power Management Integrated Circuit
>  
>  The rk8xx family current members:
> +rk805
>  rk808
>  rk818
>  
>  Required properties:
> -- compatible: "rockchip,rk808", "rockchip,rk818"
> +- compatible: "rockchip,rk805", "rockchip,rk808", "rockchip,rk818"
>  - reg: I2C slave address
>  - interrupt-parent: The parent interrupt controller.
>  - interrupts: the interrupt outputs of the controller.
> @@ -18,6 +19,14 @@ Optional properties:
>  - rockchip,system-power-controller: Telling whether or not this pmic is controlling
>    the system power.
>  
> +Optional RK805 properties:
> +- vcc1-supply:  The input supply for DCDC_REG1
> +- vcc2-supply:  The input supply for DCDC_REG2
> +- vcc3-supply:  The input supply for DCDC_REG3
> +- vcc4-supply:  The input supply for DCDC_REG4
> +- vcc5-supply:  The input supply for LDO_REG1 and LDO_REG2
> +- vcc6-supply:  The input supply for LDO_REG3
> +
>  Optional RK808 properties:
>  - vcc1-supply:  The input supply for DCDC_REG1
>  - vcc2-supply:  The input supply for DCDC_REG2
> @@ -56,6 +65,15 @@ by a child node of the 'regulators' node.
>  		/* standard regulator bindings here */
>  	};
>  
> +Following regulators of the RK805 PMIC block are supported. Note that

"The following RK805 PMIC regulators are supported."

> +the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
> +number as described in RK805 datasheet.
> +
> +	- DCDC_REGn
> +		- valid values for n are 1 to 4.
> +	- LDO_REGn
> +		- valid values for n are 1 to 3
> +
>  Following regulators of the RK808 PMIC block are supported. Note that
>  the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
>  number as described in RK808 datasheet.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document
@ 2017-03-23 12:25     ` Lee Jones
  0 siblings, 0 replies; 31+ messages in thread
From: Lee Jones @ 2017-03-23 12:25 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ

On Fri, 17 Mar 2017, Elaine Zhang wrote:

> Add device tree bindings documentation for Rockchip's RK805 PMIC.
> 
> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/rk808.txt | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
> index 9636ae8d8d41..05eb07134483 100644
> --- a/Documentation/devicetree/bindings/mfd/rk808.txt
> +++ b/Documentation/devicetree/bindings/mfd/rk808.txt
> @@ -1,11 +1,12 @@
>  RK8XX Power Management Integrated Circuit
>  
>  The rk8xx family current members:
> +rk805
>  rk808
>  rk818
>  
>  Required properties:
> -- compatible: "rockchip,rk808", "rockchip,rk818"
> +- compatible: "rockchip,rk805", "rockchip,rk808", "rockchip,rk818"
>  - reg: I2C slave address
>  - interrupt-parent: The parent interrupt controller.
>  - interrupts: the interrupt outputs of the controller.
> @@ -18,6 +19,14 @@ Optional properties:
>  - rockchip,system-power-controller: Telling whether or not this pmic is controlling
>    the system power.
>  
> +Optional RK805 properties:
> +- vcc1-supply:  The input supply for DCDC_REG1
> +- vcc2-supply:  The input supply for DCDC_REG2
> +- vcc3-supply:  The input supply for DCDC_REG3
> +- vcc4-supply:  The input supply for DCDC_REG4
> +- vcc5-supply:  The input supply for LDO_REG1 and LDO_REG2
> +- vcc6-supply:  The input supply for LDO_REG3
> +
>  Optional RK808 properties:
>  - vcc1-supply:  The input supply for DCDC_REG1
>  - vcc2-supply:  The input supply for DCDC_REG2
> @@ -56,6 +65,15 @@ by a child node of the 'regulators' node.
>  		/* standard regulator bindings here */
>  	};
>  
> +Following regulators of the RK805 PMIC block are supported. Note that

"The following RK805 PMIC regulators are supported."

> +the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
> +number as described in RK805 datasheet.
> +
> +	- DCDC_REGn
> +		- valid values for n are 1 to 4.
> +	- LDO_REGn
> +		- valid values for n are 1 to 3
> +
>  Following regulators of the RK808 PMIC block are supported. Note that
>  the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
>  number as described in RK808 datasheet.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID
  2017-03-23 12:15     ` Lee Jones
@ 2017-03-24  2:22       ` Elaine Zhang
  -1 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-24  2:22 UTC (permalink / raw)
  To: Lee Jones
  Cc: lgirdwood, broonie, huangtao, xxx, linux-rockchip, linux-kernel,
	chenjh, robh+dt, mark.rutland, devicetree, w.egorov



On 03/23/2017 08:15 PM, Lee Jones wrote:
> On Fri, 17 Mar 2017, Elaine Zhang wrote:
>
>> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
>> ---
>>   include/linux/mfd/rk808.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 119 insertions(+)
>>
>> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
>> index 54feb140c210..a133309b52f9 100644
>> --- a/include/linux/mfd/rk808.h
>> +++ b/include/linux/mfd/rk808.h
>> @@ -206,6 +206,96 @@ enum rk818_reg {
>>   #define RK818_USB_ILMIN_2000MA		0x7
>>   #define RK818_USB_CHG_SD_VSEL_MASK	0x70
>>
>> +/* RK805 */
>> +enum rk805_reg {
>> +	RK805_ID_DCDC1,
>> +	RK805_ID_DCDC2,
>> +	RK805_ID_DCDC3,
>> +	RK805_ID_DCDC4,
>> +	RK805_ID_LDO1,
>> +	RK805_ID_LDO2,
>> +	RK805_ID_LDO3,
>> +};
>> +
>> +/* INTERRUPT REGISTER */
>> +#define RK805_INT_STS_REG		0x4C
>> +#define RK805_INT_STS_MSK_REG		0x4D
>> +#define RK805_GPIO_IO_POL_REG		0x50
>> +#define RK805_OUT_REG			0x52
>> +#define RK805_ON_SOURCE_REG		0xAE
>> +#define RK805_OFF_SOURCE_REG		0xAF
>> +
>> +/* POWER CHANNELS ENABLE REGISTER */
>> +#define RK805_DCDC_EN_REG		0x23
>> +#define RK805_SLP_DCDC_EN_REG		0x25
>> +#define RK805_SLP_LDO_EN_REG		0x26
>> +#define RK805_LDO_EN_REG		0x27
>> +
>> +/* CONFIG REGISTER */
>> +#define RK805_THERMAL_REG		0x22
>> +
>> +/* BUCK AND LDO CONFIG REGISTER */
>> +#define RK805_BUCK_LDO_SLP_LP_EN_REG	0x2A
>> +#define RK805_BUCK1_CONFIG_REG		0x2E
>> +#define RK805_BUCK1_ON_VSEL_REG		0x2F
>> +#define RK805_BUCK1_SLP_VSEL_REG	0x30
>> +#define RK805_BUCK2_CONFIG_REG		0x32
>> +#define RK805_BUCK2_ON_VSEL_REG		0x33
>> +#define RK805_BUCK2_SLP_VSEL_REG	0x34
>> +#define RK805_BUCK3_CONFIG_REG		0x36
>> +#define RK805_BUCK4_CONFIG_REG		0x37
>> +#define RK805_BUCK4_ON_VSEL_REG		0x38
>> +#define RK805_BUCK4_SLP_VSEL_REG	0x39
>> +#define RK805_LDO1_ON_VSEL_REG		0x3B
>> +#define RK805_LDO1_SLP_VSEL_REG		0x3C
>> +#define RK805_LDO2_ON_VSEL_REG		0x3D
>> +#define RK805_LDO2_SLP_VSEL_REG		0x3E
>> +#define RK805_LDO3_ON_VSEL_REG		0x3F
>> +#define RK805_LDO3_SLP_VSEL_REG		0x40
>> +#define RK805_OUT_REG			0x52
>> +#define RK805_ON_SOURCE_REG		0xAE
>> +#define RK805_OFF_SOURCE_REG		0xAF
>
> Why aren't all of these in numerical order?
I will fixed it in patch V5.
>
>> +#define RK805_NUM_REGULATORS		7
>> +
>> +#define RK805_PWRON_FALL_RISE_INT_EN	0x0
>> +#define RK805_PWRON_FALL_RISE_INT_MSK	0x81
>> +
>> +/* RK805 IRQ Definitions */
>> +#define RK805_IRQ_PWRON_RISE		0
>> +#define RK805_IRQ_VB_LOW		1
>> +#define RK805_IRQ_PWRON			2
>> +#define RK805_IRQ_PWRON_LP		3
>> +#define RK805_IRQ_HOTDIE		4
>> +#define RK805_IRQ_RTC_ALARM		5
>> +#define RK805_IRQ_RTC_PERIOD		6
>> +#define RK805_IRQ_PWRON_FALL		7
>> +
>> +#define RK805_IRQ_PWRON_RISE_MSK	BIT(0)
>> +#define RK805_IRQ_VB_LOW_MSK		BIT(1)
>> +#define RK805_IRQ_PWRON_MSK		BIT(2)
>> +#define RK805_IRQ_PWRON_LP_MSK		BIT(3)
>> +#define RK805_IRQ_HOTDIE_MSK		BIT(4)
>> +#define RK805_IRQ_RTC_ALARM_MSK		BIT(5)
>> +#define RK805_IRQ_RTC_PERIOD_MSK	BIT(6)
>> +#define RK805_IRQ_PWRON_FALL_MSK	BIT(7)
>> +
>> +#define RK805_PWR_RISE_INT_STATUS	BIT(0)
>> +#define RK805_VB_LOW_INT_STATUS		BIT(1)
>> +#define RK805_PWRON_INT_STATUS		BIT(2)
>> +#define RK805_PWRON_LP_INT_STATUS	BIT(3)
>> +#define RK805_HOTDIE_INT_STATUS		BIT(4)
>> +#define RK805_ALARM_INT_STATUS		BIT(5)
>> +#define RK805_PERIOD_INT_STATUS		BIT(6)
>> +#define RK805_PWR_FALL_INT_STATUS	BIT(7)
>> +
>> +#define RK805_BUCK1_2_ILMAX_MASK	(3 << 6)
>> +#define RK805_BUCK3_4_ILMAX_MASK        (3 << 3)
>> +#define RK805_RTC_PERIOD_INT_MASK	(1 << 6)
>> +#define RK805_RTC_ALARM_INT_MASK	(1 << 5)
>> +#define RK805_INT_ALARM_EN		(1 << 3)
>> +#define RK805_INT_TIMER_EN		(1 << 2)
>> +
>>   /* RK808 IRQ Definitions */
>>   #define RK808_IRQ_VOUT_LO	0
>>   #define RK808_IRQ_VB_LO		1
>> @@ -298,7 +388,14 @@ enum rk818_reg {
>>   #define VOUT_LO_INT	BIT(0)
>>   #define CLK32KOUT2_EN	BIT(0)
>>
>> +#define TEMP115C			0x0c
>> +#define TEMP_HOTDIE_MSK			0x0c
>> +#define SLP_SD_MSK			(0x3 << 2)
>> +#define SHUTDOWN_FUN			(0x2 << 2)
>> +#define SLEEP_FUN			(0x1 << 2)
>>   #define RK8XX_ID_MSK			0xfff0
>> +#define FPWM_MODE			BIT(7)
>> +
>>   enum {
>>   	BUCK_ILMIN_50MA,
>>   	BUCK_ILMIN_100MA,
>> @@ -322,6 +419,28 @@ enum {
>>   };
>>
>>   enum {
>> +	RK805_BUCK1_2_ILMAX_2500MA,
>> +	RK805_BUCK1_2_ILMAX_3000MA,
>> +	RK805_BUCK1_2_ILMAX_3500MA,
>> +	RK805_BUCK1_2_ILMAX_4000MA,
>> +};
>> +
>> +enum {
>> +	RK805_BUCK3_ILMAX_1500MA,
>> +	RK805_BUCK3_ILMAX_2000MA,
>> +	RK805_BUCK3_ILMAX_2500MA,
>> +	RK805_BUCK3_ILMAX_3000MA,
>> +};
>> +
>> +enum {
>> +	RK805_BUCK4_ILMAX_2000MA,
>> +	RK805_BUCK4_ILMAX_2500MA,
>> +	RK805_BUCK4_ILMAX_3000MA,
>> +	RK805_BUCK4_ILMAX_3500MA,
>> +};
>> +
>> +enum {
>> +	RK805_ID = 0x8050,
>>   	RK808_ID = 0x0000,
>>   	RK818_ID = 0x8181,
>>   };
>

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

* Re: [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID
@ 2017-03-24  2:22       ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-24  2:22 UTC (permalink / raw)
  To: Lee Jones
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ



On 03/23/2017 08:15 PM, Lee Jones wrote:
> On Fri, 17 Mar 2017, Elaine Zhang wrote:
>
>> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>> ---
>>   include/linux/mfd/rk808.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 119 insertions(+)
>>
>> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
>> index 54feb140c210..a133309b52f9 100644
>> --- a/include/linux/mfd/rk808.h
>> +++ b/include/linux/mfd/rk808.h
>> @@ -206,6 +206,96 @@ enum rk818_reg {
>>   #define RK818_USB_ILMIN_2000MA		0x7
>>   #define RK818_USB_CHG_SD_VSEL_MASK	0x70
>>
>> +/* RK805 */
>> +enum rk805_reg {
>> +	RK805_ID_DCDC1,
>> +	RK805_ID_DCDC2,
>> +	RK805_ID_DCDC3,
>> +	RK805_ID_DCDC4,
>> +	RK805_ID_LDO1,
>> +	RK805_ID_LDO2,
>> +	RK805_ID_LDO3,
>> +};
>> +
>> +/* INTERRUPT REGISTER */
>> +#define RK805_INT_STS_REG		0x4C
>> +#define RK805_INT_STS_MSK_REG		0x4D
>> +#define RK805_GPIO_IO_POL_REG		0x50
>> +#define RK805_OUT_REG			0x52
>> +#define RK805_ON_SOURCE_REG		0xAE
>> +#define RK805_OFF_SOURCE_REG		0xAF
>> +
>> +/* POWER CHANNELS ENABLE REGISTER */
>> +#define RK805_DCDC_EN_REG		0x23
>> +#define RK805_SLP_DCDC_EN_REG		0x25
>> +#define RK805_SLP_LDO_EN_REG		0x26
>> +#define RK805_LDO_EN_REG		0x27
>> +
>> +/* CONFIG REGISTER */
>> +#define RK805_THERMAL_REG		0x22
>> +
>> +/* BUCK AND LDO CONFIG REGISTER */
>> +#define RK805_BUCK_LDO_SLP_LP_EN_REG	0x2A
>> +#define RK805_BUCK1_CONFIG_REG		0x2E
>> +#define RK805_BUCK1_ON_VSEL_REG		0x2F
>> +#define RK805_BUCK1_SLP_VSEL_REG	0x30
>> +#define RK805_BUCK2_CONFIG_REG		0x32
>> +#define RK805_BUCK2_ON_VSEL_REG		0x33
>> +#define RK805_BUCK2_SLP_VSEL_REG	0x34
>> +#define RK805_BUCK3_CONFIG_REG		0x36
>> +#define RK805_BUCK4_CONFIG_REG		0x37
>> +#define RK805_BUCK4_ON_VSEL_REG		0x38
>> +#define RK805_BUCK4_SLP_VSEL_REG	0x39
>> +#define RK805_LDO1_ON_VSEL_REG		0x3B
>> +#define RK805_LDO1_SLP_VSEL_REG		0x3C
>> +#define RK805_LDO2_ON_VSEL_REG		0x3D
>> +#define RK805_LDO2_SLP_VSEL_REG		0x3E
>> +#define RK805_LDO3_ON_VSEL_REG		0x3F
>> +#define RK805_LDO3_SLP_VSEL_REG		0x40
>> +#define RK805_OUT_REG			0x52
>> +#define RK805_ON_SOURCE_REG		0xAE
>> +#define RK805_OFF_SOURCE_REG		0xAF
>
> Why aren't all of these in numerical order?
I will fixed it in patch V5.
>
>> +#define RK805_NUM_REGULATORS		7
>> +
>> +#define RK805_PWRON_FALL_RISE_INT_EN	0x0
>> +#define RK805_PWRON_FALL_RISE_INT_MSK	0x81
>> +
>> +/* RK805 IRQ Definitions */
>> +#define RK805_IRQ_PWRON_RISE		0
>> +#define RK805_IRQ_VB_LOW		1
>> +#define RK805_IRQ_PWRON			2
>> +#define RK805_IRQ_PWRON_LP		3
>> +#define RK805_IRQ_HOTDIE		4
>> +#define RK805_IRQ_RTC_ALARM		5
>> +#define RK805_IRQ_RTC_PERIOD		6
>> +#define RK805_IRQ_PWRON_FALL		7
>> +
>> +#define RK805_IRQ_PWRON_RISE_MSK	BIT(0)
>> +#define RK805_IRQ_VB_LOW_MSK		BIT(1)
>> +#define RK805_IRQ_PWRON_MSK		BIT(2)
>> +#define RK805_IRQ_PWRON_LP_MSK		BIT(3)
>> +#define RK805_IRQ_HOTDIE_MSK		BIT(4)
>> +#define RK805_IRQ_RTC_ALARM_MSK		BIT(5)
>> +#define RK805_IRQ_RTC_PERIOD_MSK	BIT(6)
>> +#define RK805_IRQ_PWRON_FALL_MSK	BIT(7)
>> +
>> +#define RK805_PWR_RISE_INT_STATUS	BIT(0)
>> +#define RK805_VB_LOW_INT_STATUS		BIT(1)
>> +#define RK805_PWRON_INT_STATUS		BIT(2)
>> +#define RK805_PWRON_LP_INT_STATUS	BIT(3)
>> +#define RK805_HOTDIE_INT_STATUS		BIT(4)
>> +#define RK805_ALARM_INT_STATUS		BIT(5)
>> +#define RK805_PERIOD_INT_STATUS		BIT(6)
>> +#define RK805_PWR_FALL_INT_STATUS	BIT(7)
>> +
>> +#define RK805_BUCK1_2_ILMAX_MASK	(3 << 6)
>> +#define RK805_BUCK3_4_ILMAX_MASK        (3 << 3)
>> +#define RK805_RTC_PERIOD_INT_MASK	(1 << 6)
>> +#define RK805_RTC_ALARM_INT_MASK	(1 << 5)
>> +#define RK805_INT_ALARM_EN		(1 << 3)
>> +#define RK805_INT_TIMER_EN		(1 << 2)
>> +
>>   /* RK808 IRQ Definitions */
>>   #define RK808_IRQ_VOUT_LO	0
>>   #define RK808_IRQ_VB_LO		1
>> @@ -298,7 +388,14 @@ enum rk818_reg {
>>   #define VOUT_LO_INT	BIT(0)
>>   #define CLK32KOUT2_EN	BIT(0)
>>
>> +#define TEMP115C			0x0c
>> +#define TEMP_HOTDIE_MSK			0x0c
>> +#define SLP_SD_MSK			(0x3 << 2)
>> +#define SHUTDOWN_FUN			(0x2 << 2)
>> +#define SLEEP_FUN			(0x1 << 2)
>>   #define RK8XX_ID_MSK			0xfff0
>> +#define FPWM_MODE			BIT(7)
>> +
>>   enum {
>>   	BUCK_ILMIN_50MA,
>>   	BUCK_ILMIN_100MA,
>> @@ -322,6 +419,28 @@ enum {
>>   };
>>
>>   enum {
>> +	RK805_BUCK1_2_ILMAX_2500MA,
>> +	RK805_BUCK1_2_ILMAX_3000MA,
>> +	RK805_BUCK1_2_ILMAX_3500MA,
>> +	RK805_BUCK1_2_ILMAX_4000MA,
>> +};
>> +
>> +enum {
>> +	RK805_BUCK3_ILMAX_1500MA,
>> +	RK805_BUCK3_ILMAX_2000MA,
>> +	RK805_BUCK3_ILMAX_2500MA,
>> +	RK805_BUCK3_ILMAX_3000MA,
>> +};
>> +
>> +enum {
>> +	RK805_BUCK4_ILMAX_2000MA,
>> +	RK805_BUCK4_ILMAX_2500MA,
>> +	RK805_BUCK4_ILMAX_3000MA,
>> +	RK805_BUCK4_ILMAX_3500MA,
>> +};
>> +
>> +enum {
>> +	RK805_ID = 0x8050,
>>   	RK808_ID = 0x0000,
>>   	RK818_ID = 0x8181,
>>   };
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 4/7] mfd: rk808: Add RK805 support
  2017-03-23 12:23     ` Lee Jones
@ 2017-03-24  2:28       ` Elaine Zhang
  -1 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-24  2:28 UTC (permalink / raw)
  To: Lee Jones
  Cc: lgirdwood, broonie, huangtao, xxx, linux-rockchip, linux-kernel,
	chenjh, robh+dt, mark.rutland, devicetree, w.egorov



On 03/23/2017 08:23 PM, Lee Jones wrote:
> On Fri, 17 Mar 2017, Elaine Zhang wrote:
>
>> The RK805 chip is a Power Management IC (PMIC) for multimedia and handheld
>> devices. It contains the following components:
>>
>>      - Regulators
>>      - RTC
>>      - Clocking
>>
>> Both RK808 and RK805 chips are using a similar register map,
>> so we can reuse the RTC and Clocking functionality.
>>
>> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
>> ---
>>   drivers/mfd/Kconfig |   4 +-
>>   drivers/mfd/rk808.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 124 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 55ecdfb74d31..b410a348b756 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -892,13 +892,13 @@ config MFD_RC5T583
>>   	  different functionality of the device.
>>
>>   config MFD_RK808
>> -	tristate "Rockchip RK808/RK818 Power Management Chip"
>> +	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
>>   	depends on I2C && OF
>>   	select MFD_CORE
>>   	select REGMAP_I2C
>>   	select REGMAP_IRQ
>>   	help
>> -	  If you say yes here you get support for the RK808 and RK818
>> +	  If you say yes here you get support for the RK805, RK808 and RK818
>>   	  Power Management chips.
>>   	  This driver provides common support for accessing the device
>>   	  through I2C interface. The device supports multiple sub-devices
>> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
>> index 3334a2a7f3fb..fdd4449b14b0 100644
>> --- a/drivers/mfd/rk808.c
>> +++ b/drivers/mfd/rk808.c
>> @@ -70,6 +70,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	.volatile_reg = rk808_is_volatile_reg,
>>   };
>>
>> +static const struct regmap_config rk805_regmap_config = {
>> +	.reg_bits = 8,
>> +	.val_bits = 8,
>> +	.max_register = RK805_OFF_SOURCE_REG,
>> +	.cache_type = REGCACHE_RBTREE,
>> +	.volatile_reg = rk808_is_volatile_reg,
>> +};
>> +
>>   static const struct regmap_config rk808_regmap_config = {
>>   	.reg_bits = 8,
>>   	.val_bits = 8,
>> @@ -86,6 +94,16 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	}
>>   };
>>
>> +static const struct mfd_cell rk805s[] = {
>> +	{ .name = "rk808-clkout", },
>> +	{ .name = "rk808-regulator", },
>> +	{
>> +		.name = "rk808-rtc",
>> +		.num_resources = ARRAY_SIZE(rtc_resources),
>> +		.resources = &rtc_resources[0],
>> +	},
>> +};
>> +
>>   static const struct mfd_cell rk808s[] = {
>>   	{ .name = "rk808-clkout", },
>>   	{ .name = "rk808-regulator", },
>> @@ -106,6 +124,20 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	},
>>   };
>>
>> +static const struct rk808_reg_data rk805_pre_init_reg[] = {
>> +	{RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
>> +				 RK805_BUCK1_2_ILMAX_4000MA},
>> +	{RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
>> +				 RK805_BUCK1_2_ILMAX_4000MA},
>> +	{RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
>> +				 RK805_BUCK3_ILMAX_3000MA},
>> +	{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
>> +				 RK805_BUCK4_ILMAX_3500MA},
>> +	{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
>> +	{RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
>> +	{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
>> +};
>> +
>>   static const struct rk808_reg_data rk808_pre_init_reg[] = {
>>   	{ RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_150MA },
>>   	{ RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_200MA },
>> @@ -135,6 +167,41 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   						    VB_LO_SEL_3500MV },
>>   };
>>
>> +static const struct regmap_irq rk805_irqs[] = {
>> +	[RK805_IRQ_PWRON_RISE] = {
>> +		.mask = RK805_IRQ_PWRON_RISE_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_VB_LOW] = {
>> +		.mask = RK805_IRQ_VB_LOW_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_PWRON] = {
>> +		.mask = RK805_IRQ_PWRON_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_PWRON_LP] = {
>> +		.mask = RK805_IRQ_PWRON_LP_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_HOTDIE] = {
>> +		.mask = RK805_IRQ_HOTDIE_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_RTC_ALARM] = {
>> +		.mask = RK805_IRQ_RTC_ALARM_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_RTC_PERIOD] = {
>> +		.mask = RK805_IRQ_RTC_PERIOD_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_PWRON_FALL] = {
>> +		.mask = RK805_IRQ_PWRON_FALL_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +};
>> +
>>   static const struct regmap_irq rk808_irqs[] = {
>>   	/* INT_STS */
>>   	[RK808_IRQ_VOUT_LO] = {
>> @@ -247,6 +314,17 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	},
>>   };
>>
>> +static struct regmap_irq_chip rk805_irq_chip = {
>> +	.name = "rk805",
>> +	.irqs = rk805_irqs,
>> +	.num_irqs = ARRAY_SIZE(rk805_irqs),
>> +	.num_regs = 1,
>> +	.status_base = RK805_INT_STS_REG,
>> +	.mask_base = RK805_INT_STS_MSK_REG,
>> +	.ack_base = RK805_INT_STS_REG,
>> +	.init_ack_masked = true,
>> +};
>> +
>>   static const struct regmap_irq_chip rk808_irq_chip = {
>>   	.name = "rk808",
>>   	.irqs = rk808_irqs,
>> @@ -272,6 +350,38 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   };
>>
>>   static struct i2c_client *rk808_i2c_client;
>> +
>> +static void rk805_shutdown_prepare(void)
>> +{
>> +	int ret;
>> +	struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
>
> Nit: Can you switch these two around?
>
>> +	if (!rk808) {
>> +		dev_warn(&rk808_i2c_client->dev,
>> +			 "have no rk808, so do nothing here\n");
>> +		return;
>> +	}
This is follow the rk808 and rk818 device_shutdown func.Check the rk808 
whether NULL.
>
> What's happening here?  Is it possible for rk808 to be NULL?  If so,
> under what circumstances can this happen?  And is that truly an error?
>
>> +	/* close rtc int when power off */
>
> Use proper grammar, "Close RTC".
>
> What is int?  I'm guessing you mean either "interrupt" or "IRQ".
>
>> +	regmap_update_bits(rk808->regmap,
>> +			   RK808_INT_STS_MSK_REG1,
>
> "when power off" should either be "when we power off", "during
> power off", or something of that nature.
>
>> +			   RK805_RTC_PERIOD_INT_MASK |
>> +			   RK805_RTC_ALARM_INT_MASK,
>> +			   RK805_RTC_PERIOD_INT_MASK |
>> +			   RK805_RTC_ALARM_INT_MASK);
>> +	regmap_update_bits(rk808->regmap,
>> +			   RK808_RTC_INT_REG,
>> +			   RK805_INT_ALARM_EN | RK805_INT_TIMER_EN,
>> +			   0);
>> +
>> +	/* pmic sleep shutdown function */
>
> "PMIC"
>
> 'sleep' or 'shutdown' can't be both.
>
> Looks like shutdown to me.
>
I will fixed it in patch V5. Write dev_off directly to shutdown the 
rk805 device.
>> +	ret = regmap_update_bits(rk808->regmap,
>> +				 RK805_GPIO_IO_POL_REG,
>> +				 SLP_SD_MSK, SHUTDOWN_FUN);
>> +	if (ret)
>> +		dev_err(&rk808_i2c_client->dev, "power off error!\n");
>> +}
>> +
>>   static void rk808_device_shutdown(void)
>>   {
>>   	int ret;
>> @@ -309,6 +419,7 @@ static void rk818_device_shutdown(void)
>>   }
>>
>>   static const struct of_device_id rk808_of_match[] = {
>> +	{ .compatible = "rockchip,rk805" },
>>   	{ .compatible = "rockchip,rk808" },
>>   	{ .compatible = "rockchip,rk818" },
>>   	{ },
>> @@ -323,6 +434,7 @@ static int rk808_probe(struct i2c_client *client,
>>   	const struct rk808_reg_data *pre_init_reg;
>>   	const struct mfd_cell *cells;
>>   	void (*pm_pwroff_fn)(void);
>> +	void (*pm_shutdown_prepare_fn)(void);
>>   	int nr_pre_init_regs;
>>   	int nr_cells;
>>   	int pm_off = 0, msb, lsb;
>> @@ -352,6 +464,15 @@ static int rk808_probe(struct i2c_client *client,
>>   	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
>>
>>   	switch (rk808->variant) {
>> +	case RK805_ID:
>> +		rk808->regmap_cfg = &rk805_regmap_config;
>> +		rk808->regmap_irq_chip = &rk805_irq_chip;
>> +		pre_init_reg = rk805_pre_init_reg;
>> +		nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
>> +		cells = rk805s;
>> +		nr_cells = ARRAY_SIZE(rk805s);
>> +		pm_shutdown_prepare_fn = rk805_shutdown_prepare;
>> +		break;
>>   	case RK808_ID:
>>   		rk808->regmap_cfg = &rk808_regmap_config;
>>   		rk808->regmap_irq_chip = &rk808_irq_chip;
>> @@ -444,6 +565,7 @@ static int rk808_remove(struct i2c_client *client)
>>   }
>>
>>   static const struct i2c_device_id rk808_ids[] = {
>> +	{ "rk805" },
>>   	{ "rk808" },
>>   	{ "rk818" },
>>   	{ },
>

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

* Re: [PATCH v4 4/7] mfd: rk808: Add RK805 support
@ 2017-03-24  2:28       ` Elaine Zhang
  0 siblings, 0 replies; 31+ messages in thread
From: Elaine Zhang @ 2017-03-24  2:28 UTC (permalink / raw)
  To: Lee Jones
  Cc: lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ



On 03/23/2017 08:23 PM, Lee Jones wrote:
> On Fri, 17 Mar 2017, Elaine Zhang wrote:
>
>> The RK805 chip is a Power Management IC (PMIC) for multimedia and handheld
>> devices. It contains the following components:
>>
>>      - Regulators
>>      - RTC
>>      - Clocking
>>
>> Both RK808 and RK805 chips are using a similar register map,
>> so we can reuse the RTC and Clocking functionality.
>>
>> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>> ---
>>   drivers/mfd/Kconfig |   4 +-
>>   drivers/mfd/rk808.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 124 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 55ecdfb74d31..b410a348b756 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -892,13 +892,13 @@ config MFD_RC5T583
>>   	  different functionality of the device.
>>
>>   config MFD_RK808
>> -	tristate "Rockchip RK808/RK818 Power Management Chip"
>> +	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
>>   	depends on I2C && OF
>>   	select MFD_CORE
>>   	select REGMAP_I2C
>>   	select REGMAP_IRQ
>>   	help
>> -	  If you say yes here you get support for the RK808 and RK818
>> +	  If you say yes here you get support for the RK805, RK808 and RK818
>>   	  Power Management chips.
>>   	  This driver provides common support for accessing the device
>>   	  through I2C interface. The device supports multiple sub-devices
>> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
>> index 3334a2a7f3fb..fdd4449b14b0 100644
>> --- a/drivers/mfd/rk808.c
>> +++ b/drivers/mfd/rk808.c
>> @@ -70,6 +70,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	.volatile_reg = rk808_is_volatile_reg,
>>   };
>>
>> +static const struct regmap_config rk805_regmap_config = {
>> +	.reg_bits = 8,
>> +	.val_bits = 8,
>> +	.max_register = RK805_OFF_SOURCE_REG,
>> +	.cache_type = REGCACHE_RBTREE,
>> +	.volatile_reg = rk808_is_volatile_reg,
>> +};
>> +
>>   static const struct regmap_config rk808_regmap_config = {
>>   	.reg_bits = 8,
>>   	.val_bits = 8,
>> @@ -86,6 +94,16 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	}
>>   };
>>
>> +static const struct mfd_cell rk805s[] = {
>> +	{ .name = "rk808-clkout", },
>> +	{ .name = "rk808-regulator", },
>> +	{
>> +		.name = "rk808-rtc",
>> +		.num_resources = ARRAY_SIZE(rtc_resources),
>> +		.resources = &rtc_resources[0],
>> +	},
>> +};
>> +
>>   static const struct mfd_cell rk808s[] = {
>>   	{ .name = "rk808-clkout", },
>>   	{ .name = "rk808-regulator", },
>> @@ -106,6 +124,20 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	},
>>   };
>>
>> +static const struct rk808_reg_data rk805_pre_init_reg[] = {
>> +	{RK805_BUCK1_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
>> +				 RK805_BUCK1_2_ILMAX_4000MA},
>> +	{RK805_BUCK2_CONFIG_REG, RK805_BUCK1_2_ILMAX_MASK,
>> +				 RK805_BUCK1_2_ILMAX_4000MA},
>> +	{RK805_BUCK3_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
>> +				 RK805_BUCK3_ILMAX_3000MA},
>> +	{RK805_BUCK4_CONFIG_REG, RK805_BUCK3_4_ILMAX_MASK,
>> +				 RK805_BUCK4_ILMAX_3500MA},
>> +	{RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
>> +	{RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
>> +	{RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
>> +};
>> +
>>   static const struct rk808_reg_data rk808_pre_init_reg[] = {
>>   	{ RK808_BUCK3_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_150MA },
>>   	{ RK808_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_200MA },
>> @@ -135,6 +167,41 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   						    VB_LO_SEL_3500MV },
>>   };
>>
>> +static const struct regmap_irq rk805_irqs[] = {
>> +	[RK805_IRQ_PWRON_RISE] = {
>> +		.mask = RK805_IRQ_PWRON_RISE_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_VB_LOW] = {
>> +		.mask = RK805_IRQ_VB_LOW_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_PWRON] = {
>> +		.mask = RK805_IRQ_PWRON_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_PWRON_LP] = {
>> +		.mask = RK805_IRQ_PWRON_LP_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_HOTDIE] = {
>> +		.mask = RK805_IRQ_HOTDIE_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_RTC_ALARM] = {
>> +		.mask = RK805_IRQ_RTC_ALARM_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_RTC_PERIOD] = {
>> +		.mask = RK805_IRQ_RTC_PERIOD_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +	[RK805_IRQ_PWRON_FALL] = {
>> +		.mask = RK805_IRQ_PWRON_FALL_MSK,
>> +		.reg_offset = 0,
>> +	},
>> +};
>> +
>>   static const struct regmap_irq rk808_irqs[] = {
>>   	/* INT_STS */
>>   	[RK808_IRQ_VOUT_LO] = {
>> @@ -247,6 +314,17 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   	},
>>   };
>>
>> +static struct regmap_irq_chip rk805_irq_chip = {
>> +	.name = "rk805",
>> +	.irqs = rk805_irqs,
>> +	.num_irqs = ARRAY_SIZE(rk805_irqs),
>> +	.num_regs = 1,
>> +	.status_base = RK805_INT_STS_REG,
>> +	.mask_base = RK805_INT_STS_MSK_REG,
>> +	.ack_base = RK805_INT_STS_REG,
>> +	.init_ack_masked = true,
>> +};
>> +
>>   static const struct regmap_irq_chip rk808_irq_chip = {
>>   	.name = "rk808",
>>   	.irqs = rk808_irqs,
>> @@ -272,6 +350,38 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
>>   };
>>
>>   static struct i2c_client *rk808_i2c_client;
>> +
>> +static void rk805_shutdown_prepare(void)
>> +{
>> +	int ret;
>> +	struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
>
> Nit: Can you switch these two around?
>
>> +	if (!rk808) {
>> +		dev_warn(&rk808_i2c_client->dev,
>> +			 "have no rk808, so do nothing here\n");
>> +		return;
>> +	}
This is follow the rk808 and rk818 device_shutdown func.Check the rk808 
whether NULL.
>
> What's happening here?  Is it possible for rk808 to be NULL?  If so,
> under what circumstances can this happen?  And is that truly an error?
>
>> +	/* close rtc int when power off */
>
> Use proper grammar, "Close RTC".
>
> What is int?  I'm guessing you mean either "interrupt" or "IRQ".
>
>> +	regmap_update_bits(rk808->regmap,
>> +			   RK808_INT_STS_MSK_REG1,
>
> "when power off" should either be "when we power off", "during
> power off", or something of that nature.
>
>> +			   RK805_RTC_PERIOD_INT_MASK |
>> +			   RK805_RTC_ALARM_INT_MASK,
>> +			   RK805_RTC_PERIOD_INT_MASK |
>> +			   RK805_RTC_ALARM_INT_MASK);
>> +	regmap_update_bits(rk808->regmap,
>> +			   RK808_RTC_INT_REG,
>> +			   RK805_INT_ALARM_EN | RK805_INT_TIMER_EN,
>> +			   0);
>> +
>> +	/* pmic sleep shutdown function */
>
> "PMIC"
>
> 'sleep' or 'shutdown' can't be both.
>
> Looks like shutdown to me.
>
I will fixed it in patch V5. Write dev_off directly to shutdown the 
rk805 device.
>> +	ret = regmap_update_bits(rk808->regmap,
>> +				 RK805_GPIO_IO_POL_REG,
>> +				 SLP_SD_MSK, SHUTDOWN_FUN);
>> +	if (ret)
>> +		dev_err(&rk808_i2c_client->dev, "power off error!\n");
>> +}
>> +
>>   static void rk808_device_shutdown(void)
>>   {
>>   	int ret;
>> @@ -309,6 +419,7 @@ static void rk818_device_shutdown(void)
>>   }
>>
>>   static const struct of_device_id rk808_of_match[] = {
>> +	{ .compatible = "rockchip,rk805" },
>>   	{ .compatible = "rockchip,rk808" },
>>   	{ .compatible = "rockchip,rk818" },
>>   	{ },
>> @@ -323,6 +434,7 @@ static int rk808_probe(struct i2c_client *client,
>>   	const struct rk808_reg_data *pre_init_reg;
>>   	const struct mfd_cell *cells;
>>   	void (*pm_pwroff_fn)(void);
>> +	void (*pm_shutdown_prepare_fn)(void);
>>   	int nr_pre_init_regs;
>>   	int nr_cells;
>>   	int pm_off = 0, msb, lsb;
>> @@ -352,6 +464,15 @@ static int rk808_probe(struct i2c_client *client,
>>   	dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
>>
>>   	switch (rk808->variant) {
>> +	case RK805_ID:
>> +		rk808->regmap_cfg = &rk805_regmap_config;
>> +		rk808->regmap_irq_chip = &rk805_irq_chip;
>> +		pre_init_reg = rk805_pre_init_reg;
>> +		nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg);
>> +		cells = rk805s;
>> +		nr_cells = ARRAY_SIZE(rk805s);
>> +		pm_shutdown_prepare_fn = rk805_shutdown_prepare;
>> +		break;
>>   	case RK808_ID:
>>   		rk808->regmap_cfg = &rk808_regmap_config;
>>   		rk808->regmap_irq_chip = &rk808_irq_chip;
>> @@ -444,6 +565,7 @@ static int rk808_remove(struct i2c_client *client)
>>   }
>>
>>   static const struct i2c_device_id rk808_ids[] = {
>> +	{ "rk805" },
>>   	{ "rk808" },
>>   	{ "rk818" },
>>   	{ },
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document
@ 2017-03-24  2:38     ` Rob Herring
  0 siblings, 0 replies; 31+ messages in thread
From: Rob Herring @ 2017-03-24  2:38 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lee.jones, lgirdwood, broonie, huangtao, xxx, linux-rockchip,
	linux-kernel, chenjh, mark.rutland, devicetree, w.egorov

On Fri, Mar 17, 2017 at 03:08:45PM +0800, Elaine Zhang wrote:
> Add device tree bindings documentation for Rockchip's RK805 PMIC.
> 
> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> ---
>  Documentation/devicetree/bindings/mfd/rk808.txt | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
> index 9636ae8d8d41..05eb07134483 100644
> --- a/Documentation/devicetree/bindings/mfd/rk808.txt
> +++ b/Documentation/devicetree/bindings/mfd/rk808.txt
> @@ -1,11 +1,12 @@
>  RK8XX Power Management Integrated Circuit
>  
>  The rk8xx family current members:
> +rk805
>  rk808
>  rk818
>  
>  Required properties:
> -- compatible: "rockchip,rk808", "rockchip,rk818"
> +- compatible: "rockchip,rk805", "rockchip,rk808", "rockchip,rk818"

Please make this one valid combination per line

>  - reg: I2C slave address
>  - interrupt-parent: The parent interrupt controller.
>  - interrupts: the interrupt outputs of the controller.
> @@ -18,6 +19,14 @@ Optional properties:
>  - rockchip,system-power-controller: Telling whether or not this pmic is controlling
>    the system power.
>  
> +Optional RK805 properties:
> +- vcc1-supply:  The input supply for DCDC_REG1
> +- vcc2-supply:  The input supply for DCDC_REG2
> +- vcc3-supply:  The input supply for DCDC_REG3
> +- vcc4-supply:  The input supply for DCDC_REG4
> +- vcc5-supply:  The input supply for LDO_REG1 and LDO_REG2
> +- vcc6-supply:  The input supply for LDO_REG3
> +
>  Optional RK808 properties:
>  - vcc1-supply:  The input supply for DCDC_REG1
>  - vcc2-supply:  The input supply for DCDC_REG2
> @@ -56,6 +65,15 @@ by a child node of the 'regulators' node.
>  		/* standard regulator bindings here */
>  	};
>  
> +Following regulators of the RK805 PMIC block are supported. Note that
> +the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
> +number as described in RK805 datasheet.
> +
> +	- DCDC_REGn
> +		- valid values for n are 1 to 4.
> +	- LDO_REGn
> +		- valid values for n are 1 to 3
> +
>  Following regulators of the RK808 PMIC block are supported. Note that
>  the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
>  number as described in RK808 datasheet.
> -- 
> 1.9.1
> 
> 

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

* Re: [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document
@ 2017-03-24  2:38     ` Rob Herring
  0 siblings, 0 replies; 31+ messages in thread
From: Rob Herring @ 2017-03-24  2:38 UTC (permalink / raw)
  To: Elaine Zhang
  Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	chenjh-TNX95d0MmH7DzftRWevZcw, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	w.egorov-guT5V/WYfQezQB+pC5nmwQ

On Fri, Mar 17, 2017 at 03:08:45PM +0800, Elaine Zhang wrote:
> Add device tree bindings documentation for Rockchip's RK805 PMIC.
> 
> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/rk808.txt | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
> index 9636ae8d8d41..05eb07134483 100644
> --- a/Documentation/devicetree/bindings/mfd/rk808.txt
> +++ b/Documentation/devicetree/bindings/mfd/rk808.txt
> @@ -1,11 +1,12 @@
>  RK8XX Power Management Integrated Circuit
>  
>  The rk8xx family current members:
> +rk805
>  rk808
>  rk818
>  
>  Required properties:
> -- compatible: "rockchip,rk808", "rockchip,rk818"
> +- compatible: "rockchip,rk805", "rockchip,rk808", "rockchip,rk818"

Please make this one valid combination per line

>  - reg: I2C slave address
>  - interrupt-parent: The parent interrupt controller.
>  - interrupts: the interrupt outputs of the controller.
> @@ -18,6 +19,14 @@ Optional properties:
>  - rockchip,system-power-controller: Telling whether or not this pmic is controlling
>    the system power.
>  
> +Optional RK805 properties:
> +- vcc1-supply:  The input supply for DCDC_REG1
> +- vcc2-supply:  The input supply for DCDC_REG2
> +- vcc3-supply:  The input supply for DCDC_REG3
> +- vcc4-supply:  The input supply for DCDC_REG4
> +- vcc5-supply:  The input supply for LDO_REG1 and LDO_REG2
> +- vcc6-supply:  The input supply for LDO_REG3
> +
>  Optional RK808 properties:
>  - vcc1-supply:  The input supply for DCDC_REG1
>  - vcc2-supply:  The input supply for DCDC_REG2
> @@ -56,6 +65,15 @@ by a child node of the 'regulators' node.
>  		/* standard regulator bindings here */
>  	};
>  
> +Following regulators of the RK805 PMIC block are supported. Note that
> +the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
> +number as described in RK805 datasheet.
> +
> +	- DCDC_REGn
> +		- valid values for n are 1 to 4.
> +	- LDO_REGn
> +		- valid values for n are 1 to 3
> +
>  Following regulators of the RK808 PMIC block are supported. Note that
>  the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
>  number as described in RK808 datasheet.
> -- 
> 1.9.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-03-24  2:38 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17  7:06 [PATCH v4 0/7] rk808: Add RK805 support Elaine Zhang
2017-03-17  7:06 ` [PATCH v4 1/7] mfd: rk808: fix up the chip id get failed Elaine Zhang
2017-03-17  7:06   ` Elaine Zhang
2017-03-23 12:14   ` Lee Jones
2017-03-23 12:14     ` Lee Jones
2017-03-17  7:06 ` [PATCH v4 2/7] mfd: rk808: add rk805 regs addr and ID Elaine Zhang
2017-03-17  7:06   ` Elaine Zhang
2017-03-23 12:15   ` Lee Jones
2017-03-23 12:15     ` Lee Jones
2017-03-24  2:22     ` Elaine Zhang
2017-03-24  2:22       ` Elaine Zhang
2017-03-17  7:06 ` [PATCH v4 3/7] regulator: rk808: Add regulator driver for RK805 Elaine Zhang
2017-03-17  7:06   ` Elaine Zhang
2017-03-17  7:06 ` [PATCH v4 4/7] mfd: rk808: Add RK805 support Elaine Zhang
2017-03-17  7:06   ` Elaine Zhang
2017-03-20  0:19   ` kbuild test robot
2017-03-20  0:19     ` kbuild test robot
2017-03-23 12:23   ` Lee Jones
2017-03-23 12:23     ` Lee Jones
2017-03-24  2:28     ` Elaine Zhang
2017-03-24  2:28       ` Elaine Zhang
2017-03-17  7:08 ` [PATCH v4 5/7] clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808 Elaine Zhang
2017-03-17  7:08   ` Elaine Zhang
2017-03-17  7:08 ` [PATCH v4 6/7] rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808 Elaine Zhang
2017-03-17  7:08   ` Elaine Zhang
2017-03-17  7:08 ` [PATCH v4 7/7] mfd: dt-bindings: Add RK805 device tree bindings document Elaine Zhang
2017-03-17  7:08   ` Elaine Zhang
2017-03-23 12:25   ` Lee Jones
2017-03-23 12:25     ` Lee Jones
2017-03-24  2:38   ` Rob Herring
2017-03-24  2:38     ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.