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

Commit 67b2b34f authored by Vishalsingh Hajeri's avatar Vishalsingh Hajeri Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: sensor: Allocate buffer to be of DMA memory type



QUP I2C requires DMA memory buffer.

Change-Id: I4c4425e3f77c674e9d0cce0ca75b130cf4ae0644
Signed-off-by: default avatarVishalsingh Hajeri <vhajeri@codeaurora.org>
parent f09e00fd
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -245,9 +245,15 @@ static int32_t cam_qup_i2c_write(struct camera_io_master *client,
	enum camera_sensor_i2c_type data_type)
{
	int32_t rc = 0;
	unsigned char buf[I2C_REG_MAX_BUF_SIZE];
	unsigned char *buf = NULL;
	uint8_t len = 0;

	buf = kzalloc(I2C_REG_MAX_BUF_SIZE, GFP_KERNEL | GFP_DMA);
	if (!buf) {
		CAM_ERR(CAM_SENSOR, "Buffer memory allocation failed");
		return -ENOMEM;
	}

	CAM_DBG(CAM_SENSOR, "reg addr = 0x%x data type: %d",
			reg_setting->reg_addr, data_type);
	if (addr_type == CAMERA_SENSOR_I2C_TYPE_BYTE) {
@@ -273,7 +279,8 @@ static int32_t cam_qup_i2c_write(struct camera_io_master *client,
		len = 4;
	} else {
		CAM_ERR(CAM_SENSOR, "Invalid I2C addr type");
		return -EINVAL;
		rc = -EINVAL;
		goto deallocate_buffer;
	}

	CAM_DBG(CAM_SENSOR, "Data: 0x%x", reg_setting->reg_data);
@@ -307,12 +314,16 @@ static int32_t cam_qup_i2c_write(struct camera_io_master *client,
		len += 4;
	} else {
		CAM_ERR(CAM_SENSOR, "Invalid Data Type");
		return -EINVAL;
		rc = -EINVAL;
		goto deallocate_buffer;
	}

	rc = cam_qup_i2c_txdata(client, buf, len);
	if (rc < 0)
		CAM_ERR(CAM_SENSOR, "failed rc: %d", rc);

deallocate_buffer:
	kfree(buf);
	return rc;
}