usb: typec: tcpci: frs sourcing vbus callback

During FRS hardware autonomously starts to source vbus. Provide
callback to perform chip specific operations.

Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20201029063138.1429760-6-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Badhri Jagan Sridharan 2020-10-28 23:31:33 -07:00 committed by Greg Kroah-Hartman
parent a30a00e37c
commit a57d253fc0
2 changed files with 13 additions and 0 deletions

View File

@ -284,6 +284,14 @@ static int tcpci_enable_frs(struct tcpc_dev *dev, bool enable)
return ret; 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) static int tcpci_set_bist_data(struct tcpc_dev *tcpc, bool enable)
{ {
struct tcpci *tcpci = tcpc_to_tcpci(tcpc); 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.pd_transmit = tcpci_pd_transmit;
tcpci->tcpc.set_bist_data = tcpci_set_bist_data; tcpci->tcpc.set_bist_data = tcpci_set_bist_data;
tcpci->tcpc.enable_frs = tcpci_enable_frs; tcpci->tcpc.enable_frs = tcpci_enable_frs;
tcpci->tcpc.frs_sourcing_vbus = tcpci_frs_sourcing_vbus;
err = tcpci_parse_config(tcpci); err = tcpci_parse_config(tcpci);
if (err < 0) if (err < 0)

View File

@ -143,6 +143,9 @@
/* /*
* @TX_BUF_BYTE_x_hidden * @TX_BUF_BYTE_x_hidden
* optional; Set when TX_BUF_BYTE_x can only be accessed through I2C_WRITE_BYTE_COUNT. * 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;
struct tcpci_data { struct tcpci_data {
@ -154,6 +157,7 @@ struct tcpci_data {
int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data, int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data,
enum typec_cc_status cc); enum typec_cc_status cc);
int (*set_vbus)(struct tcpci *tcpci, struct tcpci_data *data, bool source, bool sink); 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); struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data);