Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp649762rwe; Wed, 31 Aug 2022 08:41:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR72QYNjyVgdRxXZXBmeBm3TmtrARMOVk2hR80oaae8rJh2z71NqTICAEEV2A91EIPEHVya7 X-Received: by 2002:a17:907:2c4f:b0:741:5b68:e2d9 with SMTP id hf15-20020a1709072c4f00b007415b68e2d9mr12852383ejc.314.1661960491162; Wed, 31 Aug 2022 08:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661960491; cv=none; d=google.com; s=arc-20160816; b=Q9hRxB5tMOJmcveTpqSPy/kwLodxomQwuA68r6cyemK2Ieo8XbH6xh9k63Dug22T3C sLBFi1/u81Z97wBun1d3BcTROTlzPoUO4ZXPo61cGv8duz8Pq58OkjRJCIUB0AtIa+g/ p3l/eiieTQAS7+RYZtrTcgysfsD/t8cMwFnRPMoCBdI5s7sQ/+SB6UxPknZcqng3bQJK FmsfUkywt7IMdo5IgQ5rgNCRrouSHCh1jQ1QQ4BvBFMp+C5hNCNt47GdLEJPmLa1iMjN s1skH4Hi8aCCc2+fbdunfDzwK3TvStBNIts5dqJo+snOBoL1PuDDVXx+RxiuJXWyxK6W fN5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4Ujg0LqL4Zf7QSMNntgyL7zhBHA2KE0VEhGl9dm9Aa8=; b=BLcy01kSQBwG/H2l6NSmLcCWmTiHfk6qqFXc7x+lUztGxJoxWoe/LGAeRNDsztCbq9 +sVs1STbgs13RJHbva8pbRIkUmAhh8+bVbuF4wYzWHSYpxi+yg0WeWYex+/CBvmPSjc3 IBMPCoYL59MLzTYAMUKOzWf9uwdTJCAL5wQkNt+rO3+fTi5v1EEfFSw76DNeYeMZDhLa lwm2vfC6EoY5S95MtYupKtVvMYX+FSGykEhw4tgyEOP7YQVxCsvsTKK6J9VIb3/xobRc hFPTsMRssGeJC2IWx2mREOzsRwnOf3vb4ub02zF03VX6yPJdx4MR69RShqZqDLOhqGDU 7S9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e8G3+XfO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a1709063c4300b0073d6d7ecec3si9671621ejg.195.2022.08.31.08.41.05; Wed, 31 Aug 2022 08:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e8G3+XfO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231717AbiHaPTQ (ORCPT + 99 others); Wed, 31 Aug 2022 11:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231400AbiHaPTJ (ORCPT ); Wed, 31 Aug 2022 11:19:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB65D87DA for ; Wed, 31 Aug 2022 08:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661959144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Ujg0LqL4Zf7QSMNntgyL7zhBHA2KE0VEhGl9dm9Aa8=; b=e8G3+XfObMLlbixQE9WG7buL5K5FL+tdzU029ovwh0vSDsh4IBoOQBNhdg5g0u2lwLg88a kyoI6Oj4WlxK5XxdlxrOA3QY5PNUvmNxM8+4+ZpdVlzGCfXywAf3GijAk3yHAH22HT1q4s lHTh0a2BmzpIk3y1XjmdDmG5orHx6kA= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-458-O48HEPqAPM2iwOn7Ol4NFQ-1; Wed, 31 Aug 2022 11:19:02 -0400 X-MC-Unique: O48HEPqAPM2iwOn7Ol4NFQ-1 Received: by mail-ej1-f72.google.com with SMTP id qb39-20020a1709077ea700b0073ddc845586so5429277ejc.2 for ; Wed, 31 Aug 2022 08:19:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=4Ujg0LqL4Zf7QSMNntgyL7zhBHA2KE0VEhGl9dm9Aa8=; b=65sYoju1BXo47rB6N6NwJwK2JI41/+EG0goGm04WwN+S4KKk2MHuPV0vRf9WeZEm7G XvoS3Ndt30g4hSnzzqUZxL1GqtLk48e/vUFlNFAmkmX89hXxfVxxV2gWcWmv7fGw4HTL RbM8cqaZaA1Q8evvzSsq+qJPeXqXOl0f8aTUbTNEN/s5K4UGf/WcCQjNbTYV+TMVhDu8 /20+HA0cbtdWNevryKCZxnQ7+x3HXlT2SAt/dSAzMRtn1JOTsV7gVLIatHB9407r3cQT XqsJ7iVcbnrdNJ6faqi6XhzM45GNLHWvLqGqtoe7HjMrRSKGX2UWfNMWIjX2slfo/7s/ VaKg== X-Gm-Message-State: ACgBeo1DiDUCKY0qzCBZgzQ1/UK1ChYfla4zwF+Kt1GMsRAcLlDBsNhe 0wGUQFXTaTHhhQmoxMEeZKBi2+Pud2NkGWqsGT7LBpba9S49ey+3355u9VvBt0FC1ROvBIfsxo3 Yx8q9TBrb2zIvJDJlzT2gisUK X-Received: by 2002:a05:6402:1013:b0:448:dc53:752e with SMTP id c19-20020a056402101300b00448dc53752emr6030299edu.30.1661959141259; Wed, 31 Aug 2022 08:19:01 -0700 (PDT) X-Received: by 2002:a05:6402:1013:b0:448:dc53:752e with SMTP id c19-20020a056402101300b00448dc53752emr6030275edu.30.1661959140988; Wed, 31 Aug 2022 08:19:00 -0700 (PDT) Received: from ?IPV6:2001:1c00:c1e:bf00:d69d:5353:dba5:ee81? (2001-1c00-0c1e-bf00-d69d-5353-dba5-ee81.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:d69d:5353:dba5:ee81]) by smtp.gmail.com with ESMTPSA id u16-20020a170906125000b0073d6093ac93sm7359153eja.16.2022.08.31.08.19.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Aug 2022 08:19:00 -0700 (PDT) Message-ID: <8aa159a1-f7e0-e54a-6a03-b76c563c62a6@redhat.com> Date: Wed, 31 Aug 2022 17:18:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH 0/8] acpi: i2c: Use SharedAndWake and ExclusiveAndWake to enable wake irq Content-Language: en-US To: Raul Rangel , Andy Shevchenko Cc: Linux ACPI , linux-input , "Limonciello, Mario" , Tim Van Patten , "Rafael J. Wysocki" , Alistair Francis , Angela Czubak , Bartosz Golaszewski , Bartosz Szczepanek , Benjamin Tissoires , Dmitry Torokhov , Jiri Kosina , Len Brown , Linus Walleij , Matthias Kaehlcke , Mika Westerberg , Rob Herring , Wolfram Sang , Yang Li , "jingle.wu" , "open list:GPIO SUBSYSTEM" , "open list:I2C SUBSYSTEM HOST DRIVERS" , linux-kernel References: <20220830231541.1135813-1-rrangel@chromium.org> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 8/31/22 16:37, Raul Rangel wrote: > Interesting... The patch series is here: > https://patchwork.kernel.org/project/linux-input/cover/20220830231541.1135813-1-rrangel@chromium.org/ > > I'll look into why you only got added to 2 of the emails. FWIW I also received the full series without problems. I'll try to reply to this soon-ish, but I have a bit of a patch backlog to process and I'm trying to process the backlog in FIFO order and this is one of the last series in the backlog ... Regards, Hans > > On Wed, Aug 31, 2022 at 5:52 AM Andy Shevchenko > wrote: >> >> On Tue, Aug 30, 2022 at 05:15:33PM -0600, Raul E Rangel wrote: >>> Today, i2c drivers are making the assumption that their IRQs can also >>> be used as wake IRQs. This isn't always the case and it can lead to >>> spurious wakes. This has recently started to affect AMD Chromebooks. >>> With the introduction of >>> d62bd5ce12d7 ("pinctrl: amd: Implement irq_set_wake"), the AMD GPIO >>> controller gained the capability to set the wake bit on each GPIO. The >>> ACPI specification defines two ways to inform the system if a device is >>> wake capable: >>> 1) The _PRW object defines the GPE that can be used to wake the system. >>> 2) Setting ExclusiveAndWake or SharedAndWake in the _CRS GpioInt. >>> >>> Currently only the first method is supported. The i2c drivers don't have >>> any indication that the IRQ is wake capable, so they guess. This causes >>> spurious interrupts, for example: >>> * We have an ACPI HID device that has `_PR0` and `_PR3`. It doesn't have >>> `_PRW` or `ExclusiveAndWake` so that means the device can't wake the >>> system. >>> * The IRQ line is active level low for this device and is pulled up by >>> the power resource defined in `_PR0`/`_PR3`. >>> * The i2c driver will (incorrectly) arm the GPIO for wake by calling >>> `enable_irq_wake` as part of its suspend hook. >>> * ACPI will power down the device since it doesn't have a wake GPE >>> associated with it. >>> * When the device is powered down, the IRQ line will drop, and it will >>> trigger a wake event. >>> >>> See the following debug log: >>> [ 42.335804] PM: Suspending system (s2idle) >>> [ 42.340186] amd_gpio AMD0030:00: RX: Setting wake for pin 89 to enable >>> [ 42.467736] power-0416 __acpi_power_off : Power resource [PR00] turned off >>> [ 42.467739] device_pm-0280 device_set_power : Device [H05D] transitioned to D3cold >>> [ 42.475210] PM: pm_system_irq_wakeup: 11 triggered pinctrl_amd >>> [ 42.535293] PM: Wakeup unrelated to ACPI SCI >>> [ 42.535294] PM: resume from suspend-to-idle >>> >>> In order to fix this, we need to take into account the wake capable bit >>> defined on the GpioInt. This is accomplished by: >>> * Migrating some of the i2c drivers over to using the PM subsystem to >>> manage the wake IRQ. max8925-i2c, elants_i2c, and raydium_i2c_ts still >>> need to be migrated, I can do that depending on the feedback to this >>> patch series. >>> * Expose the wake_capable bit from the ACPI GpioInt resource to the >>> i2c core. >>> * Use the wake_capable bit in the i2c core to call >>> `dev_pm_set_wake_irq`. This reuses the existing device tree flow. >>> * Make the i2c drivers stop calling `dev_pm_set_wake_irq` since it's now >>> handled by the i2c core. >>> * Make the ACPI device PM system aware of the wake_irq. This is >>> necessary so the device doesn't incorrectly get powered down when a >>> wake_irq is enabled. >>> >>> I've tested this code with various combinations of having _PRW, >>> ExclusiveAndWake and power resources all defined or not defined, but it >>> would be great if others could test this out on their hardware. >> >> I have got only cover letter and a single patch (#3). What's going on? >> >> Note: I'm also reviewer of I涎 DesignWare driver, you really have to >> fix your tools / submission process and try again. No review for this >> series. >> >> -- >> With Best Regards, >> Andy Shevchenko >> >> >