Skip to contentSkip to conversation

staging: media: atomisp: csi2: Fix DPCM decompression for source pad format

PATCH Superseded Debjeet Banerjee 3 participants 20 messages Apr 20 – May 20

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: atomisp: csi2: Fix DPCM decompression for source pad format

The CSI2 source pad format was set by blindly copying the sink pad format, regardless of whether the sink pad is receiving a DPCM-compressed mbus code. This was marked with a FIXME comment.

When a sensor transmits DPCM-compressed data over MIPI CSI-2 (e.g. MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8), the Atom ISP hardware decompresses it before passing it to the ISP pipeline. Therefore the source pad must expose the uncompressed format (e.g. MEDIA_BUS_FMT_SGRBG10_1X10), not the compressed one.

atomisp_subdev_uncompressed_code() already implements this mapping via the compressed_codes[] table in atomisp_subdev.c, which pairs each DPCM mbus code with its uncompressed counterpart. For codes that are not DPCM-compressed, the function returns the code unchanged, so this change is a no-op for all non-DPCM formats.

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +11 -4
index 95b9113d75e9..484765b0d9e6 100644
@@ -107,10 +107,17 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-     /* FIXME: DPCM decompression */
-     *actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
-                 CSI2_PAD_SINK);
-    
+    /*
+     * The source pad must expose the uncompressed format even when the sink
+     * pad receives DPCM-compressed data. The hardware decompresses DPCM
+     * (e.g. SGRBG10_DPCM8_1X8 -> SGRBG10_1X10) between sink and source,
+     * so propagate the sink format but map the mbus code to its uncompressed
+     * equivalent. atomisp_subdev_uncompressed_code() returns the code
+     * unchanged for formats that are not DPCM-compressed.
+     */
+    *actual_ffmt = *__csi2_get_format(csi2, sd_state, which, CSI2_PAD_SINK);
+    actual_ffmt->code = atomisp_subdev_uncompressed_code(actual_ffmt->code);
+    *ffmt = *actual_ffmt;
      return 0;
   }
 
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/1 staging: media: atomisp: csi2: Fix DPCM decompression for source pad format

The CSI2 source pad format was set by blindly copying the sink pad format, regardless of whether the sink pad is receiving a DPCM-compressed mbus code. This was marked with a FIXME comment.

When a sensor transmits DPCM-compressed data over MIPI CSI-2 (e.g. MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8), the Atom ISP hardware decompresses it before passing it to the ISP pipeline. Therefore the source pad must expose the uncompressed format (e.g. MEDIA_BUS_FMT_SGRBG10_1X10), not the compressed one.

atomisp_subdev_uncompressed_code() already implements this mapping via the compressed_codes[] table in atomisp_subdev.c, which pairs each DPCM mbus code with its uncompressed counterpart. For codes that are not DPCM-compressed, the function returns the code unchanged, so this change is a no-op for all non-DPCM formats.

---
v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +11 -4
index 95b9113d75e9..e723304bec80 100644
@@ -107,10 +107,17 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/* FIXME: DPCM decompression */
-	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
-						  CSI2_PAD_SINK);
-
+	/*
+	 * The source pad must expose the uncompressed format even when the sink
+	 * pad receives DPCM-compressed data. The hardware decompresses DPCM
+	 * (e.g. SGRBG10_DPCM8_1X8 -> SGRBG10_1X10) between sink and source,
+	 * so propagate the sink format but map the mbus code to its uncompressed
+	 * equivalent. atomisp_subdev_uncompressed_code() returns the code
+	 * unchanged for formats that are not DPCM-compressed.
+	 */
+	*actual_ffmt = *__csi2_get_format(csi2, sd_state, which, CSI2_PAD_SINK);
+	actual_ffmt->code = atomisp_subdev_uncompressed_code(actual_ffmt->code);
+	*ffmt = *actual_ffmt;
 	return 0;
 }
 
Signature · 1 line
2.53.0
#2 lore raw
Quoted 11 lines · Debjeet Banerjee

The CSI2 source pad format was set by blindly copying the sink pad format, regardless of whether the sink pad is receiving a DPCM-compressed mbus code. This was marked with a FIXME comment.

When a sensor transmits DPCM-compressed data over MIPI CSI-2 (e.g. MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8), the Atom ISP hardware decompresses it before passing it to the ISP pipeline. Therefore the source pad must expose the uncompressed format (e.g. MEDIA_BUS_FMT_SGRBG10_1X10), not the compressed one.

Quoted 5 lines

atomisp_subdev_uncompressed_code() already implements this mapping via the compressed_codes[] table in atomisp_subdev.c, which pairs each DPCM mbus code with its uncompressed counterpart. For codes that are not DPCM-compressed, the function returns the code unchanged, so this change is a no-op for all non-DPCM formats.

No, please spend your time first on learning the process. When sending patches like this, do not rush with the new versions, keep at least 24h distance between them.

...

Also, drop the "staging:" prefix from the Subject.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 3 lines · Andy Shevchenko

No, please spend your time first on learning the process. When sending patches like this, do not rush with the new versions, keep at least 24h distance between them.

Thank you for the guidance. I will follow the 24h interval before sending the next version.

Quoted 1 line

Also, drop the "staging:" prefix from the Subject.

Understood, I will remove the "staging:" prefix in v3.

Regards,
Debjeet Banerjee

#4 lore raw

PATCH v3 1/1 media: atomisp: csi2: Fix DPCM decompression for source pad format

In reply to Andy Shevchenko

The CSI2 source pad format was set by blindly copying the sink pad format, regardless of whether the sink pad is receiving a DPCM-compressed mbus code. This was marked with a FIXME comment.

When a sensor transmits DPCM-compressed data over MIPI CSI-2 (e.g. MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8), the Atom ISP hardware decompresses it before passing it to the ISP pipeline. Therefore the source pad must expose the uncompressed format (e.g. MEDIA_BUS_FMT_SGRBG10_1X10), not the compressed one.

atomisp_subdev_uncompressed_code() already implements this mapping via the compressed_codes[] table in atomisp_subdev.c, which pairs each DPCM mbus code with its uncompressed counterpart. For codes that are not DPCM-compressed, the function returns the code unchanged, so this change is a no-op for all non-DPCM formats.

---
v3:
- Drop "staging:" prefix in subject (per Andy Shevchenko)

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +11 -4
index 95b9113d75e9..e723304bec80 100644
@@ -107,10 +107,17 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/* FIXME: DPCM decompression */
-	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
-						  CSI2_PAD_SINK);
-
+	/*
+	 * The source pad must expose the uncompressed format even when the sink
+	 * pad receives DPCM-compressed data. The hardware decompresses DPCM
+	 * (e.g. SGRBG10_DPCM8_1X8 -> SGRBG10_1X10) between sink and source,
+	 * so propagate the sink format but map the mbus code to its uncompressed
+	 * equivalent. atomisp_subdev_uncompressed_code() returns the code
+	 * unchanged for formats that are not DPCM-compressed.
+	 */
+	*actual_ffmt = *__csi2_get_format(csi2, sd_state, which, CSI2_PAD_SINK);
+	actual_ffmt->code = atomisp_subdev_uncompressed_code(actual_ffmt->code);
+	*ffmt = *actual_ffmt;
 	return 0;
 }
 
Signature · 1 line
2.53.0
reviewer
#5 lore raw

Re: [PATCH v3] media: atomisp: csi2: Fix DPCM decompression for source pad format

Hi Debjeet,

Quoted 38 lines · Debjeet Banerjee

The CSI2 source pad format was set by blindly copying the sink pad format, regardless of whether the sink pad is receiving a DPCM-compressed mbus code. This was marked with a FIXME comment.

When a sensor transmits DPCM-compressed data over MIPI CSI-2 (e.g. MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8), the Atom ISP hardware decompresses it before passing it to the ISP pipeline. Therefore the source pad must expose the uncompressed format (e.g. MEDIA_BUS_FMT_SGRBG10_1X10), not the compressed one.

atomisp_subdev_uncompressed_code() already implements this mapping via the compressed_codes[] table in atomisp_subdev.c, which pairs each DPCM mbus code with its uncompressed counterpart. For codes that are not DPCM-compressed, the function returns the code unchanged, so this change is a no-op for all non-DPCM formats.

---
v3:
- Drop "staging:" prefix in subject (per Andy Shevchenko)

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -1
index 95b9113d75e9..e723304bec80 100644
@@ -107,10 +107,17 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/* FIXME: DPCM decompression */

drivers/staging/media/atomisp/pci/atomisp_csi2.c int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, · line 116

Quoted 10 lines
drivers/staging/media/atomisp/pci/atomisp_csi2.c +7 -3
-	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
-						  CSI2_PAD_SINK);
-
+	/*
+	 * The source pad must expose the uncompressed format even when the sink
+	 * pad receives DPCM-compressed data. The hardware decompresses DPCM
+	 * (e.g. SGRBG10_DPCM8_1X8 -> SGRBG10_1X10) between sink and source,
+	 * so propagate the sink format but map the mbus code to its uncompressed
+	 * equivalent. atomisp_subdev_uncompressed_code() returns the code
+	 * unchanged for formats that are not DPCM-compressed.

It may well be but the rest of the driver doesn't appear to support DPCM uncompression. Rather than trying to pretend it does, I'd instead just remove any references to it.

Quoted 7 lines
drivers/staging/media/atomisp/pci/atomisp_csi2.c +4 -0
+	 */
+	*actual_ffmt = *__csi2_get_format(csi2, sd_state, which, CSI2_PAD_SINK);
+	actual_ffmt->code = atomisp_subdev_uncompressed_code(actual_ffmt->code);
+	*ffmt = *actual_ffmt;
 	return 0;
 }
 
Signature · 3 lines
Regards,

Sakari Ailus
#6 lore raw

Re: [PATCH v3] media: atomisp: csi2: Fix DPCM decompression for source pad format

Quoted 3 lines · Sakari Ailus

It may well be but the rest of the driver doesn't appear to support DPCM uncompression. Rather than trying to pretend it does, I'd instead just remove any references to it.

Thanks for the feedback Sakari.

So if I understand correctly, the right fix here is to remove all the DPCM-related dead code: compressed_codes[], atomisp_subdev_uncompressed_code(), atomisp_subdev_is_compressed(), and atomisp_find_in_fmt_conv_compressed() declaration

And in atomisp_csi2.c just keep the source pad copying the sink format as before, but drop the FIXME comment since we're explicitly acknowledging DPCM is not supported?

Please let me know if I'm on the right track before I send v4 of this patch.

Regards,
Debjeet

reviewer
#7 lore raw

Re: [PATCH v3] media: atomisp: csi2: Fix DPCM decompression for source pad format

Hi Dabjeet,

Quoted 12 lines · Debjeet Banerjee
Quoted 3 lines · Sakari Ailus

It may well be but the rest of the driver doesn't appear to support DPCM uncompression. Rather than trying to pretend it does, I'd instead just remove any references to it.

Thanks for the feedback Sakari.

So if I understand correctly, the right fix here is to remove all the DPCM-related dead code: compressed_codes[], atomisp_subdev_uncompressed_code(), atomisp_subdev_is_compressed(), and atomisp_find_in_fmt_conv_compressed() declaration

Quoted 4 lines

And in atomisp_csi2.c just keep the source pad copying the sink format as before, but drop the FIXME comment since we're explicitly acknowledging DPCM is not supported?

Please let me know if I'm on the right track before I send v4 of this patch.

That's how it looks like to me, too.

Signature · 3 lines
Regards,

Sakari Ailus
#8 lore raw

PATCH v4 1/2 media: atomisp: csi2: Remove unimplemented DPCM decompression

The source pad format handling attempted to map DPCM-compressed mbus codes to their uncompressed equivalents. However, the rest of the driver does not support DPCM decompression, making this dead code.

Remove the DPCM unmapping logic and simplify to directly copy the sink pad format to the source pad. Add an explicit comment stating that DPCM is not supported.

