Commit 0e3bb7d6 authored by Heikki Krogerus's avatar Heikki Krogerus Committed by Greg Kroah-Hartman

usb: typec: Add driver for DisplayPort alternate mode

DisplayPort USB Type-C Alt Mode allows DisplayPort displays
and adapters to be attached to the USB Type-C ports on the
system.
Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8a37d87d
What: /sys/bus/typec/devices/.../displayport/configuration
Date: July 2018
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
Shows the current DisplayPort configuration for the connector.
Valid values are USB, source and sink. Source means DisplayPort
source, and sink means DisplayPort sink.
All supported configurations are listed as space separated list
with the active one wrapped in square brackets.
Source example:
USB [source] sink
The configuration can be changed by writing to the file
Note. USB configuration does not equal to Exit Mode. It is
separate configuration defined in VESA DisplayPort Alt Mode on
USB Type-C Standard. Functionally it equals to the situation
where the mode has been exited (to exit the mode, see
Documentation/ABI/testing/sysfs-bus-typec, and use file
/sys/bus/typec/devices/.../active).
What: /sys/bus/typec/devices/.../displayport/pin_assignment
Date: July 2018
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
VESA DisplayPort Alt Mode on USB Type-C Standard defines six
different pin assignments for USB Type-C connector that are
labeled A, B, C, D, E, and F. The supported pin assignments are
listed as space separated list with the active one wrapped in
square brackets.
Example:
C [D]
Pin assignment can be changed by writing to the file. It is
possible to set pin assignment before configuration has been
set, but the assignment will not be active before the
connector is actually configured.
Note. As of VESA DisplayPort Alt Mode on USB Type-C Standard
version 1.0b, pin assignments A, B, and F are deprecated. Only
pin assignment D can now carry simultaneously one channel of
USB SuperSpeed protocol. From user perspective pin assignments C
and E are equal, where all channels on the connector are used
for carrying DisplayPort protocol (allowing higher resolutions).
......@@ -104,4 +104,6 @@ config TYPEC_TPS6598X
source "drivers/usb/typec/mux/Kconfig"
source "drivers/usb/typec/altmodes/Kconfig"
endif # TYPEC
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_TYPEC) += typec.o
typec-y := class.o mux.o bus.o
obj-$(CONFIG_TYPEC) += altmodes/
obj-$(CONFIG_TYPEC_TCPM) += tcpm.o
obj-y += fusb302/
obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o
......
menu "USB Type-C Alternate Mode drivers"
config TYPEC_DP_ALTMODE
tristate "DisplayPort Alternate Mode driver"
help
DisplayPort USB Type-C Alternate Mode allows DisplayPort
displays and adapters to be attached to the USB Type-C
connectors on the system.
To compile this driver as a module, choose M here: the
module will be called typec_displayport.
endmenu
obj-$(CONFIG_TYPEC_DP_ALTMODE) += typec_displayport.o
typec_displayport-y := displayport.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __USB_TYPEC_DP_H
#define __USB_TYPEC_DP_H
#include <linux/usb/typec_altmode.h>
#define USB_TYPEC_DP_SID 0xff01
#define USB_TYPEC_DP_MODE 1
/*
* Connector states matching the pin assignments in DisplayPort Alt Mode
* Specification.
*
* These values are meant primarily to be used by the mux drivers, but they are
* also used as the "value" part in the alternate mode notification chain, so
* receivers of those notifications will always see them.
*
* Note. DisplayPort USB Type-C Alt Mode Specification version 1.0b deprecated
* pin assignments A, B and F, but they are still defined here for legacy
* purposes.
*/
enum {
TYPEC_DP_STATE_A = TYPEC_STATE_MODAL, /* Not supported after v1.0b */
TYPEC_DP_STATE_B, /* Not supported after v1.0b */
TYPEC_DP_STATE_C,
TYPEC_DP_STATE_D,
TYPEC_DP_STATE_E,
TYPEC_DP_STATE_F, /* Not supported after v1.0b */
};
/*
* struct typec_displayport_data - DisplayPort Alt Mode specific data
* @status: Status Update command VDO content
* @conf: Configure command VDO content
*
* This structure is delivered as the data part with the notifications. It
* contains the VDOs from the two DisplayPort Type-C alternate mode specific
* commands: Status Update and Configure.
*
* @status will show for example the status of the HPD signal.
*/
struct typec_displayport_data {
u32 status;
u32 conf;
};
enum {
DP_PIN_ASSIGN_A, /* Not supported after v1.0b */
DP_PIN_ASSIGN_B, /* Not supported after v1.0b */
DP_PIN_ASSIGN_C,
DP_PIN_ASSIGN_D,
DP_PIN_ASSIGN_E,
DP_PIN_ASSIGN_F, /* Not supported after v1.0b */
};
/* DisplayPort alt mode specific commands */
#define DP_CMD_STATUS_UPDATE VDO_CMD_VENDOR(0)
#define DP_CMD_CONFIGURE VDO_CMD_VENDOR(1)
/* DisplayPort Capabilities VDO bits (returned with Discover Modes) */
#define DP_CAP_CAPABILITY(_cap_) ((_cap_) & 3)
#define DP_CAP_UFP_D 1
#define DP_CAP_DFP_D 2
#define DP_CAP_DFP_D_AND_UFP_D 3
#define DP_CAP_DP_SIGNALING BIT(2) /* Always set */
#define DP_CAP_GEN2 BIT(3) /* Reserved after v1.0b */
#define DP_CAP_RECEPTACLE BIT(6)
#define DP_CAP_USB BIT(7)
#define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8)
#define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16)
/* DisplayPort Status Update VDO bits */
#define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)
#define DP_STATUS_CON_DISABLED 0
#define DP_STATUS_CON_DFP_D 1
#define DP_STATUS_CON_UFP_D 2
#define DP_STATUS_CON_BOTH 3
#define DP_STATUS_POWER_LOW BIT(2)
#define DP_STATUS_ENABLED BIT(3)
#define DP_STATUS_PREFER_MULTI_FUNC BIT(4)
#define DP_STATUS_SWITCH_TO_USB BIT(5)
#define DP_STATUS_EXIT_DP_MODE BIT(6)
#define DP_STATUS_HPD_STATE BIT(7) /* 0 = HPD_Low, 1 = HPD_High */
#define DP_STATUS_IRQ_HPD BIT(8)
/* DisplayPort Configurations VDO bits */
#define DP_CONF_CURRENTLY(_conf_) ((_conf_) & 3)
#define DP_CONF_UFP_U_AS_DFP_D BIT(0)
#define DP_CONF_UFP_U_AS_UFP_D BIT(1)
#define DP_CONF_SIGNALING_DP BIT(2)
#define DP_CONF_SIGNALING_GEN_2 BIT(3) /* Reserved after v1.0b */
#define DP_CONF_PIN_ASSIGNEMENT_SHIFT 8
#define DP_CONF_PIN_ASSIGNEMENT_MASK GENMASK(15, 8)
#endif /* __USB_TYPEC_DP_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment