Skip to content

arm64: dts: qcom: x126100-lenovo-ideapad-slim3: Use LPASS GPIO13 for right speaker reset - #110

Open
birkskyum wants to merge 16 commits into
jglathe:jg/ubuntu-qcom-x1e-7.3.yfrom
birkskyum:slim3-right-speaker-gpio13
Open

birkskyum wants to merge 16 commits into
jglathe:jg/ubuntu-qcom-x1e-7.3.yfrom
birkskyum:slim3-right-speaker-gpio13

Conversation

@birkskyum

Copy link
Copy Markdown

Hardware-verified fix for the right WSA8845 speaker on the Lenovo IdeaPad Slim 3 15Q8X10 (83N3), discovered and tested by Open Research Tools (@coproductionist).

Problem

Both left_spkr and right_spkr were assigned reset-gpios = <&lpass_tlmm 12 GPIO_ACTIVE_LOW>, leaving right_spkr held in reset (UNATTACHED) so only the left speaker worked.

Fix

  • Add right_spkr_sd_n_active (gpio13) under &lpass_tlmm.
  • Include <&right_spkr_sd_n_active> in &swr0 pinctrl-0.
  • Change right_spkr reset-gpios to <&lpass_tlmm 13 GPIO_ACTIVE_LOW>.

Hardware verification

Tested on Lenovo IdeaPad Slim 3 15Q8X10 (83N3) on 7.3.6: both WSA8845 amplifiers attach cleanly on boot, remain attached across idle/playback cycles, and play independent Front Left and Front Right channels.

Reference: https://gitlab.com/openresearchtools/omarchy-slim3x/-/tree/main/stock-fixes/speakers
Merged in Omarchy: omacom/omarchy-pkgs#4320

