Message ID | 1482233582-29770-3-git-send-email-peda@axentia.se (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show
Return-Path: <linux-pm-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7136B60821 for <patchwork-linux-pm@patchwork.kernel.org>; Wed, 21 Dec 2016 00:48:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5484D281C3 for <patchwork-linux-pm@patchwork.kernel.org>; Wed, 21 Dec 2016 00:48:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 471E028306; Wed, 21 Dec 2016 00:48:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28A41281C3 for <patchwork-linux-pm@patchwork.kernel.org>; Wed, 21 Dec 2016 00:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521AbcLUAsf (ORCPT <rfc822;patchwork-linux-pm@patchwork.kernel.org>); Tue, 20 Dec 2016 19:48:35 -0500 Received: from mail-db5eur01on0096.outbound.protection.outlook.com ([104.47.2.96]:20544 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751455AbcLUAsf (ORCPT <rfc822;linux-pm@vger.kernel.org>); Tue, 20 Dec 2016 19:48:35 -0500 Received: from DB6PR0201MB2312.eurprd02.prod.outlook.com (10.169.222.151) by DB6PR0201MB2309.eurprd02.prod.outlook.com (10.169.222.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Tue, 20 Dec 2016 19:14:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Vkj2saguONAeyzjxBvqB7PskusfF+nRvcACtJ8U8rfA=; b=W6yDEeOMUdQLXGnFs73nToZW8cVAee+a/Y8hA2ll6551r3xgCYJrHr5FI4RkQzg5bAtA51B5LetPocaBBaRqWyVsO2Bu4/7qeIjnqS0ye7X1FMu/nMErC7hBlhVAYhgsiM0ANFoHF2K5FRoxxzc679gqtZpx257U1ZVkYpZwUwI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Received: from localhost.localdomain (217.210.101.82) by DB6PR0201MB2312.eurprd02.prod.outlook.com (10.169.222.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Tue, 20 Dec 2016 11:33:22 +0000 From: Peter Rosin <peda@axentia.se> To: linux-kernel@vger.kernel.org Cc: Peter Rosin <peda@axentia.se>, Sebastian Reichel <sre@kernel.org>, linux-pm@vger.kernel.org Subject: [PATCH 2/3] power: supply: bq24735: configure the charger as part of enabling it Date: Tue, 20 Dec 2016 12:33:01 +0100 Message-Id: <1482233582-29770-3-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1482233582-29770-1-git-send-email-peda@axentia.se> References: <1482233582-29770-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB5PR0101CA0002.eurprd01.prod.exchangelabs.com (10.165.200.140) To DB6PR0201MB2312.eurprd02.prod.outlook.com (10.169.222.151) X-MS-Office365-Filtering-Correlation-Id: 072955d5-ab2b-4616-66dc-08d428cc019e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0201MB2312; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2312; 3:3wNmpMlWTfUNoKs2ryIiu3/627HKbL3puBINFFCRTVL9BjATt7mu1po4OJvelZZ+6qTI5UAit66ubv3pGvI0GFyArlNnDaPq4QEX+N0olSCOuSJtAWcj1F0qvJuGcpSea4LYl74mtpXRkXnmc3DJRl+DmEZOhNkEVclZTVuuHeHB8e94ENSATsuCrOcqcunq3qc3UwKzthBHtcBGOdtJuD3h3gOrObJbJUXSJXxwp93fUlDUDhAZe/IX/6BdXj6Hb2FfEQHVoIKRABaQCWORSA==; 25:Ffcs7mFdMPnS4NpwVkJ+Py0/r7HEAy57x3pL6+3owEs9fhrqVZM8hKcCb0etM8IH+uGl15OxgaGDoEWYD/15CPNJj4FiFHGCo+pMDpDOLqPYrgrxRUm7Iu7ENXC1gfjiLMHwq2y7JBs8M7hUYKi96Bzk7VZVQS8s7XkEKIsy5e0TqFijd2F+O7XP/ITY0TGOaoymB4sh5fDSdHvF3PVYWlihzzbciARNquBuKumvYrH/3PRlW5vWqDY9mSPrAA40F80KeE+YtVoF5XijTc3JEqHkf4G4Jn9Nd6SJJLbOnMy9zkhUd90KxvyEpDFaZk6h/XGo9oAsXAhP3Wv7ZFPaQLb0mH9pdPfzop1tEaad+qy8/r7v0Ft5KvUYUE4xdy5QgBPjI1XuXhzB9JHoS5AGjwqYpFzp5d10B4z5pTA2wnjdRhXfktTVeVC2rbt3hq/dIv4k8tAudqjxczo0Qxr30Q== X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2312; 31:e5q+uvHEK+W4TkU2KjxDIzuzfoPBNMjL3phFpxS0wBVIQmwV0371oTx3v66UnOtnluDSZFvT1RVv4R+BBvo0Y+Ge24/Q3SRRthS8SCEgKHKv4327QaycvPq3nzj2gewUkEmUCHlb5LMnSGnbCQWO3on5OgZ7aKW0liGpeubuTehJT6cvhYpZQUk2TmMU2z1LxN8csfLVmppGblly8UPX7axRu3lxTTDqb5gH1DYT+N5FruFYyQMKhFz0cwVVSVPs; 4:sl3gx0kNNyZH7JRR/sta4XPf6nwsoXve+8SOGOr8qxOaDma6tQtRpXAWDoehIci8ZSyrAvhrvI5WBPGuvq1Y3s2/PEeGcZ471/aZDQy4lugrDAdWZQfNz/9G3SeBVqhDdtBFeI3rCbMyU2UQKiqeWLUBS6Qd7g3RoyU+MGjCSrctxS9xTJfdQOSDz+oOWEkPe2Y1g3hGi45O7xdEcSmSG8E03mYnAUt+W0Fl5FJoBc8iZcVXrujRYH1H/Ds9YKSD05hr/u4bhbLteNH9clddoZZvGANEyGSGChL+IMf9TFdH4cwwgJWjPO8pWIUk73xJ3l8JlkSUEhas57GWPImkg1CYz8JfU3fOCOegM0OV1Ksf9SaYvVJleKeggA7oIqIxacBtyViSfFSnJ7B1LNw/KbDn/Zi2VrLNKi4D/422d2Gs16msoINYI6IwoBa4zm1DhAXs/th/TJhXDFopCyocFb6oOk7XgKFT73QnLOX7h3Gw3ptz+YO8MY3NDlRryG/+7OByqoZRqkZvwKj4LvyJiYh98N5pFSbXk/SBJM64iM1cESp3NYpMrzh4O7kukNF3czPwauRADZaNHw91AU+IGn5vIrNK2Qtv9PnGn9eLOJIPxmn+NmimKnaG1MbhPT/+ X-Microsoft-Antispam-PRVS: <DB6PR0201MB23125B1C1EF6A7EF1D8C391FBC900@DB6PR0201MB2312.eurprd02.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(2016111802025)(20161123560025)(20161123555025)(6072148)(6043046); SRVR:DB6PR0201MB2312; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0201MB2312; X-Forefront-PRVS: 0162ACCC24 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(979002)(6069001)(6009001)(7916002)(39830400002)(39450400003)(39410400002)(43544003)(189002)(199003)(6916009)(86362001)(2351001)(97736004)(6486002)(2906002)(6506006)(101416001)(6512006)(2361001)(92566002)(7736002)(25786008)(305945005)(50226002)(68736007)(38730400001)(106356001)(8676002)(42186005)(81166006)(48376002)(50466002)(74482002)(36756003)(5660300001)(76176999)(4326007)(33646002)(81156014)(50986999)(66066001)(3846002)(189998001)(6666003)(110136003)(5003940100001)(6116002)(2950100002)(47776003)(105586002)(42262002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0201MB2312; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0201MB2312; 23:jMMzoGjtTS2ld0r00zp/u216HTRZ5ZqHcjzS8UF?= =?us-ascii?Q?dFilhmwfNtGOlcxHnDEALP5m2Yx9vlUhAX3ukYGLp/H1GLiHKGL/6PSIiA2G?= =?us-ascii?Q?UmKs8NKpBEWlgcurqmaa3OKzUI2ABbuyqiGYY65UfrbZG9S9AR/ZKWjyjjJc?= =?us-ascii?Q?8iqE6vE/h85HSZQ1zD9ZTQo2c9o5qhncpo05kPETFMLCjsF38QQ/W2/TaFDz?= =?us-ascii?Q?liZTZT6fTtEFia/whpacJsi5GRYT106CopsMp0fltpfx6rgLpIyvb4s5uVYN?= =?us-ascii?Q?sNJiCdlwl80wwFeV72FvdCeIkRLfn705Odk66oy6FqxG8vE5MmeTStyF6wvb?= =?us-ascii?Q?FL25ijZITKul974PS80t63+2aF/TsGIzxqhzv0KQofG+du0Y8H2wELyuWiDz?= =?us-ascii?Q?Zm7Qots9vN+hSYxb9ltG7telzms+fz2pDv0+4CfZlFF7ntFnJHZfsNLgGYun?= =?us-ascii?Q?bgXz8W+u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?us-ascii?Q?ZGIApXw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2312; 6:DUeSDSt1XWE7hfhKvSAoruuTVsr1meYNULnqMdXT2rm10VVUP4Z79DetnrA7OAe3o7zgou2AsYp2GeTHuUVuxU+sb+O5IaWyAj/o9biX8oANN52tUNz9rqsVXJuExEJDOEawQOY6DdqtUQB08JVJmoJcnsgPpmlMlDKT9zyu0itpg1Ug9XolbzcXov77iuUS93UWET1VZE60ntEonB+4a0VWSeLuFtB4mkiRgwyNvni+FBI2BUoHfr2JeOYgEItjsCUczR4f5ob5kq5MtmNZ1ST47+q8KQqfe9QRVe7ygkGPt97Q6YGB63gCTmGVaXMQuUV94WBCa7Z7ZtNDyr3xxX0QgMmft7NHuGqk0dgnvqGlXOfP87m4jLzicHrID0uwbvgBeThTLXJBqdtraM49DCDg2SRkA4ZtfXI5nNJ7WGns+6iUK/MdWTOkqRRCulhZ; 5:Kc1E+6a+6tDMcOKSDwWlTPx8rWqGEk6jJFuemLn63YP1qYzg8/yIvztL9ESEW5aEs0lwPiBvaeuVi6OVVRoZvr26yAPAHoRphF9Irx8i16Ezir67lhtbEzH72qWoQhxsg2u+X9awtLXgA2fWkZqVNw==; 24:KtbMy9CFLjGtxPJFdvZvO1JnoeJVVZyRLZH4CX+Y81yidTVhcObWZi+oDDDrPlwcMa7GaoW54amMYeOrRp3TJnmVngdjaqfJ7rvV3DIx6xA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2312; 7:hHBZFup7e4Osnq3XrJus0S0ueUxaCosiKaJvA66V/JEUUyjGGwpWA6FAeBML3Y7ZKm7+PtUihbV7PYf0gpnrqsAlFiRHxovKc6CdQN1Le+3xpjkxYDriNHi2LiMKVUhRVejpiJU8Go1OK/A1el84EkIZAPiX05QlxqlrcM7/YLPnP6A7qb0V9y7IJcBGj7mxFGG7z0yw73ZEsWLLBfQ2rNrOqv0ok+rwq/yYGdGEQ1cwyQyp1fzNxK1ttgYnQd9lq6xJExK/k2M3lPumj4nlA/lkdG06evZSByrRQ+BRSM86pHgbLusrYpSe30TEy5Nmng+7QJvYEsNyf/bRwzqmMn7UgwN3F9TcQpjRqvGfeH27qOEXB+TFfnEvniIKV5fogDd1+djdyeO8J58+XJppmKdv+W13ZmSa03yx87QF5MJwEHhqu8ZIES2qD4/U9LxrywUd0qby6oG4Uc/8bgcSsg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2016 11:33:22.5264 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0201MB2312 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2309; 23:fje4Fz4pngTRHD8qAB1Dn6xcMbEeuIRVcedMKQc7hd8I1vYZOZcTn3JftUUsMGd4rvi8f88ce8fFkRY4vt/bUImVSE1cNbKVKqnlw/44qtU5tE4hoyYloN4DbE9IkL9ox7Vd5vAjQd/tWhldExR77Q== X-OriginatorOrg: axentia.se Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: <linux-pm.vger.kernel.org> X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/power/supply/bq24735-charger.c b/drivers/power/supply/bq24735-charger.c index 2787c19d6696..71f977d055d7 100644 --- a/drivers/power/supply/bq24735-charger.c +++ b/drivers/power/supply/bq24735-charger.c @@ -160,9 +160,15 @@ static int bq24735_config_charger(struct bq24735 *charger) static inline int bq24735_enable_charging(struct bq24735 *charger) { + int ret; + if (charger->pdata->ext_control) return 0; + ret = bq24735_config_charger(charger); + if (ret) + return ret; + return bq24735_update_word(charger->client, BQ24735_CHG_OPT, BQ24735_CHG_OPT_CHARGE_DISABLE, 0); } @@ -292,7 +298,6 @@ static int bq24735_charger_set_property(struct power_supply *psy, mutex_unlock(&charger->lock); if (ret) return ret; - bq24735_config_charger(charger); break; case POWER_SUPPLY_STATUS_DISCHARGING: case POWER_SUPPLY_STATUS_NOT_CHARGING: @@ -434,12 +439,6 @@ static int bq24735_charger_probe(struct i2c_client *client, } } - ret = bq24735_config_charger(charger); - if (ret < 0) { - dev_err(&client->dev, "failed in configuring charger"); - return ret; - } - /* check for AC adapter presence */ if (bq24735_charger_is_present(charger)) { ret = bq24735_enable_charging(charger);
During probe, it makes no sense to take care to first not issue any i2c commands to verify if the connected part really is a bq24735, to later simply fail the probe in the next step when trying to configure the charger. So, delay configuration of the charging parameters until the charger is accessible (i.e. when the AC adapter is present) as part of enabling the charging. This also fixes the rather serious issue that the charging parameters are lost when the AC adapter is disconnected. Signed-off-by: Peter Rosin <peda@axentia.se> --- drivers/power/supply/bq24735-charger.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)