LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809)
@ 2018-10-30 10:07 Tony Xie
2018-10-30 10:07 ` [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) Tony Xie
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:07 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, tony.xie
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.
Tony Xie (6):
regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
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.
Documentation/devicetree/bindings/mfd/rk808.txt | 44 ++
drivers/clk/Kconfig | 9 +-
drivers/clk/clk-rk808.c | 64 ++-
drivers/mfd/Kconfig | 6 +-
drivers/mfd/rk808.c | 225 +++++++-
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 +++++++
include/linux/regmap.h | 6 +
11 files changed, 1193 insertions(+), 69 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
@ 2018-10-30 10:07 ` Tony Xie
2018-11-14 22:22 ` Mark Brown
2018-10-30 10:07 ` [PATCH v6 2/6] mfd: rk808: Add RK817 and RK809 support Tony Xie
` (4 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:07 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, tony.xie
if there are lots of irqs for a device and the register addresses for these
irqs is continuous, we can use this macro to initialize regmap_irq value.
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
---
include/linux/regmap.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4f38068..a468b81 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1047,6 +1047,12 @@ struct regmap_irq {
#define REGMAP_IRQ_REG(_irq, _off, _mask) \
[_irq] = { .reg_offset = (_off), .mask = (_mask) }
+#define REGMAP_IRQ_REG_LINE(_id, _reg_bits) \
+ [_id] = { \
+ .mask = BIT((_id) % (_reg_bits)), \
+ .reg_offset = (_id) / (_reg_bits), \
+ }
+
/**
* struct regmap_irq_chip - Description of a generic regmap irq_chip.
*
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 2/6] mfd: rk808: Add RK817 and RK809 support
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
2018-10-30 10:07 ` [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) Tony Xie
@ 2018-10-30 10:07 ` Tony Xie
2018-11-13 7:26 ` Lee Jones
2018-10-30 10:07 ` [PATCH v6 3/6] regulator: rk808: add RK809 and RK817 support Tony Xie
` (3 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:07 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, tony.xie
The rk809 and rk817 are a Power Management IC (PMIC) for multimedia
and handheld devices. It 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 and regulators functionality.
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/mfd/Kconfig | 6 +-
drivers/mfd/rk808.c | 225 +++++++++++++++++++++++++++++++++++++++++++---
include/linux/mfd/rk808.h | 172 +++++++++++++++++++++++++++++++++++
3 files changed, 386 insertions(+), 17 deletions(-)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b860eb5..f8b1922 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -967,14 +967,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.
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 216fbf6..9da1035 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
+#include <linux/syscore_ops.h>
struct rk808_reg_data {
int addr;
@@ -62,6 +63,29 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
return false;
}
+static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg)
+{
+ /*
+ * Notes:
+ * - Technically the ROUND_30s bit makes RTC_CTRL_REG volatile, but
+ * we don't use that feature. It's better to cache.
+ * - It's unlikely we care that RK808_DEVCTRL_REG is volatile since
+ * bits are cleared in case when we shutoff anyway, but better safe.
+ */
+
+ switch (reg) {
+ case RK817_SECONDS_REG ... RK817_WEEKS_REG:
+ case RK817_RTC_STATUS_REG:
+ case RK817_INT_STS_REG0:
+ case RK817_INT_STS_REG1:
+ case RK817_INT_STS_REG2:
+ case RK817_SYS_STS:
+ return true;
+ }
+
+ return true;
+}
+
static const struct regmap_config rk818_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@@ -86,6 +110,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
.volatile_reg = rk808_is_volatile_reg,
};
+static const struct regmap_config rk817_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = RK817_GPIO_INT_CFG,
+ .cache_type = REGCACHE_NONE,
+ .volatile_reg = rk817_is_volatile_reg,
+};
+
static struct resource rtc_resources[] = {
{
.start = RK808_IRQ_RTC_ALARM,
@@ -94,6 +126,13 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
}
};
+static struct resource rk817_rtc_resources[] = {
+ {
+ .start = RK817_IRQ_RTC_ALARM,
+ .end = RK817_IRQ_RTC_ALARM,
+ .flags = IORESOURCE_IRQ,
+ }
+};
static struct resource rk805_key_resources[] = {
{
.start = RK805_IRQ_PWRON_FALL,
@@ -107,6 +146,19 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
}
};
+static struct resource rk817_pwrkey_resources[] = {
+ {
+ .start = RK817_IRQ_PWRON_RISE,
+ .end = RK817_IRQ_PWRON_RISE,
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .start = RK817_IRQ_PWRON_FALL,
+ .end = RK817_IRQ_PWRON_FALL,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
static const struct mfd_cell rk805s[] = {
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
@@ -132,6 +184,21 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
},
};
+static const struct mfd_cell rk817s[] = {
+ { .name = "rk808-clkout",},
+ { .name = "rk808-regulator",},
+ {
+ .name = "rk8xx-pwrkey",
+ .num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
+ .resources = &rk817_pwrkey_resources[0],
+ },
+ {
+ .name = "rk808-rtc",
+ .num_resources = ARRAY_SIZE(rk817_rtc_resources),
+ .resources = &rk817_rtc_resources[0],
+ },
+};
+
static const struct mfd_cell rk818s[] = {
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
@@ -167,6 +234,13 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
VB_LO_SEL_3500MV },
};
+static const struct rk808_reg_data rk817_pre_init_reg[] = {
+ {RK817_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
+ {RK817_GPIO_INT_CFG, RK817_INT_POL_MSK, RK817_INT_POL_H},
+ {RK817_SYS_CFG(1), RK817_HOTDIE_TEMP_MSK | RK817_TSD_TEMP_MSK,
+ RK817_HOTDIE_105 | RK817_TSD_140},
+};
+
static const struct rk808_reg_data rk818_pre_init_reg[] = {
/* improve efficiency */
{ RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA },
@@ -332,6 +406,33 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
},
};
+static const struct regmap_irq rk817_irqs[RK817_IRQ_END] = {
+ REGMAP_IRQ_REG_LINE(0, 8),
+ REGMAP_IRQ_REG_LINE(1, 8),
+ REGMAP_IRQ_REG_LINE(2, 8),
+ REGMAP_IRQ_REG_LINE(3, 8),
+ REGMAP_IRQ_REG_LINE(4, 8),
+ REGMAP_IRQ_REG_LINE(5, 8),
+ REGMAP_IRQ_REG_LINE(6, 8),
+ REGMAP_IRQ_REG_LINE(7, 8),
+ REGMAP_IRQ_REG_LINE(8, 8),
+ REGMAP_IRQ_REG_LINE(9, 8),
+ REGMAP_IRQ_REG_LINE(10, 8),
+ REGMAP_IRQ_REG_LINE(11, 8),
+ REGMAP_IRQ_REG_LINE(12, 8),
+ REGMAP_IRQ_REG_LINE(13, 8),
+ REGMAP_IRQ_REG_LINE(14, 8),
+ REGMAP_IRQ_REG_LINE(15, 8),
+ REGMAP_IRQ_REG_LINE(16, 8),
+ REGMAP_IRQ_REG_LINE(17, 8),
+ REGMAP_IRQ_REG_LINE(18, 8),
+ REGMAP_IRQ_REG_LINE(19, 8),
+ REGMAP_IRQ_REG_LINE(20, 8),
+ REGMAP_IRQ_REG_LINE(21, 8),
+ REGMAP_IRQ_REG_LINE(22, 8),
+ REGMAP_IRQ_REG_LINE(23, 8)
+};
+
static struct regmap_irq_chip rk805_irq_chip = {
.name = "rk805",
.irqs = rk805_irqs,
@@ -355,6 +456,18 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
.init_ack_masked = true,
};
+static struct regmap_irq_chip rk817_irq_chip = {
+ .name = "rk817",
+ .irqs = rk817_irqs,
+ .num_irqs = ARRAY_SIZE(rk817_irqs),
+ .num_regs = 3,
+ .irq_reg_stride = 2,
+ .status_base = RK817_INT_STS_REG0,
+ .mask_base = RK817_INT_STS_MSK_REG0,
+ .ack_base = RK817_INT_STS_REG0,
+ .init_ack_masked = true,
+};
+
static const struct regmap_irq_chip rk818_irq_chip = {
.name = "rk818",
.irqs = rk818_irqs,
@@ -376,7 +489,7 @@ static void rk805_device_shutdown(void)
if (!rk808) {
dev_warn(&rk808_i2c_client->dev,
- "have no rk805, so do nothing here\n");
+ "cannot get the driver data of RK808!\n");
return;
}
@@ -394,7 +507,7 @@ static void rk808_device_shutdown(void)
if (!rk808) {
dev_warn(&rk808_i2c_client->dev,
- "have no rk808, so do nothing here\n");
+ "cannot get the driver data of RK808!\n");
return;
}
@@ -412,7 +525,7 @@ static void rk818_device_shutdown(void)
if (!rk808) {
dev_warn(&rk808_i2c_client->dev,
- "have no rk818, so do nothing here\n");
+ "cannot get the driver data of RK808!\n");
return;
}
@@ -423,9 +536,39 @@ static void rk818_device_shutdown(void)
dev_err(&rk808_i2c_client->dev, "power off error!\n");
}
+static void rk8xx_syscore_shutdown(void)
+{
+ int ret;
+ struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
+
+ if (!rk808) {
+ dev_warn(&rk808_i2c_client->dev,
+ "cannot get the driver data of RK808!\n");
+ return;
+ }
+
+ if (system_state == SYSTEM_POWER_OFF &&
+ (rk808->variant == RK809_ID || rk808->variant == RK817_ID)) {
+ ret = regmap_update_bits(rk808->regmap,
+ RK817_SYS_CFG(3),
+ RK817_SLPPIN_FUNC_MSK,
+ SLPPIN_DN_FUN);
+ if (ret) {
+ dev_warn(&rk808_i2c_client->dev,
+ "the reset pin cannot switch to power down function\n");
+ }
+ }
+}
+
+static struct syscore_ops rk808_syscore_ops = {
+ .shutdown = rk8xx_syscore_shutdown,
+};
+
static const struct of_device_id rk808_of_match[] = {
{ .compatible = "rockchip,rk805" },
{ .compatible = "rockchip,rk808" },
+ { .compatible = "rockchip,rk809" },
+ { .compatible = "rockchip,rk817" },
{ .compatible = "rockchip,rk818" },
{ },
};
@@ -438,10 +581,11 @@ static int rk808_probe(struct i2c_client *client,
struct rk808 *rk808;
const struct rk808_reg_data *pre_init_reg;
const struct mfd_cell *cells;
- void (*pm_pwroff_fn)(void);
+ void (*pm_pwroff_fn)(void) = NULL;
int nr_pre_init_regs;
int nr_cells;
int pm_off = 0, msb, lsb;
+ unsigned char pmic_id_msb, pmic_id_lsb;
int ret;
int i;
@@ -449,15 +593,24 @@ static int rk808_probe(struct i2c_client *client,
if (!rk808)
return -ENOMEM;
+ if (of_device_is_compatible(np, "rockchip,rk817") ||
+ of_device_is_compatible(np, "rockchip,rk809")) {
+ pmic_id_msb = RK817_ID_MSB;
+ pmic_id_lsb = RK817_ID_LSB;
+ } else {
+ pmic_id_msb = RK808_ID_MSB;
+ pmic_id_lsb = RK808_ID_LSB;
+ }
+
/* Read chip variant */
- msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
+ msb = i2c_smbus_read_byte_data(client, pmic_id_msb);
if (msb < 0) {
dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
RK808_ID_MSB);
return msb;
}
- lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
+ lsb = i2c_smbus_read_byte_data(client, pmic_id_lsb);
if (lsb < 0) {
dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
RK808_ID_LSB);
@@ -495,6 +648,16 @@ static int rk808_probe(struct i2c_client *client,
nr_cells = ARRAY_SIZE(rk818s);
pm_pwroff_fn = rk818_device_shutdown;
break;
+ case RK809_ID:
+ case RK817_ID:
+ rk808->regmap_cfg = &rk817_regmap_config;
+ rk808->regmap_irq_chip = &rk817_irq_chip;
+ pre_init_reg = rk817_pre_init_reg;
+ nr_pre_init_regs = ARRAY_SIZE(rk817_pre_init_reg);
+ cells = rk817s;
+ nr_cells = ARRAY_SIZE(rk817s);
+ register_syscore_ops(&rk808_syscore_ops);
+ break;
default:
dev_err(&client->dev, "Unsupported RK8XX ID %lu\n",
rk808->variant);
@@ -568,22 +731,56 @@ 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 int rk8xx_suspend(struct device *dev)
+{
+ int ret = 0;
+ struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
+
+ switch (rk808->variant) {
+ case RK809_ID:
+ case RK817_ID:
+ ret = regmap_update_bits(rk808->regmap,
+ RK817_SYS_CFG(3),
+ RK817_SLPPIN_FUNC_MSK,
+ SLPPIN_SLP_FUN);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+static int rk8xx_resume(struct device *dev)
+{
+ int ret = 0;
+ struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
+
+ switch (rk808->variant) {
+ case RK809_ID:
+ case RK817_ID:
+ ret = regmap_update_bits(rk808->regmap,
+ RK817_SYS_CFG(3),
+ RK817_SLPPIN_FUNC_MSK,
+ SLPPIN_NULL_FUN);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+SIMPLE_DEV_PM_OPS(rk8xx_pm_ops, rk8xx_suspend, rk8xx_resume);
static struct i2c_driver rk808_i2c_driver = {
.driver = {
.name = "rk808",
.of_match_table = rk808_of_match,
+ .pm = &rk8xx_pm_ops,
},
.probe = rk808_probe,
.remove = rk808_remove,
- .id_table = rk808_ids,
};
module_i2c_driver(rk808_i2c_driver);
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index d315659..b973b0a 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -382,6 +382,7 @@ enum rk805_reg {
#define SWITCH1_EN BIT(5)
#define DEV_OFF_RST BIT(3)
#define DEV_OFF BIT(0)
+#define RTC_STOP BIT(0)
#define VB_LO_ACT BIT(4)
#define VB_LO_SEL_3500MV (7 << 0)
@@ -396,6 +397,175 @@ enum rk805_reg {
#define SLEEP_FUN (0x1 << 2)
#define RK8XX_ID_MSK 0xfff0
#define FPWM_MODE BIT(7)
+enum rk817_reg_id {
+ RK817_ID_DCDC1 = 0,
+ RK817_ID_DCDC2,
+ RK817_ID_DCDC3,
+ RK817_ID_DCDC4,
+ RK817_ID_LDO1,
+ RK817_ID_LDO2,
+ RK817_ID_LDO3,
+ RK817_ID_LDO4,
+ RK817_ID_LDO5,
+ RK817_ID_LDO6,
+ RK817_ID_LDO7,
+ RK817_ID_LDO8,
+ RK817_ID_LDO9,
+ RK817_ID_BOOST,
+ RK817_ID_BOOST_OTG_SW,
+ RK817_NUM_REGULATORS
+};
+
+enum rk809_reg_id {
+ RK809_ID_DCDC5 = RK817_ID_BOOST,
+ RK809_ID_SW1,
+ RK809_ID_SW2,
+ RK809_NUM_REGULATORS
+};
+
+#define RK817_SECONDS_REG 0x00
+#define RK817_MINUTES_REG 0x01
+#define RK817_HOURS_REG 0x02
+#define RK817_DAYS_REG 0x03
+#define RK817_MONTHS_REG 0x04
+#define RK817_YEARS_REG 0x05
+#define RK817_WEEKS_REG 0x06
+#define RK817_ALARM_SECONDS_REG 0x07
+#define RK817_ALARM_MINUTES_REG 0x08
+#define RK817_ALARM_HOURS_REG 0x09
+#define RK817_ALARM_DAYS_REG 0x0a
+#define RK817_ALARM_MONTHS_REG 0x0b
+#define RK817_ALARM_YEARS_REG 0x0c
+#define RK817_RTC_CTRL_REG 0xd
+#define RK817_RTC_STATUS_REG 0xe
+#define RK817_RTC_INT_REG 0xf
+#define RK817_RTC_COMP_LSB_REG 0x10
+#define RK817_RTC_COMP_MSB_REG 0x11
+
+#define RK817_POWER_EN_REG(i) (0xb1 + (i))
+#define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i))
+
+#define RK817_POWER_CONFIG (0xb9)
+
+#define RK817_BUCK_CONFIG_REG(i) (0xba + (i) * 3)
+
+#define RK817_BUCK1_ON_VSEL_REG 0xBB
+#define RK817_BUCK1_SLP_VSEL_REG 0xBC
+
+#define RK817_BUCK2_CONFIG_REG 0xBD
+#define RK817_BUCK2_ON_VSEL_REG 0xBE
+#define RK817_BUCK2_SLP_VSEL_REG 0xBF
+
+#define RK817_BUCK3_CONFIG_REG 0xC0
+#define RK817_BUCK3_ON_VSEL_REG 0xC1
+#define RK817_BUCK3_SLP_VSEL_REG 0xC2
+
+#define RK817_BUCK4_CONFIG_REG 0xC3
+#define RK817_BUCK4_ON_VSEL_REG 0xC4
+#define RK817_BUCK4_SLP_VSEL_REG 0xC5
+
+#define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2)
+#define RK817_BOOST_OTG_CFG (0xde)
+
+#define RK817_ID_MSB 0xed
+#define RK817_ID_LSB 0xee
+
+#define RK817_SYS_STS 0xf0
+#define RK817_SYS_CFG(i) (0xf1 + (i))
+
+#define RK817_ON_SOURCE_REG 0xf5
+#define RK817_OFF_SOURCE_REG 0xf6
+
+/* INTERRUPT REGISTER */
+#define RK817_INT_STS_REG0 0xf8
+#define RK817_INT_STS_MSK_REG0 0xf9
+#define RK817_INT_STS_REG1 0xfa
+#define RK817_INT_STS_MSK_REG1 0xfb
+#define RK817_INT_STS_REG2 0xfc
+#define RK817_INT_STS_MSK_REG2 0xfd
+#define RK817_GPIO_INT_CFG 0xfe
+
+/* IRQ Definitions */
+#define RK817_IRQ_PWRON_FALL 0
+#define RK817_IRQ_PWRON_RISE 1
+#define RK817_IRQ_PWRON 2
+#define RK817_IRQ_PWMON_LP 3
+#define RK817_IRQ_HOTDIE 4
+#define RK817_IRQ_RTC_ALARM 5
+#define RK817_IRQ_RTC_PERIOD 6
+#define RK817_IRQ_VB_LO 7
+#define RK817_IRQ_PLUG_IN (8 + 0)
+#define RK817_IRQ_PLUG_OUT (8 + 1)
+#define RK817_IRQ_CHRG_TERM (8 + 2)
+#define RK817_IRQ_CHRG_TIME (8 + 3)
+#define RK817_IRQ_CHRG_TS (8 + 4)
+#define RK817_IRQ_USB_OV (8 + 5)
+#define RK817_IRQ_CHRG_IN_CLMP (8 + 6)
+#define RK817_IRQ_BAT_DIS_ILIM (8 + 7)
+#define RK817_IRQ_GATE_GPIO (16 + 0)
+#define RK817_IRQ_TS_GPIO (16 + 1)
+#define RK817_IRQ_CODEC_PD (16 + 2)
+#define RK817_IRQ_CODEC_PO (16 + 3)
+#define RK817_IRQ_CLASSD_MUTE_DONE (16 + 4)
+#define RK817_IRQ_CLASSD_OCP (16 + 5)
+#define RK817_IRQ_BAT_OVP (16 + 6)
+#define RK817_IRQ_CHRG_BAT_HI (16 + 7)
+#define RK817_IRQ_END (RK817_IRQ_CHRG_BAT_HI + 1)
+
+/*
+ * rtc_ctrl 0xd
+ * same as 808, except bit4
+ */
+#define RK817_RTC_CTRL_RSV4 BIT(4)
+
+/* power config 0xb9 */
+#define RK817_BUCK3_FB_RES_MSK BIT(6)
+#define RK817_BUCK3_FB_RES_INTER BIT(6)
+#define RK817_BUCK3_FB_RES_EXT 0
+
+/* buck config 0xba */
+#define RK817_RAMP_RATE_OFFSET 6
+#define RK817_RAMP_RATE_MASK (0x3 << RK817_RAMP_RATE_OFFSET)
+#define RK817_RAMP_RATE_3MV_PER_US (0x0 << RK817_RAMP_RATE_OFFSET)
+#define RK817_RAMP_RATE_6_3MV_PER_US (0x1 << RK817_RAMP_RATE_OFFSET)
+#define RK817_RAMP_RATE_12_5MV_PER_US (0x2 << RK817_RAMP_RATE_OFFSET)
+#define RK817_RAMP_RATE_25MV_PER_US (0x3 << RK817_RAMP_RATE_OFFSET)
+
+/* sys_cfg1 0xf2 */
+#define RK817_HOTDIE_TEMP_MSK (0x3 << 4)
+#define RK817_HOTDIE_85 (0x0 << 4)
+#define RK817_HOTDIE_95 (0x1 << 4)
+#define RK817_HOTDIE_105 (0x2 << 4)
+#define RK817_HOTDIE_115 (0x3 << 4)
+
+#define RK817_TSD_TEMP_MSK BIT(6)
+#define RK817_TSD_140 0
+#define RK817_TSD_160 BIT(6)
+
+#define RK817_CLK32KOUT2_EN BIT(7)
+
+/* sys_cfg3 0xf4 */
+#define RK817_SLPPIN_FUNC_MSK (0x3 << 3)
+#define SLPPIN_NULL_FUN (0x0 << 3)
+#define SLPPIN_SLP_FUN (0x1 << 3)
+#define SLPPIN_DN_FUN (0x2 << 3)
+#define SLPPIN_RST_FUN (0x3 << 3)
+
+#define RK817_RST_FUNC_MSK (0x3 << 6)
+#define RK817_RST_FUNC_SFT (6)
+#define RK817_RST_FUNC_CNT (3)
+#define RK817_RST_FUNC_DEV (0) /* reset the dev */
+#define RK817_RST_FUNC_REG (0x1 << 6) /* reset the reg only */
+
+#define RK817_SLPPOL_MSK BIT(5)
+#define RK817_SLPPOL_H BIT(5)
+#define RK817_SLPPOL_L (0)
+
+/* gpio&int 0xfe */
+#define RK817_INT_POL_MSK BIT(1)
+#define RK817_INT_POL_H BIT(1)
+#define RK817_INT_POL_L 0
+#define RK809_BUCK5_CONFIG(i) (RK817_BOOST_OTG_CFG + (i) * 1)
enum {
BUCK_ILMIN_50MA,
@@ -443,6 +613,8 @@ enum {
enum {
RK805_ID = 0x8050,
RK808_ID = 0x0000,
+ RK809_ID = 0x8090,
+ RK817_ID = 0x8170,
RK818_ID = 0x8181,
};
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 3/6] regulator: rk808: add RK809 and RK817 support.
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
2018-10-30 10:07 ` [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) Tony Xie
2018-10-30 10:07 ` [PATCH v6 2/6] mfd: rk808: Add RK817 and RK809 support Tony Xie
@ 2018-10-30 10:07 ` Tony Xie
2018-10-30 10:07 ` [PATCH v6 4/6] dt-bindings: mfd: rk808: Add binding information for RK809 and RK817 Tony Xie
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:07 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, 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.
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
drivers/regulator/Kconfig | 4 +-
drivers/regulator/rk808-regulator.c | 657 ++++++++++++++++++++++++++++++++++--
include/linux/mfd/rk808.h | 3 +
3 files changed, 634 insertions(+), 30 deletions(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 5dbccf5..27ff89f 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -716,11 +716,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.
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 213b687..c70fbe2 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -36,6 +36,12 @@
#define RK808_BUCK4_VSEL_MASK 0xf
#define RK808_LDO_VSEL_MASK 0x1f
+#define RK809_BUCK5_VSEL_MASK 0x7
+
+#define RK817_LDO_VSEL_MASK 0x7f
+#define RK817_BOOST_VSEL_MASK 0x7
+#define RK817_BUCK_VSEL_MASK 0x7f
+
#define RK818_BUCK_VSEL_MASK 0x3f
#define RK818_BUCK4_VSEL_MASK 0x1f
#define RK818_LDO_VSEL_MASK 0x1f
@@ -65,30 +71,36 @@
/* 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 ENABLE_MASK(id) (BIT(id) | BIT(4 + (id)))
+#define DISABLE_VAL(id) (BIT(4 + (id)))
+
+#define RK817_BOOST_DESC(_id, _match, _supply, _min, _max, _step, _vreg,\
+ _vmask, _ereg, _emask, _enval, _disval, _etime, m_drop) \
+ { \
+ .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_val = (_enval), \
+ .disable_val = (_disval), \
+ .enable_time = (_etime), \
+ .min_dropout_uV = (m_drop) * 1000, \
+ .ops = &rk817_boost_ops, \
}
-#define RK8XX_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \
- _vmask, _ereg, _emask, _etime) \
- [_id] = { \
+#define RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, _enval, _disval, _etime, _ops) \
+ { \
.name = (_match), \
.supply_name = (_supply), \
.of_match = of_match_ptr(_match), \
@@ -103,12 +115,30 @@
.vsel_mask = (_vmask), \
.enable_reg = (_ereg), \
.enable_mask = (_emask), \
+ .enable_val = (_enval), \
+ .disable_val = (_disval), \
.enable_time = (_etime), \
- .ops = &rk808_reg_ops, \
+ .ops = _ops, \
}
-#define RK8XX_DESC_SWITCH(_id, _match, _supply, _ereg, _emask) \
- [_id] = { \
+#define RK805_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, _etime) \
+ RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, 0, 0, _etime, &rk805_reg_ops)
+
+#define RK8XX_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, _etime) \
+ RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, 0, 0, _etime, &rk808_reg_ops)
+
+#define RK817_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, _disval, _etime) \
+ RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
+ _vmask, _ereg, _emask, _emask, _disval, _etime, &rk817_reg_ops)
+
+#define RKXX_DESC_SWITCH_COM(_id, _match, _supply, _ereg, _emask, \
+ _enval, _disval, _ops) \
+ { \
.name = (_match), \
.supply_name = (_supply), \
.of_match = of_match_ptr(_match), \
@@ -117,10 +147,20 @@
.id = (_id), \
.enable_reg = (_ereg), \
.enable_mask = (_emask), \
+ .enable_val = (_enval), \
+ .disable_val = (_disval), \
.owner = THIS_MODULE, \
- .ops = &rk808_switch_ops \
+ .ops = _ops \
}
+#define RK817_DESC_SWITCH(_id, _match, _supply, _ereg, _emask, \
+ _disval) \
+ RKXX_DESC_SWITCH_COM(_id, _match, _supply, _ereg, _emask, \
+ _emask, _disval, &rk817_switch_ops)
+
+#define RK8XX_DESC_SWITCH(_id, _match, _supply, _ereg, _emask) \
+ RKXX_DESC_SWITCH_COM(_id, _match, _supply, _ereg, _emask, \
+ 0, 0, &rk808_switch_ops)
struct rk808_regulator_data {
struct gpio_desc *dvs_gpio[2];
@@ -138,6 +178,51 @@ struct rk808_regulator_data {
REGULATOR_LINEAR_RANGE(2500000, 15, 15, 0),
};
+#define RK809_BUCK5_SEL_CNT (8)
+
+static const struct regulator_linear_range rk809_buck5_voltage_ranges[] = {
+ REGULATOR_LINEAR_RANGE(1500000, 0, 0, 0),
+ REGULATOR_LINEAR_RANGE(1800000, 1, 3, 200000),
+ REGULATOR_LINEAR_RANGE(2800000, 4, 5, 200000),
+ REGULATOR_LINEAR_RANGE(3300000, 6, 7, 300000),
+};
+
+#define RK817_BUCK1_MIN0 500000
+#define RK817_BUCK1_MAX0 1500000
+
+#define RK817_BUCK1_MIN1 1600000
+#define RK817_BUCK1_MAX1 2400000
+
+#define RK817_BUCK3_MAX1 3400000
+
+#define RK817_BUCK1_STP0 12500
+#define RK817_BUCK1_STP1 100000
+
+#define RK817_BUCK1_SEL0 ((RK817_BUCK1_MAX0 - RK817_BUCK1_MIN0) /\
+ RK817_BUCK1_STP0)
+#define RK817_BUCK1_SEL1 ((RK817_BUCK1_MAX1 - RK817_BUCK1_MIN1) /\
+ RK817_BUCK1_STP1)
+
+#define RK817_BUCK3_SEL1 ((RK817_BUCK3_MAX1 - RK817_BUCK1_MIN1) /\
+ RK817_BUCK1_STP1)
+
+#define RK817_BUCK1_SEL_CNT (RK817_BUCK1_SEL0 + RK817_BUCK1_SEL1 + 1)
+#define RK817_BUCK3_SEL_CNT (RK817_BUCK1_SEL0 + RK817_BUCK3_SEL1 + 1)
+
+static const struct regulator_linear_range rk817_buck1_voltage_ranges[] = {
+ REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN0, 0,
+ RK817_BUCK1_SEL0, RK817_BUCK1_STP0),
+ REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN1, RK817_BUCK1_SEL0 + 1,
+ RK817_BUCK1_SEL_CNT, RK817_BUCK1_STP1),
+};
+
+static const struct regulator_linear_range rk817_buck3_voltage_ranges[] = {
+ REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN0, 0,
+ RK817_BUCK1_SEL0, RK817_BUCK1_STP0),
+ REGULATOR_LINEAR_RANGE(RK817_BUCK1_MIN1, RK817_BUCK1_SEL0 + 1,
+ RK817_BUCK3_SEL_CNT, RK817_BUCK1_STP1),
+};
+
static int rk808_buck1_2_get_voltage_sel_regmap(struct regulator_dev *rdev)
{
struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
@@ -281,14 +366,45 @@ static int rk808_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
case 6001 ... 10000:
break;
default:
- pr_warn("%s ramp_delay: %d not supported, setting 10000\n",
- rdev->desc->name, ramp_delay);
+ dev_warn(&rdev->dev,
+ "%s ramp_delay: %d not supported, setting 10000\n",
+ rdev->desc->name, ramp_delay);
}
return regmap_update_bits(rdev->regmap, reg,
RK808_RAMP_RATE_MASK, ramp_value);
}
+/*
+ * RK817 RK809
+ */
+static int rk817_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
+{
+ unsigned int ramp_value = RK817_RAMP_RATE_25MV_PER_US;
+ unsigned int reg = RK817_BUCK_CONFIG_REG(rdev_get_id(rdev));
+
+ switch (ramp_delay) {
+ case 0 ... 3000:
+ ramp_value = RK817_RAMP_RATE_3MV_PER_US;
+ break;
+ case 3001 ... 6300:
+ ramp_value = RK817_RAMP_RATE_6_3MV_PER_US;
+ break;
+ case 6301 ... 12500:
+ ramp_value = RK817_RAMP_RATE_12_5MV_PER_US;
+ break;
+ case 12501 ... 25000:
+ break;
+ default:
+ dev_warn(&rdev->dev,
+ "%s ramp_delay: %d not supported, setting 10000\n",
+ rdev->desc->name, ramp_delay);
+ }
+
+ return regmap_update_bits(rdev->regmap, reg,
+ RK817_RAMP_RATE_MASK, ramp_value);
+}
+
static int rk808_set_suspend_voltage(struct regulator_dev *rdev, int uv)
{
unsigned int reg;
@@ -304,6 +420,29 @@ static int rk808_set_suspend_voltage(struct regulator_dev *rdev, int uv)
sel);
}
+static int rk817_check_suspend_voltage(int id)
+{
+ if (id >= RK817_ID_DCDC1 && id <= RK817_ID_LDO9)
+ return 0;
+ return -1;
+}
+
+static int rk817_set_suspend_voltage(struct regulator_dev *rdev, int uv)
+{
+ unsigned int reg;
+ int id = rdev_get_id(rdev);
+ int sel = regulator_map_voltage_linear(rdev, uv, uv);
+ /* only ldo1~ldo9 */
+ if (sel < 0 || rk817_check_suspend_voltage(id))
+ return -EINVAL;
+
+ reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
+
+ return regmap_update_bits(rdev->regmap, reg,
+ rdev->desc->vsel_mask,
+ sel);
+}
+
static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
{
unsigned int reg;
@@ -363,6 +502,129 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
rdev->desc->enable_mask);
}
+static int rk817_set_suspend_enable_ctrl(struct regulator_dev *rdev,
+ unsigned int en)
+{
+ unsigned int reg;
+ int id = rdev_get_id(rdev);
+ unsigned int id_slp, msk, val;
+
+ if (id >= RK817_ID_DCDC1 && id <= RK817_ID_DCDC4)
+ id_slp = id;
+ else if (id >= RK817_ID_LDO1 && id <= RK817_ID_LDO8)
+ id_slp = 8 + (id - RK817_ID_LDO1);
+ else if (id >= RK817_ID_LDO9 && id <= RK809_ID_SW2)
+ id_slp = 4 + (id - RK817_ID_LDO9);
+ else
+ return -EINVAL;
+
+ reg = RK817_POWER_SLP_EN_REG(id_slp / 8);
+
+ msk = BIT(id_slp % 8);
+ if (en)
+ val = msk;
+ else
+ val = 0;
+
+ return regmap_update_bits(rdev->regmap, reg, msk, val);
+}
+
+static int rk817_set_suspend_enable(struct regulator_dev *rdev)
+{
+ return rk817_set_suspend_enable_ctrl(rdev, 1);
+}
+
+static int rk817_set_suspend_disable(struct regulator_dev *rdev)
+{
+ return rk817_set_suspend_enable_ctrl(rdev, 0);
+}
+
+static int rk8xx_set_suspend_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+ unsigned int reg;
+
+ reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
+
+ switch (mode) {
+ case REGULATOR_MODE_FAST:
+ return regmap_update_bits(rdev->regmap, reg,
+ PWM_MODE_MSK, FPWM_MODE);
+ case REGULATOR_MODE_NORMAL:
+ return regmap_update_bits(rdev->regmap, reg,
+ PWM_MODE_MSK, AUTO_PWM_MODE);
+ default:
+ dev_err(&rdev->dev, "do not support this mode\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int rk8xx_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+ switch (mode) {
+ case REGULATOR_MODE_FAST:
+ return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
+ PWM_MODE_MSK, FPWM_MODE);
+ case REGULATOR_MODE_NORMAL:
+ return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
+ PWM_MODE_MSK, AUTO_PWM_MODE);
+ default:
+ dev_err(&rdev->dev, "do not support this mode\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static unsigned int rk8xx_get_mode(struct regulator_dev *rdev)
+{
+ unsigned int val;
+ int err;
+
+ err = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val);
+ if (err)
+ return err;
+
+ if (val & FPWM_MODE)
+ return REGULATOR_MODE_FAST;
+ else
+ return REGULATOR_MODE_NORMAL;
+}
+
+static int rk8xx_is_enabled_wmsk_regmap(struct regulator_dev *rdev)
+{
+ unsigned int val;
+ int ret;
+
+ ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
+ if (ret != 0)
+ return ret;
+
+ /* add write mask bit */
+ val |= (rdev->desc->enable_mask & 0xf0);
+ val &= rdev->desc->enable_mask;
+
+ if (rdev->desc->enable_is_inverted) {
+ if (rdev->desc->enable_val)
+ return val != rdev->desc->enable_val;
+ return (val == 0);
+ }
+ if (rdev->desc->enable_val)
+ return val == rdev->desc->enable_val;
+ return val != 0;
+}
+
+static unsigned int rk8xx_regulator_of_map_mode(unsigned int mode)
+{
+ if (mode == 1)
+ return REGULATOR_MODE_FAST;
+ if (mode == 2)
+ return REGULATOR_MODE_NORMAL;
+
+ return -EINVAL;
+}
+
static struct regulator_ops rk805_reg_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
@@ -433,6 +695,71 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
.set_suspend_disable = rk808_set_suspend_disable,
};
+static struct regulator_ops rk809_buck5_ops_range = {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .is_enabled = rk8xx_is_enabled_wmsk_regmap,
+ .set_suspend_voltage = rk808_set_suspend_voltage_range,
+ .set_suspend_enable = rk817_set_suspend_enable,
+ .set_suspend_disable = rk817_set_suspend_disable,
+};
+
+static struct regulator_ops rk817_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 = rk8xx_is_enabled_wmsk_regmap,
+ .set_suspend_voltage = rk817_set_suspend_voltage,
+ .set_suspend_enable = rk817_set_suspend_enable,
+ .set_suspend_disable = rk817_set_suspend_disable,
+};
+
+static struct regulator_ops rk817_boost_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 = rk8xx_is_enabled_wmsk_regmap,
+ .set_suspend_enable = rk817_set_suspend_enable,
+ .set_suspend_disable = rk817_set_suspend_disable,
+};
+
+static struct regulator_ops rk817_buck_ops_range = {
+ .list_voltage = regulator_list_voltage_linear_range,
+ .map_voltage = regulator_map_voltage_linear_range,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .is_enabled = rk8xx_is_enabled_wmsk_regmap,
+ .set_mode = rk8xx_set_mode,
+ .get_mode = rk8xx_get_mode,
+ .set_suspend_mode = rk8xx_set_suspend_mode,
+ .set_ramp_delay = rk817_set_ramp_delay,
+ .set_suspend_voltage = rk808_set_suspend_voltage_range,
+ .set_suspend_enable = rk817_set_suspend_enable,
+ .set_suspend_disable = rk817_set_suspend_disable,
+};
+
+static struct regulator_ops rk817_switch_ops = {
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .is_enabled = regulator_is_enabled_regmap,
+ .set_suspend_enable = rk817_set_suspend_enable,
+ .set_suspend_disable = rk817_set_suspend_disable,
+};
+
static const struct regulator_desc rk805_reg[] = {
{
.name = "DCDC_REG1",
@@ -589,6 +916,271 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
RK808_DCDC_EN_REG, BIT(6)),
};
+static const struct regulator_desc rk809_reg[] = {
+ {
+ .name = "DCDC_REG1",
+ .supply_name = "vcc1",
+ .of_match = of_match_ptr("DCDC_REG1"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC1,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK1_SEL_CNT + 1,
+ .linear_ranges = rk817_buck1_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
+ .vsel_reg = RK817_BUCK1_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC1),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC1),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC1),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ }, {
+ .name = "DCDC_REG2",
+ .supply_name = "vcc2",
+ .of_match = of_match_ptr("DCDC_REG2"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC2,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK1_SEL_CNT + 1,
+ .linear_ranges = rk817_buck1_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
+ .vsel_reg = RK817_BUCK2_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC2),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC2),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC2),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ }, {
+ .name = "DCDC_REG3",
+ .supply_name = "vcc3",
+ .of_match = of_match_ptr("DCDC_REG3"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC3,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK1_SEL_CNT + 1,
+ .linear_ranges = rk817_buck1_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
+ .vsel_reg = RK817_BUCK3_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC3),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC3),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC3),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ }, {
+ .name = "DCDC_REG4",
+ .supply_name = "vcc4",
+ .of_match = of_match_ptr("DCDC_REG4"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC4,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK3_SEL_CNT + 1,
+ .linear_ranges = rk817_buck3_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck3_voltage_ranges),
+ .vsel_reg = RK817_BUCK4_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC4),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC4),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC4),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ },
+ {
+ .name = "DCDC_REG5",
+ .supply_name = "vcc9",
+ .of_match = of_match_ptr("DCDC_REG5"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK809_ID_DCDC5,
+ .ops = &rk809_buck5_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK809_BUCK5_SEL_CNT,
+ .linear_ranges = rk809_buck5_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk809_buck5_voltage_ranges),
+ .vsel_reg = RK809_BUCK5_CONFIG(0),
+ .vsel_mask = RK809_BUCK5_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(3),
+ .enable_mask = ENABLE_MASK(1),
+ .enable_val = ENABLE_MASK(1),
+ .disable_val = DISABLE_VAL(1),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ },
+ RK817_DESC(RK817_ID_LDO1, "LDO_REG1", "vcc5", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(0), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(0),
+ DISABLE_VAL(0), 400),
+ RK817_DESC(RK817_ID_LDO2, "LDO_REG2", "vcc5", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(1), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(1),
+ DISABLE_VAL(1), 400),
+ RK817_DESC(RK817_ID_LDO3, "LDO_REG3", "vcc5", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(2), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(2),
+ DISABLE_VAL(2), 400),
+ RK817_DESC(RK817_ID_LDO4, "LDO_REG4", "vcc6", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(3), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(3),
+ DISABLE_VAL(3), 400),
+ RK817_DESC(RK817_ID_LDO5, "LDO_REG5", "vcc6", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(4), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(0),
+ DISABLE_VAL(0), 400),
+ RK817_DESC(RK817_ID_LDO6, "LDO_REG6", "vcc6", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(5), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(1),
+ DISABLE_VAL(1), 400),
+ RK817_DESC(RK817_ID_LDO7, "LDO_REG7", "vcc7", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(6), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(2),
+ DISABLE_VAL(2), 400),
+ RK817_DESC(RK817_ID_LDO8, "LDO_REG8", "vcc7", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(7), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(3),
+ DISABLE_VAL(3), 400),
+ RK817_DESC(RK817_ID_LDO9, "LDO_REG9", "vcc7", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(8), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(3), ENABLE_MASK(0),
+ DISABLE_VAL(0), 400),
+ RK817_DESC_SWITCH(RK809_ID_SW1, "SWITCH_REG1", "vcc9",
+ RK817_POWER_EN_REG(3), ENABLE_MASK(2),
+ DISABLE_VAL(2)),
+ RK817_DESC_SWITCH(RK809_ID_SW2, "SWITCH_REG2", "vcc8",
+ RK817_POWER_EN_REG(3), ENABLE_MASK(3),
+ DISABLE_VAL(3)),
+};
+
+static const struct regulator_desc rk817_reg[] = {
+ {
+ .name = "DCDC_REG1",
+ .supply_name = "vcc1",
+ .of_match = of_match_ptr("DCDC_REG1"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC1,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK1_SEL_CNT + 1,
+ .linear_ranges = rk817_buck1_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
+ .vsel_reg = RK817_BUCK1_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC1),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC1),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC1),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ }, {
+ .name = "DCDC_REG2",
+ .supply_name = "vcc2",
+ .of_match = of_match_ptr("DCDC_REG2"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC2,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK1_SEL_CNT + 1,
+ .linear_ranges = rk817_buck1_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
+ .vsel_reg = RK817_BUCK2_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC2),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC2),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC2),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ }, {
+ .name = "DCDC_REG3",
+ .supply_name = "vcc3",
+ .of_match = of_match_ptr("DCDC_REG3"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC3,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK1_SEL_CNT + 1,
+ .linear_ranges = rk817_buck1_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
+ .vsel_reg = RK817_BUCK3_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC3),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC3),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC3),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ }, {
+ .name = "DCDC_REG4",
+ .supply_name = "vcc4",
+ .of_match = of_match_ptr("DCDC_REG4"),
+ .regulators_node = of_match_ptr("regulators"),
+ .id = RK817_ID_DCDC4,
+ .ops = &rk817_buck_ops_range,
+ .type = REGULATOR_VOLTAGE,
+ .n_voltages = RK817_BUCK3_SEL_CNT + 1,
+ .linear_ranges = rk817_buck3_voltage_ranges,
+ .n_linear_ranges = ARRAY_SIZE(rk817_buck3_voltage_ranges),
+ .vsel_reg = RK817_BUCK4_ON_VSEL_REG,
+ .vsel_mask = RK817_BUCK_VSEL_MASK,
+ .enable_reg = RK817_POWER_EN_REG(0),
+ .enable_mask = ENABLE_MASK(RK817_ID_DCDC4),
+ .enable_val = ENABLE_MASK(RK817_ID_DCDC4),
+ .disable_val = DISABLE_VAL(RK817_ID_DCDC4),
+ .of_map_mode = rk8xx_regulator_of_map_mode,
+ .owner = THIS_MODULE,
+ },
+ RK817_DESC(RK817_ID_LDO1, "LDO_REG1", "vcc5", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(0), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(0),
+ DISABLE_VAL(0), 400),
+ RK817_DESC(RK817_ID_LDO2, "LDO_REG2", "vcc5", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(1), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(1),
+ DISABLE_VAL(1), 400),
+ RK817_DESC(RK817_ID_LDO3, "LDO_REG3", "vcc5", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(2), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(2),
+ DISABLE_VAL(2), 400),
+ RK817_DESC(RK817_ID_LDO4, "LDO_REG4", "vcc6", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(3), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(1), ENABLE_MASK(3),
+ DISABLE_VAL(3), 400),
+ RK817_DESC(RK817_ID_LDO5, "LDO_REG5", "vcc6", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(4), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(0),
+ DISABLE_VAL(0), 400),
+ RK817_DESC(RK817_ID_LDO6, "LDO_REG6", "vcc6", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(5), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(1),
+ DISABLE_VAL(1), 400),
+ RK817_DESC(RK817_ID_LDO7, "LDO_REG7", "vcc7", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(6), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(2),
+ DISABLE_VAL(2), 400),
+ RK817_DESC(RK817_ID_LDO8, "LDO_REG8", "vcc7", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(7), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(2), ENABLE_MASK(3),
+ DISABLE_VAL(3), 400),
+ RK817_DESC(RK817_ID_LDO9, "LDO_REG9", "vcc7", 600, 3400, 25,
+ RK817_LDO_ON_VSEL_REG(8), RK817_LDO_VSEL_MASK,
+ RK817_POWER_EN_REG(3), ENABLE_MASK(0),
+ DISABLE_VAL(0), 400),
+ RK817_BOOST_DESC(RK817_ID_BOOST, "BOOST", "vcc8", 4700, 5400, 100,
+ RK817_BOOST_OTG_CFG, RK817_BOOST_VSEL_MASK,
+ RK817_POWER_EN_REG(3), ENABLE_MASK(1), ENABLE_MASK(1),
+ DISABLE_VAL(1), 400, 3500 - 5400),
+ RK817_DESC_SWITCH(RK817_ID_BOOST_OTG_SW, "OTG_SWITCH", "vcc9",
+ RK817_POWER_EN_REG(3), ENABLE_MASK(2),
+ DISABLE_VAL(2)),
+};
+
static const struct regulator_desc rk818_reg[] = {
{
.name = "DCDC_REG1",
@@ -759,6 +1351,14 @@ static int rk808_regulator_probe(struct platform_device *pdev)
regulators = rk808_reg;
nregulators = RK808_NUM_REGULATORS;
break;
+ case RK809_ID:
+ regulators = rk809_reg;
+ nregulators = RK809_NUM_REGULATORS;
+ break;
+ case RK817_ID:
+ regulators = rk817_reg;
+ nregulators = RK817_NUM_REGULATORS;
+ break;
case RK818_ID:
regulators = rk818_reg;
nregulators = RK818_NUM_REGULATORS;
@@ -797,6 +1397,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
module_platform_driver(rk808_regulator_driver);
MODULE_DESCRIPTION("regulator driver for the RK808/RK818 series PMICs");
+MODULE_AUTHOR("Tony xie <tony.xie@rock-chips.com>");
MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>");
MODULE_AUTHOR("Zhang Qing <zhangqing@rock-chips.com>");
MODULE_AUTHOR("Wadim Egorov <w.egorov@phytec.de>");
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index b973b0a..b4ce2373 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -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,
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 4/6] dt-bindings: mfd: rk808: Add binding information for RK809 and RK817.
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
` (2 preceding siblings ...)
2018-10-30 10:07 ` [PATCH v6 3/6] regulator: rk808: add RK809 and RK817 support Tony Xie
@ 2018-10-30 10:07 ` Tony Xie
2018-10-30 10:16 ` [PATCH v6 5/6] rtc: rk808: add RK809 and RK817 support Tony Xie
2018-10-30 10:17 ` [PATCH v6 6/6] clk: RK808: " Tony Xie
5 siblings, 0 replies; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:07 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, tony.xie
Add device tree bindings documentation for Rockchip's RK809 & RK817 PMIC.
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
Documentation/devicetree/bindings/mfd/rk808.txt | 44 +++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt
index 91b6522..f306fa0 100644
--- a/Documentation/devicetree/bindings/mfd/rk808.txt
+++ b/Documentation/devicetree/bindings/mfd/rk808.txt
@@ -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
- interrupt-parent: The parent interrupt controller.
@@ -46,6 +50,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
@@ -87,6 +108,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.
@@ -99,6 +135,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
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 5/6] rtc: rk808: add RK809 and RK817 support.
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
` (3 preceding siblings ...)
2018-10-30 10:07 ` [PATCH v6 4/6] dt-bindings: mfd: rk808: Add binding information for RK809 and RK817 Tony Xie
@ 2018-10-30 10:16 ` Tony Xie
2018-10-30 10:17 ` [PATCH v6 6/6] clk: RK808: " Tony Xie
5 siblings, 0 replies; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:16 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, tony.xie
RK809 and RK817 are power management IC chips for multimedia products.
Most of their functions and registers are same, including the rtc.
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/Kconfig | 4 +--
drivers/rtc/rtc-rk808.c | 68 +++++++++++++++++++++++++++++++++++++++----------
2 files changed, 56 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index a2ba5db..1aaf935 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -371,11 +371,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.
diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
index 739c0d4..5bacdaf 100644
--- a/drivers/rtc/rtc-rk808.c
+++ b/drivers/rtc/rtc-rk808.c
@@ -50,9 +50,18 @@
#define NUM_TIME_REGS (RK808_WEEKS_REG - RK808_SECONDS_REG + 1)
#define NUM_ALARM_REGS (RK808_ALARM_YEARS_REG - RK808_ALARM_SECONDS_REG + 1)
+struct rk_rtc_compat_reg {
+ unsigned int ctrl_reg;
+ unsigned int status_reg;
+ unsigned int alarm_seconds_reg;
+ unsigned int int_reg;
+ unsigned int seconds_reg;
+};
+
struct rk808_rtc {
struct rk808 *rk808;
struct rtc_device *rtc;
+ struct rk_rtc_compat_reg *creg;
int irq;
};
@@ -101,7 +110,7 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
int ret;
/* Force an update of the shadowed registers right now */
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->ctrl_reg,
BIT_RTC_CTRL_REG_RTC_GET_TIME,
BIT_RTC_CTRL_REG_RTC_GET_TIME);
if (ret) {
@@ -115,7 +124,7 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
* 32khz. If we clear the GET_TIME bit here, the time of i2c transfer
* certainly more than 31.25us: 16 * 2.5us at 400kHz bus frequency.
*/
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->ctrl_reg,
BIT_RTC_CTRL_REG_RTC_GET_TIME,
0);
if (ret) {
@@ -123,7 +132,7 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
return ret;
}
- ret = regmap_bulk_read(rk808->regmap, RK808_SECONDS_REG,
+ ret = regmap_bulk_read(rk808->regmap, rk808_rtc->creg->seconds_reg,
rtc_data, NUM_TIME_REGS);
if (ret) {
dev_err(dev, "Failed to bulk read rtc_data: %d\n", ret);
@@ -166,7 +175,7 @@ static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm)
rtc_data[6] = bin2bcd(tm->tm_wday);
/* Stop RTC while updating the RTC registers */
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->ctrl_reg,
BIT_RTC_CTRL_REG_STOP_RTC_M,
BIT_RTC_CTRL_REG_STOP_RTC_M);
if (ret) {
@@ -174,14 +183,14 @@ static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm)
return ret;
}
- ret = regmap_bulk_write(rk808->regmap, RK808_SECONDS_REG,
+ ret = regmap_bulk_write(rk808->regmap, rk808_rtc->creg->seconds_reg,
rtc_data, NUM_TIME_REGS);
if (ret) {
dev_err(dev, "Failed to bull write rtc_data: %d\n", ret);
return ret;
}
/* Start RTC again */
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->ctrl_reg,
BIT_RTC_CTRL_REG_STOP_RTC_M, 0);
if (ret) {
dev_err(dev, "Failed to update RTC control: %d\n", ret);
@@ -199,8 +208,13 @@ static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
uint32_t int_reg;
int ret;
- ret = regmap_bulk_read(rk808->regmap, RK808_ALARM_SECONDS_REG,
+ ret = regmap_bulk_read(rk808->regmap,
+ rk808_rtc->creg->alarm_seconds_reg,
alrm_data, NUM_ALARM_REGS);
+ if (ret) {
+ dev_err(dev, "Failed to read RTC alarm date REG: %d\n", ret);
+ return ret;
+ }
alrm->time.tm_sec = bcd2bin(alrm_data[0] & SECONDS_REG_MSK);
alrm->time.tm_min = bcd2bin(alrm_data[1] & MINUTES_REG_MAK);
@@ -210,7 +224,7 @@ static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
alrm->time.tm_year = (bcd2bin(alrm_data[5] & YEARS_REG_MSK)) + 100;
rockchip_to_gregorian(&alrm->time);
- ret = regmap_read(rk808->regmap, RK808_RTC_INT_REG, &int_reg);
+ ret = regmap_read(rk808->regmap, rk808_rtc->creg->int_reg, &int_reg);
if (ret) {
dev_err(dev, "Failed to read RTC INT REG: %d\n", ret);
return ret;
@@ -231,7 +245,7 @@ static int rk808_rtc_stop_alarm(struct rk808_rtc *rk808_rtc)
struct rk808 *rk808 = rk808_rtc->rk808;
int ret;
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_INT_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->int_reg,
BIT_RTC_INTERRUPTS_REG_IT_ALARM_M, 0);
return ret;
@@ -242,7 +256,7 @@ static int rk808_rtc_start_alarm(struct rk808_rtc *rk808_rtc)
struct rk808 *rk808 = rk808_rtc->rk808;
int ret;
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_INT_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->int_reg,
BIT_RTC_INTERRUPTS_REG_IT_ALARM_M,
BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
@@ -274,7 +288,8 @@ static int rk808_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
alrm_data[4] = bin2bcd(alrm->time.tm_mon + 1);
alrm_data[5] = bin2bcd(alrm->time.tm_year - 100);
- ret = regmap_bulk_write(rk808->regmap, RK808_ALARM_SECONDS_REG,
+ ret = regmap_bulk_write(rk808->regmap,
+ rk808_rtc->creg->alarm_seconds_reg,
alrm_data, NUM_ALARM_REGS);
if (ret) {
dev_err(dev, "Failed to bulk write: %d\n", ret);
@@ -318,7 +333,7 @@ static irqreturn_t rk808_alarm_irq(int irq, void *data)
struct i2c_client *client = rk808->i2c;
int ret;
- ret = regmap_write(rk808->regmap, RK808_RTC_STATUS_REG,
+ ret = regmap_write(rk808->regmap, rk808_rtc->creg->status_reg,
RTC_STATUS_MASK);
if (ret) {
dev_err(&client->dev,
@@ -371,6 +386,22 @@ static int rk808_rtc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(rk808_rtc_pm_ops,
rk808_rtc_suspend, rk808_rtc_resume);
+static struct rk_rtc_compat_reg rk808_creg = {
+ .ctrl_reg = RK808_RTC_CTRL_REG,
+ .status_reg = RK808_RTC_STATUS_REG,
+ .alarm_seconds_reg = RK808_ALARM_SECONDS_REG,
+ .int_reg = RK808_RTC_INT_REG,
+ .seconds_reg = RK808_SECONDS_REG,
+};
+
+static struct rk_rtc_compat_reg rk817_creg = {
+ .ctrl_reg = RK817_RTC_CTRL_REG,
+ .status_reg = RK817_RTC_STATUS_REG,
+ .alarm_seconds_reg = RK817_ALARM_SECONDS_REG,
+ .int_reg = RK817_RTC_INT_REG,
+ .seconds_reg = RK817_SECONDS_REG,
+};
+
static int rk808_rtc_probe(struct platform_device *pdev)
{
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
@@ -381,11 +412,20 @@ static int rk808_rtc_probe(struct platform_device *pdev)
if (rk808_rtc == NULL)
return -ENOMEM;
+ switch (rk808->variant) {
+ case RK809_ID:
+ case RK817_ID:
+ rk808_rtc->creg = &rk817_creg;
+ break;
+ default:
+ rk808_rtc->creg = &rk808_creg;
+ break;
+ }
platform_set_drvdata(pdev, rk808_rtc);
rk808_rtc->rk808 = rk808;
/* start rtc running by default, and use shadowed timer. */
- ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
+ ret = regmap_update_bits(rk808->regmap, rk808_rtc->creg->ctrl_reg,
BIT_RTC_CTRL_REG_STOP_RTC_M |
BIT_RTC_CTRL_REG_RTC_READSEL_M,
BIT_RTC_CTRL_REG_RTC_READSEL_M);
@@ -395,7 +435,7 @@ static int rk808_rtc_probe(struct platform_device *pdev)
return ret;
}
- ret = regmap_write(rk808->regmap, RK808_RTC_STATUS_REG,
+ ret = regmap_write(rk808->regmap, rk808_rtc->creg->status_reg,
RTC_STATUS_MASK);
if (ret) {
dev_err(&pdev->dev,
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v6 6/6] clk: RK808: add RK809 and RK817 support.
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
` (4 preceding siblings ...)
2018-10-30 10:16 ` [PATCH v6 5/6] rtc: rk808: add RK809 and RK817 support Tony Xie
@ 2018-10-30 10:17 ` Tony Xie
5 siblings, 0 replies; 9+ messages in thread
From: Tony Xie @ 2018-10-30 10:17 UTC (permalink / raw)
To: heiko
Cc: broonie, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao, 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.
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
---
drivers/clk/Kconfig | 9 ++++---
drivers/clk/clk-rk808.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 67 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 721572a..92cf5ad 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -46,13 +46,12 @@ config COMMON_CLK_MAX77686
clock.
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
diff --git a/drivers/clk/clk-rk808.c b/drivers/clk/clk-rk808.c
index 6461f28..7f9a56b 100644
--- a/drivers/clk/clk-rk808.c
+++ b/drivers/clk/clk-rk808.c
@@ -96,6 +96,68 @@ static int rk808_clkout2_is_prepared(struct clk_hw *hw)
return idx ? &rk808_clkout->clkout2_hw : &rk808_clkout->clkout1_hw;
}
+static int rk817_clkout2_enable(struct clk_hw *hw, bool enable)
+{
+ struct rk808_clkout *rk808_clkout = container_of(hw,
+ struct rk808_clkout,
+ clkout2_hw);
+ struct rk808 *rk808 = rk808_clkout->rk808;
+
+ return regmap_update_bits(rk808->regmap, RK817_SYS_CFG(1),
+ RK817_CLK32KOUT2_EN,
+ enable ? RK817_CLK32KOUT2_EN : 0);
+}
+
+static int rk817_clkout2_prepare(struct clk_hw *hw)
+{
+ return rk817_clkout2_enable(hw, true);
+}
+
+static void rk817_clkout2_unprepare(struct clk_hw *hw)
+{
+ rk817_clkout2_enable(hw, false);
+}
+
+static int rk817_clkout2_is_prepared(struct clk_hw *hw)
+{
+ struct rk808_clkout *rk808_clkout = container_of(hw,
+ struct rk808_clkout,
+ clkout2_hw);
+ struct rk808 *rk808 = rk808_clkout->rk808;
+ unsigned int val;
+
+ int ret = regmap_read(rk808->regmap, RK817_SYS_CFG(1), &val);
+
+ if (ret < 0)
+ return 0;
+
+ return (val & RK817_CLK32KOUT2_EN) ? 1 : 0;
+}
+
+static const struct clk_ops rk817_clkout2_ops = {
+ .prepare = rk817_clkout2_prepare,
+ .unprepare = rk817_clkout2_unprepare,
+ .is_prepared = rk817_clkout2_is_prepared,
+ .recalc_rate = rk808_clkout_recalc_rate,
+};
+
+static const struct clk_ops *rkpmic_get_ops(long variant)
+{
+ switch (variant) {
+ case RK809_ID:
+ case RK817_ID:
+ return &rk817_clkout2_ops;
+ /*
+ * For the default case, it match the following PMIC type.
+ * RK805_ID
+ * RK808_ID
+ * RK818_ID
+ */
+ default:
+ return &rk808_clkout2_ops;
+ }
+}
+
static int rk808_clkout_probe(struct platform_device *pdev)
{
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
@@ -127,7 +189,7 @@ static int rk808_clkout_probe(struct platform_device *pdev)
return ret;
init.name = "rk808-clkout2";
- init.ops = &rk808_clkout2_ops;
+ init.ops = rkpmic_get_ops(rk808->variant);
rk808_clkout->clkout2_hw.init = &init;
/* optional override of the clockname */
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v6 2/6] mfd: rk808: Add RK817 and RK809 support
2018-10-30 10:07 ` [PATCH v6 2/6] mfd: rk808: Add RK817 and RK809 support Tony Xie
@ 2018-11-13 7:26 ` Lee Jones
0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2018-11-13 7:26 UTC (permalink / raw)
To: Tony Xie
Cc: heiko, broonie, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao
On Tue, 30 Oct 2018, Tony Xie wrote:
> The rk809 and rk817 are a Power Management IC (PMIC) for multimedia
"RK809 and RK817"
> and handheld devices. It contains the following components:
s/It contains/They contain/
> - Regulators
> - RTC
> - Clocking
>
> Both RK809 and RK817 chips are using a similar register map,
> so we can reuse the RTC and Clocking and regulators functionality.
By is "Clocking" capitalised, but "regulators" is not?
> Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
> Acked-by: Stephen Boyd <sboyd@kernel.org>
> ---
> drivers/mfd/Kconfig | 6 +-
> drivers/mfd/rk808.c | 225 +++++++++++++++++++++++++++++++++++++++++++---
> include/linux/mfd/rk808.h | 172 +++++++++++++++++++++++++++++++++++
> 3 files changed, 386 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index b860eb5..f8b1922 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -967,14 +967,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.
> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index 216fbf6..9da1035 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -27,6 +27,7 @@
> #include <linux/module.h>
> #include <linux/of_device.h>
> #include <linux/regmap.h>
> +#include <linux/syscore_ops.h>
>
> struct rk808_reg_data {
> int addr;
> @@ -62,6 +63,29 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> return false;
> }
>
> +static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg)
> +{
> + /*
> + * Notes:
> + * - Technically the ROUND_30s bit makes RTC_CTRL_REG volatile, but
> + * we don't use that feature. It's better to cache.
> + * - It's unlikely we care that RK808_DEVCTRL_REG is volatile since
> + * bits are cleared in case when we shutoff anyway, but better safe.
This last line does not read well.
> + */
> +
> + switch (reg) {
> + case RK817_SECONDS_REG ... RK817_WEEKS_REG:
> + case RK817_RTC_STATUS_REG:
> + case RK817_INT_STS_REG0:
> + case RK817_INT_STS_REG1:
> + case RK817_INT_STS_REG2:
> + case RK817_SYS_STS:
> + return true;
> + }
> +
> + return true;
> +}
> +
> static const struct regmap_config rk818_regmap_config = {
> .reg_bits = 8,
> .val_bits = 8,
> @@ -86,6 +110,14 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> .volatile_reg = rk808_is_volatile_reg,
> };
>
> +static const struct regmap_config rk817_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> + .max_register = RK817_GPIO_INT_CFG,
> + .cache_type = REGCACHE_NONE,
> + .volatile_reg = rk817_is_volatile_reg,
> +};
> +
> static struct resource rtc_resources[] = {
> {
> .start = RK808_IRQ_RTC_ALARM,
> @@ -94,6 +126,13 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> }
> };
>
> +static struct resource rk817_rtc_resources[] = {
> + {
> + .start = RK817_IRQ_RTC_ALARM,
> + .end = RK817_IRQ_RTC_ALARM,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
Consider converting these to DEFINE_RES_IRQ_NAMED()
> static struct resource rk805_key_resources[] = {
> {
> .start = RK805_IRQ_PWRON_FALL,
> @@ -107,6 +146,19 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> }
> };
>
> +static struct resource rk817_pwrkey_resources[] = {
> + {
> + .start = RK817_IRQ_PWRON_RISE,
> + .end = RK817_IRQ_PWRON_RISE,
> + .flags = IORESOURCE_IRQ,
> + },
> + {
> + .start = RK817_IRQ_PWRON_FALL,
> + .end = RK817_IRQ_PWRON_FALL,
> + .flags = IORESOURCE_IRQ,
> + },
> +};
> +
> static const struct mfd_cell rk805s[] = {
> { .name = "rk808-clkout", },
> { .name = "rk808-regulator", },
> @@ -132,6 +184,21 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> },
> };
>
> +static const struct mfd_cell rk817s[] = {
> + { .name = "rk808-clkout",},
> + { .name = "rk808-regulator",},
> + {
> + .name = "rk8xx-pwrkey",
> + .num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
> + .resources = &rk817_pwrkey_resources[0],
> + },
> + {
> + .name = "rk808-rtc",
> + .num_resources = ARRAY_SIZE(rk817_rtc_resources),
> + .resources = &rk817_rtc_resources[0],
> + },
> +};
> +
> static const struct mfd_cell rk818s[] = {
> { .name = "rk808-clkout", },
> { .name = "rk808-regulator", },
> @@ -167,6 +234,13 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> VB_LO_SEL_3500MV },
> };
>
> +static const struct rk808_reg_data rk817_pre_init_reg[] = {
> + {RK817_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
> + {RK817_GPIO_INT_CFG, RK817_INT_POL_MSK, RK817_INT_POL_H},
> + {RK817_SYS_CFG(1), RK817_HOTDIE_TEMP_MSK | RK817_TSD_TEMP_MSK,
> + RK817_HOTDIE_105 | RK817_TSD_140},
> +};
> +
> static const struct rk808_reg_data rk818_pre_init_reg[] = {
> /* improve efficiency */
> { RK818_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_250MA },
> @@ -332,6 +406,33 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> },
> };
>
> +static const struct regmap_irq rk817_irqs[RK817_IRQ_END] = {
> + REGMAP_IRQ_REG_LINE(0, 8),
> + REGMAP_IRQ_REG_LINE(1, 8),
> + REGMAP_IRQ_REG_LINE(2, 8),
> + REGMAP_IRQ_REG_LINE(3, 8),
> + REGMAP_IRQ_REG_LINE(4, 8),
> + REGMAP_IRQ_REG_LINE(5, 8),
> + REGMAP_IRQ_REG_LINE(6, 8),
> + REGMAP_IRQ_REG_LINE(7, 8),
> + REGMAP_IRQ_REG_LINE(8, 8),
> + REGMAP_IRQ_REG_LINE(9, 8),
> + REGMAP_IRQ_REG_LINE(10, 8),
> + REGMAP_IRQ_REG_LINE(11, 8),
> + REGMAP_IRQ_REG_LINE(12, 8),
> + REGMAP_IRQ_REG_LINE(13, 8),
> + REGMAP_IRQ_REG_LINE(14, 8),
> + REGMAP_IRQ_REG_LINE(15, 8),
> + REGMAP_IRQ_REG_LINE(16, 8),
> + REGMAP_IRQ_REG_LINE(17, 8),
> + REGMAP_IRQ_REG_LINE(18, 8),
> + REGMAP_IRQ_REG_LINE(19, 8),
> + REGMAP_IRQ_REG_LINE(20, 8),
> + REGMAP_IRQ_REG_LINE(21, 8),
> + REGMAP_IRQ_REG_LINE(22, 8),
> + REGMAP_IRQ_REG_LINE(23, 8)
> +};
> +
> static struct regmap_irq_chip rk805_irq_chip = {
> .name = "rk805",
> .irqs = rk805_irqs,
> @@ -355,6 +456,18 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
> .init_ack_masked = true,
> };
>
> +static struct regmap_irq_chip rk817_irq_chip = {
> + .name = "rk817",
> + .irqs = rk817_irqs,
> + .num_irqs = ARRAY_SIZE(rk817_irqs),
> + .num_regs = 3,
> + .irq_reg_stride = 2,
> + .status_base = RK817_INT_STS_REG0,
> + .mask_base = RK817_INT_STS_MSK_REG0,
> + .ack_base = RK817_INT_STS_REG0,
> + .init_ack_masked = true,
> +};
> +
> static const struct regmap_irq_chip rk818_irq_chip = {
> .name = "rk818",
> .irqs = rk818_irqs,
> @@ -376,7 +489,7 @@ static void rk805_device_shutdown(void)
>
> if (!rk808) {
> dev_warn(&rk808_i2c_client->dev,
> - "have no rk805, so do nothing here\n");
> + "cannot get the driver data of RK808!\n");
This message should be more generic.
Something the use will care about.
Why is it not possible to obtain the driver data?
Also, is this really a warning, or is this scenario valid?
> return;
> }
>
> @@ -394,7 +507,7 @@ static void rk808_device_shutdown(void)
>
> if (!rk808) {
> dev_warn(&rk808_i2c_client->dev,
> - "have no rk808, so do nothing here\n");
> + "cannot get the driver data of RK808!\n");
As above.
> return;
> }
>
> @@ -412,7 +525,7 @@ static void rk818_device_shutdown(void)
>
> if (!rk808) {
> dev_warn(&rk808_i2c_client->dev,
> - "have no rk818, so do nothing here\n");
> + "cannot get the driver data of RK808!\n");
As above.
> return;
> }
>
> @@ -423,9 +536,39 @@ static void rk818_device_shutdown(void)
> dev_err(&rk808_i2c_client->dev, "power off error!\n");
> }
>
> +static void rk8xx_syscore_shutdown(void)
> +{
> + int ret;
> + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
Nit: reverse these 2 entries please.
> + if (!rk808) {
> + dev_warn(&rk808_i2c_client->dev,
> + "cannot get the driver data of RK808!\n");
As above.
> + return;
> + }
> +
> + if (system_state == SYSTEM_POWER_OFF &&
> + (rk808->variant == RK809_ID || rk808->variant == RK817_ID)) {
> + ret = regmap_update_bits(rk808->regmap,
> + RK817_SYS_CFG(3),
> + RK817_SLPPIN_FUNC_MSK,
> + SLPPIN_DN_FUN);
> + if (ret) {
> + dev_warn(&rk808_i2c_client->dev,
> + "the reset pin cannot switch to power down function\n");
This line looks over-sized. Did you run scripts/checkpatch.pl?
> + }
> + }
> +}
> +
> +static struct syscore_ops rk808_syscore_ops = {
> + .shutdown = rk8xx_syscore_shutdown,
> +};
> +
> static const struct of_device_id rk808_of_match[] = {
> { .compatible = "rockchip,rk805" },
> { .compatible = "rockchip,rk808" },
> + { .compatible = "rockchip,rk809" },
> + { .compatible = "rockchip,rk817" },
> { .compatible = "rockchip,rk818" },
> { },
> };
> @@ -438,10 +581,11 @@ static int rk808_probe(struct i2c_client *client,
> struct rk808 *rk808;
> const struct rk808_reg_data *pre_init_reg;
> const struct mfd_cell *cells;
> - void (*pm_pwroff_fn)(void);
> + void (*pm_pwroff_fn)(void) = NULL;
> int nr_pre_init_regs;
> int nr_cells;
> int pm_off = 0, msb, lsb;
> + unsigned char pmic_id_msb, pmic_id_lsb;
> int ret;
> int i;
>
> @@ -449,15 +593,24 @@ static int rk808_probe(struct i2c_client *client,
> if (!rk808)
> return -ENOMEM;
>
> + if (of_device_is_compatible(np, "rockchip,rk817") ||
> + of_device_is_compatible(np, "rockchip,rk809")) {
> + pmic_id_msb = RK817_ID_MSB;
> + pmic_id_lsb = RK817_ID_LSB;
> + } else {
> + pmic_id_msb = RK808_ID_MSB;
> + pmic_id_lsb = RK808_ID_LSB;
> + }
> +
> /* Read chip variant */
> - msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
> + msb = i2c_smbus_read_byte_data(client, pmic_id_msb);
> if (msb < 0) {
> dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
> RK808_ID_MSB);
> return msb;
> }
>
> - lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
> + lsb = i2c_smbus_read_byte_data(client, pmic_id_lsb);
> if (lsb < 0) {
> dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
> RK808_ID_LSB);
> @@ -495,6 +648,16 @@ static int rk808_probe(struct i2c_client *client,
> nr_cells = ARRAY_SIZE(rk818s);
> pm_pwroff_fn = rk818_device_shutdown;
> break;
> + case RK809_ID:
> + case RK817_ID:
> + rk808->regmap_cfg = &rk817_regmap_config;
> + rk808->regmap_irq_chip = &rk817_irq_chip;
> + pre_init_reg = rk817_pre_init_reg;
> + nr_pre_init_regs = ARRAY_SIZE(rk817_pre_init_reg);
> + cells = rk817s;
> + nr_cells = ARRAY_SIZE(rk817s);
> + register_syscore_ops(&rk808_syscore_ops);
> + break;
> default:
> dev_err(&client->dev, "Unsupported RK8XX ID %lu\n",
> rk808->variant);
> @@ -568,22 +731,56 @@ 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 int rk8xx_suspend(struct device *dev)
> +{
> + int ret = 0;
> + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
Nit: reverse these 2 entries please.
> + switch (rk808->variant) {
> + case RK809_ID:
> + case RK817_ID:
> + ret = regmap_update_bits(rk808->regmap,
> + RK817_SYS_CFG(3),
> + RK817_SLPPIN_FUNC_MSK,
> + SLPPIN_SLP_FUN);
> + break;
> + default:
> + break;
> + }
> +
> + return ret;
> +}
Remove this line.
> +static int rk8xx_resume(struct device *dev)
> +{
> + int ret = 0;
> + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
Nit: reverse these 2 entries please.
> + switch (rk808->variant) {
> + case RK809_ID:
> + case RK817_ID:
> + ret = regmap_update_bits(rk808->regmap,
> + RK817_SYS_CFG(3),
> + RK817_SLPPIN_FUNC_MSK,
> + SLPPIN_NULL_FUN);
> + break;
> + default:
> + break;
> + }
> +
> + return ret;
> +}
> +
Remove this line.
> +SIMPLE_DEV_PM_OPS(rk8xx_pm_ops, rk8xx_suspend, rk8xx_resume);
>
> static struct i2c_driver rk808_i2c_driver = {
> .driver = {
> .name = "rk808",
> .of_match_table = rk808_of_match,
> + .pm = &rk8xx_pm_ops,
> },
> .probe = rk808_probe,
> .remove = rk808_remove,
> - .id_table = rk808_ids,
The removal of the ID table should be done in a separate patch.
> };
>
> module_i2c_driver(rk808_i2c_driver);
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index d315659..b973b0a 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -382,6 +382,7 @@ enum rk805_reg {
> #define SWITCH1_EN BIT(5)
> #define DEV_OFF_RST BIT(3)
> #define DEV_OFF BIT(0)
> +#define RTC_STOP BIT(0)
>
> #define VB_LO_ACT BIT(4)
> #define VB_LO_SEL_3500MV (7 << 0)
> @@ -396,6 +397,175 @@ enum rk805_reg {
> #define SLEEP_FUN (0x1 << 2)
> #define RK8XX_ID_MSK 0xfff0
> #define FPWM_MODE BIT(7)
> +enum rk817_reg_id {
> + RK817_ID_DCDC1 = 0,
> + RK817_ID_DCDC2,
> + RK817_ID_DCDC3,
> + RK817_ID_DCDC4,
> + RK817_ID_LDO1,
> + RK817_ID_LDO2,
> + RK817_ID_LDO3,
> + RK817_ID_LDO4,
> + RK817_ID_LDO5,
> + RK817_ID_LDO6,
> + RK817_ID_LDO7,
> + RK817_ID_LDO8,
> + RK817_ID_LDO9,
> + RK817_ID_BOOST,
> + RK817_ID_BOOST_OTG_SW,
> + RK817_NUM_REGULATORS
> +};
> +
> +enum rk809_reg_id {
> + RK809_ID_DCDC5 = RK817_ID_BOOST,
> + RK809_ID_SW1,
> + RK809_ID_SW2,
> + RK809_NUM_REGULATORS
> +};
> +
> +#define RK817_SECONDS_REG 0x00
> +#define RK817_MINUTES_REG 0x01
> +#define RK817_HOURS_REG 0x02
> +#define RK817_DAYS_REG 0x03
> +#define RK817_MONTHS_REG 0x04
> +#define RK817_YEARS_REG 0x05
> +#define RK817_WEEKS_REG 0x06
> +#define RK817_ALARM_SECONDS_REG 0x07
> +#define RK817_ALARM_MINUTES_REG 0x08
> +#define RK817_ALARM_HOURS_REG 0x09
> +#define RK817_ALARM_DAYS_REG 0x0a
> +#define RK817_ALARM_MONTHS_REG 0x0b
> +#define RK817_ALARM_YEARS_REG 0x0c
> +#define RK817_RTC_CTRL_REG 0xd
> +#define RK817_RTC_STATUS_REG 0xe
> +#define RK817_RTC_INT_REG 0xf
> +#define RK817_RTC_COMP_LSB_REG 0x10
> +#define RK817_RTC_COMP_MSB_REG 0x11
> +
> +#define RK817_POWER_EN_REG(i) (0xb1 + (i))
> +#define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i))
> +
> +#define RK817_POWER_CONFIG (0xb9)
> +
> +#define RK817_BUCK_CONFIG_REG(i) (0xba + (i) * 3)
> +
> +#define RK817_BUCK1_ON_VSEL_REG 0xBB
> +#define RK817_BUCK1_SLP_VSEL_REG 0xBC
> +
> +#define RK817_BUCK2_CONFIG_REG 0xBD
> +#define RK817_BUCK2_ON_VSEL_REG 0xBE
> +#define RK817_BUCK2_SLP_VSEL_REG 0xBF
> +
> +#define RK817_BUCK3_CONFIG_REG 0xC0
> +#define RK817_BUCK3_ON_VSEL_REG 0xC1
> +#define RK817_BUCK3_SLP_VSEL_REG 0xC2
> +
> +#define RK817_BUCK4_CONFIG_REG 0xC3
> +#define RK817_BUCK4_ON_VSEL_REG 0xC4
> +#define RK817_BUCK4_SLP_VSEL_REG 0xC5
> +
> +#define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2)
> +#define RK817_BOOST_OTG_CFG (0xde)
> +
> +#define RK817_ID_MSB 0xed
> +#define RK817_ID_LSB 0xee
> +
> +#define RK817_SYS_STS 0xf0
> +#define RK817_SYS_CFG(i) (0xf1 + (i))
> +
> +#define RK817_ON_SOURCE_REG 0xf5
> +#define RK817_OFF_SOURCE_REG 0xf6
> +
> +/* INTERRUPT REGISTER */
> +#define RK817_INT_STS_REG0 0xf8
> +#define RK817_INT_STS_MSK_REG0 0xf9
> +#define RK817_INT_STS_REG1 0xfa
> +#define RK817_INT_STS_MSK_REG1 0xfb
> +#define RK817_INT_STS_REG2 0xfc
> +#define RK817_INT_STS_MSK_REG2 0xfd
> +#define RK817_GPIO_INT_CFG 0xfe
> +
> +/* IRQ Definitions */
> +#define RK817_IRQ_PWRON_FALL 0
> +#define RK817_IRQ_PWRON_RISE 1
> +#define RK817_IRQ_PWRON 2
> +#define RK817_IRQ_PWMON_LP 3
> +#define RK817_IRQ_HOTDIE 4
> +#define RK817_IRQ_RTC_ALARM 5
> +#define RK817_IRQ_RTC_PERIOD 6
> +#define RK817_IRQ_VB_LO 7
> +#define RK817_IRQ_PLUG_IN (8 + 0)
What is 8? Perhaps it should be defined?
> +#define RK817_IRQ_PLUG_OUT (8 + 1)
> +#define RK817_IRQ_CHRG_TERM (8 + 2)
> +#define RK817_IRQ_CHRG_TIME (8 + 3)
> +#define RK817_IRQ_CHRG_TS (8 + 4)
> +#define RK817_IRQ_USB_OV (8 + 5)
> +#define RK817_IRQ_CHRG_IN_CLMP (8 + 6)
> +#define RK817_IRQ_BAT_DIS_ILIM (8 + 7)
> +#define RK817_IRQ_GATE_GPIO (16 + 0)
What is 16? Perhaps it should be defined?
> +#define RK817_IRQ_TS_GPIO (16 + 1)
> +#define RK817_IRQ_CODEC_PD (16 + 2)
> +#define RK817_IRQ_CODEC_PO (16 + 3)
> +#define RK817_IRQ_CLASSD_MUTE_DONE (16 + 4)
> +#define RK817_IRQ_CLASSD_OCP (16 + 5)
> +#define RK817_IRQ_BAT_OVP (16 + 6)
> +#define RK817_IRQ_CHRG_BAT_HI (16 + 7)
> +#define RK817_IRQ_END (RK817_IRQ_CHRG_BAT_HI + 1)
> +
> +/*
> + * rtc_ctrl 0xd
> + * same as 808, except bit4
> + */
> +#define RK817_RTC_CTRL_RSV4 BIT(4)
> +
> +/* power config 0xb9 */
> +#define RK817_BUCK3_FB_RES_MSK BIT(6)
> +#define RK817_BUCK3_FB_RES_INTER BIT(6)
> +#define RK817_BUCK3_FB_RES_EXT 0
> +
> +/* buck config 0xba */
> +#define RK817_RAMP_RATE_OFFSET 6
> +#define RK817_RAMP_RATE_MASK (0x3 << RK817_RAMP_RATE_OFFSET)
> +#define RK817_RAMP_RATE_3MV_PER_US (0x0 << RK817_RAMP_RATE_OFFSET)
> +#define RK817_RAMP_RATE_6_3MV_PER_US (0x1 << RK817_RAMP_RATE_OFFSET)
> +#define RK817_RAMP_RATE_12_5MV_PER_US (0x2 << RK817_RAMP_RATE_OFFSET)
> +#define RK817_RAMP_RATE_25MV_PER_US (0x3 << RK817_RAMP_RATE_OFFSET)
> +
> +/* sys_cfg1 0xf2 */
> +#define RK817_HOTDIE_TEMP_MSK (0x3 << 4)
> +#define RK817_HOTDIE_85 (0x0 << 4)
> +#define RK817_HOTDIE_95 (0x1 << 4)
> +#define RK817_HOTDIE_105 (0x2 << 4)
> +#define RK817_HOTDIE_115 (0x3 << 4)
> +
> +#define RK817_TSD_TEMP_MSK BIT(6)
> +#define RK817_TSD_140 0
> +#define RK817_TSD_160 BIT(6)
> +
> +#define RK817_CLK32KOUT2_EN BIT(7)
> +
> +/* sys_cfg3 0xf4 */
> +#define RK817_SLPPIN_FUNC_MSK (0x3 << 3)
> +#define SLPPIN_NULL_FUN (0x0 << 3)
> +#define SLPPIN_SLP_FUN (0x1 << 3)
> +#define SLPPIN_DN_FUN (0x2 << 3)
> +#define SLPPIN_RST_FUN (0x3 << 3)
> +
> +#define RK817_RST_FUNC_MSK (0x3 << 6)
> +#define RK817_RST_FUNC_SFT (6)
> +#define RK817_RST_FUNC_CNT (3)
> +#define RK817_RST_FUNC_DEV (0) /* reset the dev */
> +#define RK817_RST_FUNC_REG (0x1 << 6) /* reset the reg only */
> +
> +#define RK817_SLPPOL_MSK BIT(5)
> +#define RK817_SLPPOL_H BIT(5)
> +#define RK817_SLPPOL_L (0)
> +
> +/* gpio&int 0xfe */
> +#define RK817_INT_POL_MSK BIT(1)
> +#define RK817_INT_POL_H BIT(1)
> +#define RK817_INT_POL_L 0
> +#define RK809_BUCK5_CONFIG(i) (RK817_BOOST_OTG_CFG + (i) * 1)
>
> enum {
> BUCK_ILMIN_50MA,
> @@ -443,6 +613,8 @@ enum {
> enum {
> RK805_ID = 0x8050,
> RK808_ID = 0x0000,
> + RK809_ID = 0x8090,
> + RK817_ID = 0x8170,
> RK818_ID = 0x8181,
> };
>
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
2018-10-30 10:07 ` [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) Tony Xie
@ 2018-11-14 22:22 ` Mark Brown
0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2018-11-14 22:22 UTC (permalink / raw)
To: Tony Xie
Cc: heiko, lee.jones, robh+dt, mark.rutland, a.zummo,
alexandre.belloni, sboyd, linux-clk, linux-rtc, linux-arm-kernel,
linux-rockchip, devicetree, linux-kernel, chenjh, xsf, zhangqing,
huangtao
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
On Tue, Oct 30, 2018 at 06:07:56PM +0800, Tony Xie wrote:
> if there are lots of irqs for a device and the register addresses for these
> irqs is continuous, we can use this macro to initialize regmap_irq value.
The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a:
Linux 4.20-rc1 (2018-11-04 15:37:52 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-irq-line
for you to fetch changes up to 43fac3238c1d9363b2a93d8d56c2be0c29c64e6c:
regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) (2018-11-14 14:20:45 -0800)
----------------------------------------------------------------
regmap: Add an IRQ_LINE macro to help defining regmap-irq tables
----------------------------------------------------------------
Tony Xie (1):
regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
include/linux/regmap.h | 6 ++++++
1 file changed, 6 insertions(+)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-11-14 22:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 10:07 [PATCH v6 0/6] support a new type of PMIC,including two chips(rk817 and rk809) Tony Xie
2018-10-30 10:07 ` [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) Tony Xie
2018-11-14 22:22 ` Mark Brown
2018-10-30 10:07 ` [PATCH v6 2/6] mfd: rk808: Add RK817 and RK809 support Tony Xie
2018-11-13 7:26 ` Lee Jones
2018-10-30 10:07 ` [PATCH v6 3/6] regulator: rk808: add RK809 and RK817 support Tony Xie
2018-10-30 10:07 ` [PATCH v6 4/6] dt-bindings: mfd: rk808: Add binding information for RK809 and RK817 Tony Xie
2018-10-30 10:16 ` [PATCH v6 5/6] rtc: rk808: add RK809 and RK817 support Tony Xie
2018-10-30 10:17 ` [PATCH v6 6/6] clk: RK808: " Tony Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).