Skip to content

Commit 69657e6

Browse files
Asmaa Mnebhilinusw
authored andcommitted
pinctrl: mlxbf3: Remove gpio_disable_free()
Remove support for gpio_disable_free() because it is called when the libgpiod command "gpioset" is invoked. This gives the GPIO control back to hardware which cancels out the effort to set the GPIO value. Reminder of the code flow to change a GPIO value from software: 1) All GPIOs are controlled by hardware by default 2) To change the GPIO value, enable software control via a mux. 3) Once software has control over the GPIO pin, the gpio-mlxbf3 driver will be able to change the direction and value of the GPIO. When the user runs "gpioset gpiochip0 0=0" for example, the gpio pin value should change from 1 to 0. In this case, mlxbf3_gpio_request_enable() is called via gpiochip_generic_request(). The latter switches GPIO control from hardware to software. Then the GPIO value is changed from 1 to 0. However, gpio_disable_free() is also called which changes control back to hardware which changes the GPIO value back to 1. Fixes: d11f932 ("pinctrl: mlxbf3: Add pinctrl driver support") Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230818164314.8505-2-asmaa@nvidia.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c0f8476 commit 69657e6

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

drivers/pinctrl/pinctrl-mlxbf3.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,26 +223,12 @@ static int mlxbf3_gpio_request_enable(struct pinctrl_dev *pctldev,
223223
return 0;
224224
}
225225

226-
static void mlxbf3_gpio_disable_free(struct pinctrl_dev *pctldev,
227-
struct pinctrl_gpio_range *range,
228-
unsigned int offset)
229-
{
230-
struct mlxbf3_pinctrl *priv = pinctrl_dev_get_drvdata(pctldev);
231-
232-
/* disable GPIO functionality by giving control back to hardware */
233-
if (offset < MLXBF3_NGPIOS_GPIO0)
234-
writel(BIT(offset), priv->fw_ctrl_clr0);
235-
else
236-
writel(BIT(offset % MLXBF3_NGPIOS_GPIO0), priv->fw_ctrl_clr1);
237-
}
238-
239226
static const struct pinmux_ops mlxbf3_pmx_ops = {
240227
.get_functions_count = mlxbf3_pmx_get_funcs_count,
241228
.get_function_name = mlxbf3_pmx_get_func_name,
242229
.get_function_groups = mlxbf3_pmx_get_groups,
243230
.set_mux = mlxbf3_pmx_set,
244231
.gpio_request_enable = mlxbf3_gpio_request_enable,
245-
.gpio_disable_free = mlxbf3_gpio_disable_free,
246232
};
247233

248234
static struct pinctrl_desc mlxbf3_pin_desc = {

0 commit comments

Comments
 (0)