Skip to contentSkip to conversation

support a new type of PMIC,including two chips(rk817 and rk809)

PATCH Applied Tony Xie 3 participants 13 messages Jan 2, 2019 – Apr 25, 2019

Subsystems (6)

v7 of 10 Applied Latest is v10 →

lore
Share & tools
lore

Tony Xie

author
#0 lore raw

v7 cover support a new type of PMIC,including two chips(rk817 and rk809)

Most of functions and registers of the rk817 and rk808 are the same, so they can share allmost all codes.

Their specifications are as follows:
1) The RK809 and RK809 consist of 5 DCDCs, 9 LDOs and have the same
registers
for these components except dcdc5.
2) The dcdc5 is a boost dcdc for RK817 and is a buck for RK809.
3) The RK817 has one switch but The Rk809 has two.

Changes in V2:
1. initialize the pm_pwroff_fn to NULL.
2. use EXPORT_SYMBOL_GPL to export pm_power_off_prepare.
3. change patch 2/3/4/5 subjects.

Changes in V3
1. change patch 4 subjects
2. replace pr_ with dev_ for printing in patch 2
3. modify switch1 and switch2 configs in patch 2
4. explain gpio information for rk809 and rk817 in patch 4

Changes in V4:
1. modify some codes for patch 2 and patch 5 according to comments
2. add reviewer mail lists for patch 3 and 4

Changes in V5:
modify some codes for patch 1 according to reveiw comments for v3.
1) remove the pm_power_off_prepare() and replace with shutdown
call-back from syscore
2) move the macro REGMAP_IRQ_M into the regmap.h and rename it
REGMAP_IRQ_LINE
3) make some dev_warn() log clear

Changes in V6:
modify some codes according to reveiw comments for v5.

Changes in V7:
modify some codes for patch 2 according to reveiw comments.

Tony Xie (6):
mfd: rk808: remove the id_table
mfd: rk808: Add RK817 and RK809 support
regulator: rk808: add RK809 and RK817 support.
dt-bindings: mfd: rk808: Add binding information for RK809 and RK817.
rtc: rk808: add RK809 and RK817 support.
clk: RK808: add RK809 and RK817 support.

 .../devicetree/bindings/mfd/rk808.txt         |  44 ++
 drivers/clk/Kconfig                           |   9 +-
 drivers/clk/clk-rk808.c                       |  64 +-
 drivers/mfd/Kconfig                           |   6 +-
 drivers/mfd/rk808.c                           | 199 +++++-
 drivers/regulator/Kconfig                     |   4 +-
 drivers/regulator/rk808-regulator.c           | 657 +++++++++++++++++-
 drivers/rtc/Kconfig                           |   4 +-
 drivers/rtc/rtc-rk808.c                       |  68 +-
 include/linux/mfd/rk808.h                     | 175 +++++
 10 files changed, 1164 insertions(+), 66 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v7 1/6 mfd: rk808: remove the id_table

Remove the id_table because it's not used.

---
 drivers/mfd/rk808.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/mfd/rk808.c +0 -9
index 216fbf6adec9..94377782d208 100644
@@ -568,14 +568,6 @@ static int rk808_remove(struct i2c_client *client)
 	return 0;
 }
 
-static const struct i2c_device_id rk808_ids[] = {
-	{ "rk805" },
-	{ "rk808" },
-	{ "rk818" },
-	{ },
-};
-MODULE_DEVICE_TABLE(i2c, rk808_ids);
-
 static struct i2c_driver rk808_i2c_driver = {
 	.driver = {
 		.name = "rk808",
@@ -583,7 +575,6 @@ static struct i2c_driver rk808_i2c_driver = {
 	},
 	.probe    = rk808_probe,
 	.remove   = rk808_remove,
-	.id_table = rk808_ids,
 };
 
 module_i2c_driver(rk808_i2c_driver);
Signature · 1 line
2.17.1
Applied
#2 lore raw

Re: [PATCH v7 1/6] mfd: rk808: remove the id_table

Quoted 6 lines · Tony Xie

Remove the id_table because it's not used.

---
 drivers/mfd/rk808.c | 9 ---------
 1 file changed, 9 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#3 lore raw

PATCH v7 2/6 mfd: rk808: Add RK817 and RK809 support

In reply to Tony Xie

The RK809 and RK817 are a Power Management IC (PMIC) for multimedia and handheld devices. They contains the following components:
- Regulators
- RTC
- Clocking

Both RK809 and RK817 chips are using a similar register map, so we can reuse the RTC and Clocking functionality. Most of regulators have a some implementation also.

---
 drivers/mfd/Kconfig       |   6 +-
 drivers/mfd/rk808.c       | 192 +++++++++++++++++++++++++++++++++++++-
 include/linux/mfd/rk808.h | 172 ++++++++++++++++++++++++++++++++++
 3 files changed, 364 insertions(+), 6 deletions(-)
drivers/mfd/Kconfig +3 -3
index 8c5dfdce4326..a8a2833407b1 100644
@@ -1006,14 +1006,14 @@ config MFD_RC5T583
 	  different functionality of the device.
 
 config MFD_RK808
-	tristate "Rockchip RK805/RK808/RK818 Power Management Chip"
+	tristate "Rockchip RK805/RK808/RK809/RK817/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 RK805, RK808 and RK818
-	  Power Management chips.
+	  If you say yes here you get support for the RK805, RK808, RK809,
+	  RK817 and RK818 Power Management chips.
 	  This driver provides common support for accessing the device
 	  through I2C interface. The device supports multiple sub-devices
 	  including interrupts, RTC, LDO & DCDC regulators, and onkey.
drivers/mfd/rk808.c +189 -3

293 lines not on this page · raw message

include/linux/mfd/rk808.h +172 -0

190 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH v7 2/6] mfd: rk808: Add RK817 and RK809 support

Quoted 10 lines · Tony Xie

The RK809 and RK817 are a Power Management IC (PMIC) for multimedia and handheld devices. They contains the following components:
- Regulators
- RTC
- Clocking

Both RK809 and RK817 chips are using a similar register map, so we can reuse the RTC and Clocking functionality. Most of regulators have a some implementation also.

Quoted 7 lines
---
 drivers/mfd/Kconfig       |   6 +-
 drivers/mfd/rk808.c       | 192 +++++++++++++++++++++++++++++++++++++-
 include/linux/mfd/rk808.h | 172 ++++++++++++++++++++++++++++++++++
 3 files changed, 364 insertions(+), 6 deletions(-)

For my own reference:

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#5 lore raw

Re: [PATCH v7 2/6] mfd: rk808: Add RK817 and RK809 support

Hi Lee,

Am Dienstag, 2. April 2019, 08:33:05 CEST schrieb Lee Jones:

Quoted 20 lines · Tony Xie
Quoted 11 lines

The RK809 and RK817 are a Power Management IC (PMIC) for multimedia and handheld devices. They contains the following components:
- Regulators
- RTC
- Clocking

Both RK809 and RK817 chips are using a similar register map, so we can reuse the RTC and Clocking functionality. Most of regulators have a some implementation also.

Quoted 7 lines
---
 drivers/mfd/Kconfig       |   6 +-
 drivers/mfd/rk808.c       | 192 +++++++++++++++++++++++++++++++++++++-
 include/linux/mfd/rk808.h | 172 ++++++++++++++++++++++++++++++++++
 3 files changed, 364 insertions(+), 6 deletions(-)
Quoted 2 lines

For my own reference:

do you have some sort of merge plan for this or are you waiting for specific Acks? I guess if we're waiting for an Ack from Mark Brown, we'll need a resend of the patch.

All other patches have Acks from their subsystem maintainers (rtc, clk) so you could pick up all patches except patch3 and I could just resend this one, which in turn could also go through the regulator tree.

Otherwise we'll probably need a resend of the series, as Mark most of the time doesn't keep old patch series around.

Heiko

#6 lore raw

Re: [PATCH v7 2/6] mfd: rk808: Add RK817 and RK809 support

Quoted 30 lines · Heiko Stuebner

Hi Lee,

Am Dienstag, 2. April 2019, 08:33:05 CEST schrieb Lee Jones:

Quoted 20 lines · Tony Xie
Quoted 11 lines

The RK809 and RK817 are a Power Management IC (PMIC) for multimedia and handheld devices. They contains the following components:
- Regulators
- RTC
- Clocking

Both RK809 and RK817 chips are using a similar register map, so we can reuse the RTC and Clocking functionality. Most of regulators have a some implementation also.

Quoted 7 lines
---
 drivers/mfd/Kconfig       |   6 +-
 drivers/mfd/rk808.c       | 192 +++++++++++++++++++++++++++++++++++++-
 include/linux/mfd/rk808.h | 172 ++++++++++++++++++++++++++++++++++
 3 files changed, 364 insertions(+), 6 deletions(-)
Quoted 2 lines

For my own reference:

do you have some sort of merge plan for this or are you waiting for specific Acks? I guess if we're waiting for an Ack from Mark Brown, we'll need a resend of the patch.

Quoted 6 lines

All other patches have Acks from their subsystem maintainers (rtc, clk) so you could pick up all patches except patch3 and I could just resend this one, which in turn could also go through the regulator tree.

Otherwise we'll probably need a resend of the series, as Mark most of the time doesn't keep old patch series around.

Try resending it. Hopefully he will review in the next week or so can I can collect it when I return back from Shared Parental Leave.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#7 lore raw

PATCH v7 3/6 regulator: rk808: add RK809 and RK817 support.

In reply to Tony Xie

Add support for the rk809 and rk817 regulator driver. Their specifications are as follows:
1. The RK809 and RK809 consist of 5 DCDCs, 9 LDOs
and have the same registers for these components except dcdc5.
2. The dcdc5 is a boost dcdc for RK817 and is a buck for RK809.
3. The RK817 has one switch but The Rk809 has two.

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

---
 drivers/regulator/Kconfig           |   4 +-
 drivers/regulator/rk808-regulator.c | 657 ++++++++++++++++++++++++++--
 include/linux/mfd/rk808.h           |   3 +
 3 files changed, 634 insertions(+), 30 deletions(-)
drivers/regulator/Kconfig +2 -2
index ee60a222f5eb..3bfd820afcdd 100644
@@ -742,11 +742,11 @@ config REGULATOR_RC5T583
 	  outputs which can be controlled by i2c communication.
 
 config REGULATOR_RK808
-	tristate "Rockchip RK805/RK808/RK818 Power regulators"
+	tristate "Rockchip RK805/RK808/RK809/RK817/RK818 Power regulators"
 	depends on MFD_RK808
 	help
 	  Select this option to enable the power regulator of ROCKCHIP
-	  PMIC RK805,RK808 and RK818.
+	  PMIC RK805,RK809&RK817,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.
drivers/regulator/rk808-regulator.c +629 -28

743 lines not on this page · raw message

include/linux/mfd/rk808.h +3 -0
index 0fd9eedf3c20..2a9cd01691b2 100644
@@ -396,7 +396,10 @@ enum rk805_reg {
 #define SHUTDOWN_FUN			(0x2 << 2)
 #define SLEEP_FUN			(0x1 << 2)
 #define RK8XX_ID_MSK			0xfff0
+#define PWM_MODE_MSK			BIT(7)
 #define FPWM_MODE			BIT(7)
+#define AUTO_PWM_MODE			0
+
 enum rk817_reg_id {
 	RK817_ID_DCDC1 = 0,
 	RK817_ID_DCDC2,
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH v7 4/6 dt-bindings: mfd: rk808: Add binding information for RK809 and RK817.

In reply to Tony Xie

Add device tree bindings documentation for Rockchip's RK809 & RK817 PMIC.

---
 .../devicetree/bindings/mfd/rk808.txt         | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
Documentation/devicetree/bindings/mfd/rk808.txt +44 -0
index 1683ec3245bc..04df07f6f793 100644
@@ -3,11 +3,15 @@ RK8XX Power Management Integrated Circuit
 The rk8xx family current members:
 rk805
 rk808
+rk809
+rk817
 rk818
 
 Required properties:
 - compatible: "rockchip,rk805"
 - compatible: "rockchip,rk808"
+- compatible: "rockchip,rk809"
+- compatible: "rockchip,rk817"
 - compatible: "rockchip,rk818"
 - reg: I2C slave address
 - interrupts: the interrupt outputs of the controller.
@@ -45,6 +49,23 @@ Optional RK808 properties:
   the gpio controller. If DVS GPIOs aren't present, voltage changes will happen
   very quickly with no slow ramp time.
 
+Optional shared RK809 and RK817 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, LDO_REG2, LDO_REG3
+- vcc6-supply:  The input supply for LDO_REG4, LDO_REG5, LDO_REG6
+- vcc7-supply:  The input supply for LDO_REG7, LDO_REG8, LDO_REG9
+
+Optional RK809 properties:
+- vcc8-supply:  The input supply for SWITCH_REG1
+- vcc9-supply:  The input supply for DCDC_REG5, SWITCH_REG2
+
+Optional RK817 properties:
+- vcc8-supply:  The input supply for BOOST
+- vcc9-supply:  The input supply for OTG_SWITCH
+
 Optional RK818 properties:
 - vcc1-supply:  The input supply for DCDC_REG1
 - vcc2-supply:  The input supply for DCDC_REG2
@@ -86,6 +107,21 @@ number as described in RK808 datasheet.
 	- SWITCH_REGn
 		- valid values for n are 1 to 2
 
+Following regulators of the RK809 and RK817 PMIC blocks are supported. Note that
+the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO
+number as described in RK809 and RK817 datasheets.
+
+	- DCDC_REGn
+		- valid values for n are 1 to 5 for RK809.
+		- valid values for n are 1 to 4 for RK817.
+	- LDO_REGn
+		- valid values for n are 1 to 9 for RK809.
+		- valid values for n are 1 to 9 for RK817.
+	- SWITCH_REGn
+		- valid values for n are 1 to 2 for RK809.
+	- BOOST for RK817
+	- OTG_SWITCH for RK817
+
 Following regulators of the RK818 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 RK818 datasheet.
@@ -98,6 +134,14 @@ number as described in RK818 datasheet.
 	- HDMI_SWITCH
 	- OTG_SWITCH
 
+It is necessary to configure three pins for both the RK809 and RK817, the three
+pins are "gpio_ts" "gpio_gt" "gpio_slp".
+	The gpio_gt and gpio_ts pins support the gpio function.
+	The gpio_slp pin is for controlling the pmic states, as below:
+		- reset
+		- power down
+		- sleep
+
 Standard regulator bindings are used inside regulator subnodes. Check
   Documentation/devicetree/bindings/regulator/regulator.txt
 for more details
Signature · 1 line
2.17.1
author
#9 lore raw

PATCH v7 5/6 rtc: rk808: add RK809 and RK817 support.

In reply to Tony Xie

RK809 and RK817 are power management IC chips for multimedia products. Most of their functions and registers are same, including the rtc.

---
 drivers/rtc/Kconfig     |  4 +--
 drivers/rtc/rtc-rk808.c | 68 ++++++++++++++++++++++++++++++++---------
 2 files changed, 56 insertions(+), 16 deletions(-)
drivers/rtc/Kconfig +2 -2
index a819ef07b7ec..8c34f7ec0a59 100644
@@ -363,11 +363,11 @@ config RTC_DRV_MAX77686
 	  will be called rtc-max77686.
 
 config RTC_DRV_RK808
-	tristate "Rockchip RK805/RK808/RK818 RTC"
+	tristate "Rockchip RK805/RK808/RK809/RK817/RK818 RTC"
 	depends on MFD_RK808
 	help
 	  If you say yes here you will get support for the
-	  RTC of RK805, RK808 and RK818 PMIC.
+	  RTC of RK805, RK809 and RK817, RK808 and RK818 PMIC.
 
 	  This driver can also be built as a module. If so, the module
 	  will be called rk808-rtc.
drivers/rtc/rtc-rk808.c +54 -14

172 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#10 lore raw

PATCH v7 6/6 clk: RK808: add RK809 and RK817 support.

In reply to Tony Xie

RK809 and RK817 are power management IC chips for multimedia products. most of their functions and registers are same, including the clkout funciton.

---
 drivers/clk/Kconfig     |  9 +++---
 drivers/clk/clk-rk808.c | 64 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 67 insertions(+), 6 deletions(-)
drivers/clk/Kconfig +4 -5
index e5b2fe80eab4..532ab112fa8a 100644
@@ -52,13 +52,12 @@ config COMMON_CLK_MAX9485
 	  This driver supports Maxim 9485 Programmable Audio Clock Generator
 
 config COMMON_CLK_RK808
-	tristate "Clock driver for RK805/RK808/RK818"
+	tristate "Clock driver for RK805/RK808/RK809/RK817/RK818"
 	depends on MFD_RK808
 	---help---
-	  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.
+	  This driver supports RK805, RK809 and RK817, 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.
 
 config COMMON_CLK_HI655X
 	tristate "Clock driver for Hi655x" if EXPERT
drivers/clk/clk-rk808.c +63 -1

76 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#11 lore raw
In reply to Tony Xie

Hi Lee,

Am Mittwoch, 2. Januar 2019, 11:19:56 CET schrieb Tony Xie:

Quoted 2 lines

Most of functions and registers of the rk817 and rk808 are the same, so they can share allmost all codes.

do you have this series on your radar somewhere or should Tony resend the series? As it looks like it fell through the cracks somehow.

Thanks
Heiko

Quoted 55 lines

Their specifications are as follows:
1) The RK809 and RK809 consist of 5 DCDCs, 9 LDOs and have the same
registers
for these components except dcdc5.
2) The dcdc5 is a boost dcdc for RK817 and is a buck for RK809.
3) The RK817 has one switch but The Rk809 has two.

