Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
15dec834
Commit
15dec834
authored
Jul 17, 2017
by
Chanwoo Choi
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/ib-extcon-mfd-4.14' into extcon-next
parents
ff890bc0
a8a5549f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
522 additions
and
0 deletions
+522
-0
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
...tation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
+24
-0
drivers/extcon/Kconfig
drivers/extcon/Kconfig
+7
-0
drivers/extcon/Makefile
drivers/extcon/Makefile
+1
-0
drivers/extcon/extcon-usbc-cros-ec.c
drivers/extcon/extcon-usbc-cros-ec.c
+415
-0
include/linux/mfd/cros_ec_commands.h
include/linux/mfd/cros_ec_commands.h
+75
-0
No files found.
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
0 → 100644
View file @
15dec834
ChromeOS EC USB Type-C cable and accessories detection
On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
able to detect the state of external accessories such as display adapters
or USB devices when said accessories are attached or detached.
The node for this device must be under a cros-ec node like google,cros-ec-spi
or google,cros-ec-i2c.
Required properties:
- compatible: Should be "google,extcon-usbc-cros-ec".
- google,usb-port-id: Specifies the USB port ID to use.
Example:
cros-ec@0 {
compatible = "google,cros-ec-i2c";
...
extcon {
compatible = "google,extcon-usbc-cros-ec";
google,usb-port-id = <0>;
};
}
drivers/extcon/Kconfig
View file @
15dec834
...
...
@@ -150,4 +150,11 @@ config EXTCON_USB_GPIO
Say Y here to enable GPIO based USB cable detection extcon support.
Used typically if GPIO is used for USB ID pin detection.
config EXTCON_USBC_CROS_EC
tristate "ChromeOS Embedded Controller EXTCON support"
depends on MFD_CROS_EC
help
Say Y here to enable USB Type C cable detection extcon support when
using Chrome OS EC based USB Type-C ports.
endif
drivers/extcon/Makefile
View file @
15dec834
...
...
@@ -20,3 +20,4 @@ obj-$(CONFIG_EXTCON_QCOM_SPMI_MISC) += extcon-qcom-spmi-misc.o
obj-$(CONFIG_EXTCON_RT8973A)
+=
extcon-rt8973a.o
obj-$(CONFIG_EXTCON_SM5502)
+=
extcon-sm5502.o
obj-$(CONFIG_EXTCON_USB_GPIO)
+=
extcon-usb-gpio.o
obj-$(CONFIG_EXTCON_USBC_CROS_EC)
+=
extcon-usbc-cros-ec.o
drivers/extcon/extcon-usbc-cros-ec.c
0 → 100644
View file @
15dec834
This diff is collapsed.
Click to expand it.
include/linux/mfd/cros_ec_commands.h
View file @
15dec834
...
...
@@ -285,6 +285,11 @@ enum host_event_code {
EC_HOST_EVENT_HANG_DETECT
=
20
,
/* Hang detect logic detected a hang and warm rebooted the AP */
EC_HOST_EVENT_HANG_REBOOT
=
21
,
/* PD MCU triggering host event */
EC_HOST_EVENT_PD_MCU
=
22
,
/* EC desires to change state of host-controlled USB mux */
EC_HOST_EVENT_USB_MUX
=
28
,
/*
* The high bit of the event mask is not used as a host event code. If
...
...
@@ -2905,6 +2910,76 @@ struct ec_params_usb_pd_control {
uint8_t
mux
;
}
__packed
;
#define PD_CTRL_RESP_ENABLED_COMMS (1 << 0)
/* Communication enabled */
#define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1)
/* Device connected */
#define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2)
/* Partner is PD capable */
struct
ec_response_usb_pd_control_v1
{
uint8_t
enabled
;
uint8_t
role
;
uint8_t
polarity
;
char
state
[
32
];
}
__packed
;
#define EC_CMD_USB_PD_PORTS 0x102
struct
ec_response_usb_pd_ports
{
uint8_t
num_ports
;
}
__packed
;
#define EC_CMD_USB_PD_POWER_INFO 0x103
#define PD_POWER_CHARGING_PORT 0xff
struct
ec_params_usb_pd_power_info
{
uint8_t
port
;
}
__packed
;
enum
usb_chg_type
{
USB_CHG_TYPE_NONE
,
USB_CHG_TYPE_PD
,
USB_CHG_TYPE_C
,
USB_CHG_TYPE_PROPRIETARY
,
USB_CHG_TYPE_BC12_DCP
,
USB_CHG_TYPE_BC12_CDP
,
USB_CHG_TYPE_BC12_SDP
,
USB_CHG_TYPE_OTHER
,
USB_CHG_TYPE_VBUS
,
USB_CHG_TYPE_UNKNOWN
,
};
struct
usb_chg_measures
{
uint16_t
voltage_max
;
uint16_t
voltage_now
;
uint16_t
current_max
;
uint16_t
current_lim
;
}
__packed
;
struct
ec_response_usb_pd_power_info
{
uint8_t
role
;
uint8_t
type
;
uint8_t
dualrole
;
uint8_t
reserved1
;
struct
usb_chg_measures
meas
;
uint32_t
max_power
;
}
__packed
;
/* Get info about USB-C SS muxes */
#define EC_CMD_USB_PD_MUX_INFO 0x11a
struct
ec_params_usb_pd_mux_info
{
uint8_t
port
;
/* USB-C port number */
}
__packed
;
/* Flags representing mux state */
#define USB_PD_MUX_USB_ENABLED (1 << 0)
#define USB_PD_MUX_DP_ENABLED (1 << 1)
#define USB_PD_MUX_POLARITY_INVERTED (1 << 2)
#define USB_PD_MUX_HPD_IRQ (1 << 3)
struct
ec_response_usb_pd_mux_info
{
uint8_t
flags
;
/* USB_PD_MUX_*-encoded USB mux state */
}
__packed
;
/*****************************************************************************/
/*
* Passthru commands
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment