build/patch/kernel/archive/sunxi-6.5/patches.megous/regulator-axp20x-Turn-N_VBUSEN-to-input-on-x-powers-sense-vbus-.patch

55 lines
1.8 KiB
Diff

From 77457d0a70b70f61c6a8b00db5f4a06858a97cdb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Tue, 9 Jun 2020 22:00:36 +0200
Subject: [PATCH 215/464] regulator: axp20x: Turn N_VBUSEN to input on
x-powers,sense-vbus-en
When x-powers,sense-vbus-en is present on the PMIC DT node, force
the N_VBUSEN to be an input. This is necessary on boards that
have N_VBUSEN connected to VBUS enabling switch to make PMIC
not charge when the board is generating VBUS voltage itself.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts | 4 ++++
drivers/regulator/axp20x-regulator.c | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
index 4e7e237cb46a..bdca3e118ee4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
@@ -15,6 +15,10 @@ wifi_pwrseq: wifi-pwrseq {
};
};
+&axp803 {
+ x-powers,sense-vbus-en;
+};
+
&backlight {
power-supply = <&reg_ldo_io0>;
/*
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 76329662cb57..8067fa4442d0 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -1618,6 +1618,14 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
&aldo1_name);
}
+ if (!drivevbus &&
+ of_property_read_bool(pdev->dev.parent->of_node, "x-powers,sense-vbus-en")) {
+ /* make N_VBUSEN an input */
+ regmap_update_bits(axp20x->regmap, AXP20X_OVER_TMP,
+ AXP22X_MISC_N_VBUSEN_FUNC,
+ AXP22X_MISC_N_VBUSEN_FUNC);
+ }
+
if (drivevbus) {
struct regulator_desc *new_desc;
bool drivevbus_vin = false;
--
2.34.1