aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSoren Brinkmann <soren.brinkmann@xilinx.com>2014-10-16 13:11:29 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-10-28 11:59:31 -0400
commiteec450713e5c5cafa9b8565c84548580080b1f64 (patch)
treebce0c8ec02794bc71cd863db34bc44788908a831 /drivers
parentc61c2d7071d865adc3bbd92dee670bcf7bf56099 (diff)
pinctrl: pinconf-generic: Add flag to print arguments
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 <soren.brinkmann@xilinx.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/pinconf-generic.c65
1 files 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 {
32 const enum pin_config_param param; 32 const enum pin_config_param param;
33 const char * const display; 33 const char * const display;
34 const char * const format; 34 const char * const format;
35 bool has_arg;
35}; 36};
36 37
37#define PCONFDUMP(a, b, c) { .param = a, .display = b, .format = c } 38#define PCONFDUMP(a, b, c, d) { .param = a, .display = b, .format = c, \
39 .has_arg = d }
38 40
39static struct pin_config_item conf_items[] = { 41static struct pin_config_item conf_items[] = {
40 PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL), 42 PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL, false),
41 PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL), 43 PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL, false),
42 PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL), 44 PCONFDUMP(PIN_CONFIG_BIAS_BUS_HOLD, "input bias bus hold", NULL, false),
43 PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL), 45 PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL, false),
44 PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL), 46 PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL, false),
45 PCONFDUMP(PIN_CONFIG_BIAS_PULL_PIN_DEFAULT, 47 PCONFDUMP(PIN_CONFIG_BIAS_PULL_PIN_DEFAULT,
46 "input bias pull to pin specific state", NULL), 48 "input bias pull to pin specific state", NULL, false),
47 PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL), 49 PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false),
48 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL), 50 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL, false),
49 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL), 51 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL, false),
50 PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH, "output drive strength", "mA"), 52 PCONFDUMP(PIN_CONFIG_DRIVE_STRENGTH, "output drive strength", "mA", true),
51 PCONFDUMP(PIN_CONFIG_INPUT_ENABLE, "input enabled", NULL), 53 PCONFDUMP(PIN_CONFIG_INPUT_ENABLE, "input enabled", NULL, false),
52 PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT_ENABLE, "input schmitt enabled", NULL), 54 PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT_ENABLE, "input schmitt enabled", NULL, false),
53 PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT, "input schmitt trigger", NULL), 55 PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT, "input schmitt trigger", NULL, false),
54 PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "usec"), 56 PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "usec", true),
55 PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector"), 57 PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector", true),
56 PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL), 58 PCONFDUMP(PIN_CONFIG_SLEW_RATE, "slew rate", NULL, true),
57 PCONFDUMP(PIN_CONFIG_LOW_POWER_MODE, "pin low power", "mode"), 59 PCONFDUMP(PIN_CONFIG_LOW_POWER_MODE, "pin low power", "mode", true),
58 PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level"), 60 PCONFDUMP(PIN_CONFIG_OUTPUT, "pin output", "level", true),
59}; 61};
60 62
61void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, 63void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
@@ -85,11 +87,14 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
85 seq_puts(s, " "); 87 seq_puts(s, " ");
86 seq_puts(s, conf_items[i].display); 88 seq_puts(s, conf_items[i].display);
87 /* Print unit if available */ 89 /* Print unit if available */
88 if (conf_items[i].format && 90 if (conf_items[i].has_arg) {
89 pinconf_to_config_argument(config) != 0) 91 seq_printf(s, " (%u",
90 seq_printf(s, " (%u %s)", 92 pinconf_to_config_argument(config));
91 pinconf_to_config_argument(config), 93 if (conf_items[i].format)
92 conf_items[i].format); 94 seq_printf(s, " %s)", conf_items[i].format);
95 else
96 seq_puts(s, ")");
97 }
93 } 98 }
94} 99}
95 100
@@ -121,10 +126,14 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
121 seq_puts(s, " "); 126 seq_puts(s, " ");
122 seq_puts(s, conf_items[i].display); 127 seq_puts(s, conf_items[i].display);
123 /* Print unit if available */ 128 /* Print unit if available */
124 if (conf_items[i].format && config != 0) 129 if (conf_items[i].has_arg) {
125 seq_printf(s, " (%u %s)", 130 seq_printf(s, " (%u",
126 pinconf_to_config_argument(config), 131 pinconf_to_config_argument(config));
127 conf_items[i].format); 132 if (conf_items[i].format)
133 seq_printf(s, " %s)", conf_items[i].format);
134 else
135 seq_puts(s, ")");
136 }
128 } 137 }
129} 138}
130 139