From patchwork Tue Dec 26 19:21:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 13504972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24FFBC46CD3 for ; Tue, 26 Dec 2023 19:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Lt+oF9+8168Y0M7tFBSsZeMSS/1+n0CsRmbYW1p5CZ4=; b=KwtOwMc0zqj9Ks WC5CpyIaWhh6u9XH5dTfumaL1tHyXmnvcER4UfYCGaWWNo7tr9wqGe4hxmuph9dSeFKKy7MigQvBy MadGw2jPdBAb5MZr/lNlsFS5pB3MTATzN6RWEwPiaWbi2m+MQqbeBomNdCUnd9SBmRGLfWxLJOCJm bdTrLz76t7gBCFO94va0+YurrRS+IwXTM7OniIraV/Zo5hKz2UdfxTp1ZXq3mo7rQhYNoL8mlK5gc nGZ19zO9XYdwcxxf6fPbUL2fee1dAbdAV7PYgdrU1k5WjWzjhya42z4ggB4xeJ/FYkreU3KzeLHfW cEKjAYAQggX88fGG3zsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rID09-00DPh4-21; Tue, 26 Dec 2023 19:22:05 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rID06-00DPfo-1B for linux-rockchip@lists.infradead.org; Tue, 26 Dec 2023 19:22:04 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7bb0ab8e79fso5321539f.1 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=lists.infradead.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=VIlUHQjql5utp92MJccSvUuBqTXLVnirmVcw56rTPxaeBTEpleDbIaplGERXFFSIgA NFoWu9Vgb96WlxQPQUJKneYRcwKU+ciTNb8Y6vfLh95AFh6aZ/oksRlh7u5e1+6Wyu2R ymfcHdBdYlifjnNRrca14jnmjdfjO19SqUEYo= 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=o0inEvjd1VphMqT3j23ByUCWKcKUX6GFpugOKYB/dxE5Vh6ZZeffBlftN/8DrNDYih qwsgC23wnkzDqRM9YoWgaeSS0j68/KXx3d7zOqNQ/jzLuD+NaYclUnIoA/yBG2WXgo5b H6ZrtbLbOuBq4CwBVq3CIJUnMclXHn99z8HSaTJ2b7HQidSY/RWxVb1MdgvMAam9ItLU FSkZKHWiiVwxGuWO0HXXVJ9ffgXEuxKdXNIr9x3qBrqCJMEuHZYiAMsVkRr35rhd19qX ctq00OGQ65XRr1Mz8ZM0Ya4RkN54P3ILczz+tulSp8R3Y+tC5ek1hVK7j80+138lmqsG a3Og== X-Gm-Message-State: AOJu0YzzR3PrJLw4uVUpzy7As0q0jQqG/YRXaZ/LGUuLsjM47Ou19euz bOS6MIp3dFqBB8DRwY3vrW79HBg+N1QoKbZFqHR4zGMdYN449Ok= X-Google-Smtp-Source: AGHT+IG4C2xoYudxRt+wWDCBtgSKAQTayFQAShLTQwb4dd83mgwRgc9KhsMLLL8fkL4EZvoyrMNzzQ== 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_Kleine-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 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231226_112202_714118_949FEE8F X-CRM114-Status: GOOD ( 18.53 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 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(-)