//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 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; }
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; }
int s5k6aafx13_sensor_release(void) { #ifdef CONFIG_PANTECH_CAMERA_TUNER si2c_pid_t i = 0; #endif CDBG("%s E\n", __func__); mutex_lock(&s5k6aafx13_mutex); if (s5k6aafx13_ctrl) { kfree(s5k6aafx13_ctrl); s5k6aafx13_ctrl = NULL; } (void)s5k6aafx13_power_off(); svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); #ifdef CONFIG_PANTECH_CAMERA_TUNER for (i = 0; i < SI2C_PID_MAX; i++) { if (s5k6aafx13_tuner_params[i].cmds) kfree(s5k6aafx13_tuner_params[i].cmds); } #endif si2c_release(); mutex_unlock(&s5k6aafx13_mutex); CDBG("%s X\n", __func__); return 0; }
int mt9d113_sensor_init(struct msm_sensor_ctrl_t *s_ctrl) { int rc = 0; //uint8_t data_buf[4]; SKYCDBG("%s: E\n",__func__); #if 1//needtocheck //sensor_mode = ??;//SENSOR_PREVIEW_MODE; // memset(mt9d113_params, 0, sizeof(mt9d113_params)); //s_ctrl->sensor_i2c_client->client->adapter, // rc = si2c_init(s5k6aafx13_client->adapter, s5k6aafx13_const_params, s5k6aafx13_params); #if 0 rc = si2c_init(mt9d113_client->adapter, mt9d113_const_params, mt9d113_params); if (!mt9d113_ctrl) { SKYCDBG("%s err(-ENOMEM)\n", __func__); goto sensor_init_fail; } #endif rc = si2c_write_param(SI2C_SA, SI2C_INIT, mt9d113_params); SKYCDBG("%s: si2c_write_param / rc:%d \n",__func__, rc); if (rc < 0) goto sensor_init_fail; #endif sensor_mode = 1; SKYCDBG("%s: X\n",__func__); return rc; #if 1//needtocheck sensor_init_fail: #if 0 if (mt9d113_ctrl) { kfree(mt9d113_ctrl); mt9d113_ctrl = NULL; } (void)mt9d113_power_off(); svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); #endif SKYCDBG("%s: sensor_init_fail / si2c_release(); \n",__func__); si2c_release(); SKYCDBG("%s err(%d)\n", __func__, rc); return rc; #endif }
/* mt9d113_vreg_init */ static int mt9d113_vreg_init(void) { int rc = 0; pr_err("%s E\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; pr_err("%s X\n", __func__); return 0; sensor_init_fail: svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); return -ENODEV; }
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 }
int s5k6aafx13_sensor_init(const struct msm_camera_sensor_info *sinfo) { int rc = 0; CDBG("%s E\n", __func__); config_csi_done = false; sensor_mode = SENSOR_PREVIEW_MODE; memset(s5k6aafx13_params, 0, sizeof(s5k6aafx13_params)); #ifdef CONFIG_PANTECH_CAMERA_TUNER memset(s5k6aafx13_tuner_params, 0, sizeof(s5k6aafx13_tuner_params)); #endif //PANTECH_CAMERA_TODO, adapter 설정과 param 설정을 분리할 것. ugly 하다... rc = si2c_init(s5k6aafx13_client->adapter, s5k6aafx13_const_params, s5k6aafx13_params); if (rc < 0) goto sensor_init_fail; s5k6aafx13_ctrl = kzalloc(sizeof(s5k6aafx13_ctrl_t), GFP_KERNEL); if (!s5k6aafx13_ctrl) { CERR("%s err(-ENOMEM)\n", __func__); goto sensor_init_fail; } if (sinfo) s5k6aafx13_ctrl->sinfo = sinfo; 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; rc = s5k6aafx13_power_on(); if (rc < 0) goto sensor_init_fail; #ifdef CONFIG_PANTECH_CAMERA_TUNER CERR("%s tuner is enabled, skip writing INIT param!\n", __func__); #else rc = si2c_write_param(SI2C_SA, SI2C_INIT, s5k6aafx13_params); if (rc < 0) goto sensor_init_fail; #endif CDBG("%s X\n", __func__); return 0; sensor_init_fail: if (s5k6aafx13_ctrl) { kfree(s5k6aafx13_ctrl); s5k6aafx13_ctrl = NULL; } (void)s5k6aafx13_power_off(); svreg_release(svregs, CAMV_MAX); sgpio_release(sgpios, CAMIO_MAX); si2c_release(); CERR("%s err(%d)\n", __func__, rc); return rc; }