mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: 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
Date: Tue, 27 Sep 2016 15:34:48 +0200	[thread overview]
Message-ID: <87a8etwjnr.fsf@machinist.wiedmeyer.de> (raw)
In-Reply-To: <20160927081344.GC4394@kozik-lap>

[-- Attachment #1: Type: text/plain, Size: 4108 bytes --]


Krzysztof Kozlowski writes:

> 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 <wolfgit@wiedmeyer.de>
>
> 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.

When I was in the middle of implementing this, I noticed that the
charger manager does everything that is needed. But it took me quite
some time to configure the DTS correctly until I realized that the
charger manager used a deprecated function
(extcon_register_interest()) and thus couldn't work. And as I didn't see
the charger-manager in any other device's DTS, I thought that this might
not be right way.
But Chanwoo Choi has a fix: https://patchwork.kernel.org/patch/8898541/
So I will try to get it working with this patch.

> 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.

Ok, then I will try to reduce the patch to the CURRENT_NOW property
support.

> If you would like to play with charger-manager, here is my old DTS for
> Trats2 (might need updates):

Is there a reason that this patch is not in the kernel? It would have
been very helpful for me :)

Thanks,
Wolfgang

> index 595ad4ba6977..b4361b4a9de7 100644
> --- 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";
>         };
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>
> Best regards,
> Krzysztof


-- 
Website: https://fossencdi.org
OpenPGP: 0F30 D1A0 2F73 F70A 6FEE  048E 5816 A24C 1075 7FC4
Key download: https://wiedmeyer.de/keys/ww.asc

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  reply	other threads:[~2016-09-27 13:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 23:31 [PATCH 0/3] max77693: USB event listener for charger Wolfgang Wiedmeyer
2016-09-26 23:31 ` [PATCH 1/3] mfd: max77693: Add defines for charger current control Wolfgang Wiedmeyer
2016-09-27  8:06   ` Krzysztof Kozlowski
2016-09-27 13:54     ` Wolfgang Wiedmeyer
2016-09-26 23:31 ` [PATCH 2/3] regulator: max77693: Also manipulate the fast charge current Wolfgang Wiedmeyer
2016-09-27  8:03   ` Krzysztof Kozlowski
2016-09-27 13:50     ` Wolfgang Wiedmeyer
2016-09-27 16:15       ` Mark Brown
2016-09-27 17:51         ` Wolfgang Wiedmeyer
2016-09-28  8:04           ` Krzysztof Kozlowski
2016-09-26 23:31 ` [PATCH 3/3] power_supply: max77693: Listen for cable events and enable charging Wolfgang Wiedmeyer
2016-09-27  8:13   ` Krzysztof Kozlowski
2016-09-27 13:34     ` Wolfgang Wiedmeyer [this message]
2016-09-28  7:56       ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8etwjnr.fsf@machinist.wiedmeyer.de \
    --to=wolfgit@wiedmeyer.de \
    --cc=b.zolnierkie@samsung.com \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=krzk@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome