Skip to content

Commit

Permalink
pinctrl: tegra: Add support to display pin function
Browse files Browse the repository at this point in the history
The current function for a given pin is not displayed via the debugfs.
Add support to display the current function that is set for each pin.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20230714113547.15384-1-pshete@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Prathamesh Shete authored and Linus Walleij committed Jul 20, 2023
1 parent f147624 commit d1cd5b5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 17 additions & 2 deletions drivers/pinctrl/tegra/pinctrl-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static const struct cfg_param {
{"nvidia,slew-rate-falling", TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING},
{"nvidia,slew-rate-rising", TEGRA_PINCONF_PARAM_SLEW_RATE_RISING},
{"nvidia,drive-type", TEGRA_PINCONF_PARAM_DRIVE_TYPE},
{"nvidia,function", TEGRA_PINCONF_PARAM_FUNCTION},
};

static int tegra_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
Expand Down Expand Up @@ -470,6 +471,12 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx,
*bit = g->drvtype_bit;
*width = 2;
break;
case TEGRA_PINCONF_PARAM_FUNCTION:
*bank = g->mux_bank;
*reg = g->mux_reg;
*bit = g->mux_bit;
*width = 2;
break;
default:
dev_err(pmx->dev, "Invalid config param %04x\n", param);
return -ENOTSUPP;
Expand Down Expand Up @@ -633,8 +640,16 @@ static void tegra_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
val >>= bit;
val &= (1 << width) - 1;

seq_printf(s, "\n\t%s=%u",
strip_prefix(cfg_params[i].property), val);
if (cfg_params[i].param == TEGRA_PINCONF_PARAM_FUNCTION) {
u8 idx = pmx->soc->groups[group].funcs[val];

seq_printf(s, "\n\t%s=%s",
strip_prefix(cfg_params[i].property),
pmx->functions[idx].name);
} else {
seq_printf(s, "\n\t%s=%u",
strip_prefix(cfg_params[i].property), val);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions drivers/pinctrl/tegra/pinctrl-tegra.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ enum tegra_pinconf_param {
TEGRA_PINCONF_PARAM_SLEW_RATE_RISING,
/* argument: Integer, range is HW-dependant */
TEGRA_PINCONF_PARAM_DRIVE_TYPE,
/* argument: pinmux settings */
TEGRA_PINCONF_PARAM_FUNCTION,
};

enum tegra_pinconf_pull {
Expand Down

0 comments on commit d1cd5b5

Please sign in to comment.