Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp138486ybc; Mon, 18 Nov 2019 22:01:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzeEch1cISvO7x0tHAoVKXNjm5qrvtrmpDYCfY5LvK5Cq7p679FprfCv+aJ54n+nGFpZgxq X-Received: by 2002:a7b:c76a:: with SMTP id x10mr3073802wmk.123.1574143270088; Mon, 18 Nov 2019 22:01:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574143270; cv=none; d=google.com; s=arc-20160816; b=s7MedaXllkVv5Nj+1OTk23SBep1HUSRUyX7kpEvcf4LSdV8TB5phnZR5fe5S5GcTdL gtNxAmfpD+Td5xZZ1R2BJ3zC5CQhUjMZ0gjrRv/+0acqtyM28WaU+25nnFdM6ejNeKLZ NzRdOrz3xHJC11M6ALxYA7EEvDS3telQ30EcX3g4/+upiJLg8svFdNsD0m7ofIoOIccn VXakqalIdpARJULpkub1M5EbsJYCcMxWIrztDTk+0FOzlJ1ywFMTdS0ST5W18uSCEn7t M+IAc5mhwRgaSK1JSs+fiV4MfYs0VUZ50XCAw4N2MeHaFpOT4xPJjvgZqrSP2qpXAj8j F5/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xPVb4KOiGgscKW8+/XsI5BmK9SCw1LDnNQqwXs+jyZU=; b=KcyajfjJDSkiCASRRlUjeBDImSyscJFiXIgHtZNxoIj+Y+++lkPthOUpSAdx3LxR7f HxY5yJKqXvbjrAR8koFEmwGcYHJ6KIfSfpLWdCSNWGbrSvUSK7Iw3akW5ozMuaS4QcrB wJCUrgC/DxXqMOYGXRya6kjq0CeOrcYWDGlMhcCr2u8qV07kjIYhHlp0GlUDaJQF9wsH 0dFvp18z3x4a3z+0gXqe93W9C5JHy5RUMG6RZMHNLHVgvHbboBVIL1cAS/vQR/4AzusT 1yIIjxj/NrJF1qEBTyvWjecBU9JpvofVQTrl+OI4l8Q8R6TPdZPEp789sGyGRVQMDkwc eUfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kcojmWkr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6si10386911edo.349.2019.11.18.22.00.45; Mon, 18 Nov 2019 22:01:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kcojmWkr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731786AbfKSFv2 (ORCPT + 99 others); Tue, 19 Nov 2019 00:51:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:48862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731777AbfKSFv0 (ORCPT ); Tue, 19 Nov 2019 00:51:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A9B25208C3; Tue, 19 Nov 2019 05:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142685; bh=d999pwMigJEppsr13vUh55zksJ5+AulgB9PyRUebJXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kcojmWkrYDGNWeZ4yHwm7pro/JmAUlc8gXLfkFgX+u5sw9tbdC5LlGkxM8AHQQAA6 nX65YLJB8YOi0CGlcL9if7wAJqrfeyFbCm1t/xjy72owb3XgK9S1ENIjn+K8DihMst ZqxWLwzh7+r0vMyxs87Q6JFKkSrX1av2xYkVbNww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Mika Westerberg , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 128/239] ACPI / LPSS: Exclude I2C busses shared with PUNIT from pmc_atom_d3_mask Date: Tue, 19 Nov 2019 06:18:48 +0100 Message-Id: <20191119051330.514529055@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ 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 Acked-by: Mika Westerberg Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- 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