From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Mark Gross <markgross@kernel.org>,
Andy Shevchenko <andy@kernel.org>,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform/x86: Add intel_bytcrc_pwrsrc driver
Date: Sat, 4 Mar 2023 11:00:59 +0100 [thread overview]
Message-ID: <68a17e4e-a9ee-fe8b-abcd-7ccb4932e72a@redhat.com> (raw)
In-Reply-To: <CAHp75VfOUnVVr=_VcTch4-=KTv6v5yG3g+adgn2CtnjKCV0YYw@mail.gmail.com>
Hi,
On 3/3/23 23:41, Andy Shevchenko wrote:
> On Sat, Mar 4, 2023 at 12:19 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Add a new driver for the power-, wake- and reset-source functionality
>> of the Bay Trail (BYT) version of the Crystal Cove PMIC.
>>
>> The main functionality here is detecting which power-sources (USB /
>> DC in / battery) are active. This is normally exposed to userspace as
>> a power_supply class charger device with an online sysfs attribute.
>>
>> But if a charger is online or not is already exposed on BYT-CRC devices
>> through either an ACPI AC power_supply device, or through a native driver
>> for the battery charger chip (e.g. a BQ24292i).
>>
>> So instead of adding duplicate info under the power_supply class this
>> driver exports the info through debugfs and likewise adds debugfs files
>> for the reset- and wake-source info / registers.
>>
>> Despite this driver only exporting debugfs bits it is still useful to
>> have this driver because it clears the wake- and reset-source registers
>> after reading them. Not clearing these can have undesirable side-effects.
>
> Hmm... Why is the existing regmap debugfs not enough? OK, maybe adding
> something (clearing bits) to the actual CRC PMIC driver.
> (You also can add a write callback so regmap will provide the write
> access to the registers).
I did consider adding clearing the bits to the actual CRC PMIC driver,
but this seemed like a cleaner solution and it gives a much nicer
(debug) interface then raw register access.
Also after clearing the wake + reset reasons they are gone and cannot
be retreived using debugfs regmap accesses.
This driver caches the values before clearing them.
>> Specifically if the WAKESRC register contains 0x01 (wake by powerbutton)
>> on reboot then the firmware on some tablets turns the reboot into
>> a poweroff. I guess this may be necessary to make long power-presses turn
>> into a poweroff somehow?
>
> Have not a doc at hand. Next week I will try to dig into it to see if
> there is anything regarding it.
Note this seems to be a thing on BYT tablets which shipped with Android
and lack an EC compared to other BYT tablets with an CRC PMIC. So I think
things have been hacked around a bit here to deal with the lack of an EC.
I doubt this will be in the official docs, with that said thank you for
the offer to look this up.
Note for later BYTCR (Cost Reduced) tablets not having an EC is normal,
but these are pre BYTCR Android tablets actually AFAICT and their
Windows counterparts (same motherboard with some different components
do have an EC).
Regards,
Hans
next prev parent reply other threads:[~2023-03-04 10:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 22:19 [PATCH] platform/x86: Add intel_bytcrc_pwrsrc driver Hans de Goede
2023-03-03 22:41 ` Andy Shevchenko
2023-03-04 10:00 ` Hans de Goede [this message]
2023-07-10 9:23 ` Andy Shevchenko
2023-12-07 16:07 ` Andy Shevchenko
2023-12-07 17:39 ` Hans de Goede
2023-03-16 13:42 ` Hans de Goede
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=68a17e4e-a9ee-fe8b-abcd-7ccb4932e72a@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.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