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

Commit 045f7c87 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: Support for EEPROMS with multiple I2C addresses"

parents db37ad59 fe291bf4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ Optional properties:
- qcom,pageen%d : number %d page enable reg size, start address, address type,
    data, data type, delay in ms. size 0 stand for not used.
- cam_vdig-supply : should contain regulator to be used for the digital vdd.
- qcom,saddr%d : property should specify the slave address for block (%d).

Example:

@@ -75,6 +76,7 @@ Example:
        qcom,pageen1 = <1 0x0202 2 0x01 1 10>;
        qcom,poll1 = <0 0x0 2 0 1 1>;
        qcom,mem1 = <32 0x3000 2 0 1 0>;
        qcom,saddr1 = <0x62>;

        cam_vdig-supply = <&pm8226_l5>;
        cam_vio-supply = <&pm8226_lvs1>;
+6 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 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
@@ -119,11 +119,16 @@ struct eeprom_map_t {
	uint32_t delay;
};

struct eeprom_slave_add_t {
	uint32_t addr;
};

struct msm_eeprom_memory_map_t {
	struct eeprom_map_t page;
	struct eeprom_map_t pageen;
	struct eeprom_map_t poll;
	struct eeprom_map_t mem;
	struct eeprom_slave_add_t saddr;
};

struct msm_eeprom_memory_block_t {
+17 −0
Original line number Diff line number Diff line
@@ -268,6 +268,7 @@ static int read_eeprom_memory(struct msm_eeprom_ctrl_t *e_ctrl,
	int rc = 0;
	int j;
	struct msm_eeprom_memory_map_t *emap = block->map;
	struct msm_eeprom_board_info *eb_info;
	uint8_t *memptr = block->mapdata;

	if (!e_ctrl) {
@@ -275,7 +276,17 @@ static int read_eeprom_memory(struct msm_eeprom_ctrl_t *e_ctrl,
		return -EINVAL;
	}

	eb_info = e_ctrl->eboard_info;

	for (j = 0; j < block->num_map; j++) {
		if (emap[j].saddr.addr) {
			eb_info->i2c_slaveaddr = emap[j].saddr.addr;
			e_ctrl->i2c_client.cci_client->sid =
					eb_info->i2c_slaveaddr >> 1;
			pr_err("qcom,slave-addr = 0x%X\n",
				eb_info->i2c_slaveaddr);
		}

		if (emap[j].page.valid_size) {
			e_ctrl->i2c_client.addr_type = emap[j].page.addr_t;
			rc = e_ctrl->i2c_client.i2c_func_tbl->i2c_write(
@@ -382,6 +393,12 @@ static int msm_eeprom_parse_memory_map(struct device_node *of,
		if (rc < 0)
			pr_err("%s: pageen not needed\n", __func__);

		snprintf(property, PROPERTY_MAXSIZE, "qcom,saddr%d", i);
		rc = of_property_read_u32_array(of, property,
			(uint32_t *) &map[i].saddr.addr, 1);
		if (rc < 0)
			CDBG("%s: saddr not needed - block %d\n", __func__, i);

		snprintf(property, PROPERTY_MAXSIZE, "qcom,poll%d", i);
		rc = of_property_read_u32_array(of, property,
				(uint32_t *) &map[i].poll, count);