mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
UPSTREAM: usb: typec: tcpci_maxim: Enable data path when partner is USB Comm capable
Configure USB switches when partner is USB Communication capable.
The is enabled USB data communication over D+/D- pins.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210202003101.221145-3-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2a16e18c34
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9e634089f36fa69f82d58550d18013f22c1b4c17
This commit is contained in:
parent
28ffc10398
commit
0589271c94
|
|
@ -22,6 +22,9 @@
|
|||
#define PD_ACTIVITY_TIMEOUT_MS 10000
|
||||
|
||||
#define TCPC_VENDOR_ALERT 0x80
|
||||
#define TCPC_VENDOR_USBSW_CTRL 0x93
|
||||
#define TCPC_VENDOR_USBSW_CTRL_ENABLE_USB_DATA 0x9
|
||||
#define TCPC_VENDOR_USBSW_CTRL_DISABLE_USB_DATA 0
|
||||
|
||||
#define TCPC_RECEIVE_BUFFER_COUNT_OFFSET 0
|
||||
#define TCPC_RECEIVE_BUFFER_FRAME_TYPE_OFFSET 1
|
||||
|
|
@ -277,6 +280,21 @@ static void process_tx(struct max_tcpci_chip *chip, u16 status)
|
|||
max_tcpci_init_regs(chip);
|
||||
}
|
||||
|
||||
/* Enable USB switches when partner is USB communications capable */
|
||||
static void max_tcpci_set_partner_usb_comm_capable(struct tcpci *tcpci, struct tcpci_data *data,
|
||||
bool capable)
|
||||
{
|
||||
struct max_tcpci_chip *chip = tdata_to_max_tcpci(data);
|
||||
int ret;
|
||||
|
||||
ret = max_tcpci_write8(chip, TCPC_VENDOR_USBSW_CTRL, capable ?
|
||||
TCPC_VENDOR_USBSW_CTRL_ENABLE_USB_DATA :
|
||||
TCPC_VENDOR_USBSW_CTRL_DISABLE_USB_DATA);
|
||||
|
||||
if (ret < 0)
|
||||
dev_err(chip->dev, "Failed to enable USB switches");
|
||||
}
|
||||
|
||||
static irqreturn_t _max_tcpci_irq(struct max_tcpci_chip *chip, u16 status)
|
||||
{
|
||||
u16 mask;
|
||||
|
|
@ -456,6 +474,7 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_id
|
|||
chip->data.frs_sourcing_vbus = max_tcpci_frs_sourcing_vbus;
|
||||
chip->data.auto_discharge_disconnect = true;
|
||||
chip->data.vbus_vsafe0v = true;
|
||||
chip->data.set_partner_usb_comm_capable = max_tcpci_set_partner_usb_comm_capable;
|
||||
|
||||
max_tcpci_init_regs(chip);
|
||||
chip->tcpci = tcpci_register_port(chip->dev, &chip->data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user