---
v4:
- Complete removal of DPCM decompression attempt (per Sakari Ailus feedback)
- Keep source pad simply copying sink pad format without unmapping
- Replace detailed comment with explicit "DPCM is not supported" statement

v3:
- Drop "staging:" prefix in subject (per Andy Shevchenko)

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +4 -11
index e723304bec80..64419c1a805e 100644
@@ -107,17 +107,10 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/*
-	 * The source pad must expose the uncompressed format even when the sink
-	 * pad receives DPCM-compressed data. The hardware decompresses DPCM
-	 * (e.g. SGRBG10_DPCM8_1X8 -> SGRBG10_1X10) between sink and source,
-	 * so propagate the sink format but map the mbus code to its uncompressed
-	 * equivalent. atomisp_subdev_uncompressed_code() returns the code
-	 * unchanged for formats that are not DPCM-compressed.
-	 */
-	*actual_ffmt = *__csi2_get_format(csi2, sd_state, which, CSI2_PAD_SINK);
-	actual_ffmt->code = atomisp_subdev_uncompressed_code(actual_ffmt->code);
-	*ffmt = *actual_ffmt;
+	/* Source pad format is copied from sink pad. DPCM is not supported. */
+	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
+						  CSI2_PAD_SINK);
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
#9 lore raw

PATCH v4 2/2 media: atomisp: Remove unused DPCM helper functions and declarations

Remove the DPCM-related helper functions and data structures that are no longer used after simplifying the CSI2 source pad format handling:

- atomisp_subdev_uncompressed_code() function
- atomisp_subdev_is_compressed() function
- atomisp_find_in_fmt_conv_compressed() declaration
- compressed_codes[] array from atomisp_subdev.c

Since the driver does not support DPCM decompression, these functions were dead code and have been removed to clean up the codebase.

---
 .../media/atomisp/pci/atomisp_subdev.c        | 33 -------------------
 .../media/atomisp/pci/atomisp_subdev.h        |  3 --
 2 files changed, 36 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +0 -33
index 3d56ca83ecb7..ec5d3d7d7700 100644
@@ -51,39 +51,6 @@ const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[] = {
 	{}
 };
 
-static const struct {
-	u32 code;
-	u32 compressed;
-} compressed_codes[] = {
-	{ MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SGBRG10_1X10, MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 },
-};
-
-u32 atomisp_subdev_uncompressed_code(u32 code)
-{
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(compressed_codes); i++)
-		if (code == compressed_codes[i].compressed)
-			return compressed_codes[i].code;
-
-	return code;
-}
-
-bool atomisp_subdev_is_compressed(u32 code)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(atomisp_in_fmt_conv) - 1; i++)
-		if (code == atomisp_in_fmt_conv[i].code)
-			return atomisp_in_fmt_conv[i].bpp !=
-			       atomisp_in_fmt_conv[i].depth;
-
-	return false;
-}
-
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code)
 {
 	int i;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -3
index e1d0168cb91d..a8d3ddeda3bf 100644
@@ -296,8 +296,6 @@ struct atomisp_sub_device {
 
 extern const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[];
 
-u32 atomisp_subdev_uncompressed_code(u32 code);
-bool atomisp_subdev_is_compressed(u32 code);
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code);
 
 /* ISP2400 */
@@ -309,7 +307,6 @@ const struct atomisp_in_fmt_conv
 *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format
 	atomisp_in_fmt);
 
-const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_compressed(u32 code);
 bool atomisp_subdev_format_conversion(struct atomisp_sub_device *asd);
 
 /* Get pointer to appropriate format */
Signature · 1 line
2.53.0
reviewer
#10 lore raw

Re: [PATCH v4 1/2] media: atomisp: csi2: Remove unimplemented DPCM decompression

In reply to Debjeet Banerjee

Hi Debjeet,

Quoted 35 lines · Debjeet Banerjee

The source pad format handling attempted to map DPCM-compressed mbus codes to their uncompressed equivalents. However, the rest of the driver does not support DPCM decompression, making this dead code.

Remove the DPCM unmapping logic and simplify to directly copy the sink pad format to the source pad. Add an explicit comment stating that DPCM is not supported.

