Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5619973rdb; Wed, 13 Dec 2023 14:20:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IElpr2ubTVy7gI1m8+nonjcB9AOs06bBRh0gESi7Wr8EKsDXTA9jUBC0BbEWd6dhOpaiQQn X-Received: by 2002:a05:6a21:6da1:b0:190:573c:8a90 with SMTP id wl33-20020a056a216da100b00190573c8a90mr5031220pzb.73.1702506035724; Wed, 13 Dec 2023 14:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702506035; cv=none; d=google.com; s=arc-20160816; b=P+pA8xhSBMzE30nTVpUzGUrBOin2Eg8NEXryS8AFarsAbEvZUK7sn389fZTkCfjyWu Xu8R9DT8/0zx5JXScIkAR0FqpRwhHdNJ7UOfpHvHvYpTDJG5DTqQ275qiPh/gmlXNplG soOGuWqMAUDZEPzH88H3XDVEL1B4nsm1dbw/tENsRw6XHHBnx/qN8bZaNVxGpw25R76Q grbkl9hzB0zwEsQDphYKJmRFRPDWl83zfosAUF8WXUEFI4q2qKG6vAOcOeMIl25nsgmF ubY8buSSumVPDe2nz138hUsPIsBU8/UzpjZIlkkQtxFc/QUJIT4ulTZb/He0SXdXHT8L n9EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=IWWDY9W1m0Ti8Ki53nf0U1ywjlmu1b5RWqKGlHg5nZs=; fh=Ph26cR6uNvqWzwO33d/0FJNJTNi3ePWr0fa7V6dX3JI=; b=GmBdL+TSjytj2Dam0qsV1+590wzjXcS+qCz9vKXEOQ9E9rRqsu5YerBpytaJsPjGnW S94esJhFSghrW2FCJdtZPNcnnYsYmF+9EcJh8sqIIJW4uaQVwCr3rfcPe2anUZiVKKGp 9+z0xvXzJJRHfVqjd+aRvJJ5DtUigWYBkWWhqGcKb67H+NADdFJOqLW07VjsK/yiuxg3 NL4k8QmbsmlvBawN9wIQTPEABOmu3hXavG1I2AwT0xRPjEdWeRBv8QFE+dsN+/pBiKrL oSSFZklg2im12DUlUPGOIIy3FYEHNX0ZRh8EWehHAWEy9wxsVjvcYOjoNd6Ojhg+wDiJ 5sJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t10-20020a17090abc4a00b00286864c9cdcsi11372295pjv.125.2023.12.13.14.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:20:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 818DA807FCEA; Wed, 13 Dec 2023 14:20:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230004AbjLMWT4 (ORCPT + 99 others); Wed, 13 Dec 2023 17:19:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjLMWTz (ORCPT ); Wed, 13 Dec 2023 17:19:55 -0500 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434F39C; Wed, 13 Dec 2023 14:20:02 -0800 (PST) Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-591553d3835so702236eaf.3; Wed, 13 Dec 2023 14:20:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702506001; x=1703110801; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IWWDY9W1m0Ti8Ki53nf0U1ywjlmu1b5RWqKGlHg5nZs=; b=sXmLPi4er833zan94EXvafgD6/LJsyPQRVkt0ZugiWx3kSSKQfBlhVZ1Yawmx9+oEg pUEOcsbU0gp6r4G5zjgB7UfQa0ayOOw47e6q4/yrsyWwoEEjD4Up3VayNVIHg0JdH6p4 Jnkz/vKBY2XMVeIWEQoAEoiVuVrdwBgtQ4ePMVbB925Bqcwv4EWhurFibI4XfuNLEDev 3uE0buAmg7K1RF30sfYBVzZOssXQNWJyYA9Mk7I8c8ohGpRlfJjRZgIf5PrOevH4z/bH /HwD+yp8MBitp10BlX42MpRnB1+QS7Wl/TcjhnhvtWnqsvyFyRk5OCis08AQz59LEOIq uq0A== X-Gm-Message-State: AOJu0YwCAx4x8j3pf1Id12qa9CgRt494O+JHHCGXanj5SJSqqO4h2mdA AUBxdSaL/BX4j2mQecl17w== X-Received: by 2002:a05:6820:168b:b0:58e:29db:b963 with SMTP id bc11-20020a056820168b00b0058e29dbb963mr6417993oob.4.1702506001502; Wed, 13 Dec 2023 14:20:01 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id bx23-20020a056830601700b006da30d1646fsm722414otb.59.2023.12.13.14.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:20:00 -0800 (PST) Received: (nullmailer pid 2165620 invoked by uid 1000); Wed, 13 Dec 2023 22:19:59 -0000 Date: Wed, 13 Dec 2023 16:19:59 -0600 From: Rob Herring To: Mark Hasemeyer Cc: LKML , Raul Rangel , Frank Rowand , devicetree@vger.kernel.org Subject: Re: [PATCH v1 3/6] of: irq: add wake capable bit to of_irq_resource() Message-ID: <20231213221959.GC2115075-robh@kernel.org> References: <20231213110009.v1.1.Ifd0903f1c351e84376d71dbdadbd43931197f5ea@changeid> <20231213110009.v1.3.I29b26a7f3b80fac0a618707446a10b6cc974fdaf@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231213110009.v1.3.I29b26a7f3b80fac0a618707446a10b6cc974fdaf@changeid> X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Dec 2023 14:20:10 -0800 (PST) On Wed, Dec 13, 2023 at 11:00:21AM -0700, Mark Hasemeyer wrote: > Add wake capability information to the irq resource. Wake capability is > assumed based on conventions provided in the devicetree wakeup-source > binding documentation. An interrupt is considered wake capable if the > following are true: > 1. a wakeup-source property exits in the same device node as the > interrupt. > 2. No dedicated irq is defined, or the irq is marked as dedicated by > setting its interrupt-name to "wakeup". > > The wakeup-source documentation states that dedicated interrupts can use > device specific interrupt names and device drivers are still welcome to > use their own naming schemes. This api is provided as a helper if one is > willing to conform to the above conventions. > > The ACPI subsystems already provides similar apis that allow one to > query the wake capability of an irq. This brings feature parity to the > devicetree. > > Signed-off-by: Mark Hasemeyer > --- > > drivers/of/irq.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c > index 174900072c18c..633711bc32953 100644 > --- a/drivers/of/irq.c > +++ b/drivers/of/irq.c > @@ -383,11 +383,39 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar > } > EXPORT_SYMBOL_GPL(of_irq_parse_one); > > +/** > + * __of_irq_wake_capable - Determine whether a given irq index is wake capable > + * > + * The irq is considered wake capable if the following are true: > + * 1. wakeup-source property exists > + * 2. no dedicated wakeirq exists OR provided irq index is a dedicated wakeirq > + * > + * This logic assumes the provided irq index is valid. > + * > + * @dev: pointer to device tree node > + * @index: zero-based index of the irq > + * Return: True if provided irq index for #dev is wake capable. False otherwise. > + */ > +static bool __of_irq_wake_capable(const struct device_node *dev, int index) > +{ > + int wakeindex; > + > + if (!of_property_read_bool(dev, "wakeup-source")) > + return false; > + > + wakeindex = of_property_match_string(dev, "interrupt-names", "wakeup"); > + return wakeindex < 0 || wakeindex == index; If a device has multiple interrupts, but none named "wakeup" you are saying all the interrupts are wakeup capable. That's not right though. Only the device knows which interrupts are wakeup capable. You need: return wakeindex >= 0 && wakeindex == index; Rob