lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 2 Feb 2021 08:25:32 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Badhri Jagan Sridharan <badhri@...gle.com>
Cc:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kyle Tso <kyletso@...gle.com>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] usb: typec: tcpci_maxim: Enable data path when
 partner is USB Comm capable

On Mon, Feb 01, 2021 at 04:31:01PM -0800, Badhri Jagan Sridharan wrote:
> Configure USB switches when partner is USB Communication capable.
> The is enabled USB data communication over D+/D- pins.
> 
> Signed-off-by: Badhri Jagan Sridharan <badhri@...gle.com>

Reviewed-by: Guenter Roeck <linux@...ck-us.net>

> ---
>  drivers/usb/typec/tcpm/tcpci_maxim.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c b/drivers/usb/typec/tcpm/tcpci_maxim.c
> index f1674a611033..041a1c393594 100644
> --- a/drivers/usb/typec/tcpm/tcpci_maxim.c
> +++ b/drivers/usb/typec/tcpm/tcpci_maxim.c
> @@ -19,6 +19,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
> @@ -274,6 +277,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;
> @@ -453,6 +471,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);
> -- 
> 2.30.0.365.g02bc693789-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