mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Badhri Jagan Sridharan <badhri@google.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kyle Tso <kyletso@google.com>
Subject: Re: [PATCH v11 2/3] usb: typec: tcpci: Add callback for evaluating contaminant presence
Date: Thu, 12 Jan 2023 06:42:49 -0800	[thread overview]
Message-ID: <32a7bb3f-29ec-a5d3-c8ac-998f5714ba27@roeck-us.net> (raw)
In-Reply-To: <20221223102122.1038499-2-badhri@google.com>

On 12/23/22 02:21, Badhri Jagan Sridharan wrote:
> This change adds callback to evaluate presence of contaminant in
> the TCPCI layer.
> 
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>

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

> ---
> Changes since v10:
> * None
> Changes since v9:
> * Check for presence of low level check_contaminant before installing tcpc.check_contaminant.
> Changes since v7:
> * None. Skipped versions by mistake.
> Changes since v6:
> * Removed is_potential_contaminant callback
> Changes since v5:
> * None
> Changes since v4:
> * None
> Changes since v3:
> * None
> Changes since v2:
> * Added tcpci_is_potential_contaminant to offload
> * disconnect_while_debounce logic
> ---
>   drivers/usb/typec/tcpm/tcpci.c | 11 +++++++++++
>   include/linux/usb/tcpci.h      |  7 +++++++
>   2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index fe781a38dc82..699539e1be06 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -403,6 +403,14 @@ static void tcpci_frs_sourcing_vbus(struct tcpc_dev *dev)
>   		tcpci->data->frs_sourcing_vbus(tcpci, tcpci->data);
>   }
>   
> +static void tcpci_check_contaminant(struct tcpc_dev *dev)
> +{
> +	struct tcpci *tcpci = tcpc_to_tcpci(dev);
> +
> +	if (tcpci->data->check_contaminant)
> +		tcpci->data->check_contaminant(tcpci, tcpci->data);
> +}
> +
>   static int tcpci_set_bist_data(struct tcpc_dev *tcpc, bool enable)
>   {
>   	struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
> @@ -778,6 +786,9 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
>   	tcpci->tcpc.frs_sourcing_vbus = tcpci_frs_sourcing_vbus;
>   	tcpci->tcpc.set_partner_usb_comm_capable = tcpci_set_partner_usb_comm_capable;
>   
> +	if (tcpci->data->check_contaminant)
> +		tcpci->tcpc.check_contaminant = tcpci_check_contaminant;
> +
>   	if (tcpci->data->auto_discharge_disconnect) {
>   		tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge;
>   		tcpci->tcpc.set_auto_vbus_discharge_threshold =
> diff --git a/include/linux/usb/tcpci.h b/include/linux/usb/tcpci.h
> index 17657451c762..85e95a3251d3 100644
> --- a/include/linux/usb/tcpci.h
> +++ b/include/linux/usb/tcpci.h
> @@ -188,6 +188,12 @@ struct tcpci;
>    *		Optional; The USB Communications Capable bit indicates if port
>    *		partner is capable of communication over the USB data lines
>    *		(e.g. D+/- or SS Tx/Rx). Called to notify the status of the bit.
> + * @check_contaminant:
> + *		Optional; The callback is invoked when chiplevel drivers indicated
> + *		that the USB port needs to be checked for contaminant presence.
> + *		Chip level drivers are expected to check for contaminant and call
> + *		tcpm_clean_port when the port is clean to put the port back into
> + *		toggling state.
>    */
>   struct tcpci_data {
>   	struct regmap *regmap;
> @@ -204,6 +210,7 @@ struct tcpci_data {
>   	void (*frs_sourcing_vbus)(struct tcpci *tcpci, struct tcpci_data *data);
>   	void (*set_partner_usb_comm_capable)(struct tcpci *tcpci, struct tcpci_data *data,
>   					     bool capable);
> +	void (*check_contaminant)(struct tcpci *tcpci, struct tcpci_data *data);
>   };
>   
>   struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data);


  reply	other threads:[~2023-01-12 14:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 10:21 [PATCH v11 1/3] usb: typec: tcpm: Add callbacks to mitigate wakeups due to contaminant Badhri Jagan Sridharan
2022-12-23 10:21 ` [PATCH v11 2/3] usb: typec: tcpci: Add callback for evaluating contaminant presence Badhri Jagan Sridharan
2023-01-12 14:42   ` Guenter Roeck [this message]
2022-12-23 10:21 ` [PATCH v11 3/3] usb: typec: maxim_contaminant: Implement check_contaminant callback Badhri Jagan Sridharan
2023-01-12 14:53   ` Guenter Roeck
2023-01-14  9:35     ` Badhri Jagan Sridharan
2023-01-03 19:38 ` [PATCH v11 1/3] usb: typec: tcpm: Add callbacks to mitigate wakeups due to contaminant Badhri Jagan Sridharan
     [not found]   ` <CAPTae5JGGkeLd5fU4KVeP4WiV888XG059bWjWJ1tXn6QyMNZOw@mail.gmail.com>
2023-01-12  9:35     ` Badhri Jagan Sridharan
2023-01-12 13:52 ` Heikki Krogerus
2023-01-12 14:55   ` Guenter Roeck
2023-01-12 14:42 ` 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=32a7bb3f-29ec-a5d3-c8ac-998f5714ba27@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®