forked from rubenslte/android_kernel_samsung_msm8226
msm: camera: Add support for camera multimodule in eeprom
Add query for eeprom Multimodule data. Change-Id: I0bdc741ac7835941afc74cc79a23b08363cd8078 Signed-off-by: Evgeniy Borisov <eborisov@codeaurora.org> Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org> (cherry picked from commit 096b8b7397c18ad353944ab4194baa6601e5bbf1) Signed-off-by: Satish Kamuju <skamuj@codeaurora.org>
This commit is contained in:
committed by
Satish Kamuju
parent
d9ca993e06
commit
87ebe9cf98
@@ -58,6 +58,13 @@ Optional properties:
|
||||
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.
|
||||
|
||||
Optional properties -EEPROM Camera Multimodule
|
||||
- qcom,mm-data-support - Camera Multimodule data capability flag.
|
||||
- qcom,mm-data-compressed - Camera Multimodule data compresion flag.
|
||||
- qcom,mm-data-offset - Camera Multimodule data start offset.
|
||||
- qcom,mm-data-size - Camera Multimodule data size.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
eeprom0: qcom,eeprom@60 {
|
||||
@@ -76,6 +83,11 @@ Example:
|
||||
qcom,poll1 = <0 0x0 2 0 1 1>;
|
||||
qcom,mem1 = <32 0x3000 2 0 1 0>;
|
||||
|
||||
qcom,mm-data-support;
|
||||
qcom,mm-data-compressed;
|
||||
qcom,mm-data-offset = 0;
|
||||
qcom,mm-data-size = 0;
|
||||
|
||||
cam_vdig-supply = <&pm8226_l5>;
|
||||
cam_vio-supply = <&pm8226_lvs1>;
|
||||
qcom,cam-vreg-name = "cam_vdig", "cam_vio";
|
||||
|
||||
@@ -129,10 +129,18 @@ struct msm_eeprom_memory_block_t {
|
||||
uint32_t num_data; /* size of total mapdata */
|
||||
};
|
||||
|
||||
struct msm_eeprom_mm_t {
|
||||
uint32_t mm_support;
|
||||
uint32_t mm_compression;
|
||||
uint32_t mm_offset;
|
||||
uint32_t mm_size;
|
||||
};
|
||||
|
||||
struct msm_eeprom_board_info {
|
||||
const char *eeprom_name;
|
||||
uint16_t i2c_slaveaddr;
|
||||
struct msm_camera_power_ctrl_t power_info;
|
||||
struct msm_eeprom_mm_t mm_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -100,6 +100,17 @@ static uint32_t msm_eeprom_match_crc(struct msm_eeprom_memory_block_t *data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_eeprom_get_mm_data(struct msm_eeprom_ctrl_t *e_ctrl,
|
||||
struct msm_eeprom_cfg_data *cdata)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_eeprom_mm_t *mm_data = &e_ctrl->eboard_info->mm_data;
|
||||
cdata->cfg.get_mm_data.mm_support = mm_data->mm_support;
|
||||
cdata->cfg.get_mm_data.mm_compression = mm_data->mm_compression;
|
||||
cdata->cfg.get_mm_data.mm_size = mm_data->mm_size;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int eeprom_config_read_cal_data(struct msm_eeprom_ctrl_t *e_ctrl,
|
||||
struct msm_eeprom_cfg_data *cdata)
|
||||
{
|
||||
@@ -139,7 +150,7 @@ static int msm_eeprom_config(struct msm_eeprom_ctrl_t *e_ctrl,
|
||||
CDBG("%s E\n", __func__);
|
||||
switch (cdata->cfgtype) {
|
||||
case CFG_EEPROM_GET_INFO:
|
||||
CDBG("%s E CFG_EEPROM_GET_INFO\n", __func__);
|
||||
CDBG("%s E CFG_EEPROM_GET_INFO\n", __func__);
|
||||
cdata->is_supported = e_ctrl->is_supported;
|
||||
memcpy(cdata->cfg.eeprom_name,
|
||||
e_ctrl->eboard_info->eeprom_name,
|
||||
@@ -154,6 +165,10 @@ static int msm_eeprom_config(struct msm_eeprom_ctrl_t *e_ctrl,
|
||||
CDBG("%s E CFG_EEPROM_READ_CAL_DATA\n", __func__);
|
||||
rc = eeprom_config_read_cal_data(e_ctrl, cdata);
|
||||
break;
|
||||
case CFG_EEPROM_GET_MM_INFO:
|
||||
CDBG("%s E CFG_EEPROM_GET_MM_INFO\n", __func__);
|
||||
rc = msm_eeprom_get_mm_data(e_ctrl, cdata);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -652,6 +667,38 @@ ERROR1:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int msm_eeprom_mm_dts(struct msm_eeprom_board_info *eb_info,
|
||||
struct device_node *of_node)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_eeprom_mm_t *mm_data = &eb_info->mm_data;
|
||||
|
||||
mm_data->mm_support =
|
||||
of_property_read_bool(of_node,"qcom,mm-data-support");
|
||||
if (!mm_data->mm_support)
|
||||
return -EINVAL;
|
||||
mm_data->mm_compression =
|
||||
of_property_read_bool(of_node,"qcom,mm-data-compressed");
|
||||
if (!mm_data->mm_compression)
|
||||
pr_err("No MM compression data\n");
|
||||
|
||||
rc = of_property_read_u32(of_node, "qcom,mm-data-offset",
|
||||
&mm_data->mm_offset);
|
||||
if (rc < 0)
|
||||
pr_err("No MM offset data\n");
|
||||
|
||||
rc = of_property_read_u32(of_node, "qcom,mm-data-size",
|
||||
&mm_data->mm_size);
|
||||
if (rc < 0)
|
||||
pr_err("No MM size data\n");
|
||||
|
||||
CDBG("mm_support: mm_compr %d, mm_offset %d, mm_size %d\n",
|
||||
mm_data->mm_compression,
|
||||
mm_data->mm_offset,
|
||||
mm_data->mm_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_eeprom_spi_setup(struct spi_device *spi)
|
||||
{
|
||||
struct msm_eeprom_ctrl_t *e_ctrl = NULL;
|
||||
@@ -704,6 +751,12 @@ static int msm_eeprom_spi_setup(struct spi_device *spi)
|
||||
pr_err("%s failed %d\n", __func__, __LINE__);
|
||||
goto board_free;
|
||||
}
|
||||
|
||||
rc = msm_eeprom_mm_dts(e_ctrl->eboard_info, spi->dev.of_node);
|
||||
if (rc < 0) {
|
||||
pr_err("%s MM data miss:%d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
power_info = &eb_info->power_info;
|
||||
|
||||
power_info->clk_info = cam_8974_clk_info;
|
||||
@@ -941,6 +994,10 @@ static int msm_eeprom_platform_probe(struct platform_device *pdev)
|
||||
goto board_free;
|
||||
}
|
||||
|
||||
rc = msm_eeprom_mm_dts(e_ctrl->eboard_info, of_node);
|
||||
if (rc < 0) {
|
||||
pr_err("%s MM data miss:%d\n", __func__, __LINE__);
|
||||
}
|
||||
rc = msm_eeprom_get_dt_data(e_ctrl);
|
||||
if (rc)
|
||||
goto board_free;
|
||||
|
||||
@@ -402,6 +402,7 @@ enum eeprom_cfg_type_t {
|
||||
CFG_EEPROM_GET_CAL_DATA,
|
||||
CFG_EEPROM_READ_CAL_DATA,
|
||||
CFG_EEPROM_WRITE_DATA,
|
||||
CFG_EEPROM_GET_MM_INFO,
|
||||
};
|
||||
|
||||
struct eeprom_get_t {
|
||||
@@ -418,6 +419,12 @@ struct eeprom_write_t {
|
||||
uint32_t num_bytes;
|
||||
};
|
||||
|
||||
struct eeprom_get_mm_t {
|
||||
uint32_t mm_support;
|
||||
uint32_t mm_compression;
|
||||
uint32_t mm_size;
|
||||
};
|
||||
|
||||
struct msm_eeprom_cfg_data {
|
||||
enum eeprom_cfg_type_t cfgtype;
|
||||
uint8_t is_supported;
|
||||
@@ -426,6 +433,7 @@ struct msm_eeprom_cfg_data {
|
||||
struct eeprom_get_t get_data;
|
||||
struct eeprom_read_t read_data;
|
||||
struct eeprom_write_t write_data;
|
||||
struct eeprom_get_mm_t get_mm_data;
|
||||
} cfg;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user