{"id":807553,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807553/?format=json","project":{"id":35,"url":"http://patchwork.ozlabs.org/api/1.0/projects/35/?format=json","name":"Linux I2C development","link_name":"linux-i2c","list_id":"linux-i2c.vger.kernel.org","list_email":"linux-i2c@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170830094814.17758-3-hdegoede@redhat.com>","date":"2017-08-30T09:48:05","name":"[v3,02/11] staging: typec: tcpm: Add get_current_limit tcpc_dev callback","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f9088d849edf80928f39f7e927a641bd2cf62340","submitter":{"id":1893,"url":"http://patchwork.ozlabs.org/api/1.0/people/1893/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20170830094814.17758-3-hdegoede@redhat.com/mbox/","series":[{"id":564,"url":"http://patchwork.ozlabs.org/api/1.0/series/564/?format=json","date":"2017-08-30T09:48:14","name":"Hookup typec power-negotation to the PMIC and charger","version":3,"mbox":"http://patchwork.ozlabs.org/series/564/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807553/checks/","tags":{},"headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=hdegoede@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xj14J66s4z9sNn\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 19:51:44 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751631AbdH3Js3 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 30 Aug 2017 05:48:29 -0400","from mx1.redhat.com ([209.132.183.28]:57860 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751564AbdH3JsZ (ORCPT <rfc822;linux-i2c@vger.kernel.org>);\n\tWed, 30 Aug 2017 05:48:25 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 494057E432;\n\tWed, 30 Aug 2017 09:48:25 +0000 (UTC)","from shalem.localdomain.com (ovpn-116-238.ams2.redhat.com\n\t[10.36.116.238])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id A7A9187CA0;\n\tWed, 30 Aug 2017 09:48:22 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 494057E432","From":"Hans de Goede <hdegoede@redhat.com>","To":"Darren Hart <dvhart@infradead.org>, Andy Shevchenko <andy@infradead.org>,\n\tWolfram Sang <wsa@the-dreams.de>, Sebastian Reichel <sre@kernel.org>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tGuenter Roeck <linux@roeck-us.net>,\n\tHeikki Krogerus <heikki.krogerus@linux.intel.com>","Cc":"Hans de Goede <hdegoede@redhat.com>,\n\tplatform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinux-i2c@vger.kernel.org, Liam Breck <liam@networkimprov.net>,\n\tTony Lindgren <tony@atomide.com>, linux-pm@vger.kernel.org,\n\tdevel@driverdev.osuosl.org","Subject":"[PATCH v3 02/11] staging: typec: tcpm: Add get_current_limit\n\ttcpc_dev callback","Date":"Wed, 30 Aug 2017 11:48:05 +0200","Message-Id":"<20170830094814.17758-3-hdegoede@redhat.com>","In-Reply-To":"<20170830094814.17758-1-hdegoede@redhat.com>","References":"<20170830094814.17758-1-hdegoede@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tWed, 30 Aug 2017 09:48:25 +0000 (UTC)","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"},"content":"A Rp signalling the default current limit indicates that we're possibly\nconnected to an USB2 power-source. In some cases the type-c port-controller\nmay provide the capability to detect the current-limit in this case,\nthrough e.g. BC1.2 detection.\n\nThis commit adds an optional get_current_limit tcpc_dev callback which\nallows the port-controller to provide current-limit detection for when\nthe CC pin is pulled up with Rp.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\nReviewed-by: Guenter Roeck <linux@roeck-us.net>\n---\nChanges in v2:\n-s/get_usb2_current_limit/get_current_limit/\n---\n drivers/staging/typec/tcpm.c | 5 ++++-\n drivers/staging/typec/tcpm.h | 7 +++++++\n 2 files changed, 11 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c\nindex a911cad41a59..6ca73a3c7e88 100644\n--- a/drivers/staging/typec/tcpm.c\n+++ b/drivers/staging/typec/tcpm.c\n@@ -667,7 +667,10 @@ static u32 tcpm_get_current_limit(struct tcpm_port *port)\n \t\tbreak;\n \tcase TYPEC_CC_RP_DEF:\n \tdefault:\n-\t\tlimit = 0;\n+\t\tif (port->tcpc->get_current_limit)\n+\t\t\tlimit = port->tcpc->get_current_limit(port->tcpc);\n+\t\telse\n+\t\t\tlimit = 0;\n \t\tbreak;\n \t}\n \ndiff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h\nindex 374cea44a84a..7e9a6b7b5cd6 100644\n--- a/drivers/staging/typec/tcpm.h\n+++ b/drivers/staging/typec/tcpm.h\n@@ -109,6 +109,13 @@ struct tcpc_dev {\n \n \tint (*init)(struct tcpc_dev *dev);\n \tint (*get_vbus)(struct tcpc_dev *dev);\n+\t/*\n+\t * This optional callback gets called by the tcpm core when configured\n+\t * as a snk and cc=Rp-def. This allows the tcpm to provide a fallback\n+\t * current-limit detection method for the cc=Rp-def case. E.g. some\n+\t * tcpcs may include BC1.2 charger detection and use that in this case.\n+\t */\n+\tint (*get_current_limit)(struct tcpc_dev *dev);\n \tint (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);\n \tint (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,\n \t\t      enum typec_cc_status *cc2);\n","prefixes":["v3","02/11"]}