int32_t hm03d5_power_down(struct msm_sensor_ctrl_t *s_ctrl) { struct msm_camera_sensor_info *data = s_ctrl->sensordata; struct device *dev = NULL; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) dev = &s_ctrl->pdev->dev; else dev = &s_ctrl->sensor_i2c_client->client->dev; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) { msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_RELEASE); } if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(0); if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE) msm_cam_clk_enable(dev, cam_8960_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8960_clk_info), 0); else msm_cam_clk_enable(dev, cam_8974_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8974_clk_info), 0); msm_camera_config_gpio_table(data, 0); msm_camera_request_gpio_table(data, 0); return 0; }
int32_t msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { struct msm_camera_sensor_info *data = s_ctrl->sensordata; CDBG("%s\n", __func__); if (s_ctrl->sensor_i2c_client->cci_client) { msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_RELEASE); } if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(0); msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev, cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 0); msm_camera_config_gpio_table(data, 0); msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->reg_ptr, 0); msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->reg_ptr, 0); msm_camera_request_gpio_table(data, 0); kfree(s_ctrl->reg_ptr); return 0; }
int32_t imx119_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; struct device *dev = NULL; CDBG("%s\n", __func__); pr_err("%s\n", __func__); pr_err( " %s : E sensor name is %s \n",__func__, s_ctrl->sensordata->sensor_name); if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) dev = &s_ctrl->pdev->dev; else dev = &s_ctrl->sensor_i2c_client->client->dev; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) { msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_RELEASE); } if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) imx119_msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(0); msm_cam_clk_enable(dev, imx119_cam_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(imx119_cam_clk_info), 0); usleep(5); LDBGI("%s: Revision [%d] MSM_CAM2_RST_EN GPIO No.%d\n",__func__, lge_get_board_revno(), MSM_CAM2_RST_EN ); rc = gpio_direction_output(MSM_CAM2_RST_EN, 0 ); msm_camera_config_gpio_table(data, 0); msm_camera_enable_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); msm_camera_config_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); msm_camera_request_gpio_table(data, 0); kfree(s_ctrl->reg_ptr); s_ctrl->curr_res = MSM_SENSOR_INVALID_RES; pr_err( " %s : X sensor name is %s \n",__func__, s_ctrl->sensordata->sensor_name); gpio_free(MSM_CAM2_RST_EN); return 0; }
int32_t mt9m114_msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { struct msm_camera_sensor_info *data = s_ctrl->sensordata; struct device *dev = NULL; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) dev = &s_ctrl->pdev->dev; else dev = &s_ctrl->sensor_i2c_client->client->dev; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) { msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_RELEASE); } if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(0); if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE) msm_cam_clk_enable(dev, cam_8960_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8960_clk_info), 0); else msm_cam_clk_enable(dev, cam_8974_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8974_clk_info), 0); msm_camera_config_gpio_table(data, 0); if(!mt9m114_IsPowered){ pr_err("%s: power down\n", __func__); msm_camera_enable_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); msm_camera_config_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); kfree(s_ctrl->reg_ptr); } msm_camera_request_gpio_table(data, 0); s_ctrl->curr_res = MSM_SENSOR_INVALID_RES; return 0; }
int32_t imx119_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; struct device *dev = NULL; CDBG("%s: %d\n", __func__, __LINE__); if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) dev = &s_ctrl->pdev->dev; else dev = &s_ctrl->sensor_i2c_client->client->dev; s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *) * data->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: before request gpio, sensor name : %s", __func__, s_ctrl->sensordata->sensor_name); rc = msm_camera_request_gpio_table(data, 1); if (rc < 0) { pr_err("%s: request gpio failed\n", __func__); goto request_gpio_failed; } rc = msm_camera_config_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 1); if (rc < 0) { LDBGE("%s: regulator on failed\n", __func__); goto config_vreg_failed; } /* */ rc = gpio_request(MSM_CAM2_RST_EN, "VTCAM_RST_EN"); if (rc) { LDBGE("%s: PM request gpio failed\n", __func__); } /* */ rc = msm_camera_enable_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 1); if (rc < 0) { LDBGE("%s: enable regulator failed\n", __func__); goto enable_vreg_failed; } /* */ usleep(100); rc =pm8xxx_gpio_config(MSM_CAM2_RST_EN, &gpio28_param); if (rc) { LDBGE("%s: pm8xxx_gpio_config on failed\n", __func__); } /* */ rc = gpio_direction_output(MSM_CAM2_RST_EN, 1); rc = msm_camera_config_gpio_table(data, 1); if (rc < 0) { LDBGE("%s: config gpio failed\n", __func__); goto config_gpio_failed; } if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE) { if (s_ctrl->clk_rate != 0) imx119_cam_clk_info->clk_rate = s_ctrl->clk_rate; rc = msm_cam_clk_enable(dev, imx119_cam_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(imx119_cam_clk_info), 1); if (rc < 0) { pr_err("%s: clk enable failed\n", __func__); goto enable_clk_failed; } } if (!s_ctrl->power_seq_delay) usleep_range(1000, 2000); else if (s_ctrl->power_seq_delay < 20) usleep_range((s_ctrl->power_seq_delay * 1000), ((s_ctrl->power_seq_delay * 1000) + 1000)); else msleep(s_ctrl->power_seq_delay); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(1); if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) imx119_msm_sensor_enable_i2c_mux(data->sensor_platform_info->i2c_conf); if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) { rc = msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_INIT); if (rc < 0) { pr_err("%s cci_init failed\n", __func__); goto cci_init_failed; } } s_ctrl->curr_res = MSM_SENSOR_INVALID_RES; pr_err( " %s : X sensor name is %s \n",__func__, s_ctrl->sensordata->sensor_name); return rc; cci_init_failed: if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) imx119_msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); enable_clk_failed: rc = gpio_direction_output(MSM_CAM2_RST_EN, 0); msm_camera_config_gpio_table(data, 0); config_gpio_failed: msm_camera_enable_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); enable_vreg_failed: msm_camera_config_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); config_vreg_failed: msm_camera_request_gpio_table(data, 0); request_gpio_failed: kfree(s_ctrl->reg_ptr); return rc; }
int32_t mt9m114_msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; struct device *dev = NULL; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) dev = &s_ctrl->pdev->dev; else dev = &s_ctrl->sensor_i2c_client->client->dev; rc = msm_camera_request_gpio_table(data, 1); if (rc < 0) { pr_err("%s: request gpio failed\n", __func__); goto request_gpio_failed; } if(!mt9m114_IsPowered){ s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *) * data->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: power up\n", __func__); rc = msm_camera_config_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 1); if (rc < 0) { pr_err("%s: regulator on failed\n", __func__); goto config_vreg_failed; } rc = msm_camera_enable_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 1); if (rc < 0) { pr_err("%s: enable regulator failed\n", __func__); goto enable_vreg_failed; } mt9m114_IsPowered=1; } rc = msm_camera_config_gpio_table(data, 1); if (rc < 0) { pr_err("%s: config gpio failed\n", __func__); goto config_gpio_failed; } if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE) { if (s_ctrl->clk_rate != 0) cam_8960_clk_info->clk_rate = s_ctrl->clk_rate; rc = msm_cam_clk_enable(dev, cam_8960_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8960_clk_info), 1); if (rc < 0) { pr_err("%s: clk enable failed\n", __func__); goto enable_clk_failed; } } else { rc = msm_cam_clk_enable(dev, cam_8974_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8974_clk_info), 1); if (rc < 0) { pr_err("%s: clk enable failed\n", __func__); goto enable_clk_failed; } } if (!s_ctrl->power_seq_delay) usleep_range(1000, 2000); else if (s_ctrl->power_seq_delay < 20) usleep_range((s_ctrl->power_seq_delay * 1000), ((s_ctrl->power_seq_delay * 1000) + 1000)); else msleep(s_ctrl->power_seq_delay); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(1); if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_enable_i2c_mux(data->sensor_platform_info->i2c_conf); if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) { rc = msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_INIT); if (rc < 0) { pr_err("%s cci_init failed\n", __func__); goto cci_init_failed; } } s_ctrl->curr_res = MSM_SENSOR_INVALID_RES; return rc; cci_init_failed: if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); enable_clk_failed: msm_camera_config_gpio_table(data, 0); config_gpio_failed: msm_camera_enable_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); enable_vreg_failed: msm_camera_config_vreg(dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->vreg_seq, s_ctrl->num_vreg_seq, s_ctrl->reg_ptr, 0); if(mt9m114_IsPowered==1) mt9m114_IsPowered=0; config_vreg_failed: msm_camera_request_gpio_table(data, 0); request_gpio_failed: kfree(s_ctrl->reg_ptr); return rc; }
int32_t hm03d5_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; struct device *dev = NULL; if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) dev = &s_ctrl->pdev->dev; else dev = &s_ctrl->sensor_i2c_client->client->dev; rc = msm_camera_request_gpio_table(data, 1); if (rc < 0) { pr_err("%s: request gpio failed\n", __func__); goto request_gpio_failed; } rc = msm_camera_config_gpio_table(data, 1); if (rc < 0) { pr_err("%s: config gpio failed\n", __func__); goto config_gpio_failed; } if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE) { if (s_ctrl->clk_rate != 0) cam_8960_clk_info->clk_rate = s_ctrl->clk_rate; rc = msm_cam_clk_enable(dev, cam_8960_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8960_clk_info), 1); if (rc < 0) { pr_err("%s: clk enable failed\n", __func__); goto enable_clk_failed; } } else { rc = msm_cam_clk_enable(dev, cam_8974_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_8974_clk_info), 1); if (rc < 0) { pr_err("%s: clk enable failed\n", __func__); goto enable_clk_failed; } } if (!s_ctrl->power_seq_delay) usleep_range(1000, 2000); else if (s_ctrl->power_seq_delay < 20) usleep_range((s_ctrl->power_seq_delay * 1000), ((s_ctrl->power_seq_delay * 1000) + 1000)); else msleep(s_ctrl->power_seq_delay); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(1); if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_enable_i2c_mux(data->sensor_platform_info->i2c_conf); if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) { rc = msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_INIT); if (rc < 0) { pr_err("%s cci_init failed\n", __func__); goto cci_init_failed; } } s_ctrl->curr_res = MSM_SENSOR_INVALID_RES; return rc; cci_init_failed: if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); enable_clk_failed: msm_camera_config_gpio_table(data, 0); config_gpio_failed: msm_camera_request_gpio_table(data, 0); request_gpio_failed: return rc; }
int32_t msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; CDBG("%s: %d\n", __func__, __LINE__); s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *) * data->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; } rc = msm_camera_request_gpio_table(data, 1); if (rc < 0) { pr_err("%s: request gpio failed\n", __func__); goto request_gpio_failed; } rc = msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->reg_ptr, 1); if (rc < 0) { pr_err("%s: regulator on failed\n", __func__); goto config_vreg_failed; } rc = msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->reg_ptr, 1); if (rc < 0) { pr_err("%s: enable regulator failed\n", __func__); goto enable_vreg_failed; } rc = msm_camera_config_gpio_table(data, 1); if (rc < 0) { pr_err("%s: config gpio failed\n", __func__); goto config_gpio_failed; } if (s_ctrl->clk_rate != 0) cam_clk_info->clk_rate = s_ctrl->clk_rate; rc = msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev, cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 1); if (rc < 0) { pr_err("%s: clk enable failed\n", __func__); goto enable_clk_failed; } usleep_range(1000, 2000); if (data->sensor_platform_info->ext_power_ctrl != NULL) data->sensor_platform_info->ext_power_ctrl(1); if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_enable_i2c_mux(data->sensor_platform_info->i2c_conf); if (s_ctrl->sensor_i2c_client->cci_client) { rc = msm_sensor_cci_util(s_ctrl->sensor_i2c_client, MSM_CCI_INIT); if (rc < 0) { pr_err("%s cci_init failed\n", __func__); goto cci_init_failed; } } return rc; cci_init_failed: if (data->sensor_platform_info->i2c_conf && data->sensor_platform_info->i2c_conf->use_i2c_mux) msm_sensor_disable_i2c_mux( data->sensor_platform_info->i2c_conf); enable_clk_failed: msm_camera_config_gpio_table(data, 0); config_gpio_failed: msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->reg_ptr, 0); enable_vreg_failed: msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev, s_ctrl->sensordata->sensor_platform_info->cam_vreg, s_ctrl->sensordata->sensor_platform_info->num_vreg, s_ctrl->reg_ptr, 0); config_vreg_failed: msm_camera_request_gpio_table(data, 0); request_gpio_failed: kfree(s_ctrl->reg_ptr); return rc; }