From: Francesco Dolcini <francesco@dolcini.it>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Bjorn Andersson <andersson@kernel.org>
Subject: [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional
Date: Mon, 3 Jun 2024 10:35:58 +0200 [thread overview]
Message-ID: <20240603083558.9629-3-francesco@dolcini.it> (raw)
In-Reply-To: <20240603083558.9629-1-francesco@dolcini.it>
From: Francesco Dolcini <francesco.dolcini@toradex.com>
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>
---
v2:
- removed useless NULL check for optional enable gpio
---
drivers/usb/typec/mux/gpio-sbu-mux.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/mux/gpio-sbu-mux.c b/drivers/usb/typec/mux/gpio-sbu-mux.c
index 374168482d36..8902102c05a8 100644
--- a/drivers/usb/typec/mux/gpio-sbu-mux.c
+++ b/drivers/usb/typec/mux/gpio-sbu-mux.c
@@ -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");
--
2.39.2
next prev parent reply other threads:[~2024-06-03 8:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 8:35 [PATCH v2 0/2] " Francesco Dolcini
2024-06-03 8:35 ` [PATCH v2 1/2] dt-bindings: usb: gpio-sbu-mux: Make 'enable-gpios' optional Francesco Dolcini
2024-06-03 8:35 ` Francesco Dolcini [this message]
2024-06-03 10:10 ` [PATCH v2 2/2] usb: typec: mux: gpio-sbu: Make enable gpio optional Dmitry Baryshkov
2024-06-03 10:38 ` Heikki Krogerus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240603083558.9629-3-francesco@dolcini.it \
--to=francesco@dolcini.it \
--cc=andersson@kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=francesco.dolcini@toradex.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®