armbian_build/patch/kernel/archive/sunxi-6.6/patches.megous/power-supply-ip5xxx-Modify-initial-configuration.patch
Gunjan Gupta d1186b8a0e kernel: sunxi: Add patches for 6.6 kernel
I have changed the way the patches are generated a bit. Instead of using orange-pi branch from megous tree for 6.6 kernel, I have used the following kernel branches

	a83t-suspend, af8133j, anx, audio,
	axp, cam, drm, err, fixes, mbus,
	modem, opi3, pb, pinetab, pp, ppkb,
	samuel, speed, tbs-a711, ths

These branches were carefully chosen to include only allwinner related patches and remove importing of the rockchip related patches into the allwinner kernel.

Following patches are modified to fix patch application failure
- patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-reg_usb1_vbus-status-ok.patch
- patches.armbian/arm64-dts-sun50i-h616-orangepi-zero2-Enable-GPU-mali.patch
- patches.armbian/arm64-dts-allwinner-h616-Add-efuse_xlate-cpu-frequency-scaling-v1_6_2.patch
- patches.armbian/arm64-dts-allwinner-h616-LED-green_power_on-red_status_heartbeat.patch
- patches.armbian/arm64-dts-allwinner-overlay-Add-Overlays-for-sunxi64.patch
- patches.armbian/arm64-dts-sun50i-h616-bigtreetech-cb1.patch

Following patches are modified because of kernel api change to fix compilation failure
- patches.armbian/drv-gpu-drm-sun4i-Add-HDMI-audio-sun4i-hdmi-encoder.patch
- patches.armbian/drv-of-Device-Tree-Overlay-ConfigFS-interface.patch
2023-10-30 22:58:11 +05:30

79 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 2 Apr 2022 03:15:45 +0200
Subject: power: supply: ip5xxx: Modify initial configuration
- double press to power off
- disable auto-power on under load
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/power/supply/ip5xxx_power.c | 22 +++++++---
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/power/supply/ip5xxx_power.c b/drivers/power/supply/ip5xxx_power.c
index 9641990f76ab..6ef7708f45aa 100644
--- a/drivers/power/supply/ip5xxx_power.c
+++ b/drivers/power/supply/ip5xxx_power.c
@@ -121,6 +121,16 @@ static int ip5xxx_initialize(struct power_supply *psy)
if (ip5xxx->initialized)
return 0;
+ /*
+ * Disable flashlight feature.
+ */
+ ret = ip5xxx_update_bits(ip5xxx, IP5XXX_SYS_CTL0,
+ IP5XXX_SYS_CTL0_WLED_DET_EN |
+ IP5XXX_SYS_CTL0_WLED_EN,
+ 0);
+ if (ret)
+ return ret;
+
/*
* Disable shutdown under light load.
* Enable power on when under load.
@@ -128,12 +138,12 @@ static int ip5xxx_initialize(struct power_supply *psy)
ret = ip5xxx_update_bits(ip5xxx, IP5XXX_SYS_CTL1,
IP5XXX_SYS_CTL1_LIGHT_SHDN_EN |
IP5XXX_SYS_CTL1_LOAD_PWRUP_EN,
- IP5XXX_SYS_CTL1_LOAD_PWRUP_EN);
+ 0);
if (ret)
return ret;
/*
- * Enable shutdown after a long button press (as configured below).
+ * Enable shutdown after a double press (as configured below).
*/
ret = ip5xxx_update_bits(ip5xxx, IP5XXX_SYS_CTL3,
IP5XXX_SYS_CTL3_BTN_SHDN_EN,
@@ -142,7 +152,7 @@ static int ip5xxx_initialize(struct power_supply *psy)
return ret;
/*
- * Power on automatically when VIN is removed.
+ * Don't power on automatically when VIN is removed.
*/
ret = ip5xxx_update_bits(ip5xxx, IP5XXX_SYS_CTL4,
IP5XXX_SYS_CTL4_VIN_PULLOUT_BOOST_EN,
@@ -152,14 +162,12 @@ static int ip5xxx_initialize(struct power_supply *psy)
/*
* Enable the NTC.
- * Configure the button for two presses => LED, long press => shutdown.
+ * Configure the button for two presses => shutdown, long press => LED.
*/
ret = ip5xxx_update_bits(ip5xxx, IP5XXX_SYS_CTL5,
IP5XXX_SYS_CTL5_NTC_DIS |
IP5XXX_SYS_CTL5_WLED_MODE_SEL |
- IP5XXX_SYS_CTL5_BTN_SHDN_SEL,
- IP5XXX_SYS_CTL5_WLED_MODE_SEL |
- IP5XXX_SYS_CTL5_BTN_SHDN_SEL);
+ IP5XXX_SYS_CTL5_BTN_SHDN_SEL, 0);
if (ret)
return ret;
--
Armbian