linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Cc: chrome-platform@lists.linux.dev, linux-pm@vger.kernel.org,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Sebastian Reichel <sre@kernel.org>,
	Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	Pin-yen Lin <treapking@chromium.org>,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: Erroneous sbs-battery sysfs info a MT8173 Chromebook
Date: Fri, 4 Oct 2024 01:27:50 +0300	[thread overview]
Message-ID: <ae30adc7-8bcf-4daa-923a-d4a12e2404ea@gmail.com> (raw)
In-Reply-To: <a83e80f7-2bb8-423d-b24e-e793ce5da988@notapiano>

Hi,

On 2024-10-03 19:08 +03:00, Nícolas F. R. A. Prado wrote:
> On Thu, Oct 03, 2024 at 06:15:49PM +0300, Alper Nebi Yasak wrote:
>> Hello,
>>
>> I have a MT8173 Chromebook ("Lenovo 300e") where I'm getting a lot of 
>> battery-related errors:
>>
>> [   34.678473] sbs-battery 6-000b: sbs_read_string_data_fallback: Returned block_length is longer than 0x20
>> [   34.702079] power_supply_show_property: 5 callbacks suppressed
>> [   34.702096] power_supply sbs-6-000b: driver failed to report `technology' property: -22
>> 
>> [...]
>>
>> I have _another_ MT8173 Chromebook ("ASUS C202X") where things work 
>> fine. But I couldn't find a good mainline kernel version for this one.
>> Anyone have any idea what is going on?
> 
> FWIW, I have also experienced issues reading properties from the SBS batteries
> before on chromebooks:
> 
> https://lore.kernel.org/all/924db470-8163-4454-8f59-f7372a132186@notapiano/
> 
> In those cases it was due to the EC firmware not implementing the SBS commands,
> but that had already been fixed in the latest EC firmware release, so simply
> updating the firmware fixed it.

(Replied there as well for a different board: cozmo)

> I don't know how ectool works, but it might be fetching the battery properties
> through a different mechanism (ie not SBS commands), so this might also be a bug
> in the EC FW despite ectool working.

AFAICT, ectool talks to /dev/cros_ec with EC commands, which makes EC 
send SBS commands to the battery on its own; whereas in the kernel 
driver case it passes kernel's SBS commands through the i2c tunnel.

But never mind all that, I should've looked into ChromeOS kernel 
sources. There's a limited i2c passthrough [1] that's implemented there. 
And this specific battery is failing to recognize a read command due to 
a stop bit or something, so they use this limited passthrough [2]. I've 
managed to apply those on top of linux-next and it makes things work, 
but I have no idea how I'd go about upstreaming it (comments on [1] 
point out it's quite hacky and not used in later boards).

[1] CHROMIUM: i2c: wire a limited smart battery passthrough
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2230594

[2] CHROMIUM: arm64: dts: mt8173-hana: Add google,limited-passthrough property
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/422609


      reply	other threads:[~2024-10-03 22:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 15:15 Erroneous sbs-battery sysfs info a MT8173 Chromebook Alper Nebi Yasak
2024-10-03 16:08 ` Nícolas F. R. A. Prado
2024-10-03 22:27   ` Alper Nebi Yasak [this message]

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=ae30adc7-8bcf-4daa-923a-d4a12e2404ea@gmail.com \
    --to=alpernebiyasak@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=sre@kernel.org \
    --cc=treapking@chromium.org \
    --cc=tzungbi@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;
as well as URLs for NNTP newsgroup(s).