Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1390033pxb; Sun, 21 Feb 2021 23:58:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNKbLfcHyVop/iZaYSe+S1R0mdSCUkOlKGMNAqMQqDcCy5Loxqrnrlpjg8WrXVTtcRAsU8 X-Received: by 2002:a05:6402:d1:: with SMTP id i17mr21197406edu.85.1613980727580; Sun, 21 Feb 2021 23:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613980727; cv=none; d=google.com; s=arc-20160816; b=QQTPtOdsg7hzbko1xR2mNBQVzATAQDnWYO7wYhcFwmYI/SdVng6DXC9/V3M0i/7Vcx tNdmWpAdcjJmgt4A2wk/hVO34wuAhi5cIOtLwKPWWq093U30cI+wnjDc+14VCv/NPUL6 NahfGQF0OkMUBWcG2dkvj+8ruyQ8OeFnJhcnoLS1o/poiVNHIaPCQUnGd+1E2OXTPcY5 Gcle5FqQ0JkGXOFZDbifcVdnzgLu14B91wmg5YEXy0ObByV7v6gOhOcMFCwA/7n7Js8B bdfGfCjz86UcyDkNhMjznzPwxcHmJiNj304Lh0wF43fUEgLi8vgSVr0esgN426tK6s7X LeOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=nyalEmrCRwMlLi+SMd1Lk7P3Sc9Mfy38mszD3y1A8Qc=; b=Ay1Lc+XaVwCEfj2ytzRiBI0aWHOgF82YAi2WBxfBSSbb+dilhB+iL13ufB6RYzDFQh g0TAiytlsPljMVuPn3SP92C/Ku76YeQ7xrUckF8hXlWDK1NGtz4XlQTEIDtW23VP1lWO PDyCEuvsUoRg8dCip1yS/AJx9H7n69AD/ReSl+xj5s/AEgyWR+yi0z3d5T9S4zrHcXGM +8KrWlGa66ep5VodzongZFcvzkAErIwhP9J5kG+poUG1g7bytR7tB3K+DYloEwDPI/hD 3pScJbIhzyzTUkvzGakwm5madW/oTr4IWX7pUxO9H1kNXEf9cmG3gbwX0hB5YU1qoiwA NlcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mf3si6057979ejb.475.2021.02.21.23.58.25; Sun, 21 Feb 2021 23:58:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbhBVH5C (ORCPT + 99 others); Mon, 22 Feb 2021 02:57:02 -0500 Received: from muru.com ([72.249.23.125]:36212 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbhBVH5B (ORCPT ); Mon, 22 Feb 2021 02:57:01 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 08F3180C3; Mon, 22 Feb 2021 07:56:47 +0000 (UTC) Date: Mon, 22 Feb 2021 09:56:07 +0200 From: Tony Lindgren To: Pavel Machek Cc: kernel list , linux-arm-kernel , linux-omap@vger.kernel.org, sre@kernel.org, nekit1000@gmail.com, mpartap@gmx.net, merlijn@wizzup.org, martin_rysavy@centrum.cz, phone-devel@vger.kernel.org, maemo-leste@lists.dyne.org, Carl Philipp Klemm Subject: Re: Droid 4 charging Message-ID: References: <20210206131415.GA4499@amd> <20210219215752.GA31435@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210219215752.GA31435@amd> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Pavel Machek [210219 21:58]: > > > If I turn off charging with echo 0 > input_current_limit, 0.2 to 0.4A > > > is drawn from USB, and battery is not discharged: > > > > > > root@devuan-droid4:/sys/class/power_supply/usb# echo 0 > input_current_limit > > > root@devuan-droid4:/sys/class/power_supply/usb# cat current_now > > > 0 > > > > Hmm so have you measured that setting the current limit to 0 actually > > draws something from the USB? > > Yes, it does, if I do the echo when charge is done. (I have small USB > passthrough with volt and amp meters). It has been behaving weirdly in > other cases.p OK great, seems like we can just change the charger timeout then. > > I recall clearing the ichrgr bits stops the vbus draw completely, but > > I could be wrong. > > > > > Is that a better way to handle full battery? > > > > We could experiment with switching over to usb power when the battery is > > full. Looking at the docs for mc1378 it might be possible that setting > > CPCAP_REG_CRM_FET_OVRD and clearing CPCAP_REG_CRM_FET_CTRL after the > > battery is full disables charging but still keep drawing power from > > the usb. I'd assume the current limit still needs to be nonzero there > > too? Totally untested.. > > I may be able to test patches... Yeah this too might be worth testing on some donor device.. > > And switching back to battery power on usb disconnect will potentially > > only give us very little time based on the different line length for > > vbus and ground pins compared to data pins on the usb connector.. And > > uvos had some concerns about the battery capacity putting it back online, > > so adding him to Cc also. > > You mean, we'd have to take interrupt and switch registers in order to > switch back to battery power, and system would crash if we did not > make it in time? Yes hopefully we don't need to do that. My guess is we should find some FET_OVRD and FET_CTRL setting we can always keep enabled after charger negotation. Maybe we already have the right settings based on your tests :) Regards, Tony