From patchwork Thu Oct 16 17:11:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 5092941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B5287C11AC for ; Thu, 16 Oct 2014 17:15:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8422201F4 for ; Thu, 16 Oct 2014 17:15:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1D3D201ED for ; Thu, 16 Oct 2014 17:15:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XeobY-0007Tr-ML; Thu, 16 Oct 2014 17:12:48 +0000 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XeobC-0007HT-Cm for linux-arm-kernel@lists.infradead.org; Thu, 16 Oct 2014 17:12:28 +0000 Received: by mail-pa0-f43.google.com with SMTP id lf10so3806667pab.16 for ; Thu, 16 Oct 2014 10:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=0I9q6454J9UJH038cqmkdU1pt0PjJxiXYnfXGJGWWYQ=; b=tITRGN8nmtCJa9y2F/V+uzdwqPKk6B5irL4bgtOBtwAYjtn8Rj6AY66PqEwhgYcJoy 8ntR67EyiWX3dtm0hDRalPVx3+u0igId/6fFap2A8lz7oVLAl+7CZPgIz6tyCg07fo7c toxKyXHac6jLmLwVyehpLd8TW96AuAOM8qW/i2jF0tZAn2vIN+690e5+urJLmJNGzzbl xjZX8Qz88JqNd1nTq7ADWpVEkc5FToKZ5hoCjbOKydsE8ys6Q/QLDWGXZgwFKLRaVFOP OcLEX59QOoUAlLl/FI5fj8YdfqWNHH930H/k48XIFOD2m+uK6zGq9MCofVO+zjxtYgvU lDkA== X-Received: by 10.68.202.170 with SMTP id kj10mr2479614pbc.161.1413479525440; Thu, 16 Oct 2014 10:12:05 -0700 (PDT) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id l8sm20244108pbq.25.2014.10.16.10.12.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014 10:12:04 -0700 (PDT) From: Soren Brinkmann To: Linus Walleij Subject: [PATCH RFC v2 2/8] pinctrl: pinconf-generic: Add flag to print arguments Date: Thu, 16 Oct 2014 10:11:29 -0700 Message-Id: <1413479495-14206-3-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.1.2.1.g5e69ed6 In-Reply-To: <1413479495-14206-1-git-send-email-soren.brinkmann@xilinx.com> References: <1413479495-14206-1-git-send-email-soren.brinkmann@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141016_101226_492514_2413DC55 X-CRM114-Status: GOOD ( 14.24 ) X-Spam-Score: 0.0 (/) Cc: linux-arm-kernel@lists.infradead.org, Steffen Trumtrar , Michal Simek , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When dumping pinconf information in debugfs, config arguments are only printed when a unit is present and the argument is != 0. For parameters like the slew rate, this does not work. The slew rate uses a driver specific format for the argument, i.e. 0 can be a valid argument and a unit is not provided for it. For that reason, add a flag to enable printing the argument instead of inferring it from the presence of a unit and the value of the argument. Signed-off-by: Soren Brinkmann --- drivers/pinctrl/pinconf-generic.c | 65 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index 29ff77f90fcb..e28ef957ca2d 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c @@ -32,30 +32,32 @@ struct pin_config_item { const enum pin_config_param param; const char * const display; const char * const format; + bool has_arg; }; -#define PCONFDUMP(a, b, c) { .param = a, .display = b, .format = c } +#define PCONFDUMP(a, b, c, d) { .param = a, .display = b, .format = c, \ + .has_arg = d } static struct pin_config_item conf_items[] = { - PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL), - PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL), - PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL), - PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL), - PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL), + PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL, false), + PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL, false), + PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL, false), + PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL, false), + PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL, false), PCONFDUMP(PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, - "input bias pull to pin specific state", NULL), - PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL), - PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL), - PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL), - PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH, "output drive strength", "mA"), - PCONFDUMP(PIN_CONFIG_INPUT_ENABLE, "input enabled", NULL), - PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT_ENABLE, "input schmitt enabled", NULL), - PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT, "input schmitt trigger", NULL), - PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "usec"), - PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector"), - PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL), - PCONFDUMP(PIN_CONFIG_LOW_POWER_MODE, "pin low power", "mode"), - PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level"), + "input bias pull to pin specific state", NULL, false), + PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false), + PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL, false), + PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL, false), + PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH, "output drive strength", "mA", true), + PCONFDUMP(PIN_CONFIG_INPUT_ENABLE, "input enabled", NULL, false), + PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT_ENABLE, "input schmitt enabled", NULL, false), + PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT, "input schmitt trigger", NULL, false), + PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "usec", true), + PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true), + PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true), + PCONFDUMP(PIN_CONFIG_LOW_POWER_MODE, "pin low power", "mode", true), + PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true), }; void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, @@ -85,11 +87,14 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, seq_puts(s, " "); seq_puts(s, conf_items[i].display); /* Print unit if available */ - if (conf_items[i].format && - pinconf_to_config_argument(config) != 0) - seq_printf(s, " (%u %s)", - pinconf_to_config_argument(config), - conf_items[i].format); + if (conf_items[i].has_arg) { + seq_printf(s, " (%u", + pinconf_to_config_argument(config)); + if (conf_items[i].format) + seq_printf(s, " %s)", conf_items[i].format); + else + seq_puts(s, ")"); + } } } @@ -121,10 +126,14 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev, seq_puts(s, " "); seq_puts(s, conf_items[i].display); /* Print unit if available */ - if (conf_items[i].format && config != 0) - seq_printf(s, " (%u %s)", - pinconf_to_config_argument(config), - conf_items[i].format); + if (conf_items[i].has_arg) { + seq_printf(s, " (%u", + pinconf_to_config_argument(config)); + if (conf_items[i].format) + seq_printf(s, " %s)", conf_items[i].format); + else + seq_puts(s, ")"); + } } }