Skip to content

Commit

Permalink
media: imx: imx7-media-csi: Clear BIT_MIPI_DOUBLE_CMPNT for <16b formats
Browse files Browse the repository at this point in the history
[ Upstream commit cccc08a ]

Commit 9babbba ("media: imx: imx7-media-csi: Use dual sampling for
YUV 1X16") set BIT_MIPI_DOUBLE_CMPNT in the CR18 register for 16-bit YUV
formats in imx7_csi_configure(). The CR18 register is always updated
with read-modify-write cycles, so if a 16-bit YUV format is selected,
the bit will stay set forever, even if the format is changed. Fix it by
clearing the bit at the beginning of the imx7_csi_configure() function.

While at it, swap two of the bits being cleared to match the MSB to LSB
order. This doesn't cause any functional change.

Fixes: 9babbba ("media: imx: imx7-media-csi: Use dual sampling for YUV 1X16")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
pinchartl authored and gregkh committed Dec 31, 2022
1 parent 3f8b24a commit 0f5250e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/media/imx/imx7-media-csi.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ static void imx7_csi_configure(struct imx7_csi *csi)
cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);

cr18 &= ~(BIT_CSI_HW_ENABLE | BIT_MIPI_DATA_FORMAT_MASK |
BIT_DATA_FROM_MIPI | BIT_BASEADDR_CHG_ERR_EN |
BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL |
BIT_DEINTERLACE_EN);
BIT_DATA_FROM_MIPI | BIT_MIPI_DOUBLE_CMPNT |
BIT_BASEADDR_CHG_ERR_EN | BIT_BASEADDR_SWITCH_SEL |
BIT_BASEADDR_SWITCH_EN | BIT_DEINTERLACE_EN);

if (out_pix->field == V4L2_FIELD_INTERLACED) {
cr18 |= BIT_DEINTERLACE_EN;
Expand Down

0 comments on commit 0f5250e

Please sign in to comment.