diff --git a/CHANGELOG.md b/CHANGELOG.md index ba6b9cf..fdbd96a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ Release versions follow the `
` format (where `2026` is `a`, - Fixed PM8909/PM8916 linear battery charger (`pm8916_lbc.ko.zst`) hardware state-machine engagement by writing `MISC_BOOT_DONE` (`0x1642 = 0x80`), overriding the internal charger comparator (`0x10d0 = 0xa5`, `0x10ee = 0x02`), stopping the USB enumeration watchdog timer (`0x134e = 0x00`, `0x104e = 0x00`), clearing `USB_SUSP` (`0x1347 = 0x00`) and `CHG_FAILED` (`0x104a = 0x80`), enabling `BAT_IF` thermistor pull-ups (`0x1248`, `0x124a`), re-arming `CHG_CTRL = 0x81` on every `usb_vbus` plug event, and setting `qcom,fast-charge-safe-current = 540 mA` (`4.375 V`) across all 5 device trees (`nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler`, `nokia-leo`) so USB charging engages `FAST_CHG_ON` (`0x1010 = 0x20`) instead of idling at `90 mA`. - Fixed PM8909/PM8916 voltage-mode BMS fuel gauge (`pm8916_bms_vm.ko.zst`) calibration (`raw * 292969ULL / 1000ULL`), averaged all valid `S2` FIFO samples, seeded `vbat_now` and `fake_ocv` immediately during module probe, replaced the sticky `300 uV`/tick filter with a responsive bidirectional EMA filter with CC/CV charging IR compensation and idle discharge compensation, and added `POWER_SUPPLY_STATUS_FULL` reporting when `PM8916_LBC_CHGR_CHG_DONE` asserts. - Fixed `wcn36xx` (`wcn36xx.ko.zst`) Wi-Fi Beacon Mode Power Save (`BMPS`) by deferring `wcn36xx_pmc_enter_bmps()` until `vif->bss_conf.sync_tsf` is synchronized after the 4-way WPA handshake, removing the destructive `ieee80211_connection_loss()` disconnect call on transient pre-beacon BMPS errors, and setting `WIPHY_FLAG_PS_ON_BY_DEFAULT` (`dynamic_ps_timeout = 200 ms`) with `wifi.powersave = 3` in NetworkManager so `wlan0` enters hardware beacon-filtering sleep instead of waking the CPU on every `102.4 ms` beacon. - - Switched the digital audio codec (`snd-soc-msm8916-digital.ko.zst`, `771c000.audio-codec`) to `devm_regmap_init_mmio_clk(..., "ahbix-clk", ...)` and gated both `mclk` and `ahbclk` whenever `active_streams == 0` so `LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE` and the `19.2 MHz` `xo-board` root clock drop to `enable_cnt = 0` when audio is idle. + - Gated the PM8916 WCD analog audio codec (`snd-soc-msm8916-analog.ko.zst`, `200f000.spmi:pmic@0:codec@f000`) `9.6 MHz` `gcc_codec_digcodec_clk` clock after `pm8916_wcd_analog_probe()` so it stays at `enable_cnt = 0` when audio is idle and is only enabled on demand via `SND_SOC_DAPM_SUPPLY("CLK_BUFF", ...)` during active playback or capture, while keeping `LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE` enabled on `771c000.audio-codec` across ASoC DPCM/DAPM teardown. - Added `msm8905_cam_hw_deinit()` to the rear camera kernel driver (`src/msm8905-cam/msm8905-cam.c`) and wired it into `streamoff`, last-file-handle `release`, and module `exit` so closing `xcamera` (or stopping V4L2 streaming) immediately stops the CSI-2 stream, asserts sensor hardware standby (`GPIO_CAM_RESET=0`, `GPIO_CAM_STANDBY=0`, `GPIO_CAM_VDIG=0`, `GPIO_CAM_MCLK0=0x0001`), gates all 20 `CAMSS` `CBCR` branch clocks and 6 `RCG` roots (`200 MHz` `vfe0` / `csi0` / `camss_top_ahb` and `24 MHz` `mclk0`), releases `SMMU` vote clocks, and powers down the `VFE GDSC` domain. - Enabled `workqueue.power_efficient=Y` and `printk.console_suspend=Y` in `/etc/local.d/10-power-save.start`, tuned `schedutil` governor rate limits (`up_rate_limit_us = 40000`, `down_rate_limit_us = 10000`), automatically switched `scaling_governor` to `powersave` (`200 MHz` floor with zero RPM `vdd_dig`/`vdd_mx` voltage-scaling interrupts) whenever the screen backlight is off and back to `schedutil` on wake, lowered `78b9000.spi` runtime PM `autosuspend_delay_ms` from `1000 ms` to `50 ms`, enabled runtime PM (`power/control=auto`) across `1c00000.gpu`, `*.spi`, `*.sdhci`, and `*.serial`, switched the `7864900.sdhci` microSD host controller from driver unbinding to kernel runtime PM (`runtime_status = suspended`) with hardware GPIO 38 hotplug detection, and removed the legacy `ttyMSM0` serial `getty` rule from `scripts/configure-rootfs-from-scratch.sh`. - Fixed battery status display and udev hook permissions (`85-bananarchy-battery.rules` running `sxmo_hook_battery.sh` as `user`, `sxmo_hook_battery.sh force` bypassing the 60s throttle on wake/unlock while updating `040-battery-icon-pm8916-bms-vm` even while the screen is dark), added a live battery icon and percentage indicator plus a `30s` lockscreen-only inactivity screen-blanking timeout to `locker.so` (`xlocker`) while keeping unlocked auto-locking disabled, and removed the redundant `doas -n true` gate before `msm-modem-uim-selection dsds-daemon` in `sxmo_modemmonitor.sh`. diff --git a/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst b/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst index 9d01b25..d9a4c48 100644 Binary files a/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst and b/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst differ diff --git a/overlay/rootfs/usr/bin/sxmo_modem.sh b/overlay/rootfs/usr/bin/sxmo_modem.sh index 4404bef..e59c46f 100755 --- a/overlay/rootfs/usr/bin/sxmo_modem.sh +++ b/overlay/rootfs/usr/bin/sxmo_modem.sh @@ -301,6 +301,7 @@ checkfornewtexts() { stderr "Text from number: $NUM (TEXTID: $TEXTID)" sxmo_hook_smslog.sh "recv" "$NUM" "$NUM" "$TIME" "$TEXT" >> "$SXMO_LOGDIR/$NUM/sms.txt" printf "%s\trecv_txt\t%s\t%s\n" "$TIME" "$NUM" "$TSV_TEXT" >> "$SXMO_LOGDIR/modemlog.tsv" + sync if [ -p /tmp/dwm_plugin_sms.fifo ]; then printf "REFRESH\n" > /tmp/dwm_plugin_sms.fifo 2>/dev/null || true fi diff --git a/overlay/rootfs/usr/bin/sxmo_notifs.sh b/overlay/rootfs/usr/bin/sxmo_notifs.sh index 52586e7..b4cbe9d 100755 --- a/overlay/rootfs/usr/bin/sxmo_notifs.sh +++ b/overlay/rootfs/usr/bin/sxmo_notifs.sh @@ -30,6 +30,9 @@ clear_all() { _handle_new_notif_file() { file="$1" mode="$2" + case "${file##*/}" in + .*) return 0 ;; + esac [ -f "$file" ] || return 0 if [ "$(wc -l < "$file" 2>/dev/null || echo 0)" -lt 3 ]; then @@ -193,7 +196,9 @@ new() { msg="$2" mkdir -p "$SXMO_NOTIFDIR" - printf "%s\n%s\n%b\n" "$group" "$action" "$msg" > "$SXMO_NOTIFDIR/$id" + tmp_notif="$SXMO_NOTIFDIR/.tmp.$id.$$" + printf "%s\n%s\n%b\n" "$group" "$action" "$msg" > "$tmp_notif" + mv -f "$tmp_notif" "$SXMO_NOTIFDIR/$id" if ! pgrep -f "sxmo_notifs.sh monitor" >/dev/null 2>&1; then sxmo_hook_notification.sh "$SXMO_NOTIFDIR/$id" & diff --git a/overlay/rootfs/usr/lib/dwm/plugins/calllog.so b/overlay/rootfs/usr/lib/dwm/plugins/calllog.so index 480cb8c..5343e45 100755 Binary files a/overlay/rootfs/usr/lib/dwm/plugins/calllog.so and b/overlay/rootfs/usr/lib/dwm/plugins/calllog.so differ diff --git a/overlay/rootfs/usr/lib/dwm/plugins/sms.so b/overlay/rootfs/usr/lib/dwm/plugins/sms.so index 189854d..42de205 100755 Binary files a/overlay/rootfs/usr/lib/dwm/plugins/sms.so and b/overlay/rootfs/usr/lib/dwm/plugins/sms.so differ diff --git a/overlay/rootfs/usr/libexec/msm-modem-uim-selection b/overlay/rootfs/usr/libexec/msm-modem-uim-selection index ecc147c..de691ac 100755 --- a/overlay/rootfs/usr/libexec/msm-modem-uim-selection +++ b/overlay/rootfs/usr/libexec/msm-modem-uim-selection @@ -2185,6 +2185,8 @@ def append_modemlog(line): try: with open(MODEMLOG, "a", encoding="utf-8") as f: f.write(line) + f.flush() + os.fsync(f.fileno()) except Exception: return chown_user(MODEMLOG) @@ -2545,6 +2547,8 @@ def deliver_sms_to_sxmo(sender, iso_ts, text, sim_slot): header = f"Received from {sender} [SIM {sim_slot}] at {now_str}:\n{text}\n\n" with open(sms_file, "a", encoding="utf-8") as f: f.write(header) + f.flush() + os.fsync(f.fileno()) append_modemlog(f"{now_str}\trecv_txt\t{sender}\t[SIM {sim_slot}] {tsv_text}\n") chown_user(sms_file) send_fifo("/tmp/dwm_plugin_sms.fifo", "REFRESH") diff --git a/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch b/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch index aa62bf3..c6c7530 100644 --- a/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch +++ b/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch @@ -378,120 +378,4 @@ + wcn->hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; wcn->hw->queues = 4; - ---- a/sound/soc/codecs/msm8916-wcd-digital.c -+++ b/sound/soc/codecs/msm8916-wcd-digital.c -@@ -226,6 +226,9 @@ - - struct msm8916_wcd_digital_priv { - struct clk *ahbclk, *mclk; -+ struct regmap *regmap; -+ struct mutex clk_lock; -+ int active_streams; - }; - - static const unsigned long rx_gain_reg[] = { -@@ -1075,8 +1078,27 @@ - struct snd_soc_component *component = dai->component; - struct msm8916_wcd_digital_priv *msm8916_wcd; - unsigned long mclk_rate; -+ int ret; - - msm8916_wcd = snd_soc_component_get_drvdata(component); -+ -+ mutex_lock(&msm8916_wcd->clk_lock); -+ if (msm8916_wcd->active_streams == 0) { -+ ret = clk_prepare_enable(msm8916_wcd->ahbclk); -+ if (ret < 0) { -+ mutex_unlock(&msm8916_wcd->clk_lock); -+ return ret; -+ } -+ ret = clk_prepare_enable(msm8916_wcd->mclk); -+ if (ret < 0) { -+ clk_disable_unprepare(msm8916_wcd->ahbclk); -+ mutex_unlock(&msm8916_wcd->clk_lock); -+ return ret; -+ } -+ } -+ msm8916_wcd->active_streams++; -+ mutex_unlock(&msm8916_wcd->clk_lock); -+ - snd_soc_component_update_bits(component, LPASS_CDC_CLK_MCLK_CTL, - MCLK_CTL_MCLK_EN_MASK, - MCLK_CTL_MCLK_EN_ENABLE); -@@ -1106,8 +1128,22 @@ - static void msm8916_wcd_digital_shutdown(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) - { -- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_PDM_CTL, -+ struct snd_soc_component *component = dai->component; -+ struct msm8916_wcd_digital_priv *msm8916_wcd = -+ snd_soc_component_get_drvdata(component); -+ -+ snd_soc_component_update_bits(component, LPASS_CDC_CLK_PDM_CTL, - LPASS_CDC_CLK_PDM_CTL_PDM_CLK_SEL_MASK, 0); -+ snd_soc_component_update_bits(component, LPASS_CDC_CLK_MCLK_CTL, -+ MCLK_CTL_MCLK_EN_MASK, 0); -+ -+ mutex_lock(&msm8916_wcd->clk_lock); -+ if (msm8916_wcd->active_streams > 0 && -+ --msm8916_wcd->active_streams == 0) { -+ clk_disable_unprepare(msm8916_wcd->mclk); -+ clk_disable_unprepare(msm8916_wcd->ahbclk); -+ } -+ mutex_unlock(&msm8916_wcd->clk_lock); - } - - static const struct snd_soc_dai_ops msm8916_wcd_digital_dai_ops = { -@@ -1177,15 +1213,18 @@ - if (!priv) - return -ENOMEM; - -+ mutex_init(&priv->clk_lock); -+ - base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(base)) - return PTR_ERR(base); - - digital_map = -- devm_regmap_init_mmio(&pdev->dev, base, -- &msm8916_codec_regmap_config); -+ devm_regmap_init_mmio_clk(&pdev->dev, "ahbix-clk", base, -+ &msm8916_codec_regmap_config); - if (IS_ERR(digital_map)) - return PTR_ERR(digital_map); -+ priv->regmap = digital_map; - - ret = msm8916_wcd_digital_get_clks(pdev, priv); - if (ret < 0) -@@ -1211,6 +1250,14 @@ - if (ret) - goto err_mclk; - -+ /* -+ * Gate mclk and ahbclk at idle; regmap_mmio_clk enables ahbix-clk -+ * on-demand for mixer reads/writes, and startup/shutdown enables -+ * both clocks while any PCM stream is active. -+ */ -+ clk_disable_unprepare(priv->mclk); -+ clk_disable_unprepare(priv->ahbclk); -+ - return 0; - - err_mclk: -@@ -1224,8 +1271,13 @@ - { - struct msm8916_wcd_digital_priv *priv = dev_get_drvdata(&pdev->dev); - -- clk_disable_unprepare(priv->mclk); -- clk_disable_unprepare(priv->ahbclk); -+ mutex_lock(&priv->clk_lock); -+ if (priv->active_streams > 0) { -+ priv->active_streams = 0; -+ clk_disable_unprepare(priv->mclk); -+ clk_disable_unprepare(priv->ahbclk); -+ } -+ mutex_unlock(&priv->clk_lock); - } - - static const struct of_device_id msm8916_wcd_digital_match_table[] = { + diff --git a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko index 4648e66..726f414 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko and b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst index 9d01b25..d9a4c48 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst differ diff --git a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/calllog.so b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/calllog.so index 480cb8c..5343e45 100755 Binary files a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/calllog.so and b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/calllog.so differ diff --git a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sms.so b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sms.so index 189854d..42de205 100755 Binary files a/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sms.so and b/prebuilt/sxmo-x11/usr/lib/dwm/plugins/sms.so differ diff --git a/src/dwm-plugins/phone_data.h b/src/dwm-plugins/phone_data.h index 974a9e1..605ab74 100644 --- a/src/dwm-plugins/phone_data.h +++ b/src/dwm-plugins/phone_data.h @@ -1345,6 +1345,7 @@ inline std::vector loadCallLogFromFile(const ContactBook& book, }; while (std::getline(lf, line)) { + std::erase(line, '\0'); if (line.empty()) continue; size_t t1 = line.find('\t'); if (t1 == std::string::npos) continue; @@ -2128,6 +2129,7 @@ inline std::vector loadSmsThreadMessages( }; while (std::getline(in, line)) { + std::erase(line, '\0'); if (!line.empty() && line.back() == '\r') { line.pop_back(); }