mbox series

[0/2] ACPI / x86: ac and battery device quirk work

Message ID 20211230193120.589337-1-hdegoede@redhat.com
Headers show
Series ACPI / x86: ac and battery device quirk work | expand

Message

Hans de Goede Dec. 30, 2021, 7:31 p.m. UTC
Hi Rafael,

Here are 2 patches for ACPI ac and battery device quirk handling on x86,
the first one refactors the almost identical quirk handling in ac.c and
battery.c out into a shared helper.

And the 2nd patch then uses the now shared code to also skip / ignore
ac and battery devices on x86 Android tablets with known broken DSDTs.

Note this applies on top of my:
"[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
series which you've just merged into your bleeding edge branch.

Regards,

Hans


Hans de Goede (2):
  ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
  ACPI / x86: Skip ac and battery devices on x86 Android tablets with
    broken DSDTs

 drivers/acpi/ac.c        | 43 ++------------------
 drivers/acpi/battery.c   | 42 ++------------------
 drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
 include/acpi/acpi_bus.h  |  5 +++
 4 files changed, 90 insertions(+), 86 deletions(-)

Comments

Rafael J. Wysocki Jan. 4, 2022, 2:52 p.m. UTC | #1
On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Rafael,
>
> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
> the first one refactors the almost identical quirk handling in ac.c and
> battery.c out into a shared helper.
>
> And the 2nd patch then uses the now shared code to also skip / ignore
> ac and battery devices on x86 Android tablets with known broken DSDTs.
>
> Note this applies on top of my:
> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
> series which you've just merged into your bleeding edge branch.
>
> Regards,
>
> Hans
>
>
> Hans de Goede (2):
>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
>     broken DSDTs
>
>  drivers/acpi/ac.c        | 43 ++------------------
>  drivers/acpi/battery.c   | 42 ++------------------
>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
>  include/acpi/acpi_bus.h  |  5 +++
>  4 files changed, 90 insertions(+), 86 deletions(-)

Applied as 5.17 material.

Note that the changes here clashed with some recent battery driver
changes, so I needed to resolve the merge conflict.  Please double
check the result.

Thanks!
Hans de Goede Jan. 4, 2022, 3:07 p.m. UTC | #2
Hi Rafael,

On 1/4/22 15:52, Rafael J. Wysocki wrote:
> On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Rafael,
>>
>> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
>> the first one refactors the almost identical quirk handling in ac.c and
>> battery.c out into a shared helper.
>>
>> And the 2nd patch then uses the now shared code to also skip / ignore
>> ac and battery devices on x86 Android tablets with known broken DSDTs.
>>
>> Note this applies on top of my:
>> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
>> series which you've just merged into your bleeding edge branch.
>>
>> Regards,
>>
>> Hans
>>
>>
>> Hans de Goede (2):
>>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
>>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
>>     broken DSDTs
>>
>>  drivers/acpi/ac.c        | 43 ++------------------
>>  drivers/acpi/battery.c   | 42 ++------------------
>>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
>>  include/acpi/acpi_bus.h  |  5 +++
>>  4 files changed, 90 insertions(+), 86 deletions(-)
> 
> Applied as 5.17 material.
> 
> Note that the changes here clashed with some recent battery driver
> changes, so I needed to resolve the merge conflict.  Please double
> check the result.

Sorry about the conflict.

I just checked and something indeed went wrong with the merge.

Checking drivers/acpi/battery.c from your bleeding-edge
branch there a bunch of now dead code still present there
related to setting the now never checked battery_check_pmic
global quirk flag:

Line 55: "static int battery_check_pmic = 1;"

Line 1105-1111:

"""
static int __init
battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
{
	battery_check_pmic = 0;
	return 0;
}

"""

Line 1146-1161:

"""
	{
		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
		.callback = battery_do_not_check_pmic_quirk,
		.matches = {
			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
		},
	},
	{
		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
		.callback = battery_do_not_check_pmic_quirk,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
		},
	},
"""

Since this all just sets the now no longer checked battery_check_pmic flag, it
is harmless, but all of this can be removed.

Regards,

