Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1082755rdb; Fri, 22 Dec 2023 14:20:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaNdeynIpBjK8SrjxbwS/7IVX7WH68ls7u3QUfXRnurKhRNjQ+r7bKXa8VAuocnKQzA4T9 X-Received: by 2002:a05:6214:2588:b0:67f:5963:d401 with SMTP id fq8-20020a056214258800b0067f5963d401mr2360350qvb.13.1703283615660; Fri, 22 Dec 2023 14:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703283615; cv=none; d=google.com; s=arc-20160816; b=aItRoTN+ptHEdDY/PeXOGm2AhY4PvkW93XoMT1NlnMFjyhjfiF2eCNRyKi6hkM+TeI cV882uuZZKLWv/23CNdoh5i+TkBz0cXeIB2kh08NOrnGf7PmfjwpEBdZXRnYLi71jCBf Q++qk+fWM2qNU+udxbgOXx6zBp4NIxu7vegD5xvuOe8bls5cuFdemzNWRPeBCB4+ZNEh ZVZpG7vIvYmdSlSL/vz/gFxpAFWHaYbD5VEqX700BpG2TMNLCxl+6Ee4UHLbmC7kvF37 K8/JcOddJV+eKaSUzVxlzHCDHP7Iux6M+HYgOpYMDDlvqQLcFMVzmwbRWutO0EtS96ok etUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=zh4GNA4Y05yXEeCWYCD5IWiPdQ5iIa0JnfPD6CHsXY4=; fh=cBpz96/kgZpFROsMUy2KbgkqwyBIGnGwnmfyin++2TM=; b=len1k8eqtvNj2I5QK7fZc9IH4qi+D8otzHVfSo0Iy1drYFjiiOw4nrqY+FtPQryu/2 AaND9VQ4H3Vr6UIzh6uYL3E70gTCMrWrrizQE+w8wRglnmZjvxK5xku7gvnUR4TJhT75 09stTDIlmvB1JTLB8x68YIef3LqNS8Xsx3cgVCHJTD5We/Jq7Xbeo14cDMPtA+K22A0d XkVp0wtUfd/2dm9se+SmIvbXZXGAyZ9NDL0sSWv7LcC7l1VY/7bU2l7yGIgYswFMy8IK FM4carqAMjc1f7Zg8WOml2O975EBMfZJ2pDYMF+xP+LHuZQsnQc7DtjibN6JDTTp79m6 uMxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DbANNZZU; spf=pass (google.com: domain of linux-kernel+bounces-10076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10076-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b7-20020a0cb3c7000000b0067eaa22160bsi5306670qvf.530.2023.12.22.14.20.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 14:20:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DbANNZZU; spf=pass (google.com: domain of linux-kernel+bounces-10076-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10076-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6AE051C2179C for ; Fri, 22 Dec 2023 22:20:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 786B32F535; Fri, 22 Dec 2023 22:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DbANNZZU" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EA122EB0E for ; Fri, 22 Dec 2023 22:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3bb732e7d78so1643067b6e.0 for ; Fri, 22 Dec 2023 14:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1703283607; x=1703888407; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zh4GNA4Y05yXEeCWYCD5IWiPdQ5iIa0JnfPD6CHsXY4=; b=DbANNZZUmbahoLkT6DE4uZ/9Li0YIA08Gvq0G3RaWURNIcOQhNdOXxv7pftmDt8H5I QkPdOHmQBjG8Fro4i47JacAb/ztozoXt+nFMc1OvUXQDrMJJb23AXLbO1eXp8Kn0cCmh 4BpfmwQhcsbPSHR0CHVBs723QdTk1htJeffzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703283607; x=1703888407; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zh4GNA4Y05yXEeCWYCD5IWiPdQ5iIa0JnfPD6CHsXY4=; b=sjgUOAhBtupBvQ13UgWrez/8RHuZxJ/gSeeLLMxdVg4TS9Eak4kYHZdGMxBrotjeWI CLyPb65tD96HawHks1NilaOaqkrYXNzbLaRHmDgClQ3xwgEVXXY1mIzFhhwM6vOed0LS 1AKKRm5NgbE+J1t3LExU9UDoSE2B403zcFOvec/7Z6C1SUlZcXnNJJv94xaPpu0l860W 0fNuIm8p1i5pJIc70cuds1xfJ2UFO+s160WleqIgoMn/RUTAxCsqHcay5XBctB6/SYa/ 95eyIila/u8gyP8N+UQU7+iotsUNdCxdG1PEzKPtigVatK0U8hbVPP1eQ+KwWyAqGesl +AZw== X-Gm-Message-State: AOJu0YxmOhVFUdy+aB90xcbCstV9Cy1JHsbihDNpiesOCaS6OafjoCoS jpV73t7kbTfLIoidC4S2pvMwRor89tFTD/JMP638kit44whr X-Received: by 2002:a05:6808:2014:b0:3b9:e20f:96e7 with SMTP id q20-20020a056808201400b003b9e20f96e7mr2217983oiw.28.1703283607328; Fri, 22 Dec 2023 14:20:07 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231220235459.2965548-1-markhas@chromium.org> <20231220165423.v2.22.Ieee574a0e94fbaae01fd6883ffe2ceeb98d7df28@changeid> In-Reply-To: From: Mark Hasemeyer Date: Fri, 22 Dec 2023 15:19:56 -0700 Message-ID: Subject: Re: [PATCH v2 22/22] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq To: Tzung-Bi Shih Cc: LKML , AngeloGioacchino Del Regno , Krzysztof Kozlowski , Raul Rangel , Konrad Dybcio , Andy Shevchenko , Rob Herring , Sudeep Holla , Benson Leung , Bhanu Prakash Maiya , Chen-Yu Tsai , Guenter Roeck , Lee Jones , Prashant Malani , Rob Barnes , Stephen Boyd , chrome-platform@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 21, 2023 at 1:58=E2=80=AFAM Tzung-Bi Shih = wrote: > > On Wed, Dec 20, 2023 at 04:54:36PM -0700, Mark Hasemeyer wrote: > > The IRQ wake logic was added on an interface basis (lpc, spi, uart) as > > opposed to adding it to cros_ec.c because the i2c subsystem already > > enables the wakirq (if applicable) on our behalf. > > The setting flow are all the same. I think helper functions in cros_ec.c= help > to deduplicate the code. I'll see what I can do. > > +MODULE_DEVICE_TABLE(dmi, untrusted_fw_irq_wake_capable); > > Does it really need `MODULE_DEVICE_TABLE`? Nope. Will drop. > > ret =3D cros_ec_register(ec_dev); > > if (ret) { > > - dev_err(dev, "couldn't register ec_dev (%d)\n", ret); > > + dev_err_probe(dev, ret, "couldn't register ec_dev (%d)\n"= , ret); > > The change is irrelevant to the series. I'll drop the use of dev_err_probe() to stay consistent with current conventions. Perhaps it can be added in a follow-up patch. > > @@ -470,6 +512,8 @@ static void cros_ec_lpc_remove(struct platform_devi= ce *pdev) > > acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY, > > cros_ec_lpc_acpi_notify); > > > > + dev_pm_clear_wake_irq(dev); > > + device_init_wakeup(dev, false); > > Is it safe to call them anyway regardless of `irq_wake` in cros_ec_lpc_pr= obe()? According to bench tests, it's not a problem. That said, I am refactoring the code to move the logic into cros_ec.c and will conditionally call the cleanup functions. > > + if (!np) > > + return; > > + > > The change is an improvement (or rather say it could change behavior). B= ut > strictly speaking, the change is irrelevant to the series. Will drop. > > > @@ -702,6 +710,11 @@ static void cros_ec_spi_dt_probe(struct cros_ec_sp= i *ec_spi, struct device *dev) > > ret =3D of_property_read_u32(np, "google,cros-ec-spi-msg-delay", = &val); > > if (!ret) > > ec_spi->end_of_msg_delay =3D val; > > + > > + if (ec_dev->irq > 0 && of_property_read_bool(np, "wakeup-source")= ) { > > Or just use `spi->irq`[2]. > > [2]: https://elixir.bootlin.com/linux/v6.6/source/drivers/platform/chrome= /cros_ec_spi.c#L762 > > They are the same, but does of_property_present() make more sense? Yes it does. I'll use it. > > @@ -768,6 +778,9 @@ static int cros_ec_spi_probe(struct spi_device *spi= ) > > sizeof(struct ec_response_get_protocol_info); > > ec_dev->dout_size =3D sizeof(struct ec_host_request); > > > > + /* Check for any DT properties */ > > + cros_ec_spi_dt_probe(ec_spi, spi); > > `spi` is possibly not needed. See comment above. Agreed.