From patchwork Tue Sep 27 08:13:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9351583 Return-Path: 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 147F16077B for ; Tue, 27 Sep 2016 08:13:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 062DF290EE for ; Tue, 27 Sep 2016 08:13:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED360290F8; Tue, 27 Sep 2016 08:13:55 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 62D1529067 for ; Tue, 27 Sep 2016 08:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753702AbcI0INw (ORCPT ); Tue, 27 Sep 2016 04:13:52 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:32875 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753643AbcI0INu (ORCPT ); Tue, 27 Sep 2016 04:13:50 -0400 Received: by mail-lf0-f51.google.com with SMTP id b71so14263134lfg.0; Tue, 27 Sep 2016 01:13:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AUhBNACpXxSHb+nhZJUxyjKBM1t9rzkw2oh4xsTxmEg=; b=QjbE6ScI4KibhyQ5FjTBje2DaG/yLznrDrmZRMY2kKzxkIkqANrLgtKwAZdZj8GWgZ jYlWFdfrF77FGqGT+13s7KxgnqrjGV/qDntSy8gv0zGKqCa5UM+qwF9HpITzgp8AcQC2 wUVXHLSmaJwpjXNQ7WTI9T3DuFvc6uAkmqxu97HVQiuvcCW2IeGMVcx/IihSPUlKuGte 4DDJVUUD8QkAzEDt7Z6Ty2zNy5MqTplOFk3iSJmPZEZH/Lhbqpe/hYLmS5japSVGN8Fl q/y1jWd/BBrN+TBtm3yLhJfzY56QuyVA/t4MJhsbcfTXarIdobgGan92+PCHgWLD+1gr mrCA== X-Gm-Message-State: AE9vXwM9vGtnupAlXT+FwPjLVLePn9AlTSgZal3Kst8w/tbshGMpSvFvay57ltsctmuSrg== X-Received: by 10.46.5.151 with SMTP id 145mr9458174ljf.64.1474964028481; Tue, 27 Sep 2016 01:13:48 -0700 (PDT) Received: from kozik-lap (89-66-181-234.dynamic.chello.pl. [89.66.181.234]) by smtp.googlemail.com with ESMTPSA id f41sm203160lfi.39.2016.09.27.01.13.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Sep 2016 01:13:47 -0700 (PDT) Date: Tue, 27 Sep 2016 10:13:44 +0200 From: Krzysztof Kozlowski To: Wolfgang Wiedmeyer Cc: krzk@kernel.org, sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org, cw00.choi@samsung.com, b.zolnierkie@samsung.com, broonie@kernel.org, lgirdwood@gmail.com, lee.jones@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] power_supply: max77693: Listen for cable events and enable charging Message-ID: <20160927081344.GC4394@kozik-lap> References: <1474932670-11953-1-git-send-email-wolfgit@wiedmeyer.de> <1474932670-11953-4-git-send-email-wolfgit@wiedmeyer.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1474932670-11953-4-git-send-email-wolfgit@wiedmeyer.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Sep 27, 2016 at 01:31:10AM +0200, Wolfgang Wiedmeyer wrote: > This patch adds a listener for extcon cable events and enables > charging if an USB cable is connected. It recognizes SDP and DCP cable > types and treats them the same (same input current and fast charge > current). The maximum input current is set before the charger is > enabled and before the charger gets disabled, the maximum input > current is set to zero. The listener is inspired by the listener > implementation that was used for the AXP288 Charger driver. > > The patch also adds support for the CURRENT_NOW property. It reads the > fast charge current that gets set before the charger is enabled or > disabled. > > Signed-off-by: Wolfgang Wiedmeyer No. This power supply driver should not manage regulators. It is not a regulator consumer. For that specific need, there is a charger-manager driver. I agree that you might configure here the charger. You might even expose some writeable properties through power supply class. However the purpose of this driver is to expose the battery charger to user-space, not to replace the user-space with its work. So... NACK. If you would like to play with charger-manager, here is my old DTS for Trats2 (might need updates): index 595ad4ba6977..b4361b4a9de7 100644 Signed-off-by: Krzysztof Kozlowski Best regards, Krzysztof --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts @@ -856,6 +856,44 @@ }; }; + charger-manager@0 { + compatible = "charger-manager"; + status = "okay"; + chg-reg-supply = <&charger_reg>; + + cm-name = "battery"; + /* Polling only for external power source */ + cm-poll-mode = <2>; + cm-poll-interval = <30000>; + + cm-fullbatt-vchkdrop-ms = <30000>; + cm-fullbatt-vchkdrop-volt = <150000>; + cm-fullbatt-soc = <100>; + + cm-battery-stat = <0>; + cm-fuel-gauge = "max170xx_battery"; + + /* Allow charging for 5hr */ + cm-charging-max = <18000000>; + /* Allow discharging for 2hr */ + cm-discharging-max = <7200000>; + + cm-num-chargers = <1>; + cm-chargers = "max77693-charger"; + + charger@0 { + cm-regulator-name = "chg-reg"; + cable@0 { + cm-cable-name = "USB"; + cm-cable-extcon = "max77693-muic"; + }; + cable@1 { + cm-cable-name = "TA"; + cm-cable-extcon = "max77693-muic"; + }; + }; + }; + exynos-usbphy@125B0000 { status = "okay"; };