int imx111_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; pr_err("%s: E\n", __func__); rc = msm_sensor_power_up(s_ctrl); if (rc) { pr_err("%s: msm_sensor_power_up error, rc = %d", __func__, rc); return rc; } #ifdef CONFIG_MACH_MSM8960_L_DCM /* CAMVDD */ pr_err("%s: Turning on LDO for L-DCM project\n", __func__); rc = gpio_request(GPIO_VGACAM_LDO_EN, "CAM_GPIO"); if (rc) { pr_err("gpio_request(GPIO_VGACAM_LDO_EN) error\n"); } else { rc = gpio_direction_output(GPIO_VGACAM_LDO_EN, 1); if (rc) { pr_err("gpio_direction_output(GPIO_VGACAM_LDO_EN) error\n"); } } #endif pr_err("%s: X\n", __func__); return rc; }
int32_t as0260_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; SKYCDBG("%s: %d\n", __func__, __LINE__); rc = msm_sensor_power_up(s_ctrl); SKYCDBG(" %s : msm_sensor_power_up : rc = %d E\n",__func__, rc); as0260_vreg_init(); if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 1) < 0) rc = -EIO; mdelay(50); if (svreg_ctrl(svregs, CAMV_I2C_1P8V, 1) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0) rc = -EIO; mdelay(1); /* > 20us */ if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0) rc = -EIO; mdelay(1); /* > 15us */ if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; mdelay(1); if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0) rc = -EIO; //msm_camio_clk_rate_set(24000000); msleep(10); /* > 50us */ if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0) rc = -EIO; mdelay(30); //mdelay(1); /* > 50us */ SKYCDBG("%s X (%d)\n", __func__, rc); return rc; }
///@Hxin add for avoid current leak start int32_t ov8858_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; rc = msm_sensor_power_up(s_ctrl); return rc; }
//mt9d113_sensor_power_up int32_t mt9d113_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; CDBG("%s E\n", __func__); #if 1// memset(mt9d113_params, 0, sizeof(mt9d113_params)); rc = si2c_init(mt9d113_client->adapter, mt9d113_const_params, mt9d113_params); #else mt9d113_ctrl = kzalloc(sizeof(mt9d113_ctrl_t), GFP_KERNEL); if (!mt9d113_ctrl) { pr_err("%s err(-ENOMEM)\n", __func__); } mt9d113_ctrl->sinfo = s_ctrl->sensordata; #endif rc = msm_sensor_power_up(s_ctrl); CDBG(" %s : msm_sensor_power_up : rc = %d E\n",__func__, rc); mt9d113_vreg_init(); 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); if (sgpio_ctrl(sgpios, CAMIO_F_STB, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 1) < 0) rc = -EIO; mdelay(1); if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0) rc = -EIO; mdelay(2); /* > 1ms */ if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 1) < 0) rc = -EIO; mdelay(1); //msm_camio_clk_rate_set(24000000); //build error : undefined reference #if 1 pr_err("%s: [wsyang_debug] msm_cam_clk_enable() / 1 \n", __func__); msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev, cam_mclk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_mclk_info), 1); #endif msleep(10); /* > 1 clk (approx. 0.042us) */ if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 0) < 0) rc = -EIO; /*PANTECH_CAMERA_TODO, reset was grounded with 10uF cap in WS20*/ mdelay(10); /* > 10 clks (approx. 0.42us) */ if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 1) < 0) rc = -EIO; mdelay(1); /* > 1 clk (apporx. 0.042us) */ if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0) rc = -EIO; mdelay(2); /* > 6000 clks (approx. 252us) */ current_fps = 31; CDBG("%s X (%d)\n", __func__, rc); return rc; }
int32_t ov2722_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t status; pr_info("%s: +\n", __func__); s_ctrl->power_setting_array.power_setting = ov2722_power_setting; s_ctrl->power_setting_array.size = ARRAY_SIZE(ov2722_power_setting); status = msm_sensor_power_up(s_ctrl); pr_info("%s: -\n", __func__); return status; }
int32_t s5k5e_yuv_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t status; CDBG("%s:+\n", __func__); s_ctrl->power_setting_array.power_setting = s5k5e_power_setting; s_ctrl->power_setting_array.size = ARRAY_SIZE(s5k5e_power_setting); status = msm_sensor_power_up(s_ctrl); CDBG("%s:-\n", __func__); return status; }
static int32_t mt9v113_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; pr_info("%s called\n", __func__); msm_sensor_power_up(s_ctrl); rc = msm_sensor_match_id(s_ctrl); if (rc < 0) pr_err("%s:%d match id failed rc %d\n", __func__, __LINE__, rc); return rc; }
int32_t ov7692_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *info = NULL; info = s_ctrl->sensordata; if (info->pmic_gpio_enable) { info->sensor_lcd_gpio_onoff(1); usleep_range(5000, 5100); } rc = msm_sensor_power_up(s_ctrl); if (rc < 0) { CDBG("%s: msm_sensor_power_up failed\n", __func__); return rc; } return rc; }
int32_t ov7695_raw_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *info = s_ctrl->sensordata; CDBG("%s IN\r\n", __func__); CDBG("%s, sensor_pwd:%d\r\n",__func__, info->sensor_pwd); CDBG("%s gpio %d setting to %d\r\n", __func__, info->sensor_pwd, 0); /* for pip using */ ov7695_pwdn_pin = info->sensor_pwd; /*pip end*/ gpio_direction_output(info->sensor_pwd, 0); usleep_range(5000, 6000); #if 0 for(rc = 0; rc<1000; rc++) { CDBG("GPIO cycle...\n"); gpio_direction_output(info->sensor_pwd, 1); gpio_direction_output(info->sensor_reset, 0); usleep_range(5000, 6000); gpio_direction_output(info->sensor_pwd, 0); gpio_direction_output(info->sensor_reset, 1); usleep_range(5000, 6000); } #endif //if (info->pmic_gpio_enable) { // lcd_camera_power_onoff(1); //} usleep_range(5000, 6000); rc = msm_sensor_power_up(s_ctrl); if (rc < 0) { CDBG("%s: msm_sensor_power_up failed\n", __func__); return rc; } /* turn on ldo and vreg */ usleep_range(1000, 1100); gpio_direction_output(info->sensor_pwd, 1); msleep(10); return rc; }
int32_t ov7695_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; int value = -1; struct msm_camera_sensor_info *info = NULL; CDBG("%s: %d\n", __func__, __LINE__); info = s_ctrl->sensordata; /*request gpios and enable MCLK*/ rc = msm_sensor_power_up(s_ctrl); if (rc < 0) { CDBG("%s: msm_sensor_power_up failed\n", __func__); return rc; } msleep(20); gpio_direction_output(info->sensor_pwd, 1); msleep(20); value = gpio_get_value(info->sensor_pwd); CDBG("Exit %s: %d: sensor_pwd(gpio-%d) = %d,\n", __func__, __LINE__,info->sensor_pwd,value); return rc; }
int32_t imx081_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; CDBG("%s\n", __func__); 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)); s_ctrl->clk_info = imx081_clk_info; s_ctrl->clk_info_size = ARRAY_SIZE(imx081_clk_info); rc = msm_sensor_power_up(s_ctrl); if (rc < 0) { pr_err("%s: msm_sensor_power_up failed\n", __func__); return 0; } perf_lock(&imx081_perf_lock); return rc; }
int32_t s5k5ca_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; struct msm_camera_sensor_info *info = NULL; //printk(" s5k5ca_sensor_power_up()\n"); info = s_ctrl->sensordata; /* turn off PWDN & RST */ rc = gpio_request(info->sensor_pwd, "S5K5CA_PWDN"); if (rc < 0) pr_err("%s: gpio_request--- failed!", __func__); rc = gpio_request(info->sensor_reset, "S5K5CA_RST"); if (rc < 0) pr_err("%s: gpio_request--- failed!", __func__); gpio_direction_output(info->sensor_pwd, 0); gpio_direction_output(info->sensor_reset, 0); /*++ PeterShih - 20121004 Turn on ldo and vreg ++*/ rc = gpio_request( 14 , "S5K5CA_1.8V"); if (rc < 0) pr_err("%s: gpio_request--- failed!", __func__); rc = gpio_request( 10 , "S5K5CA_2.8V"); if (rc < 0) pr_err("%s: gpio_request--- failed!", __func__); gpio_direction_output(14, 1); gpio_direction_output(10, 1); /*-- PeterShih - 20121004 Turn on ldo and vreg --*/ 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; } #if 0 rc = msm_sensor_power_up(s_ctrl); if (rc < 0) { CDBG("%s: msm_sensor_power_up failed\n", __func__); return rc; } #endif /* turn on PWDN & RST */ gpio_direction_output(info->sensor_pwd, 1); gpio_direction_output(info->sensor_reset, 1); rc=msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0xFCFC, 0xD000, MSM_CAMERA_I2C_WORD_DATA); rc=msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x002C, 0x0000, MSM_CAMERA_I2C_WORD_DATA); rc=msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x002E, 0x0040, MSM_CAMERA_I2C_WORD_DATA); //detect sensor// camera_id=gpio_get_value(13); //Flea++ s_ctrl->sensordata->sensor_platform_info->hw_version=10|camera_id; //Flea-- //pr_emerg(" s5k5ca_sensor_power_up() camera_id:%d",camera_id); // return rc; };
int32_t yacd5c1sbdbc_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; pr_err("%s: %d\n", __func__, __LINE__); #if 0 msm_sensor_probe_on(&s_ctrl->sensor_i2c_client->client->dev); SKYCDBG("%s msm_sensor_probe_on ok\n", __func__); msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ); SKYCDBG("%s msm_camio_clk_rate_set ok\n", __func__); #else rc = msm_sensor_power_up(s_ctrl); pr_err(" %s : msm_sensor_power_up : rc = %d E\n",__func__, rc); #endif yacd5c1sbdbc_vreg_init(); if (sgpio_ctrl(sgpios, CAM1_IOVDD_EN, 1) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0) rc = -EIO; mdelay(1); /* > 20us */ if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0) rc = -EIO; mdelay(1); /* > 15us */ if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 1) < 0) rc = -EIO; mdelay(1); if (sgpio_ctrl(sgpios, CAMIO_STB_N, 1) < 0) rc = -EIO; //msm_camio_clk_rate_set(24000000); mdelay(35); //yacd5c1sbdbc spec: >30ms if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0) rc = -EIO; mdelay(1); /* > 50us */ pr_err("%s X (%d)\n", __func__, rc); return rc; #if 0 /* LDO enable ******************************************************/ rc = gpio_request(CAM1_IOVDD_EN, "yacd5c1sbdbc"); if (!rc) { printk("%s:%d\n", __func__, __LINE__); gpio_direction_output(CAM1_IOVDD_EN, 1); } else { printk("%s: gpio CAM1_IOVDD_EN request fail", __func__); } mdelay(1); #if 0 rc = gpio_request(CAM1_AVDD_EN, "yacd5c1sbdbc"); if (!rc) { printk("%s:%d\n", __func__, __LINE__); gpio_direction_output(CAM1_AVDD_EN, 1); } else { printk("%s: gpio CAM1_AVDD_EN request fail", __func__); } mdelay(1); rc = gpio_request(CAM1_DVDD_EN, "yacd5c1sbdbc"); if (!rc) { printk("%s:%d\n", __func__, __LINE__); gpio_direction_output(CAM1_DVDD_EN, 1); } else { printk("%s: gpio CAM1_DVDD_EN request fail", __func__); } mdelay(1); #endif /* VREG enable *****************************************************/ rc = regulator_enable(vreg_lvs5_1p8); if (rc) { printk("%s: Enable regulator vreg_lvs5_1p8 failed\n", __func__); goto fail; } mdelay(1); rc = regulator_enable(vreg_l11_2p85); if (rc) { printk("%s: Enable regulator vreg_l11_2p85 failed\n", __func__); goto fail; } mdelay(1); rc = regulator_enable(vreg_lvs6_1p8); if (rc) { printk("%s: Enable regulator vreg_lvs6_1p8 failed\n", __func__); goto fail; } mdelay(1); /* Standby *********************************************************/ rc = gpio_request(data->sensor_platform_info->sensor_pwd, "yacd5c1sbdbc"); if (!rc) { printk("%s:Standby\n", __func__); //gpio_set_value(SENSOR_STANDBY,1); gpio_set_value_cansleep(data->sensor_platform_info->sensor_pwd, 0); gpio_direction_output(data->sensor_platform_info->sensor_pwd, 1); } else { printk("%s: gpio Standby request fail", __func__); } mdelay(1); /* MCLK set ********************************************************/ printk(" msm_camio_clk_rate_set E\n"); msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ); printk(" msm_camio_clk_rate_set X\n"); mdelay(1); /* Reset *********************************************************/ rc = gpio_request(data->sensor_platform_info->sensor_reset, "yacd5c1sbdbc"); if (!rc) { printk("%s: reset sensor\n", __func__); gpio_direction_output(data->sensor_platform_info->sensor_reset, 0); usleep_range(1000, 2000); gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 1); usleep_range(4000, 5000); } else { printk("%s: gpio Reset request fail", __func__); } return rc; 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 }