Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1953350imb; Sun, 3 Mar 2019 12:17:24 -0800 (PST) X-Google-Smtp-Source: APXvYqysHwL/ZPTh0eBjRHZnMupMHEz/sifm4LFNSK2GBBJZNPYMLmQC+3y6oFvC7KVPlUc9Xce8 X-Received: by 2002:a17:902:6b8c:: with SMTP id p12mr16994639plk.282.1551644244535; Sun, 03 Mar 2019 12:17:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551644244; cv=none; d=google.com; s=arc-20160816; b=zkZqm+nOsV1Z8dUf2e03dEVfTPdmVCDRtDy1MYLkAYj/RCNNi7672wsEBWiE+/i95g /TZqDQBs3CP7/omowu/3s5BNCqcBpsP993CjxFPZsGuyTNOJylK7ihYrNrFuJn8Xbl1S EgaTXimJhkGI6JKUoMbhZYSvzn8lJo4wbXZt2eA5yJe28F9JD6n+2xBUPjSb5Fw8CkAL Dr9x/UBDyqkLA3gZka/a1zl0b/5jcFifx9E56b7nVPLZnH7XBAfT7HKzrcdlOIPOjg+G 3kvpjDEM4+yDkPIpOI4lD4KdfGSdwPe32b/evhlEcSlU9N+ihUQB6BCHyXrBzGfmNOJ4 Ls3A== 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=3Ut5F1KmFjOQ0jlhN+14pQF+2tOrtJRs/T7GtTtJGCg=; b=m1SFuTuklCVsCi0hzLZPv+iAr6FOj5S/rlsyqqub3ZFWJj2Hfhu4a/kzfhqMCePRoa FBpYS86jLVRCy2OF1bvubByjVKPTW8PrMnR8uskMFYUWKbcE+7eqnWM6eq6kGldqOp4s onCBohbqx9C4/TEdDaYAxVAso9SG6vaUKzNhguodatRuwcze6VkIr2cv6/SuJcENliES +yZ1OpFri7YhFfshoVXflxJg/vfMJNtF+qrFrrhkVwmklaGtrb8sogOJqz2u7jgHCetd 058Z8dSeSCYLZnjvV16qOrg+yDAC6mPC6rMtVpmku0m3jpvyN25Ws7PdLotpKkdqdJUv QdlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lIkYsUGM; 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 f11si3547742pgm.575.2019.03.03.12.17.09; Sun, 03 Mar 2019 12:17:24 -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=lIkYsUGM; 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 S1726626AbfCCUQn (ORCPT + 99 others); Sun, 3 Mar 2019 15:16:43 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34482 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbfCCUQn (ORCPT ); Sun, 3 Mar 2019 15:16:43 -0500 Received: by mail-lj1-f196.google.com with SMTP id l5so2494404lje.1 for ; Sun, 03 Mar 2019 12:16:41 -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=3Ut5F1KmFjOQ0jlhN+14pQF+2tOrtJRs/T7GtTtJGCg=; b=lIkYsUGM4Xg27pXfFwWn5xbdRTlwk7pi8xXQqhLj/tyH20YeYEYSW2pmCmge+wX8j6 u1SqZ9P1maRwIcNuFvqpA5M5k3AhE0e7ZIyLzYVQZluGnWBr24DVcfMz83T+VdE3K/nw FVulo1gDRlFBGOW9XPc93jj9vgcr9O5mARcGBNLKNzLSoCglXTll7AgHjHG0DN8zR4Df Ojv6v90GX1LDaLTyKLo8jZTMzKTMFDpbZy+LvAZW2xfiheGaAGiIX/4vRzHiWqWA7JnP dln4BPCZgG6P4Eg1iJYJtLtTiWjbjhtiWEQYSdNlolmciAaMuxmRfFw8cCF88bPCGsbK 3xmg== 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=3Ut5F1KmFjOQ0jlhN+14pQF+2tOrtJRs/T7GtTtJGCg=; b=OlIjLFWoRB46jlOsAdDcKoGf9wP6DEqkhI+73ErD+B86CEM/FS9UnRFi/xLTm7xsbX fw+ShD7bcaLc1n7O1j2CJR17idbpHRWVgrgJ16qM8ZhCX2MVAhFTC4raBOxza478PxAp pZRN17kO3q66ApS/0gtKs24V05Ev21VOBK5FhoKTOhugZb0njT75nFVfpMMwdmBE6fpj wAQaZgJuhJFduhANWcWZOKfTtn0HK1a9VPizCdbeu2sVDBwhaKoehlUOpspISedQz2ev eplcQ/XRpcxRtAF5C1VZH8HTWr7MfPpbicr3/OyTJ3qFxRD/2fHLLm593De7VYpB1GcS g/4Q== X-Gm-Message-State: APjAAAXqAXXtbA8FSYcfRGCqpLAjHPEdkj69hI1jx0FWyNFLL5KLcVYT +oC/wKVCcTzp8YzCxi8rZzrYX1aS X-Received: by 2002:a2e:93ca:: with SMTP id p10mr4101590ljh.16.1551644200560; Sun, 03 Mar 2019 12:16:40 -0800 (PST) Received: from localhost.localdomain ([46.216.192.153]) by smtp.gmail.com with ESMTPSA id o7sm1134914lff.73.2019.03.03.12.16.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Mar 2019 12:16:39 -0800 (PST) Received: from jek by localhost.localdomain with local (Exim 4.92-RC4) (envelope-from ) id 1h0XXK-0005Bg-6M; Sun, 03 Mar 2019 23:16:38 +0300 From: Yauhen Kharuzhy To: linux-kernel@vger.kernel.org Cc: MyungJoo Ham , Chanwoo Choi , Andy Shevchenko , Hans de Goede , Yauhen Kharuzhy Subject: [PATCH v3 0/2] extcon: Intel Cherry Trail Whiskey Cove PMIC and external charger tweaks Date: Sun, 3 Mar 2019 23:16:11 +0300 Message-Id: <20190303201613.19884-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]. v3 changes: - Don't restore of initial state of CHGDISCTRL and CHGRCTRL0 at exit but switch them into HW-controlled mode (as discussed in mailing list); - Use regmap_update_bits() instead of regmap_readi()/regmap_write() in the cht_wc_extcon_set_otgmode(); - Coding style and constant names changed as Andy and Hans recommended. 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 | 60 +++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) -- 2.20.1