feat(x11): migrate to pure Xlibre + dwm/dmenu/st stack, fix fcitx5-t9 bottom bar, PM8909 PON shutdown, and remove Wayland

This commit is contained in:
Luxferre
2026-10-20 21:15:16 +03:00
parent ad012360c3
commit 7bab7b7a11
422 changed files with 63226 additions and 2342 deletions
+66 -35
View File
@@ -42,7 +42,8 @@
#define RCGR_D_TORCH_50PCT 0xff7fU
#define RCGR_CMD_ENABLE_UPDATE 0x0003U /* ROOT_EN | CMD_UPDATE */
/* PM8909 PON registers for PS_HOLD shutdown vs warm reset configuration */
/* PM8909 PON registers for PS_HOLD shutdown vs hard reset configuration */
#define QPNP_PON_REVISION2 0x0801U
#define QPNP_PON_PS_HOLD_RST_CTL 0x085aU
#define QPNP_PON_PS_HOLD_RST_CTL2 0x085bU
#define QPNP_PON_S2_CNTL_EN 0x80U
@@ -54,6 +55,8 @@
static void __iomem *tlmm_gpio32_base;
static void __iomem *gcc_camss_base;
static struct regmap *pon_regmap;
static struct sys_off_handler *pon_poweroff_handler;
static struct sys_off_handler *pon_restart_handler;
static DEFINE_SPINLOCK(torch_lock);
static enum led_brightness current_brightness = LED_OFF;
@@ -131,51 +134,66 @@ static struct led_classdev msm8905_torch_led = {
.flags = LED_CORE_SUSPENDRESUME,
};
static void msm8905_pon_config_reset(unsigned int rst_type)
{
unsigned int rev2 = 0;
unsigned int ctl_reg = QPNP_PON_PS_HOLD_RST_CTL2;
if (!pon_regmap)
return;
if (regmap_read(pon_regmap, QPNP_PON_REVISION2, &rev2) == 0 && rev2 == 0)
ctl_reg = QPNP_PON_PS_HOLD_RST_CTL;
/*
* Match Qualcomm qpnp_pon_system_pwr_off():
* 1. Disable S2_CNTL_EN (bit 7 of 0x085b on Gen2 / 0x085a on Gen1)
* 2. Wait >10 sleep clock cycles (~350 us)
* 3. Program PS_HOLD_RST_CTL (0x085a) to SHUTDOWN (0x04) or HARD_RESET (0x07)
* 4. Re-enable S2_CNTL_EN (bit 7) and wait ~350 us
*/
regmap_update_bits(pon_regmap, ctl_reg, QPNP_PON_S2_CNTL_EN, 0);
udelay(350);
regmap_update_bits(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL,
QPNP_PON_RST_TYPE_MASK, rst_type);
udelay(350);
regmap_update_bits(pon_regmap, ctl_reg,
QPNP_PON_S2_CNTL_EN, QPNP_PON_S2_CNTL_EN);
udelay(350);
pr_info("leds-msm8905-torch: configured PM8909 PON PS_HOLD_RST_CTL=0x%02x (%s)\n",
rst_type, (rst_type == PON_POWER_OFF_SHUTDOWN) ? "shutdown" : "hard-reset");
}
static int msm8905_pon_sys_poweroff(struct sys_off_data *data)
{
msm8905_torch_hw_disable();
msm8905_pon_config_reset(PON_POWER_OFF_SHUTDOWN);
return NOTIFY_DONE;
}
static int msm8905_pon_sys_restart(struct sys_off_data *data)
{
msm8905_torch_hw_disable();
msm8905_pon_config_reset(PON_POWER_OFF_HARD_RESET);
return NOTIFY_DONE;
}
static int msm8905_pon_reboot_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
unsigned int ctl1 = 0;
unsigned int ctl2 = 0;
unsigned int rst_type;
msm8905_torch_hw_disable();
if (!pon_regmap)
return NOTIFY_DONE;
if (action == SYS_POWER_OFF || action == SYS_HALT)
rst_type = PON_POWER_OFF_SHUTDOWN;
else
rst_type = PON_POWER_OFF_WARM_RESET;
rst_type = PON_POWER_OFF_HARD_RESET;
/*
* Match Qualcomm qpnp_pon_system_pwr_off():
* 1. Disable S2_CNTL_EN (bit 7 of 0x085b)
* 2. Wait >10 sleep clock cycles (~500 us)
* 3. Program PS_HOLD_RST_CTL (0x085a) to SHUTDOWN (0x04) or WARM_RESET (0x01)
* 4. Re-enable S2_CNTL_EN (bit 7 of 0x085b) and wait ~500 us
*/
if (regmap_read(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL2, &ctl2) == 0)
regmap_write(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL2, ctl2 & ~QPNP_PON_S2_CNTL_EN);
else
regmap_write(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL2, 0x00U);
udelay(500);
if (regmap_read(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL, &ctl1) == 0)
ctl1 = (ctl1 & ~QPNP_PON_RST_TYPE_MASK) | rst_type;
else
ctl1 = rst_type;
regmap_write(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL, ctl1);
udelay(500);
regmap_write(pon_regmap, QPNP_PON_PS_HOLD_RST_CTL2,
(ctl2 & ~QPNP_PON_S2_CNTL_EN) | QPNP_PON_S2_CNTL_EN);
udelay(500);
pr_info("leds-msm8905-torch: configured PM8909 PON PS_HOLD_RST_CTL=0x%02x for %s\n",
ctl1, (rst_type == PON_POWER_OFF_SHUTDOWN) ? "shutdown" : "reboot");
msm8905_pon_config_reset(rst_type);
return NOTIFY_OK;
}
@@ -253,7 +271,16 @@ static int __init msm8905_torch_init(void)
}
msm8905_pon_lookup_regmap();
msm8905_pon_config_reset(PON_POWER_OFF_HARD_RESET);
register_reboot_notifier(&msm8905_pon_reboot_nb);
pon_poweroff_handler = register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
SYS_OFF_PRIO_HIGH,
msm8905_pon_sys_poweroff,
NULL);
pon_restart_handler = register_sys_off_handler(SYS_OFF_MODE_RESTART,
SYS_OFF_PRIO_HIGH,
msm8905_pon_sys_restart,
NULL);
pr_info("leds-msm8905-torch: registered white:torch on GPIO_32 (cci_timer1 150kHz PWM), pon_regmap=%s\n",
pon_regmap ? "ready" : "none");
@@ -262,6 +289,10 @@ static int __init msm8905_torch_init(void)
static void __exit msm8905_torch_exit(void)
{
if (!IS_ERR_OR_NULL(pon_restart_handler))
unregister_sys_off_handler(pon_restart_handler);
if (!IS_ERR_OR_NULL(pon_poweroff_handler))
unregister_sys_off_handler(pon_poweroff_handler);
unregister_reboot_notifier(&msm8905_pon_reboot_nb);
led_classdev_unregister(&msm8905_torch_led);
msm8905_torch_hw_disable();