Commit 3d122e6d authored by Francesco Dolcini's avatar Francesco Dolcini Committed by Greg Kroah-Hartman

usb: typec: mux: gpio-sbu: Allow GPIO operations to sleep

Use gpiod_set_value_cansleep() to support gpiochips which can
sleep like, e.g. I2C GPIO expanders.
Signed-off-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240409190910.4707-1-francesco@dolcini.itSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1a395af9
...@@ -48,10 +48,10 @@ static int gpio_sbu_switch_set(struct typec_switch_dev *sw, ...@@ -48,10 +48,10 @@ static int gpio_sbu_switch_set(struct typec_switch_dev *sw,
} }
if (enabled != sbu_mux->enabled) if (enabled != sbu_mux->enabled)
gpiod_set_value(sbu_mux->enable_gpio, enabled); gpiod_set_value_cansleep(sbu_mux->enable_gpio, enabled);
if (swapped != sbu_mux->swapped) if (swapped != sbu_mux->swapped)
gpiod_set_value(sbu_mux->select_gpio, swapped); gpiod_set_value_cansleep(sbu_mux->select_gpio, swapped);
sbu_mux->enabled = enabled; sbu_mux->enabled = enabled;
sbu_mux->swapped = swapped; sbu_mux->swapped = swapped;
...@@ -82,7 +82,7 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux, ...@@ -82,7 +82,7 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
break; break;
} }
gpiod_set_value(sbu_mux->enable_gpio, sbu_mux->enabled); gpiod_set_value_cansleep(sbu_mux->enable_gpio, sbu_mux->enabled);
mutex_unlock(&sbu_mux->lock); mutex_unlock(&sbu_mux->lock);
...@@ -141,7 +141,7 @@ static void gpio_sbu_mux_remove(struct platform_device *pdev) ...@@ -141,7 +141,7 @@ static void gpio_sbu_mux_remove(struct platform_device *pdev)
{ {
struct gpio_sbu_mux *sbu_mux = platform_get_drvdata(pdev); struct gpio_sbu_mux *sbu_mux = platform_get_drvdata(pdev);
gpiod_set_value(sbu_mux->enable_gpio, 0); gpiod_set_value_cansleep(sbu_mux->enable_gpio, 0);
typec_mux_unregister(sbu_mux->mux); typec_mux_unregister(sbu_mux->mux);
typec_switch_unregister(sbu_mux->sw); typec_switch_unregister(sbu_mux->sw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment