* [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes
@ 2026-07-21 10:28 Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle Balakrishnan Sambath
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:28 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
This series has a few fixes for the Microchip ISC/XISC driver, found
while testing and from the feedback on the combined series [1].
Fixes only, sent ahead of the enhancements so they can reach stable.
The SBGGR10 and PM leak fixes are unchanged from [1] and keep their
Reviewed-by.
All but the two pfe_cfg0_bps cleanups carry a Fixes tag and Cc: stable.
[1] https://lore.kernel.org/r/20260603-microchip-isc-fixes-v6-0-8c3d7474a768@microchip.com
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
Changes in v3:
- Rewrite the WB offset/gain register writes with FIELD_PREP() (Eugen). No
functional change; verified on SAMA7G5-EK.
- Collect Eugen's Reviewed-by on the PFE_CFG0 and macro-typo patches.
- Link to v2: https://lore.kernel.org/r/20260629-balki-isc-prefix-fixes-v1-v2-0-3b120cc3742f@microchip.com
Changes in v2:
- Squash the stop and start-error histogram/AWB-flush patches into one (Eugen).
- Store pfe_cfg0_bps unshifted, apply with FIELD_PREP() at the write (Eugen).
- Skip the WB register writes during the stop window too (isc->stop check).
- New patch: fix the ISC_PFG_CFG0_BPS macro name typo.
- Add Eugen's Reviewed-by on the IRQ-sync patch.
- Link to v1: https://lore.kernel.org/r/20260616-balki-isc-prefix-fixes-v1-v1-0-b23677fc5ab6@microchip.com
---
Balakrishnan Sambath (10):
media: microchip-isc: fix awb_mutex and lock lifecycle
media: microchip-isc: take a reference on the parsed endpoints
media: microchip-isc: synchronize the IRQ before disabling clocks on stop
media: microchip-isc: disable histogram and flush AWB work on teardown
media: microchip-isc: do not touch WB registers when not streaming
media: microchip-isc: store the unshifted PFE_CFG0 BPS value
media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo
media: microchip-isc: fix PM runtime leak in AWB work handler
media: microchip-isc: fix SBGGR10 Bayer pattern
media: microchip-isc: fix WB offset and gain register field masking
.../media/platform/microchip/microchip-isc-base.c | 77 +++++++++++++++-------
.../media/platform/microchip/microchip-isc-regs.h | 16 +++--
drivers/media/platform/microchip/microchip-isc.h | 5 +-
.../platform/microchip/microchip-sama5d2-isc.c | 40 ++++++-----
.../platform/microchip/microchip-sama7g5-isc.c | 40 ++++++-----
5 files changed, 117 insertions(+), 61 deletions(-)
---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260615-balki-isc-prefix-fixes-v1-c8c44224caa1
Best regards,
--
Balakrishnan Sambath <balakrishnan.s@microchip.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
@ 2026-07-21 10:28 ` Balakrishnan Sambath
2026-07-21 13:27 ` Eugen Hristev
2026-07-21 10:28 ` [PATCH v3 02/10] media: microchip-isc: take a reference on the parsed endpoints Balakrishnan Sambath
` (8 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:28 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
isc_async_complete() initialised awb_mutex and isc->lock only after an
early error return, and the teardown was inconsistent:
- isc_async_unbind() destroyed awb_mutex before cancelling awb_work,
which takes it;
- a failed .complete() destroyed both locks, then the v4l2-async core
unbinds the subdev and isc_async_unbind() destroyed awb_mutex again;
- isc->lock was destroyed only on the .complete() error path, so the
normal unbind path leaked it.
Initialise both locks before the first error return, make unbind the
single teardown site (cancel the work, then destroy both locks) and
drop the destroys from the .complete() error path.
Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/platform/microchip/microchip-isc-base.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index a7cdc743fda7..45a7af779323 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1703,10 +1703,11 @@ static void isc_async_unbind(struct v4l2_async_notifier *notifier,
{
struct isc_device *isc = container_of(notifier->v4l2_dev,
struct isc_device, v4l2_dev);
- mutex_destroy(&isc->awb_mutex);
cancel_work_sync(&isc->awb_work);
+ mutex_destroy(&isc->awb_mutex);
video_unregister_device(&isc->video_dev);
v4l2_ctrl_handler_free(&isc->ctrls.handler);
+ mutex_destroy(&isc->lock);
}
struct isc_format *isc_find_format_by_code(struct isc_device *isc,
@@ -1758,6 +1759,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
int ret = 0;
INIT_WORK(&isc->awb_work, isc_awb_work);
+ mutex_init(&isc->lock);
+ mutex_init(&isc->awb_mutex);
ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev);
if (ret < 0) {
@@ -1767,8 +1770,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
isc->current_subdev = container_of(notifier,
struct isc_subdev_entity, notifier);
- mutex_init(&isc->lock);
- mutex_init(&isc->awb_mutex);
init_completion(&isc->comp);
@@ -1841,8 +1842,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
video_unregister_device(vdev);
isc_async_complete_err:
- mutex_destroy(&isc->awb_mutex);
- mutex_destroy(&isc->lock);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 02/10] media: microchip-isc: take a reference on the parsed endpoints
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle Balakrishnan Sambath
@ 2026-07-21 10:28 ` Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 03/10] media: microchip-isc: synchronize the IRQ before disabling clocks on stop Balakrishnan Sambath
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:28 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
for_each_endpoint_of_node() drops the reference on the current node as
it advances. xisc_parse_dt() and isc_parse_dt() store the node in
subdev_entity->epn and release it later with of_node_put(), but never
took their own reference, so the stored pointer refers to an
already-released node. This underflows the refcount and can
use-after-free, reachable through the camera device tree overlay.
Take a reference with of_node_get() when storing the node, and drop it
in microchip_isc_subdev_cleanup() so the entities the bind loop never
reaches on an early exit do not leak it.
Fixes: c9aa973884a1 ("media: atmel: atmel-isc: add microchip-xisc driver")
Fixes: d6701f13bd07 ("media: atmel: Use v4l2_async_notifier_add_fwnode_remote_subdev")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/platform/microchip/microchip-isc-base.c | 6 ++++++
.../media/platform/microchip/microchip-sama5d2-isc.c | 18 ++++++++++++------
.../media/platform/microchip/microchip-sama7g5-isc.c | 18 ++++++++++++------
3 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 45a7af779323..4079c79cb668 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1859,6 +1859,12 @@ void microchip_isc_subdev_cleanup(struct isc_device *isc)
list_for_each_entry(subdev_entity, &isc->subdev_entities, list) {
v4l2_async_nf_unregister(&subdev_entity->notifier);
v4l2_async_nf_cleanup(&subdev_entity->notifier);
+ /*
+ * Release the endpoint reference taken while parsing. It is
+ * NULL for entities the bind loop already consumed, so this
+ * only drops the ones left over on an early exit.
+ */
+ of_node_put(subdev_entity->epn);
}
INIT_LIST_HEAD(&isc->subdev_entities);
diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 66d3d7891991..97752eca6d6b 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -356,28 +356,28 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
struct device_node *epn;
struct isc_subdev_entity *subdev_entity;
unsigned int flags;
+ int ret;
INIT_LIST_HEAD(&isc->subdev_entities);
for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
- int ret;
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
&v4l2_epn);
if (ret) {
- of_node_put(epn);
dev_err(dev, "Could not parse the endpoint\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_put;
}
subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
GFP_KERNEL);
if (!subdev_entity) {
- of_node_put(epn);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err_put;
}
- subdev_entity->epn = epn;
+ subdev_entity->epn = of_node_get(epn);
flags = v4l2_epn.bus.parallel.flags;
@@ -398,6 +398,12 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
}
return 0;
+
+err_put:
+ of_node_put(epn);
+ list_for_each_entry(subdev_entity, &isc->subdev_entities, list)
+ of_node_put(subdev_entity->epn);
+ return ret;
}
static int microchip_isc_probe(struct platform_device *pdev)
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index b0302dfc3278..1f5debb74f18 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -340,6 +340,7 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
struct isc_subdev_entity *subdev_entity;
unsigned int flags;
bool mipi_mode;
+ int ret;
INIT_LIST_HEAD(&isc->subdev_entities);
@@ -347,23 +348,22 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
- int ret;
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
&v4l2_epn);
if (ret) {
- of_node_put(epn);
dev_err(dev, "Could not parse the endpoint\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_put;
}
subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
GFP_KERNEL);
if (!subdev_entity) {
- of_node_put(epn);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto err_put;
}
- subdev_entity->epn = epn;
+ subdev_entity->epn = of_node_get(epn);
flags = v4l2_epn.bus.parallel.flags;
@@ -387,6 +387,12 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
}
return 0;
+
+err_put:
+ of_node_put(epn);
+ list_for_each_entry(subdev_entity, &isc->subdev_entities, list)
+ of_node_put(subdev_entity->epn);
+ return ret;
}
static int microchip_xisc_probe(struct platform_device *pdev)
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 03/10] media: microchip-isc: synchronize the IRQ before disabling clocks on stop
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 02/10] media: microchip-isc: take a reference on the parsed endpoints Balakrishnan Sambath
@ 2026-07-21 10:28 ` Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 04/10] media: microchip-isc: disable histogram and flush AWB work on teardown Balakrishnan Sambath
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:28 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
isc_stop_streaming() masks the DMA interrupt and then drops the runtime
PM reference, which disables the ISC clocks. microchip_isc_interrupt()
may still be executing on another CPU at that point; it reads ISC_INTSR
over regmap, and touching the unclocked registers triggers an external
abort.
Store the IRQ number at probe and call synchronize_irq() after masking
the interrupt, before dropping the PM reference.
Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
Reviewed-by: Eugen Hristev <ehristev@kernel.org>
---
drivers/media/platform/microchip/microchip-isc-base.c | 3 +++
drivers/media/platform/microchip/microchip-isc.h | 1 +
drivers/media/platform/microchip/microchip-sama5d2-isc.c | 2 ++
drivers/media/platform/microchip/microchip-sama7g5-isc.c | 2 ++
4 files changed, 8 insertions(+)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 4079c79cb668..3245dd7cb980 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -425,6 +425,9 @@ static void isc_stop_streaming(struct vb2_queue *vq)
/* Disable DMA interrupt */
regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE);
+ /* let a running IRQ handler finish before the clock is disabled */
+ synchronize_irq(isc->irq);
+
pm_runtime_put_sync(isc->dev);
/* Disable stream on the sub device */
diff --git a/drivers/media/platform/microchip/microchip-isc.h b/drivers/media/platform/microchip/microchip-isc.h
index ad4e98a1dd8f..f5e322c2e36b 100644
--- a/drivers/media/platform/microchip/microchip-isc.h
+++ b/drivers/media/platform/microchip/microchip-isc.h
@@ -287,6 +287,7 @@ struct isc_device {
u32 dcfg;
struct device *dev;
+ int irq;
struct v4l2_device v4l2_dev;
struct video_device video_dev;
diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 97752eca6d6b..5d49b9d48f57 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -438,6 +438,8 @@ static int microchip_isc_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
+ isc->irq = irq;
+
ret = devm_request_irq(dev, irq, microchip_isc_interrupt, 0,
"microchip-sama5d2-isc", isc);
if (ret < 0) {
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 1f5debb74f18..4f9e9a5ed4d1 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -427,6 +427,8 @@ static int microchip_xisc_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
+ isc->irq = irq;
+
ret = devm_request_irq(dev, irq, microchip_isc_interrupt, 0,
"microchip-sama7g5-xisc", isc);
if (ret < 0) {
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 04/10] media: microchip-isc: disable histogram and flush AWB work on teardown
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (2 preceding siblings ...)
2026-07-21 10:28 ` [PATCH v3 03/10] media: microchip-isc: synchronize the IRQ before disabling clocks on stop Balakrishnan Sambath
@ 2026-07-21 10:28 ` Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 05/10] media: microchip-isc: do not touch WB registers when not streaming Balakrishnan Sambath
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:28 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
isc_stop_streaming() and the isc_start_streaming() error path dropped the
runtime PM reference with the histogram still enabled. A HISDONE firing
just before the stop, or a failed isc_update_profile() on the start path,
can queue isc_awb_work(), which reads the histogram registers before
taking its own PM reference and faults on the unclocked device.
Disable the histogram, synchronize the IRQ and flush the work before
dropping the PM reference on both paths. synchronize_irq() must come
before cancel_work_sync(), so an in-flight handler cannot re-queue
awb_work after it is cancelled.
Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/platform/microchip/microchip-isc-base.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 3245dd7cb980..f7fbd3cd8edc 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -382,6 +382,13 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
return 0;
err_configure:
+ isc_set_histogram(isc, false);
+
+ /* let a running IRQ handler finish before the clock is disabled */
+ synchronize_irq(isc->irq);
+
+ cancel_work_sync(&isc->awb_work);
+
pm_runtime_put_sync(isc->dev);
err_pm_get:
v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0);
@@ -425,9 +432,13 @@ static void isc_stop_streaming(struct vb2_queue *vq)
/* Disable DMA interrupt */
regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE);
+ isc_set_histogram(isc, false);
+
/* let a running IRQ handler finish before the clock is disabled */
synchronize_irq(isc->irq);
+ cancel_work_sync(&isc->awb_work);
+
pm_runtime_put_sync(isc->dev);
/* Disable stream on the sub device */
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 05/10] media: microchip-isc: do not touch WB registers when not streaming
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (3 preceding siblings ...)
2026-07-21 10:28 ` [PATCH v3 04/10] media: microchip-isc: disable histogram and flush AWB work on teardown Balakrishnan Sambath
@ 2026-07-21 10:28 ` Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 06/10] media: microchip-isc: store the unshifted PFE_CFG0 BPS value Balakrishnan Sambath
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:28 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
isc_s_awb_ctrl() called isc_update_awb_ctrls() unconditionally, writing
the white balance registers even when the device is runtime suspended;
on many ARM platforms accessing the unclocked registers is an external
abort. The write was also done without awb_lock, racing isc_awb_work(),
which holds it so the DMA done IRQ cannot latch a half-updated pipeline.
Write the registers only while streaming and not stopping, under
awb_lock, and update the profile there. The isc->stop check covers the
window where isc_stop_streaming() has gated the clocks but vb2 still
reports streaming. Otherwise the new values stay cached and
isc_configure() programs them at the next stream start.
Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
.../media/platform/microchip/microchip-isc-base.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index f7fbd3cd8edc..a2f7035f4418 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1509,20 +1509,24 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)
if (ctrl->cluster[ISC_CTRL_GB_OFF]->is_new)
ctrls->offset[ISC_HIS_CFG_MODE_GB] = isc->gb_off_ctrl->val;
- isc_update_awb_ctrls(isc);
-
mutex_lock(&isc->awb_mutex);
- if (vb2_is_streaming(&isc->vb2_vidq)) {
+ if (vb2_is_streaming(&isc->vb2_vidq) && !isc->stop) {
+ unsigned long flags;
+
/*
- * If we are streaming, we can update profile to
- * have the new settings in place.
+ * awb_lock keeps the DMA done IRQ from latching a
+ * partially written WB pipeline.
*/
+ spin_lock_irqsave(&isc->awb_lock, flags);
+ isc_update_awb_ctrls(isc);
+ spin_unlock_irqrestore(&isc->awb_lock, flags);
+
isc_update_profile(isc);
} else {
/*
- * The auto cluster will activate automatically this
- * control. This has to be deactivated when not
- * streaming.
+ * Not streaming: keep the cached values for the next
+ * stream start and deactivate the cluster-activated
+ * do_white_balance button.
*/
v4l2_ctrl_activate(isc->do_wb_ctrl, false);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 06/10] media: microchip-isc: store the unshifted PFE_CFG0 BPS value
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (4 preceding siblings ...)
2026-07-21 10:28 ` [PATCH v3 05/10] media: microchip-isc: do not touch WB registers when not streaming Balakrishnan Sambath
@ 2026-07-21 10:29 ` Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 07/10] media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo Balakrishnan Sambath
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:29 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath
pfe_cfg0_bps held a pre-shifted BPS value (ISC_PFE_CFG0_BPS_EIGHT was
0x4 << 28) ORed straight into the register. The other format selectors
like cfa_baycfg store the bare field value and position it at the write,
so this one was inconsistent.
Store the bare BPS value and apply it with FIELD_PREP() at the PFE_CFG0
write, and fix the pfe_cfg0_bps comment to match. No functional change.
Suggested-by: Eugen Hristev <ehristev@kernel.org>
Reviewed-by: Eugen Hristev <ehristev@kernel.org>
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/platform/microchip/microchip-isc-base.c | 4 +++-
drivers/media/platform/microchip/microchip-isc-regs.h | 10 +++++-----
drivers/media/platform/microchip/microchip-isc.h | 4 +++-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index a2f7035f4418..4e87e5f45ac4 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -8,6 +8,7 @@
* Author: Eugen Hristev <eugen.hristev@microchip.com>
*
*/
+#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/math64.h>
@@ -290,7 +291,8 @@ static int isc_configure(struct isc_device *isc)
u32 pfe_cfg0, dcfg, mask, pipeline;
struct isc_subdev_entity *subdev = isc->current_subdev;
- pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps;
+ pfe_cfg0 = FIELD_PREP(ISC_PFE_CFG0_BPS_MASK,
+ isc->config.sd_format->pfe_cfg0_bps);
pipeline = isc->config.bits_pipeline;
dcfg = isc->config.dcfg_imode | isc->dcfg;
diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/drivers/media/platform/microchip/microchip-isc-regs.h
index e77e1d9a1db8..185ef0eab7ad 100644
--- a/drivers/media/platform/microchip/microchip-isc-regs.h
+++ b/drivers/media/platform/microchip/microchip-isc-regs.h
@@ -31,11 +31,11 @@
#define ISC_PFE_CFG0_MODE_PROGRESSIVE (0x0 << 4)
#define ISC_PFE_CFG0_MODE_MASK GENMASK(6, 4)
-#define ISC_PFE_CFG0_BPS_EIGHT (0x4 << 28)
-#define ISC_PFG_CFG0_BPS_NINE (0x3 << 28)
-#define ISC_PFG_CFG0_BPS_TEN (0x2 << 28)
-#define ISC_PFG_CFG0_BPS_ELEVEN (0x1 << 28)
-#define ISC_PFG_CFG0_BPS_TWELVE (0x0 << 28)
+#define ISC_PFE_CFG0_BPS_EIGHT 0x4
+#define ISC_PFG_CFG0_BPS_NINE 0x3
+#define ISC_PFG_CFG0_BPS_TEN 0x2
+#define ISC_PFG_CFG0_BPS_ELEVEN 0x1
+#define ISC_PFG_CFG0_BPS_TWELVE 0x0
#define ISC_PFE_CFG0_BPS_MASK GENMASK(30, 28)
#define ISC_PFE_CFG0_COLEN BIT(12)
diff --git a/drivers/media/platform/microchip/microchip-isc.h b/drivers/media/platform/microchip/microchip-isc.h
index f5e322c2e36b..d7bcd74efff9 100644
--- a/drivers/media/platform/microchip/microchip-isc.h
+++ b/drivers/media/platform/microchip/microchip-isc.h
@@ -62,7 +62,9 @@ struct isc_subdev_entity {
* @mbus_code: V4L2 media bus format code.
* @cfa_baycfg: If this format is RAW BAYER, indicate the type of bayer.
this is either BGBG, RGRG, etc.
- * @pfe_cfg0_bps: Number of hardware data lines connected to the ISC
+ * @pfe_cfg0_bps: ISC_PFE_CFG0 BPS field value (e.g. ISC_PFE_CFG0_BPS_EIGHT),
+ written into PFE_CFG0 with FIELD_PREP(ISC_PFE_CFG0_BPS_MASK)
+ at configure time.
* @raw: If the format is raw bayer.
*/
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 07/10] media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (5 preceding siblings ...)
2026-07-21 10:29 ` [PATCH v3 06/10] media: microchip-isc: store the unshifted PFE_CFG0 BPS value Balakrishnan Sambath
@ 2026-07-21 10:29 ` Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 08/10] media: microchip-isc: fix PM runtime leak in AWB work handler Balakrishnan Sambath
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:29 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath
The BPS field macros for ISC_PFE_CFG0 were spelled ISC_PFG_CFG0_BPS_*
(NINE, TEN, ELEVEN, TWELVE). The register is PFE, not PFG. Rename them
to ISC_PFE_CFG0_BPS_* to match the register and the EIGHT and MASK
macros. No functional change.
Reviewed-by: Eugen Hristev <ehristev@kernel.org>
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
drivers/media/platform/microchip/microchip-isc-regs.h | 8 ++++----
.../media/platform/microchip/microchip-sama5d2-isc.c | 18 +++++++++---------
.../media/platform/microchip/microchip-sama7g5-isc.c | 18 +++++++++---------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/drivers/media/platform/microchip/microchip-isc-regs.h
index 185ef0eab7ad..9ddbbb6dd68b 100644
--- a/drivers/media/platform/microchip/microchip-isc-regs.h
+++ b/drivers/media/platform/microchip/microchip-isc-regs.h
@@ -32,10 +32,10 @@
#define ISC_PFE_CFG0_MODE_MASK GENMASK(6, 4)
#define ISC_PFE_CFG0_BPS_EIGHT 0x4
-#define ISC_PFG_CFG0_BPS_NINE 0x3
-#define ISC_PFG_CFG0_BPS_TEN 0x2
-#define ISC_PFG_CFG0_BPS_ELEVEN 0x1
-#define ISC_PFG_CFG0_BPS_TWELVE 0x0
+#define ISC_PFE_CFG0_BPS_NINE 0x3
+#define ISC_PFE_CFG0_BPS_TEN 0x2
+#define ISC_PFE_CFG0_BPS_ELEVEN 0x1
+#define ISC_PFE_CFG0_BPS_TWELVE 0x0
#define ISC_PFE_CFG0_BPS_MASK GENMASK(30, 28)
#define ISC_PFE_CFG0_COLEN BIT(12)
diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5d49b9d48f57..5c59a692b30e 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -146,49 +146,49 @@ static struct isc_format sama5d2_formats_list[] = {
{
.fourcc = V4L2_PIX_FMT_SBGGR10,
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_RGRG,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG10,
.mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_GBGB,
},
{
.fourcc = V4L2_PIX_FMT_SGRBG10,
.mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_GRGR,
},
{
.fourcc = V4L2_PIX_FMT_SRGGB10,
.mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_RGRG,
},
{
.fourcc = V4L2_PIX_FMT_SBGGR12,
.mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_BGBG,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG12,
.mbus_code = MEDIA_BUS_FMT_SGBRG12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_GBGB,
},
{
.fourcc = V4L2_PIX_FMT_SGRBG12,
.mbus_code = MEDIA_BUS_FMT_SGRBG12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_GRGR,
},
{
.fourcc = V4L2_PIX_FMT_SRGGB12,
.mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_RGRG,
},
{
@@ -209,7 +209,7 @@ static struct isc_format sama5d2_formats_list[] = {
{
.fourcc = V4L2_PIX_FMT_Y10,
.mbus_code = MEDIA_BUS_FMT_Y10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
},
};
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 4f9e9a5ed4d1..5c7a10c9a2a5 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -155,49 +155,49 @@ static struct isc_format sama7g5_formats_list[] = {
{
.fourcc = V4L2_PIX_FMT_SBGGR10,
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_RGRG,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG10,
.mbus_code = MEDIA_BUS_FMT_SGBRG10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_GBGB,
},
{
.fourcc = V4L2_PIX_FMT_SGRBG10,
.mbus_code = MEDIA_BUS_FMT_SGRBG10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_GRGR,
},
{
.fourcc = V4L2_PIX_FMT_SRGGB10,
.mbus_code = MEDIA_BUS_FMT_SRGGB10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
.cfa_baycfg = ISC_BAY_CFG_RGRG,
},
{
.fourcc = V4L2_PIX_FMT_SBGGR12,
.mbus_code = MEDIA_BUS_FMT_SBGGR12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_BGBG,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG12,
.mbus_code = MEDIA_BUS_FMT_SGBRG12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_GBGB,
},
{
.fourcc = V4L2_PIX_FMT_SGRBG12,
.mbus_code = MEDIA_BUS_FMT_SGRBG12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_GRGR,
},
{
.fourcc = V4L2_PIX_FMT_SRGGB12,
.mbus_code = MEDIA_BUS_FMT_SRGGB12_1X12,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TWELVE,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TWELVE,
.cfa_baycfg = ISC_BAY_CFG_RGRG,
},
{
@@ -223,7 +223,7 @@ static struct isc_format sama7g5_formats_list[] = {
{
.fourcc = V4L2_PIX_FMT_Y10,
.mbus_code = MEDIA_BUS_FMT_Y10_1X10,
- .pfe_cfg0_bps = ISC_PFG_CFG0_BPS_TEN,
+ .pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
},
};
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 08/10] media: microchip-isc: fix PM runtime leak in AWB work handler
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (6 preceding siblings ...)
2026-07-21 10:29 ` [PATCH v3 07/10] media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo Balakrishnan Sambath
@ 2026-07-21 10:29 ` Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 09/10] media: microchip-isc: fix SBGGR10 Bayer pattern Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking Balakrishnan Sambath
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:29 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
Early return when streaming stops skips pm_runtime_put_sync(),
leaking the reference and preventing runtime suspend.
Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
Reviewed-by: Eugen Hristev <ehristev@kernel.org>
---
drivers/media/platform/microchip/microchip-isc-base.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 4e87e5f45ac4..1a9b97edfa32 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -1432,7 +1432,7 @@ static void isc_awb_work(struct work_struct *w)
/* streaming is not active anymore */
if (isc->stop) {
mutex_unlock(&isc->awb_mutex);
- return;
+ goto out_pm_put;
}
isc_update_profile(isc);
@@ -1443,6 +1443,7 @@ static void isc_awb_work(struct work_struct *w)
if (ctrls->awb)
regmap_write(regmap, ISC_CTRLEN, ISC_CTRL_HISREQ);
+out_pm_put:
pm_runtime_put_sync(isc->dev);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 09/10] media: microchip-isc: fix SBGGR10 Bayer pattern
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (7 preceding siblings ...)
2026-07-21 10:29 ` [PATCH v3 08/10] media: microchip-isc: fix PM runtime leak in AWB work handler Balakrishnan Sambath
@ 2026-07-21 10:29 ` Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking Balakrishnan Sambath
9 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:29 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
SBGGR10 was mapped to ISC_BAY_CFG_RGRG instead of ISC_BAY_CFG_BGBG,
causing red/blue channel swap.
Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
Reviewed-by: Eugen Hristev <ehristev@kernel.org>
---
drivers/media/platform/microchip/microchip-sama5d2-isc.c | 2 +-
drivers/media/platform/microchip/microchip-sama7g5-isc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5c59a692b30e..99fda1968a32 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -147,7 +147,7 @@ static struct isc_format sama5d2_formats_list[] = {
.fourcc = V4L2_PIX_FMT_SBGGR10,
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
.pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
- .cfa_baycfg = ISC_BAY_CFG_RGRG,
+ .cfa_baycfg = ISC_BAY_CFG_BGBG,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG10,
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 5c7a10c9a2a5..4e1fbb83bc97 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -156,7 +156,7 @@ static struct isc_format sama7g5_formats_list[] = {
.fourcc = V4L2_PIX_FMT_SBGGR10,
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
.pfe_cfg0_bps = ISC_PFE_CFG0_BPS_TEN,
- .cfa_baycfg = ISC_BAY_CFG_RGRG,
+ .cfa_baycfg = ISC_BAY_CFG_BGBG,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG10,
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
` (8 preceding siblings ...)
2026-07-21 10:29 ` [PATCH v3 09/10] media: microchip-isc: fix SBGGR10 Bayer pattern Balakrishnan Sambath
@ 2026-07-21 10:29 ` Balakrishnan Sambath
2026-07-21 13:19 ` Eugen Hristev
9 siblings, 1 reply; 15+ messages in thread
From: Balakrishnan Sambath @ 2026-07-21 10:29 UTC (permalink / raw)
To: Eugen Hristev, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel,
Balakrishnan Sambath, stable
ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset
sign-extends and corrupts the adjacent field. Add masks for the two
fields and write them with FIELD_PREP(), which masks each value into its
field, so sign extension can no longer bleed across.
Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
Cc: stable@vger.kernel.org
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
---
.../media/platform/microchip/microchip-isc-base.c | 21 +++++++++++++--------
.../media/platform/microchip/microchip-isc-regs.h | 6 ++++++
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 1a9b97edfa32..3d25d7d28652 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -62,18 +62,23 @@ static inline void isc_update_awb_ctrls(struct isc_device *isc)
/* In here we set our actual hw pipeline config */
+ /*
+ * Each register packs two 13-bit fields. FIELD_PREP() masks every
+ * value into its field, so sign extension of a negative offset can
+ * no longer bleed into the adjacent field.
+ */
regmap_write(isc->regmap, ISC_WB_O_RGR,
- ((ctrls->offset[ISC_HIS_CFG_MODE_R])) |
- ((ctrls->offset[ISC_HIS_CFG_MODE_GR]) << 16));
+ FIELD_PREP(ISC_WB_O_LO, ctrls->offset[ISC_HIS_CFG_MODE_R]) |
+ FIELD_PREP(ISC_WB_O_HI, ctrls->offset[ISC_HIS_CFG_MODE_GR]));
regmap_write(isc->regmap, ISC_WB_O_BGB,
- ((ctrls->offset[ISC_HIS_CFG_MODE_B])) |
- ((ctrls->offset[ISC_HIS_CFG_MODE_GB]) << 16));
+ FIELD_PREP(ISC_WB_O_LO, ctrls->offset[ISC_HIS_CFG_MODE_B]) |
+ FIELD_PREP(ISC_WB_O_HI, ctrls->offset[ISC_HIS_CFG_MODE_GB]));
regmap_write(isc->regmap, ISC_WB_G_RGR,
- ctrls->gain[ISC_HIS_CFG_MODE_R] |
- (ctrls->gain[ISC_HIS_CFG_MODE_GR] << 16));
+ FIELD_PREP(ISC_WB_G_LO, ctrls->gain[ISC_HIS_CFG_MODE_R]) |
+ FIELD_PREP(ISC_WB_G_HI, ctrls->gain[ISC_HIS_CFG_MODE_GR]));
regmap_write(isc->regmap, ISC_WB_G_BGB,
- ctrls->gain[ISC_HIS_CFG_MODE_B] |
- (ctrls->gain[ISC_HIS_CFG_MODE_GB] << 16));
+ FIELD_PREP(ISC_WB_G_LO, ctrls->gain[ISC_HIS_CFG_MODE_B]) |
+ FIELD_PREP(ISC_WB_G_HI, ctrls->gain[ISC_HIS_CFG_MODE_GB]));
}
static inline void isc_reset_awb_ctrls(struct isc_device *isc)
diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/drivers/media/platform/microchip/microchip-isc-regs.h
index 9ddbbb6dd68b..fe145b142b82 100644
--- a/drivers/media/platform/microchip/microchip-isc-regs.h
+++ b/drivers/media/platform/microchip/microchip-isc-regs.h
@@ -149,6 +149,12 @@
/* ISC White Balance Gain for B, GB Register */
#define ISC_WB_G_BGB 0x0000006c
+/* Each WB offset/gain register packs two 13-bit fields, low and high */
+#define ISC_WB_O_LO GENMASK(12, 0) /* R or B offset [12:0] */
+#define ISC_WB_O_HI GENMASK(28, 16) /* GR or GB offset [28:16] */
+#define ISC_WB_G_LO GENMASK(12, 0) /* R or B gain [12:0] */
+#define ISC_WB_G_HI GENMASK(28, 16) /* GR or GB gain [28:16] */
+
/* ISC Color Filter Array Control Register */
#define ISC_CFA_CTRL 0x00000070
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking
2026-07-21 10:29 ` [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking Balakrishnan Sambath
@ 2026-07-21 13:19 ` Eugen Hristev
2026-07-22 5:32 ` Balakrishnan.S
0 siblings, 1 reply; 15+ messages in thread
From: Eugen Hristev @ 2026-07-21 13:19 UTC (permalink / raw)
To: Balakrishnan Sambath, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel, stable
On 7/21/26 13:29, Balakrishnan Sambath wrote:
> ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset
> sign-extends and corrupts the adjacent field. Add masks for the two
> fields and write them with FIELD_PREP(), which masks each value into its
> field, so sign extension can no longer bleed across.
>
> Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
> Cc: stable@vger.kernel.org
> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
> ---
> .../media/platform/microchip/microchip-isc-base.c | 21 +++++++++++++--------
> .../media/platform/microchip/microchip-isc-regs.h | 6 ++++++
> 2 files changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
> index 1a9b97edfa32..3d25d7d28652 100644
> --- a/drivers/media/platform/microchip/microchip-isc-base.c
> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
> @@ -62,18 +62,23 @@ static inline void isc_update_awb_ctrls(struct isc_device *isc)
>
> /* In here we set our actual hw pipeline config */
>
> + /*
> + * Each register packs two 13-bit fields. FIELD_PREP() masks every
> + * value into its field, so sign extension of a negative offset can
> + * no longer bleed into the adjacent field.
> + */
I guess this comment does not make sense. It refers to a bad situation
in the past that is no longer valid. In time, it will be forgotten and
it does not make sense to mention it here.
At least my opinion on it.
> regmap_write(isc->regmap, ISC_WB_O_RGR,
> - ((ctrls->offset[ISC_HIS_CFG_MODE_R])) |
> - ((ctrls->offset[ISC_HIS_CFG_MODE_GR]) << 16));
> + FIELD_PREP(ISC_WB_O_LO, ctrls->offset[ISC_HIS_CFG_MODE_R]) |
> + FIELD_PREP(ISC_WB_O_HI, ctrls->offset[ISC_HIS_CFG_MODE_GR]));
> regmap_write(isc->regmap, ISC_WB_O_BGB,
> - ((ctrls->offset[ISC_HIS_CFG_MODE_B])) |
> - ((ctrls->offset[ISC_HIS_CFG_MODE_GB]) << 16));
> + FIELD_PREP(ISC_WB_O_LO, ctrls->offset[ISC_HIS_CFG_MODE_B]) |
> + FIELD_PREP(ISC_WB_O_HI, ctrls->offset[ISC_HIS_CFG_MODE_GB]));
> regmap_write(isc->regmap, ISC_WB_G_RGR,
> - ctrls->gain[ISC_HIS_CFG_MODE_R] |
> - (ctrls->gain[ISC_HIS_CFG_MODE_GR] << 16));
> + FIELD_PREP(ISC_WB_G_LO, ctrls->gain[ISC_HIS_CFG_MODE_R]) |
> + FIELD_PREP(ISC_WB_G_HI, ctrls->gain[ISC_HIS_CFG_MODE_GR]));
> regmap_write(isc->regmap, ISC_WB_G_BGB,
> - ctrls->gain[ISC_HIS_CFG_MODE_B] |
> - (ctrls->gain[ISC_HIS_CFG_MODE_GB] << 16));
> + FIELD_PREP(ISC_WB_G_LO, ctrls->gain[ISC_HIS_CFG_MODE_B]) |
> + FIELD_PREP(ISC_WB_G_HI, ctrls->gain[ISC_HIS_CFG_MODE_GB]));
> }
>
> static inline void isc_reset_awb_ctrls(struct isc_device *isc)
> diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/drivers/media/platform/microchip/microchip-isc-regs.h
> index 9ddbbb6dd68b..fe145b142b82 100644
> --- a/drivers/media/platform/microchip/microchip-isc-regs.h
> +++ b/drivers/media/platform/microchip/microchip-isc-regs.h
> @@ -149,6 +149,12 @@
> /* ISC White Balance Gain for B, GB Register */
> #define ISC_WB_G_BGB 0x0000006c
>
> +/* Each WB offset/gain register packs two 13-bit fields, low and high */
> +#define ISC_WB_O_LO GENMASK(12, 0) /* R or B offset [12:0] */
> +#define ISC_WB_O_HI GENMASK(28, 16) /* GR or GB offset [28:16] */
> +#define ISC_WB_G_LO GENMASK(12, 0) /* R or B gain [12:0] */
> +#define ISC_WB_G_HI GENMASK(28, 16) /* GR or GB gain [28:16] */
> +
> /* ISC Color Filter Array Control Register */
> #define ISC_CFA_CTRL 0x00000070
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle
2026-07-21 10:28 ` [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle Balakrishnan Sambath
@ 2026-07-21 13:27 ` Eugen Hristev
2026-07-23 9:36 ` Balakrishnan.S
0 siblings, 1 reply; 15+ messages in thread
From: Eugen Hristev @ 2026-07-21 13:27 UTC (permalink / raw)
To: Balakrishnan Sambath, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, linux-media, linux-kernel, stable
On 7/21/26 13:28, Balakrishnan Sambath wrote:
> isc_async_complete() initialised awb_mutex and isc->lock only after an
> early error return, and the teardown was inconsistent:
>
> - isc_async_unbind() destroyed awb_mutex before cancelling awb_work,
> which takes it;
> - a failed .complete() destroyed both locks, then the v4l2-async core
> unbinds the subdev and isc_async_unbind() destroyed awb_mutex again;
> - isc->lock was destroyed only on the .complete() error path, so the
> normal unbind path leaked it.
>
> Initialise both locks before the first error return, make unbind the
> single teardown site (cancel the work, then destroy both locks) and
> drop the destroys from the .complete() error path.
>
> Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming")
> Cc: stable@vger.kernel.org
> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
> ---
> drivers/media/platform/microchip/microchip-isc-base.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
> index a7cdc743fda7..45a7af779323 100644
> --- a/drivers/media/platform/microchip/microchip-isc-base.c
> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
> @@ -1703,10 +1703,11 @@ static void isc_async_unbind(struct v4l2_async_notifier *notifier,
> {
> struct isc_device *isc = container_of(notifier->v4l2_dev,
> struct isc_device, v4l2_dev);
> - mutex_destroy(&isc->awb_mutex);
> cancel_work_sync(&isc->awb_work);
> + mutex_destroy(&isc->awb_mutex);
> video_unregister_device(&isc->video_dev);
> v4l2_ctrl_handler_free(&isc->ctrls.handler);
> + mutex_destroy(&isc->lock);
> }
>
> struct isc_format *isc_find_format_by_code(struct isc_device *isc,
> @@ -1758,6 +1759,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
> int ret = 0;
>
> INIT_WORK(&isc->awb_work, isc_awb_work);
> + mutex_init(&isc->lock);
> + mutex_init(&isc->awb_mutex);
Does it make sense to reinit these mutexes again every time complete()
is called , and not get destroyed here in case of an err ?
The way I understand it, is isc_async_complete() will init them, then
some other function would destroy them, but that destroy is called in
every single case ?
It is odd that a failing function in this case would leave mutexes
initialized and not destroyed, when the function itself would initialize
them. It would not leave the device in the same state , after failing .
Which is quite odd.
I am thinking whether it's better to allocate these mutexes at probe and
have them all the time, and teardown on remove(). Is that making more
sense ?
>
> ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev);
> if (ret < 0) {
> @@ -1767,8 +1770,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
>
> isc->current_subdev = container_of(notifier,
> struct isc_subdev_entity, notifier);
> - mutex_init(&isc->lock);
> - mutex_init(&isc->awb_mutex);
>
> init_completion(&isc->comp);
>
> @@ -1841,8 +1842,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
> video_unregister_device(vdev);
>
> isc_async_complete_err:
> - mutex_destroy(&isc->awb_mutex);
> - mutex_destroy(&isc->lock);
> return ret;
If now isc_async_complete_err just returns ret, does it still make sense
to have this label ? Or just return ret instead of goto [...] ?
> }
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking
2026-07-21 13:19 ` Eugen Hristev
@ 2026-07-22 5:32 ` Balakrishnan.S
0 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan.S @ 2026-07-22 5:32 UTC (permalink / raw)
To: ehristev, mchehab
Cc: hverkuil, sakari.ailus, linux-media, linux-kernel, stable
Hi Eugen,
On 21/07/26 6:49 pm, Eugen Hristev wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On 7/21/26 13:29, Balakrishnan Sambath wrote:
>> ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset
>> sign-extends and corrupts the adjacent field. Add masks for the two
>> fields and write them with FIELD_PREP(), which masks each value into its
>> field, so sign extension can no longer bleed across.
>>
>> Fixes: 91b4e487b0c6 ("media: microchip: add ISC driver as Microchip ISC")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
>> ---
>> .../media/platform/microchip/microchip-isc-base.c | 21 +++++++++++++--------
>> .../media/platform/microchip/microchip-isc-regs.h | 6 ++++++
>> 2 files changed, 19 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
>> index 1a9b97edfa32..3d25d7d28652 100644
>> --- a/drivers/media/platform/microchip/microchip-isc-base.c
>> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
>> @@ -62,18 +62,23 @@ static inline void isc_update_awb_ctrls(struct isc_device *isc)
>>
>> /* In here we set our actual hw pipeline config */
>>
>> + /*
>> + * Each register packs two 13-bit fields. FIELD_PREP() masks every
>> + * value into its field, so sign extension of a negative offset can
>> + * no longer bleed into the adjacent field.
>> + */
>
> I guess this comment does not make sense. It refers to a bad situation
> in the past that is no longer valid. In time, it will be forgotten and
> it does not make sense to mention it here.
> At least my opinion on it.
Yeah, it makes sense if no objections let me chop it off.
Thanks,
Balakrishnan
>
>
>> regmap_write(isc->regmap, ISC_WB_O_RGR,
>> - ((ctrls->offset[ISC_HIS_CFG_MODE_R])) |
>> - ((ctrls->offset[ISC_HIS_CFG_MODE_GR]) << 16));
>> + FIELD_PREP(ISC_WB_O_LO, ctrls->offset[ISC_HIS_CFG_MODE_R]) |
>> + FIELD_PREP(ISC_WB_O_HI, ctrls->offset[ISC_HIS_CFG_MODE_GR]));
>> regmap_write(isc->regmap, ISC_WB_O_BGB,
>> - ((ctrls->offset[ISC_HIS_CFG_MODE_B])) |
>> - ((ctrls->offset[ISC_HIS_CFG_MODE_GB]) << 16));
>> + FIELD_PREP(ISC_WB_O_LO, ctrls->offset[ISC_HIS_CFG_MODE_B]) |
>> + FIELD_PREP(ISC_WB_O_HI, ctrls->offset[ISC_HIS_CFG_MODE_GB]));
>> regmap_write(isc->regmap, ISC_WB_G_RGR,
>> - ctrls->gain[ISC_HIS_CFG_MODE_R] |
>> - (ctrls->gain[ISC_HIS_CFG_MODE_GR] << 16));
>> + FIELD_PREP(ISC_WB_G_LO, ctrls->gain[ISC_HIS_CFG_MODE_R]) |
>> + FIELD_PREP(ISC_WB_G_HI, ctrls->gain[ISC_HIS_CFG_MODE_GR]));
>> regmap_write(isc->regmap, ISC_WB_G_BGB,
>> - ctrls->gain[ISC_HIS_CFG_MODE_B] |
>> - (ctrls->gain[ISC_HIS_CFG_MODE_GB] << 16));
>> + FIELD_PREP(ISC_WB_G_LO, ctrls->gain[ISC_HIS_CFG_MODE_B]) |
>> + FIELD_PREP(ISC_WB_G_HI, ctrls->gain[ISC_HIS_CFG_MODE_GB]));
>> }
>>
>> static inline void isc_reset_awb_ctrls(struct isc_device *isc)
>> diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/drivers/media/platform/microchip/microchip-isc-regs.h
>> index 9ddbbb6dd68b..fe145b142b82 100644
>> --- a/drivers/media/platform/microchip/microchip-isc-regs.h
>> +++ b/drivers/media/platform/microchip/microchip-isc-regs.h
>> @@ -149,6 +149,12 @@
>> /* ISC White Balance Gain for B, GB Register */
>> #define ISC_WB_G_BGB 0x0000006c
>>
>> +/* Each WB offset/gain register packs two 13-bit fields, low and high */
>> +#define ISC_WB_O_LO GENMASK(12, 0) /* R or B offset [12:0] */
>> +#define ISC_WB_O_HI GENMASK(28, 16) /* GR or GB offset [28:16] */
>> +#define ISC_WB_G_LO GENMASK(12, 0) /* R or B gain [12:0] */
>> +#define ISC_WB_G_HI GENMASK(28, 16) /* GR or GB gain [28:16] */
>> +
>> /* ISC Color Filter Array Control Register */
>> #define ISC_CFA_CTRL 0x00000070
>>
>>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle
2026-07-21 13:27 ` Eugen Hristev
@ 2026-07-23 9:36 ` Balakrishnan.S
0 siblings, 0 replies; 15+ messages in thread
From: Balakrishnan.S @ 2026-07-23 9:36 UTC (permalink / raw)
To: ehristev, mchehab
Cc: hverkuil, sakari.ailus, linux-media, linux-kernel, stable
Hi Eugen,
On 21/07/26 6:57 pm, Eugen Hristev wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On 7/21/26 13:28, Balakrishnan Sambath wrote:
>> isc_async_complete() initialised awb_mutex and isc->lock only after an
>> early error return, and the teardown was inconsistent:
>>
>> - isc_async_unbind() destroyed awb_mutex before cancelling awb_work,
>> which takes it;
>> - a failed .complete() destroyed both locks, then the v4l2-async core
>> unbinds the subdev and isc_async_unbind() destroyed awb_mutex again;
>> - isc->lock was destroyed only on the .complete() error path, so the
>> normal unbind path leaked it.
>>
>> Initialise both locks before the first error return, make unbind the
>> single teardown site (cancel the work, then destroy both locks) and
>> drop the destroys from the .complete() error path.
>>
>> Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com>
>> ---
>> drivers/media/platform/microchip/microchip-isc-base.c | 9 ++++-----
>> 1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
>> index a7cdc743fda7..45a7af779323 100644
>> --- a/drivers/media/platform/microchip/microchip-isc-base.c
>> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
>> @@ -1703,10 +1703,11 @@ static void isc_async_unbind(struct v4l2_async_notifier *notifier,
>> {
>> struct isc_device *isc = container_of(notifier->v4l2_dev,
>> struct isc_device, v4l2_dev);
>> - mutex_destroy(&isc->awb_mutex);
>> cancel_work_sync(&isc->awb_work);
>> + mutex_destroy(&isc->awb_mutex);
>> video_unregister_device(&isc->video_dev);
>> v4l2_ctrl_handler_free(&isc->ctrls.handler);
>> + mutex_destroy(&isc->lock);
>> }
>>
>> struct isc_format *isc_find_format_by_code(struct isc_device *isc,
>> @@ -1758,6 +1759,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
>> int ret = 0;
>>
>> INIT_WORK(&isc->awb_work, isc_awb_work);
>> + mutex_init(&isc->lock);
>> + mutex_init(&isc->awb_mutex);
>
> Does it make sense to reinit these mutexes again every time complete()
> is called , and not get destroyed here in case of an err ?
>
> The way I understand it, is isc_async_complete() will init them, then
> some other function would destroy them, but that destroy is called in
> every single case ?
> It is odd that a failing function in this case would leave mutexes
> initialized and not destroyed, when the function itself would initialize
> them. It would not leave the device in the same state , after failing .
> Which is quite odd.
> I am thinking whether it's better to allocate these mutexes at probe and
> have them all the time, and teardown on remove(). Is that making more
> sense ?
Fair point. I had put the init in isc_async_complete() just because the
rest of the setup is there, wasn't really thinking of the fail path.
Thanks for the valuable pointer, Eugen. Will address this in next version.
>>
>> ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev);
>> if (ret < 0) {
>> @@ -1767,8 +1770,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
>>
>> isc->current_subdev = container_of(notifier,
>> struct isc_subdev_entity, notifier);
>> - mutex_init(&isc->lock);
>> - mutex_init(&isc->awb_mutex);
>>
>> init_completion(&isc->comp);
>>
>> @@ -1841,8 +1842,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
>> video_unregister_device(vdev);
>>
>> isc_async_complete_err:
>> - mutex_destroy(&isc->awb_mutex);
>> - mutex_destroy(&isc->lock);
>> return ret;
>
> If now isc_async_complete_err just returns ret, does it still make sense
> to have this label ? Or just return ret instead of goto [...] ?
Ah, indeed that's a no-op somehow I missed it. I'll drop it too.
Thanks,
Balakrishnan S
>
>> }
>>
>>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-07-23 9:36 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 10:28 [PATCH v3 00/10] media: microchip-isc: AWB, stream-stop and endpoint-ref fixes Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle Balakrishnan Sambath
2026-07-21 13:27 ` Eugen Hristev
2026-07-23 9:36 ` Balakrishnan.S
2026-07-21 10:28 ` [PATCH v3 02/10] media: microchip-isc: take a reference on the parsed endpoints Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 03/10] media: microchip-isc: synchronize the IRQ before disabling clocks on stop Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 04/10] media: microchip-isc: disable histogram and flush AWB work on teardown Balakrishnan Sambath
2026-07-21 10:28 ` [PATCH v3 05/10] media: microchip-isc: do not touch WB registers when not streaming Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 06/10] media: microchip-isc: store the unshifted PFE_CFG0 BPS value Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 07/10] media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 08/10] media: microchip-isc: fix PM runtime leak in AWB work handler Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 09/10] media: microchip-isc: fix SBGGR10 Bayer pattern Balakrishnan Sambath
2026-07-21 10:29 ` [PATCH v3 10/10] media: microchip-isc: fix WB offset and gain register field masking Balakrishnan Sambath
2026-07-21 13:19 ` Eugen Hristev
2026-07-22 5:32 ` Balakrishnan.S
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.