Skip to contentSkip to conversation

pinctrl: qcom: fail to retrieve configuration from invalid pin groups

PATCH In review Richard Acayan 2 participants 2 messages Nov 28, 2023 – Dec 4, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: qcom: fail to retrieve configuration from invalid pin groups

The pinconf-groups debugfs file dumps each valid configuration item of all pin groups. Some platforms and devices may have pin groups which cannot be accessed, according to commit 691bf5d5a7bf ("pinctrl: qcom:
Don't allow protected pins to be requested"). Fail for each configuration item of an invalid pin group by checking the GPIO chip's valid mask.

The validity of the pin group cannot be checked in the generic pinconf dump (function "pinconf_generic_dump_one"), as it does not directly interact with the gpiochip or the pinmux callbacks (which would give it access to the request callback). Instead, an entry contains the ID and name of the pingroup with no properties when all items fail.

---
First few lines of pinconf-generic on SDM670 with this patch:

    Pin config settings per pin group
    Format: group (name): configs
    0 (gpio0):
    1 (gpio1):
    2 (gpio2):
    3 (gpio3):
    4 (gpio4): input bias disabled, output drive strength (16 mA), output enabled, pin output (0 level)
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/pinctrl/qcom/pinctrl-msm.c +4 -0
index 395040346d0f..0392b99d8be3 100644
@@ -358,6 +358,10 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
 	int ret;
 	u32 val;
 
+	/* Pin information can only be requested from valid pin groups */
+	if (!gpiochip_line_is_valid(&pctrl->chip, group))
+		return -EINVAL;
+
 	g = &pctrl->soc->groups[group];
 
 	ret = msm_config_reg(pctrl, g, param, &mask, &bit);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 7 lines · Richard Acayan

The pinconf-groups debugfs file dumps each valid configuration item of all pin groups. Some platforms and devices may have pin groups which cannot be accessed, according to commit 691bf5d5a7bf ("pinctrl: qcom:
Don't allow protected pins to be requested"). Fail for each configuration item of an invalid pin group by checking the GPIO chip's valid mask.

Quoted 7 lines

The validity of the pin group cannot be checked in the generic pinconf dump (function "pinconf_generic_dump_one"), as it does not directly interact with the gpiochip or the pinmux callbacks (which would give it access to the request callback). Instead, an entry contains the ID and name of the pingroup with no properties when all items fail.

Looks reasonable so patch applied.

Yours,
Linus Walleij