From: Tony Lindgren <tony@atomide.com>
To: Carl Philipp Klemm <philipp@uvos.xyz>
Cc: Sebastian Reichel <sre@kernel.org>,
linux-omap@vger.kernel.org,
Arthur Demchenkov <spinal.by@gmail.com>,
Merlijn Wajer <merlijn@wizzup.org>, Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH v2 1/2] power: supply: cpcap-battery: Add battery type auto detection for mapphone devices
Date: Sat, 24 Apr 2021 09:47:27 +0300 [thread overview]
Message-ID: <YIO+/0OnFCoYkVIB@atomide.com> (raw)
In-Reply-To: <20210423145543.d007e8aa9bd2fc91dc51caa5@uvos.xyz>
Hi,
* Carl Philipp Klemm <philipp@uvos.xyz> [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
next prev parent reply other threads:[~2021-04-24 6:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 12:55 [PATCH v2 1/2] power: supply: cpcap-battery: Add battery type auto detection for mapphone devices Carl Philipp Klemm
2021-04-24 6:47 ` Tony Lindgren [this message]
2021-06-04 12:54 ` Sebastian Reichel
-- strict thread matches above, loose matches on Subject: below --
2021-04-24 7:00 carl
2021-04-24 9:17 ` Carl Philipp Klemm
2021-04-24 12:59 ` Tony Lindgren
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=YIO+/0OnFCoYkVIB@atomide.com \
--to=tony@atomide.com \
--cc=linux-omap@vger.kernel.org \
--cc=merlijn@wizzup.org \
--cc=pavel@ucw.cz \
--cc=philipp@uvos.xyz \
--cc=spinal.by@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.