---
v4:
- Complete removal of DPCM decompression attempt (per Sakari Ailus feedback)
- Keep source pad simply copying sink pad format without unmapping
- Replace detailed comment with explicit "DPCM is not supported" statement

v3:
- Drop "staging:" prefix in subject (per Andy Shevchenko)

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -1
index e723304bec80..64419c1a805e 100644
@@ -107,17 +107,10 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/*

drivers/staging/media/atomisp/pci/atomisp_csi2.c int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, · line 120

Quoted 10 lines
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -10
-	 * The source pad must expose the uncompressed format even when the sink
-	 * pad receives DPCM-compressed data. The hardware decompresses DPCM
-	 * (e.g. SGRBG10_DPCM8_1X8 -> SGRBG10_1X10) between sink and source,
-	 * so propagate the sink format but map the mbus code to its uncompressed
-	 * equivalent. atomisp_subdev_uncompressed_code() returns the code
-	 * unchanged for formats that are not DPCM-compressed.
-	 */
-	*actual_ffmt = *__csi2_get_format(csi2, sd_state, which, CSI2_PAD_SINK);
-	actual_ffmt->code = atomisp_subdev_uncompressed_code(actual_ffmt->code);
-	*ffmt = *actual_ffmt;

This won't apply to my atomisp branch.

Quoted 7 lines
drivers/staging/media/atomisp/pci/atomisp_csi2.c +4 -0
+	/* Source pad format is copied from sink pad. DPCM is not supported. */
+	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
+						  CSI2_PAD_SINK);
+
 	return 0;
 }
 
Signature · 3 lines
Regards,

Sakari Ailus
#11 lore raw

Re: [PATCH v3] media: atomisp: csi2: Fix DPCM decompression for source pad format

Quoted 1 line · Sakari Ailus

This won't apply to my atomisp branch.

I see the issue, it's because of the indentation problem that happened becuase of my IDE. Should i send a patch v5 with the indentation fixed right now?

Regards,
Debjeet

#12 lore raw

Re: [PATCH v4 1/2] media: atomisp: csi2: Remove unimplemented DPCM decompression

In reply to Sakari Ailus

Disregard my last reply, apologies for my mistake on the subject.

Quoted 1 line · Sakari Ailus

This won't apply to my atomisp branch.

I see the issue, it's because of the indentation problem that happened becuase of my IDE. Should i send a patch v5 with the indentation fixed right now?

Regards,
Debjeet

reviewer
#13 lore raw

Re: [PATCH v4 1/2] media: atomisp: csi2: Remove unimplemented DPCM decompression

Quoted 7 lines · Debjeet Banerjee

Disregard my last reply, apologies for my mistake on the subject.

Quoted 1 line · Sakari Ailus

This won't apply to my atomisp branch.

I see the issue, it's because of the indentation problem that happened becuase of my IDE. Should i send a patch v5 with the indentation fixed right now?

Can you try rebasing on the atomisp branch first?

Signature · 1 line
Sakari Ailus
#14 lore raw

Re: [PATCH v4 1/2] media: atomisp: csi2: Remove unimplemented DPCM decompression

Hi Sakari,
I've rebased onto your atomisp branch and generated the v5 patches. Should I send them now?

Regards,
Debjeet

#15 lore raw

PATCH v5 1/2 media: atomisp: csi2: Remove unimplemented DPCM decompression

In reply to Sakari Ailus

The source pad format handling attempted to map DPCM-compressed mbus codes to their uncompressed equivalents. However, the rest of the driver does not support DPCM decompression, making this dead code.

Remove the DPCM unmapping logic and simplify to directly copy the sink pad format to the source pad. Add an explicit comment stating that DPCM is not supported.

---
v5:
- Rebased onto linuxtv.org/sailus/media_tree.git (per Sakari Ailus request)

v4:
- Complete removal of DPCM decompression attempt (per Sakari Ailus feedback)
- Keep source pad simply copying sink pad format without unmapping
- Replace detailed comment with explicit "DPCM is not supported" statement

