pinctrl: stm32: improve debugfs information of pinconf-pins entry
Print the name of the selected alternate function in addition to its number. Ex: "pin 135 (PI7): alternate 10 (SAI2_FS_A) - ..." Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com> Link: https://lore.kernel.org/r/20220502152524.283374-1-fabien.dessenne@foss.st.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Родитель
b983d423ce
Коммит
3296c473d9
|
@ -508,7 +508,7 @@ stm32_pctrl_find_group_by_pin(struct stm32_pinctrl *pctl, u32 pin)
|
||||||
static bool stm32_pctrl_is_function_valid(struct stm32_pinctrl *pctl,
|
static bool stm32_pctrl_is_function_valid(struct stm32_pinctrl *pctl,
|
||||||
u32 pin_num, u32 fnum)
|
u32 pin_num, u32 fnum)
|
||||||
{
|
{
|
||||||
int i;
|
int i, k;
|
||||||
|
|
||||||
for (i = 0; i < pctl->npins; i++) {
|
for (i = 0; i < pctl->npins; i++) {
|
||||||
const struct stm32_desc_pin *pin = pctl->pins + i;
|
const struct stm32_desc_pin *pin = pctl->pins + i;
|
||||||
|
@ -517,7 +517,7 @@ static bool stm32_pctrl_is_function_valid(struct stm32_pinctrl *pctl,
|
||||||
if (pin->pin.number != pin_num)
|
if (pin->pin.number != pin_num)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
while (func && func->name) {
|
for (k = 0; k < STM32_CONFIG_NUM; k++) {
|
||||||
if (func->num == fnum)
|
if (func->num == fnum)
|
||||||
return true;
|
return true;
|
||||||
func++;
|
func++;
|
||||||
|
@ -1119,10 +1119,27 @@ static int stm32_pconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct stm32_desc_pin *
|
||||||
|
stm32_pconf_get_pin_desc_by_pin_number(struct stm32_pinctrl *pctl,
|
||||||
|
unsigned int pin_number)
|
||||||
|
{
|
||||||
|
struct stm32_desc_pin *pins = pctl->pins;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < pctl->npins; i++) {
|
||||||
|
if (pins->pin.number == pin_number)
|
||||||
|
return pins;
|
||||||
|
pins++;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void stm32_pconf_dbg_show(struct pinctrl_dev *pctldev,
|
static void stm32_pconf_dbg_show(struct pinctrl_dev *pctldev,
|
||||||
struct seq_file *s,
|
struct seq_file *s,
|
||||||
unsigned int pin)
|
unsigned int pin)
|
||||||
{
|
{
|
||||||
|
struct stm32_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
|
||||||
|
const struct stm32_desc_pin *pin_desc;
|
||||||
struct pinctrl_gpio_range *range;
|
struct pinctrl_gpio_range *range;
|
||||||
struct stm32_gpio_bank *bank;
|
struct stm32_gpio_bank *bank;
|
||||||
int offset;
|
int offset;
|
||||||
|
@ -1172,7 +1189,12 @@ static void stm32_pconf_dbg_show(struct pinctrl_dev *pctldev,
|
||||||
case 2:
|
case 2:
|
||||||
drive = stm32_pconf_get_driving(bank, offset);
|
drive = stm32_pconf_get_driving(bank, offset);
|
||||||
speed = stm32_pconf_get_speed(bank, offset);
|
speed = stm32_pconf_get_speed(bank, offset);
|
||||||
seq_printf(s, "%d - %s - %s - %s %s", alt,
|
pin_desc = stm32_pconf_get_pin_desc_by_pin_number(pctl, pin);
|
||||||
|
if (!pin_desc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
seq_printf(s, "%d (%s) - %s - %s - %s %s", alt,
|
||||||
|
pin_desc->functions[alt + 1].name,
|
||||||
drive ? "open drain" : "push pull",
|
drive ? "open drain" : "push pull",
|
||||||
biasing[bias],
|
biasing[bias],
|
||||||
speeds[speed], "speed");
|
speeds[speed], "speed");
|
||||||
|
@ -1386,7 +1408,8 @@ static int stm32_pctrl_create_pins_tab(struct stm32_pinctrl *pctl,
|
||||||
if (pctl->pkg && !(pctl->pkg & p->pkg))
|
if (pctl->pkg && !(pctl->pkg & p->pkg))
|
||||||
continue;
|
continue;
|
||||||
pins->pin = p->pin;
|
pins->pin = p->pin;
|
||||||
pins->functions = p->functions;
|
memcpy((struct stm32_desc_pin *)pins->functions, p->functions,
|
||||||
|
STM32_CONFIG_NUM * sizeof(struct stm32_desc_function));
|
||||||
pins++;
|
pins++;
|
||||||
nb_pins_available++;
|
nb_pins_available++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#define STM32_PIN_GPIO 0
|
#define STM32_PIN_GPIO 0
|
||||||
#define STM32_PIN_AF(x) ((x) + 1)
|
#define STM32_PIN_AF(x) ((x) + 1)
|
||||||
#define STM32_PIN_ANALOG (STM32_PIN_AF(15) + 1)
|
#define STM32_PIN_ANALOG (STM32_PIN_AF(15) + 1)
|
||||||
|
#define STM32_CONFIG_NUM (STM32_PIN_ANALOG + 1)
|
||||||
|
|
||||||
/* package information */
|
/* package information */
|
||||||
#define STM32MP_PKG_AA BIT(0)
|
#define STM32MP_PKG_AA BIT(0)
|
||||||
|
@ -31,26 +32,26 @@ struct stm32_desc_function {
|
||||||
|
|
||||||
struct stm32_desc_pin {
|
struct stm32_desc_pin {
|
||||||
struct pinctrl_pin_desc pin;
|
struct pinctrl_pin_desc pin;
|
||||||
const struct stm32_desc_function *functions;
|
const struct stm32_desc_function functions[STM32_CONFIG_NUM];
|
||||||
const unsigned int pkg;
|
const unsigned int pkg;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STM32_PIN(_pin, ...) \
|
#define STM32_PIN(_pin, ...) \
|
||||||
{ \
|
{ \
|
||||||
.pin = _pin, \
|
.pin = _pin, \
|
||||||
.functions = (struct stm32_desc_function[]){ \
|
.functions = { \
|
||||||
__VA_ARGS__, { } }, \
|
__VA_ARGS__}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STM32_PIN_PKG(_pin, _pkg, ...) \
|
#define STM32_PIN_PKG(_pin, _pkg, ...) \
|
||||||
{ \
|
{ \
|
||||||
.pin = _pin, \
|
.pin = _pin, \
|
||||||
.pkg = _pkg, \
|
.pkg = _pkg, \
|
||||||
.functions = (struct stm32_desc_function[]){ \
|
.functions = { \
|
||||||
__VA_ARGS__, { } }, \
|
__VA_ARGS__}, \
|
||||||
}
|
}
|
||||||
#define STM32_FUNCTION(_num, _name) \
|
#define STM32_FUNCTION(_num, _name) \
|
||||||
{ \
|
[_num] = { \
|
||||||
.num = _num, \
|
.num = _num, \
|
||||||
.name = _name, \
|
.name = _name, \
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче