[PATCH] media: css: Write LINE_LENGTH_PCK correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to MIPI CCS v1.1 specification, the LINE_LENGTH_PCK
units is in VT pixel clocks (Section 8.2.6).

To compute how many pixel clocks it takes, simply divide the
VT pixel clock frequency by the number of pixels in a single line.

Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
---
Testing:

The patch is tested using IMX519 with CCS.
This patch makes the frame buffer being filled to the fullest
(instead of getting 1/3rd only previously) - without any workarounds.
---
 drivers/media/i2c/ccs/ccs-core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index 16de66a37fad..12c75a843dfe 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -734,9 +734,11 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
 
 		break;
 	case V4L2_CID_HBLANK:
-		rval = ccs_write(sensor, LINE_LENGTH_PCK,
-				 sensor->pixel_array->crop[CCS_PA_PAD_SRC].width
-				 + ctrl->val);
+		/* LINE_LENGTH_PCK units are in VT pixel clocks. */
+		u16 line_length_pck =
+			sensor->pll.vt_bk.pix_clk_freq_hz /
+			(sensor->pixel_array->crop[CCS_PA_PAD_SRC].width + ctrl->val);
+		rval = ccs_write(sensor, LINE_LENGTH_PCK, line_length_pck);
 
 		break;
 	case V4L2_CID_TEST_PATTERN:
-- 
2.40.1





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux