From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9CC8C43461 for ; Sat, 24 Apr 2021 06:48:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF76B61606 for ; Sat, 24 Apr 2021 06:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244407AbhDXGtC (ORCPT ); Sat, 24 Apr 2021 02:49:02 -0400 Received: from muru.com ([72.249.23.125]:48106 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231701AbhDXGsS (ORCPT ); Sat, 24 Apr 2021 02:48:18 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 0943080C3; Sat, 24 Apr 2021 06:47:33 +0000 (UTC) Date: Sat, 24 Apr 2021 09:47:27 +0300 From: Tony Lindgren To: Carl Philipp Klemm Cc: Sebastian Reichel , linux-omap@vger.kernel.org, Arthur Demchenkov , Merlijn Wajer , Pavel Machek Subject: Re: [PATCH v2 1/2] power: supply: cpcap-battery: Add battery type auto detection for mapphone devices Message-ID: References: <20210423145543.d007e8aa9bd2fc91dc51caa5@uvos.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210423145543.d007e8aa9bd2fc91dc51caa5@uvos.xyz> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hi, * Carl Philipp Klemm [210423 12:55]: > +static void cpcap_battery_detect_battery_type(struct cpcap_battery_ddata *ddata) > +{ > + struct nvmem_device *nvmem; > + u8 battery_id = 0; > + > + ddata->check_nvmem = false; > + > + nvmem = nvmem_device_find(NULL, &cpcap_battery_match_nvmem); > + if (IS_ERR_OR_NULL(nvmem)) { > + ddata->check_nvmem = true; > + if (!ddata->no_nvmem_warned) { > + dev_info(ddata->dev, "Can not find battery nvmem device. Assuming generic lipo battery\n"); > + ddata->no_nvmem_warned = true; > + } Folks are also using the device with no battery at all to have it directly connected to the power supply. This is handy for remotely power cycling the device, and also for measuring power consumption with a bench power supply. So by default I think we should continue assuming no battery is inserted rather than assume a generic battery is inserted. How about require configuring the undetected battery parameters via /sys/class/power_supply to indicate a non-standard battery is inserted? At least battery type, capacity, and voltage can depend on the generic battery inserted. Other than that, the NVRAM changes look nice to me. Regards, Tony