mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 01:10:28 +00:00
pinctrl: nomadik: improve GPIO debug prints
The debugfs file would only define if the line was "pulled" and not which direction (pull up or pull down). Improve this by taking two print paths depending on whether the pin is set as input or output and use the data register directly to figure out whether the pin is set for pull up or pull down. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
259145feff
commit
8f1774a2a9
@ -986,6 +986,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
|
|||||||
container_of(chip, struct nmk_gpio_chip, chip);
|
container_of(chip, struct nmk_gpio_chip, chip);
|
||||||
int mode;
|
int mode;
|
||||||
bool is_out;
|
bool is_out;
|
||||||
|
bool data_out;
|
||||||
bool pull;
|
bool pull;
|
||||||
u32 bit = 1 << offset;
|
u32 bit = 1 << offset;
|
||||||
const char *modes[] = {
|
const char *modes[] = {
|
||||||
@ -998,28 +999,41 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
|
|||||||
[NMK_GPIO_ALT_C+3] = "altC3",
|
[NMK_GPIO_ALT_C+3] = "altC3",
|
||||||
[NMK_GPIO_ALT_C+4] = "altC4",
|
[NMK_GPIO_ALT_C+4] = "altC4",
|
||||||
};
|
};
|
||||||
|
const char *pulls[] = {
|
||||||
|
"none ",
|
||||||
|
"pull down",
|
||||||
|
"pull up ",
|
||||||
|
};
|
||||||
|
|
||||||
clk_enable(nmk_chip->clk);
|
clk_enable(nmk_chip->clk);
|
||||||
is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit);
|
is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit);
|
||||||
pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit);
|
pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit);
|
||||||
|
data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & bit);
|
||||||
mode = nmk_gpio_get_mode(gpio);
|
mode = nmk_gpio_get_mode(gpio);
|
||||||
if ((mode == NMK_GPIO_ALT_C) && pctldev)
|
if ((mode == NMK_GPIO_ALT_C) && pctldev)
|
||||||
mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio);
|
mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio);
|
||||||
|
|
||||||
seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s",
|
if (is_out) {
|
||||||
gpio, label ?: "(none)",
|
seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s",
|
||||||
is_out ? "out" : "in ",
|
gpio,
|
||||||
chip->get
|
label ?: "(none)",
|
||||||
? (chip->get(chip, offset) ? "hi" : "lo")
|
data_out ? "hi" : "lo",
|
||||||
: "? ",
|
(mode < 0) ? "unknown" : modes[mode]);
|
||||||
(mode < 0) ? "unknown" : modes[mode],
|
} else {
|
||||||
pull ? "pull" : "none");
|
|
||||||
|
|
||||||
if (!is_out) {
|
|
||||||
int irq = gpio_to_irq(gpio);
|
int irq = gpio_to_irq(gpio);
|
||||||
struct irq_desc *desc = irq_to_desc(irq);
|
struct irq_desc *desc = irq_to_desc(irq);
|
||||||
|
int pullidx = 0;
|
||||||
|
|
||||||
/* This races with request_irq(), set_irq_type(),
|
if (pull)
|
||||||
|
pullidx = data_out ? 1 : 2;
|
||||||
|
|
||||||
|
seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s",
|
||||||
|
gpio,
|
||||||
|
label ?: "(none)",
|
||||||
|
pulls[pullidx],
|
||||||
|
(mode < 0) ? "unknown" : modes[mode]);
|
||||||
|
/*
|
||||||
|
* This races with request_irq(), set_irq_type(),
|
||||||
* and set_irq_wake() ... but those are "rare".
|
* and set_irq_wake() ... but those are "rare".
|
||||||
*/
|
*/
|
||||||
if (irq > 0 && desc && desc->action) {
|
if (irq > 0 && desc && desc->action) {
|
||||||
|
Loading…
Reference in New Issue
Block a user