* [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs
@ 2026-11-22 13:35 Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts Robert Ijtsma via B4 Relay
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-22 13:35 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, Robert Ijtsma
This series fixes five self-contained bugs in the Qualcomm CAMSS driver
found during Titan 175 (SC8180X) camera bring-up and code review:
1. vfe-17x: Check VFE_IRQ_STATUS_1 (status1) rather than
VFE_IRQ_STATUS_0 (status0) against STATUS_1_RDI_SOF(i) in vfe_isr().
2. csid-gen2: Use BIT(RDI_CFG0_ENABLE) to explicitly set or clear bit 31
in __csid_configure_rdi_stream(), avoiding signed int shift overflow
and ensuring the enable bit is cleared when stopping a stream.
3. csid: Release the parent device reference via parent_dev_ops->put()
on all csid_set_power() power-on failure paths.
4. vfe: Destroy power_lock and stream_lock after unregistering VFE
subdevices and video nodes in msm_vfe_unregister_entities().
5. video: Roll back already-started upstream subdevices if s_stream(1)
fails partway through video_start_streaming().
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
Robert Ijtsma (5):
media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts
media: qcom: camss: csid-gen2: fix RDI enable bit manipulation
media: qcom: camss: csid: release parent device on power-on failure
media: qcom: camss: vfe: destroy mutexes after unregistering entities
media: qcom: camss: video: stop started subdevs on start_streaming failure
.../media/platform/qcom/camss/camss-csid-gen2.c | 5 ++-
drivers/media/platform/qcom/camss/camss-csid.c | 48 ++++++++++------------
drivers/media/platform/qcom/camss/camss-vfe-17x.c | 2 +-
drivers/media/platform/qcom/camss/camss-vfe.c | 6 +--
drivers/media/platform/qcom/camss/camss-video.c | 27 ++++++++++--
5 files changed, 54 insertions(+), 34 deletions(-)
---
base-commit: 4843f6873f7c4835e62f2c73ba0fd538e57a2f22
change-id: 20261122-camss-fixes-4a671ce21042
Best regards,
--
Robert Ijtsma <robertijtsma@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
@ 2026-11-22 13:35 ` Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 2/5] media: qcom: camss: csid-gen2: fix RDI enable bit manipulation Robert Ijtsma via B4 Relay
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-22 13:35 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, Robert Ijtsma
From: Robert Ijtsma <robertijtsma@gmail.com>
In vfe_isr(), STATUS_1_RDI_SOF(i) is a bitmask for VFE_IRQ_STATUS_1
(status1), not VFE_IRQ_STATUS_0 (status0). Checking status0 instead
tests the unrelated STATUS_0_IMAGE_COMPOSITE_DONE bits (27..30).
Check status1 against STATUS_1_RDI_SOF(i) as intended.
Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/platform/qcom/camss/camss-vfe-17x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-17x.c b/drivers/media/platform/qcom/camss/camss-vfe-17x.c
index 62c2405..502a0d4 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-17x.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-17x.c
@@ -356,7 +356,7 @@ static irqreturn_t vfe_isr(int irq, void *dev)
vfe->isr_ops.reg_update(vfe, i);
for (i = VFE_LINE_RDI0; i < vfe->res->line_num; i++)
- if (status0 & STATUS_1_RDI_SOF(i))
+ if (status1 & STATUS_1_RDI_SOF(i))
vfe->isr_ops.sof(vfe, i);
for (i = 0; i < MSM_VFE_COMPOSITE_IRQ_NUM; i++)
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] media: qcom: camss: csid-gen2: fix RDI enable bit manipulation
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts Robert Ijtsma via B4 Relay
@ 2026-11-22 13:35 ` Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 3/5] media: qcom: camss: csid: release parent device on power-on failure Robert Ijtsma via B4 Relay
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-22 13:35 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, Robert Ijtsma
From: Robert Ijtsma <robertijtsma@gmail.com>
In __csid_configure_rdi_stream(), shifting the u8 parameter `enable`
(promoted to signed int) left by RDI_CFG0_ENABLE (31) shifts into the
sign bit, and bitwise ORing never explicitly clears the enable bit when
`enable` is zero.
Use BIT(RDI_CFG0_ENABLE) to explicitly set or clear the bit depending
on `enable`, matching camss-csid-680.c.
Fixes: 729fc005c8e2 ("media: qcom: camss: Split testgen, RDI and RX for CSID 170")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/platform/qcom/camss/camss-csid-gen2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c
index eadcb2f..804c8fe 100644
--- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c
+++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c
@@ -318,7 +318,10 @@ static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8
writel_relaxed(val, csid->base + CSID_RDI_CTRL(port));
val = readl_relaxed(csid->base + CSID_RDI_CFG0(port));
- val |= enable << RDI_CFG0_ENABLE;
+ if (enable)
+ val |= BIT(RDI_CFG0_ENABLE);
+ else
+ val &= ~BIT(RDI_CFG0_ENABLE);
writel_relaxed(val, csid->base + CSID_RDI_CFG0(port));
}
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] media: qcom: camss: csid: release parent device on power-on failure
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 2/5] media: qcom: camss: csid-gen2: fix RDI enable bit manipulation Robert Ijtsma via B4 Relay
@ 2026-11-22 13:35 ` Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 4/5] media: qcom: camss: vfe: destroy mutexes after unregistering entities Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 5/5] media: qcom: camss: video: stop started subdevs on start_streaming failure Robert Ijtsma via B4 Relay
4 siblings, 0 replies; 6+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-22 13:35 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, Robert Ijtsma
From: Robert Ijtsma <robertijtsma@gmail.com>
csid_set_power() acquires a reference on the parent device via
parent_dev_ops->get() before resuming runtime PM, enabling regulators
and clocks, and resetting the CSID hardware. If any of these subsequent
steps fail, the function returns without calling parent_dev_ops->put(),
leaking the parent VFE power reference.
Consolidate the power-on error paths using goto labels and release the
parent device reference on all failure paths.
Fixes: c5af8db84c01 ("media: camss: Do vfe_get/vfe_put for csid on sm8250")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/platform/qcom/camss/camss-csid.c | 48 ++++++++++++--------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index 51f2090..e67edc3 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -682,7 +682,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
struct csid_device *csid = v4l2_get_subdevdata(sd);
struct camss *camss = csid->camss;
struct device *dev = camss->dev;
- int ret = 0;
+ int ret;
if (on) {
/*
@@ -696,44 +696,28 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
- return ret;
+ goto err_parent_put;
ret = regulator_bulk_enable(csid->num_supplies,
csid->supplies);
- if (ret < 0) {
- pm_runtime_put_sync(dev);
- return ret;
- }
+ if (ret < 0)
+ goto err_pm_put;
ret = csid_set_clock_rates(csid);
- if (ret < 0) {
- regulator_bulk_disable(csid->num_supplies,
- csid->supplies);
- pm_runtime_put_sync(dev);
- return ret;
- }
+ if (ret < 0)
+ goto err_regulators_disable;
ret = camss_enable_clocks(csid->nclocks, csid->clock, dev);
- if (ret < 0) {
- regulator_bulk_disable(csid->num_supplies,
- csid->supplies);
- pm_runtime_put_sync(dev);
- return ret;
- }
+ if (ret < 0)
+ goto err_regulators_disable;
csid->phy.need_vc_update = true;
enable_irq(csid->irq);
ret = csid->res->hw_ops->reset(csid);
- if (ret < 0) {
- disable_irq(csid->irq);
- camss_disable_clocks(csid->nclocks, csid->clock);
- regulator_bulk_disable(csid->num_supplies,
- csid->supplies);
- pm_runtime_put_sync(dev);
- return ret;
- }
+ if (ret < 0)
+ goto err_reset;
csid->res->hw_ops->hw_version(csid);
} else {
@@ -745,6 +729,18 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
csid->res->parent_dev_ops->put(camss, csid->id);
}
+ return 0;
+
+err_reset:
+ disable_irq(csid->irq);
+ camss_disable_clocks(csid->nclocks, csid->clock);
+err_regulators_disable:
+ regulator_bulk_disable(csid->num_supplies, csid->supplies);
+err_pm_put:
+ pm_runtime_put_sync(dev);
+err_parent_put:
+ csid->res->parent_dev_ops->put(camss, csid->id);
+
return ret;
}
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] media: qcom: camss: vfe: destroy mutexes after unregistering entities
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
` (2 preceding siblings ...)
2026-11-22 13:35 ` [PATCH 3/5] media: qcom: camss: csid: release parent device on power-on failure Robert Ijtsma via B4 Relay
@ 2026-11-22 13:35 ` Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 5/5] media: qcom: camss: video: stop started subdevs on start_streaming failure Robert Ijtsma via B4 Relay
4 siblings, 0 replies; 6+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-22 13:35 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, Robert Ijtsma
From: Robert Ijtsma <robertijtsma@gmail.com>
msm_vfe_unregister_entities() destroys vfe->power_lock and
vfe->stream_lock before unregistering the VFE video devices and V4L2
subdevices. Active userspace handles or concurrent teardown callbacks
can still acquire these mutexes until the entities are unregistered.
Destroy power_lock and stream_lock after all VFE entities have been
unregistered and cleaned up.
Fixes: 4c98a5f57f90 ("media: camss: Add VFE files")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/platform/qcom/camss/camss-vfe.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index ad09593..fe6b7ef 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -2168,9 +2168,6 @@ void msm_vfe_unregister_entities(struct vfe_device *vfe)
{
int i;
- mutex_destroy(&vfe->power_lock);
- mutex_destroy(&vfe->stream_lock);
-
for (i = 0; i < vfe->res->line_num; i++) {
struct v4l2_subdev *sd = &vfe->line[i].subdev;
struct camss_video *video_out = &vfe->line[i].video_out;
@@ -2179,6 +2176,9 @@ void msm_vfe_unregister_entities(struct vfe_device *vfe)
v4l2_device_unregister_subdev(sd);
media_entity_cleanup(&sd->entity);
}
+
+ mutex_destroy(&vfe->power_lock);
+ mutex_destroy(&vfe->stream_lock);
}
bool vfe_is_lite(struct vfe_device *vfe)
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] media: qcom: camss: video: stop started subdevs on start_streaming failure
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
` (3 preceding siblings ...)
2026-11-22 13:35 ` [PATCH 4/5] media: qcom: camss: vfe: destroy mutexes after unregistering entities Robert Ijtsma via B4 Relay
@ 2026-11-22 13:35 ` Robert Ijtsma via B4 Relay
4 siblings, 0 replies; 6+ messages in thread
From: Robert Ijtsma via B4 Relay @ 2026-11-22 13:35 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, Robert Ijtsma
From: Robert Ijtsma <robertijtsma@gmail.com>
If a subdevice fails s_stream(1) partway through video_start_streaming(),
previously started subdevices earlier in the pipeline (such as the VFE
and CSID) are never stopped. This leaks VFE stream counts and write
master reservations, leaving the pipeline stuck on subsequent stream
attempts.
Walk the pipeline from the video device up to the failing entity and
call s_stream(0) on each already-started subdevice before stopping the
media pipeline and flushing buffers.
Fixes: 0ac2586c410f ("media: camss: Add files which handle the video device nodes")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/platform/qcom/camss/camss-video.c | 27 ++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index 0852eb6..6f7b9f3 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -253,7 +253,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
{
struct camss_video *video = vb2_get_drv_priv(q);
struct video_device *vdev = &video->vdev;
- struct media_entity *entity;
+ struct media_entity *entity, *failed_entity;
struct media_pad *pad;
struct v4l2_subdev *subdev;
int ret;
@@ -282,12 +282,33 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
subdev = media_entity_to_v4l2_subdev(entity);
ret = v4l2_subdev_call(subdev, video, s_stream, 1);
- if (ret < 0 && ret != -ENOIOCTLCMD)
- goto error;
+ if (ret < 0 && ret != -ENOIOCTLCMD) {
+ failed_entity = entity;
+ goto error_stop_subdevs;
+ }
}
return 0;
+error_stop_subdevs:
+ entity = &vdev->entity;
+ while (1) {
+ pad = &entity->pads[0];
+ if (!(pad->flags & MEDIA_PAD_FL_SINK))
+ break;
+
+ pad = media_pad_remote_pad_first(pad);
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
+ break;
+
+ entity = pad->entity;
+ if (entity == failed_entity)
+ break;
+
+ subdev = media_entity_to_v4l2_subdev(entity);
+ v4l2_subdev_call(subdev, video, s_stream, 0);
+ }
+
error:
video_device_pipeline_stop(vdev);
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-22 13:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 2/5] media: qcom: camss: csid-gen2: fix RDI enable bit manipulation Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 3/5] media: qcom: camss: csid: release parent device on power-on failure Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 4/5] media: qcom: camss: vfe: destroy mutexes after unregistering entities Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 5/5] media: qcom: camss: video: stop started subdevs on start_streaming failure Robert Ijtsma via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox