<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/platform/chrome/cros_ec.c, branch linux-6.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2024-06-16T11:50:56Z</updated>
<entry>
<title>platform/chrome: cros_ec: Handle events during suspend after resume completion</title>
<updated>2024-06-16T11:50:56Z</updated>
<author>
<name>Karthikeyan Ramasubramanian</name>
<email>kramasub@chromium.org</email>
</author>
<published>2024-04-29T18:13:45Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a106d0837dc6734db13785f7364af081d0e889c2'/>
<id>urn:sha1:a106d0837dc6734db13785f7364af081d0e889c2</id>
<content type='text'>
commit 2fbe479c0024e1c6b992184a799055e19932aa48 upstream.

Commit 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host
command and irq disable") re-ordered the resume sequence. Before that
change, cros_ec resume sequence is:
1) Enable IRQ
2) Send resume event
3) Handle events during suspend

After commit 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host
command and irq disable"), cros_ec resume sequence is:
1) Enable IRQ
2) Handle events during suspend
3) Send resume event.

This re-ordering leads to delayed handling of any events queued between
items 2) and 3) with the updated sequence. Also in certain platforms, EC
skips triggering interrupt for certain events eg. mkbp events until the
resume event is received. Such events are stuck in the host event queue
indefinitely. This change puts back the original order to avoid any
delay in handling the pending events.

Fixes: 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host command and irq disable")
Cc: &lt;stable@vger.kernel.org&gt;
Cc: Lalith Rajendran &lt;lalithkraj@chromium.org&gt;
Cc: &lt;chrome-platform@lists.linux.dev&gt;
Signed-off-by: Karthikeyan Ramasubramanian &lt;kramasub@chromium.org&gt;
Link: https://lore.kernel.org/r/20240429121343.v2.1.If2e0cef959f1f6df9f4d1ab53a97c54aa54208af@changeid
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_lpc: Separate host command and irq disable</title>
<updated>2023-10-28T03:13:25Z</updated>
<author>
<name>Lalith Rajendran</name>
<email>lalithkraj@chromium.org</email>
</author>
<published>2023-10-27T21:02:22Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=47ea0ddb1f5604ba3496baa19110aec6a3151f2e'/>
<id>urn:sha1:47ea0ddb1f5604ba3496baa19110aec6a3151f2e</id>
<content type='text'>
Both cros host command and irq disable were moved to suspend
prepare stage from late suspend recently. This is causing EC
to report MKBP event timeouts during suspend stress testing.
When the MKBP event timeouts happen during suspend, subsequent
wakeup of AP by EC using MKBP doesn't happen properly. Move the
irq disabling part back to late suspend stage which is a general
suggestion from the suspend kernel documentaiton to do irq
disable as late as possible.

Fixes: 4b9abbc132b8 ("platform/chrome: cros_ec_lpc: Move host command to prepare/complete")
Signed-off-by: Lalith Rajendran &lt;lalithkraj@chromium.org&gt;
Link: https://lore.kernel.org/r/20231027160221.v4.1.I1725c3ed27eb7cd9836904e49e8bfa9fb0200a97@changeid
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>platform: Explicitly include correct DT includes</title>
<updated>2023-07-26T08:58:36Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2023-07-14T17:49:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b9fe9c9ef97dcf9c87e778c2f5348d3be52091fc'/>
<id>urn:sha1:b9fe9c9ef97dcf9c87e778c2f5348d3be52091fc</id>
<content type='text'>
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Reviewed-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20230714174909.4062739-1-robh@kernel.org
Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: remove unneeded label and if-condition</title>
<updated>2023-04-24T05:35:11Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-03-08T03:12:47Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=554ec02c97254962bbb0a8776c3160d294fc7e51'/>
<id>urn:sha1:554ec02c97254962bbb0a8776c3160d294fc7e51</id>
<content type='text'>
Both `ec_dev-&gt;ec` and `ec_dev-&gt;pd` are initialized to NULL at the
beginning of cros_ec_register().  Also, platform_device_unregister()
takes care if the given platform_device is NULL.

Remove the unneeded goto-label and if-condition.

Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Link: https://lore.kernel.org/r/20230308031247.2866401-1-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: Use per-device lockdep key</title>
<updated>2023-01-13T01:30:50Z</updated>
<author>
<name>Chen-Yu Tsai</name>
<email>wenst@chromium.org</email>
</author>
<published>2023-01-11T07:41:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=961a325becd9a142ae5c8b258e5c2f221f8bfac8'/>
<id>urn:sha1:961a325becd9a142ae5c8b258e5c2f221f8bfac8</id>
<content type='text'>
Lockdep reports a bogus possible deadlock on MT8192 Chromebooks due to
the following lock sequences:

1. lock(i2c_register_adapter) [1]; lock(&amp;ec_dev-&gt;lock)
2. lock(&amp;ec_dev-&gt;lock); lock(prepare_lock);

The actual dependency chains are much longer. The shortened version
looks somewhat like:

1. cros-ec-rpmsg on mtk-scp
   ec_dev-&gt;lock -&gt; prepare_lock
2. In rt5682_i2c_probe() on native I2C bus:
   prepare_lock -&gt; regmap-&gt;lock -&gt; (possibly) i2c_adapter-&gt;bus_lock
3. In rt5682_i2c_probe() on native I2C bus:
   regmap-&gt;lock -&gt; i2c_adapter-&gt;bus_lock
4. In sbs_probe() on i2c-cros-ec-tunnel I2C bus attached on cros-ec:
   i2c_adapter-&gt;bus_lock -&gt; ec_dev-&gt;lock

While lockdep is correct that the shared lockdep classes have a circular
dependency, it is bogus because

  a) 2+3 happen on a native I2C bus
  b) 4 happens on the actual EC on ChromeOS devices
  c) 1 happens on the SCP coprocessor on MediaTek Chromebooks that just
     happens to expose a cros-ec interface, but does not have an
     i2c-cros-ec-tunnel I2C bus

In short, the "dependencies" are actually on different devices.

Setup a per-device lockdep key for cros_ec devices so lockdep can tell
the two instances apart. This helps with getting rid of the bogus
lockdep warning. For ChromeOS devices that only have one cros-ec
instance this doesn't change anything.

Also add a missing mutex_destroy, just to make the teardown complete.

[1] This is likely the per I2C bus lock with shared lockdep class

Signed-off-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20230111074146.2624496-1-wenst@chromium.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: Fix panic notifier registration</title>
<updated>2023-01-11T03:27:56Z</updated>
<author>
<name>Marek Szyprowski</name>
<email>m.szyprowski@samsung.com</email>
</author>
<published>2023-01-10T22:10:33Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9e69b1b27b13eb4eb85405900e290c0d539454bf'/>
<id>urn:sha1:9e69b1b27b13eb4eb85405900e290c0d539454bf</id>
<content type='text'>
Initialize panic notifier to avoid the following lockdep warning:

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
[...]
Hardware name: Samsung Exynos (Flattened Device Tree)
Workqueue: events_unbound async_run_entry_fn
 unwind_backtrace from show_stack
[...]
 blocking_notifier_chain_register from cros_ec_debugfs_probe
 cros_ec_debugfs_probe from platform_probe

Fixes: d90fa2c64d59 ("platform/chrome: cros_ec: Poll EC log on EC panic")
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
[tzungbi: trimmed the stack trace in commit message.]
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20230110221033.7441-1-m.szyprowski@samsung.com
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: Notify the PM of wake events during resume</title>
<updated>2022-09-19T02:34:38Z</updated>
<author>
<name>Jameson Thies</name>
<email>jthies@google.com</email>
</author>
<published>2022-09-13T20:49:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8edd2752b0aa498b3a61f3caee8f79f7e0567fad'/>
<id>urn:sha1:8edd2752b0aa498b3a61f3caee8f79f7e0567fad</id>
<content type='text'>
cros_ec_handle_event in the cros_ec driver can notify the PM of wake
events. When a device is suspended, cros_ec_handle_event will not check
MKBP events. Instead, received MKBP events are checked during resume by
cros_ec_report_events_during_suspend. But
cros_ec_report_events_during_suspend cannot notify the PM if received
events are wake events, causing wake events to not be reported if
received while the device is suspended.

