linux/drivers/bus
Baochen Qiang 813e0ae613 bus: mhi: host: Add mhi_power_down_keep_dev() API to support system suspend/hibernation
Currently, ath11k fails to resume from system suspend/hibernation on some
the x86 host machines with below error message:

```
ath11k_pci 0000:06:00.0: timeout while waiting for restart complete
```

This happens because, ath11k powers down the MHI stack during suspend and
that leads to destruction of the struct device associated with the MHI
channels. And during resume, ath11k calls calling mhi_sync_power_up() to
power up the MHI subsystem and that eventually calls the driver framework's
device_add() API from mhi_create_devices(). But the PM framework blocks the
struct device creation during device_add() and this leads to probe deferral
as below:

```
mhi mhi0_IPCR: Driver qcom_mhi_qrtr force probe deferral
```

The reason for deferring device creation during resume is explained in
dpm_prepare():

        /*
         * It is unsafe if probing of devices will happen during suspend or
         * hibernation and system behavior will be unpredictable in this
         * case. So, let's prohibit device's probing here and defer their
         * probes instead. The normal behavior will be restored in
         * dpm_complete().
         */

Due to the device probe deferral, qcom_mhi_qrtr_probe() API is not getting
called during resume and thus MHI channels are not prepared. So this blocks
the QMI messages from being transferred between ath11k and firmware,
resulting in a firmware initialization failure.

After consulting with Rafael, it was decided to not destroy the struct
device for the MHI channels during system suspend/hibernation because the
device is bound to appear again during resume.

So to achieve this, a new API called mhi_power_down_keep_dev() is
introduced for MHI controllers to keep the struct device when required.
This API is similar to the existing mhi_power_down() API, except that it
keeps the struct device associated with MHI channels instead of destroying
them.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30

Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20240305021320.3367-2-quic_bqiang@quicinc.com
[mani: reworded the commit message and subject]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2024-04-01 16:09:09 +05:30
..
fsl-mc bus: fsl-mc: Convert to platform remove callback returning void 2023-11-16 12:43:56 +01:00
mhi bus: mhi: host: Add mhi_power_down_keep_dev() API to support system suspend/hibernation 2024-04-01 16:09:09 +05:30
arm-cci.c bus: arm-cci: remove unnecessary unreachable() 2018-05-14 01:22:49 -07:00
arm-integrator-lm.c bus: arm-integrator-lm: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:50 -07:00
brcmstb_gisb.c bus: brcmstb_gisb: Added support for 74165 register layout 2024-01-29 10:43:22 -08:00
bt1-apb.c bus: bt1-apb: Remove duplicate include 2024-03-04 14:32:46 +01:00
bt1-axi.c bus: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:53 -07:00
da8xx-mstpri.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hisi_lpc.c bus: hisi_lpc: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
imx-weim.c bus: imx-weim: fix valid range check 2024-02-06 14:10:47 +08:00
intel-ixp4xx-eb.c bus: ixp4xx: fix IXP4XX_EXP_T1_MASK 2023-07-05 22:22:55 +02:00
Kconfig bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-02-16 12:11:47 +01:00
Makefile bus: add driver for initializing the SSC bus on (some) qcom SoCs 2022-04-19 13:03:57 -05:00
mips_cdmm.c mips: bus: make mips_cdmm_bustype const 2024-02-20 13:36:34 +01:00
moxtet.c Char/Misc and other Driver changes for 6.8-rc1 2024-01-17 16:47:17 -08:00
mvebu-mbus.c bus: mvebu-mbus: Remove open coded "ranges" parsing 2023-04-18 11:18:24 -05:00
omap_l3_noc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
omap_l3_noc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
omap_l3_smx.c bus: omap_l3_smx: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
omap_l3_smx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
omap-ocp2scp.c bus: omap-ocp2scp: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
qcom-ebi2.c bus: qcom: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:50 -07:00
qcom-ssc-block-bus.c bus: qcom-ssc-block-bus: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
simple-pm-bus.c bus: simple-pm-bus: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
sun50i-de2.c bus: sun50i-de2: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
sunxi-rsb.c bus: sunxi-rsb: make sunxi_rsb_bus const 2024-02-11 21:24:48 +01:00
tegra-aconnect.c bus: tegra-aconnect: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
tegra-gmi.c bus: tegra-gmi: Convert to platform remove callback returning void 2023-11-28 18:43:26 +01:00
ti-pwmss.c bus: ti-pwmss: Convert to platform remove callback returning void 2023-11-28 18:43:27 +01:00
ti-sysc.c bus: ti-sysc: constify the struct device_type usage 2024-02-28 09:30:25 +02:00
ts-nbus.c bus: ts-nbus: Improve error reporting 2024-03-12 21:07:27 +01:00
uniphier-system-bus.c bus: uniphier-system-bus: Remove open coded "ranges" parsing 2023-03-30 13:37:21 -05:00
vexpress-config.c bus: vexpress-config: Annotate struct vexpress_syscfg_func with __counted_by 2023-09-25 19:38:27 +01:00