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

Commit 2df88558 authored by Tony Lijo Jose's avatar Tony Lijo Jose
Browse files

msm: camera: cci: Avoid reading from i2c fifo if empty



Avoid reading from cci i2c read buffer while register dump, This may
lead to read underflow status bits getting set.

CRs-Fixed: 2662669
Change-Id: I6035af21277ab291e536c91ba08a1f054a59f923
Signed-off-by: default avatarTony Lijo Jose <tjose@codeaurora.org>
parent af87936b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -184,6 +184,8 @@ static void cam_cci_dump_registers(struct cci_device *cci_dev,
	uint32_t read_val = 0;
	uint32_t i = 0;
	uint32_t reg_offset = 0;
	uint32_t read_buf_level = 0;
	uint32_t read_data_reg_offset = 0x0;
	void __iomem *base = cci_dev->soc_info.reg_map[0].mem_base;

	/* CCI Top Registers */
@@ -198,8 +200,19 @@ static void cam_cci_dump_registers(struct cci_device *cci_dev,
	/* CCI Master registers */
	CAM_INFO(CAM_CCI, "****CCI MASTER %d Registers ****",
		master);
	read_buf_level = cam_io_r_mb(base +
			CCI_I2C_M0_READ_BUF_LEVEL_ADDR + master * 0x100);
	read_data_reg_offset = CCI_I2C_M0_READ_DATA_ADDR + master * 0x100;
	for (i = 0; i < DEBUG_MASTER_REG_COUNT; i++) {
		reg_offset = DEBUG_MASTER_REG_START + master*0x100 + i * 4;
		/*
		 * Don't read from READ_DATA_ADDR if
		 * i2c read fifo is empty, this may lead to
		 * read underflow status bits getting set
		 */
		if ((read_buf_level == 0) &&
			(reg_offset == read_data_reg_offset))
			continue;
		read_val = cam_io_r_mb(base + reg_offset);
		CAM_INFO(CAM_CCI, "offset = 0x%X value = 0x%X",
			reg_offset, read_val);