From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Daniel Drake <drake@endlessm.com>,
Ian W MORRISON <ianwmorrison@gmail.com>
Subject: Re: [PATCH] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist
Date: Mon, 26 Aug 2019 12:11:10 +0300 [thread overview]
Message-ID: <20190826091110.GY30120@smile.fi.intel.com> (raw)
In-Reply-To: <20190823215255.7631-1-hdegoede@redhat.com>
On Fri, Aug 23, 2019 at 11:52:55PM +0200, Hans de Goede wrote:
> Another day; another DSDT bug we need to workaround...
>
> Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
> at least once on boot") we call _AEI edge handlers at boot.
>
> In some rare cases this causes problems. One example of this is the Minix
> Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
> and pasted code for dealing with Micro USB-B connector host/device role
> switching, while the mini PC does not even have a micro-USB connector.
> This code, which should not be there, messes with the DDC data pin from
> the HDMI connector (switching it to GPIO mode) breaking HDMI support.
>
> To avoid problems like this, this commit adds a new
> gpiolib_acpi_run_edge_events_on_boot kernel commandline option which
> can be "on", "off", or "auto" (default).
>
> In auto mode the default is on and a DMI based blacklist is used,
> the initial version of this blacklist contains the Minix Neo Z83-4
> fixing the HDMI being broken on this device.
> +static int gpiolib_acpi_run_edge_events_on_boot = -1;
> +
> +static int __init gpiolib_acpi_run_edge_events_on_boot_setup(char *arg)
> +{
> + if (!strcmp(arg, "on"))
> + gpiolib_acpi_run_edge_events_on_boot = 1;
> + else if (!strcmp(arg, "off"))
> + gpiolib_acpi_run_edge_events_on_boot = 0;
kstrtobool() ?
> + else if (!strcmp(arg, "auto"))
> + gpiolib_acpi_run_edge_events_on_boot = -1;
> +
> + return 1;
> +}
> +
> +__setup("gpiolib_acpi_run_edge_events_on_boot=",
> + gpiolib_acpi_run_edge_events_on_boot_setup);
Can't we use module_param() ?
The resulting option would be 'gpiolib_acpi.foo=...'
> +{
> + if (gpiolib_acpi_run_edge_events_on_boot == -1) {
> + if (dmi_check_system(run_edge_events_on_boot_blacklist))
> + gpiolib_acpi_run_edge_events_on_boot = 0;
> + else
> + gpiolib_acpi_run_edge_events_on_boot = 1;
> + }
Can we run this at an initcall once and use variable instead of calling a
method below?
> + return gpiolib_acpi_run_edge_events_on_boot;
> +}
> +
> static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
> struct acpi_gpio_event *event)
> {
> @@ -170,10 +211,13 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio,
> event->irq_requested = true;
>
> /* Make sure we trigger the initial state of edge-triggered IRQs */
> - value = gpiod_get_raw_value_cansleep(event->desc);
> - if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
> - ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
> - event->handler(event->irq, event);
> + if (acpi_gpiochip_run_edge_events_on_boot() &&
> + (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) {
> + value = gpiod_get_raw_value_cansleep(event->desc);
> + if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) ||
> + ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0))
> + event->handler(event->irq, event);
> + }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2019-08-26 9:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 21:52 [PATCH] gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist Hans de Goede
2019-08-24 10:53 ` Ian W MORRISON
2019-08-26 9:11 ` Andy Shevchenko [this message]
2019-08-27 14:41 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190826091110.GY30120@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=bgolaszewski@baylibre.com \
--cc=drake@endlessm.com \
--cc=hdegoede@redhat.com \
--cc=ianwmorrison@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox