• Douglas Anderson's avatar
    HID: i2c-hid: Support being a panel follower · 96a37bfd
    Douglas Anderson authored
    As talked about in the patch ("drm/panel: Add a way for other devices
    to follow panel state"), we really want to keep the power states of a
    touchscreen and the panel it's attached to in sync with each other. In
    that spirit, add support to i2c-hid to be a panel follower. This will
    let the i2c-hid driver get informed when the panel is powered on and
    off. From there we can match the i2c-hid device's power state to that
    of the panel.
    
    NOTE: this patch specifically _doesn't_ use pm_runtime to keep track
    of / manage the power state of the i2c-hid device, even though my
    first instinct said that would be the way to go. Specific problems
    with using pm_runtime():
    * The initial power up couldn't happen in a runtime resume function
      since it create sub-devices and, apparently, that's not good to do
      in your resume function.
    * Managing our power state with pm_runtime meant fighting to make the
      right thing happen at system suspend to prevent the system from
      trying to resume us only to suspend us again. While this might be
      able to be solved, it added complexity.
    Overall the code without pm_runtime() ended up being smaller and
    easier to understand.
    Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
    Reviewed-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
    Acked-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230727101636.v4.9.Ib1a98309c455cd7e26b931c69993d4fba33bbe15@changeid
    96a37bfd
i2c-hid-core.c 31.9 KB