From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6216223741; Mon, 17 Aug 2026 06:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949537; cv=none; b=unAd9IhfILrSOvVDaxl/iXNJXwW0x2WzEUHjcZCJKsyyFKrxznqFwNqaDFGgszpnqrw6yH1ZYCxWqZgf7w76z7zr8oCgYbbgmZwKBlOJi6RPM0rvOtDWucDPhCTNMt64vJPwkJR2d3Ne3OhXHlKHkLpU3uQdUvtDb/SFmoqB/1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949537; c=relaxed/simple; bh=np+nq5wyAcikOl6vbymooOeGkoDKRRgOwhAAC9GlmAE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=RNVziTia5ElBHZ4LJb8OqULlLYGotMo9WxedZh6C9vQe77P5K/4Hso+DVujkq0cluTSnIwWTJZ8PEmi9T6mom6ixdh7xVGixPpDltNQvQkPCNkxfkUdbbXea93Knj6BVABVBgBOkP/yqQBvh3Uo6d7SWU/OMqMYkR0gDK71aLPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=xFwoHzZF; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="xFwoHzZF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949535; x=1818485535; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=np+nq5wyAcikOl6vbymooOeGkoDKRRgOwhAAC9GlmAE=; b=xFwoHzZFhp20K/SrEfpWhMzgNv3x7dhDIcqVHQDdEk9NW+ITpV/A2XTn CZ37dBput9n0VbXuo9JAMeZBBszTXBgG76FD/ToIMyrAaX32sxiJgWdY7 q0Lsafj7rTyt/Dlr4N2EodP//TI42pcYP2oNdJZBCAVLAPPGYqHrujVSp K/o/vXWI/MRAHuaPt43gk3fcJkU0DULn1cezHhUqe5mWDcUe3dyh55PRN RzRCIJnh28AJQl6wX8ZkgKG57g/sfY7VekzMwfOPfsVSq5Oac8SD/xFF3 O0U59ASWojcXw8wVIX7lxss+NVO4tgmT/xz/maM5tXOP8iqvGn+roAGmt w==; X-CSE-ConnectionGUID: LdRIHxAsQ/uKGk9aZHJsYg== X-CSE-MsgGUID: Y2T+RCcsQDecaQ22yGZgxQ== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="293603457" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Aug 2026 23:52:09 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 16 Aug 2026 23:52:08 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:04 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:21:58 +0530 Subject: [PATCH v5 01/10] media: microchip-isc: fix awb_mutex and lock lifecycle Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-1-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 isc->lock and awb_mutex were initialised in isc_async_complete() and destroyed in isc_async_unbind(), tying their lifetime to the subdev bind/unbind cycle instead of the device: - isc_async_unbind() destroyed awb_mutex before cancel_work_sync(), which takes it; - a failed .complete() left them initialised, and isc->lock was destroyed only on the .complete() error path, so the normal unbind path leaked it; - a rebind runs .complete() again and reinitialises a live mutex. Initialise both with devm_mutex_init() at probe so they live for the whole device lifetime and are freed at remove, and drop the init and destroy from the .complete()/.unbind() callbacks. isc_async_complete_err then only returned ret, so drop the label and return directly at each error site. Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb w= orkq from streaming") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev Signed-off-by: Balakrishnan Sambath --- drivers/media/platform/microchip/microchip-isc-base.c | 15 ++++--------= --- drivers/media/platform/microchip/microchip-sama5d2-isc.c | 9 +++++++++ drivers/media/platform/microchip/microchip-sama7g5-isc.c | 9 +++++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/driver= s/media/platform/microchip/microchip-isc-base.c index a7cdc743fda7..eebbcb28a7ee 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -1703,7 +1703,6 @@ static void isc_async_unbind(struct v4l2_async_notifi= er *notifier, { struct isc_device *isc =3D container_of(notifier->v4l2_dev, struct isc_device, v4l2_dev); - mutex_destroy(&isc->awb_mutex); cancel_work_sync(&isc->awb_work); video_unregister_device(&isc->video_dev); v4l2_ctrl_handler_free(&isc->ctrls.handler); @@ -1767,8 +1766,6 @@ static int isc_async_complete(struct v4l2_async_notif= ier *notifier) =20 isc->current_subdev =3D container_of(notifier, struct isc_subdev_entity, notifier); - mutex_init(&isc->lock); - mutex_init(&isc->awb_mutex); =20 init_completion(&isc->comp); =20 @@ -1787,7 +1784,7 @@ static int isc_async_complete(struct v4l2_async_notif= ier *notifier) ret =3D vb2_queue_init(q); if (ret < 0) { dev_err(isc->dev, "vb2_queue_init() failed: %d\n", ret); - goto isc_async_complete_err; + return ret; } =20 /* Init video dma queues */ @@ -1798,13 +1795,13 @@ static int isc_async_complete(struct v4l2_async_not= ifier *notifier) ret =3D isc_set_default_fmt(isc); if (ret) { dev_err(isc->dev, "Could not set default format\n"); - goto isc_async_complete_err; + return ret; } =20 ret =3D isc_ctrl_init(isc); if (ret) { dev_err(isc->dev, "Init isc ctrols failed: %d\n", ret); - goto isc_async_complete_err; + return ret; } =20 /* Register video device */ @@ -1824,7 +1821,7 @@ static int isc_async_complete(struct v4l2_async_notif= ier *notifier) ret =3D video_register_device(vdev, VFL_TYPE_VIDEO, -1); if (ret < 0) { dev_err(isc->dev, "video_register_device failed: %d\n", ret); - goto isc_async_complete_err; + return ret; } =20 ret =3D isc_scaler_link(isc); @@ -1839,10 +1836,6 @@ static int isc_async_complete(struct v4l2_async_noti= fier *notifier) =20 isc_async_complete_unregister_device: video_unregister_device(vdev); - -isc_async_complete_err: - mutex_destroy(&isc->awb_mutex); - mutex_destroy(&isc->lock); return ret; } =20 diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/dri= vers/media/platform/microchip/microchip-sama5d2-isc.c index 66d3d7891991..25d241b4c66a 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -417,6 +418,14 @@ static int microchip_isc_probe(struct platform_device = *pdev) platform_set_drvdata(pdev, isc); isc->dev =3D dev; =20 + ret =3D devm_mutex_init(dev, &isc->lock); + if (ret) + return ret; + + ret =3D devm_mutex_init(dev, &isc->awb_mutex); + if (ret) + return ret; + io_base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(io_base)) return PTR_ERR(io_base); diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/dri= vers/media/platform/microchip/microchip-sama7g5-isc.c index b0302dfc3278..998146adabd8 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -406,6 +407,14 @@ static int microchip_xisc_probe(struct platform_device= *pdev) platform_set_drvdata(pdev, isc); isc->dev =3D dev; =20 + ret =3D devm_mutex_init(dev, &isc->lock); + if (ret) + return ret; + + ret =3D devm_mutex_init(dev, &isc->awb_mutex); + if (ret) + return ret; + io_base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(io_base)) return PTR_ERR(io_base); --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DB3223741; Mon, 17 Aug 2026 06:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949542; cv=none; b=BoPhm2YwVlZgKby9zyiK5sJywKwpWL6uurS3ZJvmCnXmttIhAwEV4EKSXl9D3ASJsDRWJOB56fbYfo8Caw0d0pXJNPuZ5Kgqr+iRgMcqaLzsEZCsWYMvovEHp/fyhPqf0yst3Of4GW6/MdVrAGIEqDr8brZIXYG50XKZDYCTvDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949542; c=relaxed/simple; bh=PPuWwveO0ERW19jC3hyJIbV4SEC8N4W0p8Skwdf+y5s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=njv3FZUAY0i80S2OUxHEQNVHFyDNhiJcQK2c6j8fnxl+z3KyyeQMqOoX++3rzKtXXPrTGrhQYlzPI8JtweOKlRZpkbJyPx7aK6b7ixrTUZ7P5MEbmY3+Vt6F9poSgz911Osok2lUVG6wRC4V+2SntSk5eNv/Bn4/dnHEMTeiPJA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=xTHBwntn; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="xTHBwntn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949540; x=1818485540; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=PPuWwveO0ERW19jC3hyJIbV4SEC8N4W0p8Skwdf+y5s=; b=xTHBwntnN7Uz0zTV+s00I+SCOVaRoYWHpW0n/7qk/uFK43LABIgqnBP4 tS2a0p9nGjwnjORCasrbICUiuFHcOSK/25EEh6k3O+UY2C43pdlsKQzTY +f6yHXer2PaOsL5lIxj4FJx51UUYPYbXIv/NsHcfdxEPStvziVYhRMxto iAqZsgq0dAeS/MUesbKAx9pSdNR6BYf+s4eg/o8v0tNJONpcTcQxrzyHB SkjmmSWFg8wVh3G9+Zg/BPCY0PqwwfUPH4G5D54JCLS0+tF6uBDvecoRB nGp2smu2rd1S7OerXQm9H6I6jdc0j2yZSXQuhYpzicbjV8z+GQWZPRgQX w==; X-CSE-ConnectionGUID: 7F2Wpgj4TpSTeI/jFDlsVg== X-CSE-MsgGUID: iySwbNavR8+Ld82foVdt3w== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="61331925" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Aug 2026 23:52:13 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 16 Aug 2026 23:52:13 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:08 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:21:59 +0530 Subject: [PATCH v5 02/10] media: microchip-isc: take a reference on the parsed endpoints Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-2-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 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_remo= te_subdev") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- drivers/media/platform/microchip/microchip-isc-base.c | 6 ++++++ .../media/platform/microchip/microchip-sama5d2-isc.c | 17 ++++++++++++-= ---- .../media/platform/microchip/microchip-sama7g5-isc.c | 17 ++++++++++++-= ---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/driver= s/media/platform/microchip/microchip-isc-base.c index eebbcb28a7ee..ca4f3b5f58aa 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -1853,6 +1853,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); } =20 INIT_LIST_HEAD(&isc->subdev_entities); diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/dri= vers/media/platform/microchip/microchip-sama5d2-isc.c index 25d241b4c66a..18e1ec0b94fa 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -357,28 +357,30 @@ static int isc_parse_dt(struct device *dev, struct is= c_device *isc) struct device_node *epn; struct isc_subdev_entity *subdev_entity; unsigned int flags; + int ret; =20 INIT_LIST_HEAD(&isc->subdev_entities); =20 for_each_endpoint_of_node(np, epn) { struct v4l2_fwnode_endpoint v4l2_epn =3D { .bus_type =3D 0 }; - int ret; =20 ret =3D 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; + of_node_put(epn); + ret =3D -EINVAL; + goto err_cleanup; } =20 subdev_entity =3D devm_kzalloc(dev, sizeof(*subdev_entity), GFP_KERNEL); if (!subdev_entity) { of_node_put(epn); - return -ENOMEM; + ret =3D -ENOMEM; + goto err_cleanup; } - subdev_entity->epn =3D epn; + subdev_entity->epn =3D of_node_get(epn); =20 flags =3D v4l2_epn.bus.parallel.flags; =20 @@ -399,6 +401,11 @@ static int isc_parse_dt(struct device *dev, struct isc= _device *isc) } =20 return 0; + +err_cleanup: + list_for_each_entry(subdev_entity, &isc->subdev_entities, list) + of_node_put(subdev_entity->epn); + return ret; } =20 static int microchip_isc_probe(struct platform_device *pdev) diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/dri= vers/media/platform/microchip/microchip-sama7g5-isc.c index 998146adabd8..d0b91a74bb1a 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -341,6 +341,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; =20 INIT_LIST_HEAD(&isc->subdev_entities); =20 @@ -348,23 +349,24 @@ static int xisc_parse_dt(struct device *dev, struct i= sc_device *isc) =20 for_each_endpoint_of_node(np, epn) { struct v4l2_fwnode_endpoint v4l2_epn =3D { .bus_type =3D 0 }; - int ret; =20 ret =3D 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; + of_node_put(epn); + ret =3D -EINVAL; + goto err_cleanup; } =20 subdev_entity =3D devm_kzalloc(dev, sizeof(*subdev_entity), GFP_KERNEL); if (!subdev_entity) { of_node_put(epn); - return -ENOMEM; + ret =3D -ENOMEM; + goto err_cleanup; } - subdev_entity->epn =3D epn; + subdev_entity->epn =3D of_node_get(epn); =20 flags =3D v4l2_epn.bus.parallel.flags; =20 @@ -388,6 +390,11 @@ static int xisc_parse_dt(struct device *dev, struct is= c_device *isc) } =20 return 0; + +err_cleanup: + list_for_each_entry(subdev_entity, &isc->subdev_entities, list) + of_node_put(subdev_entity->epn); + return ret; } =20 static int microchip_xisc_probe(struct platform_device *pdev) --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26C7B3B3C1B; Mon, 17 Aug 2026 06:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949543; cv=none; b=rACO3ItPA18aL9fP38Zr341jbt3NFJKDtBfbq9gY885uoKIzVMMenPCfB9l9kNjsJEtPlPPnIyebSQL6hbe5BVxNHZN77pr4lH8D2ibP2NjbVzNYV+d5on21Mh8HRqxhBddjQTj7LhU0Vr45/dNUSaSoVewMagjJoTTE9cJqrvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949543; c=relaxed/simple; bh=JRU2XAxRSOjhBWgRSicm4i31gBEucOZSJGhB6Z1kwDs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=F0FQF99Dzrj7vkk1rKrkGrDDKzDi5TQXfz5EtvONp3fXujZLAjigmJ/ckYLL7rIIKAPVVxeGDRaXQR6L2VcKPrDH3bAWA42/khumUbawChEK4/R1PMoeZ03pkgzV67CfsPrBm3EUOjiW9xcYeTKh4HCPRBSV7RruNa//1VbT/PM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=sdERXfIi; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sdERXfIi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949542; x=1818485542; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=JRU2XAxRSOjhBWgRSicm4i31gBEucOZSJGhB6Z1kwDs=; b=sdERXfIiW5qY1xyxAweX8587kG5TZmLKEh3IK8eqBLD+gq3IBx8Tbp7a ihy9e+PdN4T4RxEIJI+JX3wtn7PXVWbd5FGdDefiixoz4NtTayvZdwcf3 G0GGpPCC9W83tg0O7tdA9UdL8KYReGNVDtfqvQF2FtaP2pGqOI0DaFxwE 8kHfBXCbFLX/VN41/U29dTfi9dNtFE7foP/C8V8pBQIBnpZ6LiVTnbWrR Ie97t6xoX+0KvuBfbVep2l+GJd7OWxKs7PGkNH5IGNWKTtGnlurIU+vmF davpxX32JGfiXy3siOfDha6ZsvCbIG7moHBFAZ8lFXcP2LHh6E94JKxuo A==; X-CSE-ConnectionGUID: 3HJdlEjFQ0SDAbuD/recGA== X-CSE-MsgGUID: duOs5jr5RZqehxp5QlRZtg== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="61331926" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2026 23:52:18 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Sun, 16 Aug 2026 23:52:17 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:13 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:00 +0530 Subject: [PATCH v5 03/10] media: microchip-isc: synchronize the IRQ before disabling clocks on stop Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-3-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 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: 106267444f12 ("[media] atmel-isc: add the Image Sensor Controller co= de") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- 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/driver= s/media/platform/microchip/microchip-isc-base.c index ca4f3b5f58aa..debbc38717de 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); =20 + /* let a running IRQ handler finish before the clock is disabled */ + synchronize_irq(isc->irq); + pm_runtime_put_sync(isc->dev); =20 /* Disable stream on the sub device */ diff --git a/drivers/media/platform/microchip/microchip-isc.h b/drivers/med= ia/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; =20 struct device *dev; + int irq; struct v4l2_device v4l2_dev; struct video_device video_dev; =20 diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/dri= vers/media/platform/microchip/microchip-sama5d2-isc.c index 18e1ec0b94fa..5bd109e93a8f 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -448,6 +448,8 @@ static int microchip_isc_probe(struct platform_device *= pdev) if (irq < 0) return irq; =20 + isc->irq =3D irq; + ret =3D 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/dri= vers/media/platform/microchip/microchip-sama7g5-isc.c index d0b91a74bb1a..3ebcbc1bb5a5 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -437,6 +437,8 @@ static int microchip_xisc_probe(struct platform_device = *pdev) if (irq < 0) return irq; =20 + isc->irq =3D irq; + ret =3D devm_request_irq(dev, irq, microchip_isc_interrupt, 0, "microchip-sama7g5-xisc", isc); if (ret < 0) { --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 483A33B52E7; Mon, 17 Aug 2026 06:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949545; cv=none; b=H4plfJnLASV/bAtQygHI4dkKK8ecHXCYHrM/dRfA1irrW6Ogfq0CHpPa2Oh5y9x6BsO68j3CVqY9gTFi8moA/pRAaTkcPPyop1jeeOiX28uiZbzHwDCn+c59DIHPAStYnfRpOpbOpcWD+dKy2CqVMBpOqRfq8osqAu7hZjZ6QmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949545; c=relaxed/simple; bh=JohBrOmmIOOrYg1A5HKJxG3Nsrt+Nq3/6HF4sDX225Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PE94S6B6lY0dCxWu21PyFfCMoMlagL6XtiTGmf6fQVKVapKdCN4S+0fcO02fZjvzbKRf6a50AtFzEfDfOimNhiM/x7kwAT4dJo1t7Mrj+E+dKkW/bKefIodPVWWJAInOxP8MWi9SKxjjq3+j2qAsSDRcdqTuMkg0lH/n8myvkpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=a9HRd4tf; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="a9HRd4tf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949544; x=1818485544; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=JohBrOmmIOOrYg1A5HKJxG3Nsrt+Nq3/6HF4sDX225Y=; b=a9HRd4tf2vPaRqnz02nqIuXLhOJaEzOAcy2gxPWg04WKhOsVCVIUnoWM hNAE/eDzj++Ljmocb0dllGgZLIlw3bU+u8TTC/Zg53nYVQDmuOVGSLicP SlHJkmLRTTj0LZLBD4ldIIDLdbHkbWCIBYJFnKLMfwcP6g6KAL/SiD3ep ZmDxwGimAbLfKt5xXQcUabE67SpeQIX6pg/lErWdHNZmZ+c9CgV/ZLwUP azc3v47fYGNxB2vzYEZ+g3uKgR0KEwGSyv/C4aPBqhqxpLPLCDh3fxqsS S2nsy9qgl9IEnDNaH67dA1SERw6UGyZzZ3IBNTSj/YnbtRamYDlYkOJSd w==; X-CSE-ConnectionGUID: LkR59wbgRb6YnfiQFnJDvQ== X-CSE-MsgGUID: Qu9HLjNkSL2hzIlx9DZo7Q== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="293603459" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Aug 2026 23:52:24 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 16 Aug 2026 23:52:23 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:18 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:01 +0530 Subject: [PATCH v5 04/10] media: microchip-isc: disable histogram and flush AWB work on teardown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-4-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 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 the device is left unclocked. isc_configure() is the one enabling the histogram and then calling isc_update_profile(), so do the cleanup in its own failure path; isc_stop_streaming() does the same on teardown. synchronize_irq() must come before cancel_work_sync(), so an in-flight handler cannot re-queue awb_work after it is cancelled. Fixes: 93d4a26c3dab ("[media] atmel-isc: add the isc pipeline function") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- drivers/media/platform/microchip/microchip-isc-base.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/driver= s/media/platform/microchip/microchip-isc-base.c index debbc38717de..0f486dd5bd82 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -289,6 +289,7 @@ static int isc_configure(struct isc_device *isc) struct regmap *regmap =3D isc->regmap; u32 pfe_cfg0, dcfg, mask, pipeline; struct isc_subdev_entity *subdev =3D isc->current_subdev; + int ret; =20 pfe_cfg0 =3D isc->config.sd_format->pfe_cfg0_bps; pipeline =3D isc->config.bits_pipeline; @@ -321,7 +322,15 @@ static int isc_configure(struct isc_device *isc) isc_set_histogram(isc, false); =20 /* Update profile */ - return isc_update_profile(isc); + ret =3D isc_update_profile(isc); + if (ret) { + /* flush the histogram work before the clocks are gated */ + isc_set_histogram(isc, false); + synchronize_irq(isc->irq); + cancel_work_sync(&isc->awb_work); + } + + return ret; } =20 static int isc_prepare_streaming(struct vb2_queue *vq) @@ -425,9 +434,13 @@ static void isc_stop_streaming(struct vb2_queue *vq) /* Disable DMA interrupt */ regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE); =20 + isc_set_histogram(isc, false); + /* let a running IRQ handler finish before the clock is disabled */ synchronize_irq(isc->irq); =20 + cancel_work_sync(&isc->awb_work); + pm_runtime_put_sync(isc->dev); =20 /* Disable stream on the sub device */ --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDBB63B42E4; Mon, 17 Aug 2026 06:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949550; cv=none; b=BHd7T436XRx+Eo9U1TozA43gFS/T0m0seE29eCIbxzcUJDMjsHPWdJkes9eOMY/S6NG8h6w5FWOIMyLfPEIVzpxLX4/xKX3GsxtHB6IzTje4ghf7jWx0EraDgghRN+FbuRQ/bfA87ziyUsF7Y1SnQHZlz0KkC/7u0Fmr/ax6WDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949550; c=relaxed/simple; bh=xPOJ35HOfzyopP4m6pfdsZoc8SwK0XCdF18/M26yKm4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=RPDoYG07rWmYw6KtsPRSWXsVW24ujWnt+VSgqzgiTx2TT1Qj7N1doPdG2UxVm8vX2v4U1cjcFI2/kL5xxmeMo8NvR0siI/qmpj34X9noD245gkmKG/enRru264vkb730W90ycldh+AzR8op98NMLcqh+oTDw+baG67wslSrUJsA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=lPiP59ls; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="lPiP59ls" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949549; x=1818485549; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=xPOJ35HOfzyopP4m6pfdsZoc8SwK0XCdF18/M26yKm4=; b=lPiP59lsp97F1hEiBxeSJi1Zr4c+8qivJPG+ab08Ki8xO1EOvmhn61q2 cwyRlTqyGyIVbnLM6259WodjqNeCMpY9vIl1F01RZJEiIfPJkh8JAuXCk bhkg//8m9zAG82YdT6nzKPSGgRNq778+Pww3ybv17jHund76wJF63TeFm Wq/NOEQOHsgygvzqpv9EKCF3IdjoIpcgYRFcNwmuM6MsEkohJsE541XW/ CoaDe5AwT8s2Kd4g3aopYSK5Bbhl5M4yEFkaIGWx2N0JBiEZ0Jq+ojNBj a1dMhNPM9vj4KbvuzCQw4bdJV+nAn6ftYhgyltvuplfsKyKQxFIYgRfQf w==; X-CSE-ConnectionGUID: 37ADSmV4QoSKSlZDKhr2QA== X-CSE-MsgGUID: LMN6aFpCSQWvWLv8JwgSlQ== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="62229705" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2026 23:52:29 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Sun, 16 Aug 2026 23:52:27 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:23 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:02 +0530 Subject: [PATCH v5 05/10] media: microchip-isc: do not touch WB registers when not streaming Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-5-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 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: 4e52889f48fe ("media: atmel: atmel-isc-base: expose white balance as= v4l2 controls") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev Signed-off-by: Balakrishnan Sambath --- .../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/driver= s/media/platform/microchip/microchip-isc-base.c index 0f486dd5bd82..cf4611443fd1 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -1511,20 +1511,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] =3D isc->gb_off_ctrl->val; =20 - 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); } --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B587F3B6C1D; Mon, 17 Aug 2026 06:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949554; cv=none; b=K4Uzr89Jw52dgovafR2NkVDgi6jvjo6Q+I1uEXU9cNWJPKywi0nZeanqcP0jwcVlWUPM5hDvdCiclMT5mFUV30B83tqG+8BUf64ekZft1QdvDD4t/ZsXezhCNOjLgqFJiKfISR3auvo8tvUqIKqAQxrgL8alTXH8vO+jhN5pcjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949554; c=relaxed/simple; bh=JCq3tzaKGRrDSrsFc9y3xJnyy7TMU+3MyA2mz5Iso7M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=IvXke+CkucU2f1xvcsWlz1KvDFZM7JCXIt2IGYofhn5RHmzjloFIIP+dWk1Blg7V3rthbixSK7FjbPJ45lLmWqxFmXxit/sXdjiEPjjSv1dH3/GzpRUVl3v0UeK/eJ3BkQIqnCqvB9QPLltolA4QbTxRT1Pz0j+y2Tg9E1cqOWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=SNTSwBKc; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="SNTSwBKc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949552; x=1818485552; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=JCq3tzaKGRrDSrsFc9y3xJnyy7TMU+3MyA2mz5Iso7M=; b=SNTSwBKcCygrcCrv6rTAo+8EH9368CgPNA1sWrJ/EGb58OApAgrIVVdN 8ler0zYwBi8xfdAtU1Z8JdEMSrHY+Grtt7n5E+yxcO1Tl/CaQGXkorkOo m/hWuammXe+UXvcWIWnULco16zPDwsMRSB38gnMg7pHFkQZFNwoz02pQs atJuwXRUrNvOQhP1OQ/yvykI7Fnts1x84zk3ib6bROe9MASxDYUQWWNGB nfhj1zqclcZPTYwJIy9YMvFbP+k14ukWw07OvwB4xdiio35nzlLX8YCwT 4h8XfVUJyUgo1Uw7tkpzDofxSwjmMDyouYwqdo6pYaU9tWd4Gk3NsKUAZ w==; X-CSE-ConnectionGUID: 4khulBbQTlm0efbnqh77Cw== X-CSE-MsgGUID: FU0We6zZRaSM7dKUTMUpFw== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="229357863" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2026 23:52:31 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Sun, 16 Aug 2026 23:52:31 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:28 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:03 +0530 Subject: [PATCH v5 06/10] media: microchip-isc: store the unshifted PFE_CFG0 BPS value Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-6-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath X-Mailer: b4 0.14.3 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 Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- 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/driver= s/media/platform/microchip/microchip-isc-base.c index cf4611443fd1..fe5a1fb88b21 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 * */ +#include #include #include #include @@ -291,7 +292,8 @@ static int isc_configure(struct isc_device *isc) struct isc_subdev_entity *subdev =3D isc->current_subdev; int ret; =20 - pfe_cfg0 =3D isc->config.sd_format->pfe_cfg0_bps; + pfe_cfg0 =3D FIELD_PREP(ISC_PFE_CFG0_BPS_MASK, + isc->config.sd_format->pfe_cfg0_bps); pipeline =3D isc->config.bits_pipeline; =20 dcfg =3D isc->config.dcfg_imode | isc->dcfg; diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/driver= s/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) =20 -#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) =20 #define ISC_PFE_CFG0_COLEN BIT(12) diff --git a/drivers/media/platform/microchip/microchip-isc.h b/drivers/med= ia/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_EIGH= T), + written into PFE_CFG0 with FIELD_PREP(ISC_PFE_CFG0_BPS_MASK) + at configure time. * @raw: If the format is raw bayer. */ =20 --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07DDA3B6C1D; Mon, 17 Aug 2026 06:52:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949558; cv=none; b=RpJgpuZfKL8hRLtI+iboezqHCYXVwN4+pJld6jrxNBE/hN8S0AyMl0nZsxiR+s1wmVvWKrrmJdus79veHn/zFERmKVkE9ceLJbg1BnTyP1zwKk8Y4ZfvrbxX9Hes+I06we58sI2lASlboX4FHQCtm7rsRzUn7KO0Dyv7mjuxdlo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949558; c=relaxed/simple; bh=DokWnrK2yqWi9cQiBgNvGnMVLvU9Yfy8CL5z2COi+MI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ZSFrLfOtOpUYlbWOi+ajB1awz7uZSnt2JTp5ZBxSklGHdy+PaOEuIPD3wX55wIUHJnQEsO5VNbpASVIgMBijTbV8HGkBJeflz+lqpGbtW1T/sTMWDCUQGMTpdkk1MDsy6KGD4J52l1tlQbWVNOAwIGrhG+9q/1eyJMlBiB6Ozh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=opC1nmr6; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="opC1nmr6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949556; x=1818485556; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=DokWnrK2yqWi9cQiBgNvGnMVLvU9Yfy8CL5z2COi+MI=; b=opC1nmr6k+rTlknxSu5vsDhi0uBOuow2kpvMPwIcnneYLioS/JtO+n0K qt4yRBVSVdlUotSuzkavKe9fqR5QWl5FszNfjHM+3rEW3NJDhKFRqlsn7 Bn7MQrzYvjxzgIcvcoJytQvbf7OOAqUuKwjPedSpVlXpyiHpXN1xCIqm4 SbVy+EuHEqgI4Co2cQh/S7DutDmrEBbW9m522KEoHv4NtrOTf0yT0VEh+ qkV7SvrqeHMHoXph9MtWQ2Izmb6a6rmR/eZAGXkSjAchG8vhYe+BeGWBl rRUAKkvljZ6Crhm1V/3FmcWhWT0lKn0Kor91qdEpt85AdHvSPGMkW/AHL w==; X-CSE-ConnectionGUID: NGlbiYAORm2Q8Dm/bqPzjQ== X-CSE-MsgGUID: jiBO0J19Sda9a3jHVz4eKg== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="61331932" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Aug 2026 23:52:36 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 16 Aug 2026 23:52:35 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:32 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:04 +0530 Subject: [PATCH v5 07/10] media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-7-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath X-Mailer: b4 0.14.3 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. Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- 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/driver= s/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) =20 #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) =20 #define ISC_PFE_CFG0_COLEN BIT(12) diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/dri= vers/media/platform/microchip/microchip-sama5d2-isc.c index 5bd109e93a8f..57a5aae3cabf 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -147,49 +147,49 @@ static struct isc_format sama5d2_formats_list[] =3D { { .fourcc =3D V4L2_PIX_FMT_SBGGR10, .mbus_code =3D MEDIA_BUS_FMT_SBGGR10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_RGRG, }, { .fourcc =3D V4L2_PIX_FMT_SGBRG10, .mbus_code =3D MEDIA_BUS_FMT_SGBRG10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_GBGB, }, { .fourcc =3D V4L2_PIX_FMT_SGRBG10, .mbus_code =3D MEDIA_BUS_FMT_SGRBG10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_GRGR, }, { .fourcc =3D V4L2_PIX_FMT_SRGGB10, .mbus_code =3D MEDIA_BUS_FMT_SRGGB10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_RGRG, }, { .fourcc =3D V4L2_PIX_FMT_SBGGR12, .mbus_code =3D MEDIA_BUS_FMT_SBGGR12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_BGBG, }, { .fourcc =3D V4L2_PIX_FMT_SGBRG12, .mbus_code =3D MEDIA_BUS_FMT_SGBRG12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_GBGB, }, { .fourcc =3D V4L2_PIX_FMT_SGRBG12, .mbus_code =3D MEDIA_BUS_FMT_SGRBG12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_GRGR, }, { .fourcc =3D V4L2_PIX_FMT_SRGGB12, .mbus_code =3D MEDIA_BUS_FMT_SRGGB12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_RGRG, }, { @@ -210,7 +210,7 @@ static struct isc_format sama5d2_formats_list[] =3D { { .fourcc =3D V4L2_PIX_FMT_Y10, .mbus_code =3D MEDIA_BUS_FMT_Y10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, }, =20 }; diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/dri= vers/media/platform/microchip/microchip-sama7g5-isc.c index 3ebcbc1bb5a5..0a4dbef72d12 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -156,49 +156,49 @@ static struct isc_format sama7g5_formats_list[] =3D { { .fourcc =3D V4L2_PIX_FMT_SBGGR10, .mbus_code =3D MEDIA_BUS_FMT_SBGGR10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_RGRG, }, { .fourcc =3D V4L2_PIX_FMT_SGBRG10, .mbus_code =3D MEDIA_BUS_FMT_SGBRG10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_GBGB, }, { .fourcc =3D V4L2_PIX_FMT_SGRBG10, .mbus_code =3D MEDIA_BUS_FMT_SGRBG10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_GRGR, }, { .fourcc =3D V4L2_PIX_FMT_SRGGB10, .mbus_code =3D MEDIA_BUS_FMT_SRGGB10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, .cfa_baycfg =3D ISC_BAY_CFG_RGRG, }, { .fourcc =3D V4L2_PIX_FMT_SBGGR12, .mbus_code =3D MEDIA_BUS_FMT_SBGGR12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_BGBG, }, { .fourcc =3D V4L2_PIX_FMT_SGBRG12, .mbus_code =3D MEDIA_BUS_FMT_SGBRG12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_GBGB, }, { .fourcc =3D V4L2_PIX_FMT_SGRBG12, .mbus_code =3D MEDIA_BUS_FMT_SGRBG12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_GRGR, }, { .fourcc =3D V4L2_PIX_FMT_SRGGB12, .mbus_code =3D MEDIA_BUS_FMT_SRGGB12_1X12, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TWELVE, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TWELVE, .cfa_baycfg =3D ISC_BAY_CFG_RGRG, }, { @@ -224,7 +224,7 @@ static struct isc_format sama7g5_formats_list[] =3D { { .fourcc =3D V4L2_PIX_FMT_Y10, .mbus_code =3D MEDIA_BUS_FMT_Y10_1X10, - .pfe_cfg0_bps =3D ISC_PFG_CFG0_BPS_TEN, + .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, }, }; =20 --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C01D43B7753; Mon, 17 Aug 2026 06:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949563; cv=none; b=UsMTN7joStdsj0w4H82vjD1XoBOfzuC3hTnUtecmqVmvjivNRzy0uUMYoMjHJjQT/lLc1FTMcyAHmqlSN9rG1DGGSTSnLNBY1bADe1yRVIJnNIG2BGUuHzxyBtd/8rA8lckYc7FCMHHU0GvmsindYK3mVkuUPcZGuuBDW8cGdv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949563; c=relaxed/simple; bh=E/h1hz0wiIQIh9FrugF+dw7I292LKsqzlweQ9JZsHas=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=BU9Zb91UXKr6v4gpfk8/TeerY2PmuTpahuNfkc5PMPGRq2husXJXbddpGK1v9uZXA/ZEMP4+5PY5u93dl1StOykMKJnz+d4Su+fus0AJyLXIjuK3wBMcq4Q1HDAhBapSn+Sz5jhCOX2vc8uwZb1hJ9QYTKOOfIpk+Nomc6WSzys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=R7TPo0Wg; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="R7TPo0Wg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949561; x=1818485561; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=E/h1hz0wiIQIh9FrugF+dw7I292LKsqzlweQ9JZsHas=; b=R7TPo0Wg8ALM6EAhEPweWsvueVsCUjjEQyyJ+Wcz5x/27YsIg2zjh9gD WIX34ep78xOlNv9+oui10wiftfUqh64G77YTGFoY09cYly7qzWRRXlJJm HDDzdBr6ZxExuRBX6BW3I3iBpXtCKhqtqrQcQe0DbtYOtWfkfKS6xyHeT /Ycdx9wgW2MX/z2Kf23r039DkO+VXSvw5IkooLGszozd3Jd/sUsiLN+1f 07+P8ig8hlaTphDBvswTnwick4Dhh4kDzth0SO5eLCUmJQWpmFbtKeJ6c 0r/vEf3YwJJ8LTVjrwVf4t6AClL+1K4gQB8usHPXBtt3zLkSK+vawVc/+ Q==; X-CSE-ConnectionGUID: 473NZGg9TB2fyUjPFTh3XQ== X-CSE-MsgGUID: jfBp422dTL+mNVZvuxzhyw== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="71930905" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Aug 2026 23:52:41 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 16 Aug 2026 23:52:40 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:36 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:05 +0530 Subject: [PATCH v5 08/10] media: microchip-isc: fix PM runtime leak in AWB work handler Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-8-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 Early return when streaming stops skips pm_runtime_put_sync(), leaking the reference and preventing runtime suspend. Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb w= orkq from streaming") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- 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/driver= s/media/platform/microchip/microchip-isc-base.c index fe5a1fb88b21..e5ecf6ffd24a 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -1434,7 +1434,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; } =20 isc_update_profile(isc); @@ -1445,6 +1445,7 @@ static void isc_awb_work(struct work_struct *w) if (ctrls->awb) regmap_write(regmap, ISC_CTRLEN, ISC_CTRL_HISREQ); =20 +out_pm_put: pm_runtime_put_sync(isc->dev); } =20 --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77A1B3B6347; Mon, 17 Aug 2026 06:52:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949567; cv=none; b=B68h3EKW/YNvL8Apbr1jD82k9OJd8noJyZ5p1Me51yC05JP3wrAMvUn0SC4JaGEEMDAfhA71gssmpKOmFifFZyS6zrkYRu1yle3rUDjz3bI/Ygeto1QDa2x4oa4JsYtd4rciqCXqYc4Or2Wo5g0NVFmBALsoyUWmSdRsvbf1J1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949567; c=relaxed/simple; bh=vcxK4HV2Uq/bpM32zTqM7x2ybn6/dmL9vXo7IqFlAMc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=FtPVXRj9/s2TxLLxn0HKn+Fd6DMdZHi7H87912La4D3sMRVdLNiACKX67xrJ0Dha8PtHwpmyYD4uMDN2ZMdZpqT6FBi+NQeVfaJKqplqatqmzdIMS3ufBJZuJXcszaTejVWnktrGXUhR/GzlTozLLmUUPr1B7Mjd/1lv+GW9aK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=r2hCfkVa; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="r2hCfkVa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949566; x=1818485566; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=vcxK4HV2Uq/bpM32zTqM7x2ybn6/dmL9vXo7IqFlAMc=; b=r2hCfkVa88iW0nhW5giMEL92da83qhSumEFQO3RVoL8D1F/2bXaxjOZq VegBn6kGRbxK5uO8NYeNW7r9W6mwMAWDArzARml1QGm5cs0PenB800SSl YkY7G7oIA5sPsT/0R9ZmuacJH+VhEFC0kP1gPNCupA0VXsIaa64HrTfer qAR5VFrEgdQ20B6ti+/FUtFwkCtO/YC64GMv9/FFtOjLsyofH4wU136Ps s62ekXZxY7MLtFtbMSGfV0ukt8l5BY9JOBIAlz8MTEhfKhvAxdRUEVLpc C+F3vInkfYEieJtXjAiVU3tuKNwCXIe8vU0kB+oPzv+V+TaGFDvrtakQ5 g==; X-CSE-ConnectionGUID: yPROdCyATSa/kW0lnYCcsw== X-CSE-MsgGUID: NJTQGtrKTlqbtB9iSREq5Q== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="61331940" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Aug 2026 23:52:45 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Sun, 16 Aug 2026 23:52:45 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:41 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:06 +0530 Subject: [PATCH v5 09/10] media: microchip-isc: fix SBGGR10 Bayer pattern Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-9-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 SBGGR10 was mapped to ISC_BAY_CFG_RGRG instead of ISC_BAY_CFG_BGBG, causing red/blue channel swap. Fixes: 1e8f401474d6 ("media: atmel: atmel-isc: reworked driver and formats") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev --- 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/dri= vers/media/platform/microchip/microchip-sama5d2-isc.c index 57a5aae3cabf..5e41eee45dbd 100644 --- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c +++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c @@ -148,7 +148,7 @@ static struct isc_format sama5d2_formats_list[] =3D { .fourcc =3D V4L2_PIX_FMT_SBGGR10, .mbus_code =3D MEDIA_BUS_FMT_SBGGR10_1X10, .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, - .cfa_baycfg =3D ISC_BAY_CFG_RGRG, + .cfa_baycfg =3D ISC_BAY_CFG_BGBG, }, { .fourcc =3D V4L2_PIX_FMT_SGBRG10, diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/dri= vers/media/platform/microchip/microchip-sama7g5-isc.c index 0a4dbef72d12..70a69a51eeaf 100644 --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c @@ -157,7 +157,7 @@ static struct isc_format sama7g5_formats_list[] =3D { .fourcc =3D V4L2_PIX_FMT_SBGGR10, .mbus_code =3D MEDIA_BUS_FMT_SBGGR10_1X10, .pfe_cfg0_bps =3D ISC_PFE_CFG0_BPS_TEN, - .cfa_baycfg =3D ISC_BAY_CFG_RGRG, + .cfa_baycfg =3D ISC_BAY_CFG_BGBG, }, { .fourcc =3D V4L2_PIX_FMT_SGBRG10, --=20 2.34.1 From nobody Mon Sep 28 21:54:44 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BC293B585F; Mon, 17 Aug 2026 06:52:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949573; cv=none; b=kN/CztSl3E0A9hByzWUAbHwpEbFlzqw02cAozFXN7CJpKSIhsVDqEUX24y3BkVFt4rjNY6wWLkL5ENQJ262tjHNNk5rGdYQhLuSWHEzrSA2GoOxd8jzOlIB+K1KWArlk4ojRw5+C0ZQBMIpwRFOw62sRG2+jfAyKrtWYuS4d4rI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786949573; c=relaxed/simple; bh=Wn5lGPS+kuaGxuYHLrt9nEjywar+suE6Y5h5dD4AxS0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tZ44/4bmS3N7HK1sDWZNoXl/a2iHsCKbkUlVjjxFuzIVzaHq6226PQGixW6cJbHUNzYxp+VkmzD1geP43/EvjGxTlluwi9Frvv6IR4ZcuZLOyeI8me9tW8mdpc2iHqrr/SHcAzFXi3y5Hkesqj/IoSu0swNlVdclCIHRQffvNh8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=oRNh7TBk; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="oRNh7TBk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786949571; x=1818485571; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=Wn5lGPS+kuaGxuYHLrt9nEjywar+suE6Y5h5dD4AxS0=; b=oRNh7TBkSGTgAxyKRI2mLyZ+SW88YTDCIEP4S97Ieq9whukIjAIsL2d8 Yq2fxqTQPhMJi7NtCO6lA+pIZbVI59pVLQFNi6kf52rHtgZdHG5TWgtbn 1OiHi2RdljBzxkxo96rQLf4svn/r5waofXfyqQJNSQoFw43Hi8GRhhi+E 0viDGdoHSTNGjJvw7ZCb6Qv+gVeaRmOFlOsB8+NATAmvWW3bG6iJsv9Lv +Bde9G2QTqwn+T8y8jMclxUJwtoGFr7GMplNUj0IRuJtGBPPZnPnfPHNa JJaEYU0YsF/eKtPF8KCXmUOO9cruPvgVWqylm713488/pOZBuyECY972N A==; X-CSE-ConnectionGUID: qszNy0ISQQukmIHHhUM3+w== X-CSE-MsgGUID: UgV4bmmMTyucvW5WMWslUA== X-IronPort-AV: E=Sophos;i="6.25,228,1779174000"; d="scan'208";a="71930910" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2026 23:52:50 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex2.mchp-main.com (10.10.87.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Sun, 16 Aug 2026 23:52:50 -0700 Received: from [127.0.0.1] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Sun, 16 Aug 2026 23:52:45 -0700 From: Balakrishnan Sambath Date: Mon, 17 Aug 2026 12:22:07 +0530 Subject: [PATCH v5 10/10] media: microchip-isc: fix WB offset and gain register field masking Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260817-balki-isc-prefix-fixes-v1-v5-10-2514df336c5e@microchip.com> References: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> In-Reply-To: <20260817-balki-isc-prefix-fixes-v1-v5-0-2514df336c5e@microchip.com> To: Eugen Hristev , Mauro Carvalho Chehab CC: Hans Verkuil , Sakari Ailus , , , Balakrishnan Sambath , X-Mailer: b4 0.14.3 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: 73c1a577b839 ("media: atmel: atmel-isc: reworked white balance featu= re") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev Signed-off-by: Balakrishnan Sambath --- drivers/media/platform/microchip/microchip-isc-base.c | 16 ++++++++-------- drivers/media/platform/microchip/microchip-isc-regs.h | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/driver= s/media/platform/microchip/microchip-isc-base.c index e5ecf6ffd24a..963d5fd53b58 100644 --- a/drivers/media/platform/microchip/microchip-isc-base.c +++ b/drivers/media/platform/microchip/microchip-isc-base.c @@ -63,17 +63,17 @@ static inline void isc_update_awb_ctrls(struct isc_devi= ce *isc) /* In here we set our actual hw pipeline config */ =20 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])); } =20 static inline void isc_reset_awb_ctrls(struct isc_device *isc) diff --git a/drivers/media/platform/microchip/microchip-isc-regs.h b/driver= s/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 =20 +/* 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 =20 --=20 2.34.1