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; }
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; }
static int s5k6aafx13_power_on(void) { int rc = 0; CDBG("%s E\n", __func__); if (sgpio_ctrl(sgpios, CAMIO_R_RST_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_R_STB_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_F_STB_N, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0) rc = -EIO; mdelay(1); /* > 20us */ if (svreg_ctrl(svregs, CAMV_CORE_1P5V, 1) < 0) rc = -EIO; mdelay(1); /* > 15us */ if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0) rc = -EIO; mdelay(1); if (sgpio_ctrl(sgpios, CAMIO_F_STB_N, 1) < 0) rc = -EIO; msm_camio_clk_rate_set(24000000); msleep(10); /* > 50us */ if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 1) < 0) rc = -EIO; mdelay(1); /* > 50us */ CDBG("%s X (%d)\n", __func__, rc); 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 mt9v113_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; SKYCDBG("%s E\n", __func__); msm_sensor_probe_off(&s_ctrl->sensor_i2c_client->client->dev); /*PANTECH_CAMERA_TODO, check correct timing, spec don't have off seq. */ if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; mdelay(1); if (svreg_ctrl(svregs, CAMV_IO_1P8V, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMV_CORE_1P8V, 0) < 0) rc = -EIO; #if defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER < WS20) rc = gpio_direction_output(91, 0); if (rc < 0) { SKYCDBG("%s err(%d, gpio91)\n", __func__, rc); rc = -EIO; return rc; } mdelay(1); #elif defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER >= WS20) if (sgpio_ctrl(sgpios, CAMV_A_2P8V, 0) < 0) rc = -EIO; mdelay(1); #endif svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); SKYCDBG("%s X (%d)\n", __func__, rc); return rc; }
static int s5k6aafx13_power_off(void) { int rc = 0; CDBG("%s E\n", __func__); if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 0) < 0) rc = -EIO; mdelay(1); /* > 20 cycles (approx. 0.64us) */ if (sgpio_ctrl(sgpios, CAMIO_F_STB_N, 0) < 0) rc = -EIO; /* 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_1P5V, 0) < 0) rc = -EIO; if (svreg_ctrl(svregs, CAMV_A_2P8V, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_R_RST_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_R_STB_N, 0) < 0) rc = -EIO; CDBG("%s X (%d)\n", __func__, rc); return rc; }
int32_t mt9v113_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int32_t rc = 0; SKYCDBG("%s E\n", __func__); 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__); rc = sgpio_init(sgpios, CAMIO_MAX); if (rc < 0) goto sensor_init_fail; rc = svreg_init(svregs, CAMV_MAX); if (rc < 0) goto sensor_init_fail; if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0) rc = -EIO; mdelay(1); if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0) rc = -EIO; mdelay(1); /* > 1ms */ #if defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER < WS20) rc = gpio_direction_output(91, 1); if (rc < 0) { SKYCDBG("%s err(%d, gpio91)\n", __func__, rc); rc = -EIO; return rc; } mdelay(1); #elif defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER >= WS20) if (sgpio_ctrl(sgpios, CAMV_A_2P8V, 1) < 0) rc = -EIO; mdelay(1); #endif if (sgpio_ctrl(sgpios, CAMV_CORE_1P8V, 1) < 0) rc = -EIO; mdelay(1); if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; mdelay(1); /* > 10 clks (approx. 0.42us) */ if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0) rc = -EIO; mdelay(1); /* > 1 clk (apporx. 0.042us) */ msleep(500); /* 500ms PANTECH_CAMERA_TODO */ //msm_camio_clk_rate_set(24000000); msleep(10); SKYCDBG("%s X (%d)\n", __func__, rc); return rc; sensor_init_fail: /*PANTECH_CAMERA_TODO, check correct timing, spec don't have off seq. */ if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0) rc = -EIO; mdelay(1); if (svreg_ctrl(svregs, CAMV_IO_1P8V, 0) < 0) rc = -EIO; if (sgpio_ctrl(sgpios, CAMV_CORE_1P8V, 0) < 0) rc = -EIO; #if defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER < WS20) rc = gpio_direction_output(91, 0); if (rc < 0) { SKYCDBG("%s err(%d, gpio91)\n", __func__, rc); rc = -EIO; return rc; } mdelay(1); #elif defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER >= WS20) if (sgpio_ctrl(sgpios, CAMV_A_2P8V, 0) < 0) rc = -EIO; mdelay(1); #endif svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); return rc; }
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 }
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 }