mbox series

[0/2] media: fully initialize si2168 on resume only when necessary

Message ID 20210418001204.7453-1-kernel@tuxforce.de
Headers show
Series media: fully initialize si2168 on resume only when necessary | expand

Message

Lukas Middendorf April 18, 2021, 12:12 a.m. UTC
For the si2168, the firmware file is loaded in si2168_init(). This function is
called at the beginning of actual device usage and on resume. si2168_probe()
does not include firmware loading and full device initialization. In case the
device is not used before suspend, the call on resume can be the first time the
firmware file is read. This is can lead to a system stall and is unreliable.
If the firmware has been loaded before suspend, the kernel firmware loader sets
up automatic caching which allows firmware loads to succeed on later resumes.

It is not useful to fully initialize the device on resume if it has not been
initialized previously. The device is not in active use and is not expected to
be in an initialized state. Therefore initialization should be skipped in this
case.

This patch series adds a separate resume callback to si2168 to skip init in
case the device has not been initialized previously. To allow this, separate
suspend and resume callback pointers have to be added to dvb_frontend_ops. The
new callbacks are only used if they are implemented in a driver, otherwise the
old sleep and init callback is used instead.

Similar dedicated init callback likely also have to be implemented for some
other dvb frontend drivers to prevent first-time firmware loading on resume.

This patch series replaces my earlier patch which calls firmware_request_cache
instead to explicitly set up firmware caching.

Lukas Middendorf (2):
  media dvb_frontend: add suspend and resume callbacks to
    dvb_frontend_ops
  media si2168: fully initialize si2168 on resume only when necessary

 drivers/media/dvb-core/dvb_frontend.c     |  8 ++++++--
 drivers/media/dvb-frontends/si2168.c      | 24 +++++++++++++++++++++++
 drivers/media/dvb-frontends/si2168_priv.h |  1 +
 include/media/dvb_frontend.h              | 13 ++++++++++--
 4 files changed, 42 insertions(+), 4 deletions(-)