From patchwork Wed Feb 14 11:23:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10218437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0DB5602CB for ; Wed, 14 Feb 2018 11:23:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C30F528A3F for ; Wed, 14 Feb 2018 11:23:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B678628ABF; Wed, 14 Feb 2018 11:23:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40B0128A42 for ; Wed, 14 Feb 2018 11:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967319AbeBNLXm (ORCPT ); Wed, 14 Feb 2018 06:23:42 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:38682 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967255AbeBNLXl (ORCPT ); Wed, 14 Feb 2018 06:23:41 -0500 Received: by mail-qt0-f193.google.com with SMTP id k13so7259292qtg.5; Wed, 14 Feb 2018 03:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZdrqkoO3bFg/jyvztY9J3K/jBfDVGFlRxvmtNcGqtuU=; b=dsOD8RjWC7icQiWbuKeTyWCkkWc0txSvEswqhaF5WRhiio96Z4G3ZamrsRsNEMYgDg YYEkmXZeieX/sCFp5Zpq3qTrxPozi+2lc3OQkmZOhzgISIpH0czqQ+7XhcXC4rW5iqq2 XdTE9uvS1AMtZhDp4PuEDdZ2E9wFmXBZ0l8SpP/IzwhlxosGr8eijkhtkuvujD1Zs4gj cCyQBCxPOSffrY2s2GysugZePpFXYEWV9RU7w4ACrvFnUm3QTIXR888iCiXRtjL3E4s6 CwNi+vlxASMbf86C7NCxoRgAxRbWzY4no+nENcRuNB0LRFELKbT5KlPK8c/skRQ7tX1I S3OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZdrqkoO3bFg/jyvztY9J3K/jBfDVGFlRxvmtNcGqtuU=; b=uOAcsynb8rXmQ+VJEn4En7lC8xiE7cmOzaMBEjbyrQgiI9+uWnZCFvRdQXeQwAT2So lO+U6c1kicI+VeQy/IqQOXdrMIQh9usNiN7LcoN2vpXagrrdeAqcy1aGmDqYiIfQJbC0 O9lYz6HNsMHSiwAxsmt1YogbaBDHqnd+Pj0+sKdzntlU4Z7guokbdtzzKRQdE4icIIL3 wkHT2KBdQCJBVoaXvd6f9rTCLKqTZQeRFIFrYa2gioEKRMvwGukvp7ZBkfG0Cltw5mo8 AOFhY2AyoIJ9w59vjih+jrEgX/5R/+C0wCYKy+qIimjfb3lq6QlzpQNGG2IOqusqj1O5 NyAQ== X-Gm-Message-State: APf1xPB/SbfTkheQ9oribvOp/JwDNYxwsuxduq04z60iofj6E2QwdWxC PGv/ZqAqTD01zlGi01DqqUri/y+OvgyHthmhgVM= X-Google-Smtp-Source: AH8x225X4Nf2+hAnQw48Cp61kMER/gi71lm56bw06pdg7UMDMeQeazLHIMoeud/u/EUGgxHZueX3HK97DB15+HUvMMk= X-Received: by 10.200.11.13 with SMTP id e13mr1962588qti.340.1518607421144; Wed, 14 Feb 2018 03:23:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.82 with HTTP; Wed, 14 Feb 2018 03:23:40 -0800 (PST) In-Reply-To: <20180209161456.18951-1-tony@atomide.com> References: <20180209161456.18951-1-tony@atomide.com> From: Andy Shevchenko Date: Wed, 14 Feb 2018 13:23:40 +0200 Message-ID: Subject: Re: [PATCH] PM / wakeirq: Add wakeup name to dedicated wake irqs To: Tony Lindgren Cc: "Rafael J . Wysocki" , Alan Stern , Linux PM , Linux Kernel Mailing List , Brian Norris , Grygorii Strashko , Ulf Hansson Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Feb 9, 2018 at 6:14 PM, Tony Lindgren wrote: > This makes it easy to grep :wakeup /proc/interrupts. I used to have another patch (not published) to provide this information via /sys/kernel/irq. OK, here we are: > + namelen = strlen(dev_name(dev)) + strlen(postfix) + 1; > + wirq->name = kzalloc(namelen, GFP_KERNEL); kasprintf() From ef35d3fd789a32d85212b2bcb82f754ae244cd58 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 12 May 2017 20:19:32 +0300 Subject: [PATCH] genirq: Add wakeup sysfs node to show IRQ wakeup state Surprisingly there is no simple way to see if the IRQ line in question is wakeup source or not. Note that wakeup might be an OOB (out-of-band) source like GPIO line which makes things slightly more complicated. Add a sysfs node to cover this case. Signed-off-by: Andy Shevchenko --- Documentation/ABI/testing/sysfs-kernel-irq | 7 +++++++ kernel/irq/irqdesc.c | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-irq b/Documentation/ABI/testing/sysfs-kernel-irq index eb074b100986..10ad998f9411 100644 --- a/Documentation/ABI/testing/sysfs-kernel-irq +++ b/Documentation/ABI/testing/sysfs-kernel-irq @@ -51,3 +51,10 @@ Date: September 2016 KernelVersion: 4.9 Contact: Craig Gallek Description: The type of the interrupt. Either the string 'level' or 'edge'. + +What: /sys/kernel/irq//wakeup +Date: Jan 2018 +KernelVersion: 4.16 +Contact: Andy Shevchenko +Description: The wakeup state of the interrupt. Either the string + 'enabled' or 'disabled'. diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 49b54e9979cc..d9ded088d336 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -210,6 +210,22 @@ static ssize_t type_show(struct kobject *kobj, } IRQ_ATTR_RO(type); +static ssize_t wakeup_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); + ssize_t ret = 0; + + raw_spin_lock_irq(&desc->lock); + ret = sprintf(buf, "%s\n", + irqd_is_wakeup_set(&desc->irq_data) ? "enabled" : "disabled"); + raw_spin_unlock_irq(&desc->lock); + + return ret; + +} +IRQ_ATTR_RO(wakeup); + static ssize_t name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -253,6 +269,7 @@ static struct attribute *irq_attrs[] = { &chip_name_attr.attr, &hwirq_attr.attr, &type_attr.attr, + &wakeup_attr.attr, &name_attr.attr, &actions_attr.attr, NULL -- 2.15.1