aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/mux.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2020-03-02 16:53:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-04 11:11:52 +0100
commit774a9df6aeac236282dc0ec711b73865b64ef6a1 (patch)
treeabfc37c5004516b465bc0a90aa507ca1213c1fea /drivers/usb/typec/mux.c
parentusb: typec: mux: Allow the muxes to be named (diff)
downloadlinux-dev-774a9df6aeac236282dc0ec711b73865b64ef6a1.tar.xz
linux-dev-774a9df6aeac236282dc0ec711b73865b64ef6a1.zip
usb: typec: mux: Add helpers for setting the mux state
Adding helpers typec_switch_set() and typec_mux_set() that simply call the ->set callback function of the mux. These functions make it possible to set the mux states also from outside the class code. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200302135353.56659-3-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/mux.c')
-rw-r--r--drivers/usb/typec/mux.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index 2a073614172a..800c140d7853 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -141,6 +141,16 @@ typec_switch_register(struct device *parent,
}
EXPORT_SYMBOL_GPL(typec_switch_register);
+int typec_switch_set(struct typec_switch *sw,
+ enum typec_orientation orientation)
+{
+ if (IS_ERR_OR_NULL(sw))
+ return 0;
+
+ return sw->set(sw, orientation);
+}
+EXPORT_SYMBOL_GPL(typec_switch_set);
+
/**
* typec_switch_unregister - Unregister USB Type-C orientation switch
* @sw: USB Type-C orientation switch
@@ -269,6 +279,15 @@ void typec_mux_put(struct typec_mux *mux)
}
EXPORT_SYMBOL_GPL(typec_mux_put);
+int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state)
+{
+ if (IS_ERR_OR_NULL(mux))
+ return 0;
+
+ return mux->set(mux, state);
+}
+EXPORT_SYMBOL_GPL(typec_mux_set);
+
static void typec_mux_release(struct device *dev)
{
kfree(to_typec_mux(dev));