From patchwork Thu Jan 28 23:27:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 372666 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67839C433E0 for ; Thu, 28 Jan 2021 23:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34A5164DFA for ; Thu, 28 Jan 2021 23:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbhA1Xa4 (ORCPT ); Thu, 28 Jan 2021 18:30:56 -0500 Received: from mga11.intel.com ([192.55.52.93]:4524 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbhA1X3S (ORCPT ); Thu, 28 Jan 2021 18:29:18 -0500 IronPort-SDR: shD4p6NIhhDYysjMOHVHh5S6pluVZI9JCxZsyDK4Hxw6NgEBIjEk05jhKaplqSoZrLDdWz6SI4 G+K7y+RAXlrA== X-IronPort-AV: E=McAfee;i="6000,8403,9878"; a="176824524" X-IronPort-AV: E=Sophos;i="5.79,383,1602572400"; d="scan'208";a="176824524" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2021 15:27:33 -0800 IronPort-SDR: +ZI6vXBLOqRjUcuHT/LG/VTH07moeD/Zdy9kQBygbrtWx9TEZE9zLp7UchICfQpI7U7kqq5+zu e91yvUuuJz/w== X-IronPort-AV: E=Sophos;i="5.79,383,1602572400"; d="scan'208";a="354359314" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2021 15:27:29 -0800 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by paasikivi.fi.intel.com (Postfix) with ESMTP id BB510211D8; Fri, 29 Jan 2021 01:27:27 +0200 (EET) Received: from sailus by punajuuri.localdomain with local (Exim 4.92) (envelope-from ) id 1l5GhF-0004F8-MI; Fri, 29 Jan 2021 01:27:29 +0200 From: Sakari Ailus To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , rajmohan.mani@intel.com, Tomasz Figa , Bartosz Golaszewski , Bingbu Cao , Chiranjeevi Rapolu , Hyungwoo Yang , linux-media@vger.kernel.org Subject: [PATCH v9 1/7] ACPI: scan: Obtain device's desired enumeration power state Date: Fri, 29 Jan 2021 01:27:23 +0200 Message-Id: <20210128232729.16064-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200903081550.6012-1-sakari.ailus@linux.intel.com> References: <20200903081550.6012-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Store a device's desired enumeration power state in struct acpi_device_power_flags during acpi_device object's initialisation. Signed-off-by: Sakari Ailus --- drivers/acpi/scan.c | 6 ++++++ include/acpi/acpi_bus.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 1d7a02ee45e05..b077c645c9845 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -987,6 +987,8 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) static void acpi_bus_get_power_flags(struct acpi_device *device) { + unsigned long long pre; + acpi_status status; u32 i; /* Presence of _PS0|_PR0 indicates 'power manageable' */ @@ -1008,6 +1010,10 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) if (acpi_has_method(device->handle, "_DSW")) device->power.flags.dsw_present = 1; + status = acpi_evaluate_integer(device->handle, "_PRE", NULL, &pre); + if (ACPI_SUCCESS(status) && !pre) + device->power.flags.allow_low_power_probe = 1; + /* * Enumerate supported power management states */ diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 02a716a0af5d4..020b850120883 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -258,7 +258,8 @@ struct acpi_device_power_flags { u32 power_removed:1; /* Optimize Dx->D0 */ u32 ignore_parent:1; /* Power is independent of parent power state */ u32 dsw_present:1; /* _DSW present? */ - u32 reserved:26; + u32 allow_low_power_probe:1; /* Allow low power state in device probe */ + u32 reserved:25; }; struct acpi_device_power_state {