141 lines
5.1 KiB
Diff
141 lines
5.1 KiB
Diff
From: Matrix Screen Controller maintainers
|
|
Subject: [PATCH] mfd: regulator: complete the AXP313A backport for WalnutPi 6.1
|
|
|
|
WalnutPi's 6.1.31 tree already carries an early, partial copy of the
|
|
AXP313A MFD and regulator changes. Complete that backport with the
|
|
upstream shutdown register and power-key resources, use the upstream
|
|
regulator identifiers and names, and include the later CONTROL spelling
|
|
fix from upstream commit 4628b804555773daa982d9578d89fe04fcdde374.
|
|
|
|
The originating upstream commits are stored verbatim beside this patch:
|
|
75c8cb2f4cb218aaf4ea68cab08d6dbc96eeae15 and
|
|
60fd7eb89670d2636ac3156881acbd103c6eba6a.
|
|
|
|
---
|
|
drivers/mfd/axp20x.c | 24 ++++++++++++++++++------
|
|
drivers/regulator/axp20x-regulator.c | 14 +++++++-------
|
|
include/linux/mfd/axp20x.h | 17 +++++++++--------
|
|
3 files changed, 34 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
|
|
--- a/drivers/mfd/axp20x.c
|
|
+++ b/drivers/mfd/axp20x.c
|
|
@@ -160,7 +160,8 @@ static const struct regmap_range axp313a_writeable_ranges[] = {
|
|
};
|
|
|
|
static const struct regmap_range axp313a_volatile_ranges[] = {
|
|
- regmap_reg_range(AXP313A_ON_INDICATE, AXP313A_IRQ_STATE),
|
|
+ regmap_reg_range(AXP313A_SHUTDOWN_CTRL, AXP313A_SHUTDOWN_CTRL),
|
|
+ regmap_reg_range(AXP313A_IRQ_STATE, AXP313A_IRQ_STATE),
|
|
};
|
|
|
|
static const struct regmap_access_table axp313a_writeable_table = {
|
|
@@ -255,6 +256,11 @@ static const struct resource axp809_pek_resources[] = {
|
|
DEFINE_RES_IRQ_NAMED(AXP809_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
|
|
};
|
|
|
|
+static const struct resource axp313a_pek_resources[] = {
|
|
+ DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
|
|
+ DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
|
|
+};
|
|
+
|
|
static const struct regmap_config axp152_regmap_config = {
|
|
.reg_bits = 8,
|
|
.val_bits = 8,
|
|
@@ -735,8 +741,12 @@ static const struct mfd_cell axp152_cells[] = {
|
|
};
|
|
|
|
static struct mfd_cell axp313a_cells[] = {
|
|
- {
|
|
- .name = "axp20x-regulator",
|
|
+ {
|
|
+ .name = "axp20x-regulator",
|
|
+ }, {
|
|
+ .name = "axp313a-pek",
|
|
+ .num_resources = ARRAY_SIZE(axp313a_pek_resources),
|
|
+ .resources = axp313a_pek_resources,
|
|
},
|
|
};
|
|
|
|
@@ -898,9 +909,14 @@ static struct axp20x_dev *axp20x_pm_power_off;
|
|
static void axp20x_power_off(void)
|
|
{
|
|
+ unsigned int shutdown_reg = AXP20X_OFF_CTRL;
|
|
+
|
|
if (axp20x_pm_power_off->variant == AXP288_ID)
|
|
return;
|
|
|
|
- regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
|
|
+ if (axp20x_pm_power_off->variant == AXP313A_ID)
|
|
+ shutdown_reg = AXP313A_SHUTDOWN_CTRL;
|
|
+
|
|
+ regmap_write(axp20x_pm_power_off->regmap, shutdown_reg,
|
|
AXP20X_OFF);
|
|
|
|
/* Give capacitors etc. time to drain to avoid kernel panic msg. */
|
|
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
|
|
--- a/drivers/regulator/axp20x-regulator.c
|
|
+++ b/drivers/regulator/axp20x-regulator.c
|
|
@@ -666,20 +666,20 @@ static const struct regulator_desc axp313a_regulators[] = {
|
|
AXP_DESC_RANGES(AXP313A, DCDC1, "dcdc1", "vin1",
|
|
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)),
|
|
AXP_DESC_RANGES(AXP313A, DCDC2, "dcdc2", "vin2",
|
|
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)),
|
|
AXP_DESC_RANGES(AXP313A, DCDC3, "dcdc3", "vin3",
|
|
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)),
|
|
- AXP_DESC(AXP313A, LDO1, "ldo1", "vin1", 500, 3500, 100,
|
|
- AXP313A_ALDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK,
|
|
+ AXP_DESC(AXP313A, ALDO1, "aldo1", "vin1", 500, 3500, 100,
|
|
+ AXP313A_ALDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
|
|
AXP313A_OUTPUT_CONTROL, BIT(3)),
|
|
- AXP_DESC(AXP313A, LDO2, "ldo2", "vin1", 500, 3500, 100,
|
|
- AXP313A_DLDO1_CONRTOL, AXP313A_LDO_V_OUT_MASK,
|
|
+ AXP_DESC(AXP313A, DLDO1, "dldo1", "vin1", 500, 3500, 100,
|
|
+ AXP313A_DLDO1_CONTROL, AXP313A_LDO_V_OUT_MASK,
|
|
AXP313A_OUTPUT_CONTROL, BIT(4)),
|
|
AXP_DESC_FIXED(AXP313A, RTC_LDO, "rtc-ldo", "vin1", 1800),
|
|
};
|
|
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
|
|
--- a/include/linux/mfd/axp20x.h
|
|
+++ b/include/linux/mfd/axp20x.h
|
|
@@ -94,11 +94,12 @@ enum axp20x_variants {
|
|
|
|
#define AXP313A_ON_INDICATE 0x00
|
|
#define AXP313A_OUTPUT_CONTROL 0x10
|
|
-#define AXP313A_DCDC1_CONRTOL 0x13
|
|
-#define AXP313A_DCDC2_CONRTOL 0x14
|
|
-#define AXP313A_DCDC3_CONRTOL 0x15
|
|
-#define AXP313A_ALDO1_CONRTOL 0x16
|
|
-#define AXP313A_DLDO1_CONRTOL 0x17
|
|
+#define AXP313A_DCDC1_CONTROL 0x13
|
|
+#define AXP313A_DCDC2_CONTROL 0x14
|
|
+#define AXP313A_DCDC3_CONTROL 0x15
|
|
+#define AXP313A_ALDO1_CONTROL 0x16
|
|
+#define AXP313A_DLDO1_CONTROL 0x17
|
|
+#define AXP313A_SHUTDOWN_CTRL 0x1a
|
|
#define AXP313A_OUTPUT_MONITOR 0x1d
|
|
#define AXP313A_IRQ_EN 0x20
|
|
#define AXP313A_IRQ_STATE 0x21
|
|
@@ -338,8 +339,8 @@ enum {
|
|
AXP313A_DCDC1 = 0,
|
|
AXP313A_DCDC2,
|
|
AXP313A_DCDC3,
|
|
- AXP313A_LDO1,
|
|
- AXP313A_LDO2,
|
|
+ AXP313A_ALDO1,
|
|
+ AXP313A_DLDO1,
|
|
AXP313A_RTC_LDO,
|
|
AXP313A_REG_ID_MAX,
|
|
};
|
|
--
|
|
2.39.2
|