mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Shih-Yuan Lee <fourdollars@debian.org>
Cc: Mark Brown <broonie@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Lukas Wunner <lukas@wunner.de>, Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v17 5/6] spi: pxa2xx-pci: restore LPSS private register state across S3 resume
Date: Thu, 1 Oct 2026 10:20:27 +0300	[thread overview]
Message-ID: <ar4Ju6oGkWGCOlct@ashevche-desk.local> (raw)
In-Reply-To: <20260930160629.1822-6-fourdollars@debian.org>

On Thu, Oct 01, 2026 at 12:06:28AM +0800, Shih-Yuan Lee wrote:
> On platforms where Intel LPSS SPI is enumerated as a bare PCI device
> (such as the Apple MacBook8,1 on Lynxpoint-LP), the LPSS power island
> loses power during system sleep and powers up with the controller held
> in reset. Because the device lacks ACPI companion objects or MFD
> binding, neither drivers/acpi/x86/lpss.c nor drivers/mfd/intel-lpss.c
> restore the private register context across S3 resume.
> 
> This causes memory-mapped I/O reads on resume to return ~0, resulting
> in PCIe Completion Timeouts, missing interrupts, and dead
> keyboard/touchpad.
> 
> Restore LPSS private registers and deassert functional, APB, and iDMA
> resets in the PCI glue layer:
> 1. In suspend, quiesce the controller queue via spi_controller_suspend()
>    so no transfers remain in flight and chip select is deasserted.
>    Then save the LPSS private registers (LPSS_PRIV_REG_COUNT 9 covering
>    up to offset 0x20 including reg_cs_ctrl at 0x18). Ensure the clock is
>    active for reading MMIO registers using pm_runtime_resume_and_get(),
>    balanced by pm_runtime_put_noidle(), before calling
>    pm_runtime_force_suspend().
> 2. In resume, restore LPSS private registers and deassert functional,
>    APB, and iDMA resets via pxa2xx_spi_pci_lpss_restore_ctx() before
>    calling pm_runtime_force_resume(). Because the controller clock
>    remains gated (clk_enabled is false) during this restoration, any
>    interrupt arriving on a shared line bails out early in ssp_int()
>    without accessing registers on a controller held in reset. Once
>    resets are deasserted and private registers are restored, call
>    pm_runtime_force_resume() to enable the clock and mark the device
>    active, and restart the queue with spi_controller_resume().
> 3. In probe, call pci_d3cold_disable() for Lynxpoint-LP (is_lpt) to
>    ensure the PCI device cannot enter D3cold during runtime PM,
>    guaranteeing that LPSS private registers are retained during S0 idle
>    periods and only require restoration across S3 system sleep. Set
>    DPM_FLAG_NO_DIRECT_COMPLETE to prevent PCI subsystem direct-complete
>    bypassing system sleep callbacks.
> 4. Scope LPSS context restoration specifically to Lynxpoint-LP
>    (PCI_DEVICE_ID_INTEL_LPT*) devices to avoid perturbing other LPSS
>    PCI platforms (BYT, BSW) or non-LPSS platforms.
> 
> Export lpss_ssp_setup() and core runtime PM ops so the PCI glue layer
> can invoke them around private register restoration.

No, as I told earlier please find a way how to not add a code duplication.

> Assisted-by: Antigravity:gemini-3.8-flash sparse

Assisted-by: LLM

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2026-10-01  7:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 16:06 [PATCH v17 0/6] spi: pxa2xx: PM fixes, teardown overhaul, and LPSS restore for MacBook8,1 Shih-Yuan Lee
2026-09-30 16:06 ` [PATCH v17 1/6] spi: pxa2xx: rename local status variable to ret Shih-Yuan Lee
2026-10-01  7:10   ` Andy Shevchenko
2026-09-30 16:06 ` [PATCH v17 2/6] spi: pxa2xx: introduce clock enable and disable helper functions Shih-Yuan Lee
2026-09-30 17:31   ` Mark Brown
2026-10-01  7:13   ` Andy Shevchenko
2026-09-30 16:06 ` [PATCH v17 3/6] spi: pxa2xx: acquire active PM runtime reference in interrupt handler Shih-Yuan Lee
2026-09-30 17:40   ` Mark Brown
2026-09-30 16:06 ` [PATCH v17 4/6] spi: pxa2xx: overhaul teardown and suspend sequence to synchronize IRQ before clock gating Shih-Yuan Lee
2026-09-30 16:06 ` [PATCH v17 5/6] spi: pxa2xx-pci: restore LPSS private register state across S3 resume Shih-Yuan Lee
2026-10-01  4:13   ` Mika Westerberg
2026-10-01  7:20   ` Andy Shevchenko [this message]
2026-09-30 16:06 ` [PATCH v17 6/6] spi: pxa2xx-pci: disable DMA and runtime autosuspend for Apple MacBook8,1 Shih-Yuan Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ar4Ju6oGkWGCOlct@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel@zonque.org \
    --cc=fourdollars@debian.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=robert.jarzmik@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®