From patchwork Tue Jan 2 21:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 18651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4684414dyb; Tue, 2 Jan 2024 13:09:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZew2XZ6KZlcpDA/+VWUDSm+yBX+LzDbGZKksP3+AylpWTpUXQXSsRZqxxfyRFK2JE0CLI X-Received: by 2002:a17:90a:9109:b0:28c:2871:95fd with SMTP id k9-20020a17090a910900b0028c287195fdmr7129796pjo.14.1704229774701; Tue, 02 Jan 2024 13:09:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704229774; cv=none; d=google.com; s=arc-20160816; b=sw/KJ1iY21DZcCuAoB/bi3gVWjmL9bnxuEtsmxZp8pLaeFvWYevMjFWzETUsBhHvJR amSWW67uVlIaxSSpSrT6/z8v+LM9OeK8ISUy+ZOVJvM5qc6hy3YasiuwRBCMVUmmwYMK 6d4/FsbbDF8hQ9D+X+gVZQLzObNPDrx3s4QS2QLv7B0+8yGQjDS+QgoIEHC8lzVfJMCs R2wMkZzYX3hOjPqOiqATf13eQuUz1iJA67FuOLPmX0HEniymTsCwZiTvEkv+Z/+wA39z FLzYSaM4PI9tWTVEyZqc33MTpoi0OSGSNX4xdRILSRgBIMKJ3T8K/DIH48WvfB8jdheX eZ9g== 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=C7mFJdJJR38MVoewAU3PshqnCmTUbmo4+vjrut4nXkA=; fh=+/nJgCG7oNlMXhP7KN9yQndxFBIXqdkqN5cdTJYSpI0=; b=vDbwQrRMiPOTHdFHvDZ0QEgJZWAJChCI8lqed0OqfICCg0jnyA3HJkMQIZmOND0/tX 5QnGwFmJT4w4skJ5z/l+3i+34L/9t0V0BiTJ4nkD2c3T5+qoDyU++1KQ1hlIf+TZPssm N5cw7UtRCtByYovoy5BhCxmtJhew3RlBAvZH60vi3YQ+0B3dhdmrgz2iJ04vvA10gps/ hS0kSRfNKaNCmoW39tB9a7UznuDm+6GaixOq3Lvb0PRq/m5kjb7BxmZyf8H5Ms3ztuoL eVLVoA2wYeF8JUiIgypxlV5ZvauVZoftA+mAkVoQKJM/qHKBG6gSWYaUqCxVONthlt05 Vufw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="FXsKUh/S"; spf=pass (google.com: domain of linux-kernel+bounces-14824-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14824-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q9-20020a17090ad38900b0028c2b9080b8si67229pju.118.2024.01.02.13.09.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:09:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14824-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="FXsKUh/S"; spf=pass (google.com: domain of linux-kernel+bounces-14824-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14824-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7601A284132 for ; Tue, 2 Jan 2024 21:09:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21A98171C4; Tue, 2 Jan 2024 21:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FXsKUh/S" 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 83BAD16438 for ; Tue, 2 Jan 2024 21:08:44 +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-7b7a9f90f34so534006039f.2 for ; Tue, 02 Jan 2024 13:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704229723; x=1704834523; 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=C7mFJdJJR38MVoewAU3PshqnCmTUbmo4+vjrut4nXkA=; b=FXsKUh/St9ROpCfBxBctElZ0B8NOZqVdhhpKFefJYaizRpZLwRtSk/hSpzpGNwADQf EurbVWdvdquu7SIHdT0PKV6Ygvoc1xI3N7gLMSmXNZ1OR27sna3yytDi+Eij/TtOjzVj Z7pFyGExz2c+fIdTeavtr7qLTDYYLxrN/lUzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704229723; x=1704834523; 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=C7mFJdJJR38MVoewAU3PshqnCmTUbmo4+vjrut4nXkA=; b=CkkppPlqa60Rzt5+gOyB6HBao64jgSP7XDPledA3hG5ucDGEq6pI/8eOoSCth+Bn03 3zgqqr5NvhvGUZvgzKc8o19NiPJ/IWQpldappm8ZSWBMCYg7UunKRYofJrmZKLWvtBtK eORI2T6KwhDAf6U+1W/6TaJH0d4REPxTK9Upp6ruhOvpNBteiW1fZhGOgy5Bw3cRA1ds vRsiA3B8epWaNU74Yu4aBuv3oZjjKmwJsnUHBcND4YbmQJISdTVxHU+IsB5EahC6/uV+ biRvvj4YM3HLRyKNi/d0/ObIQQjIwB9X0X96b6vxuoHZ/xPTRMSVqHerOWvUOU4exLzo wumQ== X-Gm-Message-State: AOJu0YzTTu+B7p2Y2mPV66ilIr3eYpnthw+/CRcyNwZa5cqSh+HwMKWd JAuX2hT15giR1W0EYuriDsDxY6Cmdxb/5BCr4hNZinyxVfnd X-Received: by 2002:a05:6602:e03:b0:7ba:a232:30fe with SMTP id gp3-20020a0566020e0300b007baa23230femr13087461iob.20.1704229723563; Tue, 02 Jan 2024 13:08:43 -0800 (PST) Received: from markhas1.lan (71-218-50-136.hlrn.qwest.net. [71.218.50.136]) by smtp.gmail.com with ESMTPSA id bo18-20020a056638439200b0046993034c91sm6956978jab.77.2024.01.02.13.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:08:43 -0800 (PST) From: Mark Hasemeyer To: LKML Cc: Sudeep Holla , AngeloGioacchino Del Regno , Rob Herring , Andy Shevchenko , Krzysztof Kozlowski , Konrad Dybcio , 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 , Frank Rowand , Greg Kroah-Hartman , Guenter Roeck , Heikki Krogerus , Heiko Stuebner , Jonathan Hunter , Krzysztof Kozlowski , Len Brown , Linus Walleij , Mark Brown , Matthias Brugger , Mika Westerberg , Nick Hawkins , Paul Barker , Prashant Malani , "Rafael J. Wysocki" , Rob Barnes , Rob Herring , Romain Perier , Sakari Ailus , Stephen Boyd , Takashi Iwai , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Wei Xu , 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 v4 00/24] Improve IRQ wake capability reporting and update the cros_ec driver to use it Date: Tue, 2 Jan 2024 14:07:24 -0700 Message-ID: <20240102210820.2604667-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787014439917246366 X-GMAIL-MSGID: 1787014439917246366 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 v4: -Rebase on linux-next -See each patch for patch specific changes 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 | 90 ++++++++++++------- drivers/base/property.c | 40 ++++++--- drivers/gpio/gpiolib-acpi.c | 28 ++++-- drivers/i2c/i2c-core-acpi.c | 43 ++++----- 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 | 40 +++++++-- drivers/platform/chrome/cros_ec_spi.c | 15 ++-- drivers/platform/chrome/cros_ec_uart.c | 14 ++- include/linux/acpi.h | 25 +++--- 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, 350 insertions(+), 172 deletions(-)