All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Middendorf <kernel@tuxforce.de>
To: linux-media@vger.kernel.org
Cc: Lukas Middendorf <kernel@tuxforce.de>,
	Antti Palosaari <crope@iki.fi>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 0/2] media: fully initialize si2168 on resume only when necessary
Date: Sun, 18 Apr 2021 02:12:02 +0200	[thread overview]
Message-ID: <20210418001204.7453-1-kernel@tuxforce.de> (raw)

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(-)

-- 
2.31.1


             reply	other threads:[~2021-04-18  0:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18  0:12 Lukas Middendorf [this message]
2021-04-18  0:12 ` [PATCH 1/2] media dvb_frontend: add suspend and resume callbacks to dvb_frontend_ops Lukas Middendorf
2021-04-18  0:12 ` [PATCH 2/2] media si2168: fully initialize si2168 on resume only when necessary Lukas Middendorf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210418001204.7453-1-kernel@tuxforce.de \
    --to=kernel@tuxforce.de \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.