All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 102/103] ACPI / LPSS: Exclude I2C busses shared with PUNIT from pmc_atom_d3_mask
Date: Fri,  8 Nov 2019 06:43:07 -0500	[thread overview]
Message-ID: <20191108114310.14363-102-sashal@kernel.org> (raw)
In-Reply-To: <20191108114310.14363-1-sashal@kernel.org>

From: Hans de Goede <hdegoede@redhat.com>

[ Upstream commit 86b62e5cd8965d3056f9e9ccdec51631c37add81 ]

lpss_iosf_enter_d3_state() checks if all hw-blocks using the DMA
controllers are in d3 before powering down the DMA controllers.

But on devices, where the I2C bus connected to the PMIC is shared by
the PUNIT, the controller for that bus will never reach d3 since it has
an effectively empty _PS3 method. Instead it appears to automatically
power-down during S0i3 and we never see it as being in d3.

This causes the DMA controllers to never be powered-down on these devices,
causing them to never reach S0i3. This commit uses the ACPI _SEM method
to detect if an I2C bus is shared with the PUNIT and if it is, it removes
it from the mask of devices which lpss_iosf_enter_d3_state() checks for.

This fixes these devices never reaching any S0ix states.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/acpi/acpi_lpss.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 51592dd45b066..1ab8d7223b252 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -98,6 +98,9 @@ struct lpss_private_data {
 	u32 prv_reg_ctx[LPSS_PRV_REG_COUNT];
 };
 
+/* Devices which need to be in D3 before lpss_iosf_enter_d3_state() proceeds */
+static u32 pmc_atom_d3_mask = 0xfe000ffe;
+
 /* LPSS run time quirks */
 static unsigned int lpss_quirks;
 
@@ -174,6 +177,21 @@ static void byt_pwm_setup(struct lpss_private_data *pdata)
 
 static void byt_i2c_setup(struct lpss_private_data *pdata)
 {
+	const char *uid_str = acpi_device_uid(pdata->adev);
+	acpi_handle handle = pdata->adev->handle;
+	unsigned long long shared_host = 0;
+	acpi_status status;
+	long uid = 0;
+
+	/* Expected to always be true, but better safe then sorry */
+	if (uid_str)
+		uid = simple_strtol(uid_str, NULL, 10);
+
+	/* Detect I2C bus shared with PUNIT and ignore its d3 status */
+	status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
+	if (ACPI_SUCCESS(status) && shared_host && uid)
+		pmc_atom_d3_mask &= ~(BIT_LPSS2_F1_I2C1 << (uid - 1));
+
 	lpss_deassert_reset(pdata);
 
 	if (readl(pdata->mmio_base + pdata->dev_desc->prv_offset))
@@ -789,7 +807,7 @@ static void lpss_iosf_enter_d3_state(void)
 	 * Here we read the values related to LPSS power island, i.e. LPSS
 	 * devices, excluding both LPSS DMA controllers, along with SCC domain.
 	 */
-	u32 func_dis, d3_sts_0, pmc_status, pmc_mask = 0xfe000ffe;
+	u32 func_dis, d3_sts_0, pmc_status;
 	int ret;
 
 	ret = pmc_atom_read(PMC_FUNC_DIS, &func_dis);
@@ -807,7 +825,7 @@ static void lpss_iosf_enter_d3_state(void)
 	 * Shutdown both LPSS DMA controllers if and only if all other devices
 	 * are already in D3hot.
 	 */
-	pmc_status = (~(d3_sts_0 | func_dis)) & pmc_mask;
+	pmc_status = (~(d3_sts_0 | func_dis)) & pmc_atom_d3_mask;
 	if (pmc_status)
 		goto exit;
 
-- 
2.20.1


  parent reply	other threads:[~2019-11-08 11:56 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 11:41 [PATCH AUTOSEL 4.14 001/103] iio: adc: max9611: explicitly cast gain_selectors Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 002/103] tee: optee: take DT status property into account Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 003/103] ath10k: fix kernel panic by moving pci flush after napi_disable Sasha Levin
