Re: [PATCH 1/2] ACPI / AC: Notify when state changes in get_ac_property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2014-02-08 Alexander Mezin <mezin.alexander@xxxxxxxxx>:
> Do the same thing as in acpi_ac_resume.
>
> BIOS on my laptop (HP Pavilion dv6-6179er) don't send proper
> notifications when AC adapter is plugged/unplugged.
> This change makes it possible to workaround the problem by using
> acpid and a shell script.
>
> This patch has the same effect as
> commit 50a2bc5429f07ec4d53df2d287b03bdbceb281bb
> "ACPI / AC: change notification handler type to ACPI_ALL_NOTIFY"
>
> Aforementioned commit could be reverted.

Hi Alexander:
             I don't think the previous commit can be reverted. AC driver
should get system notify events(E,G bus check event) and  process them.
Some drivers(E,G radeon) also need to know AC event and AC driver's
notify handler sends the event to these drivers via block notifier call chain.
Further more, this patch only works when the related sysfs interfaces are
accessed. It's redundant with previous commit.

>
> Signed-off-by: Alexander Mezin <mezin.alexander@xxxxxxxxx>
> ---
>  drivers/acpi/ac.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
> index e7515aa..cdba639 100644
> --- a/drivers/acpi/ac.c
> +++ b/drivers/acpi/ac.c
> @@ -90,12 +90,16 @@ static int get_ac_property(struct power_supply *psy,
>                            union power_supply_propval *val)
>  {
>         struct acpi_ac *ac = to_acpi_ac(psy);
> +       unsigned long long old_state;
>
>         if (!ac)
>                 return -ENODEV;
>
> +       old_state = ac->state;
>         if (acpi_ac_get_state(ac))
>                 return -ENODEV;
> +       if (old_state != ac->state)
> +               kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
>
>         switch (psp) {
>         case POWER_SUPPLY_PROP_ONLINE:
> --
> 1.8.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best regards
Tianyu Lan
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux