Message ID | 1391801333-18519-1-git-send-email-mezin.alexander@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: > 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@gmail.com> > --- > 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@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: > 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >> 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. OK, I didn't think about other drivers and so. Second patch works fine on its own (if old commit isn't reverted, of course), I've tested it just now. Should I resend it as single patch? -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: > 2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >> 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >>> 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. > > OK, I didn't think about other drivers and so. > > Second patch works fine on its own (if old commit isn't reverted, of course), > I've tested it just now. Should I resend it as single patch? Hi: What's the benefit of the second patch without this patch? So far, bios sends the ACPI notify event of power change to AC driver and the driver would change status and send uevent. That seems enough. BTW, battery status update normally is also triggered by ACPI notify event.
2014-02-10 8:29 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: > 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >> 2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: > Hi: > What's the benefit of the second patch without this patch? > So far, bios sends the ACPI notify event of power change to AC driver and > the driver would change status and send uevent. That seems enough. Without second patch AC adapter's status isn't updated on my laptop. AC status updates only if I run "acpi -a". I usually automated this with acpid. On my laptop only battery notifications are working fine. With second patch (and without first) everything works as it should. -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2014-02-10 10:16 GMT+08:00 Alexander Mezin <mezin.alexander@gmail.com>: > 2014-02-10 8:29 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >> 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >>> 2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >> Hi: >> What's the benefit of the second patch without this patch? >> So far, bios sends the ACPI notify event of power change to AC driver and >> the driver would change status and send uevent. That seems enough. > Without second patch AC adapter's status isn't updated on my laptop. commit 50a2bc5429f can't fix this issue. > AC status updates only if I run "acpi -a". I usually automated this > with acpid. > On my laptop only battery notifications are working fine. > With second patch (and without first) everything works as it should.
2014-02-10 Lan Tianyu <lantianyu1986@gmail.com>: > 2014-02-10 10:16 GMT+08:00 Alexander Mezin <mezin.alexander@gmail.com>: >> 2014-02-10 8:29 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >>> 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >>>> 2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >>> Hi: >>> What's the benefit of the second patch without this patch? >>> So far, bios sends the ACPI notify event of power change to AC driver and >>> the driver would change status and send uevent. That seems enough. >> Without second patch AC adapter's status isn't updated on my laptop. > > commit 50a2bc5429f can't fix this issue. Sorry. commit 50a2bc5429f can't fix this issue? > >> AC status updates only if I run "acpi -a". I usually automated this >> with acpid. >> On my laptop only battery notifications are working fine. >> With second patch (and without first) everything works as it should. > > > > -- > Best regards > Tianyu Lan
2014-02-10 9:34 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: > 2014-02-10 Lan Tianyu <lantianyu1986@gmail.com>: >> 2014-02-10 10:16 GMT+08:00 Alexander Mezin <mezin.alexander@gmail.com>: >>> 2014-02-10 8:29 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >>>> 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >>>>> 2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >>>> Hi: >>>> What's the benefit of the second patch without this patch? >>>> So far, bios sends the ACPI notify event of power change to AC driver and >>>> the driver would change status and send uevent. That seems enough. >>> Without second patch AC adapter's status isn't updated on my laptop. >> >> commit 50a2bc5429f can't fix this issue. > Sorry. commit 50a2bc5429f can't fix this issue? No, it doesn't solve the problem. But before it AC state didn't update even when I run "acpi -a". There was no way other than reboot. -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2014-02-10 Alexander Mezin <mezin.alexander@gmail.com>: > 2014-02-10 9:34 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >> 2014-02-10 Lan Tianyu <lantianyu1986@gmail.com>: >>> 2014-02-10 10:16 GMT+08:00 Alexander Mezin <mezin.alexander@gmail.com>: >>>> 2014-02-10 8:29 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >>>>> 2014-02-08 Alexander Mezin <mezin.alexander@gmail.com>: >>>>>> 2014-02-08 13:33 GMT+07:00 Lan Tianyu <lantianyu1986@gmail.com>: >>>>> Hi: >>>>> What's the benefit of the second patch without this patch? >>>>> So far, bios sends the ACPI notify event of power change to AC driver and >>>>> the driver would change status and send uevent. That seems enough. >>>> Without second patch AC adapter's status isn't updated on my laptop. >>> >>> commit 50a2bc5429f can't fix this issue. >> Sorry. commit 50a2bc5429f can't fix this issue? > No, it doesn't solve the problem. But before it AC state didn't update > even when I run "acpi -a". There was no way other than reboot. Ok. You mean AC state didn't update before running "acpi -a" with commit 50a2bc5429f, right? How do you check the AC state? via /sys/class/power_supply/ACXX/online? What does acpi_listen show when plug or unplug adaptor?
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:
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. Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com> --- drivers/acpi/ac.c | 4 ++++ 1 file changed, 4 insertions(+)