int32_t as0260_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; SKYCDBG("%s\n", __func__); msm_sensor_power_down(s_ctrl); SKYCDBG(" %s : msm_sensor_power_down : rc = %d E\n",__func__, rc); if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; mdelay(1); /* > 20 cycles (approx. 0.64us) */ if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_A_2P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_IO_1P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_I2C_1P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 0) < 0) rc = -EIO; svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); SKYCDBG("%s X (%d)\n", __func__, rc); return rc; }
//mt9d113_sensor_power_down int32_t mt9d113_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; CDBG("%s E\n", __func__); msm_sensor_power_down(s_ctrl); CDBG(" %s : msm_sensor_power_down : rc = %d E\n",__func__, rc); if (sgpio_ctrl(sgpios, CAMIO_F_STB, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 0) < 0) rc = -EIO; mdelay(1); /* MCLK will be disabled once again after this. */ // (void)msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK); if (svreg_ctrl(svregs, CAMV_IO_1P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_A_2P8V, 0) < 0) rc = -EIO; mdelay(1); if (sgpio_ctrl(sgpios, CAMIO_R_RST_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_R_STB_N, 0) < 0) rc = -EIO; mdelay(1); svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); si2c_release(); CDBG("%s X (%d)\n", __func__, rc); return rc; }
int ov680_sensor_standby_power_down(struct msm_sensor_ctrl_t *s_ctrl) { #ifndef OV680_SUPPORT_STANDBY ov680_info("%s line %d", __func__, __LINE__); return msm_sensor_power_down(s_ctrl); #else int rc = 0; ov680_info("%s line %d", __func__, __LINE__); if (ov680_props.state != OV680_STATE_IDLE) { ov680_err("%s Standby has bad state: %d %d, forcing to idle", __func__, ov680_props.state, __LINE__); ov680_fwi_run(OV680_FWI_IDLE, 0); // do it anyways? typically want shutdown procedures to always work. } if (ov680_props.fw_state == OV680_FW_MISSING) { ov680_dbg("%s firmware not loaded regular power_down %d", __func__, __LINE__); /* Release PWDN gpio, it's not part of the DTS GPIO list */ msm_camera_request_gpio_table(standby_gpios, 1, 0); rc = msm_sensor_power_down(s_ctrl); goto end; } ov680_dbg("%s Entering standby %d", __func__, __LINE__); rc = ov680_fwi_run_force(OV680_FWI_FIRMWARE, OV680_FIRMWARE_STANDBY); if (rc) { ov680_err("%s standby enter failed %d", __func__, __LINE__); } rc = ov680_power_down(s_ctrl, ov680_standby_power_setting, ARRAY_SIZE(ov680_standby_power_setting)); if (rc) { ov680_err("%s power down failed %d", __func__, __LINE__); goto end; } ov680_props.state = OV680_STATE_STANDBY; end: return rc; #endif }
/* this never gets called as we have a platfrom driver and not an i2c driver */ int ov680_sensor_standby_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { #ifndef OV680_SUPPORT_STANDBY int rc; ov680_info("%s line %d", __func__, __LINE__); ov680_skip_fw_load = 1; rc = msm_sensor_i2c_probe(client, id); ov680_skip_fw_load = 0; return rc; #else int rc; ov680_info("%s line %d", __func__, __LINE__); // Essentially use the original msm power commands to power on // On failure, power down MSM style too. ov680_props.fw_state = OV680_FW_MISSING; ov680_props.state = OV680_STATE_OFF; rc = msm_sensor_i2c_probe(client, id); if (rc) { // In the case of a camera subsystem failure during boot up (probe failed) // it is necessary to turn everything on just so it can all be turned off again! ov680_props.state = OV680_STATE_UNWIND; ov680_sensor_standby_power_up(&ov680_s_ctrl); msm_sensor_power_down(&ov680_s_ctrl); ov680_props.state = OV680_STATE_OFF; return rc; } rc = ov680_sensor_standby_power_up(&ov680_s_ctrl); if (rc) { ov680_err("Unable to load firmware - power on failed.\n"); msm_sensor_power_down(&ov680_s_ctrl); ov680_props.state = OV680_STATE_OFF; return rc; } rc = ov680_fwi_run_force(OV680_FWI_FIRMWARE, OV680_FIRMWARE_INIT); ov680_props.fw_state = OV680_FW_LOADED; ov680_sensor_standby_power_down(&ov680_s_ctrl); return rc; #endif }
int32_t ov8858_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; camera_af_software_powerdown(s_ctrl->sensor_i2c_client->client); rc = msm_sensor_power_down(s_ctrl); return rc; }
int32_t s5k5ca_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { struct msm_camera_sensor_info *info = NULL; //printk(" s5k5ca_sensor_power_down()\n"); info = s_ctrl->sensordata; gpio_direction_output(info->sensor_pwd, 0); gpio_direction_output(info->sensor_reset, 0); usleep_range(5000, 5100); msm_sensor_power_down(s_ctrl); return 0; }
int32_t imx081_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { long fps = 0; uint16_t ll_pclk; uint16_t fl_lines; uint32_t delay = 0; CDBG("%s\n", __func__); s_ctrl->sensor_i2c_client->i2c_func_tbl->i2c_write( s_ctrl->sensor_i2c_client, 0x0100, 0x00, MSM_CAMERA_I2C_BYTE_DATA); s_ctrl->sensor_i2c_client->i2c_func_tbl->i2c_read( s_ctrl->sensor_i2c_client, 0x342, &ll_pclk, MSM_CAMERA_I2C_WORD_DATA); s_ctrl->sensor_i2c_client->i2c_func_tbl->i2c_read( s_ctrl->sensor_i2c_client, 0x340, &fl_lines, MSM_CAMERA_I2C_WORD_DATA); CDBG("%s ll_pclk = %d, frame fl_lines = %d\n", __func__, ll_pclk, fl_lines); if((ll_pclk != 0) && (fl_lines != 0)){ #if defined(CONFIG_MACH_DECKARD_AS97) fps = 269629630 / fl_lines / ll_pclk; #else fps = 268800000 / fl_lines / ll_pclk; #endif if(fps != 0) delay = 1000 / fps; } CDBG("%s fps = %ld, frame time = %d\n", __func__, fps, delay); msleep(delay); msm_sensor_power_down(s_ctrl); CDBG("%s MSM_TLMM_BASE + 0x2024 = 0x%0x\n", __func__, (unsigned int)MSM_TLMM_BASE + 0x2024); CDBG("%s __raw_readl = 0x%0x\n", __func__, __raw_readl(MSM_TLMM_BASE + 0x2024)); __raw_writel(__raw_readl((MSM_TLMM_BASE + 0x2024)) & ~(0x01), (MSM_TLMM_BASE + 0x2024)); perf_unlock(&imx081_perf_lock); return 0; }
int32_t ov2722_sub_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t status; pr_info("%s: +\n", __func__); s_ctrl->power_setting_array.power_setting = ov2722_sub_power_down_setting; s_ctrl->power_setting_array.size = ARRAY_SIZE(ov2722_sub_power_down_setting); g_subcam_no_ack = 0; status = msm_sensor_power_down(s_ctrl); pr_info("%s: -\n", __func__); return status; }
int32_t ov7695_raw_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { struct msm_camera_sensor_info *info = s_ctrl->sensordata;; CDBG("%s IN\r\n", __func__); gpio_direction_output(info->sensor_pwd, 0); usleep_range(5000, 5100); pip_ov5648_ctrl(PIP_CRL_POWERDOWN, NULL); usleep_range(5000, 5100); msm_sensor_power_down(s_ctrl); msleep(40); //if (s_ctrl->sensordata->pmic_gpio_enable){ // lcd_camera_power_onoff(0); //} return 0; }
int32_t ov7692_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *info = NULL; rc = msm_sensor_power_down(s_ctrl); if (rc < 0) CDBG("%s: msm_sensor_power_down failed\n", __func__); info = s_ctrl->sensordata; if (info->pmic_gpio_enable) { info->pmic_gpio_enable = 0; info->sensor_lcd_gpio_onoff(0); usleep_range(5000, 5100); } return rc; }
int imx111_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { pr_err("%s: E\n", __func__); msm_sensor_power_down(s_ctrl); #ifdef CONFIG_MACH_MSM8960_L_DCM /* CAMVDD */ pr_err("%s: Turning off LDO for L-DCM project\n", __func__); if (gpio_direction_output(GPIO_VGACAM_LDO_EN, 0)) { pr_err("gpio_direction_output(GPIO_VGACAM_LDO_EN, 0) error\n"); } else { gpio_free(GPIO_VGACAM_LDO_EN); } #endif pr_err("%s: X\n", __func__); return 0; }
int32_t s5k5e_yuv_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t status; int i = 0; int j = 0; int data_size; CDBG("%s: +\n", __func__); s_ctrl->power_setting_array.power_setting = s5k5e_power_down_setting; s_ctrl->power_setting_array.size = ARRAY_SIZE(s5k5e_power_down_setting); for(i = 0; i < s_ctrl->power_setting_array.size; i++) { data_size = sizeof(s5k5e_power_setting[i].data)/sizeof(void *); for (j =0; j < data_size; j++ ) s5k5e_power_down_setting[i].data[j] = s5k5e_power_setting[i].data[j]; } status = msm_sensor_power_down(s_ctrl); CDBG("%s: -\n", __func__); return status; }
//For power down sequece, keep reset pin low int32_t ov2722_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t status; int i = 0; int j = 0; int data_size; pr_info("%s: +\n", __func__); s_ctrl->power_setting_array.power_setting = ov2722_power_down_setting; s_ctrl->power_setting_array.size = ARRAY_SIZE(ov2722_power_down_setting); //When release regulator, need the same data pointer from power up sequence. for(i = 0; i < s_ctrl->power_setting_array.size; i++) { data_size = sizeof(ov2722_power_down_setting[i].data)/sizeof(void *); for (j =0; j < data_size; j++ ) ov2722_power_down_setting[i].data[j] = ov2722_power_setting[i].data[j]; } status = msm_sensor_power_down(s_ctrl); pr_info("%s: -\n", __func__); return status; }
int32_t ov7695_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { struct msm_camera_sensor_info *info = NULL; int rc = 0; int value = -1; CDBG("%s: %d\n", __func__, __LINE__); info = s_ctrl->sensordata; /*power down before mclk disable*/ gpio_direction_output(info->sensor_pwd, 0); msleep(50); msm_sensor_power_down(s_ctrl); msleep(10); value = gpio_get_value(info->sensor_pwd); CDBG("%s: %d: sensor_pwd(gpio-%d) = %d,\n", __func__, __LINE__,info->sensor_pwd,value); return rc; }
static int32_t hi256_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { hi256_i2c_write_table(s_ctrl, &hi256_sleep_settings[0], ARRAY_SIZE(hi256_sleep_settings)); return msm_sensor_power_down(s_ctrl); }
int32_t yacd5c1sbdbc_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; pr_err("%s\n", __func__); #if 1//wsyang_temp if(booting_skip_check == 1) {// except AF_power_down for booting if (s_ctrl->func_tbl->sensor_stop_stream) { s_ctrl->func_tbl->sensor_stop_stream(s_ctrl); msleep(20); } } else { booting_skip_check = 1; } #endif #if 0 msm_sensor_probe_off(&s_ctrl->sensor_i2c_client->client->dev); #else msm_sensor_power_down(s_ctrl); pr_err(" %s : msm_sensor_power_down : rc = %d E\n",__func__, rc); #endif if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; mdelay(1); /* > 20 cycles (approx. 0.64us) */ if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_A_2P8V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_IO_1P8V, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAM1_IOVDD_EN, 0) < 0) rc = -EIO; svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); #ifdef CONFIG_PANTECH_CAMERA_TUNER kfree(yacd5c1sbdbc_recommend_tuner_settings); #endif pr_err("%s X (%d)\n", __func__, rc); return rc; #if 0 /* Reset *********************************************************/ gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 0); usleep_range(1000, 2000); gpio_free(data->sensor_platform_info->sensor_reset); mdelay(1); /* Standby *********************************************************/ if(data->sensor_platform_info->sensor_pwd) { gpio_set_value_cansleep(data->sensor_platform_info->sensor_pwd, 0); gpio_free(data->sensor_platform_info->sensor_pwd); } mdelay(1); /* VREG disable *****************************************************/ rc = regulator_disable(vreg_lvs6_1p8); if (rc){ printk("%s: Disable regulator vreg_lvs6_1p8 failed\n", __func__); goto fail; } regulator_put(vreg_lvs6_1p8); vreg_lvs6_1p8 = NULL; mdelay(1); rc = regulator_disable(vreg_l11_2p85); if (rc){ printk("%s: Disable regulator vreg_l11_2p85 failed\n", __func__); goto fail; } regulator_put(vreg_l11_2p85); vreg_l11_2p85 = NULL; mdelay(1); rc = regulator_disable(vreg_lvs5_1p8); if (rc){ printk("%s: Disable regulator vreg_lvs5_1p8 failed\n", __func__); goto fail; } regulator_put(vreg_lvs5_1p8); vreg_lvs5_1p8 = NULL; mdelay(1); /* LDO disable ******************************************************/ gpio_set_value_cansleep(CAM1_IOVDD_EN, 0); gpio_free(CAM1_IOVDD_EN); mdelay(1); #if 0 gpio_set_value_cansleep(CAM1_AVDD_EN, 0); gpio_free(CAM1_AVDD_EN); mdelay(1); gpio_set_value_cansleep(CAM1_DVDD_EN, 0); gpio_free(CAM1_DVDD_EN); mdelay(1); #endif return 0; fail: printk("%s Failed!:%d\n",__func__, __LINE__); if(vreg_lvs6_1p8) { regulator_put(vreg_lvs6_1p8); } if(vreg_l11_2p85) { regulator_put(vreg_l11_2p85); } if(vreg_lvs5_1p8){ regulator_put(vreg_lvs5_1p8); } return rc; #endif }
int ov680_sensor_standby_power_up(struct msm_sensor_ctrl_t *s_ctrl) { #ifndef OV680_SUPPORT_STANDBY int rc = 0; ov680_info("%s line %d", __func__, __LINE__); msm_sensor_power_up(s_ctrl); if (rc < 0) { ov680_err("%s line %d power up failed", __func__, __LINE__); return rc; } if (!rc) { ov680_dbg("LOAD FW ++"); rc = ov680_fwi_run_force(OV680_FWI_FIRMWARE, OV680_FIRMWARE_INIT); ov680_dbg("LOAD FW --"); if (rc < 0) { pr_err("FW load failed try next time rc=%d", rc); rc = 0; } } return rc; #else int rc = 0; int i, j; ov680_info("%s line %d", __func__, __LINE__); if (ov680_props.state == OV680_STATE_OFF) { ov680_dbg ("%s Standby mode availability. Powering ON for the first time %d", __func__, __LINE__); /* Acquire PWDN gpio, it's not part of the DTS GPIO list */ rc = msm_camera_request_gpio_table(standby_gpios, 1, 1); if(rc){ ov680_err("%s msm_camera_request_gpio_table failed rc=%d %d", __func__, rc, __LINE__); msm_sensor_power_down(s_ctrl); return rc; } gpio_set_value(OV680_PWDN_GPIO, 0); // deassert rc = msm_sensor_power_up(s_ctrl); if (rc) { ov680_err("%s line %d stadby power up failed", __func__, __LINE__); return rc; } /* copy clk and vreg information */ for (i = 0; i < s_ctrl->power_setting_array.size; i++) { if (s_ctrl->power_setting_array. power_setting[i].seq_type == SENSOR_VREG && s_ctrl->power_setting_array. power_setting[i].seq_val == CAM_VANA){ ov680_dbg("%s Found VANA %d", __func__, __LINE__); for (j = 0; j < 10; j++) ov680_standby_power_setting[0].data[j] = s_ctrl-> power_setting_array.power_setting [i].data[j]; } } for (i = 0; i < s_ctrl->power_setting_array.size; i++) { if (s_ctrl->power_setting_array. power_setting[i].seq_type == SENSOR_CLK){ ov680_dbg("%s Found MCLK %d", __func__, __LINE__); for (j = 0; j < 10; j++) ov680_standby_power_setting[1].data[j] = s_ctrl-> power_setting_array.power_setting [i].data[j]; } } /* swap to standby power script to be used in next power down */ #if 0 s_ctrl->power_setting_array.power_setting = ov680_standby_power_setting; s_ctrl->power_setting_array.size = ARRAY_SIZE(ov680_standby_power_setting); #endif #if 0 /* Load the Firmware duirng first power on */ ov680_dbg("%s Load the Firmware duirng first power on %d", __func__, __LINE__); rc = ov680_fwi_run_force(OV680_FWI_FIRMWARE, OV680_FIRMWARE_INIT); if (rc) { ov680_err("%s FW loading failed rc=%d %d", __func__, rc, __LINE__); ov680_props.fw_state = OV680_FW_MISSING; ov680_props.state = OV680_STATE_OFF; rc = 0; //return rc; } else { ov680_dbg("%s Change state to OV680_FW_LOADED %d", __func__, __LINE__); ov680_props.fw_state = OV680_FW_LOADED; ov680_props.state = OV680_STATE_IDLE; } #endif } else if (ov680_props.state == OV680_STATE_STANDBY) { ov680_dbg("%s Resuming from standby %d", __func__, __LINE__); /* this tunrs on Rails and Clk using standby power up sequnce */ rc = ov680_power_up(s_ctrl, ov680_standby_power_setting, ARRAY_SIZE(ov680_standby_power_setting)); if (rc < 0) { ov680_err("%s Unable to power up rc=%d %d", __func__, rc, __LINE__); return rc; } if (ov680_props.fw_state == OV680_FW_MISSING) { ov680_dbg("%s Loading firmware %d", __func__, __LINE__); rc = ov680_fwi_run_force (OV680_FWI_FIRMWARE, OV680_FIRMWARE_INIT); ov680_props.fw_state = OV680_FW_LOADED; if (rc) { ov680_err("%s FW loading failed rc=%d %d", __func__, rc, __LINE__); ov680_props.fw_state = OV680_FW_MISSING; ov680_props.state = OV680_STATE_OFF; return rc; } else { ov680_info("%s Loading firmware SUCCESS %d", __func__, __LINE__); ov680_props.fw_state = OV680_FW_LOADED; ov680_props.state = OV680_STATE_IDLE; } } else { /* FW Loaded */ ov680_dbg("%s FW already loaded Begin resume %d", __func__, __LINE__); rc = ov680_fwi_run_force(OV680_FWI_FIRMWARE, OV680_FIRMWARE_RESUME); if (rc) { ov680_info("%s FW resume failed rc=%d %d", __func__, rc, __LINE__); } ov680_dbg("%s Restoring old firmware %d", __func__, __LINE__); rc = ov680_fwi_run_force(OV680_FWI_FIRMWARE, OV680_FIRMWARE_RESTORE); if (rc) { ov680_info ("Failed to resume. Loading firmware, resetting.\n"); { rc = ov680_fwi_run_force (OV680_FWI_FIRMWARE, OV680_FIRMWARE_INIT); ov680_props.fw_state = OV680_FW_LOADED; ov680_props.state = OV680_STATE_IDLE; } } } } return rc; #endif }