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

55 lines
1.8 KiB
Diff
Raw Permalink Normal View History

From 2bf4df1e80f67e386ba5ddebb20a6c5a89c43da9 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 211/469] 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 0bb6805a53b9..cc1868061f35 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -1344,6 +1344,14 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
&dcdc5_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