<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/acpi/ec.c, branch linux-5.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-11-08T15:20:37Z</updated>
<entry>
<title>ACPI: EC: Do not release locks during operation region accesses</title>
<updated>2024-11-08T15:20:37Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2024-07-04T16:26:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bcb4a23f035dfec2c3a97153b8985da6e162daa3'/>
<id>urn:sha1:bcb4a23f035dfec2c3a97153b8985da6e162daa3</id>
<content type='text'>
[ Upstream commit dc171114926ec390ab90f46534545420ec03e458 ]

It is not particularly useful to release locks (the EC mutex and the
ACPI global lock, if present) and re-acquire them immediately thereafter
during EC address space accesses in acpi_ec_space_handler().

First, releasing them for a while before grabbing them again does not
really help anyone because there may not be enough time for another
thread to acquire them.

Second, if another thread successfully acquires them and carries out
a new EC write or read in the middle if an operation region access in
progress, it may confuse the EC firmware, especially after the burst
mode has been enabled.

Finally, manipulating the locks after writing or reading every single
byte of data is overhead that it is better to avoid.

Accordingly, modify the code to carry out EC address space accesses
entirely without releasing the locks.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Link: https://patch.msgid.link/12473338.O9o76ZdvQC@rjwysocki.net
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: Avoid returning AE_OK on errors in address space handler</title>
<updated>2024-07-27T08:38:29Z</updated>
<author>
<name>Armin Wolf</name>
</author>
<published>2024-05-22T21:36:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=275590f2e989eac02aeecd7ed8343aff93965d92'/>
<id>urn:sha1:275590f2e989eac02aeecd7ed8343aff93965d92</id>
<content type='text'>
[ Upstream commit c4bd7f1d78340e63de4d073fd3dbe5391e2996e5 ]

If an error code other than EINVAL, ENODEV or ETIME is returned
by acpi_ec_read() / acpi_ec_write(), then AE_OK is incorrectly
returned by acpi_ec_space_handler().

Fix this by only returning AE_OK on success, and return AE_ERROR
otherwise.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: Abort address space access upon error</title>
<updated>2024-07-27T08:38:28Z</updated>
<author>
<name>Armin Wolf</name>
</author>
<published>2024-05-22T21:36:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=838d9c0f6b8141144197253a309421c8a02b147d'/>
<id>urn:sha1:838d9c0f6b8141144197253a309421c8a02b147d</id>
<content type='text'>
[ Upstream commit f6f172dc6a6d7775b2df6adfd1350700e9a847ec ]

When a multi-byte address space access is requested, acpi_ec_read()/
acpi_ec_write() is being called multiple times.

Abort such operations if a single call to acpi_ec_read() /
acpi_ec_write() fails, as the data read from / written to the EC
might be incomplete.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: Fix oops when removing custom query handlers</title>
<updated>2023-05-30T11:44:02Z</updated>
<author>
<name>Armin Wolf</name>
</author>
<published>2023-03-24T20:26:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ccae2233e9935a038a35fe8cfd703df905f700e7'/>
<id>urn:sha1:ccae2233e9935a038a35fe8cfd703df905f700e7</id>
<content type='text'>
[ Upstream commit e5b492c6bb900fcf9722e05f4a10924410e170c1 ]

When removing custom query handlers, the handler might still
be used inside the EC query workqueue, causing a kernel oops
if the module holding the callback function was already unloaded.

Fix this by flushing the EC query workqueue when removing
custom query handlers.

Tested on a Acer Travelmate 4002WLMi

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: Remove duplicate ThinkPad X1 Carbon 6th entry from DMI quirks</title>
<updated>2022-08-25T09:17:31Z</updated>
<author>
<name>Hans de Goede</name>
</author>
<published>2022-06-20T09:25:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=81abef841f323b7f4b91774ec56fb33f4deef872'/>
<id>urn:sha1:81abef841f323b7f4b91774ec56fb33f4deef872</id>
<content type='text'>
[ Upstream commit 0dd6db359e5f206cbf1dd1fd40dd211588cd2725 ]

Somehow the "ThinkPad X1 Carbon 6th" entry ended up twice in the
struct dmi_system_id acpi_ec_no_wakeup[] array. Remove one of
the entries.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Revert "ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE"</title>
<updated>2022-03-11T10:22:39Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2022-03-10T13:47:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f7fc9c34879050091acb63fedf17c985218089ab'/>
<id>urn:sha1:f7fc9c34879050091acb63fedf17c985218089ab</id>
<content type='text'>
This reverts commit 9d09cb110868f027d015fbc6c64ba1e45a69a192 which is
commit dc0075ba7f387fe4c48a8c674b11ab6f374a6acc upstream.

It's been reported to cause problems with a number of Fedora and Arch
Linux users, so drop it for now until that is resolved.

