static int s5k6b2yx_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; CAM_DEBUG("E"); 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); /* MCLK */ rc = msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev, cam_clk_info, s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 0); /* VT_CAM_RESET */ data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->reset, 0); /* STBY */ data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->stby, 0); /* Power off */ data->sensor_platform_info->sensor_power_off(); msm_camera_request_gpio_table(data, 0); s_ctrl->vision_mode_flag=0; CAM_DEBUG("X"); return rc; }
void sensor_native_control_front(void __user *arg) { struct ioctl_native_cmd ctrl_info; if (copy_from_user((void *)&ctrl_info, (const void *)arg, sizeof(ctrl_info))) cam_err(" fail copy_from_user!"); switch (ctrl_info.mode) { case EXT_CAM_EV: s5k8aay_set_ev(ctrl_info.value_1); break; case EXT_CAM_EFFECT: s5k8aay_set_effect(ctrl_info.value_1); break; case EXT_CAM_WB: s5k8aay_set_whitebalance(ctrl_info.value_1); break; case EXT_CAM_DTP_TEST: s5k8aay_check_dataline(ctrl_info.value_1); break; case EXT_CAM_MOVIE_MODE: CAM_DEBUG(" MOVIE mode : %d", ctrl_info.value_1); s5k8aay_ctrl->cam_mode = ctrl_info.value_1; break; case EXT_CAM_PREVIEW_SIZE: s5k8aay_set_preview_size(ctrl_info.value_1); break; case EXT_CAM_EXIF: ctrl_info.value_1 = s5k8aay_get_exif(ctrl_info.address); break; case EXT_CAM_VT_MODE: CAM_DEBUG(" VT mode : %d", ctrl_info.value_1); s5k8aay_ctrl->vtcall_mode = ctrl_info.value_1; break; case EXT_CAM_SET_FPS: s5k8aay_set_frame_rate(ctrl_info.value_1); break; case EXT_CAM_SAMSUNG_CAMERA: CAM_DEBUG(" SAMSUNG camera : %d", ctrl_info.value_1); s5k8aay_ctrl->samsungapp = ctrl_info.value_1; break; default: break; } if (copy_to_user((void *)arg, (const void *)&ctrl_info, sizeof(ctrl_info))) cam_err(" fail copy_to_user!"); }
void msm_camera_gpio_install(void) { CAM_DEBUG("Camera GPIO install LT02!!\n"); /*CAM_MCLK1 : GPIO 4*/ gpio_tlmm_config(GPIO_CFG(GPIO_SUB_CAM_MCLK, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); /*CAM_MCLK0 : GPIO 5*/ gpio_tlmm_config(GPIO_CFG(GPIO_MAIN_CAM_MCLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); /*GPIO_CAM_CORE_EN : GPIO 1*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM_IO_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE);//jixu /*Front cam stby : GPIO 64*/ gpio_tlmm_config(GPIO_CFG(GPIO_VT_STBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Main cam stby : GPIO 63*/ gpio_tlmm_config(GPIO_CFG(GPIO_MAIN_STBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Front cam reset : GPIO 76*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM2_RST_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Main cam reset : GPIO 107*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM1_RST_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Camera Analog 2.8V : GPIO 1 */ gpio_tlmm_config(GPIO_CFG(GPIO_CAM_SENSOR_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); CAM_DEBUG("Finish!!\n"); }
static int s5k8_i2c_wrt_list(struct s5k8aay_short_t regs[], int size, char *name) { #ifdef CONFIG_LOAD_FILE s5k8aay_write_regs_from_sd(name); #else int err = 0; int i = 0; CAM_DEBUG(" %s", name); if (!s5k8aay_client->adapter) { cam_err(" can't search i2c client adapter"); return -EIO; } for (i = 0; i < size; i++) { if (regs[i].subaddr == 0xFFFF) { msleep(regs[i].value); CAM_DEBUG(" delay = 0x%04x, value = 0x%04x", regs[i].subaddr, regs[i].value); } else { err = s5k8aay_i2c_write_multi(regs[i].subaddr, regs[i].value); if (unlikely(err < 0)) { cam_err(" register set failed"); return -EIO; } } } #endif return 0; }
static int s5k6aafx_reset(void) { printk("s5k6aafx_reset"); gpio_set_value(CAM_STANDBY, 0); //gpio_set_value(CAM_RESET, 0); gpio_set_value_cansleep(CAM_RESET, 0); printk(" 2. CAM_VT_nSTBY = 0 "); gpio_set_value_cansleep(CAM_VT_nSTBY, 0); printk(" 3. CAM_VT_RST = 0 "); gpio_set_value_cansleep(CAM_VT_RST, 0); mdelay(30); CAM_DEBUG(" CAM PM already on \n"); //CAM_DEBUG(" 1. PMIC ON "); //cam_pmic_onoff(ON); //CAM_DEBUG(" 1. CAM_8M_RST = 0 "); //gpio_set_value(CAM_8M_RST, LOW); CAM_DEBUG(" 2. CAM_VT_nSTBY = 1 "); gpio_set_value_cansleep(CAM_VT_nSTBY, 1); mdelay(20); CAM_DEBUG(" 3. CAM_VT_RST = 1 "); gpio_set_value_cansleep(CAM_VT_RST, 1); mdelay(30); // min 350ns return 0; }
static int s5k8aay_write_regs_from_sd(char *name) { char *start, *end, *reg, *size; unsigned short addr; unsigned int len, value; char reg_buf[7], data_buf1[5], data_buf2[7]; *(reg_buf + 6) = '\0'; *(data_buf1 + 4) = '\0'; *(data_buf2 + 6) = '\0'; CAM_DEBUG(" s5k8aay_regs_table_write start!"); CAM_DEBUG(" E string = %s", name); start = strstr(s5k8aay_regs_table, name); end = strstr(start, "};"); while (1) { /* Find Address */ reg = strstr(start, "{0x"); if ((reg == NULL) || (reg > end)) break; /* Write Value to Address */ if (reg != NULL) { memcpy(reg_buf, (reg + 1), 6); memcpy(data_buf2, (reg + 9), 6); size = strstr(data_buf2, ","); if (size) { /* 1 byte write */ memcpy(data_buf1, (reg + 9), 4); kstrtoint(reg_buf, 16, &addr); kstrtoint(data_buf1, 16, &value); if (reg) start = (reg + 12); } else {/* 2 byte write */ kstrtoint(reg_buf, 16, &addr); kstrtoint(data_buf2, 16, &value); if (reg) start = (reg + 14); } size = NULL; CAM_DEBUG(" addr 0x%04x, value 0x%04x", addr, value); if (addr == 0xFFFF) msleep(value); else s5k8aay_i2c_write_multi(addr, value); } } CAM_DEBUG(" s5k8aay_regs_table_write end!"); return 0; }
static void s5k8aay_check_dataline(int val) { if (val) { CAM_DEBUG(" DTP ON"); s5k8aay_ctrl->dtpTest = 1; } else { CAM_DEBUG(" DTP OFF"); s5k8aay_ctrl->dtpTest = 0; } }
static int s5k6aafx_sensor_init_probe(struct msm_camera_sensor_info *data) { int rc = 0; // int read_value=-1; // unsigned short read_value_1 = 0; // int i; //for loop // int cnt = 0; CAM_DEBUG("s5k6aafx_sensor_init_probe start"); gpio_set_value(CAM_STANDBY, 0); //gpio_set_value(CAM_RESET, 0); gpio_set_value_cansleep(CAM_RESET, 0); CAM_DEBUG(" CAM PM already on \n"); //CAM_DEBUG(" 1. PMIC ON "); //cam_pmic_onoff(ON); //CAM_DEBUG(" 1. CAM_8M_RST = 0 "); //gpio_set_value(CAM_8M_RST, LOW); CAM_DEBUG(" 2. CAM_VT_nSTBY = 1 "); gpio_set_value_cansleep(CAM_VT_nSTBY, 1); mdelay(20); CAM_DEBUG(" 3. CAM_VT_RST = 1 "); gpio_set_value_cansleep(CAM_VT_RST, 1); mdelay(30); // min 350ns #if 0 //////////////////////////////////////////////////// #if 0//Mclk_timing for M4Mo spec. // -Jeonhk clock was enabled in vfe31_init msm_camio_clk_enable(CAMIO_VFE_CLK); msm_camio_clk_enable(CAMIO_MDC_CLK); msm_camio_clk_enable(CAMIO_VFE_MDC_CLK); #endif CAM_DEBUG("START MCLK:24Mhz~~~~~"); // msm_camio_clk_rate_set(24000000); mdelay(5); msm_camio_camif_pad_reg_reset(); // this is not mdelay(10); //////////////////////////////////////////////////// #endif s5k6aafx_start(); return rc; init_probe_fail: return rc; }
/* Switch to low power vision mode */ static int s5k6b2yx_sensor_set_streaming_mode( struct msm_sensor_ctrl_t *s_ctrl, int32_t vision_mode_enable) { int rc = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; CAM_DEBUG("stop streaming"); s_ctrl->func_tbl->sensor_stop_stream(s_ctrl); CAM_DEBUG("vision_mode_enable=%d: E", vision_mode_enable); if(vision_mode_enable) { /*switch from normal/dual to vision mode */ CAM_DEBUG("set X_SHUTDOWN pin to low"); data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->reset, 0); usleep(1050); CAM_DEBUG("set VIS_STBY pin to high"); data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->stby, 1); CAM_DEBUG("change stream config arrays"); s_ctrl->msm_sensor_reg->start_stream_conf = s5k6b2yx_start_settings_vision; s_ctrl->msm_sensor_reg->start_stream_conf_size = ARRAY_SIZE(s5k6b2yx_start_settings_vision); s_ctrl->msm_sensor_reg->stop_stream_conf = s5k6b2yx_stop_settings_vision; s_ctrl->msm_sensor_reg->stop_stream_conf_size = ARRAY_SIZE(s5k6b2yx_stop_settings_vision); s_ctrl->vision_mode_flag = 1; /*set FPS based on flag set from user space driver*/ if (vision_mode_enable == VISION_MODE_SET_FPS_5) msm_camera_i2c_write(s_ctrl->sensor_i2c_client, VISION_MODE_SET_FPS_ADDR, VISION_MODE_FPS_5_VAL, MSM_CAMERA_I2C_BYTE_DATA); else if (vision_mode_enable == VISION_MODE_SET_FPS_10) msm_camera_i2c_write(s_ctrl->sensor_i2c_client, VISION_MODE_SET_FPS_ADDR, VISION_MODE_FPS_10_VAL, MSM_CAMERA_I2C_BYTE_DATA); } else { /*switch from vision to normal/dual mode */ CAM_DEBUG("set VIS_STBY pin to low"); data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->stby, 0); usleep(1050); CAM_DEBUG("set X_SHUTDOWN pin to high"); data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->reset, 1); CAM_DEBUG("change stream config arrays"); s_ctrl->msm_sensor_reg->start_stream_conf = s5k6b2yx_start_settings; s_ctrl->msm_sensor_reg->start_stream_conf_size = ARRAY_SIZE(s5k6b2yx_start_settings); s_ctrl->msm_sensor_reg->stop_stream_conf = s5k6b2yx_stop_settings; s_ctrl->msm_sensor_reg->stop_stream_conf_size = ARRAY_SIZE(s5k6b2yx_stop_settings); s_ctrl->vision_mode_flag = 0; } CAM_DEBUG("rc=%d : X", rc); return rc; }
static ssize_t cameraflash_file_cmd_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { int value; sscanf(buf, "%d", &value); if (value == 0) { CAM_DEBUG(" [Factory flash]OFF"); s5k8aay_set_flash(MOVIE_FLASH, 0); } else { CAM_DEBUG(" [Factory flash]ON"); s5k8aay_set_flash(MOVIE_FLASH, 1); } return size; }
static int s5k8aay_set_whitebalance(int wb) { CAM_DEBUG(" %d", wb); switch (wb) { case CAMERA_WHITE_BALANCE_AUTO: S5K8_BURST_WRT_LIST(s5k8aay_wb_auto); break; case CAMERA_WHITE_BALANCE_INCANDESCENT: S5K8_BURST_WRT_LIST(s5k8aay_wb_incandescent); break; case CAMERA_WHITE_BALANCE_FLUORESCENT: S5K8_BURST_WRT_LIST(s5k8aay_wb_fluorescent); break; case CAMERA_WHITE_BALANCE_DAYLIGHT: S5K8_BURST_WRT_LIST(s5k8aay_wb_daylight); break; case CAMERA_WHITE_BALANCE_CLOUDY_DAYLIGHT: S5K8_BURST_WRT_LIST(s5k8aay_wb_cloudy); break; default: break; } s5k8aay_ctrl->settings.wb = wb; return 0; }
static int s5k8aay_set_effect(int effect) { CAM_DEBUG(" %d", effect); switch (effect) { case CAMERA_EFFECT_OFF: S5K8_BURST_WRT_LIST(s5k8aay_effect_none); break; case CAMERA_EFFECT_MONO: S5K8_BURST_WRT_LIST(s5k8aay_effect_mono); break; case CAMERA_EFFECT_NEGATIVE: S5K8_BURST_WRT_LIST(s5k8aay_effect_negative); break; case CAMERA_EFFECT_SEPIA: S5K8_BURST_WRT_LIST(s5k8aay_effect_sepia); break; case CAMERA_EFFECT_WHITEBOARD: S5K8_BURST_WRT_LIST(s5k8aay_effect_sketch); break; default: break; } s5k8aay_ctrl->settings.effect = effect; return 0; }
static void s5k8aay_set_frame_rate(int fps) { CAM_DEBUG(" %d", fps); switch (fps) { case 15: S5K8_BURST_WRT_LIST(s5k8aay_vt_15fps); break; case 12: S5K8_BURST_WRT_LIST(s5k8aay_vt_12fps); break; case 10: S5K8_BURST_WRT_LIST(s5k8aay_vt_10fps); break; case 7: S5K8_BURST_WRT_LIST(s5k8aay_vt_7fps); break; default: break; } s5k8aay_ctrl->settings.fps = fps; }
static int ptopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct pt_softc *softc; int error = 0; periph = (struct cam_periph *)dev->si_drv1; if (cam_periph_acquire(periph) != CAM_REQ_CMP) return (ENXIO); softc = (struct pt_softc *)periph->softc; cam_periph_lock(periph); if (softc->flags & PT_FLAG_DEVICE_INVALID) { cam_periph_unlock(periph); cam_periph_release(periph); return(ENXIO); } if ((softc->flags & PT_FLAG_OPEN) == 0) softc->flags |= PT_FLAG_OPEN; else { error = EBUSY; cam_periph_release(periph); } CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ptopen: dev=%s\n", devtoname(dev))); cam_periph_unlock(periph); return (error); }
static int s5k8aay_sensor_config(struct msm_sensor_ctrl_t *s_ctrl, void __user *argp) { struct sensor_cfg_data cfg_data; long rc = 0; if (copy_from_user(&cfg_data, (void *)argp, sizeof(struct sensor_cfg_data))) return -EFAULT; CAM_DEBUG(" cfgtype = %d, mode = %d", cfg_data.cfgtype, cfg_data.mode); switch (cfg_data.cfgtype) { case CFG_SENSOR_INIT: if (config_csi2 == 0) rc = s5k8aay_sensor_setting( UPDATE_PERIODIC, RES_PREVIEW); break; case CFG_SET_MODE: rc = s5k8aay_set_sensor_mode(cfg_data.mode); break; case CFG_GET_AF_MAX_STEPS: default: rc = 0; break; } return rc; }
static void ahciemaction(struct cam_sim *sim, union ccb *ccb) { device_t dev, parent; struct ahci_enclosure *enc; CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_TRACE, ("ahciemaction func_code=%x\n", ccb->ccb_h.func_code)); enc = cam_sim_softc(sim); dev = enc->dev; switch (ccb->ccb_h.func_code) { case XPT_ATA_IO: /* Execute the requested I/O operation */ if (ahci_check_ids(dev, ccb)) return; ahci_em_begin_transaction(dev, ccb); return; case XPT_RESET_BUS: /* Reset the specified bus */ case XPT_RESET_DEV: /* Bus Device Reset the specified device */ ahci_em_reset(dev); ccb->ccb_h.status = CAM_REQ_CMP; break; case XPT_PATH_INQ: /* Path routing inquiry */ { struct ccb_pathinq *cpi = &ccb->cpi; parent = device_get_parent(dev); cpi->version_num = 1; /* XXX??? */ cpi->hba_inquiry = PI_SDTR_ABLE; cpi->target_sprt = 0; cpi->hba_misc = PIM_SEQSCAN; cpi->hba_eng_cnt = 0; cpi->max_target = 0; cpi->max_lun = 0; cpi->initiator_id = 0; cpi->bus_id = cam_sim_bus(sim); cpi->base_transfer_speed = 150000; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "AHCI", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->hba_vendor = pci_get_vendor(parent); cpi->hba_device = pci_get_device(parent); cpi->hba_subvendor = pci_get_subvendor(parent); cpi->hba_subdevice = pci_get_subdevice(parent); cpi->ccb_h.status = CAM_REQ_CMP; break; } default: ccb->ccb_h.status = CAM_REQ_INVALID; break; } xpt_done(ccb); }
void s5k8aay_regs_table_exit(void) { CAM_DEBUG(" %d", __LINE__); if (s5k8aay_regs_table) { vfree(s5k8aay_regs_table); s5k8aay_regs_table = NULL; } }
void cam_ldo_power_off(int mode) { int ret = 0; cam_err("%s CAMERA POWER OFF!!\n", mode ? "FRONT" : "REAR"); /*Sensor AF 2.8V -CAM_AF_2P8 */ if (!mode) { if (l11) { ret = regulator_disable(l11); if (ret) cam_err("error disabling regulator\n"); } } usleep(10); /*VT core 1.2 - CAM_DVDD_1P5V*/ #if defined(CONFIG_SR130PC20) || defined(CONFIG_SR030PC50) if (l29) { ret = regulator_disable(l29); if (ret) cam_err("error disabling regulator\n"); } #else if (l30) { ret = regulator_disable(l30); if (ret) cam_err("error disabling regulator\n"); } #endif usleep(8000); /*Sensor AVDD 2.8V - CAM_SENSOR_A2P8 */ if (l32) { ret = regulator_disable(l32); if (ret) cam_err("error disabling regulator\n"); } usleep(8000); /*Sensor IO 1.8V -CAM_SENSOR_IO_1P8 */ if (l34) { ret = regulator_disable(l34); if (ret) cam_err("error disabling regulator\n"); } usleep(10); /*5M Core 1.2V - CAM_ISP_CORE_1P2*/ gpio_set_value_cansleep(GPIO_CAM_CORE_EN, 0); CAM_DEBUG("%s End!!\n", mode ? "FRONT" : "REAR"); }
void s5k8aay_set_preview(void) { int stable_delay = 250; CAM_DEBUG(" cam_mode = %d, vt_mode = %d", s5k8aay_ctrl->cam_mode, s5k8aay_ctrl->vtcall_mode); if (s5k8aay_ctrl->cam_mode == MOVIE_MODE) { if (s5k8aay_ctrl->settings.preview_size_idx == PREVIEW_SIZE_HD) { CAM_DEBUG(" 720P recording common"); if (s5k8aay_ctrl->op_mode == CAMERA_MODE_INIT || s5k8aay_ctrl->op_mode == CAMERA_MODE_PREVIEW || s5k8aay_ctrl->isHDSize == 0) { s5k8aay_ctrl->isHDSize = 1; S5K8_BURST_WRT_LIST(s5k8aay_720p_common); } } else { CAM_DEBUG(" VGA recording common"); if (s5k8aay_ctrl->op_mode == CAMERA_MODE_INIT || s5k8aay_ctrl->op_mode == CAMERA_MODE_PREVIEW || s5k8aay_ctrl->isHDSize == 1) { s5k8aay_ctrl->isHDSize = 0; S5K8_BURST_WRT_LIST(s5k8aay_recording_common); } } s5k8aay_ctrl->op_mode = CAMERA_MODE_RECORDING; stable_delay = 150; } else { if (s5k8aay_ctrl->op_mode == CAMERA_MODE_INIT || s5k8aay_ctrl->op_mode == CAMERA_MODE_RECORDING) { if (s5k8aay_ctrl->vtcall_mode == 1) { CAM_DEBUG(" VT common"); S5K8_BURST_WRT_LIST(s5k8aay_skt_vt_common); stable_delay = 350; } else if (s5k8aay_ctrl->vtcall_mode == 2) { CAM_DEBUG(" WIFI VT common"); S5K8_BURST_WRT_LIST(s5k8aay_wifi_vt_common); stable_delay = 150; } else if (s5k8aay_ctrl->vtcall_mode == 3) { CAM_DEBUG(" FACE DETECTION common"); S5K8_BURST_WRT_LIST(s5k8aay_fd_common); stable_delay = 250; } else { CAM_DEBUG(" Normal common"); S5K8_BURST_WRT_LIST(s5k8aay_common); stable_delay = 250; } } S5K8_WRT_LIST(s5k8aay_preview); /* add delay 150ms */ s5k8aay_ctrl->op_mode = CAMERA_MODE_PREVIEW; } s5k8aay_set_ev(s5k8aay_ctrl->settings.brightness); if (!g_bFrontCameraRunning) { g_bFrontCameraRunning = true; msleep(stable_delay); } }
void s5k8aay_set_capture(void) { CAM_DEBUG(" E"); S5K8_BURST_WRT_LIST(s5k8aay_capture); s5k8aay_get_exif_shutter_speed(); s5k8aay_get_exif_iso_speed_rate(); s5k8aay_ctrl->op_mode = CAMERA_MODE_CAPTURE; }
static int s5k8aay_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl) { int rc = 0; int temp = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; CAM_DEBUG(" E"); #ifdef CONFIG_LOAD_FILE s5k8aay_regs_table_exit(); #endif gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 0); temp = gpio_get_value(data->sensor_platform_info->sensor_reset); gpio_set_value_cansleep(data->sensor_platform_info->sensor_stby, 0); temp = gpio_get_value(data->sensor_platform_info->sensor_stby); gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_reset, 0); temp = gpio_get_value(data->sensor_platform_info->vt_sensor_reset); usleep(10); /* 20clk = 0.833us */ gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_stby, 0); temp = gpio_get_value(data->sensor_platform_info->vt_sensor_stby); /*CAM_MCLK0*/ msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev, cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 0); gpio_tlmm_config(GPIO_CFG(data->sensor_platform_info->mclk, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); data->sensor_platform_info->sensor_power_off(1); rc = msm_camera_request_gpio_table(data, 0); if (rc < 0) cam_err(" request gpio failed"); CAM_DEBUG(" X"); return rc; }
int s5k6aafx_sensor_release(void) { int rc = 0; /* down(&m5mo_sem); */ CAM_DEBUG("POWER OFF"); printk("camera turn off\n"); CAM_DEBUG(" 1. CAM_VT_RST = 0 "); gpio_set_value_cansleep(CAM_VT_RST, 0); mdelay(2); CAM_DEBUG(" 2. CAM_VT_nSTBY = 0 "); gpio_set_value_cansleep(CAM_VT_nSTBY, 0); CAM_DEBUG(" 2. CAM_EN = 0 "); gpio_set_value(CAM_EN, 0); /* if(system_rev >= 4) { CAM_DEBUG(" 2. CAM_SENSOR_A_EN = 0 "); gpio_set_value_cansleep(CAM_SENSOR_A_EN, 0); CAM_DEBUG(" 2. CAM_SENSOR_A_EN_ALTER = 0 "); gpio_set_value_cansleep(CAM_SENSOR_A_EN_ALTER, 0); vreg_disable(vreg_CAM_AF28); } */ //cam_pmic_onoff(0); kfree(s5k6aafx_ctrl); #ifdef CONFIG_LOAD_FILE s5k6aafx_regs_table_exit(); #endif /* up(&m5mo_sem); */ return rc; }
void msm_camera_gpio_install(void) { CAM_DEBUG("Camera GPIO install!!\n"); /*GPIO_CAM_CORE_EN : GPIO 1*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM_CORE_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Flash SOURCE EN : GPIO 3*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM_FLASH_SOURCE_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*CAM_MCLK1 : GPIO 4*/ gpio_tlmm_config(GPIO_CFG(GPIO_SUB_CAM_MCLK, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); /*CAM_MCLK0 : GPIO 5*/ gpio_tlmm_config(GPIO_CFG(GPIO_MAIN_CAM_MCLK, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); /*Main cam stby : GPIO 51*/ gpio_tlmm_config(GPIO_CFG(GPIO_MAIN_STBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Front cam stby : GPIO 52*/ gpio_tlmm_config(GPIO_CFG(GPIO_VT_STBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Flash SET/EN : GPIO 63/64*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM_FLASH_SET, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); gpio_tlmm_config(GPIO_CFG(GPIO_CAM_FLASH_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Front cam reset : GPIO 76*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM2_RST_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Main cam reset : GPIO 107*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM1_RST_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); CAM_DEBUG("Finish!!\n"); }
static void ptstart(struct cam_periph *periph, union ccb *start_ccb) { struct pt_softc *softc; struct bio *bp; softc = (struct pt_softc *)periph->softc; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("ptstart\n")); /* * See if there is a buf with work for us to do.. */ bp = bioq_first(&softc->bio_queue); if (bp == NULL) { xpt_release_ccb(start_ccb); } else { bioq_remove(&softc->bio_queue, bp); devstat_start_transaction_bio(softc->device_stats, bp); scsi_send_receive(&start_ccb->csio, /*retries*/4, ptdone, MSG_SIMPLE_Q_TAG, bp->bio_cmd == BIO_READ, /*byte2*/0, bp->bio_bcount, bp->bio_data, /*sense_len*/SSD_FULL_SIZE, /*timeout*/softc->io_timeout); start_ccb->ccb_h.ccb_state = PT_CCB_BUFFER_IO_UA; /* * Block out any asynchronous callbacks * while we touch the pending ccb list. */ LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, periph_links.le); start_ccb->ccb_h.ccb_bp = bp; bp = bioq_first(&softc->bio_queue); xpt_action(start_ccb); if (bp != NULL) { /* Have more work to do, so ensure we stay scheduled */ xpt_schedule(periph, CAM_PRIORITY_NORMAL); } } }
void s5k8aay_regs_table_init(void) { struct file *filp; char *dp; long lsize; loff_t pos; int ret; /*Get the current address space */ mm_segment_t fs = get_fs(); CAM_DEBUG(" %d", __LINE__); /*Set the current segment to kernel data segment */ set_fs(get_ds()); filp = filp_open("/mnt/sdcard/s5k8aay_regs_v2.h", O_RDONLY, 0); if (IS_ERR_OR_NULL(filp)) { cam_err(" file open error"); return ; } lsize = filp->f_path.dentry->d_inode->i_size; dp = vmalloc(lsize); if (dp == NULL) { cam_err(" Out of Memory"); filp_close(filp, current->files); } pos = 0; memset(dp, 0, lsize); ret = vfs_read(filp, (char __user *)dp, lsize, &pos); if (ret != lsize) { cam_err(" Failed to read file ret = %d", ret); vfree(dp); filp_close(filp, current->files); } /*close the file*/ filp_close(filp, current->files); /*restore the previous address space*/ set_fs(fs); s5k8aay_regs_table = dp; s5k8aay_regs_table_size = lsize; *((s5k8aay_regs_table + s5k8aay_regs_table_size) - 1) = '\0'; return; }
/* * Change normal/backlight AEC for vision mode * aec_mode: * 0 = normal * 1 = backlight */ int s5k6b2yx_sensor_set_vision_ae_control( struct msm_sensor_ctrl_t *s_ctrl, int ae_mode) { if(s_ctrl->vision_mode_flag == 0) { cam_err("Error: sensor not in vision mode, cannot set AE."); return -1; } if(ae_mode == 0) { msm_camera_i2c_write(s_ctrl->sensor_i2c_client, VISION_MODE_AE_REG_ADDR, VISION_MODE_AE_NORMAL, MSM_CAMERA_I2C_BYTE_DATA); CAM_DEBUG("normal mode AEC set"); } else { msm_camera_i2c_write(s_ctrl->sensor_i2c_client, VISION_MODE_AE_REG_ADDR, VISION_MODE_AE_BACKLIGHT, MSM_CAMERA_I2C_BYTE_DATA); CAM_DEBUG("backlight mode AEC set"); } return 0; }
void msm_camera_gpio_install(void) { CAM_DEBUG("Camera GPIO install!!\n"); /*Flash Set : GPIO 3*/ gpio_tlmm_config(GPIO_CFG(GPIO_MSM_FLASH_NOW, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); #if !defined(CONFIG_MACH_EXPRESS) /*CAM_MCLK1 : GPIO 4*/ gpio_tlmm_config(GPIO_CFG(GPIO_SUB_CAM_MCLK, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); #endif /*CAM_MCLK0 : GPIO 5*/ gpio_tlmm_config(GPIO_CFG(GPIO_MAIN_CAM_MCLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); /*GPIO_CAM_CORE_EN : GPIO 6*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM_CORE_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Front cam stby : GPIO 18*/ gpio_tlmm_config(GPIO_CFG(GPIO_VT_STBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Main cam stby : GPIO 54*/ gpio_tlmm_config(GPIO_CFG(GPIO_MAIN_STBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); gpio_tlmm_config(GPIO_CFG(GPIO_FLASH_LED_UNLOCK, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Front cam reset : GPIO 76*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM2_RST_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*Main cam reset : GPIO 107*/ gpio_tlmm_config(GPIO_CFG(GPIO_CAM1_RST_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_16MA), GPIO_CFG_ENABLE); CAM_DEBUG("Finish!!\n"); }
static int s5k6aafx_start(void) { int rc=0; unsigned short value=0; CAM_DEBUG("%s E\n",__FUNCTION__); //s5k6aafx_i2c_test(); //s5k6aafx_i2c_write_list(INIT_DATA,sizeof(INIT_DATA)/sizeof(INIT_DATA[0]),"INIT_DATA"); #if 0 s5k6aafx_i2c_write_list(reg_init_list,sizeof(reg_init_list)/sizeof(reg_init_list[0]),"reg_init_list"); s5k6aafx_i2c_write_list(reg_effect_none_list,sizeof(reg_effect_none_list)/sizeof(reg_effect_none_list[0]),"reg_effect_none_list"); s5k6aafx_i2c_write_list(reg_meter_center_list,sizeof(reg_meter_center_list)/sizeof(reg_meter_center_list[0]),"reg_meter_center_list"); s5k6aafx_i2c_write_list(reg_wb_auto_list,sizeof(reg_wb_auto_list)/sizeof(reg_wb_auto_list[0]),"reg_wb_auto_list"); #endif s5k6aafx_i2c_read(0x00,0x7b,&value); CAM_DEBUG(" 0x7b value : 0x%x\n",value); /* s5k6aafx_i2c_read(0x00,0x00,&value); CAM_DEBUG("read test -- reg - 0x%x, value - 0x%x\n",0x00 , value); */ return rc; }
int cam_pmic_onoff(int onoff) { static int last_state = -1; if(last_state == onoff) { CAM_DEBUG("%s : PMIC already %d\n",__FUNCTION__,onoff); return 0; } if(onoff) // ON { CAM_DEBUG("%s ON\n",__FUNCTION__); //gpio_direction_output(CAM_PMIC_STBY, LOW); // set PMIC to STBY mode gpio_set_value(CAM_PMIC_STBY, 0); mdelay(2); cam_pm_lp8720_i2c_write(0x07, 0x09); // BUCKS2:1.2V, no delay cam_pm_lp8720_i2c_write(0x04, 0x05); // LDO4:1.2V, no delay cam_pm_lp8720_i2c_write(0x02, 0x19); // LDO2 :2.8V, no delay cam_pm_lp8720_i2c_write(0x05, 0x0C); // LDO5 :1.8V, no delay cam_pm_lp8720_i2c_write(0x01, 0x19); // LDO1 :2.8V, no delay cam_pm_lp8720_i2c_write(0x08, 0xBB); // Enable all power without LDO3 //gpio_direction_output(CAM_PMIC_STBY, HIGH); gpio_set_value(CAM_PMIC_STBY, 1); mdelay(5); } else { CAM_DEBUG("%s OFF\n",__FUNCTION__); } return 0; }
static int s5k6b2yx_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int rc = 0; /* int err; u32 int_factor; int temp = 0; */ struct msm_camera_sensor_info *data = s_ctrl->sensordata; CAM_DEBUG("E"); CAM_DEBUG("s5k6b2yx_sensor_power_up(1) : i2c_scl: %d, i2c_sda: %d\n", gpio_get_value(85), gpio_get_value(84)); rc = msm_camera_request_gpio_table(data, 1); if (rc < 0) pr_err("%s: request gpio failed\n", __func__); CAM_DEBUG("s5k6b2yx_sensor_power_up(2) : i2c_scl: %d, i2c_sda: %d\n", gpio_get_value(85), gpio_get_value(84)); /* Power on */ data->sensor_platform_info->sensor_power_on(); 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); usleep(1200); CAM_DEBUG("s5k6b2yx_sensor_power_up(3) : i2c_scl: %d, i2c_sda: %d\n", gpio_get_value(85), gpio_get_value(84)); /* VT_CAM_RESET */ data->sensor_platform_info-> sensor_pmic_gpio_ctrl(data->sensor_platform_info->reset, 1); usleep(50); /* MCLK */ 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__); CAM_DEBUG("s5k6b2yx_sensor_power_up(4) : i2c_scl: %d, i2c_sda: %d\n", gpio_get_value(85), gpio_get_value(84)); usleep(5000); CAM_DEBUG("X"); return rc; }