2019-11-08 11:41   ` Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 004/103] iio: dac: mcp4922: fix error handling in mcp4922_write_raw Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 005/103] arm64: dts: allwinner: a64: Olinuxino: fix DRAM voltage Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 006/103] arm64: dts: allwinner: a64: NanoPi-A64: Fix DCDC1 voltage Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 007/103] ALSA: pcm: signedness bug in snd_pcm_plug_alloc() Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 008/103] arm64: dts: tegra210-p2180: Correct sdmmc4 vqmmc-supply Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 009/103] ARM: dts: at91/trivial: Fix USART1 definition for at91sam9g45 Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 010/103] rtc: rv8803: fix the rv8803 id in the OF table Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 011/103] remoteproc/davinci: Use %zx for formating size_t Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 012/103] extcon: cht-wc: Return from default case to avoid warnings Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 013/103] cfg80211: Avoid regulatory restore when COUNTRY_IE_IGNORE is set Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 014/103] ALSA: seq: Do error checks at creating system ports Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 015/103] ath9k: fix tx99 with monitor mode interface Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 016/103] ath10k: limit available channels via DT ieee80211-freq-limit Sasha Levin
2019-11-08 11:41   ` Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 017/103] gfs2: Don't set GFS2_RDF_UPTODATE when the lvb is updated Sasha Levin
2019-11-08 11:41   ` [Cluster-devel] " Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 018/103] ASoC: dpcm: Properly initialise hw->rate_max Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 019/103] pinctrl: ingenic: Probe driver at subsys_initcall Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 020/103] MIPS: BCM47XX: Enable USB power on Netgear WNDR3400v3 Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 021/103] ARM: dts: exynos: Fix sound in Snow-rev5 Chromebook Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 022/103] liquidio: fix race condition in instruction completion processing Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 023/103] ARM: dts: exynos: Fix regulators configuration on Peach Pi/Pit Chromebooks Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 024/103] i40e: use correct length for strncpy Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 025/103] i40e: hold the rtnl lock on clearing interrupt scheme Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 026/103] i40e: Prevent deleting MAC address from VF when set by PF Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 027/103] IB/rxe: fixes for rdma read retry Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 028/103] iwlwifi: don't WARN on trying to dump dead firmware Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 029/103] iwlwifi: mvm: avoid sending too many BARs Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 030/103] ARM: dts: pxa: fix the rtc controller Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 031/103] ARM: dts: pxa: fix power i2c base address Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 032/103] rtl8187: Fix warning generated when strncpy() destination length matches the sixe argument Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 033/103] soc: imx: gpc: fix PDN delay Sasha Levin
2019-11-08 11:41 ` [PATCH AUTOSEL 4.14 034/103] ASoC: rsnd: ssi: Fix issue in dma data address assignment Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 035/103] net: phy: mscc: read 'vsc8531,vddmac' as an u32 Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 036/103] net: phy: mscc: read 'vsc8531, edge-slowdown' " Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 037/103] ARM: dts: meson8: fix the clock controller register size Sasha Levin
2019-11-08 11:42   ` Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 038/103] ARM: dts: meson8b: " Sasha Levin
2019-11-08 11:42   ` Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 039/103] net: lan78xx: Bail out if lan78xx_get_endpoints fails Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 040/103] ASoC: sgtl5000: avoid division by zero if lo_vag is zero Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 041/103] ARM: dts: exynos: Disable pull control for S5M8767 PMIC Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 042/103] ath10k: wmi: disable softirq's while calling ieee80211_rx Sasha Levin
2019-11-08 11:42   ` Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 043/103] IB/ipoib: Ensure that MTU isn't less than minimum permitted Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 044/103] RDMA/core: Rate limit MAD error messages Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 045/103] RDMA/core: Follow correct unregister order between sysfs and cgroup Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 046/103] mips: txx9: fix iounmap related issue Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 047/103] ASoC: Intel: hdac_hdmi: Limit sampling rates at dai creation Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 048/103] of: make PowerMac cache node search conditional on CONFIG_PPC_PMAC Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 049/103] ARM: dts: omap3-gta04: give spi_lcd node a label so that we can overwrite in other DTS files Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 050/103] ARM: dts: omap3-gta04: fixes for tvout / venc Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 051/103] ARM: dts: omap3-gta04: tvout: enable as display1 alias Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 052/103] ARM: dts: omap3-gta04: fix touchscreen tsc2007 Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 053/103] ARM: dts: omap3-gta04: make NAND partitions compatible with recent U-Boot Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 054/103] ARM: dts: omap3-gta04: keep vpll2 always on Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 055/103] sched/debug: Use symbolic names for task state constants Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 056/103] arm64: dts: rockchip: Fix VCC5V0_HOST_EN on rk3399-sapphire Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 057/103] dmaengine: dma-jz4780: Don't depend on MACH_JZ4780 Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 058/103] dmaengine: dma-jz4780: Further residue status fix Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 059/103] EDAC, sb_edac: Return early on ADDRV bit and address type test Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 060/103] rtc: mt6397: fix possible race condition Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 061/103] rtc: pl030: " Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 062/103] ath9k: add back support for using active monitor interfaces for tx99 Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 063/103] IB/hfi1: Missing return value in error path for user sdma Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 064/103] signal: Always ignore SIGKILL and SIGSTOP sent to the global init Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 065/103] signal: Properly deliver SIGILL from uprobes Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 066/103] signal: Properly deliver SIGSEGV from x86 uprobes Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 067/103] f2fs: fix memory leak of percpu counter in fill_super() Sasha Levin
2019-11-08 11:42   ` [f2fs-dev] " Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 068/103] scsi: qla2xxx: Fix iIDMA error Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 069/103] scsi: qla2xxx: Defer chip reset until target mode is enabled Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 070/103] scsi: qla2xxx: Fix dropped srb resource Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 071/103] scsi: lpfc: Fix errors in log messages Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 072/103] scsi: sym53c8xx: fix NULL pointer dereference panic in sym_int_sir() Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 073/103] ARM: imx6: register pm_power_off handler if "fsl,pmic-stby-poweroff" is set Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 074/103] scsi: pm80xx: Corrected dma_unmap_sg() parameter Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 075/103] scsi: pm80xx: Fixed system hang issue during kexec boot Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 076/103] kprobes: Don't call BUG_ON() if there is a kprobe in use on free list Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 077/103] Drivers: hv: vmbus: Fix synic per-cpu context initialization Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 078/103] nvmem: core: return error code instead of NULL from nvmem_device_get Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 079/103] media: dt-bindings: adv748x: Fix decimal unit addresses Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 080/103] media: fix: media: pci: meye: validate offset to avoid arbitrary access Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 081/103] media: dvb: fix compat ioctl translation Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 082/103] arm64: dts: meson: libretech: update board model Sasha Levin
2019-11-08 11:42   ` Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 083/103] ALSA: intel8x0m: Register irq handler after register initializations Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 084/103] pinctrl: at91-pio4: fix has_config check in atmel_pctl_dt_subnode_to_map() Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 085/103] MIPS: lantiq: Do not enable IRQs in dma open Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 086/103] llc: avoid blocking in llc_sap_close() Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 087/103] ARM: dts: qcom: ipq4019: fix cpu0's qcom,saw2 reg value Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 088/103] soc: qcom: wcnss_ctrl: Avoid string overflow Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 089/103] powerpc/vdso: Correct call frame information Sasha Levin
2019-11-08 11:42   ` Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 090/103] ARM: dts: socfpga: Fix I2C bus unit-address error Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 091/103] pinctrl: at91: don't use the same irqchip with multiple gpiochips Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 092/103] cxgb4: Fix endianness issue in t4_fwcache() Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 093/103] blok, bfq: do not plug I/O if all queues are weight-raised Sasha Levin
2019-11-08 11:42 ` [PATCH AUTOSEL 4.14 094/103] arm64: dts: meson: Fix erroneous SPI bus warnings Sasha Levin
2019-11-08 11:42   ` Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 095/103] power: supply: ab8500_fg: silence uninitialized variable warnings Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 096/103] power: reset: at91-poweroff: do not procede if at91_shdwc is allocated Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 097/103] power: supply: max8998-charger: Fix platform data retrieval Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 098/103] component: fix loop condition to call unbind() if bind() fails Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 099/103] kernfs: Fix range checks in kernfs_get_target_path Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 100/103] ip_gre: fix parsing gre header in ipgre_err Sasha Levin
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 101/103] ARM: dts: rockchip: Fix erroneous SPI bus dtc warnings on rk3036 Sasha Levin
2019-11-08 11:43 ` Sasha Levin [this message]
2019-11-08 11:43 ` [PATCH AUTOSEL 4.14 103/103] ath9k: Fix a locking bug in ath9k_add_interface() Sasha Levin

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=20191108114310.14363-102-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.