On Tue, Mar 3, 2020 at 8:29 AM Jian-Hong Pan <jian-hong@xxxxxxxxxxxx> wrote: > > Rafael J. Wysocki <rafael@xxxxxxxxxx> 於 2020年3月2日 週一 下午7:45寫道: > > > > On Mon, Mar 2, 2020 at 11:38 AM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote: > > > > > > On Mon, Mar 2, 2020 at 6:54 AM Jian-Hong Pan <jian-hong@xxxxxxxxxxxx> wrote: > > > > > > > > Daniel Drake <drake@xxxxxxxxxxxx> 於 2020年2月28日 週五 下午5:43寫道: > > > > > > > > > > On Thu, Feb 27, 2020 at 10:25 PM Rafael J. Wysocki <rjw@xxxxxxxxxxxxx> wrote: > > > > > > The purpose of this series of update of the ACPI EC driver is to make its > > > > > > initialization more straightforward. > > > > > > > > > > > > They fix a couple of issues, clean up some things, remove redundant code etc. > > > > > > > > > > > > Please refer to the changelogs of individual patches for details. > > > > > > > > > > > > For easier access, the series is available in the git branch at > > > > > > > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ > > > > > > acpi-ec-work > > > > > > > > > > > > on top of 5.6-rc3. > > > > > > > > > > Jian-Hong, can you please test this on Asus UX434DA? > > > > > Check if the screen brightness hotkeys are still working after these changes. > > > > > > > > Hi Rafael, > > > > > > > > Thanks for your patches, but we found an issue: > > > > The laptops like ASUS UX434DA's screen brightness hotkeys work before > > > > this patch series. However, the hotkeys are failed with the patch > > > > "ACPI: EC: Unify handling of event handler installation failures". > > > > > > So I have modified the series to avoid the change that can possibly break this. > > > > > > Can you please pull the new series from > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ > > > acpi-ec-work > > > > > > (same branch) and retest? > > > > Note that the current top-most commit in that branch is > > > > 0957d98f50da ACPI: EC: Consolidate event handler installation code > > I tested the commits in acpi-ec-work branch whose last commit is > 0957d98f50da ("ACPI: EC: Consolidate event handler installation > code"). The screen brightness hotkeys are still failed with > 0957d98f50da ("ACPI: EC: Consolidate event handler installation > code"). > > I tweak and add some debug messages: > > diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c > index 85f1fe8e208a..3887f427283c 100644 > --- a/drivers/acpi/ec.c > +++ b/drivers/acpi/ec.c > @@ -1443,23 +1443,27 @@ static bool install_gpe_event_handler(struct > acpi_ec *ec) > return true; > } > > -static bool install_gpio_irq_event_handler(struct acpi_ec *ec, > +static int install_gpio_irq_event_handler(struct acpi_ec *ec, > struct acpi_device *device) > { > int irq, ret; > > /* ACPI reduced hardware platforms use a GpioInt specified in _CRS. */ > irq = acpi_dev_gpio_irq_get(device, 0); > - if (irq < 0) > - return false; > + if (irq < 0) { > + pr_err("%s: acpi_dev_gpio_irq_get returns %d\n", __func__, irq); > + return irq; > + } > > ret = request_irq(irq, acpi_ec_irq_handler, IRQF_SHARED, "ACPI EC", ec); > - if (ret < 0) > - return false; > + if (ret < 0) { > + pr_err("%s: request_irq returns %d\n", __func__, ret); > + return ret; > + } > > ec->irq = irq; > > - return true; > + return 0; > } > > /** > @@ -1517,9 +1521,11 @@ static int ec_install_handlers(struct acpi_ec > *ec, struct acpi_device *device) > * fatal, because the EC can be polled for events. > */ > } else { > - ready = install_gpio_irq_event_handler(ec, device); > - if (!ready) > - return -ENXIO; > + pr_err("%s: install_gpio_irq_event_handler\n", > __func__); > + int ret = install_gpio_irq_event_handler(ec, device); > + if (ret) > + return ret; > + ready = true; > } > if (ready) { > set_bit(EC_FLAGS_EVENT_HANDLER_INSTALLED, &ec->flags); > > The dmesg shows: > > [ 0.121117] ACPI: EC: ec_install_handlers: install_gpio_irq_event_handler > [ 0.121133] ACPI: EC: install_gpio_irq_event_handler: > acpi_dev_gpio_irq_get returns -517 > > Originally, ec_install_handlers() will return the returned value from > install_gpio_irq_event_handler() from acpi_dev_gpio_irq_get(), which > is -EPROBE_DEFER, instead of -ENXIO. However, ec_install_handlers() > returns -ENXIO directly if install_gpio_irq_event_handler() returns > false in patch ("ACPI: EC: Consolidate event handler installation > code"). Here needs some modification. Thanks, I forgot about the -EPROBE_DEFER case.