v3:
- Drop "staging:" prefix in subject (per Andy Shevchenko)

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +1 -1
index 95b9113d75e9..64419c1a805e 100644
@@ -107,7 +107,7 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/* FIXME: DPCM decompression */
+	/* Source pad format is copied from sink pad. DPCM is not supported. */
 	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
 						  CSI2_PAD_SINK);
 
Signature · 1 line
2.53.0
#16 lore raw

PATCH v5 2/2 media: atomisp: Remove unused DPCM helper functions and declarations

Remove the DPCM-related helper functions and data structures that are no longer used after simplifying the CSI2 source pad format handling:

- atomisp_subdev_uncompressed_code() function
- atomisp_subdev_is_compressed() function
- atomisp_find_in_fmt_conv_compressed() declaration
- compressed_codes[] array from atomisp_subdev.c

Since the driver does not support DPCM decompression, these functions were dead code and have been removed to clean up the codebase.

---
 .../media/atomisp/pci/atomisp_subdev.c        | 33 -------------------
 .../media/atomisp/pci/atomisp_subdev.h        |  3 --
 2 files changed, 36 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +0 -33
index 9de9cd884d99..07189230c308 100644
@@ -51,39 +51,6 @@ const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[] = {
 	{}
 };
 
-static const struct {
-	u32 code;
-	u32 compressed;
-} compressed_codes[] = {
-	{ MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SGBRG10_1X10, MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 },
-};
-
-u32 atomisp_subdev_uncompressed_code(u32 code)
-{
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(compressed_codes); i++)
-		if (code == compressed_codes[i].compressed)
-			return compressed_codes[i].code;
-
-	return code;
-}
-
-bool atomisp_subdev_is_compressed(u32 code)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(atomisp_in_fmt_conv) - 1; i++)
-		if (code == atomisp_in_fmt_conv[i].code)
-			return atomisp_in_fmt_conv[i].bpp !=
-			       atomisp_in_fmt_conv[i].depth;
-
-	return false;
-}
-
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code)
 {
 	int i;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -3
index b12bb65be3f2..b399319ae2c9 100644
@@ -296,8 +296,6 @@ struct atomisp_sub_device {
 
 extern const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[];
 
-u32 atomisp_subdev_uncompressed_code(u32 code);
-bool atomisp_subdev_is_compressed(u32 code);
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code);
 
 /* ISP2400 */
@@ -309,7 +307,6 @@ const struct atomisp_in_fmt_conv
 *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format
 	atomisp_in_fmt);
 
-const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_compressed(u32 code);
 bool atomisp_subdev_format_conversion(struct atomisp_sub_device *asd);
 
 /* Get pointer to appropriate format */
Signature · 1 line
2.53.0
reviewer
#17 lore raw

Re: [PATCH v5 1/2] media: atomisp: csi2: Remove unimplemented DPCM decompression

In reply to Debjeet Banerjee

Hi Debjeet,

Quoted 34 lines · Debjeet Banerjee

The source pad format handling attempted to map DPCM-compressed mbus codes to their uncompressed equivalents. However, the rest of the driver does not support DPCM decompression, making this dead code.

Remove the DPCM unmapping logic and simplify to directly copy the sink pad format to the source pad. Add an explicit comment stating that DPCM is not supported.

---
v5:
- Rebased onto linuxtv.org/sailus/media_tree.git (per Sakari Ailus request)

v4:
- Complete removal of DPCM decompression attempt (per Sakari Ailus feedback)
- Keep source pad simply copying sink pad format without unmapping
- Replace detailed comment with explicit "DPCM is not supported" statement

v3:
- Drop "staging:" prefix in subject (per Andy Shevchenko)

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 drivers/staging/media/atomisp/pci/atomisp_csi2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -0
index 95b9113d75e9..64419c1a805e 100644

drivers/staging/media/atomisp/pci/atomisp_csi2.c int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, · line 110

Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp_csi2.c +1 -1
@@ -107,7 +107,7 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/* FIXME: DPCM decompression */
+	/* Source pad format is copied from sink pad. DPCM is not supported. */

I think you just remove this comment and squash the change with the 2nd patch.

Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -0
 	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
 						  CSI2_PAD_SINK);
 
Signature · 3 lines
Regards,

Sakari Ailus
#18 lore raw

PATCH v6 1/1 media: atomisp: Remove unimplemented DPCM decompression

The CSI2 source pad format was set by blindly copying the sink pad format, regardless of whether the sink pad is receiving a DPCM-compressed mbus code. The rest of the driver does not support DPCM decompression, so remove all DPCM-related dead code:

- Remove the FIXME comment in atomisp_csi2.c
- Remove atomisp_subdev_uncompressed_code() function
- Remove atomisp_subdev_is_compressed() function
- Remove atomisp_find_in_fmt_conv_compressed() declaration
- Remove compressed_codes[] array from atomisp_subdev.c

---
v6:
- Squashed into a single patch and removed comment in atomisp_csi2.c

v5:
- Rebased onto linuxtv.org/sailus/media_tree.git

v4:
- Complete removal of DPCM decompression attempt
- Keep source pad simply copying sink pad format without unmapping
- Replace detailed comment with explicit "DPCM is not supported" statement

v3:
- Drop "staging:" prefix in subject

v2:
- Rebased onto latest media tree (fix CI apply failure)
- Fix missing linux-staging recipient (typo in v1)
- Fix indentation

---
 .../staging/media/atomisp/pci/atomisp_csi2.c  |  1 -
 .../media/atomisp/pci/atomisp_subdev.c        | 33 -------------------
 .../media/atomisp/pci/atomisp_subdev.h        |  3 --
 3 files changed, 37 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -1
index 95b9113d75e9..d15e607784e5 100644
@@ -107,7 +107,6 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
 					     &tmp_ffmt);
 	}
 
-	/* FIXME: DPCM decompression */
 	*actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which,
 						  CSI2_PAD_SINK);
 
drivers/staging/media/atomisp/pci/atomisp_subdev.c +0 -33
index 9de9cd884d99..07189230c308 100644
@@ -51,39 +51,6 @@ const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[] = {
 	{}
 };
 
-static const struct {
-	u32 code;
-	u32 compressed;
-} compressed_codes[] = {
-	{ MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SGBRG10_1X10, MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 },
-	{ MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 },
-};
-
-u32 atomisp_subdev_uncompressed_code(u32 code)
-{
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(compressed_codes); i++)
-		if (code == compressed_codes[i].compressed)
-			return compressed_codes[i].code;
-
-	return code;
-}
-
-bool atomisp_subdev_is_compressed(u32 code)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(atomisp_in_fmt_conv) - 1; i++)
-		if (code == atomisp_in_fmt_conv[i].code)
-			return atomisp_in_fmt_conv[i].bpp !=
-			       atomisp_in_fmt_conv[i].depth;
-
-	return false;
-}
-
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code)
 {
 	int i;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -3
index b12bb65be3f2..b399319ae2c9 100644
@@ -296,8 +296,6 @@ struct atomisp_sub_device {
 
 extern const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[];
 
-u32 atomisp_subdev_uncompressed_code(u32 code);
-bool atomisp_subdev_is_compressed(u32 code);
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code);
 
 /* ISP2400 */
@@ -309,7 +307,6 @@ const struct atomisp_in_fmt_conv
 *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format
 	atomisp_in_fmt);
 
-const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_compressed(u32 code);
 bool atomisp_subdev_format_conversion(struct atomisp_sub_device *asd);
 
 /* Get pointer to appropriate format */
Signature · 1 line
2.53.0
#19 lore raw

Re: [PATCH v5 1/2] media: atomisp: csi2: Remove unimplemented DPCM decompression

In reply to Sakari Ailus
Quoted 2 lines · On Fri, 24 Apr 2026 00:05:59 +0300 Sakari Ailus wrote:

I think you just remove this comment and squash the change with the 2nd patch.

Hi sakari,
I have squahed the commits and sent a PATCH v6 many weeks ago. Could you please review it and send feedback if any changes are required. If the Patch is acceptable, what is our next step?