linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kyle Tso <kyletso@google.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] usb: typec: tcpci_maxim: Enable data path when partner is USB Comm capable
Date: Tue, 2 Feb 2021 10:52:03 +0200	[thread overview]
Message-ID: <20210202085203.GG1433721@kuha.fi.intel.com> (raw)
In-Reply-To: <20210202003101.221145-3-badhri@google.com>

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@google.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  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

thanks,

-- 
heikki

  reply	other threads:[~2021-02-02  8:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  0:30 [PATCH v2 1/3] usb: typec: tcpm: Add Callback to Usb Communication capable partner Badhri Jagan Sridharan
2021-02-02  0:31 ` [PATCH v2 2/3] usb: typec: tcpci: " Badhri Jagan Sridharan
2021-02-02  8:49   ` Heikki Krogerus
2021-02-02 16:25   ` Guenter Roeck
2021-02-02  0:31 ` [PATCH v2 3/3] usb: typec: tcpci_maxim: Enable data path when partner is USB Comm capable Badhri Jagan Sridharan
2021-02-02  8:52   ` Heikki Krogerus [this message]
2021-02-02 16:25   ` Guenter Roeck
2021-02-02  4:34 ` [PATCH v2 1/3] usb: typec: tcpm: Add Callback to Usb Communication capable partner Badhri Jagan Sridharan
2021-02-02  8:37 ` Heikki Krogerus
2021-02-02 16:25 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210202085203.GG1433721@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).