theironrobin and others added 16 commits November 26, 2026 20:04
Since commit d4c79b6 ("PCI: Allow D3 for native hotplug-capable
Root Ports on non-x86 platforms"), suspend entry crashes on Qualcomm
SC8280XP systems when a Root Port enters D3.

Keep PCI bridges in D0 on SC8280XP until the controller-specific issue
is understood and fixed.

Fixes: d4c79b6 ("PCI: Allow D3 for native hotplug-capable Root Ports on non-x86 platforms")
Signed-off-by: Clover <alex@ironrobin.net>
…ire into Slim 5x

x1-el2-sleep.dtso references cluster_pd2, which does not exist on
Purwa (X1P4x, two CPU clusters), so fdtoverlay fails with
FDT_ERR_NOTFOUND when it is applied to a Purwa EL2 DTB. Add a Purwa
variant without that fragment and apply it on top of x1-el2.dtbo for
both IdeaPad Slim 5x EL2 DTBs (LCD and OLED). EL1 DTBs are unchanged.

Built and checked with fdtoverlay: cluster 0 and 1 get CL4+CL5, the
system domain SS1+DRIPS, CL5 and DRIPS carry system-state.

Slim 5x (X1P-42-100) EL2 results with this configuration are reported
in jglathe#102.

Assisted-by: Grok Bot
…under Gunyah (book4)

At EL1 under Qualcomm's hypervisor an X1E80100 never powers down in
suspend-to-idle: the system-level PSCI state is accepted and held, but
qcom_stats apss/cxsd/ddr stay at 0 (Galaxy Book4 Edge: 1.4 W asleep).
tick_freeze() shuts every CPU's clock event device down, which disables
the virtual timer, and Gunyah only lets a CPU power down when the vCPU
has a timer deadline: its public arm_vm_timer code counts a timer only if
it is enabled and unmasked, and the next timeout is what it hands to its
low-power timer at CPU suspend.

At CPU_PM_ENTER, if the virtual timer is disabled or masked, program a
deadline half the clock event device's range away, and put the control
register back at CPU_PM_EXIT. Only at EL1 on the virtual timer, on
qcom,x1e80100. The full range (max_delta_ticks, 2^56 - 1 here) does not
work: the compare value then lies beyond the 56-bit counter and Gunyah
behaves as with no deadline (cntv_arm far_secs=3752999689: apss/cxsd 0;
far_secs=1876499844, half: apss/cxsd/ddr collapse).

Replaces the out-of-tree test module cntv_arm (2^44 ticks, unmasked),
with which the Book4 reached cxsd/ddr 100 % and 0.77 W over 127 min at
EL1 on 13 November 2026. Not needed for mem_sleep=deep (PSCI
SYSTEM_SUSPEND), which collapses without it.

Fork book4/7.2-sleep: 10f75db and c2bcfa2, folded into one patch.

Assisted-by: Claude Fable 5.2
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Eg21zz6xsWYdX7DBM2kAaw
…00 (Purwa)

IdeaPad Slim 5x 83HL runs under the same Gunyah firmware at EL1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The AOP keeps the AOSS out of sleep on {class: aoss_slp, res: sleep,
val: disable}. The prevent_aoss_sleep debugfs entry sends "res: sleep:
%s" without the val key, and maps Y, which asks to prevent sleep, to
"enable".

On a Samsung Galaxy Book4 Edge 14 (X1E-80-100), writing either Y or N
to the entry left the AOSD residency at 97 to 98 % of a suspend, while
the message above kept it at 0. Send that message, with "disable" for
Y and "enable" for N.

Fixes: d51d984 ("soc: qcom: aoss: Add debugfs interface for sending messages")
Link: omacom/omarchy#15860 (reply in thread)
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Some boards don't come back from AOSS sleep. On the Samsung Galaxy
Book4 Edge 14 a deep suspend with it allowed loses UFS on resume, and
an s2idle one ends in a PMIC power cycle once a full hour of the AOP
clock passes. With AOSS sleep disabled both sleep normally.

The prevent_aoss_sleep debugfs entry can disable it, but only after
boot, and not under lockdown. Add a prevent_aoss_sleep module
parameter that sends the same message at probe, so a board's kernel
command line can keep the AOSS out of sleep from the first suspend.

Link: omacom/omarchy#15860 (reply in thread)
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
drm_edp_backlight_probe_max() reads DP_EDP_PWMGEN_BIT_COUNT, clamps it to
the advertised min/max and derives bl->max from it. It only remembers the
value in bl->pwmgen_bit_count when the driver asked for a specific PWM
frequency, so drm_edp_backlight_enable() never programs it again.

That is fine as long as the panel keeps its state, but when the panel is
power cycled (its supply is switched off for suspend or by runtime PM) the
TCON falls back to its power-on default. On the Samsung ATNA40CT01 OLED
(SDC 0x4187) in the Lenovo IdeaPad Slim 5x that default is 16 bits, while
the firmware (and Windows, via BacklightAuxPWMSizeinBits = 0xB) runs it
with 11. The levels Linux writes then no longer match what the panel
expects, and the brightness cannot be controlled until the next reboot
re-initialises the panel.

Remember the bit count chosen at probe in every case, so that
drm_edp_backlight_enable() restores it after a power cycle.

Assisted-by: Grok Bot
…the OLED model

The always-on rail pulls ~1W constantly (in sleep, too), it is needed for the OLED
model until we have the right power sequences, but not on the LCD model.

Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
When Linux runs at EL2, the qcom_scm_io_writel() to
PDC_GPIO_INT_CTL_ENABLE succeeds and the PDC runs in pass-through mode.
qcom-pdc then turns IRQ_TYPE_EDGE_BOTH on a GPIO wake IRQ into
IRQ_TYPE_EDGE_RISING, and without the dual-edge errata emulation in
pinctrl-msm only one edge is ever seen.

On the Lenovo IdeaPad Slim 5x the lid switch (gpio-keys, GPIO 92, active
low) then fires only on lid open: closing the lid is never reported and
logind never suspends on lid close.

Enable wakeirq_dual_edge_errata so pinctrl-msm re-arms the PDC for the
opposite edge after each interrupt, as on sc7180 and others.

Signed-off-by: Hugo Malinen <patch@tokoro.fi>
Assisted-by: Claude:claude-opus-5-5
…2 overlays

CL5 on the CPU cluster domains, limited to system suspend with
"system-state", is not EL2 specific: TZ refusing the ...54 system states
while the clusters only request CL4 is a property of the firmware, not of
the exception level the kernel runs at. Runtime idle must still not use
CL5 (DC ZVA erratum), which "system-state" guarantees.

Move that part into new x1-sleep.dtso (Hamoa, three clusters) and
x1p-sleep.dtso (Purwa, two clusters), so it can also be applied to the
EL1 DTBs. It is kept out of hamoa.dtsi/purwa.dtsi since it depends on
the genpd "system-state" domain idle state support only this tree has.

x1-el2-sleep.dtso and x1p-el2-sleep.dtso keep the EL2-only parts: SS1
for runtime idle, and DRIPS (domain_ss3) only from system suspend. They
now apply on top of x1-el2.dtbo and x1[p]-sleep.dtbo, and the five EL2
DTBs using them get x1[p]-sleep.dtbo added in front.

No functional change: the resulting EL2 and EL1 DTBs for the T14s, T14s
OLED, Zenbook A14 (X1E) and IdeaPad Slim 5x LCD/OLED are byte-identical
to before. See jglathe#102.

Assisted-by: Grok Bot
x1p-el2-sleep.dtso only existed because the CL5 part referenced
cluster_pd2, which Purwa does not have. With that part moved to
x1p-sleep.dtso, x1p-el2-sleep.dtso has the same content as
x1-el2-sleep.dtso (SS1 and the system domain only). Remove it and use
x1-el2-sleep.dtbo for the IdeaPad Slim 5x EL2 DTBs as well.

The resulting DTBs are byte-identical.

Assisted-by: Grok Bot
Apply x1-sleep.dtbo (ThinkPad T14s LCD/OLED, X1E) and x1p-sleep.dtbo
(IdeaPad Slim 5x LCD/OLED, X1P-42) to the EL1 DTBs as well, so CL5 is
also available for system suspend at EL1 under Gunyah. Runtime idle
stays on CL4.

A composite DTB cannot share its name with its base DTB, and the EL1
DTB names must stay as they are (boot loaders and distro packaging pick
them by name). Like the -el2 DTBs, make <board>.dtb a composite: a
generic rule builds the board .dts as the interim <board>-base.dtb (not
in dtb-y, so neither installed nor listed in dtbs-list), and

  <board>.dtb     = <board>-base.dtb + x1[p]-sleep.dtbo
  <board>-el2.dtb = <board>-base.dtb + x1-el2.dtbo + x1[p]-sleep.dtbo
                    + x1-el2-sleep.dtbo

The EL2 DTBs are byte-identical to before. The EL1 DTBs differ only in
CL5 carrying "system-state" and the cluster domains listing CL4+CL5; the
system domain keeps DRIPS (domain_ss3) as its only, runtime, state.

Other X1E/X1P boards can follow the same scheme after A/B testing.
See jglathe#102.

Assisted-by: Grok Bot
Since commit b38fa16 ("usb: typec: mux: ps883x: Power the retimer
off when not in use"), ps883x_configure() powers the retimer back up
when a Type-C event arrives while it is in reset. Unlike probe, that
path releases reset right after enabling the VDD IO supply, without
the pre-delay that probe has.

Without that delay the first configuration after power-up appears to
fail in some cases, e.g. USB3 in reversed orientation. There is no
public documentation for the power-up sequence, so treat the delay as
a stabilizing pre-delay before reset release and apply it on both paths.

Factor the reset release out of probe into a helper and use it in
probe and ps883x_configure(), and use msleep(20) instead of
usleep_range(4000, 14000), as there is no need for a tight wakeup here.
The delay is only taken when the retimer comes out of reset after a
period of inactivity, so the added latency before the first
configuration is negligible compared to getting the hardware into a
known state.

Fixes: b38fa16 ("usb: typec: mux: ps883x: Power the retimer off when not in use")
Assisted-by: Grok Bot
Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
…right speaker reset

The right WSA8845 amplifier on the Lenovo IdeaPad Slim 3 15Q8X10 (83N3)
has an independent active-low reset line on LPASS GPIO13, while the left
amplifier uses LPASS GPIO12. Assigning both amplifiers to GPIO12 left
right_spkr held in reset (UNATTACHED) so only the left speaker played.

Add right_spkr_sd_n_active for LPASS GPIO13 under &lpass_tlmm, include it
in &swr0 pinctrl-0, and point right_spkr's reset-gpios to LPASS GPIO13.

Tested on hardware (confirmed both amplifiers attach on boot, remain
attached across idle/playback cycles, and play independent Front Left and
Front Right channels).

Link: https://gitlab.com/openresearchtools/omarchy-slim3x/-/tree/main/stock-fixes/speakers
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
@jglathe
jglathe force-pushed the jg/ubuntu-qcom-x1e-7.3.y branch from cc4450a to 7061ff2 Compare December 2, 2026 06:33
@jglathe

jglathe commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Thanks for the pr, slightly sceptical, though. I need to see what's up with mine then. I have a 83N30004GE, and it runs happily with both speakers and only lpass_tlmm 12 as published.

@jglathe
jglathe force-pushed the jg/ubuntu-qcom-x1e-7.3.y branch 2 times, most recently from d4fa38e to 5fb65f3 Compare December 5, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants