int32_t msm_sensor_probe(struct msm_sensor_ctrl_t *s_ctrl, const struct msm_camera_sensor_info *info, struct msm_sensor_ctrl *s) { int rc = 0; rc = i2c_add_driver(s_ctrl->sensor_i2c_driver); if (rc < 0 || s_ctrl->sensor_i2c_client->client == NULL) { rc = -ENOTSUPP; CDBG("I2C add driver failed"); goto probe_fail; } #if !defined(CONFIG_S5C73M3) && !defined(CONFIG_S5K6A3YX) rc = s_ctrl->func_tbl->sensor_power_up(info); if (rc < 0) goto probe_fail; rc = msm_sensor_match_id(s_ctrl); if (rc < 0) goto probe_fail; if (s_ctrl->sensor_eeprom_client != NULL) { struct msm_camera_eeprom_client *eeprom_client = s_ctrl->sensor_eeprom_client; if (eeprom_client->func_tbl.eeprom_init != NULL && eeprom_client->func_tbl.eeprom_release != NULL) { rc = eeprom_client->func_tbl.eeprom_init( eeprom_client, s_ctrl->sensor_i2c_client->client->adapter); if (rc < 0) goto probe_fail; rc = msm_camera_eeprom_read_tbl(eeprom_client, eeprom_client->read_tbl, eeprom_client->read_tbl_size); eeprom_client->func_tbl.eeprom_release(eeprom_client); if (rc < 0) goto probe_fail; } } #endif s->s_init = s_ctrl->func_tbl->sensor_open_init; s->s_release = s_ctrl->func_tbl->sensor_release; s->s_config = s_ctrl->func_tbl->sensor_config; s->s_camera_type = info->camera_type; if (info->sensor_platform_info != NULL) s->s_mount_angle = info->sensor_platform_info->mount_angle; else s->s_mount_angle = 0; goto power_down; probe_fail: i2c_del_driver(s_ctrl->sensor_i2c_driver); power_down: #if !defined(CONFIG_S5C73M3) && !defined(CONFIG_S5K6A3YX) s_ctrl->func_tbl->sensor_power_down(info); #endif return rc; }
int32_t msm_eeprom_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; struct msm_eeprom_ctrl_t *e_ctrl_t = NULL; CDBG("%s called\n", __func__); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { pr_err("i2c_check_functionality failed\n"); goto probe_failure; } e_ctrl_t = (struct msm_eeprom_ctrl_t *)(id->driver_data); e_ctrl_t->i2c_client.client = client; if (e_ctrl_t->i2c_addr != 0) e_ctrl_t->i2c_client.client->addr = e_ctrl_t->i2c_addr; CDBG("%s client = %x\n", __func__, (unsigned int) client); /* Assign name for sub device */ snprintf(e_ctrl_t->sdev.name, sizeof(e_ctrl_t->sdev.name), "%s", e_ctrl_t->i2c_driver->driver.name); if (e_ctrl_t->func_tbl.eeprom_init != NULL) { rc = e_ctrl_t->func_tbl.eeprom_init(e_ctrl_t, e_ctrl_t->i2c_client.client->adapter); } msm_camera_eeprom_read_tbl(e_ctrl_t, e_ctrl_t->read_tbl, e_ctrl_t->read_tbl_size); if (e_ctrl_t->func_tbl.eeprom_format_data != NULL) e_ctrl_t->func_tbl.eeprom_format_data(); if (e_ctrl_t->func_tbl.eeprom_release != NULL) rc = e_ctrl_t->func_tbl.eeprom_release(e_ctrl_t); /* Initialize sub device */ v4l2_i2c_subdev_init(&e_ctrl_t->sdev, e_ctrl_t->i2c_client.client, e_ctrl_t->eeprom_v4l2_subdev_ops); CDBG("%s success resut=%d\n", __func__, rc); return rc; probe_failure: pr_err("%s failed! rc = %d\n", __func__, rc); return rc; }
int32_t msm_sensor_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; struct msm_sensor_ctrl_t *s_ctrl; CDBG("%s_i2c_probe called\n", client->name); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { pr_err("%s %s i2c_check_functionality failed\n", __func__, client->name); rc = -EFAULT; return rc; } s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data); if (s_ctrl->sensor_i2c_client != NULL) { s_ctrl->sensor_i2c_client->client = client; if (s_ctrl->sensor_i2c_addr != 0) s_ctrl->sensor_i2c_client->client->addr = s_ctrl->sensor_i2c_addr; } else { pr_err("%s %s sensor_i2c_client NULL\n", __func__, client->name); rc = -EFAULT; return rc; } s_ctrl->sensordata = client->dev.platform_data; if (s_ctrl->sensordata == NULL) { pr_err("%s %s NULL sensor data\n", __func__, client->name); return -EFAULT; } rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl); if (rc < 0) { pr_err("%s %s power up failed\n", __func__, client->name); return rc; } if (s_ctrl->func_tbl->sensor_match_id) rc = s_ctrl->func_tbl->sensor_match_id(s_ctrl); else rc = msm_sensor_match_id(s_ctrl); if (rc < 0) goto probe_fail; if (s_ctrl->sensor_eeprom_client != NULL) { struct msm_camera_eeprom_client *eeprom_client = s_ctrl->sensor_eeprom_client; if (eeprom_client->func_tbl.eeprom_init != NULL && eeprom_client->func_tbl.eeprom_release != NULL) { rc = eeprom_client->func_tbl.eeprom_init( eeprom_client, s_ctrl->sensor_i2c_client->client->adapter); if (rc < 0) goto probe_fail; rc = msm_camera_eeprom_read_tbl(eeprom_client, eeprom_client->read_tbl, eeprom_client->read_tbl_size); eeprom_client->func_tbl.eeprom_release(eeprom_client); if (rc < 0) goto probe_fail; } } snprintf(s_ctrl->sensor_v4l2_subdev.name, sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name); v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client, s_ctrl->sensor_v4l2_subdev_ops); msm_sensor_register(&s_ctrl->sensor_v4l2_subdev); goto power_down; probe_fail: pr_err("%s %s_i2c_probe failed\n", __func__, client->name); power_down: if (rc > 0) rc = 0; s_ctrl->func_tbl->sensor_power_down(s_ctrl); return rc; }
int32_t imx105_sunny_msm_sensor_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; int ret = 0; struct msm_sensor_ctrl_t *s_ctrl; CDBG("%s_i2c_probe called\n", client->name); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { CDBG("i2c_check_functionality failed\n"); rc = -EFAULT; return rc; } s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data); if (s_ctrl->sensor_i2c_client != NULL) { s_ctrl->sensor_i2c_client->client = client; if (s_ctrl->sensor_i2c_addr != 0) s_ctrl->sensor_i2c_client->client->addr = s_ctrl->sensor_i2c_addr; } else { rc = -EFAULT; return rc; } s_ctrl->sensordata = client->dev.platform_data; if (s_ctrl->sensordata == NULL) { pr_err("%s: NULL sensor data\n", __func__); return -EFAULT; } rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl); if (rc < 0) goto probe_fail; rc = msm_sensor_match_id(s_ctrl); if (rc < 0) goto probe_fail; /*zhanglijun add for otp begin*/ ret= imx105_sunny_otp_data_read(); if(ret < 0) printk("imx105_sunny ========= otp read data error!\n"); /*zhanglijun add for otp end*/ #if 0 if (s_ctrl->sensor_eeprom_client != NULL) { struct msm_camera_eeprom_client *eeprom_client = s_ctrl->sensor_eeprom_client; if (eeprom_client->func_tbl.eeprom_init != NULL && eeprom_client->func_tbl.eeprom_release != NULL) { rc = eeprom_client->func_tbl.eeprom_init( eeprom_client, s_ctrl->sensor_i2c_client->client->adapter); if (rc < 0) goto probe_fail; rc = msm_camera_eeprom_read_tbl(eeprom_client, eeprom_client->read_tbl, eeprom_client->read_tbl_size); eeprom_client->func_tbl.eeprom_release(eeprom_client); if (rc < 0) goto probe_fail; } } #endif snprintf(s_ctrl->sensor_v4l2_subdev.name, sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name); v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client, s_ctrl->sensor_v4l2_subdev_ops); if(s_ctrl->sensor_name) { strncpy((char *)s_ctrl->sensordata->sensor_name, s_ctrl->sensor_name, CAMERA_NAME_LEN -1); printk("the name for project menu is %s\n", s_ctrl->sensordata->sensor_name); } msm_sensor_register(&s_ctrl->sensor_v4l2_subdev); goto power_down; probe_fail: CDBG("%s_i2c_probe failed\n", client->name); power_down: if (rc > 0) rc = 0; s_ctrl->func_tbl->sensor_power_down(s_ctrl); return rc; }
int32_t msm_sensor_probe(struct msm_sensor_ctrl_t *s_ctrl, const struct msm_camera_sensor_info *info, struct msm_sensor_ctrl *s) { int rc = 0; pr_info("%s\n", __func__); rc = i2c_add_driver(s_ctrl->sensor_i2c_driver); if (rc < 0 || s_ctrl->sensor_i2c_client->client == NULL) { rc = -ENOTSUPP; #if 1 /* HTC_START */ pr_err("%s: _probe_failure I2C add driver failed\n", __func__); i2c_del_driver(s_ctrl->sensor_i2c_driver); return rc; #else CDBG("I2C add driver failed"); goto probe_fail; #endif /* HTC_END */ } rc = s_ctrl->func_tbl->sensor_power_up(info); if (rc < 0) goto probe_fail; rc = msm_sensor_match_id(s_ctrl); if (rc < 0) goto probe_fail; if (s_ctrl->sensor_eeprom_client != NULL) { struct msm_camera_eeprom_client *eeprom_client = s_ctrl->sensor_eeprom_client; if (eeprom_client->func_tbl.eeprom_init != NULL && eeprom_client->func_tbl.eeprom_release != NULL) { rc = eeprom_client->func_tbl.eeprom_init( eeprom_client, s_ctrl->sensor_i2c_client->client->adapter); if (rc < 0) goto probe_fail; rc = msm_camera_eeprom_read_tbl(eeprom_client, eeprom_client->read_tbl, eeprom_client->read_tbl_size); eeprom_client->func_tbl.eeprom_release(eeprom_client); if (rc < 0) goto probe_fail; } } s->s_init = s_ctrl->func_tbl->sensor_open_init; s->s_release = s_ctrl->func_tbl->sensor_release; s->s_config = s_ctrl->func_tbl->sensor_config; s->s_camera_type = info->camera_type; if (info->sensor_platform_info != NULL) s->s_mount_angle = info->sensor_platform_info->mount_angle; else s->s_mount_angle = 0; pr_info("%s: probe_done\n", __func__); goto power_down; probe_fail: pr_warning("%s: _probe_failure\n", __func__); i2c_del_driver(s_ctrl->sensor_i2c_driver); power_down: s_ctrl->func_tbl->sensor_power_down(info); return rc; }
int32_t msm_ov9740_sensor_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; struct msm_sensor_ctrl_t *s_ctrl; pr_err("%s_i2c_probe called\n", client->name); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { pr_err("i2c_check_functionality failed\n"); rc = -EFAULT; return rc; } s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data); if (s_ctrl->sensor_i2c_client != NULL) { s_ctrl->sensor_i2c_client->client = client; if (s_ctrl->sensor_i2c_addr != 0) s_ctrl->sensor_i2c_client->client->addr = s_ctrl->sensor_i2c_addr; } else { rc = -EFAULT; return rc; } s_ctrl->sensordata = client->dev.platform_data; if (s_ctrl->sensordata == NULL) { pr_err("%s: NULL sensor data\n", __func__); return -EFAULT; } s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *) * s_ctrl->sensordata->sensor_platform_info->num_vreg, GFP_KERNEL); if (!s_ctrl->reg_ptr) { pr_err("%s: could not allocate mem for regulators\n", __func__); return -ENOMEM; } pr_err("%s: %d\n", __func__, __LINE__); s_ctrl->func_tbl->sensor_power_up(s_ctrl); #ifdef CONFIG_SENSOR_INFO msm_sensorinfo_set_front_sensor_id(s_ctrl->sensor_id_info->sensor_id); #else //do nothing here #endif rc = msm_sensor_match_id(s_ctrl); if (rc < 0) goto probe_fail; if (s_ctrl->sensor_eeprom_client != NULL) { struct msm_camera_eeprom_client *eeprom_client = s_ctrl->sensor_eeprom_client; if (eeprom_client->func_tbl.eeprom_init != NULL && eeprom_client->func_tbl.eeprom_release != NULL) { rc = eeprom_client->func_tbl.eeprom_init( eeprom_client, s_ctrl->sensor_i2c_client->client->adapter); if (rc < 0) goto probe_fail; rc = msm_camera_eeprom_read_tbl(eeprom_client, eeprom_client->read_tbl, eeprom_client->read_tbl_size); eeprom_client->func_tbl.eeprom_release(eeprom_client); if (rc < 0) goto probe_fail; } } snprintf(s_ctrl->sensor_v4l2_subdev.name, sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name); v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client, s_ctrl->sensor_v4l2_subdev_ops); msm_sensor_register(&s_ctrl->sensor_v4l2_subdev); goto power_down; probe_fail: pr_err("%s_i2c_probe failed\n", client->name); power_down: if (rc > 0) rc = 0; s_ctrl->func_tbl->sensor_power_down(s_ctrl); s_ctrl->func_tbl->sensor_power_up(s_ctrl); if (s_ctrl->func_tbl->sensor_setting(s_ctrl, MSM_SENSOR_REG_INIT, 0) < 0) { pr_err("%s sensor_setting init failed\n",__func__); return rc; } if (s_ctrl->func_tbl->sensor_setting(s_ctrl, MSM_SENSOR_UPDATE_PERIODIC, 0) < 0) { pr_err("%s sensor_setting init failed\n",__func__); return rc; } msleep(10); s_ctrl->func_tbl->sensor_power_down(s_ctrl); return rc; }
int32_t msm_sensor_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; char front_cam[10] = "mt9m114"; struct msm_sensor_ctrl_t *s_ctrl; CDBG("%s_i2c_probe called\n", client->name); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { CDBG("i2c_check_functionality failed\n"); rc = -EFAULT; return rc; } s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data); if (s_ctrl->sensor_i2c_client != NULL) { s_ctrl->sensor_i2c_client->client = client; if (s_ctrl->sensor_i2c_addr != 0) s_ctrl->sensor_i2c_client->client->addr = s_ctrl->sensor_i2c_addr; } else { rc = -EFAULT; return rc; } s_ctrl->sensordata = client->dev.platform_data; if (s_ctrl->sensordata == NULL) { pr_err("%s: NULL sensor data\n", __func__); return -EFAULT; } rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl); if (rc < 0) goto probe_fail; rc = msm_sensor_match_id(s_ctrl); /*BEGIN Chaoyen_Wu@pegatron[2012.4.12][front camera 2nd source porting]*/ if(rc < 0 && !(strcmp(client->name, front_cam))){ s_ctrl->sensor_i2c_client->client->addr = s_ctrl->sensor_i2c_addr_high; CDBG("2nd source i2c addr: 0x%x\n",s_ctrl->sensor_i2c_client->client->addr); rc = msm_sensor_match_id(s_ctrl); } /*END Chaoyen_Wu@pegatron[2012.4.12][front camera 2nd source porting]*/ if (rc < 0) goto probe_fail; if (s_ctrl->sensor_eeprom_client != NULL) { struct msm_camera_eeprom_client *eeprom_client = s_ctrl->sensor_eeprom_client; if (eeprom_client->func_tbl.eeprom_init != NULL && eeprom_client->func_tbl.eeprom_release != NULL) { rc = eeprom_client->func_tbl.eeprom_init( eeprom_client, s_ctrl->sensor_i2c_client->client->adapter); if (rc < 0) goto probe_fail; rc = msm_camera_eeprom_read_tbl(eeprom_client, eeprom_client->read_tbl, eeprom_client->read_tbl_size); eeprom_client->func_tbl.eeprom_release(eeprom_client); if (rc < 0) goto probe_fail; } } snprintf(s_ctrl->sensor_v4l2_subdev.name, sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name); v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client, s_ctrl->sensor_v4l2_subdev_ops); msm_sensor_register(&s_ctrl->sensor_v4l2_subdev); goto power_down; probe_fail: CDBG("%s_i2c_probe failed\n", client->name); power_down: if (rc > 0) rc = 0; s_ctrl->func_tbl->sensor_power_down(s_ctrl); return rc; }