From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Liam Breck <liam@networkimprov.net>
Cc: "Sebastian Reichel" <sre@kernel.org>,
"Pali Rohár" <pali.rohar@gmail.com>,
"Andrew F. Davis" <afd@ti.com>,
"Linux PM mailing list" <linux-pm@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
"Discussions about the Letux Kernel"
<letux-kernel@openphoenux.org>,
kernel@pyra-handheld.com
Subject: Re: [PATCH resend v2] power: supply: bq27xxx: enable writing capacity values for bq27421
Date: Sat, 9 Sep 2017 00:08:03 +0200 [thread overview]
Message-ID: <BD7B5AE4-ACD7-4255-8D9D-F0987CFF032A@goldelico.com> (raw)
In-Reply-To: <CAKvHMgSQduvA6MFgNMgaYejep74OfJPUnCGJ3cKeHty=OAabPg@mail.gmail.com>
> Am 08.09.2017 um 22:57 schrieb Liam Breck <liam@networkimprov.net>:
>
> Howdy,
>
> On Fri, Sep 8, 2017 at 1:28 PM, H. Nikolaus Schaller <hns@goldelico.com> wrote:
>> Hi Liam,
>>
>>> Am 08.09.2017 um 22:19 schrieb Liam Breck <liam@networkimprov.net>:
>>>
>>> Hi Nikolaus,
>>>
>>> On Fri, Sep 8, 2017 at 10:38 AM, H. Nikolaus Schaller <hns@goldelico.com> wrote:
>>>> Hi Liam,
>>>> I finally continues testing on OpenPandora.
>>>>
>>>>> Am 31.08.2017 um 22:19 schrieb Liam Breck <liam@networkimprov.net>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> This may be a fix that allows >0 input from DT, but won't try to
>>>>> program the register since the first 3 fields aren't compatible:
>>>>>
>>>>> ... bq27500_dm_regs[] = {
>>>>> ...
>>>>> [bq27xxx_dm_design_energy] = { 0, 0, 0, 0, 65535 }, /* missing on chip */
>>>>> NB: align columns with other rows
>>>>
>>>> I have tried with this DT
>>>>
>>>> bat: battery {
>>>> compatible = "simple-battery", "openpandora-battery";
>>>> voltage-min-design-microvolt = <3250000>;
>>>> energy-full-design-microwatt-hours = <14800000>;
>>>> charge-full-design-microamp-hours = <4100000>;
>>>> };
>>>>
>>>> and here is the result:
>>>>
>>>>> root@letux:~# dmesg|fgrep bq27
>>>>> [ 10.391235] bq27xxx_battery_setup
>>>>> [ 10.391265] bq27xxx_battery_setup: dm_regs=bf0520e0
>>>>> [ 10.393798] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix
>>>>> [ 10.432678] bq27xxx_battery_settings
>>>>> [ 10.432952] bq27xxx_battery_set_config
>>>>> [ 10.432952] bq27xxx_battery_unseal
>>>>> [ 10.485168] bq27xxx_battery_update_dm_block
>>>>> [ 10.485198] bq27xxx-battery 2-0055: update design-capacity to 4100
>>>>
>>>> looks good
>>>>
>>>>> [ 10.485229] bq27xxx_battery_update_dm_block
>>>>> [ 10.485229] bq27xxx-battery 2-0055: buffer does not match design-energy dm spec
>>>>
>>>> ok, ignored
>>>>
>>>>> [ 10.511718] bq27xxx_battery_update_dm_block
>>>>> [ 10.511749] bq27xxx-battery 2-0055: update terminate-voltage to 3250
>>>>
>>>> looks good
>>>>
>>>>> [ 10.826446] bq27xxx_battery_seal
>>>>> [ 12.150939] bq27xxx_battery_platform_probe
>>>>> [ 12.151031] bq27xxx_battery_setup
>>>>> [ 12.151062] bq27xxx_battery_setup: dm_regs= (null)
>>>>> [ 12.153411] (NULL device *): hwmon: 'bq27000-battery' is not a valid name attribute, please fix
>>>>> [ 12.154327] bq27xxx_battery_settings
>>>>> [ 12.154357] power_supply bq27000-battery: power_supply_get_battery_info currently only supports devicetree
>>>>> [ 12.154388] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-6
>>>
>>> Is there also a bq27000 chip on this device, or a battery with it
>>> embedded? If so, it doesn't appear to have a DT node (correct for
>>> embedded), hence that warning, which isn't useful in that case. Prob
>>> battery_settings() should do:
>>> if (!di->dev->of_node || power_supply_get_battery_info(...) < 0) return;
>>> altho that would be wrong once get_battery_info() supports ACPI config...
>>
>> No it is not available, but could be. The bq27000 can be connected through
>> HDQ to an OMAP3 and therefore there is no auto-detection. If it is configured
>> the driver will be loaded. Even if there is no battery_info.
>>
>> In fact we use the same defconfig for several devices and there is one (GTA04)
>> which only has a bq27000 inside the battery.
>
> Any idea why the driver detects a non-present bq27000 and calls
> probe() for it? defconfig with battery_bq27xxx=y ?
Yes.
The key reason is that hdq can't detect presence of a device
without support of the device driver. Which means as soon as
you have hdq and the battery driver it will be present and
create /sys/class/power entry. Which says "battery not present".
It is the best it can do. Especially for removeable batteries
(which might be installed some time after boot and probing).
If you want to study further, there is some code in the hdq
subsystem to load the bq27000.
BR,
Nikolaus
next prev parent reply other threads:[~2017-09-08 22:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 20:10 [PATCH resend v2] power: supply: bq27xxx: enable writing capacity values for bq27421 H. Nikolaus Schaller
2017-08-29 20:20 ` Liam Breck
2017-08-30 0:37 ` Sebastian Reichel
2017-08-30 9:30 ` H. Nikolaus Schaller
2017-08-30 11:24 ` Liam Breck
2017-08-31 6:58 ` H. Nikolaus Schaller
2017-08-31 8:58 ` Liam Breck
2017-08-31 9:35 ` H. Nikolaus Schaller
2017-08-31 20:19 ` Liam Breck
2017-09-08 17:38 ` H. Nikolaus Schaller
2017-09-08 17:40 ` Pali Rohár
2017-09-08 17:44 ` H. Nikolaus Schaller
2017-09-08 20:19 ` Liam Breck
2017-09-08 20:28 ` H. Nikolaus Schaller
2017-09-08 20:57 ` Liam Breck
2017-09-08 22:08 ` H. Nikolaus Schaller [this message]
2017-09-09 20:21 ` [PATCH resend v2] power: supply: bq27xxx: enable writing capacity values for bq27421 + bq27500 H. Nikolaus Schaller
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=BD7B5AE4-ACD7-4255-8D9D-F0987CFF032A@goldelico.com \
--to=hns@goldelico.com \
--cc=afd@ti.com \
--cc=kernel@pyra-handheld.com \
--cc=letux-kernel@openphoenux.org \
--cc=liam@networkimprov.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pali.rohar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox