linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-gpio@vger.kernel.org, Jean Delvare <jdelvare@suse.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output
Date: Thu, 26 Jan 2017 19:24:09 +0200	[thread overview]
Message-ID: <20170126172409.132136-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20170126172409.132136-1-andriy.shevchenko@linux.intel.com>

When debug pin configuration is printed out debounce setting is missed.
Add it here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 46 ++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index a1f85a79f186..6bdb6e5879f8 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1391,11 +1391,12 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
 static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 {
 	struct byt_gpio *vg = gpiochip_get_data(chip);
+	u32 conf0, debounce, val;
 	int i;
-	u32 conf0, val;
 
 	for (i = 0; i < vg->soc_data->npins; i++) {
 		const struct byt_community *comm;
+		const char *db_str = NULL;
 		const char *pull_str = NULL;
 		const char *pull = NULL;
 		void __iomem *reg;
@@ -1415,6 +1416,16 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		}
 		conf0 = readl(reg);
 
+		reg = byt_gpio_reg(vg, pin, BYT_DEBOUNCE_REG);
+		if (!reg) {
+			seq_printf(s,
+				   "Could not retrieve pin %i debounce reg\n",
+				   pin);
+			raw_spin_unlock_irqrestore(&vg->lock, flags);
+			continue;
+		}
+		debounce = readl(reg);
+
 		reg = byt_gpio_reg(vg, pin, BYT_VAL_REG);
 		if (!reg) {
 			seq_printf(s,
@@ -1459,6 +1470,32 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			break;
 		}
 
+		if (conf0 & BYT_DEBOUNCE_EN) {
+			switch (debounce & BYT_DEBOUNCE_PULSE_MASK) {
+			case BYT_DEBOUNCE_PULSE_375US:
+				db_str = "375us";
+				break;
+			case BYT_DEBOUNCE_PULSE_750US:
+				db_str = "750us";
+				break;
+			case BYT_DEBOUNCE_PULSE_1500US:
+				db_str = "1500us";
+				break;
+			case BYT_DEBOUNCE_PULSE_3MS:
+				db_str = "3ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_6MS:
+				db_str = "6ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_12MS:
+				db_str = "12ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_24MS:
+				db_str = "24ms";
+				break;
+			}
+		}
+
 		seq_printf(s,
 			   " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s",
 			   pin,
@@ -1475,7 +1512,12 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		if (pull && pull_str)
 			seq_printf(s, " %-4s %-3s", pull, pull_str);
 		else
-			seq_puts(s, "          ");
+			seq_puts(s, "         ");
+
+		if (db_str)
+			seq_printf(s, " %-6s", db_str);
+		else
+			seq_puts(s, "        ");
 
 		if (conf0 & BYT_IODEN)
 			seq_puts(s, " open-drain");
-- 
2.11.0


  parent reply	other threads:[~2017-01-26 17:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 17:24 [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature Andy Shevchenko
2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko
2017-01-27  9:14   ` Jean Delvare
2017-01-27 13:28     ` Andy Shevchenko
2017-01-27  9:34   ` Mika Westerberg
2017-01-30 14:47   ` Linus Walleij
2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko
2017-01-27  9:21   ` Jean Delvare
2017-01-27 13:27     ` Andy Shevchenko
2017-01-27 14:06       ` Jean Delvare
2017-01-27  9:35   ` Mika Westerberg
2017-01-30 14:49   ` Linus Walleij
2017-01-26 17:24 ` Andy Shevchenko [this message]
2017-01-27  9:40   ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Mika Westerberg
2017-01-27 10:07   ` Jean Delvare
2017-01-30 14:51   ` Linus Walleij
2017-01-30 15:13     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170126172409.132136-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jdelvare@suse.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).