[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201019134133.GE1667571@kuha.fi.intel.com>
Date: Mon, 19 Oct 2020 16:41:33 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Badhri Jagan Sridharan <badhri@...gle.com>
Cc: Guenter Roeck <linux@...ck-us.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Mark Brown <broonie@...nel.org>,
Maxime Ripard <mripard@...nel.org>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Thierry Reding <treding@...dia.com>,
Prashant Malani <pmalani@...omium.org>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, Amelie Delaunay <amelie.delaunay@...com>
Subject: Re: [PATCH v10 10/15] usb: typec: tcpci: frs sourcing vbus callback
On Wed, Oct 07, 2020 at 11:15:51PM -0700, Badhri Jagan Sridharan wrote:
> During FRS hardware autonomously starts to source vbus. Provide
> callback to perform chip specific operations.
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@...gle.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> ---
> v9 is the first version of this patch in the series. Added to fix
> occasional bug of vbus turning back on when disconnecting the FRS accessory
> after disconnect. No changes since v9.
> ---
> drivers/usb/typec/tcpm/tcpci.c | 9 +++++++++
> drivers/usb/typec/tcpm/tcpci.h | 4 ++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index f9f0af64da5f..f91688e43991 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -284,6 +284,14 @@ static int tcpci_enable_frs(struct tcpc_dev *dev, bool enable)
> return ret;
> }
>
> +static void tcpci_frs_sourcing_vbus(struct tcpc_dev *dev)
> +{
> + struct tcpci *tcpci = tcpc_to_tcpci(dev);
> +
> + if (tcpci->data->frs_sourcing_vbus)
> + tcpci->data->frs_sourcing_vbus(tcpci, tcpci->data);
> +}
> +
> static int tcpci_set_bist_data(struct tcpc_dev *tcpc, bool enable)
> {
> struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
> @@ -628,6 +636,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
> tcpci->tcpc.pd_transmit = tcpci_pd_transmit;
> tcpci->tcpc.set_bist_data = tcpci_set_bist_data;
> tcpci->tcpc.enable_frs = tcpci_enable_frs;
> + tcpci->tcpc.frs_sourcing_vbus = tcpci_frs_sourcing_vbus;
>
> err = tcpci_parse_config(tcpci);
> if (err < 0)
> diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
> index 5ef07a56d67a..b418fe11b527 100644
> --- a/drivers/usb/typec/tcpm/tcpci.h
> +++ b/drivers/usb/typec/tcpm/tcpci.h
> @@ -143,6 +143,9 @@
> /*
> * @TX_BUF_BYTE_x_hidden
> * optional; Set when TX_BUF_BYTE_x can only be accessed through I2C_WRITE_BYTE_COUNT.
> + * @frs_sourcing_vbus:
> + * Optional; Callback to perform chip specific operations when FRS
> + * is sourcing vbus.
> */
> struct tcpci;
> struct tcpci_data {
> @@ -154,6 +157,7 @@ struct tcpci_data {
> int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data,
> enum typec_cc_status cc);
> int (*set_vbus)(struct tcpci *tcpci, struct tcpci_data *data, bool source, bool sink);
> + void (*frs_sourcing_vbus)(struct tcpci *tcpci, struct tcpci_data *data);
> };
>
> struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data);
> --
> 2.28.0.806.g8561365e88-goog
thanks,
--
heikki
Powered by blists - more mailing lists