Keep MT6351 VA18 enabled in MD1 deep flight / Airplane Mode
This commit is contained in:
1 parent
30348132fa
commit
21485612fb
7 files changed
+41
-3
No files matched your search
@@ -176,7 +176,7 @@ Subject: [PATCH 10/10] soc: mediatek: mt6797-ccci: add MD1 boot, AP_MD_HS_V2, an
|
||||
* - SiI9024A HDMI transmitter / DPI0 nodes disabled until ext_path support
|
||||
* - All 10 CPU core clock-frequency properties preserved from base DTS
|
||||
*/
|
||||
@@ -57,18 +56,6 @@
|
||||
@@ -57,18 +56,13 @@
|
||||
};
|
||||
|
||||
&mt6351regulator {
|
||||
@@ -192,6 +192,13 @@ Subject: [PATCH 10/10] soc: mediatek: mt6797-ccci: add MD1 boot, AP_MD_HS_V2, an
|
||||
- regulator-max-microvolt = <3100000>;
|
||||
- };
|
||||
-
|
||||
+ mt6351_va18_reg: ldo-va18 {
|
||||
+ regulator-name = "va18";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
mt6351_vusb33_reg: ldo-vusb33 {
|
||||
regulator-name = "vusb33";
|
||||
regulator-always-on;
|
||||
@@ -1125,9 +1132,9 @@ Subject: [PATCH 10/10] soc: mediatek: mt6797-ccci: add MD1 boot, AP_MD_HS_V2, an
|
||||
+ MT6351_LDO_EN_BIT | MT6351_LDO_ON_CTRL_BIT, 0);
|
||||
+ regmap_update_bits(cdev->pmic_regmap, MT6351_LDO_VTCXO28_CON0,
|
||||
+ MT6351_LDO_EN_BIT | MT6351_LDO_ON_CTRL_BIT, 0);
|
||||
+ /* Keep shared MT6351 VA18 (FGADC, AUXADC, audio) enabled */
|
||||
+ regmap_update_bits(cdev->pmic_regmap, MT6351_LDO_VA18_CON0,
|
||||
+ MT6351_LDO_EN_BIT | MT6351_LDO_ON_CTRL_BIT, 0);
|
||||
+
|
||||
+ MT6351_LDO_EN_BIT | MT6351_LDO_ON_CTRL_BIT, MT6351_LDO_EN_BIT);
|
||||
+ regmap_update_bits(cdev->pmic_regmap, MT6351_BUCK_VMODEM_CON9,
|
||||
+ MT6351_BUCK_VSLEEP_EN_BIT, 0);
|
||||
+ regmap_update_bits(cdev->pmic_regmap, MT6351_BUCK_VMODEM_CON2,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -505,6 +505,9 @@ docker run --rm -i -v "$IMAGES_DIR:/images:ro" -v "$BASE_DIR/prebuilt/kernel/boo
|
||||
/ldo-vusb33 \{/ { in_vusb=1; next }
|
||||
in_vusb && /\};/ { in_vusb=0 }
|
||||
in_vusb && /regulator-always-on;/ { found_vusb=1 }
|
||||
/ldo-va18 \{/ { in_va18=1; next }
|
||||
in_va18 && /\};/ { in_va18=0 }
|
||||
in_va18 && /regulator-always-on;/ { found_va18=1 }
|
||||
END {
|
||||
if (!found_ok || found_dis) {
|
||||
print "FAIL: DTB i2c@11007000 (&i2c0) must have status = \"okay\"" > "/dev/stderr"
|
||||
@@ -514,6 +517,10 @@ docker run --rm -i -v "$IMAGES_DIR:/images:ro" -v "$BASE_DIR/prebuilt/kernel/boo
|
||||
print "FAIL: DTB ldo-vusb33 must have regulator-always-on" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
if (!found_va18) {
|
||||
print "FAIL: DTB ldo-va18 must have regulator-always-on" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
if (!pwm_ok || pwm_dis || pwm_pd) {
|
||||
print "FAIL: DTB pwm@1100f000 (&disp_pwm) must be okay without power-domains" > "/dev/stderr"
|
||||
exit 1
|
||||
|
||||
@@ -79,6 +79,25 @@ static void maybe_advance_ccci_stage(ccci_ctx_t *ctx) {
|
||||
(void)advance_ccci_stage(3);
|
||||
}
|
||||
|
||||
static bool load_persisted_airplane(void) {
|
||||
FILE *rf = fopen("/run/geminux/airplane-mode", "r");
|
||||
if (rf) {
|
||||
char buf[32] = {0};
|
||||
size_t n = fread(buf, 1, sizeof(buf) - 1, rf);
|
||||
fclose(rf);
|
||||
if (n > 0) return buf[0] == '1';
|
||||
}
|
||||
FILE *vf = fopen("/var/lib/geminux/airplane-mode", "r");
|
||||
if (vf) {
|
||||
char buf[160] = {0};
|
||||
size_t n = fread(buf, 1, sizeof(buf) - 1, vf);
|
||||
fclose(vf);
|
||||
buf[n] = '\0';
|
||||
return strstr(buf, "airplane=1") != NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void open_ccci_devs(ccci_ctx_t *ctx) {
|
||||
if (ctx->fs_fd < 0) {
|
||||
ctx->fs_fd = open("/dev/ccci_fs", O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||
@@ -90,7 +109,11 @@ static void open_ccci_devs(ccci_ctx_t *ctx) {
|
||||
ctx->ctl_fd = open("/dev/ccci_md_ctl", O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||
if (ctx->ctl_fd >= 0) {
|
||||
add_ep(ctx->epfd, ctx->ctl_fd);
|
||||
if (ctx->sm.flight_mode) {
|
||||
ioctl(ctx->ctl_fd, CCCI_IOC_ENTER_DEEP_FLIGHT);
|
||||
} else {
|
||||
maybe_advance_ccci_stage(ctx);
|
||||
}
|
||||
refresh_md_state(ctx);
|
||||
}
|
||||
}
|
||||
@@ -195,6 +218,7 @@ int main(void) {
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
ctx.ctl_fd = ctx.fs_fd = -1;
|
||||
geminux_ccci_sm_init(&ctx.sm);
|
||||
ctx.sm.flight_mode = load_persisted_airplane();
|
||||
geminux_ccci_fs_init(&ctx.fs, NULL, CCCI_LOG);
|
||||
|
||||
mkdir("/run/geminux", 0755);
|
||||
|
||||
Reference in new issue
Block a user