pinctrl: sunxi-pinctrl: fix pin funtion can not be match correctly.

Pin function can not be match correctly when SUNXI_PIN describe with
mutiple variant and same function.

such as:
on pinctrl-sun4i-a10.c

SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 2),
		SUNXI_FUNCTION(0x0, "gpio_in"),
		SUNXI_FUNCTION(0x1, "gpio_out"),
		SUNXI_FUNCTION_VARIANT(0x2, "pwm",    /* PWM0 */
			PINCTRL_SUN4I_A10 |
			PINCTRL_SUN7I_A20),
		SUNXI_FUNCTION_VARIANT(0x3, "pwm",    /* PWM0 */
			PINCTRL_SUN8I_R40)),

it would always match to the first variant function
(PINCTRL_SUN4I_A10, PINCTRL_SUN7I_A20)

so we should add variant compare on it.

Signed-off-by: hao_zhang <hao5781286@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
hao_zhang 2018-01-09 13:59:02 +08:00 committed by Linus Walleij
parent a3a093ae02
commit 32e21f084f
1 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,9 @@ sunxi_pinctrl_desc_find_function_by_name(struct sunxi_pinctrl *pctl,
struct sunxi_desc_function *func = pin->functions; struct sunxi_desc_function *func = pin->functions;
while (func->name) { while (func->name) {
if (!strcmp(func->name, func_name)) if (!strcmp(func->name, func_name) &&
(!func->variant ||
func->variant & pctl->variant))
return func; return func;
func++; func++;