Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807546/?format=api
{ "id": 807546, "url": "http://patchwork.ozlabs.org/api/patches/807546/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170830094814.17758-10-hdegoede@redhat.com/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "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": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170830094814.17758-10-hdegoede@redhat.com>", "list_archive_url": null, "date": "2017-08-30T09:48:12", "name": "[v3,09/11] power: supply: bq24190_charger: Get input_current_limit from our supplier", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "6886f8bef99a1b104aeeca155f7bb3fcdd345a83", "submitter": { "id": 1893, "url": "http://patchwork.ozlabs.org/api/people/1893/?format=api", "name": "Hans de Goede", "email": "hdegoede@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20170830094814.17758-10-hdegoede@redhat.com/mbox/", "series": [ { "id": 564, "url": "http://patchwork.ozlabs.org/api/series/564/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=564", "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/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807546/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807546/checks/", "tags": {}, "related": [], "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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx07.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 3xj12h1W9cz9sNn\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 19:50:20 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751834AbdH3Jsv (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 30 Aug 2017 05:48:51 -0400", "from mx1.redhat.com ([209.132.183.28]:35930 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751760AbdH3Jst (ORCPT <rfc822;linux-i2c@vger.kernel.org>);\n\tWed, 30 Aug 2017 05:48:49 -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 7DCD7C047B66;\n\tWed, 30 Aug 2017 09:48:49 +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 6711787CA4;\n\tWed, 30 Aug 2017 09:48:45 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 7DCD7C047B66", "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 09/11] power: supply: bq24190_charger: Get\n\tinput_current_limit from our supplier", "Date": "Wed, 30 Aug 2017 11:48:12 +0200", "Message-Id": "<20170830094814.17758-10-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.31]);\n\tWed, 30 Aug 2017 09:48:49 +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": "On some devices the USB Type-C port power (USB PD 2.0) negotiation is\ndone by a separate port-controller IC, while the current limit is\ncontrolled through another (charger) IC.\n\nIt has been decided to model this by modelling the external Type-C\npower brick (adapter/charger) as a power-supply class device which\nsupplies the charger-IC, with its voltage-now and current-max representing\nthe negotiated voltage and max current draw.\n\nThis commit adds support for this to the bq24190_charger driver by adding\nan external_power_changed callback and calling\npower_supply_set_input_current_limit_from_supplier from this callback.\nThis callback will only get called if the bq24190 has a parent-supply.\n\nNote this replaces the functionality to get the current-limit from an\nextcon device, which will be removed in a follow-up commit.\n\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\n---\nChanges in v2:\n-Wait a bit before applying current-max from our supplier as input-current-limit\n the bq24190 may still be in its power-good wait-state while our supplier is\n done negotating current-max and if we apply the limit to early then the\n input-current-limit will be reset to 0.5A by the bq24190 after its\n power-good wait is done.\n\nChanges in v3:\n-Drop the input-current-limit-from-supplier device-property, simply always\n sync the input-current-limit with the parent-supply if a parent-supply is\n present\n---\n drivers/power/supply/bq24190_charger.c | 30 ++++++++++++++++++++++++++++++\n 1 file changed, 30 insertions(+)", "diff": "diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c\nindex e606a078b0dd..35ff406aca48 100644\n--- a/drivers/power/supply/bq24190_charger.c\n+++ b/drivers/power/supply/bq24190_charger.c\n@@ -165,6 +165,7 @@ struct bq24190_dev_info {\n \tstruct extcon_dev\t\t*extcon;\n \tstruct notifier_block\t\textcon_nb;\n \tstruct delayed_work\t\textcon_work;\n+\tstruct delayed_work\t\tinput_current_limit_work;\n \tchar\t\t\t\tmodel_name[I2C_NAME_SIZE];\n \tbool\t\t\t\tinitialized;\n \tbool\t\t\t\tirq_event;\n@@ -1210,6 +1211,32 @@ static int bq24190_charger_property_is_writeable(struct power_supply *psy,\n \treturn ret;\n }\n \n+static void bq24190_input_current_limit_work(struct work_struct *work)\n+{\n+\tstruct bq24190_dev_info *bdi =\n+\t\tcontainer_of(work, struct bq24190_dev_info,\n+\t\t\t input_current_limit_work.work);\n+\n+\tpower_supply_set_input_current_limit_from_supplier(bdi->charger);\n+}\n+\n+/* Sync the input-current-limit with our parent supply (if we have one) */\n+static void bq24190_charger_external_power_changed(struct power_supply *psy)\n+{\n+\tstruct bq24190_dev_info *bdi = power_supply_get_drvdata(psy);\n+\n+\t/*\n+\t * The Power-Good detection may take up to 220ms, sometimes\n+\t * the external charger detection is quicker, and the bq24190 will\n+\t * reset to iinlim based on its own charger detection (which is not\n+\t * hooked up when using external charger detection) resulting in a\n+\t * too low default 500mA iinlim. Delay setting the input-current-limit\n+\t * for 300ms to avoid this.\n+\t */\n+\tqueue_delayed_work(system_wq, &bdi->input_current_limit_work,\n+\t\t\t msecs_to_jiffies(300));\n+}\n+\n static enum power_supply_property bq24190_charger_properties[] = {\n \tPOWER_SUPPLY_PROP_CHARGE_TYPE,\n \tPOWER_SUPPLY_PROP_HEALTH,\n@@ -1240,6 +1267,7 @@ static const struct power_supply_desc bq24190_charger_desc = {\n \t.get_property\t\t= bq24190_charger_get_property,\n \t.set_property\t\t= bq24190_charger_set_property,\n \t.property_is_writeable\t= bq24190_charger_property_is_writeable,\n+\t.external_power_changed\t= bq24190_charger_external_power_changed,\n };\n \n /* Battery power supply property routines */\n@@ -1758,6 +1786,8 @@ static int bq24190_probe(struct i2c_client *client,\n \tmutex_init(&bdi->f_reg_lock);\n \tbdi->f_reg = 0;\n \tbdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state */\n+\tINIT_DELAYED_WORK(&bdi->input_current_limit_work,\n+\t\t\t bq24190_input_current_limit_work);\n \n \ti2c_set_clientdata(client, bdi);\n \n", "prefixes": [ "v3", "09/11" ] }