On Sat, Mar 4, 2023 at 12:19 AM Hans de Goede <hdegoede@xxxxxxxxxx> 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). > 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. -- With Best Regards, Andy Shevchenko