Link: https://lore.kernel.org/r/CAJZ5v0gE52NT=4kN4MkhV3Gx=M5CeMGVHOF0jgTXDb5WwAMs_Q@mail.gmail.com
Link: https://lore.kernel.org/r/31b9d1cd-6a67-218b-4ada-12f72e6f00dc@redhat.com
Reported-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Reported-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Cc: Sasha Levin &lt;sashal@kernel.org&gt;
Cc: Justin Forbes &lt;jmforbes@linuxtx.org&gt;
Cc: Mark Pearson &lt;markpearson@lenovo.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE</title>
<updated>2022-02-16T11:52:54Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2022-02-04T17:31:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9d09cb110868f027d015fbc6c64ba1e45a69a192'/>
<id>urn:sha1:9d09cb110868f027d015fbc6c64ba1e45a69a192</id>
<content type='text'>
commit dc0075ba7f387fe4c48a8c674b11ab6f374a6acc upstream.

Commit 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while
suspended to idle") made acpi_ec_dispatch_gpe() check
pm_wakeup_pending(), but that is before canceling the SCI wakeup,
so pm_wakeup_pending() is always true.  This causes the loop in
acpi_ec_dispatch_gpe() to always terminate after one iteration which
may not be correct.

Address this issue by canceling the SCI wakeup earlier, from
acpi_ec_dispatch_gpe() itself.

Fixes: 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while suspended to idle")
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: Rework flushing of EC work while suspended to idle</title>
<updated>2022-01-27T08:19:32Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2021-11-23T18:36:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=77af47f26987ee46f914af926ea671a0812efa20'/>
<id>urn:sha1:77af47f26987ee46f914af926ea671a0812efa20</id>
<content type='text'>
[ Upstream commit 4a9af6cac050dce2e895ec3205c4615383ad9112 ]

The flushing of pending work in the EC driver uses drain_workqueue()
to flush the event handling work that can requeue itself via
advance_transaction(), but this is problematic, because that
work may also be requeued from the query workqueue.

Namely, if an EC transaction is carried out during the execution of
a query handler, it involves calling advance_transaction() which
may queue up the event handling work again.  This causes the kernel
to complain about attempts to add a work item to the EC event
workqueue while it is being drained and worst-case it may cause a
valid event to be skipped.

To avoid this problem, introduce two new counters, events_in_progress
and queries_in_progress, incremented when a work item is queued on
the event workqueue or the query workqueue, respectively, and
decremented at the end of the corresponding work function, and make
acpi_ec_dispatch_gpe() the workqueues in a loop until the both of
these counters are zero (or system wakeup is pending) instead of
calling acpi_ec_flush_work().

At the same time, change __acpi_ec_flush_work() to call
flush_workqueue() instead of drain_workqueue() to flush the event
workqueue.

While at it, use the observation that the work item queued in
acpi_ec_query() cannot be pending at that time, because it is used
only once, to simplify the code in there.

Additionally, clean up a comment in acpi_ec_query() and adjust white
space in acpi_ec_event_processor().

Fixes: f0ac20c3f613 ("ACPI: EC: Fix flushing of pending work")
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: Make more Asus laptops use ECDT _GPE</title>
<updated>2021-07-14T14:53:16Z</updated>
<author>
<name>Chris Chiu</name>
</author>
<published>2021-05-20T03:09:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4cee846b30aa128e3372e651b9a1b28b1d677ad3'/>
<id>urn:sha1:4cee846b30aa128e3372e651b9a1b28b1d677ad3</id>
<content type='text'>
[ Upstream commit 6306f0431914beaf220634ad36c08234006571d5 ]

More ASUS laptops have the _GPE define in the DSDT table with a
different value than the _GPE number in the ECDT.

This is causing media keys not working on ASUS X505BA/BP, X542BA/BP

Add model info to the quirks list.

Signed-off-by: Chris Chiu &lt;chris.chiu@canonical.com&gt;
Signed-off-by: Jian-Hong Pan &lt;jhp@endlessos.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe()</title>
<updated>2020-11-05T10:43:25Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2020-10-05T17:13:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7f9d9a007e59be420c5d0de4ff8e3e7310ef7fd4'/>
<id>urn:sha1:7f9d9a007e59be420c5d0de4ff8e3e7310ef7fd4</id>
<content type='text'>
commit e0e9ce390d7bc6a705653d4a8aa4ea92c9a65e53 upstream.

It turns out that in some cases there are EC events to flush in
acpi_ec_dispatch_gpe() even though the ec_no_wakeup kernel parameter
is set and the EC GPE is disabled while sleeping, so drop the
ec_no_wakeup check that prevents those events from being processed
from acpi_ec_dispatch_gpe().

Reported-by: Todd Brandt &lt;todd.e.brandt@linux.intel.com&gt;
Cc: 5.4+ &lt;stable@vger.kernel.org&gt; # 5.4+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
