diff options
author | Steve Longerbeam <slongerbeam@gmail.com> | 2016-07-19 21:11:06 -0400 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2016-08-08 05:44:20 -0400 |
commit | aede45b2f6cd995f9949297b0e3234f495ec93f1 (patch) | |
tree | 08f65a127e97d8fcf058f44a461b6c298d8339c4 | |
parent | 97afc25c4392105ea031e6f643f659058161c7dc (diff) |
gpu: ipu-v3: set correct full sensor frame for PAL/NTSC
Set the sensor full frame based on whether the passed in mbus_fmt
is 720x480 (NTSC) or 720x576 (PAL).
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r-- | drivers/gpu/ipu-v3/ipu-csi.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c index 06631ac61b04..641ed7651baa 100644 --- a/drivers/gpu/ipu-v3/ipu-csi.c +++ b/drivers/gpu/ipu-v3/ipu-csi.c | |||
@@ -365,10 +365,14 @@ int ipu_csi_init_interface(struct ipu_csi *csi, | |||
365 | { | 365 | { |
366 | struct ipu_csi_bus_config cfg; | 366 | struct ipu_csi_bus_config cfg; |
367 | unsigned long flags; | 367 | unsigned long flags; |
368 | u32 data = 0; | 368 | u32 width, height, data = 0; |
369 | 369 | ||
370 | fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); | 370 | fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); |
371 | 371 | ||
372 | /* set default sensor frame width and height */ | ||
373 | width = mbus_fmt->width; | ||
374 | height = mbus_fmt->height; | ||
375 | |||
372 | /* Set the CSI_SENS_CONF register remaining fields */ | 376 | /* Set the CSI_SENS_CONF register remaining fields */ |
373 | data |= cfg.data_width << CSI_SENS_CONF_DATA_WIDTH_SHIFT | | 377 | data |= cfg.data_width << CSI_SENS_CONF_DATA_WIDTH_SHIFT | |
374 | cfg.data_fmt << CSI_SENS_CONF_DATA_FMT_SHIFT | | 378 | cfg.data_fmt << CSI_SENS_CONF_DATA_FMT_SHIFT | |
@@ -386,11 +390,6 @@ int ipu_csi_init_interface(struct ipu_csi *csi, | |||
386 | 390 | ||
387 | ipu_csi_write(csi, data, CSI_SENS_CONF); | 391 | ipu_csi_write(csi, data, CSI_SENS_CONF); |
388 | 392 | ||
389 | /* Setup sensor frame size */ | ||
390 | ipu_csi_write(csi, | ||
391 | (mbus_fmt->width - 1) | ((mbus_fmt->height - 1) << 16), | ||
392 | CSI_SENS_FRM_SIZE); | ||
393 | |||
394 | /* Set CCIR registers */ | 393 | /* Set CCIR registers */ |
395 | 394 | ||
396 | switch (cfg.clk_mode) { | 395 | switch (cfg.clk_mode) { |
@@ -408,11 +407,12 @@ int ipu_csi_init_interface(struct ipu_csi *csi, | |||
408 | * Field1BlankEnd = 0x7, Field1BlankStart = 0x3, | 407 | * Field1BlankEnd = 0x7, Field1BlankStart = 0x3, |
409 | * Field1ActiveEnd = 0x5, Field1ActiveStart = 0x1 | 408 | * Field1ActiveEnd = 0x5, Field1ActiveStart = 0x1 |
410 | */ | 409 | */ |
410 | height = 625; /* framelines for PAL */ | ||
411 | |||
411 | ipu_csi_write(csi, 0x40596 | CSI_CCIR_ERR_DET_EN, | 412 | ipu_csi_write(csi, 0x40596 | CSI_CCIR_ERR_DET_EN, |
412 | CSI_CCIR_CODE_1); | 413 | CSI_CCIR_CODE_1); |
413 | ipu_csi_write(csi, 0xD07DF, CSI_CCIR_CODE_2); | 414 | ipu_csi_write(csi, 0xD07DF, CSI_CCIR_CODE_2); |
414 | ipu_csi_write(csi, 0xFF0000, CSI_CCIR_CODE_3); | 415 | ipu_csi_write(csi, 0xFF0000, CSI_CCIR_CODE_3); |
415 | |||
416 | } else if (mbus_fmt->width == 720 && mbus_fmt->height == 480) { | 416 | } else if (mbus_fmt->width == 720 && mbus_fmt->height == 480) { |
417 | /* | 417 | /* |
418 | * NTSC case | 418 | * NTSC case |
@@ -422,6 +422,8 @@ int ipu_csi_init_interface(struct ipu_csi *csi, | |||
422 | * Field1BlankEnd = 0x6, Field1BlankStart = 0x2, | 422 | * Field1BlankEnd = 0x6, Field1BlankStart = 0x2, |
423 | * Field1ActiveEnd = 0x4, Field1ActiveStart = 0 | 423 | * Field1ActiveEnd = 0x4, Field1ActiveStart = 0 |
424 | */ | 424 | */ |
425 | height = 525; /* framelines for NTSC */ | ||
426 | |||
425 | ipu_csi_write(csi, 0xD07DF | CSI_CCIR_ERR_DET_EN, | 427 | ipu_csi_write(csi, 0xD07DF | CSI_CCIR_ERR_DET_EN, |
426 | CSI_CCIR_CODE_1); | 428 | CSI_CCIR_CODE_1); |
427 | ipu_csi_write(csi, 0x40596, CSI_CCIR_CODE_2); | 429 | ipu_csi_write(csi, 0x40596, CSI_CCIR_CODE_2); |
@@ -447,6 +449,10 @@ int ipu_csi_init_interface(struct ipu_csi *csi, | |||
447 | break; | 449 | break; |
448 | } | 450 | } |
449 | 451 | ||
452 | /* Setup sensor frame size */ | ||
453 | ipu_csi_write(csi, (width - 1) | ((height - 1) << 16), | ||
454 | CSI_SENS_FRM_SIZE); | ||
455 | |||
450 | dev_dbg(csi->ipu->dev, "CSI_SENS_CONF = 0x%08X\n", | 456 | dev_dbg(csi->ipu->dev, "CSI_SENS_CONF = 0x%08X\n", |
451 | ipu_csi_read(csi, CSI_SENS_CONF)); | 457 | ipu_csi_read(csi, CSI_SENS_CONF)); |
452 | dev_dbg(csi->ipu->dev, "CSI_ACT_FRM_SIZE = 0x%08X\n", | 458 | dev_dbg(csi->ipu->dev, "CSI_ACT_FRM_SIZE = 0x%08X\n", |