msm: camera: add logic to support sensor compatibility
Add logic to support sensor compatibility to fix same slave address of sensor but different modules on one platform. Change-Id: I6c6721e8ff890feaf2d618c8170e346367a68c28 Signed-off-by: penliu <pengfeiliu@codeaurora.org> Signed-off-by: Wei Ding <weiding@codeaurora.org>
This commit is contained in:
parent
3162449f7d
commit
7dcadefa9c
3 changed files with 64 additions and 2 deletions
|
@ -172,6 +172,8 @@ Optional properties:
|
||||||
should contain phandle of respective ir-led node
|
should contain phandle of respective ir-led node
|
||||||
- qcom,ir-cut-src : if ir cut is supported by this sensor, this property
|
- qcom,ir-cut-src : if ir cut is supported by this sensor, this property
|
||||||
should contain phandle of respective ir-cut node
|
should contain phandle of respective ir-cut node
|
||||||
|
- qcom,special-support-sensors: if only some special sensors are supported
|
||||||
|
on this board, add sensor name in this property.
|
||||||
|
|
||||||
* Qualcomm Technologies, Inc. MSM ACTUATOR
|
* Qualcomm Technologies, Inc. MSM ACTUATOR
|
||||||
|
|
||||||
|
|
|
@ -679,6 +679,24 @@ static void msm_sensor_fill_sensor_info(struct msm_sensor_ctrl_t *s_ctrl,
|
||||||
strlcpy(entity_name, s_ctrl->msm_sd.sd.entity.name, MAX_SENSOR_NAME);
|
strlcpy(entity_name, s_ctrl->msm_sd.sd.entity.name, MAX_SENSOR_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static function definition */
|
||||||
|
static int32_t msm_sensor_driver_is_special_support(
|
||||||
|
struct msm_sensor_ctrl_t *s_ctrl,
|
||||||
|
char *sensor_name)
|
||||||
|
{
|
||||||
|
int32_t rc = 0, i = 0;
|
||||||
|
struct msm_camera_sensor_board_info *sensordata = s_ctrl->sensordata;
|
||||||
|
|
||||||
|
for (i = 0; i < sensordata->special_support_size; i++) {
|
||||||
|
if (!strcmp(sensordata->special_support_sensors[i],
|
||||||
|
sensor_name)) {
|
||||||
|
rc = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/* static function definition */
|
/* static function definition */
|
||||||
int32_t msm_sensor_driver_probe(void *setting,
|
int32_t msm_sensor_driver_probe(void *setting,
|
||||||
struct msm_sensor_info_t *probed_info, char *entity_name)
|
struct msm_sensor_info_t *probed_info, char *entity_name)
|
||||||
|
@ -810,6 +828,16 @@ int32_t msm_sensor_driver_probe(void *setting,
|
||||||
|
|
||||||
CDBG("s_ctrl[%d] %pK", slave_info->camera_id, s_ctrl);
|
CDBG("s_ctrl[%d] %pK", slave_info->camera_id, s_ctrl);
|
||||||
|
|
||||||
|
if (s_ctrl->sensordata->special_support_size > 0) {
|
||||||
|
if (!msm_sensor_driver_is_special_support(s_ctrl,
|
||||||
|
slave_info->sensor_name)) {
|
||||||
|
pr_err("%s:%s is not support on this board\n",
|
||||||
|
__func__, slave_info->sensor_name);
|
||||||
|
rc = 0;
|
||||||
|
goto free_slave_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s_ctrl->is_probe_succeed == 1) {
|
if (s_ctrl->is_probe_succeed == 1) {
|
||||||
/*
|
/*
|
||||||
* Different sensor on this camera slot has been connected
|
* Different sensor on this camera slot has been connected
|
||||||
|
@ -1017,7 +1045,7 @@ free_slave_info:
|
||||||
|
|
||||||
static int32_t msm_sensor_driver_get_dt_data(struct msm_sensor_ctrl_t *s_ctrl)
|
static int32_t msm_sensor_driver_get_dt_data(struct msm_sensor_ctrl_t *s_ctrl)
|
||||||
{
|
{
|
||||||
int32_t rc = 0;
|
int32_t rc = 0, i = 0;
|
||||||
struct msm_camera_sensor_board_info *sensordata = NULL;
|
struct msm_camera_sensor_board_info *sensordata = NULL;
|
||||||
struct device_node *of_node = s_ctrl->of_node;
|
struct device_node *of_node = s_ctrl->of_node;
|
||||||
uint32_t cell_id;
|
uint32_t cell_id;
|
||||||
|
@ -1055,6 +1083,35 @@ static int32_t msm_sensor_driver_get_dt_data(struct msm_sensor_ctrl_t *s_ctrl)
|
||||||
goto FREE_SENSOR_DATA;
|
goto FREE_SENSOR_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sensordata->special_support_size =
|
||||||
|
of_property_count_strings(of_node,
|
||||||
|
"qcom,special-support-sensors");
|
||||||
|
|
||||||
|
if (sensordata->special_support_size < 0)
|
||||||
|
sensordata->special_support_size = 0;
|
||||||
|
|
||||||
|
if (sensordata->special_support_size > MAX_SPECIAL_SUPPORT_SIZE) {
|
||||||
|
pr_debug("%s:support_size exceed max support size\n", __func__);
|
||||||
|
sensordata->special_support_size = MAX_SPECIAL_SUPPORT_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sensordata->special_support_size) {
|
||||||
|
for (i = 0; i < sensordata->special_support_size; i++) {
|
||||||
|
rc = of_property_read_string_index(of_node,
|
||||||
|
"qcom,special-support-sensors", i,
|
||||||
|
&(sensordata->special_support_sensors[i]));
|
||||||
|
if (rc < 0) {
|
||||||
|
/* if read sensor support names failed,
|
||||||
|
* set support all sensors, break;
|
||||||
|
*/
|
||||||
|
sensordata->special_support_size = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CDBG("%s special_support_sensors[%d] = %s\n", __func__,
|
||||||
|
i, sensordata->special_support_sensors[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Read subdev info */
|
/* Read subdev info */
|
||||||
rc = msm_sensor_get_sub_module_index(of_node, &sensordata->sensor_info);
|
rc = msm_sensor_get_sub_module_index(of_node, &sensordata->sensor_info);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
|
|
||||||
|
#define MAX_SPECIAL_SUPPORT_SIZE 10
|
||||||
|
|
||||||
enum msm_camera_device_type_t {
|
enum msm_camera_device_type_t {
|
||||||
MSM_CAMERA_I2C_DEVICE,
|
MSM_CAMERA_I2C_DEVICE,
|
||||||
|
@ -148,6 +149,8 @@ struct msm_camera_sensor_board_info {
|
||||||
const char *actuator_name;
|
const char *actuator_name;
|
||||||
const char *ois_name;
|
const char *ois_name;
|
||||||
const char *flash_name;
|
const char *flash_name;
|
||||||
|
const char *special_support_sensors[MAX_SPECIAL_SUPPORT_SIZE];
|
||||||
|
int32_t special_support_size;
|
||||||
struct msm_camera_slave_info *slave_info;
|
struct msm_camera_slave_info *slave_info;
|
||||||
struct msm_camera_csi_lane_params *csi_lane_params;
|
struct msm_camera_csi_lane_params *csi_lane_params;
|
||||||
struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
|
struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
|
||||||
|
|
Loading…
Add table
Reference in a new issue