summaryrefslogtreecommitdiff
path: root/include/linux/usb/typec_mux.h
AgeCommit message (Collapse)Author
2020-03-04usb: typec: mux: Allow the mux handles to be requested with fwnodeHeikki Krogerus
Introducing fwnode_typec_switch_get() and fwnode_typec_mux_get() functions that work just like typec_switch_get() and typec_mux_get() but they take struct fwnode_handle as the first parameter instead of struct device. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200302135353.56659-4-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04usb: typec: mux: Add helpers for setting the mux stateHeikki Krogerus
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>
2020-03-04usb: typec: mux: Allow the muxes to be namedHeikki Krogerus
The mux devices have been named by using the name of the parent device as base until now, but if for example the parent device has multiple muxes that will not work. This makes it possible to supply the name for a mux during registration. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200302135353.56659-2-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: typec: Give the mux drivers all the details regarding the port stateHeikki Krogerus
Passing all the details that the alternate mode drivers provide to the mux drivers during mode changes. The mux drivers will in practice need to be able to make decisions on their own. It is not enough that they get only the requested port state. With the Thunderbolt 3 alternate mode for example the mux driver will need to consider also the capabilities of the cable before configuring the mux. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20191230142611.24921-13-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03usb: typec: Registering real device entries for the muxesHeikki Krogerus
Registering real device entries (struct device) for the mode muxes as well as for the orientation switches. The Type-C mux code was deliberately attempting to avoid creation of separate device entries for the orientation switch and the mode switch (alternate modes) because they are not physical devices. They are functions of a single physical multiplexer/demultiplexer switch device. Unfortunately because of the dependency we still have on the underlying mux device driver, we had to put in hacks like the one in the commit 3e3b81965cbf ("usb: typec: mux: Take care of driver module reference counting") to make sure the driver does not disappear from underneath us. Even with those hacks we were still left with a potential NUll pointer dereference scenario, so just creating the device entries, and letting the core take care of the dependencies. No more hacks needed. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-14usb: typec: Rationalize the API for the muxesHeikki Krogerus
Since with accessory modes there is no need for additional identification when requesting a handle to the mux, we can replace the second parameter that is passed to the typec_mux_get() function with a pointer to alternate mode description structure, and simply passing NULL with accessory modes. This change means the naming of the mux device connections can be updated. Alternate and Accessory Modes will both be handled with muxes named "mode-switch", and the orientation switches will be named "orientation-switch". Future identification of the alternate modes will be later done using device property "svid" of the mux. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-02usb: typec: mux: Get the mux identifier from function parameterHeikki Krogerus
In order for the muxes to be usable with alternate modes, the alternate mode devices will need also to be able to get a handle to the muxes on top of the port devices. To make that possible, the muxes need to be possible to request with an identifier. This will change the API so that the mux identifier is given as a function parameter to typec_mux_get(), and the hard-coded "typec-mux" is replaced with that value. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22usb: typec: API for controlling USB Type-C MultiplexersHeikki Krogerus
USB Type-C connectors consist of various muxes and switches that route the pins on the connector to the right locations. The USB Type-C drivers need to be able to control the muxes, as they are the ones that know things like the cable plug orientation, and the current mode that was negotiated with the partner. This introduces a small API for registering and controlling cable plug orientation switches, and separate small API for registering and controlling pin multiplexer/demultiplexer switches that are needed with Accessory/Alternate Modes. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>