]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: typec: mux: gpio-sbu: Make enable gpio optional
authorFrancesco Dolcini <francesco.dolcini@toradex.com>
Mon, 3 Jun 2024 08:35:58 +0000 (10:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Jun 2024 13:44:57 +0000 (15:44 +0200)
The enable gpio is not required when the SBU mux is used only for
orientation, make it optional.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240603083558.9629-3-francesco@dolcini.it
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/mux/gpio-sbu-mux.c

index 374168482d36348f2b50dcc589d5f5ce9c45c272..8902102c05a8ecdb7a8136415117f0c2aa48261a 100644 (file)
@@ -66,6 +66,9 @@ static int gpio_sbu_mux_set(struct typec_mux_dev *mux,
 {
        struct gpio_sbu_mux *sbu_mux = typec_mux_get_drvdata(mux);
 
+       if (!sbu_mux->enable_gpio)
+               return -EOPNOTSUPP;
+
        mutex_lock(&sbu_mux->lock);
 
        switch (state->mode) {
@@ -102,7 +105,8 @@ static int gpio_sbu_mux_probe(struct platform_device *pdev)
 
        mutex_init(&sbu_mux->lock);
 
-       sbu_mux->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+       sbu_mux->enable_gpio = devm_gpiod_get_optional(dev, "enable",
+                                                      GPIOD_OUT_LOW);
        if (IS_ERR(sbu_mux->enable_gpio))
                return dev_err_probe(dev, PTR_ERR(sbu_mux->enable_gpio),
                                     "unable to acquire enable gpio\n");