Skip to content

Commit e8129a0

Browse files
superm1linusw
authored andcommitted
pinctrl: amd: Use unicode for debugfs output
The output is currently split across two lines making it more difficult to parse unless the newlines are removed between pins or it's read in by a parser like Libreoffice Calc or Google docs. To make it easier to follow to the naked eye in a terminal window: * drop the newline in the middle of pin definitions * shorten all output using unicode characters * align all pipe delimitters * output the same phrase even for disabled functions (but with a ∅ character) Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20220722220810.28894-2-mario.limonciello@amd.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent dc24b75 commit e8129a0

File tree

1 file changed

+56
-58
lines changed

1 file changed

+56
-58
lines changed

drivers/pinctrl/pinctrl-amd.c

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
202202
struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
203203

204204
bool tmr_out_unit;
205-
unsigned int time;
206-
unsigned int unit;
207205
bool tmr_large;
208206

209207
char *level_trig;
@@ -217,13 +215,14 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
217215
char *pull_up_sel;
218216
char *pull_up_enable;
219217
char *pull_down_enable;
220-
char *output_value;
218+
char *orientation;
221219
char *output_enable;
222220
char debounce_value[40];
223221
char *debounce_enable;
224222

225223
for (bank = 0; bank < gpio_dev->hwbank_num; bank++) {
226-
seq_printf(s, "GPIO bank%d\n", bank);
224+
unsigned int time = 0;
225+
unsigned int unit = 0;
227226

228227
switch (bank) {
229228
case 0:
@@ -246,93 +245,101 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
246245
/* Illegal bank number, ignore */
247246
continue;
248247
}
248+
seq_printf(s, "GPIO bank%d\n", bank);
249249
for (; i < pin_num; i++) {
250-
seq_printf(s, "pin%d\t", i);
250+
seq_printf(s, "📌%d\t", i);
251251
raw_spin_lock_irqsave(&gpio_dev->lock, flags);
252252
pin_reg = readl(gpio_dev->base + i * 4);
253253
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
254254

255255
if (pin_reg & BIT(INTERRUPT_ENABLE_OFF)) {
256256
u8 level = (pin_reg >> ACTIVE_LEVEL_OFF) &
257257
ACTIVE_LEVEL_MASK;
258-
interrupt_enable = "interrupt is enabled|";
258+
interrupt_enable = "+";
259259

260260
if (level == ACTIVE_LEVEL_HIGH)
261-
active_level = "Active high|";
261+
active_level = "";
262262
else if (level == ACTIVE_LEVEL_LOW)
263-
active_level = "Active low|";
263+
active_level = "";
264264
else if (!(pin_reg & BIT(LEVEL_TRIG_OFF)) &&
265265
level == ACTIVE_LEVEL_BOTH)
266-
active_level = "Active on both|";
266+
active_level = "b";
267267
else
268-
active_level = "Unknown Active level|";
268+
active_level = "?";
269269

270270
if (pin_reg & BIT(LEVEL_TRIG_OFF))
271-
level_trig = "Level trigger|";
271+
level_trig = "level";
272272
else
273-
level_trig = "Edge trigger|";
273+
level_trig = " edge";
274274

275275
} else {
276-
interrupt_enable =
277-
"interrupt is disabled|";
278-
active_level = " ";
279-
level_trig = " ";
276+
interrupt_enable = "∅";
277+
active_level = "∅";
278+
level_trig = " ∅";
280279
}
281280

282281
if (pin_reg & BIT(INTERRUPT_MASK_OFF))
283-
interrupt_mask =
284-
"interrupt is unmasked|";
282+
interrupt_mask = "-";
285283
else
286-
interrupt_mask =
287-
"interrupt is masked|";
284+
interrupt_mask = "+";
285+
seq_printf(s, "int %s (🎭 %s)| active-%s| %s-🔫| ",
286+
interrupt_enable,
287+
interrupt_mask,
288+
active_level,
289+
level_trig);
288290

289291
if (pin_reg & BIT(WAKE_CNTRL_OFF_S0I3))
290-
wake_cntrl0 = "enable wakeup in S0i3 state|";
292+
wake_cntrl0 = "+";
291293
else
292-
wake_cntrl0 = "disable wakeup in S0i3 state|";
294+
wake_cntrl0 = "∅";
295+
seq_printf(s, "S0i3 🌅 %s| ", wake_cntrl0);
293296

294297
if (pin_reg & BIT(WAKE_CNTRL_OFF_S3))
295-
wake_cntrl1 = "enable wakeup in S3 state|";
298+
wake_cntrl1 = "+";
296299
else
297-
wake_cntrl1 = "disable wakeup in S3 state|";
300+
wake_cntrl1 = "∅";
301+
seq_printf(s, "S3 🌅 %s| ", wake_cntrl1);
298302

299303
if (pin_reg & BIT(WAKE_CNTRL_OFF_S4))
300-
wake_cntrl2 = "enable wakeup in S4/S5 state|";
304+
wake_cntrl2 = "+";
301305
else
302-
wake_cntrl2 = "disable wakeup in S4/S5 state|";
306+
wake_cntrl2 = "∅";
307+
seq_printf(s, "S4/S5 🌅 %s| ", wake_cntrl2);
303308

304309
if (pin_reg & BIT(PULL_UP_ENABLE_OFF)) {
305-
pull_up_enable = "pull-up is enabled|";
310+
pull_up_enable = "+";
306311
if (pin_reg & BIT(PULL_UP_SEL_OFF))
307-
pull_up_sel = "8k pull-up|";
312+
pull_up_sel = "8k";
308313
else
309-
pull_up_sel = "4k pull-up|";
314+
pull_up_sel = "4k";
310315
} else {
311-
pull_up_enable = "pull-up is disabled|";
312-
pull_up_sel = " ";
316+
pull_up_enable = "";
317+
pull_up_sel = " ";
313318
}
319+
seq_printf(s, "pull-↑ %s (%s)| ",
320+
pull_up_enable,
321+
pull_up_sel);
314322

315323
if (pin_reg & BIT(PULL_DOWN_ENABLE_OFF))
316-
pull_down_enable = "pull-down is enabled|";
324+
pull_down_enable = "+";
317325
else
318-
pull_down_enable = "Pull-down is disabled|";
326+
pull_down_enable = "∅";
327+
seq_printf(s, "pull-↓ %s| ", pull_down_enable);
319328

320329
if (pin_reg & BIT(OUTPUT_ENABLE_OFF)) {
321-
pin_sts = " ";
322-
output_enable = "output is enabled|";
330+
pin_sts = "output";
323331
if (pin_reg & BIT(OUTPUT_VALUE_OFF))
324-
output_value = "output is high|";
332+
orientation = "";
325333
else
326-
output_value = "output is low|";
334+
orientation = "";
327335
} else {
328-
output_enable = "output is disabled|";
329-
output_value = " ";
330-
336+
pin_sts = "input ";
331337
if (pin_reg & BIT(PIN_STS_OFF))
332-
pin_sts = "input is high|";
338+
orientation = "";
333339
else
334-
pin_sts = "input is low|";
340+
orientation = "";
335341
}
342+
seq_printf(s, "%s %s| ", pin_sts, orientation);
336343

337344
db_cntrl = (DB_CNTRl_MASK << DB_CNTRL_OFF) & pin_reg;
338345
if (db_cntrl) {
@@ -351,27 +358,18 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
351358
unit = 61;
352359
}
353360
if ((DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF) == db_cntrl)
354-
debounce_enable = "debouncing filter (high and low) enabled|";
361+
debounce_enable = "b +";
355362
else if ((DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF) == db_cntrl)
356-
debounce_enable = "debouncing filter (low) enabled|";
363+
debounce_enable = "↓ +";
357364
else
358-
debounce_enable = "debouncing filter (high) enabled|";
365+
debounce_enable = "↑ +";
359366

360-
snprintf(debounce_value, sizeof(debounce_value),
361-
"debouncing timeout is %u (us)|", time * unit);
362367
} else {
363-
debounce_enable = "debouncing filter disabled|";
364-
snprintf(debounce_value, sizeof(debounce_value), " ");
368+
debounce_enable = " ∅";
365369
}
366-
367-
seq_printf(s, "%s %s %s %s %s %s\n"
368-
" %s %s %s %s %s %s %s %s %s 0x%x\n",
369-
level_trig, active_level, interrupt_enable,
370-
interrupt_mask, wake_cntrl0, wake_cntrl1,
371-
wake_cntrl2, pin_sts, pull_up_sel,
372-
pull_up_enable, pull_down_enable,
373-
output_value, output_enable,
374-
debounce_enable, debounce_value, pin_reg);
370+
snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit);
371+
seq_printf(s, "debounce %s (⏰ %sus)| ", debounce_enable, debounce_value);
372+
seq_printf(s, " 0x%x\n", pin_reg);
375373
}
376374
}
377375
}

0 commit comments

Comments
 (0)