Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2981100rdb; Tue, 26 Dec 2023 11:22:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoGayEpRxGB2U5+Dvgb04qKGYkkEUq1dqe4ZLh2Xk2yvSPk44aeISqXtU0vlzOBfdVudqX X-Received: by 2002:ac8:5956:0:b0:427:a692:2a91 with SMTP id 22-20020ac85956000000b00427a6922a91mr12203963qtz.79.1703618534094; Tue, 26 Dec 2023 11:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703618534; cv=none; d=google.com; s=arc-20160816; b=IK22gX7VLzsGgJbzIm3NZF7ENj9/Bp+FLCHJW2Bl8fl0wKivQwxBs/cd7k0u5joc6B nQIADRiN4g7Te4CEMQ36G+vQTX8NTtrpjnuEFObne7M/t7EHhBRdmXparYTJx85yzUEb DhQDNgx8QUg+GsilNJRFH1UU8oNaIvjq0d2qW3kekld8Q64Mq5Aac5LqKYzXWghsSX5R REV0+ty0PqooSANw0ZcXlxl13h2fxTbMBOfR4tiXnYqWwfpYp0qpCzlCcR1P24+nfOhp jBXviuJgQpDSAYeM63OMUuew2tWeMYmSWOm7TFM451jxsdQ1RaPoBG4exP5WbWSPuAUQ psLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=RTMdzaXRW7qZuQbwoV3Wl84rTkfhX+SS2G9EZyVMNtM=; fh=P5WXcq4XkMsu0kl8lgikQGTSa6+lQJ0oqDKuezNzB0A=; b=FaaDnpF1lYP2AQMScbqIDIruj2RQaSIg9/nH/j8YWRlC0HPAsx277YcEVbFBkbMzO5 JJtYlNPwSRNKm9q7MplnCFjtXUkp7neSdutU7TEAqmFL3O8NhdHGj2mqFO3e2sdzD2Lx 7XdyfcJPtEEKLpvPws9VJCKcTK/VJOlnUY3fFx/xUgxaUknrH79L8E0vxnp0HpdndPtl zupg0OH4kmSZD4B6N7YpgXdafBIQd6yCIUom74JRh/rNN+9UaM3BTTYSwyWUVW/VNc1E jrB1hxbtGKG3Xpaq/FXjEE3kQVD3FWn5mmNbkau7KoVuCK8SyLK6gQpdoZ7BTnlX3+2I +iAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bhB8gn2b; spf=pass (google.com: domain of linux-kernel+bounces-11628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11628-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 g6-20020ac85806000000b004278ae7591csi13086627qtg.592.2023.12.26.11.22.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 11:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11628-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=bhB8gn2b; spf=pass (google.com: domain of linux-kernel+bounces-11628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11628-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 ABE191C21267 for ; Tue, 26 Dec 2023 19:22:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9658223C6; Tue, 26 Dec 2023 19:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bhB8gn2b" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 6A93C1865 for ; Tue, 26 Dec 2023 19:21:59 +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-io1-f47.google.com with SMTP id ca18e2360f4ac-7b7fe0ae57bso282926239f.0 for ; Tue, 26 Dec 2023 11:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1703618518; x=1704223318; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RTMdzaXRW7qZuQbwoV3Wl84rTkfhX+SS2G9EZyVMNtM=; b=bhB8gn2bTOUKiZC7bfODn2IWKIXN88hgEghVvxPNszXTfyl92IViWkh1IMM6qwLBdu qzN1ADOBPGa9SDdjyZDlPcby60E7YYXXuTJIHzptmNgtwV+KS2O5jzigkiVZFce0Dxn2 3RxCnlPGEbkseBWIF9g+j/7ulMMGEEAGizR1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703618518; x=1704223318; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RTMdzaXRW7qZuQbwoV3Wl84rTkfhX+SS2G9EZyVMNtM=; b=SUZ7xqk15RJE0yw3AN5wvGOUKZKFWC48ZlwSt+1ky3vVaG0bNQV6T/USkij4KnrT++ ftDwAREvdI5s4aJhmElcDagDIn4BajQRo48didQerXb14avKMoERVBXfcmkRj/OJnrBv fN9EXAy+4QOKN2Y2RyydSzm7ylIrCMjPQsCk4hkndiDoHGzg2lr3fEnltwW5hpbblY4h YL59QLjOxhFQ5W71CYRP9xfzFzvOQxgq8n6IWSfkIGOdvxfJjX020K9JY+dzF8bevrzb Wj2bzUjRuwmfILxycC1URT0Wr+jV8W4s9vKVq98EMwHc1emjTXccD7s8/r4LcN+A3pvl saHw== X-Gm-Message-State: AOJu0YwAL7rDNZtd6jc1wkh4DWGaDEScn4gSU1BsnVwsDILVJUGY+27b jc6NJ0Tpv3s2RQ6VTZdAPr7V64qbD8amcnb7SAPTeG2/Lsyu634= X-Received: by 2002:a6b:d90a:0:b0:7b7:b27f:351c with SMTP id r10-20020a6bd90a000000b007b7b27f351cmr12182959ioc.14.1703618518475; Tue, 26 Dec 2023 11:21:58 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id gw3-20020a0566381ee300b0046b692e719esm3207609jab.150.2023.12.26.11.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 11:21:58 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: AngeloGioacchino Del Regno , Krzysztof Kozlowski , Rob Herring , Konrad Dybcio , Sudeep Holla , Andy Shevchenko , Raul Rangel , Tzung-Bi Shih , Mark Hasemeyer , AKASHI Takahiro , Alexandre TORGUE , Alim Akhtar , Andre Przywara , Andrew Morton , Andy Shevchenko , Baoquan He , Bartosz Golaszewski , Benson Leung , Bhanu Prakash Maiya , Bjorn Andersson , Chen-Yu Tsai , Conor Dooley , Daniel Scally , David Gow , Enric Balletbo i Serra , Frank Rowand , Greg Kroah-Hartman , Guenter Roeck , Heikki Krogerus , Heiko Stuebner , Jonathan Hunter , Krzysztof Kozlowski , Lee Jones , Len Brown , Linus Walleij , Manivannan Sadhasivam , Mark Brown , Matthias Brugger , Michal Simek , Mika Westerberg , Nick Hawkins , Prashant Malani , "Rafael J. Wysocki" , Rob Barnes , Rob Herring , Sakari Ailus , Stephen Boyd , Takashi Iwai , Thierry Reding , Tony Lindgren , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Wolfram Sang , chrome-platform@lists.linux.dev, cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 00/24] Improve IRQ wake capability reporting and update the cros_ec driver to use it Date: Tue, 26 Dec 2023 12:21:04 -0700 Message-ID: <20231226192149.1830592-1-markhas@chromium.org> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently the cros_ec driver assumes that its associated interrupt is wake capable. This is an incorrect assumption as some Chromebooks use a separate wake pin, while others overload the interrupt for wake and IO. This patch train updates the driver to query the underlying ACPI/DT data to determine whether or not the IRQ should be enabled for wake. Both the device tree and ACPI systems have methods for reporting IRQ wake capability. In device tree based systems, a node can advertise itself as a 'wakeup-source'. In ACPI based systems, GpioInt and Interrupt resource descriptors can use the 'SharedAndWake' or 'ExclusiveAndWake' share types. Some logic is added to the platform, ACPI, and DT subsystems to more easily pipe wakeirq information up to the driver. Changes in v3: -Rebase on linux-next -See each patch for patch specific changes Changes in v2: -Rebase on linux-next -Add cover letter -See each patch for patch specific changes Mark Hasemeyer (24): resource: Add DEFINE_RES_*_NAMED_FLAGS macro gpiolib: acpi: Modify acpi_dev_irq_wake_get_by() to use resource i2c: acpi: Modify i2c_acpi_get_irq() to use resource dt-bindings: power: Clarify wording for wakeup-source property ARM: dts: tegra: Enable cros-ec-spi as wake source ARM: dts: rockchip: rk3288: Enable cros-ec-spi as wake source ARM: dts: samsung: exynos5420: Enable cros-ec-spi as wake source ARM: dts: samsung: exynos5800: Enable cros-ec-spi as wake source arm64: dts: mediatek: mt8173: Enable cros-ec-spi as wake source arm64: dts: mediatek: mt8183: Enable cros-ec-spi as wake source arm64: dts: mediatek: mt8192: Enable cros-ec-spi as wake source arm64: dts: mediatek: mt8195: Enable cros-ec-spi as wake source arm64: dts: tegra: Enable cros-ec-spi as wake source arm64: dts: qcom: sc7180: Enable cros-ec-spi as wake source arm64: dts: qcom: sc7280: Enable cros-ec-spi as wake source arm64: dts: qcom: sdm845: Enable cros-ec-spi as wake source arm64: dts: rockchip: rk3399: Enable cros-ec-spi as wake source of: irq: add wake capable bit to of_irq_resource() of: irq: Add default implementation for of_irq_to_resource() of: irq: Remove extern from function declarations device property: Modify fwnode irq_get() to use resource device property: Update functions to use EXPORT_SYMBOL_GPL platform: Modify platform_get_irq_optional() to use resource platform/chrome: cros_ec: Use PM subsystem to manage wakeirq .../bindings/power/wakeup-source.txt | 18 +++-- arch/arm/boot/dts/nvidia/tegra124-nyan.dtsi | 1 + arch/arm/boot/dts/nvidia/tegra124-venice2.dts | 1 + .../rockchip/rk3288-veyron-chromebook.dtsi | 1 + .../boot/dts/samsung/exynos5420-peach-pit.dts | 1 + .../boot/dts/samsung/exynos5800-peach-pi.dts | 1 + arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 1 + .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + .../boot/dts/mediatek/mt8192-asurada.dtsi | 1 + .../boot/dts/mediatek/mt8195-cherry.dtsi | 1 + .../arm64/boot/dts/nvidia/tegra132-norrin.dts | 1 + arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 1 + .../arm64/boot/dts/qcom/sc7280-herobrine.dtsi | 1 + .../arm64/boot/dts/qcom/sc7280-idp-ec-h1.dtsi | 1 + arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 1 + arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 1 + drivers/acpi/property.c | 11 ++- drivers/base/platform.c | 70 +++++++++++++------ drivers/base/property.c | 32 +++++++-- drivers/gpio/gpiolib-acpi.c | 27 ++++--- drivers/i2c/i2c-core-acpi.c | 37 +++++----- drivers/i2c/i2c-core-base.c | 6 +- drivers/i2c/i2c-core.h | 4 +- drivers/of/irq.c | 39 +++++++++-- drivers/of/property.c | 8 +-- drivers/platform/chrome/cros_ec.c | 48 ++++++++++--- drivers/platform/chrome/cros_ec_lpc.c | 32 ++++++++- drivers/platform/chrome/cros_ec_spi.c | 15 ++-- drivers/platform/chrome/cros_ec_uart.c | 22 ++++-- include/linux/acpi.h | 23 +++--- include/linux/fwnode.h | 8 ++- include/linux/ioport.h | 20 ++++-- include/linux/of_irq.h | 41 ++++++----- include/linux/platform_data/cros_ec_proto.h | 4 +- include/linux/platform_device.h | 3 + include/linux/property.h | 2 + 36 files changed, 336 insertions(+), 149 deletions(-) -- 2.43.0.472.g3155946c3a-goog