Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1353479

Re: [PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime suspended

From Benson Leung <bleung@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime suspended
Date 2016-03-09 00:20 +0100
Message-ID <raz50-7IS-5@gated-at.bofh.it> (permalink)
References <rayVk-7EC-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Mar 8, 2016 at 3:03 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On ACPI-based systems ACPI power domain code runtime resumes device before
> calling suspend method, which ensures that i2c-hid suspend code starts with
> device not in low-power state and with interrupts enabled.
>
> On other systems, especially if device is not a part of any power domain,
> we may end up calling driver's system-level suspend routine while the
> device is runtime-suspended (with controller in presumably low power state
> and interrupts disabled). This will result in interrupts being essentially
> disabled twice, and we will only re-enable them after both system resume
> and runtime resume methods complete. Unfortunately i2c_hid_resume() calls
> i2c_hid_hwreset() and that only works properly if interrupts are enabled.
>
> Also if device is runtime-suspended driver's suspend code may fail if it
> tries to issue I/O requests.
>
> Let's fix it by runtime-resuming the device if we need to run HID driver's
> suspend code and also disabling interrupts only if device is not already
> runtime-suspended. Also on resume we mark the device as running at full
> power (since that is what resetting will do to it).
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Dmitry Torokhov <dtor@chromium.org>

Reviewed-by: Benson Leung <bleung@chromium.org>

> ---
>
> This is an uprev of a patch that Doug sent a year ago (see
> https://patchwork.kernel.org/patch/5970731/), adjusted to the latest
> mainline. The change from v2 is that we runtime-resume the device before
> calling into HID driver's suspend callback.




-- 
Benson Leung
Senior Software Engineer, Chrom* OS
bleung@chromium.org

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime  suspended Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-03-09 00:10 +0100
  Re: [PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime suspended Benson Leung <bleung@chromium.org> - 2016-03-09 00:20 +0100
  Re: [PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime  suspended Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-03-09 13:10 +0100
    Re: [PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime  suspended Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-03-09 21:00 +0100
      Re: [PATCH v3] HID: i2c-hid: Fix suspend/resume when already runtime  suspended Jiri Kosina <jikos@kernel.org> - 2016-03-09 22:00 +0100

csiph-web