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

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

Merge "msm: camera: add MSM_CAM_READ_LOOP control flow for eeprom"

parents c387a631 6d75cad8
Loading
Loading
Loading
Loading
+42 −6
Original line number Diff line number Diff line
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -54,8 +54,10 @@ static int msm_get_read_mem_size
			return -EINVAL;
		}
		for (i = 0; i < eeprom_map->memory_map_size; i++) {
			if (eeprom_map->mem_settings[i].i2c_operation ==
				MSM_CAM_READ) {
			if ((eeprom_map->mem_settings[i].i2c_operation ==
				MSM_CAM_READ) ||
				(eeprom_map->mem_settings[i].i2c_operation ==
				MSM_CAM_READ_LOOP)) {
				size += eeprom_map->mem_settings[i].reg_data;
			}
		}
@@ -325,8 +327,10 @@ static int msm_eeprom_parse_memory_map(struct device_node *of,
static int eeprom_parse_memory_map(struct msm_eeprom_ctrl_t *e_ctrl,
	struct msm_eeprom_memory_map_array *eeprom_map_array)
{
	int rc =  0, i, j;
	int rc =  0, i, j, gc;
	uint8_t *memptr;
	uint16_t gc_read = 0;

	struct msm_eeprom_mem_map_t *eeprom_map;

	e_ctrl->cal_data.mapdata = NULL;
@@ -406,9 +410,41 @@ static int eeprom_parse_memory_map(struct msm_eeprom_ctrl_t *e_ctrl,
				memptr += eeprom_map->mem_settings[i].reg_data;
			}
			break;

			case MSM_CAM_READ_LOOP: {
				e_ctrl->i2c_client.addr_type =
				 eeprom_map->mem_settings[i].addr_type;

				for (gc = 0;
					gc < eeprom_map->mem_settings[i].
						reg_data;
					gc++) {
					msleep(eeprom_map->mem_settings[i].
						delay);
					rc = e_ctrl->i2c_client.i2c_func_tbl->
						i2c_read(
						&(e_ctrl->i2c_client),
						eeprom_map->mem_settings[i].
						reg_addr,
						&gc_read,
						eeprom_map->mem_settings[i].
						data_type);
					if (rc < 0) {
						pr_err("%s: read failed\n",
							__func__);
						goto clean_up;
					}
					*memptr = (uint8_t)gc_read;
					memptr++;
				}
			}
			break;

			default:
				pr_err("%s: %d Invalid i2c operation LC:%d\n",
					__func__, __LINE__, i);
				pr_err("%s: %d Invalid i2c operation LC:%d, op: %d\n",
					__func__, __LINE__, i,
					eeprom_map->mem_settings[i].
						i2c_operation);
				return -EINVAL;
			}
		}
+3 −0
Original line number Diff line number Diff line
@@ -255,6 +255,9 @@ enum msm_camera_i2c_operation {
	MSM_CAM_WRITE = 0,
	MSM_CAM_POLL,
	MSM_CAM_READ,
#define MSM_CAM_READ_LOOP \
	MSM_CAM_READ_LOOP
	MSM_CAM_READ_LOOP = 3,
};

struct msm_sensor_i2c_sync_params {