Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3511336rdb; Wed, 27 Dec 2023 09:35:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEo/3Ua6wVGwNJyW6ZDLoSSWfv8sY3AYOb61fmm9ywbwcYfYYIhb8G1f10/5m0GQdhAdhNF X-Received: by 2002:a05:600c:283:b0:40d:1d7f:a810 with SMTP id 3-20020a05600c028300b0040d1d7fa810mr5737884wmk.102.1703698516375; Wed, 27 Dec 2023 09:35:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703698516; cv=none; d=google.com; s=arc-20160816; b=PKiGEWEcgY/8HBEYtkEBSUT6DU3JJWM+KJWggcOWKD2CBCdZmzaCZle6w/sLzohNkB VnVX0t910KMv9gyX5FExb83374+8eOZ1eoLTXEbT/h5oNjRyPGiJxiP9mvD7jcQtEdPf GQoYlQ075AhVrm/wnmYHQVOUGsvXR5V220r5VCFel80z0McLWAD6xF5SCCwaWZKsRQOg g1PEoLrhvB9f5mG97toY2rqzn88aQf5MNYfGw2MnEoj4ETUnprnNnWH1dBvHHtmiCvWN 51tkZuz0k3UQBswmD4bLoCTguAspGjCRluQmk6wl6on1KTIOyRFGAzs3yuGPyGJVIoWd K6WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=wXIvfVZBhK57BmlVhBWXGGhwhiJD3FEJCnZoA/eQwkc=; fh=21c6F/aar9rOVeoeOPoKPLkjWo0ukQh8Vdb6TfE3JLY=; b=BlYEa43b2fx2tXCg1jgAIbxZVJDTWWwQNCTn7g53H4xGEAG24J3rEGYi9v3GRE1RPK nI4y4Yq44GvF6g7UkjG+h4IIrrjq7N53402uejbQPU5NCgsFQzrG69O43nGmBdkfXeL+ GXZQgI78TsADK6odJSq2nw/aciLE9GE+ryyrlOKkLrabKiSQsupkW0g8YLpxDaUjGd+4 bTdO8uQh5ngmn3nXEm5RxC1t7WdamKWEuu7df0DLAxsqnDcYaCCGo9uWuNYv9BMovfaK 2vbVX2d0g7jtZW4cXAWohQFIjH3qxYUkJTNuQJ0F7hHWIzOS1UlfeWQIIsLY60cecy7s JsJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ChGeEBvx; spf=pass (google.com: domain of linux-kernel+bounces-12175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k14-20020a170906578e00b00a1c56d97dd9si6169339ejq.416.2023.12.27.09.35.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 09:35:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ChGeEBvx; spf=pass (google.com: domain of linux-kernel+bounces-12175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2442D1F21467 for ; Wed, 27 Dec 2023 17:35:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 608614652C; Wed, 27 Dec 2023 17:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ChGeEBvx" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45D8A46522 for ; Wed, 27 Dec 2023 17:35:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703698507; x=1735234507; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xgw6Rx1xyiu9/c4fqxAyWEIp8q2MXXE0eNzx2fpq55Q=; b=ChGeEBvxgrXzqyiRzZLFCTmhek0sRxg4jmILlzEWaJAxBBj9gXpeI8yi apgHwfXuFSS38Ds89j1HldS3BMAlCr8J5IRT6bP+4c6XJVvCRT1skNSFi Pt2EFvA+Ps/k7Ajs5bvd8t8zWEVj4ukRUZCvR6M/y/RDBtqPiWfJ30xBm BMbmFeLBisYWgrYhulG06/kdQs9gSl14UBsY+xEHJftRV695mW/y8ki3m C8VP7vbvFAIiNV7Gqklz1/y9ias5wJZREa6jXGAFW8lbFR6mspW5ZQYIu dhh3QXxSOsfEwQ+vJ7fh0F2AhO7UceRrwdDYcIUeSJZz+0IVLfPRbPjL2 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="399256031" X-IronPort-AV: E=Sophos;i="6.04,309,1695711600"; d="scan'208";a="399256031" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2023 09:35:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="921884517" X-IronPort-AV: E=Sophos;i="6.04,309,1695711600"; d="scan'208";a="921884517" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2023 09:35:02 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rIXo3-00000009Tbk-0hcN; Wed, 27 Dec 2023 19:34:59 +0200 Date: Wed, 27 Dec 2023 19:34:58 +0200 From: Andy Shevchenko To: Mark Hasemeyer Cc: LKML , AngeloGioacchino Del Regno , Krzysztof Kozlowski , Rob Herring , Konrad Dybcio , Sudeep Holla , Raul Rangel , Tzung-Bi Shih , Benson Leung , Bhanu Prakash Maiya , Chen-Yu Tsai , Guenter Roeck , Lee Jones , Prashant Malani , Rob Barnes , Stephen Boyd , chrome-platform@lists.linux.dev Subject: Re: [PATCH v3 24/24] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq Message-ID: References: <20231226192149.1830592-1-markhas@chromium.org> <20231226122113.v3.24.Ieee574a0e94fbaae01fd6883ffe2ceeb98d7df28@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231226122113.v3.24.Ieee574a0e94fbaae01fd6883ffe2ceeb98d7df28@changeid> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Dec 26, 2023 at 12:21:28PM -0700, Mark Hasemeyer wrote: > The cros ec driver is manually managing the wake IRQ by calling > enable_irq_wake()/disable_irq_wake() during suspend/resume. > > Modify the driver to use the power management subsystem to manage the > wakeirq. > > Rather than assuming that the IRQ is wake capable, use the underlying > firmware/device tree to determine whether or not to enable it as a wake > source. Some Chromebooks rely solely on the ec_sync pin to wake the AP > but do not specify the interrupt as wake capable in the ACPI _CRS. For > LPC/ACPI based systems a DMI quirk is introduced listing boards whose > firmware should not be trusted to provide correct wake capable values. > For device tree base systems, it is not an issue as the relevant device > tree entries have been updated and DTS is built from source for each > ChromeOS update. ... > acpi_status status; > struct cros_ec_device *ec_dev; > + struct resource irqres; struct resource irqres = {}; ? > u8 buf[2] = {}; > int irq, ret; ... > - irq = platform_get_irq_optional(pdev, 0); > - if (irq > 0) > + irq = platform_get_irq_resource_optional(pdev, 0, &irqres); > + if (irq > 0) { > ec_dev->irq = irq; > - else if (irq != -ENXIO) { > + if (should_force_irq_wake_capable()) > + ec_dev->irq_wake = true; > + else > + ec_dev->irq_wake = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE; > + } else if (irq != -ENXIO) { > dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq); > return irq; > } Still I do not like ambiguity behind irq > 0 vs. irqres.start. For this, and if needed others, return plain error. Seems I gave the tag for the previous patch, consider that tag conditional (it seems I missed this). ... > u16 proto_version; > void *priv; > int irq; > + bool irq_wake; > u8 *din; > u8 *dout; > int din_size; > int dout_size; > - bool wake_enabled; > bool suspended; > int (*cmd_xfer)(struct cros_ec_device *ec, > struct cros_ec_command *msg); Have you run pahole on this (before and after)? -- With Best Regards, Andy Shevchenko