Changes in V2:
1. initialize the pm_pwroff_fn to NULL.
2. use EXPORT_SYMBOL_GPL to export pm_power_off_prepare.
3. change patch 2/3/4/5 subjects.

Changes in V3
1. change patch 4 subjects
2. replace pr_ with dev_ for printing in patch 2
3. modify switch1 and switch2 configs in patch 2
4. explain gpio information for rk809 and rk817 in patch 4

Changes in V4:
1. modify some codes for patch 2 and patch 5 according to comments
2. add reviewer mail lists for patch 3 and 4

Changes in V5:
modify some codes for patch 1 according to reveiw comments for v3.
1) remove the pm_power_off_prepare() and replace with shutdown
call-back from syscore
2) move the macro REGMAP_IRQ_M into the regmap.h and rename it
REGMAP_IRQ_LINE
3) make some dev_warn() log clear

Changes in V6:
modify some codes according to reveiw comments for v5.

Changes in V7:
modify some codes for patch 2 according to reveiw comments.

Tony Xie (6):
mfd: rk808: remove the id_table
mfd: rk808: Add RK817 and RK809 support
regulator: rk808: add RK809 and RK817 support.
dt-bindings: mfd: rk808: Add binding information for RK809 and RK817.
rtc: rk808: add RK809 and RK817 support.
clk: RK808: add RK809 and RK817 support.

 .../devicetree/bindings/mfd/rk808.txt         |  44 ++
 drivers/clk/Kconfig                           |   9 +-
 drivers/clk/clk-rk808.c                       |  64 +-
 drivers/mfd/Kconfig                           |   6 +-
 drivers/mfd/rk808.c                           | 199 +++++-
 drivers/regulator/Kconfig                     |   4 +-
 drivers/regulator/rk808-regulator.c           | 657 +++++++++++++++++-
 drivers/rtc/Kconfig                           |   4 +-
 drivers/rtc/rtc-rk808.c                       |  68 +-
 include/linux/mfd/rk808.h                     | 175 +++++
 10 files changed, 1164 insertions(+), 66 deletions(-)
#12 lore raw
Quoted 6 lines · Heiko Stübner

Am Mittwoch, 2. Januar 2019, 11:19:56 CET schrieb Tony Xie:

Quoted 2 lines

Most of functions and registers of the rk817 and rk808 are the same, so they can share allmost all codes.

do you have this series on your radar somewhere or should Tony resend the series? As it looks like it fell through the cracks somehow.

It wasn't, but it is now, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog