mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: stm32: csi: add missing SBGGR 10/12/14 bit formats
@ 2026-12-03  2:24 Weidong Wang via B4 Relay
  2026-12-03 19:52 ` Alain Volmat
  0 siblings, 1 reply; 2+ messages in thread
From: Weidong Wang via B4 Relay @ 2026-12-03  2:24 UTC (permalink / raw)
  To: Alain Volmat, Mauro Carvalho Chehab
  Cc: Hans Verkuil, Maxime Coquelin, Alexandre Torgue, linux-media,
	linux-stm32, linux-arm-kernel, linux-kernel, Weidong Wang

From: Weidong Wang <weidongw@illinois.edu>

The stm32_csi_formats[] table lists SRGGB10_1X10, SRGGB12_1X12 and
SRGGB14_1X14 twice each, as both the first and the last entry of the
10, 12 and 14 bit Bayer groups, while the SBGGR variants are absent.
The 8 bit group correctly starts with SBGGR8_1X8.

As a result the SBGGR 10, 12 and 14 bit media bus codes are not
enumerated, and stm32_csi_set_pad_format() replaces them with the
default format since they are not found in the table, so a sensor
producing such formats cannot be used with the CSI.

Replace the first SRGGB entry of each group with the SBGGR one.

Found by a static analysis tool.

The fix and this changelog were drafted with AI assistance (Claude Code,
with a second review by OpenAI Codex), then reviewed by the submitter.

Fixes: dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver")
Signed-off-by: Weidong Wang <weidongw@illinois.edu>
---
Testing:
- Compile-tested on x86_64 (allmodconfig, W=1):
  drivers/media/platform/st/stm32/stm32-csi.o; no new warnings.
- checkpatch.pl --strict: no errors or warnings.
---
 drivers/media/platform/st/stm32/stm32-csi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c
index e71142634a17..e7e8b9f22a33 100644
--- a/drivers/media/platform/st/stm32/stm32-csi.c
+++ b/drivers/media/platform/st/stm32/stm32-csi.c
@@ -228,17 +228,17 @@ static const struct stm32_csi_fmts stm32_csi_formats[] = {
 	FMT_MBUS_DT_DTFMT_BPP(SGRBG8_1X8, RAW8, BPP8, 8),
 	FMT_MBUS_DT_DTFMT_BPP(SRGGB8_1X8, RAW8, BPP8, 8),
 	/* 10 bit */
-	FMT_MBUS_DT_DTFMT_BPP(SRGGB10_1X10, RAW10, BPP10, 10),
+	FMT_MBUS_DT_DTFMT_BPP(SBGGR10_1X10, RAW10, BPP10, 10),
 	FMT_MBUS_DT_DTFMT_BPP(SGBRG10_1X10, RAW10, BPP10, 10),
 	FMT_MBUS_DT_DTFMT_BPP(SGRBG10_1X10, RAW10, BPP10, 10),
 	FMT_MBUS_DT_DTFMT_BPP(SRGGB10_1X10, RAW10, BPP10, 10),
 	/* 12 bit */
-	FMT_MBUS_DT_DTFMT_BPP(SRGGB12_1X12, RAW12, BPP12, 12),
+	FMT_MBUS_DT_DTFMT_BPP(SBGGR12_1X12, RAW12, BPP12, 12),
 	FMT_MBUS_DT_DTFMT_BPP(SGBRG12_1X12, RAW12, BPP12, 12),
 	FMT_MBUS_DT_DTFMT_BPP(SGRBG12_1X12, RAW12, BPP12, 12),
 	FMT_MBUS_DT_DTFMT_BPP(SRGGB12_1X12, RAW12, BPP12, 12),
 	/* 14 bit */
-	FMT_MBUS_DT_DTFMT_BPP(SRGGB14_1X14, RAW14, BPP14, 14),
+	FMT_MBUS_DT_DTFMT_BPP(SBGGR14_1X14, RAW14, BPP14, 14),
 	FMT_MBUS_DT_DTFMT_BPP(SGBRG14_1X14, RAW14, BPP14, 14),
 	FMT_MBUS_DT_DTFMT_BPP(SGRBG14_1X14, RAW14, BPP14, 14),
 	FMT_MBUS_DT_DTFMT_BPP(SRGGB14_1X14, RAW14, BPP14, 14),

---
base-commit: 37760be5a04b538bbd25099000e37d3208c27efe
change-id: 20261202-kbug-l1928-03ab5c3db9a5

Best regards,
--  
Weidong Wang <weidongw@illinois.edu>



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

* Re: [PATCH] media: stm32: csi: add missing SBGGR 10/12/14 bit formats
  2026-12-03  2:24 [PATCH] media: stm32: csi: add missing SBGGR 10/12/14 bit formats Weidong Wang via B4 Relay
@ 2026-12-03 19:52 ` Alain Volmat
  0 siblings, 0 replies; 2+ messages in thread
From: Alain Volmat @ 2026-12-03 19:52 UTC (permalink / raw)
  To: weidongw
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Maxime Coquelin,
	Alexandre Torgue, linux-media, linux-stm32, linux-arm-kernel,
	linux-kernel

Hi,

thanks for this patch.

On Wed, Dec 02, 2026 at 08:24:05PM -0600, Weidong Wang via B4 Relay wrote:
> From: Weidong Wang <weidongw@illinois.edu>
> 
> The stm32_csi_formats[] table lists SRGGB10_1X10, SRGGB12_1X12 and
> SRGGB14_1X14 twice each, as both the first and the last entry of the
> 10, 12 and 14 bit Bayer groups, while the SBGGR variants are absent.
> The 8 bit group correctly starts with SBGGR8_1X8.
> 
> As a result the SBGGR 10, 12 and 14 bit media bus codes are not
> enumerated, and stm32_csi_set_pad_format() replaces them with the
> default format since they are not found in the table, so a sensor
> producing such formats cannot be used with the CSI.
> 
> Replace the first SRGGB entry of each group with the SBGGR one.
> 
> Found by a static analysis tool.
> 
> The fix and this changelog were drafted with AI assistance (Claude Code,
> with a second review by OpenAI Codex), then reviewed by the submitter.
> 
> Fixes: dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver")
> Signed-off-by: Weidong Wang <weidongw@illinois.edu>

Reviewed-by: Alain Volmat <alain.volmat@foss.st.com>

Regards,
Alain


> ---
> Testing:
> - Compile-tested on x86_64 (allmodconfig, W=1):
>   drivers/media/platform/st/stm32/stm32-csi.o; no new warnings.
> - checkpatch.pl --strict: no errors or warnings.
> ---
>  drivers/media/platform/st/stm32/stm32-csi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c
> index e71142634a17..e7e8b9f22a33 100644
> --- a/drivers/media/platform/st/stm32/stm32-csi.c
> +++ b/drivers/media/platform/st/stm32/stm32-csi.c
> @@ -228,17 +228,17 @@ static const struct stm32_csi_fmts stm32_csi_formats[] = {
>  	FMT_MBUS_DT_DTFMT_BPP(SGRBG8_1X8, RAW8, BPP8, 8),
>  	FMT_MBUS_DT_DTFMT_BPP(SRGGB8_1X8, RAW8, BPP8, 8),
>  	/* 10 bit */
> -	FMT_MBUS_DT_DTFMT_BPP(SRGGB10_1X10, RAW10, BPP10, 10),
> +	FMT_MBUS_DT_DTFMT_BPP(SBGGR10_1X10, RAW10, BPP10, 10),
>  	FMT_MBUS_DT_DTFMT_BPP(SGBRG10_1X10, RAW10, BPP10, 10),
>  	FMT_MBUS_DT_DTFMT_BPP(SGRBG10_1X10, RAW10, BPP10, 10),
>  	FMT_MBUS_DT_DTFMT_BPP(SRGGB10_1X10, RAW10, BPP10, 10),
>  	/* 12 bit */
> -	FMT_MBUS_DT_DTFMT_BPP(SRGGB12_1X12, RAW12, BPP12, 12),
> +	FMT_MBUS_DT_DTFMT_BPP(SBGGR12_1X12, RAW12, BPP12, 12),
>  	FMT_MBUS_DT_DTFMT_BPP(SGBRG12_1X12, RAW12, BPP12, 12),
>  	FMT_MBUS_DT_DTFMT_BPP(SGRBG12_1X12, RAW12, BPP12, 12),
>  	FMT_MBUS_DT_DTFMT_BPP(SRGGB12_1X12, RAW12, BPP12, 12),
>  	/* 14 bit */
> -	FMT_MBUS_DT_DTFMT_BPP(SRGGB14_1X14, RAW14, BPP14, 14),
> +	FMT_MBUS_DT_DTFMT_BPP(SBGGR14_1X14, RAW14, BPP14, 14),
>  	FMT_MBUS_DT_DTFMT_BPP(SGBRG14_1X14, RAW14, BPP14, 14),
>  	FMT_MBUS_DT_DTFMT_BPP(SGRBG14_1X14, RAW14, BPP14, 14),
>  	FMT_MBUS_DT_DTFMT_BPP(SRGGB14_1X14, RAW14, BPP14, 14),
> 
> ---
> base-commit: 37760be5a04b538bbd25099000e37d3208c27efe
> change-id: 20261202-kbug-l1928-03ab5c3db9a5
> 
> Best regards,
> --  
> Weidong Wang <weidongw@illinois.edu>
> 
> 

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

end of thread, other threads:[~2026-12-03 19:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03  2:24 [PATCH] media: stm32: csi: add missing SBGGR 10/12/14 bit formats Weidong Wang via B4 Relay
2026-12-03 19:52 ` Alain Volmat

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

all inboxes | Powered by JetHome®