linux/drivers/usb/typec/class.c

// SPDX-License-Identifier: GPL-2.0
/*
 * USB Type-C Connector Class
 *
 * Copyright (C) 2017, Intel Corporation
 * Author: Heikki Krogerus <[email protected]>
 */

#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/usb/pd_vdo.h>
#include <linux/usb/typec_mux.h>
#include <linux/usb/typec_retimer.h>
#include <linux/usb.h>

#include "bus.h"
#include "class.h"
#include "pd.h"

static DEFINE_IDA(typec_index_ida);

const struct class typec_class =;

/* ------------------------------------------------------------------------- */
/* Common attributes */

static const char * const typec_accessory_modes[] =;

/* Product types defined in USB PD Specification R3.0 V2.0 */
static const char * const product_type_ufp[8] =;

static const char * const product_type_dfp[8] =;

static const char * const product_type_cable[8] =;

static struct usb_pd_identity *get_pd_identity(struct device *dev)
{}

static const char *get_pd_product_type(struct device *dev)
{}

static ssize_t id_header_show(struct device *dev, struct device_attribute *attr,
			      char *buf)
{}
static DEVICE_ATTR_RO(id_header);

static ssize_t cert_stat_show(struct device *dev, struct device_attribute *attr,
			      char *buf)
{}
static DEVICE_ATTR_RO(cert_stat);

static ssize_t product_show(struct device *dev, struct device_attribute *attr,
			    char *buf)
{}
static DEVICE_ATTR_RO(product);

static ssize_t product_type_vdo1_show(struct device *dev, struct device_attribute *attr,
				      char *buf)
{}
static DEVICE_ATTR_RO(product_type_vdo1);

static ssize_t product_type_vdo2_show(struct device *dev, struct device_attribute *attr,
				      char *buf)
{}
static DEVICE_ATTR_RO(product_type_vdo2);

static ssize_t product_type_vdo3_show(struct device *dev, struct device_attribute *attr,
				      char *buf)
{}
static DEVICE_ATTR_RO(product_type_vdo3);

static struct attribute *usb_pd_id_attrs[] =;

static const struct attribute_group usb_pd_id_group =;

static const struct attribute_group *usb_pd_id_groups[] =;

static void typec_product_type_notify(struct device *dev)
{}

static void typec_report_identity(struct device *dev)
{}

static ssize_t
type_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(type);

static ssize_t usb_power_delivery_revision_show(struct device *dev,
						struct device_attribute *attr,
						char *buf);
static DEVICE_ATTR_RO(usb_power_delivery_revision);

/* ------------------------------------------------------------------------- */
/* Alternate Modes */

static int altmode_match(struct device *dev, void *data)
{}

static void typec_altmode_set_partner(struct altmode *altmode)
{}

static void typec_altmode_put_partner(struct altmode *altmode)
{}

/**
 * typec_altmode_update_active - Report Enter/Exit mode
 * @adev: Handle to the alternate mode
 * @active: True when the mode has been entered
 *
 * If a partner or cable plug executes Enter/Exit Mode command successfully, the
 * drivers use this routine to report the updated state of the mode.
 */
void typec_altmode_update_active(struct typec_altmode *adev, bool active)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_altmode2port - Alternate Mode to USB Type-C port
 * @alt: The Alternate Mode
 *
 * Returns handle to the port that a cable plug or partner with @alt is
 * connected to.
 */
struct typec_port *typec_altmode2port(struct typec_altmode *alt)
{}
EXPORT_SYMBOL_GPL();

static ssize_t
vdo_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(vdo);

static ssize_t
description_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(description);

static ssize_t
active_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t active_store(struct device *dev, struct device_attribute *attr,
			    const char *buf, size_t size)
{}
static DEVICE_ATTR_RW(active);

static ssize_t
supported_roles_show(struct device *dev, struct device_attribute *attr,
		     char *buf)
{}
static DEVICE_ATTR_RO(supported_roles);

static ssize_t
mode_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(mode);

static ssize_t
svid_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(svid);

static struct attribute *typec_altmode_attrs[] =;

static umode_t typec_altmode_attr_is_visible(struct kobject *kobj,
					     struct attribute *attr, int n)
{}

static const struct attribute_group typec_altmode_group =;

static const struct attribute_group *typec_altmode_groups[] =;

