mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
![Heikki Krogerus](/assets/img/avatar_default.png)
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>
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef __USB_TYPEC_MUX
|
|
#define __USB_TYPEC_MUX
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/usb/typec.h>
|
|
|
|
struct device;
|
|
|
|
/**
|
|
* struct typec_switch - USB Type-C cable orientation switch
|
|
* @dev: Switch device
|
|
* @entry: List entry
|
|
* @set: Callback to the driver for setting the orientation
|
|
*
|
|
* USB Type-C pin flipper switch routing the correct data pairs from the
|
|
* connector to the USB controller depending on the orientation of the cable
|
|
* plug.
|
|
*/
|
|
struct typec_switch {
|
|
struct device *dev;
|
|
struct list_head entry;
|
|
|
|
int (*set)(struct typec_switch *sw, enum typec_orientation orientation);
|
|
};
|
|
|
|
/**
|
|
* struct typec_switch - USB Type-C connector pin mux
|
|
* @dev: Mux device
|
|
* @entry: List entry
|
|
* @set: Callback to the driver for setting the state of the mux
|
|
*
|
|
* Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to
|
|
* different components depending on the requested mode of operation. Used with
|
|
* Accessory/Alternate modes.
|
|
*/
|
|
struct typec_mux {
|
|
struct device *dev;
|
|
struct list_head entry;
|
|
|
|
int (*set)(struct typec_mux *mux, int state);
|
|
};
|
|
|
|
struct typec_switch *typec_switch_get(struct device *dev);
|
|
void typec_switch_put(struct typec_switch *sw);
|
|
int typec_switch_register(struct typec_switch *sw);
|
|
void typec_switch_unregister(struct typec_switch *sw);
|
|
|
|
struct typec_mux *typec_mux_get(struct device *dev);
|
|
void typec_mux_put(struct typec_mux *mux);
|
|
int typec_mux_register(struct typec_mux *mux);
|
|
void typec_mux_unregister(struct typec_mux *mux);
|
|
|
|
#endif /* __USB_TYPEC_MUX */
|