From patchwork Wed Jun 21 19:21:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 106114 Delivered-To: patches@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2092602qgd; Wed, 21 Jun 2017 12:21:48 -0700 (PDT) X-Received: by 10.46.14.10 with SMTP id 10mr4896694ljo.52.1498072908364; Wed, 21 Jun 2017 12:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498072908; cv=none; d=google.com; s=arc-20160816; b=iCbsCXw3RjsQ4lJ2/HI36qx8Org876VVFmgOvOuzCQ9Fuj4edmZZfnJAfmz/d8IB33 mT8idkdihLsSxcOgs6zy1XC2l3akekTKUdF2fXlFwflohtLCncof+gSEu0V8HotU1Uls ywABABQUJbR1IWmgqj3HxOpnm6U7EsoRZebXlV1BOsHwlr0C7YTXvDh6mw2AbankhX99 J5na8F9MP/j/KHS46pPJBwQo4h2jP/s9OIFF8YYGjd7pfxPsSOjpaBMxjq7TJ1pJ7vr6 xDrNjHoky5GllK1Eb3n79YXcmXOXiaVlWGWGbIh0xwLgHB5mjEfBGSE17vIXTOxOc1Ur i8xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=2tFm2ReLkZSQmBAP8QqPjntJJcpMyEdbGG5/WbHDudI=; b=H5UH2pc0bviD/9va2tFn2YIj8dbZlUgfLP39T64MuVEZJ3p12XkLZjA4mR4vYJoHm8 fYp3HR+blab8JRJmrYE7PDWPwv1vQRSAwe0mjKCfNNwLOKdJFR+WzP8oW5ktlYajkEWg tkw77bN5nFdKTlCRjq04yht/5dlNsmv3RbO8Segjg/356ne7PL3o+XJB4s90jiwE1dQJ Wq3hHUj2kEXKkZvgGd6NPmwJN4o4SxW5WGCOVNgCNTDDsHvIL7GBG/dQtjS42k+GuQYP MRLkwo6ouEcVqG+RnxRLyBy6caOY6p3FpQFzRNqhLr3uGC/sO1gJKPDfdnmKRPeExNRc BPhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=NbpoQ32R; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com. [2a00:1450:4010:c07::235]) by mx.google.com with ESMTPS id 26si8259644ljg.30.2017.06.21.12.21.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 12:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) client-ip=2a00:1450:4010:c07::235; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=NbpoQ32R; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::235 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x235.google.com with SMTP id m77so102860142lfe.0 for ; Wed, 21 Jun 2017 12:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=2tFm2ReLkZSQmBAP8QqPjntJJcpMyEdbGG5/WbHDudI=; b=NbpoQ32RP0AteH5xG1t+vvRYE9eLnGZunl1Z/Ldyel0e7n0FOl2TijrD70qFPSXo7C 4DGprAYQvGFdPSRtWBNdImEk/3x/3Y5OzPibQppjLZH9S1Hvcm7Qx4lL37y5ethNgfPX +S6mxFwhRIiM6DBTRu8biomtjF70Nxfq7XsXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2tFm2ReLkZSQmBAP8QqPjntJJcpMyEdbGG5/WbHDudI=; b=WpEsBqQTncVQP7LYeDxZcbKiPeb1C+fjrzMVM7CqmQz0UlE76CkKHDaUPxwPxjz9ci TQzOJKQG7nnaNd9U1Y20DTctuW60xTSxnmJ64tqEMqKteD44/1OxTNY7O515+C+VMKcf gmLsET5hdRLyPUdiTuPXGL/pFGqPmb3QFuPrMYubzxao4RY4AyvLDRHvwx6l3xTToj22 uPDnPpxJf+J6nnB+q+nAd+jFR5gnXhzzAi+YPM1JfuHRO4ajmBjxl5+WIYbINtcfxpLU I6ZbUb1YYAyKRhaiSljpp71XQPe485T5QLPI6odtPWb6fLSmRQxo0qrF/v8M8eGKrQrV XdsQ== X-Gm-Message-State: AKS2vOzCailF73ds1/KsFp8uZg0lCJhrBIf6+PtD73CqGtW+MOKepq1z h63e4fewNHjDsUOkFcU= X-Received: by 10.25.195.5 with SMTP id t5mr12395270lff.23.1498072906913; Wed, 21 Jun 2017 12:21:46 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id t24sm3920047ljd.1.2017.06.21.12.21.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 12:21:46 -0700 (PDT) From: Ulf Hansson To: Wolfram Sang , "Rafael J . Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Cc: Kevin Hilman , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jisheng Zhang , John Stultz , Guodong Xu , Sumit Semwal , Haojian Zhuang , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, Ulf Hansson Subject: [PATCH 0/9] PM / ACPI / i2c: Fix system suspend and deploy runtime PM centric path for ACPI Date: Wed, 21 Jun 2017 21:21:19 +0200 Message-Id: <1498072888-14782-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 The i2c designware platform driver, drivers/i2c/busses/i2c-designware-platdrv.c, currently suffers from a regression, which easily can be triggerd during system suspend/resume. In particular the regression concerns those SoCs, which doesn't have the i2c device being attached to the ACPI PM domain. The regression, introduced in commit 8503ff166504 ("i2c: designware: Avoid unnecessary resuming during system suspend"), takes advantage of the so called direct_complete path during system sleep, which works well when using the ACPI PM domain, however as stated, that's not the case for other SoCs. In this series, patch 1, takes a very simplistic approach to solve the problem and the change is limited to the i2c driver itself. The aim with this change is to make it acceptable as a fix for v4.2+. However, patch 1 is unfortunate also reverting back to the old behaviour, avoiding the direct_complete path, by always runtime resuming the device in the device_prepare() phase during system sleep. In many cases this is a waste, especially when the device could have remained runtime suspended during the entire system sleep sequence. The rest of the changes in this series, addresses the above problem, avoiding to runtime resume the device unless it's really needed. One could have tried out other local hacks, limited to the i2c driver, but I believe the problem could exist for other drivers/devices as well, thus I aim for a more generic solution. In principle, this series enables the proven runtime PM centric approach to implement system sleep in the i2c driver. However, to do that the ACPI PM domain have to collaborate and understand this behaviour. Therefore a number of changes, patch 2 to patch 8, makes the needed changes to the ACPI PM domain. In the last change, patch9, the i2c driver converts to the runtime PM centric approach. It shall be noted, the behaviour of the ACPI PM domain should remain intact, still taking benefit of using the direct_complete path during system sleep, except for those devices that explicitly request it not to. This series has been tested on an ARM64 Hikey board, not having its i2c device attach to the ACPI PM domain. This means that the ACPI changes has so far only been compile tested. Any help in testing on relevant Intel SoCs is greatly appreciated and so is of course review comments. The series is based upon Rafael's pm tree and linux-next branch. It's also available at the following git: git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git acpi_pm_i2c_rpm_path Kind regards Ulf Hansson Ulf Hansson (9): i2c: designware: Fix system suspend PM / ACPI: Restore acpi_subsys_complete() PM / Sleep: Remove pm_complete_with_resume_check() PM / ACPI: Split code validating need for runtime resume in ->prepare() PM / ACPI: Split acpi_lpss_suspend_late|resume_early() PM / ACPI: Provide option to disable direct_complete for ACPI devices PM / ACPI: Enable the runtime PM centric approach for system sleep PM / ACPI: Avoid runtime resuming device in acpi_subsys_suspend|freeze() i2c: designware: Deploy the runtime PM centric approach for system sleep drivers/acpi/acpi_lpss.c | 81 ++++++++++---- drivers/acpi/device_pm.c | 164 ++++++++++++++++++++++++---- drivers/base/power/generic_ops.c | 23 ---- drivers/i2c/busses/i2c-designware-platdrv.c | 32 ++---- include/acpi/acpi_bus.h | 1 + include/linux/acpi.h | 4 + include/linux/pm.h | 1 - 7 files changed, 219 insertions(+), 87 deletions(-) -- 2.7.4