/**
 * typec_altmode_set_ops - Set ops for altmode
 * @adev: Handle to the alternate mode
 * @ops: Ops for the alternate mode
 *
 * After setting ops, attribute visiblity needs to be refreshed if the alternate
 * mode can be activated.
 */
void typec_altmode_set_ops(struct typec_altmode *adev,
			   const struct typec_altmode_ops *ops)
{}
EXPORT_SYMBOL_GPL();

static int altmode_id_get(struct device *dev)
{}

static void altmode_id_remove(struct device *dev, int id)
{}

static void typec_altmode_release(struct device *dev)
{}

const struct device_type typec_altmode_dev_type =;

static struct typec_altmode *
typec_register_altmode(struct device *parent,
		       const struct typec_altmode_desc *desc)
{}

/**
 * typec_unregister_altmode - Unregister Alternate Mode
 * @adev: The alternate mode to be unregistered
 *
 * Unregister device created with typec_partner_register_altmode(),
 * typec_plug_register_altmode() or typec_port_register_altmode().
 */
void typec_unregister_altmode(struct typec_altmode *adev)
{}
EXPORT_SYMBOL_GPL();

/* ------------------------------------------------------------------------- */
/* Type-C Partners */

static ssize_t accessory_mode_show(struct device *dev,
				   struct device_attribute *attr,
				   char *buf)
{}
static DEVICE_ATTR_RO(accessory_mode);

static ssize_t supports_usb_power_delivery_show(struct device *dev,
						struct device_attribute *attr,
						char *buf)
{}
static DEVICE_ATTR_RO(supports_usb_power_delivery);

static ssize_t number_of_alternate_modes_show(struct device *dev, struct device_attribute *attr,
					      char *buf)
{}
static DEVICE_ATTR_RO(number_of_alternate_modes);

static struct attribute *typec_partner_attrs[] =;

static umode_t typec_partner_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n)
{}

static const struct attribute_group typec_partner_group =;

static const struct attribute_group *typec_partner_groups[] =;

static void typec_partner_release(struct device *dev)
{}

const struct device_type typec_partner_dev_type =;

static void typec_partner_link_device(struct typec_partner *partner, struct device *dev)
{}

static void typec_partner_unlink_device(struct typec_partner *partner, struct device *dev)
{}

/**
 * typec_partner_set_identity - Report result from Discover Identity command
 * @partner: The partner updated identity values
 *
 * This routine is used to report that the result of Discover Identity USB power
 * delivery command has become available.
 */
int typec_partner_set_identity(struct typec_partner *partner)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_partner_set_pd_revision - Set the PD revision supported by the partner
 * @partner: The partner to be updated.
 * @pd_revision:  USB Power Delivery Specification Revision supported by partner
 *
 * This routine is used to report that the PD revision of the port partner has
 * become available.
 */
void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd_revision)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_partner_set_usb_power_delivery - Declare USB Power Delivery Contract.
 * @partner: The partner device.
 * @pd: The USB PD instance.
 *
 * This routine can be used to declare USB Power Delivery Contract with @partner
 * by linking @partner to @pd which contains the objects that were used during the
 * negotiation of the contract.
 *
 * If @pd is NULL, the link is removed and the contract with @partner has ended.
 */
int typec_partner_set_usb_power_delivery(struct typec_partner *partner,
					 struct usb_power_delivery *pd)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_partner_set_num_altmodes - Set the number of available partner altmodes
 * @partner: The partner to be updated.
 * @num_altmodes: The number of altmodes we want to specify as available.
 *
 * This routine is used to report the number of alternate modes supported by the
 * partner. This value is *not* enforced in alternate mode registration routines.
 *
 * @partner.num_altmodes is set to -1 on partner registration, denoting that
 * a valid value has not been set for it yet.
 *
 * Returns 0 on success or negative error number on failure.
 */
int typec_partner_set_num_altmodes(struct typec_partner *partner, int num_altmodes)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_partner_register_altmode - Register USB Type-C Partner Alternate Mode
 * @partner: USB Type-C Partner that supports the alternate mode
 * @desc: Description of the alternate mode
 *
 * This routine is used to register each alternate mode individually that
 * @partner has listed in response to Discover SVIDs command. The modes for a
 * SVID listed in response to Discover Modes command need to be listed in an
 * array in @desc.
 *
 * Returns handle to the alternate mode on success or ERR_PTR on failure.
 */
struct typec_altmode *
typec_partner_register_altmode(struct typec_partner *partner,
			       const struct typec_altmode_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_partner_set_svdm_version - Set negotiated Structured VDM (SVDM) Version
 * @partner: USB Type-C Partner that supports SVDM
 * @svdm_version: Negotiated SVDM Version
 *
 * This routine is used to save the negotiated SVDM Version.
 */
void typec_partner_set_svdm_version(struct typec_partner *partner,
				   enum usb_pd_svdm_ver svdm_version)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_partner_usb_power_delivery_register - Register Type-C partner USB Power Delivery Support
 * @partner: Type-C partner device.
 * @desc: Description of the USB PD contract.
 *
 * This routine is a wrapper around usb_power_delivery_register(). It registers
 * USB Power Delivery Capabilities for a Type-C partner device. Specifically,
 * it sets the Type-C partner device as a parent for the resulting USB Power Delivery object.
 *
 * Returns handle to struct usb_power_delivery or ERR_PTR.
 */
struct usb_power_delivery *
typec_partner_usb_power_delivery_register(struct typec_partner *partner,
					  struct usb_power_delivery_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_register_partner - Register a USB Type-C Partner
 * @port: The USB Type-C Port the partner is connected to
 * @desc: Description of the partner
 *
 * Registers a device for USB Type-C Partner described in @desc.
 *
 * Returns handle to the partner on success or ERR_PTR on failure.
 */
struct typec_partner *typec_register_partner(struct typec_port *port,
					     struct typec_partner_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_unregister_partner - Unregister a USB Type-C Partner
 * @partner: The partner to be unregistered
 *
 * Unregister device created with typec_register_partner().
 */
void typec_unregister_partner(struct typec_partner *partner)
{}
EXPORT_SYMBOL_GPL();

/* ------------------------------------------------------------------------- */
/* Type-C Cable Plugs */

static void typec_plug_release(struct device *dev)
{}

static struct attribute *typec_plug_attrs[] =;

static umode_t typec_plug_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n)
{}

static const struct attribute_group typec_plug_group =;

static const struct attribute_group *typec_plug_groups[] =;

const struct device_type typec_plug_dev_type =;

/**
 * typec_plug_set_num_altmodes - Set the number of available plug altmodes
 * @plug: The plug to be updated.
 * @num_altmodes: The number of altmodes we want to specify as available.
 *
 * This routine is used to report the number of alternate modes supported by the
 * plug. This value is *not* enforced in alternate mode registration routines.
 *
 * @plug.num_altmodes is set to -1 on plug registration, denoting that
 * a valid value has not been set for it yet.
 *
 * Returns 0 on success or negative error number on failure.
 */
int typec_plug_set_num_altmodes(struct typec_plug *plug, int num_altmodes)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_plug_register_altmode - Register USB Type-C Cable Plug Alternate Mode
 * @plug: USB Type-C Cable Plug that supports the alternate mode
 * @desc: Description of the alternate mode
 *
 * This routine is used to register each alternate mode individually that @plug
 * has listed in response to Discover SVIDs command. The modes for a SVID that
 * the plug lists in response to Discover Modes command need to be listed in an
 * array in @desc.
 *
 * Returns handle to the alternate mode on success or ERR_PTR on failure.
 */
struct typec_altmode *
typec_plug_register_altmode(struct typec_plug *plug,
			    const struct typec_altmode_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_register_plug - Register a USB Type-C Cable Plug
 * @cable: USB Type-C Cable with the plug
 * @desc: Description of the cable plug
 *
 * Registers a device for USB Type-C Cable Plug described in @desc. A USB Type-C
 * Cable Plug represents a plug with electronics in it that can response to USB
 * Power Delivery SOP Prime or SOP Double Prime packages.
 *
 * Returns handle to the cable plug on success or ERR_PTR on failure.
 */
struct typec_plug *typec_register_plug(struct typec_cable *cable,
				       struct typec_plug_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_unregister_plug - Unregister a USB Type-C Cable Plug
 * @plug: The cable plug to be unregistered
 *
 * Unregister device created with typec_register_plug().
 */
void typec_unregister_plug(struct typec_plug *plug)
{}
EXPORT_SYMBOL_GPL();

/* Type-C Cables */

static const char * const typec_plug_types[] =;

static ssize_t plug_type_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(plug_type);

static struct attribute *typec_cable_attrs[] =;
ATTRIBUTE_GROUPS();

static void typec_cable_release(struct device *dev)
{}

const struct device_type typec_cable_dev_type =;

static int cable_match(struct device *dev, void *data)
{}

/**
 * typec_cable_get - Get a reference to the USB Type-C cable
 * @port: The USB Type-C Port the cable is connected to
 *
 * The caller must decrement the reference count with typec_cable_put() after
 * use.
 */
struct typec_cable *typec_cable_get(struct typec_port *port)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_cable_put - Decrement the reference count on USB Type-C cable
 * @cable: The USB Type-C cable
 */
void typec_cable_put(struct typec_cable *cable)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_cable_is_active - Check is the USB Type-C cable active or passive
 * @cable: The USB Type-C Cable
 *
 * Return 1 if the cable is active or 0 if it's passive.
 */
int typec_cable_is_active(struct typec_cable *cable)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_cable_set_identity - Report result from Discover Identity command
 * @cable: The cable updated identity values
 *
 * This routine is used to report that the result of Discover Identity USB power
 * delivery command has become available.
 */
int typec_cable_set_identity(struct typec_cable *cable)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_register_cable - Register a USB Type-C Cable
 * @port: The USB Type-C Port the cable is connected to
 * @desc: Description of the cable
 *
 * Registers a device for USB Type-C Cable described in @desc. The cable will be
 * parent for the optional cable plug devises.
 *
 * Returns handle to the cable on success or ERR_PTR on failure.
 */
struct typec_cable *typec_register_cable(struct typec_port *port,
					 struct typec_cable_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_unregister_cable - Unregister a USB Type-C Cable
 * @cable: The cable to be unregistered
 *
 * Unregister device created with typec_register_cable().
 */
void typec_unregister_cable(struct typec_cable *cable)
{}
EXPORT_SYMBOL_GPL();

/* ------------------------------------------------------------------------- */
/* USB Type-C ports */

/**
 * typec_port_set_usb_power_delivery - Assign USB PD for port.
 * @port: USB Type-C port.
 * @pd: USB PD instance.
 *
 * This routine can be used to set the USB Power Delivery Capabilities for @port
 * that it will advertise to the partner.
 *
 * If @pd is NULL, the assignment is removed.
 */
int typec_port_set_usb_power_delivery(struct typec_port *port, struct usb_power_delivery *pd)
{}
EXPORT_SYMBOL_GPL();

static ssize_t select_usb_power_delivery_store(struct device *dev,
					       struct device_attribute *attr,
					       const char *buf, size_t size)
{}

static ssize_t select_usb_power_delivery_show(struct device *dev,
					      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RW(select_usb_power_delivery);

static struct attribute *port_attrs[] =;

static umode_t port_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n)
{}

static const struct attribute_group pd_group =;

static const char * const typec_orientations[] =;

static const char * const typec_roles[] =;

static const char * const typec_data_roles[] =;

static const char * const typec_port_power_roles[] =;

static const char * const typec_port_data_roles[] =;

static const char * const typec_port_types_drp[] =;

static ssize_t
preferred_role_store(struct device *dev, struct device_attribute *attr,
		     const char *buf, size_t size)
{}

static ssize_t
preferred_role_show(struct device *dev, struct device_attribute *attr,
		    char *buf)
{}
static DEVICE_ATTR_RW(preferred_role);

static ssize_t data_role_store(struct device *dev,
			       struct device_attribute *attr,
			       const char *buf, size_t size)
{}

static ssize_t data_role_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RW(data_role);

static ssize_t power_role_store(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t size)
{}

static ssize_t power_role_show(struct device *dev,
			       struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RW(power_role);

static ssize_t
port_type_store(struct device *dev, struct device_attribute *attr,
			const char *buf, size_t size)
{}

static ssize_t
port_type_show(struct device *dev, struct device_attribute *attr,
		char *buf)
{}
static DEVICE_ATTR_RW(port_type);

static const char * const typec_pwr_opmodes[] =;

static ssize_t power_operation_mode_show(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{}
static DEVICE_ATTR_RO(power_operation_mode);

static ssize_t vconn_source_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t size)
{}

static ssize_t vconn_source_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RW(vconn_source);

static ssize_t supported_accessory_modes_show(struct device *dev,
					      struct device_attribute *attr,
					      char *buf)
{}
static DEVICE_ATTR_RO(supported_accessory_modes);

static ssize_t usb_typec_revision_show(struct device *dev,
				       struct device_attribute *attr,
				       char *buf)
{}
static DEVICE_ATTR_RO(usb_typec_revision);

static ssize_t usb_power_delivery_revision_show(struct device *dev,
						struct device_attribute *attr,
						char *buf)
{}

static ssize_t orientation_show(struct device *dev,
				   struct device_attribute *attr,
				   char *buf)
{}
static DEVICE_ATTR_RO(orientation);

static struct attribute *typec_attrs[] =;

static umode_t typec_attr_is_visible(struct kobject *kobj,
				     struct attribute *attr, int n)
{}

static const struct attribute_group typec_group =;

static const struct attribute_group *typec_groups[] =;

static int typec_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}

static void typec_release(struct device *dev)
{}

const struct device_type typec_port_dev_type =;

/* --------------------------------------- */
/* Driver callbacks to report role updates */

static int partner_match(struct device *dev, void *data)
{}

static struct typec_partner *typec_get_partner(struct typec_port *port)
{}

static void typec_partner_attach(struct typec_connector *con, struct device *dev)
{}

static void typec_partner_deattach(struct typec_connector *con, struct device *dev)
{}

/**
 * typec_set_data_role - Report data role change
 * @port: The USB Type-C Port where the role was changed
 * @role: The new data role
 *
 * This routine is used by the port drivers to report data role changes.
 */
void typec_set_data_role(struct typec_port *port, enum typec_data_role role)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_set_pwr_role - Report power role change
 * @port: The USB Type-C Port where the role was changed
 * @role: The new data role
 *
 * This routine is used by the port drivers to report power role changes.
 */
void typec_set_pwr_role(struct typec_port *port, enum typec_role role)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_set_vconn_role - Report VCONN source change
 * @port: The USB Type-C Port which VCONN role changed
 * @role: Source when @port is sourcing VCONN, or Sink when it's not
 *
 * This routine is used by the port drivers to report if the VCONN source is
 * changes.
 */
void typec_set_vconn_role(struct typec_port *port, enum typec_role role)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_set_pwr_opmode - Report changed power operation mode
 * @port: The USB Type-C Port where the mode was changed
 * @opmode: New power operation mode
 *
 * This routine is used by the port drivers to report changed power operation
 * mode in @port. The modes are USB (default), 1.5A, 3.0A as defined in USB
 * Type-C specification, and "USB Power Delivery" when the power levels are
 * negotiated with methods defined in USB Power Delivery specification.
 */
void typec_set_pwr_opmode(struct typec_port *port,
			  enum typec_pwr_opmode opmode)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_find_pwr_opmode - Get the typec power operation mode capability
 * @name: power operation mode string
 *
 * This routine is used to find the typec_pwr_opmode by its string @name.
 *
 * Returns typec_pwr_opmode if success, otherwise negative error code.
 */
int typec_find_pwr_opmode(const char *name)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_find_orientation - Convert orientation string to enum typec_orientation
 * @name: Orientation string
 *
 * This routine is used to find the typec_orientation by its string name @name.
 *
 * Returns the orientation value on success, otherwise negative error code.
 */
int typec_find_orientation(const char *name)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_find_port_power_role - Get the typec port power capability
 * @name: port power capability string
 *
 * This routine is used to find the typec_port_type by its string name.
 *
 * Returns typec_port_type if success, otherwise negative error code.
 */
int typec_find_port_power_role(const char *name)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_find_power_role - Find the typec one specific power role
 * @name: power role string
 *
 * This routine is used to find the typec_role by its string name.
 *
 * Returns typec_role if success, otherwise negative error code.
 */
int typec_find_power_role(const char *name)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_find_port_data_role - Get the typec port data capability
 * @name: port data capability string
 *
 * This routine is used to find the typec_port_data by its string name.
 *
 * Returns typec_port_data if success, otherwise negative error code.
 */
int typec_find_port_data_role(const char *name)
{}
EXPORT_SYMBOL_GPL();

/* ------------------------------------------ */
/* API for Multiplexer/DeMultiplexer Switches */

/**
 * typec_set_orientation - Set USB Type-C cable plug orientation
 * @port: USB Type-C Port
 * @orientation: USB Type-C cable plug orientation
 *
 * Set cable plug orientation for @port.
 */
int typec_set_orientation(struct typec_port *port,
			  enum typec_orientation orientation)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_get_orientation - Get USB Type-C cable plug orientation
 * @port: USB Type-C Port
 *
 * Get current cable plug orientation for @port.
 */
enum typec_orientation typec_get_orientation(struct typec_port *port)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_set_mode - Set mode of operation for USB Type-C connector
 * @port: USB Type-C connector
 * @mode: Accessory Mode, USB Operation or Safe State
 *
 * Configure @port for Accessory Mode @mode. This function will configure the
 * muxes needed for @mode.
 */
int typec_set_mode(struct typec_port *port, int mode)
{}
EXPORT_SYMBOL_GPL();

/* --------------------------------------- */

/**
 * typec_get_negotiated_svdm_version - Get negotiated SVDM Version
 * @port: USB Type-C Port.
 *
 * Get the negotiated SVDM Version. The Version is set to the port default
 * value stored in typec_capability on partner registration, and updated after
 * a successful Discover Identity if the negotiated value is less than the
 * default value.
 *
 * Returns usb_pd_svdm_ver if the partner has been registered otherwise -ENODEV.
 */
int typec_get_negotiated_svdm_version(struct typec_port *port)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_get_cable_svdm_version - Get cable negotiated SVDM Version
 * @port: USB Type-C Port.
 *
 * Get the negotiated SVDM Version for the cable. The Version is set to the port
 * default value based on the PD Revision during cable registration, and updated
 * after a successful Discover Identity if the negotiated value is less than the
 * default.
 *
 * Returns usb_pd_svdm_ver if the cable has been registered otherwise -ENODEV.
 */
int typec_get_cable_svdm_version(struct typec_port *port)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_cable_set_svdm_version - Set negotiated Structured VDM (SVDM) Version
 * @cable: USB Type-C Active Cable that supports SVDM
 * @svdm_version: Negotiated SVDM Version
 *
 * This routine is used to save the negotiated SVDM Version.
 */
void typec_cable_set_svdm_version(struct typec_cable *cable, enum usb_pd_svdm_ver svdm_version)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_get_drvdata - Return private driver data pointer
 * @port: USB Type-C port
 */
void *typec_get_drvdata(struct typec_port *port)
{}
EXPORT_SYMBOL_GPL();

int typec_get_fw_cap(struct typec_capability *cap,
		     struct fwnode_handle *fwnode)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_port_register_altmode - Register USB Type-C Port Alternate Mode
 * @port: USB Type-C Port that supports the alternate mode
 * @desc: Description of the alternate mode
 *
 * This routine is used to register an alternate mode that @port is capable of
 * supporting.
 *
 * Returns handle to the alternate mode on success or ERR_PTR on failure.
 */
struct typec_altmode *
typec_port_register_altmode(struct typec_port *port,
			    const struct typec_altmode_desc *desc)
{}
EXPORT_SYMBOL_GPL();

void typec_port_register_altmodes(struct typec_port *port,
	const struct typec_altmode_ops *ops, void *drvdata,
	struct typec_altmode **altmodes, size_t n)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_port_register_cable_ops - Register typec_cable_ops to port altmodes
 * @altmodes: USB Type-C Port's altmode vector
 * @max_altmodes: The maximum number of alt modes supported by the port
 * @ops: Cable alternate mode vector
 */
void typec_port_register_cable_ops(struct typec_altmode **altmodes, int max_altmodes,
				   const struct typec_cable_ops *ops)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_register_port - Register a USB Type-C Port
 * @parent: Parent device
 * @cap: Description of the port
 *
 * Registers a device for USB Type-C Port described in @cap.
 *
 * Returns handle to the port on success or ERR_PTR on failure.
 */
struct typec_port *typec_register_port(struct device *parent,
				       const struct typec_capability *cap)
{}
EXPORT_SYMBOL_GPL();

/**
 * typec_unregister_port - Unregister a USB Type-C Port
 * @port: The port to be unregistered
 *
 * Unregister device created with typec_register_port().
 */
void typec_unregister_port(struct typec_port *port)
{}
EXPORT_SYMBOL_GPL();

static int __init typec_init(void)
{}
subsys_initcall(typec_init);

static void __exit typec_exit(void)
{}
module_exit(typec_exit);

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();