Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa02a8bd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: isp: Fix vfe40 driver to support 8952"

parents 290fb09f 0ed5ac13
Loading
Loading
Loading
Loading
+109 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ static uint8_t stats_pingpong_offset_map[] = {
#define VFE40_BUS_BDG_QOS_CFG_6     0x000002DC
#define VFE40_BUS_BDG_QOS_CFG_7     0x000002E0

#define VFE40_CLK_IDX 1
#define VFE40_CLK_IDX 2
static struct msm_cam_clk_info msm_vfe40_clk_info[VFE_CLK_INFO_MAX];

static int32_t msm_vfe40_init_qos_parms(struct vfe_device *vfe_dev,
@@ -1194,6 +1194,106 @@ static void msm_vfe40_cfg_fetch_engine(struct vfe_device *vfe_dev,
	return;
}

static void msm_vfe40_cfg_testgen(struct vfe_device *vfe_dev,
		struct msm_vfe_testgen_cfg *testgen_cfg)
{
	uint32_t bit_per_pixel = 0;
	uint32_t bpp_reg = 0;
	uint32_t bayer_pix_pattern_reg = 0;
	uint32_t unicolorbar_reg = 0;
	uint32_t unicolor_enb = 0;

	bit_per_pixel = msm_isp_get_bit_per_pixel(
		vfe_dev->axi_data.src_info[VFE_PIX_0].input_format);

	switch (bit_per_pixel) {
	case 8:
		bpp_reg = 0x0;
		break;
	case 10:
		bpp_reg = 0x1;
		break;
	case 12:
		bpp_reg = 0x10;
		break;
	case 14:
		bpp_reg = 0x11;
		break;
	default:
		pr_err("%s: invalid bpp %d\n", __func__, bit_per_pixel);
		break;
	}

	msm_camera_io_w(bpp_reg << 16 | testgen_cfg->burst_num_frame,
		vfe_dev->vfe_base + 0x940);

	msm_camera_io_w(((testgen_cfg->lines_per_frame - 1) << 16) |
		(testgen_cfg->pixels_per_line - 1), vfe_dev->vfe_base + 0x944);

	msm_camera_io_w(testgen_cfg->h_blank, vfe_dev->vfe_base + 0x958);

	msm_camera_io_w((1 << 16) | testgen_cfg->v_blank,
		vfe_dev->vfe_base + 0x95C);

	switch (testgen_cfg->pixel_bayer_pattern) {
	case ISP_BAYER_RGRGRG:
		bayer_pix_pattern_reg = 0x0;
		break;
	case ISP_BAYER_GRGRGR:
		bayer_pix_pattern_reg = 0x1;
		break;
	case ISP_BAYER_BGBGBG:
		bayer_pix_pattern_reg = 0x10;
		break;
	case ISP_BAYER_GBGBGB:
		bayer_pix_pattern_reg = 0x11;
		break;
	default:
		pr_err("%s: invalid pix pattern %d\n",
			__func__, bit_per_pixel);
		break;
	}

	if (testgen_cfg->color_bar_pattern == COLOR_BAR_8_COLOR) {
		unicolor_enb = 0x0;
	} else {
		unicolor_enb = 0x1;
		switch (testgen_cfg->color_bar_pattern) {
		case UNICOLOR_WHITE:
			unicolorbar_reg = 0x0;
			break;
		case UNICOLOR_YELLOW:
			unicolorbar_reg = 0x1;
			break;
		case UNICOLOR_CYAN:
			unicolorbar_reg = 0x10;
			break;
		case UNICOLOR_GREEN:
			unicolorbar_reg = 0x11;
			break;
		case UNICOLOR_MAGENTA:
			unicolorbar_reg = 0x100;
			break;
		case UNICOLOR_RED:
			unicolorbar_reg = 0x101;
			break;
		case UNICOLOR_BLUE:
			unicolorbar_reg = 0x110;
			break;
		case UNICOLOR_BLACK:
			unicolorbar_reg = 0x111;
			break;
		default:
			pr_err("%s: invalid colorbar %d\n",
				__func__, testgen_cfg->color_bar_pattern);
			break;
		}
	}
	msm_camera_io_w((testgen_cfg->rotate_period << 8) |
	(bayer_pix_pattern_reg << 6) | (unicolor_enb << 4) |
	(unicolorbar_reg), vfe_dev->vfe_base + 0x968);
}

static void msm_vfe40_cfg_camif(struct vfe_device *vfe_dev,
	struct msm_vfe_pix_cfg *pix_cfg)
{
@@ -1296,6 +1396,7 @@ static void msm_vfe40_cfg_input_mux(struct vfe_device *vfe_dev,
		core_cfg |= 0x1 << 16;
		msm_camera_io_w_mb(core_cfg, vfe_dev->vfe_base + 0x1C);
		msm_vfe40_cfg_camif(vfe_dev, pix_cfg);
		msm_vfe40_cfg_testgen(vfe_dev, &pix_cfg->testgen_cfg);
		break;
	case EXTERNAL_READ:
		core_cfg |= 0x2 << 16;
@@ -1319,9 +1420,13 @@ static void msm_vfe40_update_camif_state(struct vfe_device *vfe_dev,
		return;

	if (update_state == ENABLE_CAMIF) {
		msm_camera_io_w(0xFFFFFFFF, vfe_dev->vfe_base + 0x30);
		msm_camera_io_w_mb(0xFFFFFFFF, vfe_dev->vfe_base + 0x34);
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x24);
		val = msm_camera_io_r(vfe_dev->vfe_base + 0x28);
		val |= 0xF1;
		val |= 0xF7;
		msm_camera_io_w_mb(val, vfe_dev->vfe_base + 0x28);
		msm_camera_io_w_mb(0x140000, vfe_dev->vfe_base + 0x318);

		bus_en =
			((vfe_dev->axi_data.
@@ -1707,6 +1812,7 @@ static int msm_vfe40_axi_restart(struct vfe_device *vfe_dev,
	msm_camera_io_w(0x7FFFFFFF, vfe_dev->vfe_base + 0x30);
	msm_camera_io_w(0xFEFFFEFF, vfe_dev->vfe_base + 0x34);
	msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x24);
	msm_camera_io_w_mb(0x140000, vfe_dev->vfe_base + 0x318);

	/* Start AXI */
	msm_camera_io_w(0x0, vfe_dev->vfe_base + 0x2C0);
@@ -1799,6 +1905,7 @@ static void msm_vfe40_stats_cfg_comp_mask(struct vfe_device *vfe_dev,
	}

	stats_mask = stats_mask & 0xFF;
	mask_bf_scale = stats_mask;

	stats_comp_mask = &stats_data->stats_comp_mask[request_comp_index];
	comp_mask_reg = msm_camera_io_r(vfe_dev->vfe_base + 0x44);