Hans
Rafael J. Wysocki Jan. 4, 2022, 8:03 p.m. UTC | #3
On Tue, Jan 4, 2022 at 4:08 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Rafael,
>
> On 1/4/22 15:52, Rafael J. Wysocki wrote:
> > On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
> >>
> >> Hi Rafael,
> >>
> >> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
> >> the first one refactors the almost identical quirk handling in ac.c and
> >> battery.c out into a shared helper.
> >>
> >> And the 2nd patch then uses the now shared code to also skip / ignore
> >> ac and battery devices on x86 Android tablets with known broken DSDTs.
> >>
> >> Note this applies on top of my:
> >> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
> >> series which you've just merged into your bleeding edge branch.
> >>
> >> Regards,
> >>
> >> Hans
> >>
> >>
> >> Hans de Goede (2):
> >>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
> >>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
> >>     broken DSDTs
> >>
> >>  drivers/acpi/ac.c        | 43 ++------------------
> >>  drivers/acpi/battery.c   | 42 ++------------------
> >>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
> >>  include/acpi/acpi_bus.h  |  5 +++
> >>  4 files changed, 90 insertions(+), 86 deletions(-)
> >
> > Applied as 5.17 material.
> >
> > Note that the changes here clashed with some recent battery driver
> > changes, so I needed to resolve the merge conflict.  Please double
> > check the result.
>
> Sorry about the conflict.
>
> I just checked and something indeed went wrong with the merge.
>
> Checking drivers/acpi/battery.c from your bleeding-edge
> branch there a bunch of now dead code still present there
> related to setting the now never checked battery_check_pmic
> global quirk flag:
>
> Line 55: "static int battery_check_pmic = 1;"
>
> Line 1105-1111:
>
> """
> static int __init
> battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
> {
>         battery_check_pmic = 0;
>         return 0;
> }
>
> """
>
> Line 1146-1161:
>
> """
>         {
>                 /* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
>                 .callback = battery_do_not_check_pmic_quirk,
>                 .matches = {
>                         DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
>                 },
>         },
>         {
>                 /* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
>                 .callback = battery_do_not_check_pmic_quirk,
>                 .matches = {
>                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
>                         DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
>                         DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
>                 },
>         },
> """
>
> Since this all just sets the now no longer checked battery_check_pmic flag, it
> is harmless, but all of this can be removed.

OK, I redid the merge, please check again.

Thanks!
Hans de Goede Jan. 5, 2022, 12:17 p.m. UTC | #4
Hi,

On 1/4/22 21:03, Rafael J. Wysocki wrote:
> On Tue, Jan 4, 2022 at 4:08 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Rafael,
>>
>> On 1/4/22 15:52, Rafael J. Wysocki wrote:
>>> On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>>>
>>>> Hi Rafael,
>>>>
>>>> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
>>>> the first one refactors the almost identical quirk handling in ac.c and
>>>> battery.c out into a shared helper.
>>>>
>>>> And the 2nd patch then uses the now shared code to also skip / ignore
>>>> ac and battery devices on x86 Android tablets with known broken DSDTs.
>>>>
>>>> Note this applies on top of my:
>>>> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
>>>> series which you've just merged into your bleeding edge branch.
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>>
>>>>
>>>> Hans de Goede (2):
>>>>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
>>>>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
>>>>     broken DSDTs
>>>>
>>>>  drivers/acpi/ac.c        | 43 ++------------------
>>>>  drivers/acpi/battery.c   | 42 ++------------------
>>>>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
>>>>  include/acpi/acpi_bus.h  |  5 +++
>>>>  4 files changed, 90 insertions(+), 86 deletions(-)
>>>
>>> Applied as 5.17 material.
>>>
>>> Note that the changes here clashed with some recent battery driver
>>> changes, so I needed to resolve the merge conflict.  Please double
>>> check the result.
>>
>> Sorry about the conflict.
>>
>> I just checked and something indeed went wrong with the merge.
>>
>> Checking drivers/acpi/battery.c from your bleeding-edge
>> branch there a bunch of now dead code still present there
>> related to setting the now never checked battery_check_pmic
>> global quirk flag:
>>
>> Line 55: "static int battery_check_pmic = 1;"
>>
>> Line 1105-1111:
>>
>> """
>> static int __init
>> battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
>> {
>>         battery_check_pmic = 0;
>>         return 0;
>> }
>>
>> """
>>
>> Line 1146-1161:
>>
>> """
>>         {
>>                 /* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
>>                 .callback = battery_do_not_check_pmic_quirk,
>>                 .matches = {
>>                         DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
>>                 },
>>         },
>>         {
>>                 /* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
>>                 .callback = battery_do_not_check_pmic_quirk,
>>                 .matches = {
>>                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
>>                         DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
>>                         DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
>>                 },
>>         },
>> """
>>
>> Since this all just sets the now no longer checked battery_check_pmic flag, it
>> is harmless, but all of this can be removed.
> 
> OK, I redid the merge, please check again.

This looks good now, thanks.

Regards,

Hans