From e822fde2768e8f59c7d57956d350d966bc299c48 Mon Sep 17 00:00:00 2001 From: Antoni Aloy Torrens Date: Thu, 12 May 2022 15:37:31 +0200 Subject: [PATCH] community/linux-samsung-espresso3g: Fix WiFi reboot issue (MR 3130) - Patch from Robert Nelson and Hansem Ro. - Based on the work of Hansem Ro, who owns another device, the First Generation Kindle Fire, which has similar specifications as the Samsung Galaxy Tab 2 7.0. --- ...to-twl6030-and-fix-wifi-reboot-issue.patch | 104 ++++++++++++++++++ .../linux-samsung-espresso3g/APKBUILD | 4 +- 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 device/community/linux-samsung-espresso3g/03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch diff --git a/device/community/linux-samsung-espresso3g/03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch b/device/community/linux-samsung-espresso3g/03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch new file mode 100644 index 000000000..7257ad458 --- /dev/null +++ b/device/community/linux-samsung-espresso3g/03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch @@ -0,0 +1,104 @@ +Patch picked from https://raw.githubusercontent.com/hansemro/kc1-linux/v5.16.x/patches/0006-Add-clk32kg-to-twl6030.patch + + +From 6418e8fe6b80d906ac5a1d3570dd92ab0e7ec3e8 Mon Sep 17 00:00:00 2001 +From: Hansem Ro +Date: Wed, 12 May 2021 18:26:38 -0700 +Subject: [PATCH] Add clk32kg to twl6030 + +Needed for wl1271/wlcore driver bringup on Kindle Fire. + +Patch from Robert Nelson: +https://github.com/RobertCNelson/armv7-multiplatform/commit/27fd28715ecf47dee1f36e70faecc1243125b06d + + + +This patch also fixes a WiFi reboot issue on Samsung Galaxy Tab 2 7.0 tablet, +see https://gitlab.com/postmarketOS/pmaports/-/issues/1211 + +--- + arch/arm/boot/dts/twl6030.dtsi | 5 +++++ + drivers/regulator/twl6030-regulator.c | 23 +++++++++++++++++++++++ + 2 files changed, 28 insertions(+) + +diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi +index 9d588cfaa5cb..4eee3133ce4e 100644 +--- a/arch/arm/boot/dts/twl6030.dtsi ++++ b/arch/arm/boot/dts/twl6030.dtsi +@@ -97,6 +97,11 @@ twl_pwmled: pwmled { + #pwm-cells = <2>; + }; + ++ clk32kg: regulator-clk32kg { ++ compatible = "ti,twl6030-clk32kg"; ++ regulator-always-on; ++ }; ++ + gpadc { + compatible = "ti,twl6030-gpadc"; + interrupts = <3>; +diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c +index 430265c404d6..8ee55a0e3d2f 100644 +--- a/drivers/regulator/twl6030-regulator.c ++++ b/drivers/regulator/twl6030-regulator.c +@@ -299,6 +299,13 @@ static const struct regulator_ops twl6030fixed_ops = { + .get_status = twl6030reg_get_status, + }; + ++static struct regulator_ops twl6030_fixed_resource = { ++ .enable = twl6030reg_enable, ++ .disable = twl6030reg_disable, ++ .is_enabled = twl6030reg_is_enabled, ++ .get_status = twl6030reg_get_status, ++}; ++ + /* + * SMPS status and control + */ +@@ -572,6 +579,19 @@ static const struct twlreg_info TWLSMPS_INFO_##label = { \ + }, \ + } + ++#define TWL6030_FIXED_RESOURCE(label, offset, turnon_delay) \ ++static struct twlreg_info TWLRES_INFO_##label = { \ ++ .base = offset, \ ++ .desc = { \ ++ .name = #label, \ ++ .id = TWL6030_REG_##label, \ ++ .ops = &twl6030_fixed_resource, \ ++ .type = REGULATOR_VOLTAGE, \ ++ .owner = THIS_MODULE, \ ++ .enable_time = turnon_delay, \ ++ }, \ ++ } ++ + /* VUSBCP is managed *only* by the USB subchip */ + /* 6030 REG with base as PMC Slave Misc : 0x0030 */ + /* Turnon-delay and remap configuration values for 6030 are not +@@ -601,6 +621,7 @@ TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0); + TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0); + TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0); + TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0); ++TWL6030_FIXED_RESOURCE(CLK32KG, 0x8C, 0); + TWL6032_ADJUSTABLE_SMPS(SMPS3, 0x34); + TWL6032_ADJUSTABLE_SMPS(SMPS4, 0x10); + TWL6032_ADJUSTABLE_SMPS(VIO, 0x16); +@@ -632,6 +653,7 @@ static u8 twl_get_smps_mult(void) + #define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label) + #define TWL6032_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6032, label) + #define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label) ++#define TWLRES_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLRES, label) + #define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label) + + static const struct of_device_id twl_of_match[] = { +@@ -659,6 +681,7 @@ static const struct of_device_id twl_of_match[] = { + TWLFIXED_OF_MATCH("ti,twl6030-vusb", VUSB), + TWLFIXED_OF_MATCH("ti,twl6030-v1v8", V1V8), + TWLFIXED_OF_MATCH("ti,twl6030-v2v1", V2V1), ++ TWLRES_OF_MATCH("ti,twl6030-clk32kg", CLK32KG), + TWLSMPS_OF_MATCH("ti,twl6032-smps3", SMPS3), + TWLSMPS_OF_MATCH("ti,twl6032-smps4", SMPS4), + TWLSMPS_OF_MATCH("ti,twl6032-vio", VIO), +-- +2.31.1 + diff --git a/device/community/linux-samsung-espresso3g/APKBUILD b/device/community/linux-samsung-espresso3g/APKBUILD index 26c7ea7c8..7465fbb89 100644 --- a/device/community/linux-samsung-espresso3g/APKBUILD +++ b/device/community/linux-samsung-espresso3g/APKBUILD @@ -2,7 +2,7 @@ # Co-Maintainer: Antoni Aloy pkgname=linux-samsung-espresso3g pkgver=5.17.0 -pkgrel=0 +pkgrel=1 pkgdesc="Samsung Galaxy Tab 2 (7.0 inch) mainline kernel" arch="armv7" _carch="arm" @@ -27,6 +27,7 @@ source=" 00-Add-espresso-dts.patch 01-Add-TWL6030-power-driver-with-minimal-support-for-power-off.patch 02-Add-TWL6030-power-button-support-to-twl-pwrbutton.patch + 03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch $_config " builddir="$srcdir/linux-$_kernver" @@ -60,5 +61,6 @@ sha512sums=" 01d2e04afba261c42ba3c9e9aea4f8f023d86e58f17e2e17dec2f46347665843678dd56ad8875ab00b69074c3389dd471a47a9f252e2c8002c89dc730691cfd8 00-Add-espresso-dts.patch a483b1a322f3fe47c7bb6514f34cca69ad1b806487596ffab69078acb6e83e99ed39ffb4d5b4ecd17035d118a75ce5bac6761b9e42d01608f1e6a53d59b27806 01-Add-TWL6030-power-driver-with-minimal-support-for-power-off.patch b3d6114c5c60fc2820856c89ea6f09c369d857ae79a79f0eeb0f83f5401dc2253e11f7dac6869eb1095d3e0b3a68126246762e2f406ffae5b5ef0a60d5563bac 02-Add-TWL6030-power-button-support-to-twl-pwrbutton.patch +c98479208876387a0e9b3aabe9e496ed41af348b459d9180ce48d08b556578e3e607727e14e2fc9569d7fd86dce539f97f6341a4b010e59fd7fc1da4600c2b88 03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch 3bf676ddaf2201088c223b5f67933041d47b0cb20aefb678af271887107658f334fb6f3a778470a824b1c1a1a256ac68e17bded27c6d661f7b0a92eb15326fa3 config-samsung-espresso3g.armv7 "