usb: typec: tcpci: Add Callback to Usb Communication capable partner

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). TCPM passes this information for chip specific
operations.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210202003101.221145-2-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Badhri Jagan Sridharan 2021-02-01 16:31:00 -08:00 коммит произвёл Greg Kroah-Hartman
Родитель a69bdb283f
Коммит 372a3d0b6b
2 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -255,6 +255,14 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,
TCPC_TCPC_CTRL_ORIENTATION : 0); TCPC_TCPC_CTRL_ORIENTATION : 0);
} }
static void tcpci_set_partner_usb_comm_capable(struct tcpc_dev *tcpc, bool capable)
{
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
if (tcpci->data->set_partner_usb_comm_capable)
tcpci->data->set_partner_usb_comm_capable(tcpci, tcpci->data, capable);
}
static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable) static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
{ {
struct tcpci *tcpci = tcpc_to_tcpci(tcpc); struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
@ -720,6 +728,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
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; 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->auto_discharge_disconnect) { if (tcpci->data->auto_discharge_disconnect) {
tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge; tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge;

Просмотреть файл

@ -161,6 +161,10 @@ struct tcpci;
* Optional; Enables TCPC to autonously discharge vbus on disconnect. * Optional; Enables TCPC to autonously discharge vbus on disconnect.
* @vbus_vsafe0v: * @vbus_vsafe0v:
* optional; Set when TCPC can detect whether vbus is at VSAFE0V. * optional; Set when TCPC can detect whether vbus is at VSAFE0V.
* @set_partner_usb_comm_capable:
* 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.
*/ */
struct tcpci_data { struct tcpci_data {
struct regmap *regmap; struct regmap *regmap;
@ -175,6 +179,8 @@ struct tcpci_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); 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);
}; };
struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data); struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data);