Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5402460rwb; Wed, 7 Sep 2022 02:10:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR5LVVGnMu7dYLWxFatTxSGWgkjL7nAPt/oi/xNAAzXSeS2A3FCUJgdPNiAxG2TtrsMkcREl X-Received: by 2002:aa7:8b44:0:b0:537:a35d:3c11 with SMTP id i4-20020aa78b44000000b00537a35d3c11mr2802851pfd.76.1662541821336; Wed, 07 Sep 2022 02:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662541821; cv=none; d=google.com; s=arc-20160816; b=vCIQOg8N3n0kW8kUli+PtVAWzq0UbUPz+XUtEvlwYOo0fYQBhUTCrJkq7quZXFIrQ4 jdYoh+yXgfE7GlHT26Cts1ki4IKGnihjOi13GBvSiddUYsWf6xmrJPMBW2UwNUpSUd+O EHjGbF9SbHzagAondMGf/JonzFKZbnYYhPGz4o1CqmpkFLst7v3I/xaCy7Sl7mTUpX2F YC5//7GER0CfIY4cxFfImSMxrS4KSFbLZvP+JPwdYYX3I8De2KDXcj63M/bl14s50ZCk g6f6BVDipQoyMdCNEcUzRAgbffmGusN2V80iPBWxjtcU0X04NVxdxCYFRfAzQxajpes8 Tm9g== 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=G7JSisCjfZkuxA0PRfAg5vFvEX0TLAd+IEtq8gNC3kc=; b=AMqUmXzEI6EXo0ibMBcHw1VWnEdksouIeDy5iSFYA0rqAW9qPLj2sDlNgkCkewc0eb /Wd/c3sa2XwogAUZfOLNAwuy970t+zmJFrIRqD7zrmp5heIjD6JsXGwuGKfn91D05+3d 6DTWDBPlD9q8/j2ujb1bivNG9z14NwavicoGBmUzTtUGnknO4B0KFCfVlDffEqckUU8S PcEK6n1d+ET29e/jKnfDAHAR4PJ9rODuPRtkWdZtX94P+VBHb/dwLtB9LAuwrNWmlNyY 60gndcgBA9vLBXNTnmYQzER7WGVWMOwKl8djGAx+fmz0x93C9ZZLHlPj/vEKC6mOa3Ff oACg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BOTwzi7a; 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 e6-20020a17090301c600b00172dc6b5eecsi16454571plh.9.2022.09.07.02.10.09; Wed, 07 Sep 2022 02:10:21 -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=BOTwzi7a; 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 S230208AbiIGINB (ORCPT + 99 others); Wed, 7 Sep 2022 04:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbiIGIM5 (ORCPT ); Wed, 7 Sep 2022 04:12:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6A76AA3C2 for ; Wed, 7 Sep 2022 01:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662538374; 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=G7JSisCjfZkuxA0PRfAg5vFvEX0TLAd+IEtq8gNC3kc=; b=BOTwzi7adLGVltPRAGLRa+0s0Q1JziGZ6Kz1P91nasyNfN9+XWm4ZHdFlvRFp1VY6kl/9i DkrJ0KErQ4MHNz4Y4QUJ7KAVvpLmbdh74PfYcrlqcA/2h9v/dyDjVqbkLeM66MAgYbthU6 Gs8HGgYWwghk2OvCkwsQcDfVlgB0z7k= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-303-k5V5esPROnmpeJDJUYfIrQ-1; Wed, 07 Sep 2022 04:12:50 -0400 X-MC-Unique: k5V5esPROnmpeJDJUYfIrQ-1 Received: by mail-ed1-f71.google.com with SMTP id q18-20020a056402519200b0043dd2ff50feso9125898edd.9 for ; Wed, 07 Sep 2022 01:12:50 -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:subject:date; bh=G7JSisCjfZkuxA0PRfAg5vFvEX0TLAd+IEtq8gNC3kc=; b=rsvo3vPidilvuv6VcWephUqdSe8b0bxK8uKtcHsQhpfRRxfpi60xWo9YEC8sA7r0h0 y2Y/xXBHpUs/EvBSYZJyr994LAqRwURHZ5bwqO+ytGtff9yFith8NtED3+8Y9LLI7Kw5 7BQQlo/pEHHmw07qxKNfNog1Fw6MextUZmedfZ6vFCkCFWJX+jihtLEmj+lpdW7YPHUD NyCHBEYJPw3a7yGrbT3ziprrNMcudyLTovaDJnRdwiW8t806t8NK6DTTjAPM/5HTuL+v RgDFNNV0sIrTjfPQEX31Lo6URo3Xi/dnaurUVMLjwyocFKEz+UPbTFI7vfndWeG8ASXT o9zQ== X-Gm-Message-State: ACgBeo1hlVmWKFkJ3G40wrIgv4gF4a3dDBL3bbC1Qb4xaK43AqiGsP78 l5wSlO9eIlgZ5EeRdOK+vzW6RW6uU9teT1P50yIbjpDwHOTFZzL8NvIhXX8tR5GHp/zjz9+KgMh rMKYq4Dmv3E/3ESAG54YJz9Zf X-Received: by 2002:a17:907:86a9:b0:741:79ed:63c5 with SMTP id qa41-20020a17090786a900b0074179ed63c5mr1540649ejc.672.1662538369562; Wed, 07 Sep 2022 01:12:49 -0700 (PDT) X-Received: by 2002:a17:907:86a9:b0:741:79ed:63c5 with SMTP id qa41-20020a17090786a900b0074179ed63c5mr1540637ejc.672.1662538369275; Wed, 07 Sep 2022 01:12:49 -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 m2-20020a170906848200b007707ab1139csm1071181ejx.75.2022.09.07.01.12.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Sep 2022 01:12:48 -0700 (PDT) Message-ID: <98559c23-cc22-3b85-2102-0cc760240804@redhat.com> Date: Wed, 7 Sep 2022 10:12:47 +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 4/8] i2c: acpi: Use ACPI GPIO wake capability bit to set wake_irq Content-Language: en-US To: Raul Rangel , Dmitry Torokhov Cc: Linux ACPI , linux-input , "Limonciello, Mario" , Tim Van Patten , "Rafael J. Wysocki" , Mika Westerberg , Wolfram Sang , "open list:I2C SUBSYSTEM HOST DRIVERS" , linux-kernel References: <20220830231541.1135813-1-rrangel@chromium.org> <20220830171332.4.I8af4282adc72eb9f247adcd03676a43893a020a6@changeid> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 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_LOW,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 9/7/22 04:00, Raul Rangel wrote: > On Tue, Sep 6, 2022 at 7:00 PM Dmitry Torokhov > wrote: >> >> On Tue, Aug 30, 2022 at 05:15:37PM -0600, Raul E Rangel wrote: >>> Device tree already has a mechanism to pass the wake_irq. It does this >>> by looking for the wakeup-source property and setting the >>> I2C_CLIENT_WAKE flag. This CL adds the ACPI equivalent. It uses at the >>> ACPI GpioInt wake flag to determine if the interrupt can be used to wake >>> the system. Previously the i2c drivers had to make assumptions and >>> blindly enable the wake IRQ. This can cause spurious wake events. e.g., >>> If there is a device with an Active Low interrupt and the device gets >>> powered off while suspending, the interrupt line will go low since it's >>> no longer powered and wake the system. For this reason we should respect >>> the board designers wishes and honor the wake bit defined on the >>> GpioInt. >>> >>> This change does not cover the ACPI Interrupt or IRQ resources. >>> >>> Signed-off-by: Raul E Rangel >>> --- >>> >>> drivers/i2c/i2c-core-acpi.c | 8 ++++++-- >>> drivers/i2c/i2c-core-base.c | 17 +++++++++++------ >>> drivers/i2c/i2c-core.h | 4 ++-- >>> 3 files changed, 19 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c >>> index c762a879c4cc6b..cfe82a6ba3ef28 100644 >>> --- a/drivers/i2c/i2c-core-acpi.c >>> +++ b/drivers/i2c/i2c-core-acpi.c >>> @@ -182,12 +182,13 @@ static int i2c_acpi_add_resource(struct acpi_resource *ares, void *data) >>> /** >>> * i2c_acpi_get_irq - get device IRQ number from ACPI >>> * @client: Pointer to the I2C client device >>> + * @wake_capable: Set to 1 if the IRQ is wake capable >>> * >>> * Find the IRQ number used by a specific client device. >>> * >>> * Return: The IRQ number or an error code. >>> */ >>> -int i2c_acpi_get_irq(struct i2c_client *client) >>> +int i2c_acpi_get_irq(struct i2c_client *client, int *wake_capable) >>> { >>> struct acpi_device *adev = ACPI_COMPANION(&client->dev); >>> struct list_head resource_list; >>> @@ -196,6 +197,9 @@ int i2c_acpi_get_irq(struct i2c_client *client) >>> >>> INIT_LIST_HEAD(&resource_list); >>> >>> + if (wake_capable) >>> + *wake_capable = 0; >>> + >>> ret = acpi_dev_get_resources(adev, &resource_list, >>> i2c_acpi_add_resource, &irq); >> > > >> You also need to handle "Interrupt(..., ...AndWake)" case here. I would >> look into maybe defining >> >> #define IORESOURCE_IRQ_WAKECAPABLE (1<<6) >> >> in include/linux/ioport.h and plumbing it through from ACPI layer. >> >> Thanks. > > AFAIK the Intel (Not 100% certain) and AMD IO-APIC's can't actually > wake a system from suspend/suspend-to-idle. That may be true for S3 suspend (it sounds about right) there certainly is no way to "arm for wakeup" on the APIC, but with s2idle all IRQs which are not explicitly disabled by the OS still function normally so there any IRQ can be a wakeup source (AFAIK). And even with S3 suspend I think some IRQs can act as wakeup, but that is configured by the BIOS then and not something which linux can enable/disable. E.g IIRC the parent IRQ of the GPIO controllers on x86 is an APIC IRQ ... Regards, Hans