瀏覽代碼

msm: camera: isp: Allow plain161x output format reserve

Allow plain1610/plain1612/plain14 output format reserve while
seamless switch between RAW10/RAW12/RAW14 sensor mode.
Fix the image size violation issue by using write master pack
to get correct pack format and width on rdi.

CRs-Fixed: 3478244
Change-Id: I4dc3660f40405604bfd04a1e0042bb11ca5b5bf9
Signed-off-by: chengxue <[email protected]>
chengxue 2 年之前
父節點
當前提交
0f20eeb37b

+ 5 - 21
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_common.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/iopoll.h>
@@ -128,31 +128,15 @@ static int cam_ife_csid_validate_rdi_format(uint32_t in_format,
 		}
 		break;
 	case CAM_FORMAT_MIPI_RAW_10:
+	case CAM_FORMAT_MIPI_RAW_12:
+	case CAM_FORMAT_MIPI_RAW_14:
 		switch (out_format) {
 		case CAM_FORMAT_MIPI_RAW_10:
+		case CAM_FORMAT_MIPI_RAW_12:
+		case CAM_FORMAT_MIPI_RAW_14:
 		case CAM_FORMAT_PLAIN128:
 		case CAM_FORMAT_PLAIN16_10:
-		case CAM_FORMAT_PLAIN16_16:
-			break;
-		default:
-			rc = -EINVAL;
-			break;
-		}
-		break;
-	case CAM_FORMAT_MIPI_RAW_12:
-		switch (out_format) {
-		case CAM_FORMAT_MIPI_RAW_12:
 		case CAM_FORMAT_PLAIN16_12:
-		case CAM_FORMAT_PLAIN16_16:
-			break;
-		default:
-			rc = -EINVAL;
-			break;
-		}
-		break;
-	case CAM_FORMAT_MIPI_RAW_14:
-		switch (out_format) {
-		case CAM_FORMAT_MIPI_RAW_14:
 		case CAM_FORMAT_PLAIN16_14:
 		case CAM_FORMAT_PLAIN16_16:
 			break;

+ 3 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -2732,6 +2732,9 @@ static bool cam_ife_csid_hw_ver2_need_unpack_mipi(
 	  * We still need to set need_unpack here so that we unpack incoming data (say MIPI10)
 	  * into MSB. If default_out_format can be set to 16_10/16_12/16_14 - then we can remove
 	  */
+	case CAM_FORMAT_PLAIN16_10:
+	case CAM_FORMAT_PLAIN16_12:
+	case CAM_FORMAT_PLAIN16_14:
 	case CAM_FORMAT_PLAIN16_16:
 		need_unpack = (bool)(path_reg->capabilities & CAM_IFE_CSID_CAP_RDI_UNPACK_MSB);
 		break;

+ 10 - 3
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c

@@ -904,9 +904,16 @@ static int cam_vfe_bus_ver3_config_rdi_wm(
 			ALIGNUP(rsrc_data->width * 2, 16) / 16;
 		rsrc_data->en_cfg = 0x1;
 
-		if (rsrc_data->use_wm_pack &&
-			rsrc_data->default_line_based)
-			rsrc_data->width = ALIGNUP((rsrc_data->acquired_width), 8);
+		if (rsrc_data->use_wm_pack) {
+			rsrc_data->pack_fmt = cam_vfe_bus_ver3_get_packer_fmt(rsrc_data->format,
+				rsrc_data->index);
+			/* LSB aligned */
+			rsrc_data->pack_fmt |= (1 <<
+				rsrc_data->common_data->pack_align_shift);
+
+			if (rsrc_data->default_line_based)
+				rsrc_data->width = ALIGNUP((rsrc_data->acquired_width), 8);
+		}
 		break;
 	case CAM_FORMAT_PLAIN64:
 		rsrc_data->width =