From patchwork Mon Oct 1 21:06:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 147932 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4373093lji; Mon, 1 Oct 2018 14:06:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV63zLFnYBAnm+J+bUQf4iDbJ3OtYr37VQUK1e8GbU9aw9p/Vp4JdD9CXyUKP25Pinm6vYO8S X-Received: by 2002:a62:18a:: with SMTP id 132-v6mr13215326pfb.207.1538427984286; Mon, 01 Oct 2018 14:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538427984; cv=none; d=google.com; s=arc-20160816; b=OI/ZQnMpvjcIuv9tVAY3xxMCMvj96eo5Jcxh2Lc0vycmNJK/VG/De+Fe0pEKPQ1ZCl 4HDIFpobhymB2JRhvTDlyV5hdpuxATdMDcOm/gU0QpQPO11987h0NViEX61edJEn1D1m n4N5M4GpYx4+jZRg6ll6hBgrO5rYGHtUTFC++uhkFhV2sZQqN+nlN7Qu3o0g4yL/M5Wx 28ZK7aux/heSEX8vX3hkXODuBtkvQHLAb5CVvgPn4YIdgmzn6kyuQ8xDrc3Ys+YY+XW1 515Xl7bKoCMljtVMIylC3koTYkenPEW8fcghTPAJ4xGcF8AHxjxpJ2cBaIcb7d+oi5W0 v7rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Ga14cqJdq1ks34GswSKsxNu0bzZeKcs8M8RCL1ajx8A=; b=Ftuww6u8YsEheZDS17WGwq8rZu+Muxx/gWHPq1/E9T/VGWRN4hRDwR9gfzN+X5VP+v zG1hz4lX1Pc55SdUFSBAQhSWt9bL6eKT+INiiqBF9JqgT7ZFHyYBKAH8gs37IrS/m9GC I8Usfcws26UhtzKy25sKbDd1DSpW3LtAezhvGyGP9FTYMww/9U8uU1Mv0pfiMIaQekJZ Lrp3o5Wxfj7FealRzRYGEeNg3E/079+WBDbnAZMyW4ELgeN6XFRvnT48VKP+jkkzRYUe 6Ma73jafM4wbYdIkqlOKAZtHQVoV1TsMACmeICEgkILOj8SOQNRm4PG6vb2PepKgxK8j 5tOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Up39jNxF; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b128-v6si14061429pfg.94.2018.10.01.14.06.24; Mon, 01 Oct 2018 14:06:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Up39jNxF; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726149AbeJBDqE (ORCPT + 5 others); Mon, 1 Oct 2018 23:46:04 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46302 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725936AbeJBDqD (ORCPT ); Mon, 1 Oct 2018 23:46:03 -0400 Received: by mail-lf1-f67.google.com with SMTP id q2-v6so10930054lfc.13 for ; Mon, 01 Oct 2018 14:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Ga14cqJdq1ks34GswSKsxNu0bzZeKcs8M8RCL1ajx8A=; b=Up39jNxFYl0SCRd567vHgeUe/76rVneZilm8ww/1Ub4QhL6oSBLUES6CQ8fgSiddon qSBnDlHdMw/YMKNQOVBU3L+9gx0kTRtELybGvtsGT3UeNwSnmH45cTSTISvhqAuOgc3g FWtRZ9hYPRm7Trr7bfcC6IynuNfiW+4+0w36s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ga14cqJdq1ks34GswSKsxNu0bzZeKcs8M8RCL1ajx8A=; b=oV3ZBlXGG+GB/o/cYSw6IN06L6EFmSv0I0wiYzBv7soM5r4FrphmuSKWou+GYDuXpn qmmvBv5bQWo55LuNoiRzNrdJ3bI563/wP8d6wLNqfN82KguTfUqmlArIrr4r/OVM+5w+ gvzpv0dL/o/LvqBa4czVWjrE7CwG3RYXJ8WeiJswVgyTI/xnNc9G8EDLj6h1BOIm/iaw UYFgD3HK8oSCywWcq9cIWJ/hMyxA+wSTrua6FX9+aTRFdjdal0Iqv0AKM/JuLZy+0lHF HdXdoK8ZvdZSirVrKrPUGYACkSe0mNwCcuRLoyiEZwkdWc6pz7WeCpHd6P200pXxSay/ K5xQ== X-Gm-Message-State: ABuFfognh7X005GBF4HeuM//7u67VMhLzEipm9lNUhkadILp7Y+fczct IappnzrCJo/JXJafuFMKdd6USlxtA9E= X-Received: by 2002:a19:a2c1:: with SMTP id l184-v6mr6800446lfe.33.1538427981053; Mon, 01 Oct 2018 14:06:21 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id 2-v6sm147637lfx.54.2018.10.01.14.06.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Oct 2018 14:06:19 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij Subject: [PATCH] gpio: Slightly more helpful debugfs Date: Mon, 1 Oct 2018 23:06:17 +0200 Message-Id: <20181001210617.5247-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This at least makes debugfs print if the line is active high or low. That is pretty helpful as what we display as "lo" or "hi" is the raw physical level of the line. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 267c1cc64b1f..0002d180a062 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4585,8 +4585,9 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev) struct gpio_chip *chip = gdev->chip; unsigned gpio = gdev->base; struct gpio_desc *gdesc = &gdev->descs[0]; - int is_out; - int is_irq; + bool is_out; + bool is_irq; + bool active_low; for (i = 0; i < gdev->ngpio; i++, gpio++, gdesc++) { if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) { @@ -4600,11 +4601,13 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev) gpiod_get_direction(gdesc); is_out = test_bit(FLAG_IS_OUT, &gdesc->flags); is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags); - seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %s %s %s", + active_low = test_bit(FLAG_ACTIVE_LOW, &gdesc->flags); + seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %s %s %s%s", gpio, gdesc->name ? gdesc->name : "", gdesc->label, is_out ? "out" : "in ", chip->get ? (chip->get(chip, i) ? "hi" : "lo") : "? ", - is_irq ? "IRQ" : " "); + is_irq ? "IRQ " : "", + active_low ? "ACTIVE LOW" : ""); seq_printf(s, "\n"); } }