Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4003567imj; Tue, 19 Feb 2019 13:25:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IZGlwpvGS2U/wR/RpMiItqnFo9xrNgOxqi8k9qwM3Y6TzVflWlLsrsVrMpIlTw4vkIW5sxr X-Received: by 2002:a62:76c9:: with SMTP id r192mr32025165pfc.251.1550611556903; Tue, 19 Feb 2019 13:25:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550611556; cv=none; d=google.com; s=arc-20160816; b=xmNrzpACFambEXcgrwrobwAp9XXR7xdnHrlxdqBgqGFswWp7WKmifmLoA1fthC2CDp zPRGqQIWrWn7x4Jdxg3Ie5uvDi99yhVtb6YV6DPqf5GEvRyulqksmiNWcRsTGj2SPATQ QftS+oYHcbKqtVgM+4dWZG4JrdPzYgFwzd+lKVXCpNEeQmDAA+4EUSjSPuledjN3AUb8 0btsyT0TSgSrERk/UbRHDCja8HLRWJpIruv2BLdgsNglcmyxq0ecgqMK3z6Un0hFFGKd wiG3pt1OK5kjUDzdpb3gM3WbTIiI9SBQESoJjbYMvwgU7SgtStwzwzivtOx27LFC9hyF ONXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cjQnR7W4bi473rcLkgASnoHLlD2X3fmlSX69EZkK6ms=; b=rvSfunvaKtzhx933z4Bi02H/l4K8KRz07gSQqpEa6MDfYTu+VQutvaP5VJjUM5ahf1 rhLway5DBDcW5fA1YxoVEGK94ZzIAMf/ztzWXbSt3ENMkEpb1+tDK1VcuJR3IAdEvOiw igUkRL3IE5xSWGAYZQ3BM1oTQOFW5lCbyEWRkXOyvwodWBbh9xTOTPmfaWlaAD21ik5s Dh9RJvaYLbQR/MEcW9AM0ALQJfazuta4IFL2LFdOe++NN6lQr+gT6wtJ6RLNgkIg0pWf 5ZQdq1P5SepOySAvZDs4JZkTKD3oM1WgFrSIh5ymS1qN75g3ZyDNDBfEEbCS83sniBda oYVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=as3DDm8O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si17695400pld.386.2019.02.19.13.25.42; Tue, 19 Feb 2019 13:25:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=as3DDm8O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729556AbfBSVYv (ORCPT + 99 others); Tue, 19 Feb 2019 16:24:51 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40470 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbfBSVYv (ORCPT ); Tue, 19 Feb 2019 16:24:51 -0500 Received: by mail-wm1-f67.google.com with SMTP id t15so4216030wmi.5 for ; Tue, 19 Feb 2019 13:24:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cjQnR7W4bi473rcLkgASnoHLlD2X3fmlSX69EZkK6ms=; b=as3DDm8OzAE593jT40zyiS7qhgd3zsuiV53NXhwpQuWdJbnBIqLYDVBmUxTYd7KsIW N7GODrTeT86sakk8+V09WKQ9bBdw31t8hiDkWUpfse1G6wRs5UhhRAmvJ8dJ26ZLAOsU tpLUh8xR7XzG+uqa0eAI12cmmwoaXp7F8m3aOnsgjMvQUzqo/sFD5DOGMdzG5dvL0TYK rRfOimarBAdBkTZSjGRquQs+M1SUheIFDnf3HWeBMYbnPiAQiZd2Ok9ReAg8r2RIb0VM FPRjNtE/33vMFPiWrGrcR75Wdfc2FmgKTMX9f3T2SJIyKx3YXMDKfIhMkS2znfTDTyNz BocQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cjQnR7W4bi473rcLkgASnoHLlD2X3fmlSX69EZkK6ms=; b=P1X3xjbpYlQaTpK3r6/pYGu84DZsCM/3b5r2oizlI8OUFEAc9Trfl6AzDaHdpQM3tC dVECmEOfxg3ud3p3cMe/g8QMQ8ByWjKfHsmc/VJR4K0jAWO3Zys4H0B/0ChbxOy0iB9S Zao5maXbtt8Zn6Pu+GeNdTwh9igOgfr42IQj3PcMLTgOARAPZngZLyIpzEWrPP2aZxe0 FK0EXEOyP6htnJL7GwmtrQKTMr366edG//KTNNw6aGCaWGLYIXDwzmHaI4An28wC7KDE gcNE3av+ML91xxBFrUFmYD5lXjKXJny5xphs8eOKN4aMo2aijbgg8oW6XyP6W1WbArYk GiKA== X-Gm-Message-State: AHQUAuZ0h/BLLstmqSejCVKH7PsPI2hqOzCq0fYIK3XtBPxegvo8qjvs OidGo0S7ho/LevJdXrBx1pNe9XpL X-Received: by 2002:a1c:7c08:: with SMTP id x8mr4336212wmc.8.1550611489062; Tue, 19 Feb 2019 13:24:49 -0800 (PST) Received: from localhost.localdomain ([46.216.153.243]) by smtp.gmail.com with ESMTPSA id c129sm4035151wma.48.2019.02.19.13.24.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 13:24:47 -0800 (PST) Received: from jek by localhost.localdomain with local (Exim 4.92-RC4) (envelope-from ) id 1gwCsf-00053X-8z; Wed, 20 Feb 2019 00:24:45 +0300 From: Yauhen Kharuzhy To: linux-kernel@vger.kernel.org Cc: MyungJoo Ham , Chanwoo Choi , Hans de Goede , Andy Shevchenko , Yauhen Kharuzhy Subject: [PATCH v2 0/2] extcon: Intel Cherry Trail Whiskey Cove PMIC and external charger tweaks Date: Wed, 20 Feb 2019 00:24:39 +0300 Message-Id: <20190219212441.19391-1-jekhor@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At implementation of charging support for Lenovo Yoga Book (Intel Cherry Trail based with Whiskey Cove PMIC), two pitfalls were found: - for detection of charger type by PMIC, bit 6 in the CHGRCTRL1 register should be set in 0 (and set to 1 for Host mode). Pick up its definition and logic from from Intel code drop[1]; - "#CHARGE ENABLE" signal of external charger (bq25892) in Yoga Book is connected to one of PMIC outputs controlled by CHGDISCTRL register. Enable charging at driver initialization. Pick up this from Lenovo's code drop[2,3]. v2 changes: - Disable HW control mode of CHGDISCTRL at driver probing and restore initial state at exit. - Switch CE output off if OTG host mode is enabled. - Save and restore CHGRCTRL0 register also. [1]. https://github.com/01org/ProductionKernelQuilts/uefi/cht-m1stable/patches/0001-power_supply-intel-pmic-ccsm-driver.patch [2]. https://github.com/jekhor/yogabook-linux-android-kernel/blob/b7aa015ab794b516da7b6cb76e5e2d427e3b8b0c/drivers/power/bq2589x_charger.c#L2257 [3]. https://github.com/01org/ProductionKernelQuilts/uefi/cht-m1stable/patches/EM-Charger-Disable-battery-charging-in-S3-and-enable.patch Yauhen Kharuzhy (2): extcon-intel-cht-wc: Make charger detection co-existed with OTG host mode extcon intel-cht-wc: Enable external charger drivers/extcon/extcon-intel-cht-wc.c | 129 ++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-) -- 2.20.1