Skip to content

Commit a5d093d

Browse files
diandersgregkh
authored andcommitted
pinctrl: msm: Fix msm_config_group_get() to be compliant
[ Upstream commit 05e0c82 ] If you do this on an sdm845 board: cat /sys/kernel/debug/pinctrl/3400000.pinctrl/pinconf-groups ...it looks like nonsense. For every pin you see listed: input bias bus hold, input bias disabled, input bias pull down, input bias pull up That's because msm_config_group_get() isn't complying with the rules that pinconf_generic_dump_one() expects. Specifically for boolean parameters (anything with a "struct pin_config_item" where has_arg is false) the function expects that the function should return its value not through the "config" parameter but should return "0" if the value is set and "-EINVAL" if the value isn't set. Let's fix this. >From a quick sample of other pinctrl drivers, it appears to be tradition to also return 1 through the config parameter for these boolean parameters when they exist. I'm not one to knock tradition, so I'll follow tradition and return 1 in these cases. While I'm at it, I'll also continue searching for four leaf clovers, kocking on wood three times, and trying not to break mirrors. Fixes: f365be0 ("pinctrl: Add Qualcomm TLMM driver") Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b520f00 commit a5d093d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/pinctrl/qcom/pinctrl-msm.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,30 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
238238
/* Convert register value to pinconf value */
239239
switch (param) {
240240
case PIN_CONFIG_BIAS_DISABLE:
241-
arg = arg == MSM_NO_PULL;
241+
if (arg != MSM_NO_PULL)
242+
return -EINVAL;
243+
arg = 1;
242244
break;
243245
case PIN_CONFIG_BIAS_PULL_DOWN:
244-
arg = arg == MSM_PULL_DOWN;
246+
if (arg != MSM_PULL_DOWN)
247+
return -EINVAL;
248+
arg = 1;
245249
break;
246250
case PIN_CONFIG_BIAS_BUS_HOLD:
247251
if (pctrl->soc->pull_no_keeper)
248252
return -ENOTSUPP;
249253

250-
arg = arg == MSM_KEEPER;
254+
if (arg != MSM_KEEPER)
255+
return -EINVAL;
256+
arg = 1;
251257
break;
252258
case PIN_CONFIG_BIAS_PULL_UP:
253259
if (pctrl->soc->pull_no_keeper)
254260
arg = arg == MSM_PULL_UP_NO_KEEPER;
255261
else
256262
arg = arg == MSM_PULL_UP;
263+
if (!arg)
264+
return -EINVAL;
257265
break;
258266
case PIN_CONFIG_DRIVE_STRENGTH:
259267
arg = msm_regval_to_drive(arg);

0 commit comments

Comments
 (0)