summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/typec/tcpm.c5
-rw-r--r--drivers/staging/typec/tcpm.h7
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 2ce02ab..8af62e7 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -685,7 +685,10 @@ static u32 tcpm_get_current_limit(struct tcpm_port *port)
break;
case TYPEC_CC_RP_DEF:
default:
- limit = 0;
+ if (port->tcpc->get_current_limit)
+ limit = port->tcpc->get_current_limit(port->tcpc);
+ else
+ limit = 0;
break;
}
diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h
index 374cea4..7e9a6b7 100644
--- a/drivers/staging/typec/tcpm.h
+++ b/drivers/staging/typec/tcpm.h
@@ -109,6 +109,13 @@ struct tcpc_dev {
int (*init)(struct tcpc_dev *dev);
int (*get_vbus)(struct tcpc_dev *dev);
+ /*
+ * This optional callback gets called by the tcpm core when configured
+ * as a snk and cc=Rp-def. This allows the tcpm to provide a fallback
+ * current-limit detection method for the cc=Rp-def case. E.g. some
+ * tcpcs may include BC1.2 charger detection and use that in this case.
+ */
+ int (*get_current_limit)(struct tcpc_dev *dev);
int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
enum typec_cc_status *cc2);
OpenPOWER on IntegriCloud