static int32_t msm_sensor_driver_platform_probe(struct platform_device *pdev) { int32_t rc = 0; struct msm_sensor_ctrl_t *s_ctrl = NULL; /* Create sensor control structure */ s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL); if (!s_ctrl) { pr_err("failed: no memory s_ctrl %p", s_ctrl); return -ENOMEM; } platform_set_drvdata(pdev, s_ctrl); /* Initialize sensor device type */ s_ctrl->sensor_device_type = MSM_CAMERA_PLATFORM_DEVICE; s_ctrl->of_node = pdev->dev.of_node; rc = msm_sensor_driver_parse(s_ctrl); if (rc < 0) { pr_err("failed: msm_sensor_driver_parse rc %d", rc); goto FREE_S_CTRL; } /* Fill platform device */ pdev->id = s_ctrl->id; s_ctrl->pdev = pdev; /* Fill device in power info */ s_ctrl->sensordata->power_info.dev = &pdev->dev; return rc; FREE_S_CTRL: kfree(s_ctrl); return rc; }
static int32_t msm_sensor_driver_platform_probe(struct platform_device *pdev) { int32_t rc = 0; struct msm_sensor_ctrl_t *s_ctrl = NULL; struct v4l2_subdev *subdev_flash[1] = {NULL}; struct device_node *src_node = NULL; /* Create sensor control structure */ s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL); if (!s_ctrl) { pr_err("failed: no memory s_ctrl %p", s_ctrl); return -ENOMEM; } platform_set_drvdata(pdev, s_ctrl); /* Initialize sensor device type */ s_ctrl->sensor_device_type = MSM_CAMERA_PLATFORM_DEVICE; s_ctrl->of_node = pdev->dev.of_node; rc = msm_sensor_driver_parse(s_ctrl); if (rc < 0) { pr_err("failed: msm_sensor_driver_parse rc %d", rc); goto FREE_S_CTRL; } //check flash subdev id, don't care the value of "qcom,led-flash-src" in dtsi. if(s_ctrl->of_node) { src_node = of_parse_phandle(s_ctrl->of_node, "qcom,led-flash-src", 0); if (!src_node) { CDBG("%s:%d led-flash-src node NULL,do not config flash\n", __func__, __LINE__); } else { msm_sd_get_subdevs(subdev_flash,1,"msm_flash"); if(subdev_flash[0] != NULL) { uint32_t flash_subdev_id = 0; v4l2_subdev_call(subdev_flash[0], core, ioctl, VIDIOC_MSM_SENSOR_GET_SUBDEV_ID, &flash_subdev_id); s_ctrl->sensordata->sensor_info->subdev_id[SUB_MODULE_LED_FLASH] = flash_subdev_id; CDBG("%s: flash subdev id = %d \n",__func__,flash_subdev_id); } } } /* Fill platform device */ pdev->id = s_ctrl->id; s_ctrl->pdev = pdev; /* Fill device in power info */ s_ctrl->sensordata->power_info.dev = &pdev->dev; return rc; FREE_S_CTRL: kfree(s_ctrl); return rc; }
static int32_t msm_sensor_driver_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int32_t rc = 0; struct msm_sensor_ctrl_t *s_ctrl; CDBG("\n\nEnter: msm_sensor_driver_i2c_probe"); 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; } /* Create sensor control structure */ s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL); if (!s_ctrl) { pr_err("failed: no memory s_ctrl %p", s_ctrl); return -ENOMEM; } i2c_set_clientdata(client, s_ctrl); /* Initialize sensor device type */ s_ctrl->sensor_device_type = MSM_CAMERA_I2C_DEVICE; s_ctrl->of_node = client->dev.of_node; rc = msm_sensor_driver_parse(s_ctrl); if (rc < 0) { pr_err("failed: msm_sensor_driver_parse rc %d", rc); goto FREE_S_CTRL; } if (s_ctrl->sensor_i2c_client != NULL) { s_ctrl->sensor_i2c_client->client = client; s_ctrl->sensordata->power_info.dev = &client->dev; } return rc; FREE_S_CTRL: kfree(s_ctrl); return rc; }
static int32_t msm_sensor_driver_platform_probe(struct platform_device *pdev) { int32_t rc = 0; struct msm_sensor_ctrl_t *s_ctrl = NULL; /* Create sensor control structure */ s_ctrl = kzalloc(sizeof(*s_ctrl), GFP_KERNEL); if (!s_ctrl) { pr_err("failed: no memory s_ctrl %p", s_ctrl); return -ENOMEM; } platform_set_drvdata(pdev, s_ctrl); /* Initialize sensor device type */ s_ctrl->sensor_device_type = MSM_CAMERA_PLATFORM_DEVICE; s_ctrl->of_node = pdev->dev.of_node; rc = msm_sensor_driver_parse(s_ctrl); if (rc < 0) { pr_err("failed: msm_sensor_driver_parse rc %d", rc); goto FREE_S_CTRL; } /* Fill platform device */ pdev->id = s_ctrl->id; s_ctrl->pdev = pdev; /* Fill device in power info */ s_ctrl->sensordata->power_info.dev = &pdev->dev; #ifdef VENDOR_EDIT /*zhengrong.zhang, 2015/04/15, add for pdaf engineer mode*/ if (BACK_CAMERA_B == s_ctrl->sensordata->sensor_info->position) msm_sensor_driver_pdaf_proc_init(); #endif return rc; FREE_S_CTRL: kfree(s_ctrl); return rc; }