Commit cac5fd39 authored by Lee Jones's avatar Lee Jones

Merge branches 'ib-mfd-misc-pinctrl-regulator-6.10',...

Merge branches 'ib-mfd-misc-pinctrl-regulator-6.10', 'ib-mfd-pinctrl-regulator-6.10' and 'ib-mfd-regulator-6.10' into ibs-for-mfd-merged
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/rockchip,rk816.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: RK816 Power Management Integrated Circuit
maintainers:
- Chris Zhong <zyw@rock-chips.com>
- Zhang Qing <zhangqing@rock-chips.com>
description:
Rockchip RK816 series PMIC. This device consists of an i2c controlled MFD
that includes regulators, a RTC, a GPIO controller, a power button, and a
battery charger manager with fuel gauge.
properties:
compatible:
enum:
- rockchip,rk816
reg:
maxItems: 1
interrupts:
maxItems: 1
'#clock-cells':
description:
See <dt-bindings/clock/rockchip,rk808.h> for clock IDs.
const: 1
clock-output-names:
maxItems: 2
gpio-controller: true
'#gpio-cells':
const: 2
system-power-controller:
type: boolean
description:
Telling whether or not this PMIC is controlling the system power.
wakeup-source:
type: boolean
vcc1-supply:
description:
The input supply for dcdc1.
vcc2-supply:
description:
The input supply for dcdc2.
vcc3-supply:
description:
The input supply for dcdc3.
vcc4-supply:
description:
The input supply for dcdc4.
vcc5-supply:
description:
The input supply for ldo1, ldo2, and ldo3.
vcc6-supply:
description:
The input supply for ldo4, ldo5, and ldo6.
vcc7-supply:
description:
The input supply for boost.
vcc8-supply:
description:
The input supply for otg-switch.
regulators:
type: object
patternProperties:
'^(boost|dcdc[1-4]|ldo[1-6]|otg-switch)$':
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
additionalProperties: false
patternProperties:
'-pins$':
type: object
additionalProperties: false
$ref: /schemas/pinctrl/pinmux-node.yaml
properties:
function:
enum: [gpio, thermistor]
pins:
$ref: /schemas/types.yaml#/definitions/string
const: gpio0
required:
- compatible
- reg
- interrupts
- '#clock-cells'
additionalProperties: false
examples:
- |
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
rk816: pmic@1a {
compatible = "rockchip,rk816";
reg = <0x1a>;
interrupt-parent = <&gpio0>;
interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
clock-output-names = "xin32k", "rk816-clkout2";
pinctrl-names = "default";
pinctrl-0 = <&pmic_int_l>;
gpio-controller;
system-power-controller;
wakeup-source;
#clock-cells = <1>;
#gpio-cells = <2>;
vcc1-supply = <&vcc_sys>;
vcc2-supply = <&vcc_sys>;
vcc3-supply = <&vcc_sys>;
vcc4-supply = <&vcc_sys>;
vcc5-supply = <&vcc33_io>;
vcc6-supply = <&vcc_sys>;
regulators {
vdd_cpu: dcdc1 {
regulator-name = "vdd_cpu";
regulator-min-microvolt = <750000>;
regulator-max-microvolt = <1450000>;
regulator-ramp-delay = <6001>;
regulator-initial-mode = <1>;
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vdd_logic: dcdc2 {
regulator-name = "vdd_logic";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1250000>;
regulator-ramp-delay = <6001>;
regulator-initial-mode = <1>;
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1000000>;
};
};
vcc_ddr: dcdc3 {
regulator-name = "vcc_ddr";
regulator-initial-mode = <1>;
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-on-in-suspend;
};
};
vcc33_io: dcdc4 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc33_io";
regulator-initial-mode = <1>;
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
};
vccio_pmu: ldo1 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vccio_pmu";
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
};
vcc_tp: ldo2 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc_tp";
regulator-state-mem {
regulator-off-in-suspend;
};
};
vdd_10: ldo3 {
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-name = "vdd_10";
regulator-always-on;
regulator-boot-on;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1000000>;
};
};
vcc18_lcd: ldo4 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-name = "vcc18_lcd";
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1800000>;
};
};
vccio_sd: ldo5 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vccio_sd";
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <3300000>;
};
};
vdd10_lcd: ldo6 {
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-name = "vdd10_lcd";
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1000000>;
};
};
};
rk816_gpio_pins: gpio-pins {
function = "gpio";
pins = "gpio0";
};
};
};
...@@ -83,6 +83,7 @@ allOf: ...@@ -83,6 +83,7 @@ allOf:
enum: enum:
- x-powers,axp313a - x-powers,axp313a
- x-powers,axp15060 - x-powers,axp15060
- x-powers,axp717
then: then:
properties: properties:
...@@ -99,6 +100,7 @@ properties: ...@@ -99,6 +100,7 @@ properties:
- x-powers,axp221 - x-powers,axp221
- x-powers,axp223 - x-powers,axp223
- x-powers,axp313a - x-powers,axp313a
- x-powers,axp717
- x-powers,axp803 - x-powers,axp803
- x-powers,axp806 - x-powers,axp806
- x-powers,axp809 - x-powers,axp809
......
...@@ -1225,7 +1225,7 @@ config MFD_RK8XX ...@@ -1225,7 +1225,7 @@ config MFD_RK8XX
select MFD_CORE select MFD_CORE
config MFD_RK8XX_I2C config MFD_RK8XX_I2C
tristate "Rockchip RK805/RK808/RK809/RK817/RK818 Power Management Chip" tristate "Rockchip RK805/RK808/RK809/RK816/RK817/RK818 Power Management Chip"
depends on I2C && OF depends on I2C && OF
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
...@@ -1233,7 +1233,7 @@ config MFD_RK8XX_I2C ...@@ -1233,7 +1233,7 @@ config MFD_RK8XX_I2C
select MFD_RK8XX select MFD_RK8XX
help help
If you say yes here you get support for the RK805, RK808, RK809, If you say yes here you get support for the RK805, RK808, RK809,
RK817 and RK818 Power Management chips. RK816, RK817 and RK818 Power Management chips.
This driver provides common support for accessing the device This driver provides common support for accessing the device
through I2C interface. The device supports multiple sub-devices through I2C interface. The device supports multiple sub-devices
including interrupts, RTC, LDO & DCDC regulators, and onkey. including interrupts, RTC, LDO & DCDC regulators, and onkey.
......
...@@ -65,6 +65,7 @@ static const struct of_device_id axp20x_i2c_of_match[] = { ...@@ -65,6 +65,7 @@ static const struct of_device_id axp20x_i2c_of_match[] = {
{ .compatible = "x-powers,axp221", .data = (void *)AXP221_ID }, { .compatible = "x-powers,axp221", .data = (void *)AXP221_ID },
{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID }, { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
{ .compatible = "x-powers,axp313a", .data = (void *)AXP313A_ID }, { .compatible = "x-powers,axp313a", .data = (void *)AXP313A_ID },
{ .compatible = "x-powers,axp717", .data = (void *)AXP717_ID },
{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID }, { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID }, { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
{ .compatible = "x-powers,axp15060", .data = (void *)AXP15060_ID }, { .compatible = "x-powers,axp15060", .data = (void *)AXP15060_ID },
...@@ -81,6 +82,7 @@ static const struct i2c_device_id axp20x_i2c_id[] = { ...@@ -81,6 +82,7 @@ static const struct i2c_device_id axp20x_i2c_id[] = {
{ "axp221", 0 }, { "axp221", 0 },
{ "axp223", 0 }, { "axp223", 0 },
{ "axp313a", 0 }, { "axp313a", 0 },
{ "axp717", 0 },
{ "axp803", 0 }, { "axp803", 0 },
{ "axp806", 0 }, { "axp806", 0 },
{ "axp15060", 0 }, { "axp15060", 0 },
......
...@@ -58,6 +58,7 @@ static void axp20x_rsb_remove(struct sunxi_rsb_device *rdev) ...@@ -58,6 +58,7 @@ static void axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
static const struct of_device_id axp20x_rsb_of_match[] = { static const struct of_device_id axp20x_rsb_of_match[] = {
{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID }, { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
{ .compatible = "x-powers,axp717", .data = (void *)AXP717_ID },
{ .compatible = "x-powers,axp803", .data = (void *)AXP803_ID }, { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
{ .compatible = "x-powers,axp806", .data = (void *)AXP806_ID }, { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID }, { .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
......
...@@ -42,6 +42,7 @@ static const char * const axp20x_model_names[] = { ...@@ -42,6 +42,7 @@ static const char * const axp20x_model_names[] = {
"AXP223", "AXP223",
"AXP288", "AXP288",
"AXP313a", "AXP313a",
"AXP717",
"AXP803", "AXP803",
"AXP806", "AXP806",
"AXP809", "AXP809",
...@@ -207,6 +208,25 @@ static const struct regmap_access_table axp313a_volatile_table = { ...@@ -207,6 +208,25 @@ static const struct regmap_access_table axp313a_volatile_table = {
.n_yes_ranges = ARRAY_SIZE(axp313a_volatile_ranges), .n_yes_ranges = ARRAY_SIZE(axp313a_volatile_ranges),
}; };
static const struct regmap_range axp717_writeable_ranges[] = {
regmap_reg_range(AXP717_IRQ0_EN, AXP717_IRQ4_EN),
regmap_reg_range(AXP717_DCDC_OUTPUT_CONTROL, AXP717_CPUSLDO_CONTROL),
};
static const struct regmap_range axp717_volatile_ranges[] = {
regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE),
};
static const struct regmap_access_table axp717_writeable_table = {
.yes_ranges = axp717_writeable_ranges,
.n_yes_ranges = ARRAY_SIZE(axp717_writeable_ranges),
};
static const struct regmap_access_table axp717_volatile_table = {
.yes_ranges = axp717_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(axp717_volatile_ranges),
};
static const struct regmap_range axp806_volatile_ranges[] = { static const struct regmap_range axp806_volatile_ranges[] = {
regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE), regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
}; };
...@@ -317,6 +337,11 @@ static const struct resource axp313a_pek_resources[] = { ...@@ -317,6 +337,11 @@ static const struct resource axp313a_pek_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_FAL_EDGE, "PEK_DBF"), DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
}; };
static const struct resource axp717_pek_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
};
static const struct resource axp803_pek_resources[] = { static const struct resource axp803_pek_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_RIS_EDGE, "PEK_DBR"), DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_FAL_EDGE, "PEK_DBF"), DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
...@@ -391,6 +416,15 @@ static const struct regmap_config axp313a_regmap_config = { ...@@ -391,6 +416,15 @@ static const struct regmap_config axp313a_regmap_config = {
.cache_type = REGCACHE_MAPLE, .cache_type = REGCACHE_MAPLE,
}; };
static const struct regmap_config axp717_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.wr_table = &axp717_writeable_table,
.volatile_table = &axp717_volatile_table,
.max_register = AXP717_CPUSLDO_CONTROL,
.cache_type = REGCACHE_RBTREE,
};
static const struct regmap_config axp806_regmap_config = { static const struct regmap_config axp806_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
...@@ -589,6 +623,40 @@ static const struct regmap_irq axp313a_regmap_irqs[] = { ...@@ -589,6 +623,40 @@ static const struct regmap_irq axp313a_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP313A, DIE_TEMP_HIGH, 0, 0), INIT_REGMAP_IRQ(AXP313A, DIE_TEMP_HIGH, 0, 0),
}; };
static const struct regmap_irq axp717_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP717, SOC_DROP_LVL2, 0, 7),
INIT_REGMAP_IRQ(AXP717, SOC_DROP_LVL1, 0, 6),
INIT_REGMAP_IRQ(AXP717, GAUGE_NEW_SOC, 0, 4),
INIT_REGMAP_IRQ(AXP717, BOOST_OVER_V, 0, 2),
INIT_REGMAP_IRQ(AXP717, VBUS_OVER_V, 0, 1),
INIT_REGMAP_IRQ(AXP717, VBUS_FAULT, 0, 0),
INIT_REGMAP_IRQ(AXP717, VBUS_PLUGIN, 1, 7),
INIT_REGMAP_IRQ(AXP717, VBUS_REMOVAL, 1, 6),
INIT_REGMAP_IRQ(AXP717, BATT_PLUGIN, 1, 5),
INIT_REGMAP_IRQ(AXP717, BATT_REMOVAL, 1, 4),
INIT_REGMAP_IRQ(AXP717, PEK_SHORT, 1, 3),
INIT_REGMAP_IRQ(AXP717, PEK_LONG, 1, 2),
INIT_REGMAP_IRQ(AXP717, PEK_FAL_EDGE, 1, 1),
INIT_REGMAP_IRQ(AXP717, PEK_RIS_EDGE, 1, 0),
INIT_REGMAP_IRQ(AXP717, WDOG_EXPIRE, 2, 7),
INIT_REGMAP_IRQ(AXP717, LDO_OVER_CURR, 2, 6),
INIT_REGMAP_IRQ(AXP717, BATT_OVER_CURR, 2, 5),
INIT_REGMAP_IRQ(AXP717, CHARG_DONE, 2, 4),
INIT_REGMAP_IRQ(AXP717, CHARG, 2, 3),
INIT_REGMAP_IRQ(AXP717, DIE_TEMP_HIGH, 2, 2),
INIT_REGMAP_IRQ(AXP717, CHARG_TIMER, 2, 1),
INIT_REGMAP_IRQ(AXP717, BATT_OVER_V, 2, 0),
INIT_REGMAP_IRQ(AXP717, BC_USB_DONE, 3, 7),
INIT_REGMAP_IRQ(AXP717, BC_USB_CHNG, 3, 6),
INIT_REGMAP_IRQ(AXP717, BATT_QUIT_TEMP_HIGH, 3, 4),
INIT_REGMAP_IRQ(AXP717, BATT_CHG_TEMP_HIGH, 3, 3),
INIT_REGMAP_IRQ(AXP717, BATT_CHG_TEMP_LOW, 3, 2),
INIT_REGMAP_IRQ(AXP717, BATT_ACT_TEMP_HIGH, 3, 1),
INIT_REGMAP_IRQ(AXP717, BATT_ACT_TEMP_LOW, 3, 0),
INIT_REGMAP_IRQ(AXP717, TYPEC_REMOVE, 4, 6),
INIT_REGMAP_IRQ(AXP717, TYPEC_PLUGIN, 4, 5),
};
static const struct regmap_irq axp803_regmap_irqs[] = { static const struct regmap_irq axp803_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V, 0, 7), INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V, 0, 7),
INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN, 0, 6), INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN, 0, 6),
...@@ -776,6 +844,17 @@ static const struct regmap_irq_chip axp313a_regmap_irq_chip = { ...@@ -776,6 +844,17 @@ static const struct regmap_irq_chip axp313a_regmap_irq_chip = {
.num_regs = 1, .num_regs = 1,
}; };
static const struct regmap_irq_chip axp717_regmap_irq_chip = {
.name = "axp717_irq_chip",
.status_base = AXP717_IRQ0_STATE,
.ack_base = AXP717_IRQ0_STATE,
.unmask_base = AXP717_IRQ0_EN,
.init_ack_masked = true,
.irqs = axp717_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp717_regmap_irqs),
.num_regs = 5,
};
static const struct regmap_irq_chip axp803_regmap_irq_chip = { static const struct regmap_irq_chip axp803_regmap_irq_chip = {
.name = "axp803", .name = "axp803",
.status_base = AXP20X_IRQ1_STATE, .status_base = AXP20X_IRQ1_STATE,
...@@ -941,6 +1020,11 @@ static struct mfd_cell axp313a_cells[] = { ...@@ -941,6 +1020,11 @@ static struct mfd_cell axp313a_cells[] = {
MFD_CELL_RES("axp313a-pek", axp313a_pek_resources), MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
}; };
static struct mfd_cell axp717_cells[] = {
MFD_CELL_NAME("axp20x-regulator"),
MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
};
static const struct resource axp288_adc_resources[] = { static const struct resource axp288_adc_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP288_IRQ_GPADC, "GPADC"), DEFINE_RES_IRQ_NAMED(AXP288_IRQ_GPADC, "GPADC"),
}; };
...@@ -1181,6 +1265,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x) ...@@ -1181,6 +1265,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_cfg = &axp313a_regmap_config; axp20x->regmap_cfg = &axp313a_regmap_config;
axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip; axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
break; break;
case AXP717_ID:
axp20x->nr_cells = ARRAY_SIZE(axp717_cells);
axp20x->cells = axp717_cells;
axp20x->regmap_cfg = &axp717_regmap_config;
axp20x->regmap_irq_chip = &axp717_regmap_irq_chip;
break;
case AXP803_ID: case AXP803_ID:
axp20x->nr_cells = ARRAY_SIZE(axp803_cells); axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
axp20x->cells = axp803_cells; axp20x->cells = axp803_cells;
......
...@@ -28,6 +28,10 @@ static const struct resource rtc_resources[] = { ...@@ -28,6 +28,10 @@ static const struct resource rtc_resources[] = {
DEFINE_RES_IRQ(RK808_IRQ_RTC_ALARM), DEFINE_RES_IRQ(RK808_IRQ_RTC_ALARM),
}; };
static const struct resource rk816_rtc_resources[] = {
DEFINE_RES_IRQ(RK816_IRQ_RTC_ALARM),
};
static const struct resource rk817_rtc_resources[] = { static const struct resource rk817_rtc_resources[] = {
DEFINE_RES_IRQ(RK817_IRQ_RTC_ALARM), DEFINE_RES_IRQ(RK817_IRQ_RTC_ALARM),
}; };
...@@ -87,6 +91,22 @@ static const struct mfd_cell rk808s[] = { ...@@ -87,6 +91,22 @@ static const struct mfd_cell rk808s[] = {
}, },
}; };
static const struct mfd_cell rk816s[] = {
{ .name = "rk805-pinctrl", },
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
{
.name = "rk805-pwrkey",
.num_resources = ARRAY_SIZE(rk805_key_resources),
.resources = rk805_key_resources,
},
{
.name = "rk808-rtc",
.num_resources = ARRAY_SIZE(rk816_rtc_resources),
.resources = rk816_rtc_resources,
},
};
static const struct mfd_cell rk817s[] = { static const struct mfd_cell rk817s[] = {
{ .name = "rk808-clkout", }, { .name = "rk808-clkout", },
{ .name = "rk808-regulator", }, { .name = "rk808-regulator", },
...@@ -148,6 +168,17 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = { ...@@ -148,6 +168,17 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = {
VB_LO_SEL_3500MV }, VB_LO_SEL_3500MV },
}; };
static const struct rk808_reg_data rk816_pre_init_reg[] = {
{ RK818_BUCK1_CONFIG_REG, RK817_RAMP_RATE_MASK,
RK817_RAMP_RATE_12_5MV_PER_US },
{ RK818_BUCK2_CONFIG_REG, RK817_RAMP_RATE_MASK,
RK817_RAMP_RATE_12_5MV_PER_US },
{ RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA },
{ RK808_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP105C},
{ RK808_VB_MON_REG, VBAT_LOW_VOL_MASK | VBAT_LOW_ACT_MASK,
RK808_VBAT_LOW_3V0 | EN_VABT_LOW_SHUT_DOWN },
};
static const struct rk808_reg_data rk817_pre_init_reg[] = { static const struct rk808_reg_data rk817_pre_init_reg[] = {
{RK817_RTC_CTRL_REG, RTC_STOP, RTC_STOP}, {RK817_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
/* Codec specific registers */ /* Codec specific registers */
...@@ -350,6 +381,59 @@ static const struct regmap_irq rk808_irqs[] = { ...@@ -350,6 +381,59 @@ static const struct regmap_irq rk808_irqs[] = {
}, },
}; };
static const unsigned int rk816_irq_status_offsets[] = {
RK816_IRQ_STS_OFFSET(RK816_INT_STS_REG1),
RK816_IRQ_STS_OFFSET(RK816_INT_STS_REG2),
RK816_IRQ_STS_OFFSET(RK816_INT_STS_REG3),
};
static const unsigned int rk816_irq_mask_offsets[] = {
RK816_IRQ_MSK_OFFSET(RK816_INT_STS_MSK_REG1),
RK816_IRQ_MSK_OFFSET(RK816_INT_STS_MSK_REG2),
RK816_IRQ_MSK_OFFSET(RK816_INT_STS_MSK_REG3),
};
static unsigned int rk816_get_irq_reg(struct regmap_irq_chip_data *data,
unsigned int base, int index)
{
unsigned int irq_reg = base;
switch (base) {
case RK816_INT_STS_REG1:
irq_reg += rk816_irq_status_offsets[index];
break;
case RK816_INT_STS_MSK_REG1:
irq_reg += rk816_irq_mask_offsets[index];
break;
}
return irq_reg;
};
static const struct regmap_irq rk816_irqs[] = {
/* INT_STS_REG1 IRQs */
REGMAP_IRQ_REG(RK816_IRQ_PWRON_FALL, 0, RK816_INT_STS_PWRON_FALL),
REGMAP_IRQ_REG(RK816_IRQ_PWRON_RISE, 0, RK816_INT_STS_PWRON_RISE),
/* INT_STS_REG2 IRQs */
REGMAP_IRQ_REG(RK816_IRQ_VB_LOW, 1, RK816_INT_STS_VB_LOW),
REGMAP_IRQ_REG(RK816_IRQ_PWRON, 1, RK816_INT_STS_PWRON),
REGMAP_IRQ_REG(RK816_IRQ_PWRON_LP, 1, RK816_INT_STS_PWRON_LP),
REGMAP_IRQ_REG(RK816_IRQ_HOTDIE, 1, RK816_INT_STS_HOTDIE),
REGMAP_IRQ_REG(RK816_IRQ_RTC_ALARM, 1, RK816_INT_STS_RTC_ALARM),
REGMAP_IRQ_REG(RK816_IRQ_RTC_PERIOD, 1, RK816_INT_STS_RTC_PERIOD),
REGMAP_IRQ_REG(RK816_IRQ_USB_OV, 1, RK816_INT_STS_USB_OV),
/* INT_STS3 IRQs */
REGMAP_IRQ_REG(RK816_IRQ_PLUG_IN, 2, RK816_INT_STS_PLUG_IN),
REGMAP_IRQ_REG(RK816_IRQ_PLUG_OUT, 2, RK816_INT_STS_PLUG_OUT),
REGMAP_IRQ_REG(RK816_IRQ_CHG_OK, 2, RK816_INT_STS_CHG_OK),
REGMAP_IRQ_REG(RK816_IRQ_CHG_TE, 2, RK816_INT_STS_CHG_TE),
REGMAP_IRQ_REG(RK816_IRQ_CHG_TS, 2, RK816_INT_STS_CHG_TS),
REGMAP_IRQ_REG(RK816_IRQ_CHG_CVTLIM, 2, RK816_INT_STS_CHG_CVTLIM),
REGMAP_IRQ_REG(RK816_IRQ_DISCHG_ILIM, 2, RK816_INT_STS_DISCHG_ILIM),
};
static const struct regmap_irq rk818_irqs[] = { static const struct regmap_irq rk818_irqs[] = {
/* INT_STS */ /* INT_STS */
[RK818_IRQ_VOUT_LO] = { [RK818_IRQ_VOUT_LO] = {
...@@ -482,6 +566,18 @@ static const struct regmap_irq_chip rk808_irq_chip = { ...@@ -482,6 +566,18 @@ static const struct regmap_irq_chip rk808_irq_chip = {
.init_ack_masked = true, .init_ack_masked = true,
}; };
static const struct regmap_irq_chip rk816_irq_chip = {
.name = "rk816",
.irqs = rk816_irqs,
.num_irqs = ARRAY_SIZE(rk816_irqs),
.num_regs = 3,
.get_irq_reg = rk816_get_irq_reg,
.status_base = RK816_INT_STS_REG1,
.mask_base = RK816_INT_STS_MSK_REG1,
.ack_base = RK816_INT_STS_REG1,
.init_ack_masked = true,
};
static struct regmap_irq_chip rk817_irq_chip = { static struct regmap_irq_chip rk817_irq_chip = {
.name = "rk817", .name = "rk817",
.irqs = rk817_irqs, .irqs = rk817_irqs,
...@@ -530,6 +626,7 @@ static int rk808_power_off(struct sys_off_data *data) ...@@ -530,6 +626,7 @@ static int rk808_power_off(struct sys_off_data *data)
reg = RK817_SYS_CFG(3); reg = RK817_SYS_CFG(3);
bit = DEV_OFF; bit = DEV_OFF;
break; break;
case RK816_ID:
case RK818_ID: case RK818_ID:
reg = RK818_DEVCTRL_REG; reg = RK818_DEVCTRL_REG;
bit = DEV_OFF; bit = DEV_OFF;
...@@ -637,6 +734,13 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmap ...@@ -637,6 +734,13 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmap
cells = rk808s; cells = rk808s;
nr_cells = ARRAY_SIZE(rk808s); nr_cells = ARRAY_SIZE(rk808s);
break; break;
case RK816_ID:
rk808->regmap_irq_chip = &rk816_irq_chip;
pre_init_reg = rk816_pre_init_reg;
nr_pre_init_regs = ARRAY_SIZE(rk816_pre_init_reg);
cells = rk816s;
nr_cells = ARRAY_SIZE(rk816s);
break;
case RK818_ID: case RK818_ID:
rk808->regmap_irq_chip = &rk818_irq_chip; rk808->regmap_irq_chip = &rk818_irq_chip;
pre_init_reg = rk818_pre_init_reg; pre_init_reg = rk818_pre_init_reg;
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Rockchip RK808/RK818 Core (I2C) driver * Rockchip RK805/RK808/RK816/RK817/RK818 Core (I2C) driver
* *
* Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
* Copyright (C) 2016 PHYTEC Messtechnik GmbH * Copyright (C) 2016 PHYTEC Messtechnik GmbH
...@@ -49,6 +49,35 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg) ...@@ -49,6 +49,35 @@ static bool rk808_is_volatile_reg(struct device *dev, unsigned int reg)
return false; return false;
} }
static bool rk816_is_volatile_reg(struct device *dev, unsigned int reg)
{
/*
* Technically the ROUND_30s bit makes RTC_CTRL_REG volatile, but
* we don't use that feature. It's better to cache.
*/
switch (reg) {
case RK808_SECONDS_REG ... RK808_WEEKS_REG:
case RK808_RTC_STATUS_REG:
case RK808_VB_MON_REG:
case RK808_THERMAL_REG:
case RK816_DCDC_EN_REG1:
case RK816_DCDC_EN_REG2:
case RK816_INT_STS_REG1:
case RK816_INT_STS_REG2:
case RK816_INT_STS_REG3:
case RK808_DEVCTRL_REG:
case RK816_SUP_STS_REG:
case RK816_GGSTS_REG:
case RK816_ZERO_CUR_ADC_REGH:
case RK816_ZERO_CUR_ADC_REGL:
case RK816_GASCNT_REG(0) ... RK816_BAT_VOL_REGL:
return true;
}
return false;
}
static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg) static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg)
{ {
/* /*
...@@ -100,6 +129,14 @@ static const struct regmap_config rk808_regmap_config = { ...@@ -100,6 +129,14 @@ static const struct regmap_config rk808_regmap_config = {
.volatile_reg = rk808_is_volatile_reg, .volatile_reg = rk808_is_volatile_reg,
}; };
static const struct regmap_config rk816_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = RK816_DATA_REG(18),
.cache_type = REGCACHE_MAPLE,
.volatile_reg = rk816_is_volatile_reg,
};
static const struct regmap_config rk817_regmap_config = { static const struct regmap_config rk817_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
...@@ -123,6 +160,11 @@ static const struct rk8xx_i2c_platform_data rk809_data = { ...@@ -123,6 +160,11 @@ static const struct rk8xx_i2c_platform_data rk809_data = {
.variant = RK809_ID, .variant = RK809_ID,
}; };
static const struct rk8xx_i2c_platform_data rk816_data = {
.regmap_cfg = &rk816_regmap_config,
.variant = RK816_ID,
};
static const struct rk8xx_i2c_platform_data rk817_data = { static const struct rk8xx_i2c_platform_data rk817_data = {
.regmap_cfg = &rk817_regmap_config, .regmap_cfg = &rk817_regmap_config,
.variant = RK817_ID, .variant = RK817_ID,
...@@ -161,6 +203,7 @@ static const struct of_device_id rk8xx_i2c_of_match[] = { ...@@ -161,6 +203,7 @@ static const struct of_device_id rk8xx_i2c_of_match[] = {
{ .compatible = "rockchip,rk805", .data = &rk805_data }, { .compatible = "rockchip,rk805", .data = &rk805_data },
{ .compatible = "rockchip,rk808", .data = &rk808_data }, { .compatible = "rockchip,rk808", .data = &rk808_data },
{ .compatible = "rockchip,rk809", .data = &rk809_data }, { .compatible = "rockchip,rk809", .data = &rk809_data },
{ .compatible = "rockchip,rk816", .data = &rk816_data },
{ .compatible = "rockchip,rk817", .data = &rk817_data }, { .compatible = "rockchip,rk817", .data = &rk817_data },
{ .compatible = "rockchip,rk818", .data = &rk818_data }, { .compatible = "rockchip,rk818", .data = &rk818_data },
{ }, { },
......
...@@ -93,6 +93,11 @@ enum rk806_pinmux_option { ...@@ -93,6 +93,11 @@ enum rk806_pinmux_option {
RK806_PINMUX_FUN5, RK806_PINMUX_FUN5,
}; };
enum rk816_pinmux_option {
RK816_PINMUX_THERMISTOR,
RK816_PINMUX_GPIO,
};
enum { enum {
RK805_GPIO0, RK805_GPIO0,
RK805_GPIO1, RK805_GPIO1,
...@@ -104,6 +109,10 @@ enum { ...@@ -104,6 +109,10 @@ enum {
RK806_GPIO_DVS3 RK806_GPIO_DVS3
}; };
enum {
RK816_GPIO0,
};
static const char *const rk805_gpio_groups[] = { static const char *const rk805_gpio_groups[] = {
"gpio0", "gpio0",
"gpio1", "gpio1",
...@@ -115,6 +124,10 @@ static const char *const rk806_gpio_groups[] = { ...@@ -115,6 +124,10 @@ static const char *const rk806_gpio_groups[] = {
"gpio_pwrctrl3", "gpio_pwrctrl3",
}; };
static const char *const rk816_gpio_groups[] = {
"gpio0",
};
/* RK805: 2 output only GPIOs */ /* RK805: 2 output only GPIOs */
static const struct pinctrl_pin_desc rk805_pins_desc[] = { static const struct pinctrl_pin_desc rk805_pins_desc[] = {
PINCTRL_PIN(RK805_GPIO0, "gpio0"), PINCTRL_PIN(RK805_GPIO0, "gpio0"),
...@@ -128,6 +141,11 @@ static const struct pinctrl_pin_desc rk806_pins_desc[] = { ...@@ -128,6 +141,11 @@ static const struct pinctrl_pin_desc rk806_pins_desc[] = {
PINCTRL_PIN(RK806_GPIO_DVS3, "gpio_pwrctrl3"), PINCTRL_PIN(RK806_GPIO_DVS3, "gpio_pwrctrl3"),
}; };
/* RK816 */
static const struct pinctrl_pin_desc rk816_pins_desc[] = {
PINCTRL_PIN(RK816_GPIO0, "gpio0"),
};
static const struct rk805_pin_function rk805_pin_functions[] = { static const struct rk805_pin_function rk805_pin_functions[] = {
{ {
.name = "gpio", .name = "gpio",
...@@ -176,6 +194,21 @@ static const struct rk805_pin_function rk806_pin_functions[] = { ...@@ -176,6 +194,21 @@ static const struct rk805_pin_function rk806_pin_functions[] = {
}, },
}; };
static const struct rk805_pin_function rk816_pin_functions[] = {
{
.name = "gpio",
.groups = rk816_gpio_groups,
.ngroups = ARRAY_SIZE(rk816_gpio_groups),
.mux_option = RK816_PINMUX_GPIO,
},
{
.name = "thermistor",
.groups = rk816_gpio_groups,
.ngroups = ARRAY_SIZE(rk816_gpio_groups),
.mux_option = RK816_PINMUX_THERMISTOR,
},
};
static const struct rk805_pin_group rk805_pin_groups[] = { static const struct rk805_pin_group rk805_pin_groups[] = {
{ {
.name = "gpio0", .name = "gpio0",
...@@ -207,6 +240,14 @@ static const struct rk805_pin_group rk806_pin_groups[] = { ...@@ -207,6 +240,14 @@ static const struct rk805_pin_group rk806_pin_groups[] = {
} }
}; };
static const struct rk805_pin_group rk816_pin_groups[] = {
{
.name = "gpio0",
.pins = { RK816_GPIO0 },
.npins = 1,
},
};
#define RK805_GPIO0_VAL_MSK BIT(0) #define RK805_GPIO0_VAL_MSK BIT(0)
#define RK805_GPIO1_VAL_MSK BIT(1) #define RK805_GPIO1_VAL_MSK BIT(1)
...@@ -255,6 +296,20 @@ static struct rk805_pin_config rk806_gpio_cfgs[] = { ...@@ -255,6 +296,20 @@ static struct rk805_pin_config rk806_gpio_cfgs[] = {
} }
}; };
#define RK816_FUN_MASK BIT(2)
#define RK816_VAL_MASK BIT(3)
#define RK816_DIR_MASK BIT(4)
static struct rk805_pin_config rk816_gpio_cfgs[] = {
{
.fun_reg = RK818_IO_POL_REG,
.fun_msk = RK816_FUN_MASK,
.reg = RK818_IO_POL_REG,
.val_msk = RK816_VAL_MASK,
.dir_msk = RK816_DIR_MASK,
},
};
/* generic gpio chip */ /* generic gpio chip */
static int rk805_gpio_get(struct gpio_chip *chip, unsigned int offset) static int rk805_gpio_get(struct gpio_chip *chip, unsigned int offset)
{ {
...@@ -439,6 +494,8 @@ static int rk805_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev, ...@@ -439,6 +494,8 @@ static int rk805_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev,
return _rk805_pinctrl_set_mux(pctldev, offset, RK805_PINMUX_GPIO); return _rk805_pinctrl_set_mux(pctldev, offset, RK805_PINMUX_GPIO);
case RK806_ID: case RK806_ID:
return _rk805_pinctrl_set_mux(pctldev, offset, RK806_PINMUX_FUN5); return _rk805_pinctrl_set_mux(pctldev, offset, RK806_PINMUX_FUN5);
case RK816_ID:
return _rk805_pinctrl_set_mux(pctldev, offset, RK816_PINMUX_GPIO);
} }
return -ENOTSUPP; return -ENOTSUPP;
...@@ -588,6 +645,18 @@ static int rk805_pinctrl_probe(struct platform_device *pdev) ...@@ -588,6 +645,18 @@ static int rk805_pinctrl_probe(struct platform_device *pdev)
pci->pin_cfg = rk806_gpio_cfgs; pci->pin_cfg = rk806_gpio_cfgs;
pci->gpio_chip.ngpio = ARRAY_SIZE(rk806_gpio_cfgs); pci->gpio_chip.ngpio = ARRAY_SIZE(rk806_gpio_cfgs);
break; break;
case RK816_ID:
pci->pins = rk816_pins_desc;
pci->num_pins = ARRAY_SIZE(rk816_pins_desc);
pci->functions = rk816_pin_functions;
pci->num_functions = ARRAY_SIZE(rk816_pin_functions);
pci->groups = rk816_pin_groups;
pci->num_pin_groups = ARRAY_SIZE(rk816_pin_groups);
pci->pinctrl_desc.pins = rk816_pins_desc;
pci->pinctrl_desc.npins = ARRAY_SIZE(rk816_pins_desc);
pci->pin_cfg = rk816_gpio_cfgs;
pci->gpio_chip.ngpio = ARRAY_SIZE(rk816_gpio_cfgs);
break;
default: default:
dev_err(&pdev->dev, "unsupported RK805 ID %lu\n", dev_err(&pdev->dev, "unsupported RK805 ID %lu\n",
pci->rk808->variant); pci->rk808->variant);
......
...@@ -138,6 +138,12 @@ ...@@ -138,6 +138,12 @@
#define AXP313A_DCDC_V_OUT_MASK GENMASK(6, 0) #define AXP313A_DCDC_V_OUT_MASK GENMASK(6, 0)
#define AXP313A_LDO_V_OUT_MASK GENMASK(4, 0) #define AXP313A_LDO_V_OUT_MASK GENMASK(4, 0)
#define AXP717_DCDC1_NUM_VOLTAGES 88
#define AXP717_DCDC2_NUM_VOLTAGES 107
#define AXP717_DCDC3_NUM_VOLTAGES 104
#define AXP717_DCDC_V_OUT_MASK GENMASK(6, 0)
#define AXP717_LDO_V_OUT_MASK GENMASK(4, 0)
#define AXP803_PWR_OUT_DCDC1_MASK BIT_MASK(0) #define AXP803_PWR_OUT_DCDC1_MASK BIT_MASK(0)
#define AXP803_PWR_OUT_DCDC2_MASK BIT_MASK(1) #define AXP803_PWR_OUT_DCDC2_MASK BIT_MASK(1)
#define AXP803_PWR_OUT_DCDC3_MASK BIT_MASK(2) #define AXP803_PWR_OUT_DCDC3_MASK BIT_MASK(2)
...@@ -733,25 +739,98 @@ static const struct linear_range axp313a_dcdc3_ranges[] = { ...@@ -733,25 +739,98 @@ static const struct linear_range axp313a_dcdc3_ranges[] = {
static const struct regulator_desc axp313a_regulators[] = { static const struct regulator_desc axp313a_regulators[] = {
AXP_DESC_RANGES(AXP313A, DCDC1, "dcdc1", "vin1", AXP_DESC_RANGES(AXP313A, DCDC1, "dcdc1", "vin1",
axp313a_dcdc1_ranges, AXP313A_DCDC1_NUM_VOLTAGES, axp313a_dcdc1_ranges, AXP313A_DCDC1_NUM_VOLTAGES,
AXP313A_DCDC1_CONRTOL, AXP313A_DCDC_V_OUT_MASK, AXP313A_DCDC1_CONTROL, AXP313A_DCDC_V_OUT_MASK,
AXP313A_OUTPUT_CONTROL, BIT(0)), AXP313A_OUTPUT_CONTROL, BIT(0)),
AXP_DESC_RANGES(AXP313A, DCDC2, "dcdc2", "vin2", AXP_DESC_RANGES(AXP313A, DCDC2, "dcdc2", "vin2",
axp313a_dcdc2_ranges, AXP313A_DCDC23_NUM_VOLTAGES, axp313a_dcdc2_ranges, AXP313A_DCDC23_NUM_VOLTAGES,
AXP313A_DCDC2_CONRTOL, AXP313A_DCDC_V_OUT_MASK, AXP313A_DCDC2_CONTROL, AXP313A_DCDC_V_OUT_MASK,
AXP313A_OUTPUT_CONTROL, BIT(1)), AXP313A_OUTPUT_CONTROL, BIT(1)),
AXP_DESC_RANGES(AXP313A, DCDC3, "dcdc3", "vin3", AXP_DESC_RANGES(AXP313A, DCDC3, "dcdc3", "vin3",
axp313a_dcdc3_ranges, AXP313A_DCDC23_NUM_VOLTAGES, axp313a_dcdc3_ranges, AXP313A_DCDC23_NUM_VOLTAGES,
AXP313A_DCDC3_CONRTOL, AXP313A_DCDC_V_OUT_MASK, AXP313A_DCDC3_CONTROL, AXP313A_DCDC_V_OUT_MASK,
AXP313A_OUTPUT_CONTROL, BIT(2)), AXP313A_OUTPUT_CONTROL, BIT(2)),
AXP_DESC(AXP313A, ALDO1, "aldo1", "vin1", 500, 3500, 100, AXP_DESC(AXP313A, ALDO1, "aldo1", "vin1", 500, 3500, 100,
AXP313A_ALDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK, AXP313A_ALDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
AXP313A_OUTPUT_CONTROL, BIT(3)), AXP313A_OUTPUT_CONTROL, BIT(3)),
AXP_DESC(AXP313A, DLDO1, "dldo1", "vin1", 500, 3500, 100, AXP_DESC(AXP313A, DLDO1, "dldo1", "vin1", 500, 3500, 100,
AXP313A_DLDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK, AXP313A_DLDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
AXP313A_OUTPUT_CONTROL, BIT(4)), AXP313A_OUTPUT_CONTROL, BIT(4)),
AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800), AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
}; };
static const struct linear_range axp717_dcdc1_ranges[] = {
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
};
static const struct linear_range axp717_dcdc2_ranges[] = {
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
REGULATOR_LINEAR_RANGE(1220000, 71, 87, 20000),
REGULATOR_LINEAR_RANGE(1600000, 88, 107, 100000),
};
static const struct linear_range axp717_dcdc3_ranges[] = {
REGULATOR_LINEAR_RANGE(500000, 0, 70, 10000),
REGULATOR_LINEAR_RANGE(1220000, 71, 102, 20000),
};
static const struct regulator_desc axp717_regulators[] = {
AXP_DESC_RANGES(AXP717, DCDC1, "dcdc1", "vin1",
axp717_dcdc1_ranges, AXP717_DCDC1_NUM_VOLTAGES,
AXP717_DCDC1_CONTROL, AXP717_DCDC_V_OUT_MASK,
AXP717_DCDC_OUTPUT_CONTROL, BIT(0)),
AXP_DESC_RANGES(AXP717, DCDC2, "dcdc2", "vin2",
axp717_dcdc2_ranges, AXP717_DCDC2_NUM_VOLTAGES,
AXP717_DCDC2_CONTROL, AXP717_DCDC_V_OUT_MASK,
AXP717_DCDC_OUTPUT_CONTROL, BIT(1)),
AXP_DESC_RANGES(AXP717, DCDC3, "dcdc3", "vin3",
axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES,
AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK,
AXP717_DCDC_OUTPUT_CONTROL, BIT(2)),
AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
AXP_DESC(AXP717, ALDO1, "aldo1", "vin1", 500, 3500, 100,
AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),
AXP_DESC(AXP717, ALDO2, "aldo2", "vin1", 500, 3500, 100,
AXP717_ALDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(1)),
AXP_DESC(AXP717, ALDO3, "aldo3", "vin1", 500, 3500, 100,
AXP717_ALDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(2)),
AXP_DESC(AXP717, ALDO4, "aldo4", "vin1", 500, 3500, 100,
AXP717_ALDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(3)),
AXP_DESC(AXP717, BLDO1, "bldo1", "vin1", 500, 3500, 100,
AXP717_BLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(4)),
AXP_DESC(AXP717, BLDO2, "bldo2", "vin1", 500, 3500, 100,
AXP717_BLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(5)),
AXP_DESC(AXP717, BLDO3, "bldo3", "vin1", 500, 3500, 100,
AXP717_BLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(6)),
AXP_DESC(AXP717, BLDO4, "bldo4", "vin1", 500, 3500, 100,
AXP717_BLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO0_OUTPUT_CONTROL, BIT(7)),
AXP_DESC(AXP717, CLDO1, "cldo1", "vin1", 500, 3500, 100,
AXP717_CLDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO1_OUTPUT_CONTROL, BIT(0)),
AXP_DESC(AXP717, CLDO2, "cldo2", "vin1", 500, 3500, 100,
AXP717_CLDO2_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO1_OUTPUT_CONTROL, BIT(1)),
AXP_DESC(AXP717, CLDO3, "cldo3", "vin1", 500, 3500, 100,
AXP717_CLDO3_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO1_OUTPUT_CONTROL, BIT(2)),
AXP_DESC(AXP717, CLDO4, "cldo4", "vin1", 500, 3500, 100,
AXP717_CLDO4_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO1_OUTPUT_CONTROL, BIT(3)),
AXP_DESC(AXP717, CPUSLDO, "cpusldo", "vin1", 500, 1400, 50,
AXP717_CPUSLDO_CONTROL, AXP717_LDO_V_OUT_MASK,
AXP717_LDO1_OUTPUT_CONTROL, BIT(4)),
};
/* DCDC ranges shared with AXP813 */ /* DCDC ranges shared with AXP813 */
static const struct linear_range axp803_dcdc234_ranges[] = { static const struct linear_range axp803_dcdc234_ranges[] = {
REGULATOR_LINEAR_RANGE(500000, REGULATOR_LINEAR_RANGE(500000,
...@@ -1253,6 +1332,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) ...@@ -1253,6 +1332,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
step = 150; step = 150;
break; break;
case AXP313A_ID: case AXP313A_ID:
case AXP717_ID:
case AXP15060_ID: case AXP15060_ID:
/* The DCDC PWM frequency seems to be fixed to 3 MHz. */ /* The DCDC PWM frequency seems to be fixed to 3 MHz. */
if (dcdcfreq != 0) { if (dcdcfreq != 0) {
...@@ -1479,6 +1559,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev) ...@@ -1479,6 +1559,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
regulators = axp313a_regulators; regulators = axp313a_regulators;
nregulators = AXP313A_REG_ID_MAX; nregulators = AXP313A_REG_ID_MAX;
break; break;
case AXP717_ID:
regulators = axp717_regulators;
nregulators = AXP717_REG_ID_MAX;
break;
case AXP803_ID: case AXP803_ID:
regulators = axp803_regulators; regulators = axp803_regulators;
nregulators = AXP803_REG_ID_MAX; nregulators = AXP803_REG_ID_MAX;
......
...@@ -158,6 +158,11 @@ ...@@ -158,6 +158,11 @@
RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \ RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
_vmask, _ereg, _emask, 0, 0, _etime, &rk808_reg_ops) _vmask, _ereg, _emask, 0, 0, _etime, &rk808_reg_ops)
#define RK816_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, &rk816_reg_ops)
#define RK817_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \ #define RK817_DESC(_id, _match, _supply, _min, _max, _step, _vreg, \
_vmask, _ereg, _emask, _disval, _etime) \ _vmask, _ereg, _emask, _disval, _etime) \
RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \ RK8XX_DESC_COM(_id, _match, _supply, _min, _max, _step, _vreg, \
...@@ -258,7 +263,7 @@ static const unsigned int rk808_buck1_2_ramp_table[] = { ...@@ -258,7 +263,7 @@ static const unsigned int rk808_buck1_2_ramp_table[] = {
2000, 4000, 6000, 10000 2000, 4000, 6000, 10000
}; };
/* RK817 RK809 */ /* RK817/RK809/RK816 (buck 1/2 only) */
static const unsigned int rk817_buck1_4_ramp_table[] = { static const unsigned int rk817_buck1_4_ramp_table[] = {
3000, 6300, 12500, 25000 3000, 6300, 12500, 25000
}; };
...@@ -534,15 +539,25 @@ static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv) ...@@ -534,15 +539,25 @@ static int rk808_set_suspend_voltage_range(struct regulator_dev *rdev, int uv)
{ {
unsigned int reg; unsigned int reg;
int sel = regulator_map_voltage_linear_range(rdev, uv, uv); int sel = regulator_map_voltage_linear_range(rdev, uv, uv);
int ret;
if (sel < 0) if (sel < 0)
return -EINVAL; return -EINVAL;
reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET; reg = rdev->desc->vsel_reg + RK808_SLP_REG_OFFSET;
return regmap_update_bits(rdev->regmap, reg, ret = regmap_update_bits(rdev->regmap, reg,
rdev->desc->vsel_mask, rdev->desc->vsel_mask,
sel); sel);
if (ret)
return ret;
if (rdev->desc->apply_bit)
ret = regmap_update_bits(rdev->regmap, rdev->desc->apply_reg,
rdev->desc->apply_bit,
rdev->desc->apply_bit);
return ret;
} }
static int rk805_set_suspend_enable(struct regulator_dev *rdev) static int rk805_set_suspend_enable(struct regulator_dev *rdev)
...@@ -630,6 +645,38 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev) ...@@ -630,6 +645,38 @@ static int rk808_set_suspend_disable(struct regulator_dev *rdev)
rdev->desc->enable_mask); rdev->desc->enable_mask);
} }
static const struct rk8xx_register_bit rk816_suspend_bits[] = {
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG1, 0),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG1, 1),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG1, 2),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG1, 3),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG2, 0),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG2, 1),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG2, 2),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG2, 3),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG2, 4),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG2, 5),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG1, 5),
RK8XX_REG_BIT(RK818_SLEEP_SET_OFF_REG1, 6),
};
static int rk816_set_suspend_enable(struct regulator_dev *rdev)
{
int rid = rdev_get_id(rdev);
return regmap_update_bits(rdev->regmap, rk816_suspend_bits[rid].reg,
rk816_suspend_bits[rid].bit,
rk816_suspend_bits[rid].bit);
}
static int rk816_set_suspend_disable(struct regulator_dev *rdev)
{
int rid = rdev_get_id(rdev);
return regmap_update_bits(rdev->regmap, rk816_suspend_bits[rid].reg,
rk816_suspend_bits[rid].bit, 0);
}
static int rk817_set_suspend_enable_ctrl(struct regulator_dev *rdev, static int rk817_set_suspend_enable_ctrl(struct regulator_dev *rdev,
unsigned int en) unsigned int en)
{ {
...@@ -903,6 +950,54 @@ static const struct regulator_ops rk809_buck5_ops_range = { ...@@ -903,6 +950,54 @@ static const struct regulator_ops rk809_buck5_ops_range = {
.set_suspend_disable = rk817_set_suspend_disable, .set_suspend_disable = rk817_set_suspend_disable,
}; };
static const struct regulator_ops rk816_buck1_2_ops_ranges = {
.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 = regulator_is_enabled_regmap,
.set_mode = rk8xx_set_mode,
.get_mode = rk8xx_get_mode,
.set_suspend_mode = rk8xx_set_suspend_mode,
.set_ramp_delay = regulator_set_ramp_delay_regmap,
.set_suspend_voltage = rk808_set_suspend_voltage_range,
.set_suspend_enable = rk816_set_suspend_enable,
.set_suspend_disable = rk816_set_suspend_disable,
};
static const struct regulator_ops rk816_buck4_ops_ranges = {
.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 = regulator_is_enabled_regmap,
.set_mode = rk8xx_set_mode,
.get_mode = rk8xx_get_mode,
.set_suspend_mode = rk8xx_set_suspend_mode,
.set_suspend_voltage = rk808_set_suspend_voltage_range,
.set_suspend_enable = rk816_set_suspend_enable,
.set_suspend_disable = rk816_set_suspend_disable,
};
static const struct regulator_ops rk816_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 = rk808_set_suspend_voltage,
.set_suspend_enable = rk816_set_suspend_enable,
.set_suspend_disable = rk816_set_suspend_disable,
};
static const struct regulator_ops rk817_reg_ops = { static const struct regulator_ops rk817_reg_ops = {
.list_voltage = regulator_list_voltage_linear, .list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
...@@ -1382,6 +1477,117 @@ static const struct regulator_desc rk809_reg[] = { ...@@ -1382,6 +1477,117 @@ static const struct regulator_desc rk809_reg[] = {
DISABLE_VAL(3)), DISABLE_VAL(3)),
}; };
static const struct linear_range rk816_buck_4_voltage_ranges[] = {
REGULATOR_LINEAR_RANGE(800000, 0, 26, 100000),
REGULATOR_LINEAR_RANGE(3500000, 27, 31, 0),
};
static const struct regulator_desc rk816_reg[] = {
{
.name = "dcdc1",
.supply_name = "vcc1",
.of_match = of_match_ptr("dcdc1"),
.regulators_node = of_match_ptr("regulators"),
.id = RK816_ID_DCDC1,
.ops = &rk816_buck1_2_ops_ranges,
.type = REGULATOR_VOLTAGE,
.n_voltages = 64,
.linear_ranges = rk805_buck_1_2_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk805_buck_1_2_voltage_ranges),
.vsel_reg = RK818_BUCK1_ON_VSEL_REG,
.vsel_mask = RK818_BUCK_VSEL_MASK,
.apply_reg = RK816_DCDC_EN_REG2,
.apply_bit = RK816_BUCK_DVS_CONFIRM,
.enable_reg = RK816_DCDC_EN_REG1,
.enable_mask = BIT(4) | BIT(0),
.enable_val = BIT(4) | BIT(0),
.disable_val = BIT(4),
.ramp_reg = RK818_BUCK1_CONFIG_REG,
.ramp_mask = RK808_RAMP_RATE_MASK,
.ramp_delay_table = rk817_buck1_4_ramp_table,
.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
.of_map_mode = rk8xx_regulator_of_map_mode,
.owner = THIS_MODULE,
}, {
.name = "dcdc2",
.supply_name = "vcc2",
.of_match = of_match_ptr("dcdc2"),
.regulators_node = of_match_ptr("regulators"),
.id = RK816_ID_DCDC2,
.ops = &rk816_buck1_2_ops_ranges,
.type = REGULATOR_VOLTAGE,
.n_voltages = 64,
.linear_ranges = rk805_buck_1_2_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk805_buck_1_2_voltage_ranges),
.vsel_reg = RK818_BUCK2_ON_VSEL_REG,
.vsel_mask = RK818_BUCK_VSEL_MASK,
.apply_reg = RK816_DCDC_EN_REG2,
.apply_bit = RK816_BUCK_DVS_CONFIRM,
.enable_reg = RK816_DCDC_EN_REG1,
.enable_mask = BIT(5) | BIT(1),
.enable_val = BIT(5) | BIT(1),
.disable_val = BIT(5),
.ramp_reg = RK818_BUCK2_CONFIG_REG,
.ramp_mask = RK808_RAMP_RATE_MASK,
.ramp_delay_table = rk817_buck1_4_ramp_table,
.n_ramp_values = ARRAY_SIZE(rk817_buck1_4_ramp_table),
.of_map_mode = rk8xx_regulator_of_map_mode,
.owner = THIS_MODULE,
}, {
.name = "dcdc3",
.supply_name = "vcc3",
.of_match = of_match_ptr("dcdc3"),
.regulators_node = of_match_ptr("regulators"),
.id = RK816_ID_DCDC3,
.ops = &rk808_switch_ops,
.type = REGULATOR_VOLTAGE,
.n_voltages = 1,
.enable_reg = RK816_DCDC_EN_REG1,
.enable_mask = BIT(6) | BIT(2),
.enable_val = BIT(6) | BIT(2),
.disable_val = BIT(6),
.of_map_mode = rk8xx_regulator_of_map_mode,
.owner = THIS_MODULE,
}, {
.name = "dcdc4",
.supply_name = "vcc4",
.of_match = of_match_ptr("dcdc4"),
.regulators_node = of_match_ptr("regulators"),
.id = RK816_ID_DCDC4,
.ops = &rk816_buck4_ops_ranges,
.type = REGULATOR_VOLTAGE,
.n_voltages = 32,
.linear_ranges = rk816_buck_4_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(rk816_buck_4_voltage_ranges),
.vsel_reg = RK818_BUCK4_ON_VSEL_REG,
.vsel_mask = RK818_BUCK4_VSEL_MASK,
.enable_reg = RK816_DCDC_EN_REG1,
.enable_mask = BIT(7) | BIT(3),
.enable_val = BIT(7) | BIT(3),
.disable_val = BIT(7),
.of_map_mode = rk8xx_regulator_of_map_mode,
.owner = THIS_MODULE,
},
RK816_DESC(RK816_ID_LDO1, "ldo1", "vcc5", 800, 3400, 100,
RK818_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
RK816_LDO_EN_REG1, ENABLE_MASK(0), DISABLE_VAL(0), 400),
RK816_DESC(RK816_ID_LDO2, "ldo2", "vcc5", 800, 3400, 100,
RK818_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
RK816_LDO_EN_REG1, ENABLE_MASK(1), DISABLE_VAL(1), 400),
RK816_DESC(RK816_ID_LDO3, "ldo3", "vcc5", 800, 3400, 100,
RK818_LDO3_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
RK816_LDO_EN_REG1, ENABLE_MASK(2), DISABLE_VAL(2), 400),
RK816_DESC(RK816_ID_LDO4, "ldo4", "vcc6", 800, 3400, 100,
RK818_LDO4_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
RK816_LDO_EN_REG1, ENABLE_MASK(3), DISABLE_VAL(3), 400),
RK816_DESC(RK816_ID_LDO5, "ldo5", "vcc6", 800, 3400, 100,
RK818_LDO5_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
RK816_LDO_EN_REG2, ENABLE_MASK(0), DISABLE_VAL(0), 400),
RK816_DESC(RK816_ID_LDO6, "ldo6", "vcc6", 800, 3400, 100,
RK818_LDO6_ON_VSEL_REG, RK818_LDO_VSEL_MASK,
RK816_LDO_EN_REG2, ENABLE_MASK(1), DISABLE_VAL(1), 400),
};
static const struct regulator_desc rk817_reg[] = { static const struct regulator_desc rk817_reg[] = {
{ {
.name = "DCDC_REG1", .name = "DCDC_REG1",
...@@ -1704,6 +1910,10 @@ static int rk808_regulator_probe(struct platform_device *pdev) ...@@ -1704,6 +1910,10 @@ static int rk808_regulator_probe(struct platform_device *pdev)
regulators = rk809_reg; regulators = rk809_reg;
nregulators = RK809_NUM_REGULATORS; nregulators = RK809_NUM_REGULATORS;
break; break;
case RK816_ID:
regulators = rk816_reg;
nregulators = ARRAY_SIZE(rk816_reg);
break;
case RK817_ID: case RK817_ID:
regulators = rk817_reg; regulators = rk817_reg;
nregulators = RK817_NUM_REGULATORS; nregulators = RK817_NUM_REGULATORS;
......
...@@ -19,6 +19,7 @@ enum axp20x_variants { ...@@ -19,6 +19,7 @@ enum axp20x_variants {
AXP223_ID, AXP223_ID,
AXP288_ID, AXP288_ID,
AXP313A_ID, AXP313A_ID,
AXP717_ID,
AXP803_ID, AXP803_ID,
AXP806_ID, AXP806_ID,
AXP809_ID, AXP809_ID,
...@@ -104,15 +105,47 @@ enum axp20x_variants { ...@@ -104,15 +105,47 @@ enum axp20x_variants {
#define AXP313A_ON_INDICATE 0x00 #define AXP313A_ON_INDICATE 0x00
#define AXP313A_OUTPUT_CONTROL 0x10 #define AXP313A_OUTPUT_CONTROL 0x10
#define AXP313A_DCDC1_CONRTOL 0x13 #define AXP313A_DCDC1_CONTROL 0x13
#define AXP313A_DCDC2_CONRTOL 0x14 #define AXP313A_DCDC2_CONTROL 0x14
#define AXP313A_DCDC3_CONRTOL 0x15 #define AXP313A_DCDC3_CONTROL 0x15
#define AXP313A_ALDO1_CONRTOL 0x16 #define AXP313A_ALDO1_CONTROL 0x16
#define AXP313A_DLDO1_CONRTOL 0x17 #define AXP313A_DLDO1_CONTROL 0x17
#define AXP313A_SHUTDOWN_CTRL 0x1a #define AXP313A_SHUTDOWN_CTRL 0x1a
#define AXP313A_IRQ_EN 0x20 #define AXP313A_IRQ_EN 0x20
#define AXP313A_IRQ_STATE 0x21 #define AXP313A_IRQ_STATE 0x21
#define AXP717_ON_INDICATE 0x00
#define AXP717_IRQ0_EN 0x40
#define AXP717_IRQ1_EN 0x41
#define AXP717_IRQ2_EN 0x42
#define AXP717_IRQ3_EN 0x43
#define AXP717_IRQ4_EN 0x44
#define AXP717_IRQ0_STATE 0x48
#define AXP717_IRQ1_STATE 0x49
#define AXP717_IRQ2_STATE 0x4a
#define AXP717_IRQ3_STATE 0x4b
#define AXP717_IRQ4_STATE 0x4c
#define AXP717_DCDC_OUTPUT_CONTROL 0x80
#define AXP717_DCDC1_CONTROL 0x83
#define AXP717_DCDC2_CONTROL 0x84
#define AXP717_DCDC3_CONTROL 0x85
#define AXP717_DCDC4_CONTROL 0x86
#define AXP717_LDO0_OUTPUT_CONTROL 0x90
#define AXP717_LDO1_OUTPUT_CONTROL 0x91
#define AXP717_ALDO1_CONTROL 0x93
#define AXP717_ALDO2_CONTROL 0x94
#define AXP717_ALDO3_CONTROL 0x95
#define AXP717_ALDO4_CONTROL 0x96
#define AXP717_BLDO1_CONTROL 0x97
#define AXP717_BLDO2_CONTROL 0x98
#define AXP717_BLDO3_CONTROL 0x99
#define AXP717_BLDO4_CONTROL 0x9a
#define AXP717_CLDO1_CONTROL 0x9b
#define AXP717_CLDO2_CONTROL 0x9c
#define AXP717_CLDO3_CONTROL 0x9d
#define AXP717_CLDO4_CONTROL 0x9e
#define AXP717_CPUSLDO_CONTROL 0x9f
#define AXP806_STARTUP_SRC 0x00 #define AXP806_STARTUP_SRC 0x00
#define AXP806_CHIP_ID 0x03 #define AXP806_CHIP_ID 0x03
#define AXP806_PWR_OUT_CTRL1 0x10 #define AXP806_PWR_OUT_CTRL1 0x10
...@@ -433,6 +466,27 @@ enum { ...@@ -433,6 +466,27 @@ enum {
AXP313A_REG_ID_MAX, AXP313A_REG_ID_MAX,
}; };
enum {
AXP717_DCDC1 = 0,
AXP717_DCDC2,
AXP717_DCDC3,
AXP717_DCDC4,
AXP717_ALDO1,
AXP717_ALDO2,
AXP717_ALDO3,
AXP717_ALDO4,
AXP717_BLDO1,
AXP717_BLDO2,
AXP717_BLDO3,
AXP717_BLDO4,
AXP717_CLDO1,
AXP717_CLDO2,
AXP717_CLDO3,
AXP717_CLDO4,
AXP717_CPUSLDO,
AXP717_REG_ID_MAX,
};
enum { enum {
AXP806_DCDCA = 0, AXP806_DCDCA = 0,
AXP806_DCDCB, AXP806_DCDCB,
...@@ -732,6 +786,40 @@ enum axp313a_irqs { ...@@ -732,6 +786,40 @@ enum axp313a_irqs {
AXP313A_IRQ_PEK_RIS_EDGE, AXP313A_IRQ_PEK_RIS_EDGE,
}; };
enum axp717_irqs {
AXP717_IRQ_VBUS_FAULT,
AXP717_IRQ_VBUS_OVER_V,
AXP717_IRQ_BOOST_OVER_V,
AXP717_IRQ_GAUGE_NEW_SOC = 4,
AXP717_IRQ_SOC_DROP_LVL1 = 6,
AXP717_IRQ_SOC_DROP_LVL2,
AXP717_IRQ_PEK_RIS_EDGE,
AXP717_IRQ_PEK_FAL_EDGE,
AXP717_IRQ_PEK_LONG,
AXP717_IRQ_PEK_SHORT,
AXP717_IRQ_BATT_REMOVAL,
AXP717_IRQ_BATT_PLUGIN,
AXP717_IRQ_VBUS_REMOVAL,
AXP717_IRQ_VBUS_PLUGIN,
AXP717_IRQ_BATT_OVER_V,
AXP717_IRQ_CHARG_TIMER,
AXP717_IRQ_DIE_TEMP_HIGH,
AXP717_IRQ_CHARG,
AXP717_IRQ_CHARG_DONE,
AXP717_IRQ_BATT_OVER_CURR,
AXP717_IRQ_LDO_OVER_CURR,
AXP717_IRQ_WDOG_EXPIRE,
AXP717_IRQ_BATT_ACT_TEMP_LOW,
AXP717_IRQ_BATT_ACT_TEMP_HIGH,
AXP717_IRQ_BATT_CHG_TEMP_LOW,
AXP717_IRQ_BATT_CHG_TEMP_HIGH,
AXP717_IRQ_BATT_QUIT_TEMP_HIGH,
AXP717_IRQ_BC_USB_CHNG = 30,
AXP717_IRQ_BC_USB_DONE,
AXP717_IRQ_TYPEC_PLUGIN = 37,
AXP717_IRQ_TYPEC_REMOVE,
};
enum axp803_irqs { enum axp803_irqs {
AXP803_IRQ_ACIN_OVER_V = 1, AXP803_IRQ_ACIN_OVER_V = 1,
AXP803_IRQ_ACIN_PLUGIN, AXP803_IRQ_ACIN_PLUGIN,
......
...@@ -113,6 +113,148 @@ enum rk808_reg { ...@@ -113,6 +113,148 @@ enum rk808_reg {
#define RK808_INT_STS_MSK_REG2 0x4f #define RK808_INT_STS_MSK_REG2 0x4f
#define RK808_IO_POL_REG 0x50 #define RK808_IO_POL_REG 0x50
/* RK816 */
enum rk816_reg {
RK816_ID_DCDC1,
RK816_ID_DCDC2,
RK816_ID_DCDC3,
RK816_ID_DCDC4,
RK816_ID_LDO1,
RK816_ID_LDO2,
RK816_ID_LDO3,
RK816_ID_LDO4,
RK816_ID_LDO5,
RK816_ID_LDO6,
RK816_ID_BOOST,
RK816_ID_OTG_SW,
};
enum rk816_irqs {
/* INT_STS_REG1 */
RK816_IRQ_PWRON_FALL,
RK816_IRQ_PWRON_RISE,
/* INT_STS_REG2 */
RK816_IRQ_VB_LOW,
RK816_IRQ_PWRON,
RK816_IRQ_PWRON_LP,
RK816_IRQ_HOTDIE,
RK816_IRQ_RTC_ALARM,
RK816_IRQ_RTC_PERIOD,
RK816_IRQ_USB_OV,
/* INT_STS_REG3 */
RK816_IRQ_PLUG_IN,
RK816_IRQ_PLUG_OUT,
RK816_IRQ_CHG_OK,
RK816_IRQ_CHG_TE,
RK816_IRQ_CHG_TS,
RK816_IRQ_CHG_CVTLIM,
RK816_IRQ_DISCHG_ILIM,
};
/* power channel registers */
#define RK816_DCDC_EN_REG1 0x23
#define RK816_DCDC_EN_REG2 0x24
#define RK816_BOOST_EN BIT(1)
#define RK816_OTG_EN BIT(2)
#define RK816_BOOST_EN_MSK BIT(5)
#define RK816_OTG_EN_MSK BIT(6)
#define RK816_BUCK_DVS_CONFIRM BIT(7)
#define RK816_LDO_EN_REG1 0x27
#define RK816_LDO_EN_REG2 0x28
/* interrupt registers and irq definitions */
#define RK816_INT_STS_REG1 0x49
#define RK816_INT_STS_MSK_REG1 0x4a
#define RK816_INT_STS_PWRON_FALL BIT(5)
#define RK816_INT_STS_PWRON_RISE BIT(6)
#define RK816_INT_STS_REG2 0x4c
#define RK816_INT_STS_MSK_REG2 0x4d
#define RK816_INT_STS_VB_LOW BIT(1)
#define RK816_INT_STS_PWRON BIT(2)
#define RK816_INT_STS_PWRON_LP BIT(3)
#define RK816_INT_STS_HOTDIE BIT(4)
#define RK816_INT_STS_RTC_ALARM BIT(5)
#define RK816_INT_STS_RTC_PERIOD BIT(6)
#define RK816_INT_STS_USB_OV BIT(7)
#define RK816_INT_STS_REG3 0x4e
#define RK816_INT_STS_MSK_REG3 0x4f
#define RK816_INT_STS_PLUG_IN BIT(0)
#define RK816_INT_STS_PLUG_OUT BIT(1)
#define RK816_INT_STS_CHG_OK BIT(2)
#define RK816_INT_STS_CHG_TE BIT(3)
#define RK816_INT_STS_CHG_TS BIT(4)
#define RK816_INT_STS_CHG_CVTLIM BIT(6)
#define RK816_INT_STS_DISCHG_ILIM BIT(7)
#define RK816_IRQ_STS_OFFSET(x) ((x) - RK816_INT_STS_REG1)
#define RK816_IRQ_MSK_OFFSET(x) ((x) - RK816_INT_STS_MSK_REG1)
/* charger, boost and OTG registers */
#define RK816_OTG_BUCK_LDO_CONFIG_REG 0x2a
#define RK816_CHRG_CONFIG_REG 0x2b
#define RK816_BOOST_ON_VESL_REG 0x54
#define RK816_BOOST_SLP_VSEL_REG 0x55
#define RK816_CHRG_BOOST_CONFIG_REG 0x9a
#define RK816_SUP_STS_REG 0xa0
#define RK816_USB_CTRL_REG 0xa1
#define RK816_CHRG_CTRL(x) (0xa3 + (x))
#define RK816_BAT_CTRL_REG 0xa6
#define RK816_BAT_HTS_TS_REG 0xa8
#define RK816_BAT_LTS_TS_REG 0xa9
/* adc and fuel gauge registers */
#define RK816_TS_CTRL_REG 0xac
#define RK816_ADC_CTRL_REG 0xad
#define RK816_GGCON_REG 0xb0
#define RK816_GGSTS_REG 0xb1
#define RK816_ZERO_CUR_ADC_REGH 0xb2
#define RK816_ZERO_CUR_ADC_REGL 0xb3
#define RK816_GASCNT_CAL_REG(x) (0xb7 - (x))
#define RK816_GASCNT_REG(x) (0xbb - (x))
#define RK816_BAT_CUR_AVG_REGH 0xbc
#define RK816_BAT_CUR_AVG_REGL 0xbd
#define RK816_TS_ADC_REGH 0xbe
#define RK816_TS_ADC_REGL 0xbf
#define RK816_USB_ADC_REGH 0xc0
#define RK816_USB_ADC_REGL 0xc1
#define RK816_BAT_OCV_REGH 0xc2
#define RK816_BAT_OCV_REGL 0xc3
#define RK816_BAT_VOL_REGH 0xc4
#define RK816_BAT_VOL_REGL 0xc5
#define RK816_RELAX_ENTRY_THRES_REGH 0xc6
#define RK816_RELAX_ENTRY_THRES_REGL 0xc7
#define RK816_RELAX_EXIT_THRES_REGH 0xc8
#define RK816_RELAX_EXIT_THRES_REGL 0xc9
#define RK816_RELAX_VOL1_REGH 0xca
#define RK816_RELAX_VOL1_REGL 0xcb
#define RK816_RELAX_VOL2_REGH 0xcc
#define RK816_RELAX_VOL2_REGL 0xcd
#define RK816_RELAX_CUR1_REGH 0xce
#define RK816_RELAX_CUR1_REGL 0xcf
#define RK816_RELAX_CUR2_REGH 0xd0
#define RK816_RELAX_CUR2_REGL 0xd1
#define RK816_CAL_OFFSET_REGH 0xd2
#define RK816_CAL_OFFSET_REGL 0xd3
#define RK816_NON_ACT_TIMER_CNT_REG 0xd4
#define RK816_VCALIB0_REGH 0xd5
#define RK816_VCALIB0_REGL 0xd6
#define RK816_VCALIB1_REGH 0xd7
#define RK816_VCALIB1_REGL 0xd8
#define RK816_FCC_GASCNT_REG(x) (0xdc - (x))
#define RK816_IOFFSET_REGH 0xdd
#define RK816_IOFFSET_REGL 0xde
#define RK816_SLEEP_CON_SAMP_CUR_REG 0xdf
/* general purpose data registers 0xe0 ~ 0xf2 */
#define RK816_DATA_REG(x) (0xe0 + (x))
/* RK818 */ /* RK818 */
#define RK818_DCDC1 0 #define RK818_DCDC1 0
#define RK818_LDO1 4 #define RK818_LDO1 4
...@@ -791,6 +933,7 @@ enum rk806_dvs_mode { ...@@ -791,6 +933,7 @@ enum rk806_dvs_mode {
#define VOUT_LO_INT BIT(0) #define VOUT_LO_INT BIT(0)
#define CLK32KOUT2_EN BIT(0) #define CLK32KOUT2_EN BIT(0)
#define TEMP105C 0x08
#define TEMP115C 0x0c #define TEMP115C 0x0c
#define TEMP_HOTDIE_MSK 0x0c #define TEMP_HOTDIE_MSK 0x0c
#define SLP_SD_MSK (0x3 << 2) #define SLP_SD_MSK (0x3 << 2)
...@@ -1191,6 +1334,7 @@ enum { ...@@ -1191,6 +1334,7 @@ enum {
RK806_ID = 0x8060, RK806_ID = 0x8060,
RK808_ID = 0x0000, RK808_ID = 0x0000,
RK809_ID = 0x8090, RK809_ID = 0x8090,
RK816_ID = 0x8160,
RK817_ID = 0x8170, RK817_ID = 0x8170,
RK818_ID = 0x8180, RK818_ID = 0x8180,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment