{"id":48891618,"url":"https://github.com/penguinztech/x1e-pd-fix","last_synced_at":"2026-04-16T08:05:50.895Z","repository":{"id":344710193,"uuid":"1182568314","full_name":"PenguinzTech/x1e-pd-fix","owner":"PenguinzTech","description":"Fix slow USB-C PD charging (~12W→60W) on Snapdragon X Elite (X1E80100) Linux laptops — ASUS Vivobook S Plus, Dell Latitude 7455, Lenovo ThinkPad T14s Gen 6, etc.","archived":false,"fork":false,"pushed_at":"2026-03-16T01:42:16.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-16T12:09:10.841Z","etag":null,"topics":["aarch64","arm64","asus-vivobook","battery","charging-fix","dell-latitude","kernel-module","lenovo-thinkpad","linux-kernel","pmic-glink","power-delivery","qcom-battmgr","qualcomm","snapdragon-x-elite","snapdragon-x-plus","ubuntu","usb-pd","x1e80100"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PenguinzTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-15T17:35:46.000Z","updated_at":"2026-03-16T01:42:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/PenguinzTech/x1e-pd-fix","commit_stats":null,"previous_names":["penguinztech/x1e-pd-fix"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/PenguinzTech/x1e-pd-fix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PenguinzTech%2Fx1e-pd-fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PenguinzTech%2Fx1e-pd-fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PenguinzTech%2Fx1e-pd-fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PenguinzTech%2Fx1e-pd-fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PenguinzTech","download_url":"https://codeload.github.com/PenguinzTech/x1e-pd-fix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PenguinzTech%2Fx1e-pd-fix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31876860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T07:36:03.521Z","status":"ssl_error","status_checked_at":"2026-04-16T07:35:53.576Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aarch64","arm64","asus-vivobook","battery","charging-fix","dell-latitude","kernel-module","lenovo-thinkpad","linux-kernel","pmic-glink","power-delivery","qcom-battmgr","qualcomm","snapdragon-x-elite","snapdragon-x-plus","ubuntu","usb-pd","x1e80100"],"created_at":"2026-04-16T08:05:08.975Z","updated_at":"2026-04-16T08:05:50.875Z","avatar_url":"https://github.com/PenguinzTech.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# x1e80100 USB PD Charging Fix for Linux\n\n**Fix for extremely slow USB-C Power Delivery charging on Qualcomm Snapdragon X Elite (X1E80100) laptops running Linux.** Increases charging from ~12W to 60W+ (5x improvement).\n\n\u003e Tested on **ASUS Vivobook S 15 / Vivobook S Plus X Elite (S5507QA)** — should work on any X1E80100 laptop including Dell Latitude 7455, Lenovo ThinkPad T14s Gen 6, HP EliteBook Ultra, Samsung Galaxy Book4 Edge, and other Snapdragon X Elite / X Plus devices.\n\n**Keywords:** Snapdragon X Elite, X1E80100, USB-C slow charging, Linux, Ubuntu, qcom_battmgr, PMIC GLINK, power delivery, ASUS Vivobook, Dell Latitude, Lenovo ThinkPad, battery charging fix\n\n## The Problem\n\nOn Snapdragon X Elite / X Plus laptops (ASUS Vivobook S 15, Vivobook S Plus X Elite, Dell Latitude 7455, Lenovo ThinkPad T14s Gen 6, etc.), USB-C PD charging under Linux is often limited to ~12W regardless of charger wattage. Windows charges the same hardware at 60W+ with the same charger.\n\n**Symptoms:**\n- `power_now` reports only 10-15W while charging\n- `qcom-battmgr-ac` shows `ONLINE=0` (system doesn't recognize AC power)\n- `qcom-battmgr-usb` shows `ONLINE=1` but with `USB_TYPE=Unknown`\n- UCSI layer sees PD (`USB_TYPE=C [PD] PD_PPS`) but battery manager doesn't\n- Charging takes 5+ hours on a laptop that should charge in ~1.5 hours\n\n## Root Cause\n\nThe upstream `qcom_battmgr` driver maps X1E80100 to the `QCOM_BATTMGR_SC8280XP` variant, which:\n\n1. **Only exposes `ONLINE` for USB** — no voltage, current, or type information\n2. **Never queries USB properties** from firmware individually (uses bulk battery status notifications only)\n3. **Never sets USB adapter type** — firmware defaults to basic USB classification instead of PD\n4. **Never uses `BATTMGR_USB_PROPERTY_SET`** — opcode `0x33` exists but is dead code\n\nThe PMIC firmware classifies the charger as basic USB and limits charging current accordingly.\n\n## The Fix\n\nThis patch creates a dedicated `QCOM_BATTMGR_X1E80100` variant that:\n\n1. **Separates X1E80100 from SC8280XP** — allows X1E-specific behavior\n2. **Hybrid callback routing** — uses SC8280XP-style callbacks for battery status notifications, SM8350-style individual property queries for USB properties\n3. **Auto-configures PD on charger detect** — sends `USB_ADAP_TYPE=PD`, `USB_TYPE=PD`, `USB_CURR_MAX`, `USB_INPUT_CURR_LIMIT`, and `USB_VOLT_MAX` to firmware when USB charging is detected\n4. **Exposes full USB properties** — voltage, current, type, and writable `input_current_limit` via sysfs\n5. **Module parameter** — `pd_current_limit_ua` (default 5A) for tuning\n\n## Results\n\n| | Before | After |\n|---|--------|-------|\n| Battery charging power | ~12W | ~61W |\n| UCSI current draw | 2.5A | 4.3A |\n| USB type reported | Unknown | PD |\n| Charger input power | ~15W | ~86W (20V × 4.3A) |\n| Time to full (70Wh battery) | ~6 hours | ~1.2 hours |\n\nTested with a 100W USB-C PD charger. The firmware properly renegotiates the PD contract to draw up to 4.3A at 20V after the patch configures adapter type and current limits.\n\n## Tested On\n\n- **Laptop:** ASUS Vivobook S 15 / Vivobook S Plus X Elite (S5507QA / S5507QAD)\n- **SoC:** Qualcomm Snapdragon X Elite (X1E80100)\n- **OS:** Ubuntu 25.10 (Questing Quokka)\n- **Kernel:** 6.17.0-12-generic (aarch64)\n- **Charger:** 100W USB-C PD (InMotion) — capped at 60W by laptop's PD sink capability\n\n### Expected Compatible Devices\n\nAny laptop with `qcom,x1e80100-pmic-glink` in its device tree, including:\n- ASUS Vivobook S 15 / S Plus X Elite (S5507QA, S5507QAD)\n- Dell Latitude 7455\n- Dell Inspiron 14 Plus\n- Lenovo ThinkPad T14s Gen 6\n- HP EliteBook Ultra G1q\n- Samsung Galaxy Book4 Edge\n- Microsoft Surface Laptop 7\n- Acer Swift 14 AI\n- Other Snapdragon X Elite / X Plus laptops\n\n**Please report your results** if you test on a different device!\n\n## Installation\n\n### Prerequisites\n\n```bash\nsudo apt install build-essential linux-headers-$(uname -r)\n```\n\n### Build\n\n```bash\ngit clone https://github.com/PenguinzTech/x1e-pd-fix.git\ncd x1e-pd-fix\nmake\n```\n\n### Install\n\n\u003e **IMPORTANT: A full reboot is REQUIRED after installation.** The PD charging parameters must be configured during a fresh boot — the firmware ignores them if set after the PD session is already established. Hot-reloading the module with `modprobe -r \u0026\u0026 modprobe` will NOT work. You must reboot (or fully power off and back on) for the fix to take effect.\n\n```bash\n# Backup original module\nsudo cp /lib/modules/$(uname -r)/kernel/drivers/power/supply/qcom_battmgr.ko.zst \\\n       /lib/modules/$(uname -r)/kernel/drivers/power/supply/qcom_battmgr.ko.zst.bak\n\n# Install patched module\nsudo zstd qcom_battmgr.ko \\\n     -o /lib/modules/$(uname -r)/kernel/drivers/power/supply/qcom_battmgr.ko.zst --force\n\n# Update module dependencies and initramfs\nsudo depmod -a\nsudo update-initramfs -u\n\n# REBOOT IS REQUIRED — hot-reload will NOT work\nsudo reboot\n```\n\n### Verify\n\n```bash\n# Check patched module loaded\ncat /sys/module/qcom_battmgr/parameters/pd_current_limit_ua\n# Should show: 5000000\n\n# Check charging power\ncat /sys/class/power_supply/qcom-battmgr-bat/power_now\n# Should show ~30000000-40000000 (30-40W)\n\n# Check USB type\ngrep -o '\\[.*\\]' /sys/class/power_supply/ucsi-source-psy-pmic_glink.ucsi.*/usb_type\n# Should show: [PD]\n```\n\n### Revert\n\n```bash\nsudo cp /lib/modules/$(uname -r)/kernel/drivers/power/supply/qcom_battmgr.ko.zst.bak \\\n       /lib/modules/$(uname -r)/kernel/drivers/power/supply/qcom_battmgr.ko.zst\nsudo depmod -a\nsudo update-initramfs -u\nsudo reboot\n```\n\n## Module Parameters\n\n| Parameter | Default | Description |\n|-----------|---------|-------------|\n| `pd_current_limit_ua` | `5000000` (5A) | USB PD input current limit in microamps. The firmware clamps to the actual PD contract. Set to `0` to disable automatic PD configuration. |\n\nAdjust at runtime:\n```bash\necho 3000000 | sudo tee /sys/module/qcom_battmgr/parameters/pd_current_limit_ua\n```\n\nOr at boot via kernel cmdline:\n```\nqcom_battmgr.pd_current_limit_ua=3000000\n```\n\n## Technical Details\n\n### Architecture\n\nThe Qualcomm X1E80100 SoC communicates with its PMIC (including the SMB2360 charger IC) through **PMIC GLINK** — a message-passing interface over shared memory. The `qcom_battmgr` driver sends requests and receives responses through this channel.\n\n```\n┌─────────┐    GLINK     ┌──────────┐    SPMI    ┌─────────┐\n│  Linux   │◄───────────►│   PMIC   │◄──────────►│ SMB2360 │\n│ battmgr  │  messages   │ Firmware │  registers  │ Charger │\n└─────────┘              └──────────┘             └─────────┘\n                                                       ▲\n                                                       │ USB PD\n                                                  ┌────┴────┐\n                                                  │ Charger  │\n                                                  │ (100W)   │\n                                                  └──────────┘\n```\n\n### What the patch changes\n\nThe upstream driver treats X1E80100 identically to SC8280XP, which only reads battery status notifications containing a simple `charging_source` field (AC=1, USB=2, Wireless=3). It never queries or sets individual USB properties.\n\nThis patch:\n- Adds `QCOM_BATTMGR_X1E80100` as a distinct variant\n- Routes USB/WLS property responses to the SM8350 callback (which handles individual property GET/SET)\n- Routes battery status responses to the SC8280XP callback (which handles bulk notifications)\n- On USB charger detection, sends firmware commands to configure PD charging parameters\n- Creates an X1E80100-specific USB power supply descriptor with full property support\n\n### GLINK commands sent on charger detect\n\n| Command | Property | Value | Purpose |\n|---------|----------|-------|---------|\n| `USB_PROPERTY_SET` (0x33) | `USB_ADAP_TYPE` (7) | 14 (PD) | Reclassify charger as PD |\n| `USB_PROPERTY_SET` (0x33) | `USB_TYPE` (6) | 6 (PD) | Set USB type to PD |\n| `USB_PROPERTY_SET` (0x33) | `USB_CURR_MAX` (4) | 5000000 | Request 5A max current |\n| `USB_PROPERTY_SET` (0x33) | `USB_INPUT_CURR_LIMIT` (5) | 5000000 | Set input current limit to 5A |\n| `USB_PROPERTY_SET` (0x33) | `USB_VOLT_MAX` (2) | 20000000 | Set max voltage to 20V |\n\n### Limitations\n\n- **Reboot required**: The PD charging parameters **must** be configured during a fresh boot. The firmware locks its charger classification early in the PD session and ignores changes made after that. Hot-reloading the module with `modprobe -r \u0026\u0026 modprobe` will **NOT** work — you must do a full reboot (or power off/on). This is the single most important thing to know about this fix.\n- **Kernel updates**: The module must be rebuilt after kernel updates. Consider using DKMS for automation.\n\n## Files\n\n| File | Description |\n|------|-------------|\n| `qcom_battmgr.c` | Patched driver source |\n| `qcom_battmgr.c.ubuntu_orig` | Unmodified Ubuntu 6.17.0-12 source |\n| `x1e80100-usb-pd-charging-v4.patch` | Unified diff |\n| `Makefile` | Out-of-tree module build |\n\n## Contributing\n\nIf you test this on a different X1E80100 laptop, please open an issue with:\n- Laptop model\n- Charger wattage\n- `power_now` before and after\n- Kernel version\n- Output of `./check-charging.sh` (in the scripts/ directory)\n\n## License\n\nGPL-2.0-only (same as the Linux kernel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenguinztech%2Fx1e-pd-fix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpenguinztech%2Fx1e-pd-fix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpenguinztech%2Fx1e-pd-fix/lists"}