summaryrefslogtreecommitdiffstats
path: root/drivers/staging/typec/tcpm.c
diff options
context:
space:
mode:
authorHans de Goede2017-08-30 11:48:05 +0200
committerGreg Kroah-Hartman2017-08-31 18:23:12 +0200
commitea62cfc71b6f7f0ae9bb93b60335a6dedcaa69e6 (patch)
treec8a50973e5ac8cfaa216e234b5961d6220b21448 /drivers/staging/typec/tcpm.c
parentstaging:rtl8188eu Use __func__ instead of function name (diff)
downloadkernel-qcow2-linux-ea62cfc71b6f7f0ae9bb93b60335a6dedcaa69e6.tar.gz
kernel-qcow2-linux-ea62cfc71b6f7f0ae9bb93b60335a6dedcaa69e6.tar.xz
kernel-qcow2-linux-ea62cfc71b6f7f0ae9bb93b60335a6dedcaa69e6.zip
staging: typec: tcpm: Add get_current_limit tcpc_dev callback
A Rp signalling the default current limit indicates that we're possibly connected to an USB2 power-source. In some cases the type-c port-controller may provide the capability to detect the current-limit in this case, through e.g. BC1.2 detection. This commit adds an optional get_current_limit tcpc_dev callback which allows the port-controller to provide current-limit detection for when the CC pin is pulled up with Rp. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/typec/tcpm.c')
-rw-r--r--drivers/staging/typec/tcpm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 2ce02aba039a..8af62e74d54c 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;
}