From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Lars-Peter Clausen <lars@metafoo.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH 00/11] media: adv7180: Improve the control over decoder power
Date: Thu, 3 Jul 2025 22:52:12 +0200 [thread overview]
Message-ID: <20250703205223.2810806-1-niklas.soderlund+renesas@ragnatech.se> (raw)
Hello,
This series started as an effort to fix issues with querystd. To do that
it turned out the whole drivers design around how it controls the power
to the video decoder block inside the chip had to be reworked. As a
bonus this works removes the now deprecated .s_power callback from
adv7180.
The adv7180 drivers comes from a time before media controller and all
operation callbacks are, more or less, designed around the concept that
a video device is the only user-space facing API. In that world a vdev
would attached the subdevice, call .s_power and then perform format
configuration using the other operation callbacks and then start
streaming with .s_stream. Needles to say this mode of operation don't
work well with media controller where the subdevices itself have a
user-space API exposed thru a subdev device.
The initial problem I tried to solve (querystd) was that it stopped
functioning as expected after the subdev had been used to stream once
(.s_power(1), .s_power(0)). As it turns out different variants of the
adv7180 device have different reset beaver for if its video decoder
block is left running or powered off. On my device it was left running
so querystd functioned the first time, but not after the video decoder
had been switched off once by .s_power(0).
I first tried to fix this by introducing proper PM handling in the
driver to be able to remove the .s_power callback. I quickly learnt the
power on/off logic happening in the driver had noting to do with
controlling power to the chip itself, but to control if the chips video
decoder block was turned off.
When this block is powered on the device process video data, if there is
a video source else it free runs. However when the block is turned off
the device can still be configured, in fact some configuration requires
it to be off.
For this reason I dropped the effort to add proper PM handling and
treated the decoder power as a stream on/off switch. I still think
proper PM handling would be beneficial for this driver but to not
explode this already large series I left that for another time. Solving
the issue around .s_power will make that work easier as well as other
task such as converting to the v4l2_subdev active state API.
Patch 1/11 just moves code around to make the consecutive changes easier
to read. Patch 2/11 fix a locking issues when suspending the device.
Patch 3/11 and 4/11 improves the locking design to prepare to improve
the driver.
Patch 5/11 make sure the device controls are always programmed after the
device have been reset, fixing a possible issue when the device where
resumed from system sleep.
Patches 6/11, 7/11 and 8/11 is the real change where the .s_power
callback is reworked to fit the design of .s_stream instead.
And finally patch 9/11, 10/11 and 11/11 removes programming of the
device from operation callbacks and solves the issue with querystd.
The work is tested on R-Car M2 together with a ADV7180 device.
Niklas Söderlund (11):
media: adv7180: Move adv7180_set_power() and init_device()
media: adv7180: Add missing lock in suspend callback
media: adv7180: Move state mutex handling outside init_device()
media: adv7180: Use v4l2-ctrls core to handle s_ctrl locking
media: adv7180: Setup controls every time the device is reset
media: adv7180: Power down decoder when configuring the device
media: adv7180: Split device initialization and reset
media: adv7180: Remove the s_power callback
media: adv7180: Do not write format to device in set_fmt
media: adv7180: Only validate format in s_std
media: adv7180: Only validate format in querystd
drivers/media/i2c/adv7180.c | 338 +++++++++++++++++++-----------------
1 file changed, 174 insertions(+), 164 deletions(-)
--
2.50.0
next reply other threads:[~2025-07-03 20:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 20:52 Niklas Söderlund [this message]
2025-07-03 20:52 ` [PATCH 01/11] media: adv7180: Move adv7180_set_power() and init_device() Niklas Söderlund
2025-07-03 22:41 ` Laurent Pinchart
2025-07-03 20:52 ` [PATCH 02/11] media: adv7180: Add missing lock in suspend callback Niklas Söderlund
2025-07-03 22:43 ` Laurent Pinchart
2025-07-03 22:51 ` Niklas Söderlund
2025-07-03 23:06 ` Laurent Pinchart
2025-07-03 23:07 ` Niklas Söderlund
2025-07-03 20:52 ` [PATCH 03/11] media: adv7180: Move state mutex handling outside init_device() Niklas Söderlund
2025-07-03 22:45 ` Laurent Pinchart
2025-07-03 20:52 ` [PATCH 04/11] media: adv7180: Use v4l2-ctrls core to handle s_ctrl locking Niklas Söderlund
2025-07-03 22:46 ` Laurent Pinchart
2025-07-03 20:52 ` [PATCH 05/11] media: adv7180: Setup controls every time the device is reset Niklas Söderlund
2025-07-03 22:47 ` Laurent Pinchart
2025-07-03 20:52 ` [PATCH 06/11] media: adv7180: Power down decoder when configuring the device Niklas Söderlund
2025-07-03 20:52 ` [PATCH 07/11] media: adv7180: Split device initialization and reset Niklas Söderlund
2025-07-03 20:52 ` [PATCH 08/11] media: adv7180: Remove the s_power callback Niklas Söderlund
2025-07-03 20:52 ` [PATCH 09/11] media: adv7180: Do not write format to device in set_fmt Niklas Söderlund
2025-07-03 22:49 ` Laurent Pinchart
2025-07-03 20:52 ` [PATCH 10/11] media: adv7180: Only validate format in s_std Niklas Söderlund
2025-07-03 20:52 ` [PATCH 11/11] media: adv7180: Only validate format in querystd Niklas Söderlund
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=20250703205223.2810806-1-niklas.soderlund+renesas@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=hverkuil@xs4all.nl \
--cc=lars@metafoo.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).