Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp306043pxb; Wed, 20 Apr 2022 23:25:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdwjL2/F0/ao8fxnn02KekF/xG7hhOtZOAbPphTThzZBRrC2dqZwK2kocz/DUY70NqXzIG X-Received: by 2002:a17:902:d5ce:b0:158:48db:9719 with SMTP id g14-20020a170902d5ce00b0015848db9719mr23958264plh.7.1650522353388; Wed, 20 Apr 2022 23:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650522353; cv=none; d=google.com; s=arc-20160816; b=gTFWLO5kfD0QBpX7CQYY4vAVqeT8UaCHK5fjpTremvzPsY6YJaNd5zT4iiVsH0VjsE JtKaF30UHEcRbGy9mq9Y1rRHLmedWFZItHDMqYqr+CHUhEY4PRt3VNdA1l/6q2ItSlHa 2LD5SR56aiq5w3EGzadeTJQFilicdSvhTjt3GgpPMYb6dtAZK+QnfsniqXwZnkpianiw sGFd3P0UNBLTgpLd9tKBWO+IfSZiiCo9eRYWGn/f2qyow8rYhN29uFvCbfFgd1vDhve5 3dO/o7G5NsXQCkKzMGVXX9PuVEU2GA0MGpgmoIqFwxQ/jCbS764l853SPZIoqYIyW2nU 89Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=GiG8Kf5jte2JaaM7VW05Mvi1OJ2SeodBn8rH9FlBK7E=; b=bDf688D7TTBVg9rXUZYA8QNhMv/WmBQMahVTtveILh7DAYcHTHPtdU3vZcv8Wi0T5H hs9Le3E5Rz70PzSsAsHqfhAJVTQhj6OjfQhi6RaloXaS2xJxSN/GLRTDqmY9mWxdBiwB lIj5wIbOkALyfWwLzD2wjlQKlsY07jBwElDvdfPm2fXK/oGF74M1mS32OdEVM2vZ/5Dj n27HVpgLUSo1QG2Jjptf70CIOv/YaK4tsectAPDPOMxeplAYYBQx6APSEcS8DzaKL+VE uMcxxXBL96rAJYiCo/zOYJ7weDKB5ycAdrZyPlfhV1PLtwJU/25yfISDp2jsPbr3Fyxl Zoug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nqzbBSji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h29-20020a63531d000000b0039919e9128dsi4061390pgb.782.2022.04.20.23.25.39; Wed, 20 Apr 2022 23:25:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nqzbBSji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358196AbiDSWMx (ORCPT + 99 others); Tue, 19 Apr 2022 18:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358186AbiDSWMs (ORCPT ); Tue, 19 Apr 2022 18:12:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7E211C39; Tue, 19 Apr 2022 15:10:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26888617C8; Tue, 19 Apr 2022 22:10:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57787C385A5; Tue, 19 Apr 2022 22:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650406203; bh=nu7JAz/iZL5xTvK4t662LoC6NJwxk64ejQbKntayjS0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nqzbBSjii0XE3/O32BfwfZmA7x1Vj61tfhxaX5LFu6xKYotqzzco1/yprAaUIy8bA lo3POwW9Vk+ZWi+vUCL48fEo9dK9WkaVXsebg5a/3updlLqYimxU1QkSR5W/Lp9Bky FDkt+/000BDTQKAZitfcbHcA1AYCLx8bieS9stzwdVCv3UvTJ+jgJ8ZSW42YkbG7u3 Yy+jxF/qmQLbUJeh9oj1XnxiS+Gq8XIFjraDOtpNnSSFLt8vUynrJz7EQZir4/juG7 T+aw0XK0Qi2T8mNkHox128A0GUaRAJXOMYfOL1FKyN01kmN1VDUwx+7ALJJ1/gkZdt ZDaRsc1Wjp8uQ== Received: by pali.im (Postfix) id 070FB692; Wed, 20 Apr 2022 00:09:59 +0200 (CEST) Date: Wed, 20 Apr 2022 00:09:59 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: "Sicelo A. Mhlongo" Cc: sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/1] power: supply: bq27xxx: expose battery data when CI=1 Message-ID: <20220419220959.jnyhycaarxtucymo@pali> References: <20220419213647.1186284-1-absicsz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220419213647.1186284-1-absicsz@gmail.com> User-Agent: NeoMutt/20180716 X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 19 April 2022 23:36:46 Sicelo A. Mhlongo wrote: > We currently discard capacity information provided by the chip when the > Capacity Inaccurate flag is set. However, in many cases, having this > stale data is better than no information at all. > > Even if the chip has been fully reset, the datasheet shows that capacity > values (NAC specifically) can be seeded by using the WRTNAC facility of > the Control and Mode registers. After seeding, CI remains set, but the > capacity values are as accurate as the NAC value provided to WRTNAC is. NAC (Nominal Available Capacity) is exported via CHARGE_NOW property. So what about implementing CHARGE_NOW property also writable and write operation would do this WRTNAC seeding? So userspace would be able to do 'echo new_value > charge_now' and for Nokia N900 case just directly 'cat .../rx51_battery/charge_full_design > .../bq27200/charge_now' > On the Nokia N900, such seed value can be obtained from rx51_battery, > which reads battery data directly from the battery's BSI pin. This can > be done in userspace via i2c access to the registers. With this patch, > once seeded, capacity values are available through the driver. > > The patch was successfully tested on bq27200 on the Nokia N900. > > Signed-off-by: Sicelo A. Mhlongo > > Sicelo A. Mhlongo (1): > power: supply: bq27xxx: expose battery data when CI=1 > > drivers/power/supply/bq27xxx_battery.c | 58 +++++++++++++------------- > 1 file changed, 28 insertions(+), 30 deletions(-) > > -- > 2.35.2 >