Skip to content

media: rockchip: rkcif: Fix a system hang and validate the pixel format

Mehdi Djait linux-media linux-rockchip stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2media: rockchip: rkcif: Don't reset the hardware in runtime suspenddrivers/media/platform/rockchip/rkcif/rkcif-common.h drivers/media/platform/rockchip/rkcif/rkcif-dev.c+0 -164 replies
2/2media: rockchip: rkcif: Validate the pixel format against the media bus codedrivers/media/platform/rockchip/rkcif/rkcif-stream.c+12 -01 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchMichael Riesch
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/2] media: rockchip: rkcif: Fix a system hang and validate the pixel format

Hello Michael :)

Sorry for the additional work with this flood of patches...

This series fixes two issues in the rkcif driver that stayed long enough on my TODO list.

I am using an RK3588 ROCK 5B with an IMX415 sensor.

Patch 1 drops the reset from the runtime suspend. The reset also resets the VICAP IOMMU and hangs the system when the IOMMU driver accesses the IOMMU registers at the same time. This was reproduced by repeatedly starting and stopping the stream with runtime PM enabled.

Steps to reproduce the issue:
* configure the media pipeline
* You can use this script here:
--------------------------------------------------------------------------------

$ cat stream-loop.sh
#!/bin/bash
# Start and stop yavta in a loop: stream for a random 0.1-1 s
# Usage: ./stream-loop.sh [device]

DEV=${1:-/dev/video0}

trap 'echo; echo "stopped after $i iterations"; exit 0' INT

i=0
while true; do

	i=$((i + 1))
	stream=$(printf "0.%03d" $((100 + RANDOM % 900)))

	echo "=== iteration $i: stream ${stream}s"
	timeout -s INT "$stream" yavta -c -f SGBRG10 -s 3864x2192 "$DEV"

done
--------------------------------------------------------------------------------

Patch 2 rejects pipelines where the pixel format does not match the media bus code on the source pad.

Steps to reproduce the issue:
* configure the media pipeline to use SGBRG10
* try to capture with yavta using the format SGBRG12

Fyi:
Another patch is also needed to not get the timeout everytime the streaming is stopped but some of the work on that patch is already done in Daniel's 4th patch:
https://lore.kernel.org/linux-media/[email protected]/

Mehdi Djait (2):
media: rockchip: rkcif: Don't reset the hardware in runtime suspend
media: rockchip: rkcif: Validate the pixel format against the media
bus code

 .../media/platform/rockchip/rkcif/rkcif-common.h  |  1 -
 drivers/media/platform/rockchip/rkcif/rkcif-dev.c | 15 ---------------
 .../media/platform/rockchip/rkcif/rkcif-stream.c  | 12 ++++++++++++
 3 files changed, 12 insertions(+), 16 deletions(-)
Signature · 1 line
2.56.0