mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 00/12] media: qcom: camss: add V4L2 subdev streams API support
@ 2026-11-25  7:59 Gjorgji.Rosikopulos.gjorgji.rosikopulos
  2026-11-25  7:59 ` [PATCH v2 01/12] media: qcom: camss: csid_gen3: Fix multi-VC buf-done IRQ mask Gjorgji.Rosikopulos.gjorgji.rosikopulos
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Gjorgji.Rosikopulos.gjorgji.rosikopulos @ 2026-11-25  7:59 UTC (permalink / raw)
  To: Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media, linux-arm-msm
  Cc: Vladimir Zapolskiy, Loic Poulain, linux-kernel, Hitesh Patel,
	Atanas Filipov, Jigarkumar Zala, Gjorgji Rosikopulos

From: Gjorgji Rosikopulos <gjorgji.rosikopulos@oss.qualcomm.com>

This series adds V4L2 subdev streams API support to the CAMSS driver.

Each subdevice gains streams-aware enable_streams/disable_streams pad
ops alongside the existing legacy (non-streams) subdev ops, guarded by
a new per-instance streams_enable resource flag.

Patch 1 is a standalone bug fix on CSID gen3, found during RB8 multi-VC
testing: CSID reset used to program CSID_BUF_DONE_IRQ_MASK with one
write per enabled VC instead of accumulating the bits into a single
write.

Patch 2 factors a pad-to-port helper out of csid_get_sof_seq(), used by
later patches.

Patches 3-9 add the CSIPHY/CSID/TPG/VFE/camss-video mechanism:
 - CSIPHY: passthrough routing and shared D-PHY lane enable/disable
   gated on stream-count transitions, dispatching between the generic
   PHY framework and the legacy PHY backend.
 - CSID: configure_stream() is reworked to take a port_mask and a
   per-port {vc, dt} config array shared by all six CSID backends
   (gen2, gen3, 340, 4-1, 4-7, 680), then the CSID subdev itself gains
   per-source-pad routing (a single sink stream propagated to every
   source pad by default, remappable for multi-VC sensors) and VC/DT
   discovery via get_frame_desc.
 - TPG: the single fmt field becomes a per-stream array, so the
   generator can drive several concurrent virtual channels, with one
   get_frame_desc entry per active route.
 - VFE: streams-aware pad ops. VFE lines are inherently single-consumer
   (vfe_link_setup() enforces one link per pad), so no refcounting is
   needed there.
 - camss-video: the video device pipeline walk now checks, via
   v4l2_subdev_has_op(), whether the directly-connected subdev supports
   enable_streams/disable_streams; if so it issues a single top-level
   call instead of manually walking the pipeline one subdev at a time
   with .s_stream(). Falls back to the existing legacy path unchanged
   when the remote subdev doesn't support the streams API, so no other
   platform is affected.

Patches 10-12 set streams_enable per SoC: SM8250, SA8775P, and SC7280
(dispatched through the legacy PHY backend on SC7280, since it has no
camss child node named "phy", so camss_detect_legacy_phy() puts it in
legacy PHY mode). Every other platform keeps using the legacy
non-streams subdev ops, so these are a no-op everywhere else.

A practical benefit of the CSID routing change (patch 6) is routing
flexibility for multi-VC sensors: the CSID's routing table maps sink
streams to source pads/streams via userspace-configurable
v4l2_subdev_route entries instead of a fixed pad<->VC assignment, so a
sensor emitting multiple virtual channels can have each VC directed to
a different RDI output (and thus a different VFE line/video node)
with a set_routing call, rather than being constrained to whatever
fixed mapping the driver hardcodes.

When a sink stream is shared by multiple source pads/streams, CSID
only enables the corresponding upstream CSIPHY stream on the first
source stream that needs it, and only disables it once the last
remaining source stream using it is disabled. Enabling or disabling
additional consumers of an already-active shared stream is a no-op
upstream, so no consumer can double-enable or prematurely disable a
stream still in use by another. This also avoids ever hitting v4l2
core's own -EALREADY re-enable gate.

Verified on RB8/SA8775P hardware, driving the CSID test-pattern
generator directly (no sensor), for 1, 2 and 3 concurrent virtual
channels through CSID to separate VFE RDI lines. Entity/video node
names below are resolved via `media-ctl -d /dev/media0 -e <entity>`.

NOTE: the V4L2 subdev streams API is disabled by default with the
static bool v4l2_subdev_enable_streams_api in
drivers/media/v4l2-core/v4l2-subdev.c. it must be set to true to
use the stream API and reproduce the testing below:

1 VC:
  media-ctl -d /dev/media0 --reset
  media-ctl -d /dev/media0 -l '"msm_tpg0":0->"msm_csid0":0[1]'
  media-ctl -d /dev/media0 -R '"msm_csid0"[0/0->1/0[1]]'
  media-ctl -d /dev/media0 -V '"msm_tpg0":0/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_csid0":0/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_csid0":1/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
  media-ctl -d /dev/media0 -V '"msm_vfe0_rdi0":0[fmt:SBGGR8/1920x1080]'
  v4l2-ctl -d <tpg-subdev> --set-ctrl=test_pattern=9
  v4l2-ctl -d <rdi0-video> --set-fmt-video=width=1920,height=1080,\
    pixelformat=BA81 --stream-mmap=5 --stream-count=20 \
    --stream-to=vc0.raw

2 VCs (vc1 added in parallel):
  media-ctl -d /dev/media0 --reset
  media-ctl -d /dev/media0 -l '"msm_tpg0":0->"msm_csid0":0[1]'
  media-ctl -d /dev/media0 -R '"msm_csid0"[0/0->1/0[1],0/1->2/0[1]]'
  media-ctl -d /dev/media0 -V '"msm_tpg0":0/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_tpg0":0/1[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_csid0":0/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_csid0":0/1[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_csid0":1/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
  media-ctl -d /dev/media0 -V '"msm_vfe0_rdi0":0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -V '"msm_csid0":2/0[fmt:SBGGR8/1920x1080]'
  media-ctl -d /dev/media0 -l '"msm_csid0":2->"msm_vfe0_rdi1":0[1]'
  media-ctl -d /dev/media0 -V '"msm_vfe0_rdi1":0[fmt:SBGGR8/1920x1080]'
  v4l2-ctl -d <tpg-subdev> --set-ctrl=test_pattern=9
  v4l2-ctl -d <rdi0-video> --set-fmt-video=width=1920,height=1080,\
    pixelformat=BA81 --stream-mmap=5 --stream-count=20 \
    --stream-to=vc0.raw &
  v4l2-ctl -d <rdi1-video> --set-fmt-video=width=1920,height=1080,\
    pixelformat=BA81 --stream-mmap=5 --stream-count=20 \
    --stream-to=vc1.raw &
  wait

3 VCs: same as the 2 VC case, plus a third route
'0/2->3/0[1]' from "msm_csid0":3 to "msm_vfe0_rdi2", and a third,
concurrently-started v4l2-ctl capture on that line's video node
(vc2.raw).

All three cases captured the expected, exact frame byte count on
every VC with no dmesg Oops/BUG/WARNING/overflow output. Additional
early-stop and staggered-start variants of the 3 VC case (one VC
starting/stopping while the others keep streaming) were also run and
passed.

These changes apply on top of v7.4-rc1.

Changes since v1:
- Incorporate Loic comment for csid and extend configure_stream
  instead of adding new enable/disable stream api.
- Incorporate Bryan comment for moving stream_enable in per SoC
  resources.
- Add Hitesh changes for SC7280
- Drop the fix for csid to each vfe link. It is part of another
  series:
  Link: https://lore.kernel.org/all/20261122-camss-routing-fixes-v1-0-0deeeaca2622@kernel.org/
- Incorporate Bryan comment and remove csid lite check for port
  mapping and add route to each port. Although not functional for
  full VFE/IFEs, this is more likely to be fixed in the near future.

Depends-on:https://lore.kernel.org/all/20261107-v4l2-frame-sync-v3-0-e5bf7073a35d@kernel.org/

Gjorgji Rosikopulos (11):
  media: qcom: camss: csid_gen3: Fix multi-VC buf-done IRQ mask
  media: qcom: camss: Add csid pad to port helper
  media: qcom: camss: Add streams enable field to camss resources
  media: qcom: camss: Add streams API support for CSIPHY
  media: qcom: camss: Add per-port config to CSID configure_stream
  media: qcom: camss: Add streams API support in CSID subdevice
  media: qcom: camss: Add streams API support in tpg subdev
  media: qcom: camss: Add streams API support for VFE
  media: qcom: camss: Add streams API support in camss-video
  media: qcom: camss: Enable streams API on SM8250
  media: qcom: camss: Enable streams API on SA8775P

Hitesh Patel (1):
  media: qcom: camss: Enable streams API on SC7280

 .../platform/qcom/camss/camss-csid-340.c      |   5 +-
 .../platform/qcom/camss/camss-csid-4-1.c      |   3 +-
 .../platform/qcom/camss/camss-csid-4-7.c      |   3 +-
 .../platform/qcom/camss/camss-csid-680.c      |   7 +-
 .../platform/qcom/camss/camss-csid-gen2.c     |  54 +-
 .../platform/qcom/camss/camss-csid-gen3.c     |  51 +-
 .../media/platform/qcom/camss/camss-csid.c    | 521 +++++++++++++++++-
 .../media/platform/qcom/camss/camss-csid.h    |  22 +-
 .../media/platform/qcom/camss/camss-csiphy.c  | 249 ++++++++-
 .../media/platform/qcom/camss/camss-csiphy.h  |   1 +
 .../platform/qcom/camss/camss-tpg-gen1.c      |  63 ++-
 drivers/media/platform/qcom/camss/camss-tpg.c | 179 +++++-
 drivers/media/platform/qcom/camss/camss-tpg.h |   6 +-
 drivers/media/platform/qcom/camss/camss-vfe.c | 119 +++-
 .../media/platform/qcom/camss/camss-video.c   | 119 +++-
 drivers/media/platform/qcom/camss/camss.c     |   3 +
 drivers/media/platform/qcom/camss/camss.h     |   1 +
 17 files changed, 1273 insertions(+), 133 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-11-25 17:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  7:59 [PATCH v2 00/12] media: qcom: camss: add V4L2 subdev streams API support Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 01/12] media: qcom: camss: csid_gen3: Fix multi-VC buf-done IRQ mask Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 02/12] media: qcom: camss: Add csid pad to port helper Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 03/12] media: qcom: camss: Add streams enable field to camss resources Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25 17:09   ` Gjorgji Rosikopulos (Consultant)
2026-11-25  7:59 ` [PATCH v2 04/12] media: qcom: camss: Add streams API support for CSIPHY Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 05/12] media: qcom: camss: Add per-port config to CSID configure_stream Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 06/12] media: qcom: camss: Add streams API support in CSID subdevice Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 07/12] media: qcom: camss: Add streams API support in tpg subdev Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 08/12] media: qcom: camss: Add streams API support for VFE Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 09/12] media: qcom: camss: Add streams API support in camss-video Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  7:59 ` [PATCH v2 10/12] media: qcom: camss: Enable streams API on SM8250 Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  8:00 ` [PATCH v2 11/12] media: qcom: camss: Enable streams API on SA8775P Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25  8:00 ` [PATCH v2 12/12] media: qcom: camss: Enable streams API on SC7280 Gjorgji.Rosikopulos.gjorgji.rosikopulos
2026-11-25 17:27 ` [PATCH v2 00/12] media: qcom: camss: add V4L2 subdev streams API support Gjorgji Rosikopulos (Consultant)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®