Update cros_ec_report_events_during_suspend to notify the PM of wake
events during resume by calling pm_wakeup_event.

Signed-off-by: Jameson Thies &lt;jthies@google.com&gt;
Reviewed-by: Prashant Malani &lt;pmalani@chromium.org&gt;
Reviewed-by: Benson Leung &lt;bleung@chromium.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20220913204954.2931042-1-jthies@google.com
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: Expose suspend_timeout_ms in debugfs</title>
<updated>2022-08-24T02:37:07Z</updated>
<author>
<name>Evan Green</name>
<email>evgreen@chromium.org</email>
</author>
<published>2022-08-22T21:40:40Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e8bf17d58a4db4b4f38617925414097f12e0d509'/>
<id>urn:sha1:e8bf17d58a4db4b4f38617925414097f12e0d509</id>
<content type='text'>
In modern Chromebooks, the embedded controller has a mechanism where
it will watch a hardware-controlled line that toggles in suspend, and
wake the system up if an expected sleep transition didn't occur. This
can be very useful for detecting power management issues where the
system appears to suspend, but doesn't actually reach its lowest
expected power states.

Sometimes it's useful in debug and test scenarios to be able to control
the duration of that timeout, or even disable the EC timeout mechanism
altogether. Add a debugfs control to set the timeout to values other
than the EC-defined default, for more convenient debug and
development iteration.

Signed-off-by: Evan Green &lt;evgreen@chromium.org&gt;
Reviewed-by: Prashant Malani &lt;pmalani@chromium.org&gt;
Reviewed-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Link: https://lore.kernel.org/r/20220822144026.v3.1.Idd188ff3f9caddebc17ac357a13005f93333c21f@changeid
[tzungbi: fix one nit in Documentation/ABI/testing/debugfs-cros-ec.]
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: Always expose last resume result</title>
<updated>2022-06-14T08:18:18Z</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2022-06-14T07:57:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=74bb746407bf0d7c7d126c7731dbcd66d467619b'/>
<id>urn:sha1:74bb746407bf0d7c7d126c7731dbcd66d467619b</id>
<content type='text'>
The last resume result exposing logic in cros_ec_sleep_event()
incorrectly requires S0ix support, which doesn't work on ARM based
systems where S0ix doesn't exist. That's because cros_ec_sleep_event()
only reports the last resume result when the EC indicates the last sleep
event was an S0ix resume. On ARM systems, the last sleep event is always
S3 resume, but the EC can still detect sleep hang events in case some
other part of the AP is blocking sleep.

Always expose the last resume result if the EC supports it so that this
works on all devices regardless of S0ix support. This fixes sleep hang
detection on ARM based chromebooks like Trogdor.

Cc: Rajat Jain &lt;rajatja@chromium.org&gt;
Cc: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Cc: Hsin-Yi Wang &lt;hsinyi@chromium.org&gt;
Cc: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Reviewed-by: Evan Green &lt;evgreen@chromium.org&gt;
Fixes: 7235560ac77a ("platform/chrome: Add support for v1 of host sleep event")
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20220614075726.2729987-1-swboyd@chromium.org
</content>
</entry>
<entry>
<title>platform/chrome: use macros for passthru indexes</title>
<updated>2022-06-10T02:31:42Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2022-06-09T08:49:39Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3db0c9e5de7bd9dbe52580eb9752b2b3049e38da'/>
<id>urn:sha1:3db0c9e5de7bd9dbe52580eb9752b2b3049e38da</id>
<content type='text'>
Move passthru indexes for EC and PD devices to common header.  Also use
them instead of literal constants.

Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20220609084957.3684698-4-tzungbi@kernel.org
</content>
</entry>
</feed>
