static ssize_t flash_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { if(*buf == '0') { pr_info("%s: torch flash off\n", __func__); gpio_request_one(GPIO_TORCH_EN, GPIOF_OUT_INIT_LOW, "FLASH_OUTPUT_LOW"); gpio_free(GPIO_TORCH_EN); if(__gpio_get_value(GPIO_MAIN_CAM_RST)) { pr_err("%s: torch flash off on running camera.(%d)!!\n", __func__, __gpio_get_value(GPIO_MAIN_CAM_RST)); /* hand over the permission in order to handle the flash pins in the isp of camera. */ s3c_gpio_cfgpin(GPIO_TORCH_EN, (2 << 16)); s3c_gpio_setpull(GPIO_TORCH_EN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GPIO_FLASH_EN, (2 << 24)); s3c_gpio_setpull(GPIO_FLASH_EN, S3C_GPIO_PULL_NONE); } } else { pr_info("%s: torch flash on\n", __func__); gpio_request_one(GPIO_TORCH_EN, GPIOF_OUT_INIT_HIGH, "FLASH_OUTPUT_HIGH"); gpio_free(GPIO_TORCH_EN); } return count; }
static void gpio_btn_timer_handler(unsigned long data) { gpio_btn_timer.expires = jiffies + 1 * HZ; printk(" the gpio timer is called ! time is %d \n", btn_time); if ( btn_time<5 ) { if (__gpio_get_value(GPIO_BTN)==1) { printk("*** Begin rebooting system!! \n"); gpio_direction_output(GPIO_BTN2,0); } else { btn_time++; mod_timer(&gpio_btn_timer,jiffies + 1 * HZ); } } else { if (__gpio_get_value(GPIO_BTN)==1) { printk("*** You can realize restore functionality yourself! \n"); //queue_work(gpio_btn_wq, gpio_btn_wk); del_timer(&gpio_btn_timer); } else { btn_time++; mod_timer(&gpio_btn_timer,jiffies + 1 * HZ); } } }
int sr130pc10_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; pr_info("=== POWER DOWN Start ==="); sr130pc10_sensor_write(0x03, 0x02); sr130pc10_sensor_write(0x55, 0x10); mdelay(1); udelay(50); gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 0); temp = __gpio_get_value(data->sensor_platform_info->sensor_reset); pr_info("[%s]check sensor_reset : %d\n", __func__, temp); gpio_set_value_cansleep(data->sensor_platform_info->sensor_stby, 0); temp = __gpio_get_value(data->sensor_platform_info->sensor_stby); pr_info("[%s]check sensor_stby : %d\n", __func__, temp); gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_reset, 0); temp = __gpio_get_value(data->sensor_platform_info->vt_sensor_reset); pr_info("[%s]check vt_sensor_reset : %d\n", __func__, temp); mdelay(2); /*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); udelay(10); gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_stby, 0); temp = __gpio_get_value(data->sensor_platform_info->vt_sensor_stby); pr_info("[%s] check VT standby : %d", __func__, temp); udelay(10); data->sensor_platform_info->sensor_power_off(1); msm_camera_request_gpio_table(data, 0); sr130pc10_ctrl->op_mode = 0; sr130pc10_ctrl->dtp_mode = 0; sr130pc10_ctrl->settings.exposure = 0; #ifdef CONFIG_LOAD_FILE sr130pc10_regs_table_exit(); #endif return rc; }
/* * Refer to MSM_CAM_IOCTL_FLASH_LED_CFG used by mm-camera in user space * flash_led_enable is set in apps's menu item selected by user * 0: disable Flash LED * 1: enable Flash LED */ int32_t msm_camera_flash_set_led_state(struct msm_camera_sensor_flash_data *fdata, unsigned led_state) { int32_t rc = 0; pr_err("%s: led_state: %d,fdata->flash_type=%d\n", __func__, led_state,fdata->flash_type); if (fdata->flash_type != MSM_CAMERA_FLASH_LED) { return -ENODEV; } switch(led_state) { case MSM_CAMERA_LED_OFF: if( __gpio_get_value(MSM_CAMERA_FLASH_LED_GPIO)) msm_camera_flash_set_led_gpio(0); break; case MSM_CAMERA_LED_LOW: if (flash_led_enable==1) {//MSM_LED_MODE_ON msm_camera_set_flash_torch_mode(5); } else if(flash_led_enable==2) { //MSM_LED_MODE_AUTO if(zte_get_flash_auto_flag_value()== 1) { msm_camera_set_flash_torch_mode(5); } } break; case MSM_CAMERA_LED_HIGH: msm_camera_flash_led_enable(); break; case MSM_CAMERA_LED_RELEASE: if( __gpio_get_value(MSM_CAMERA_FLASH_LED_GPIO)) msm_camera_flash_set_led_gpio(0); break; default: rc = -EFAULT; pr_err("%s: rc=%d\n", __func__, rc); return rc; } return rc; }
/* Put data into the proc fs file. * * Arguments * ========= * 1. The buffer where the data is to be inserted, if * you decide to use it. * 2. A pointer to a pointer to characters. This is * useful if you don't want to use the buffer * allocated by the kernel. * 3. The current position in the file * 4. The size of the buffer in the first argument. * 5. Write a "1" here to indicate EOF. * 6. A pointer to data (useful in case one common * read for multiple /proc/... entries) * * Usage and Return Value * ====================== * A return value of zero means you have no further * information at this time (end of file). A negative * return value is an error condition. * * For More Information * ==================== * The way I discovered what to do with this function * wasn't by reading documentation, but by reading the * code which used it. I just looked to see what uses * the get_info field of proc_dir_entry struct (I used a * combination of find and grep, if you're interested), * and I saw that it is used in <kernel source * directory>/fs/proc/array.c. * * If something is unknown about the kernel, this is * usually the way to go. In Linux we have the great * advantage of having the kernel source code for * free - use it. */ static int procfile_read(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data) { int ret; int value = -1; if (offset > 0) { /* we have finished to read, return 0 */ ret = 0; } else { if(lid_stat >=0){ gpio_direction_input(lid_stat); value = __gpio_get_value(lid_stat); /* fill the buffer, return the buffer size */ ret = sprintf(buffer,"%d",value); }else{ printk("err! have not set wmt.gpo.printer uboot variant\n"); ret = -1; } } return ret; }
int gpio_get_value(unsigned gpio) { if (gpio < ath79_gpio_count) return __ath79_gpio_get_value(gpio); return __gpio_get_value(gpio); }
static int hall_out_status_show(struct seq_file *s, void *unused) { int state; state = __gpio_get_value(CEI_HALL_OUT); seq_printf(s, "%d\n", state); return 0; }
static void hall_out_handler(unsigned long data) { /**/ #if 0 int state; state = __gpio_get_value(CEI_HALL_OUT); kpd_print("[Keypad] state = %d , old_INT_stat = %d \n", (int)state, old_INT_stat); if(old_INT_stat != state) { if(state == 1) { kpd_print("[Keypad] hall_out (0 -> 1) OPEN\n"); } else { kpd_print("[Keypad] hall_out (1 -> 0) CLOSE\n"); } old_INT_stat = state; switch_set_state((struct switch_dev *)&sdev, state); } #endif kpd_print("[Keypad] %s() Enter\n", __FUNCTION__); schedule_delayed_work(&hall_work, 0); /**/ enable_irq(hall_irqnr); }
static int gpio_sw_data_get(struct gpio_sw_classdev *gpio_sw_cdev) { struct gpio_sw *gpio = to_gpio(gpio_sw_cdev); int ret; ret = __gpio_get_value(gpio->cdev.pio_hdle); return ret; }
__s32 ir_gpio_read_one_pin_value(u32 p_handler, const char *gpio_name) { if(p_handler) { return __gpio_get_value(p_handler); } printk("OSAL_GPIO_DevREAD_ONEPIN_DATA, hdl is NULL\n"); return -1; }
__s32 OSAL_GPIO_DevREAD_ONEPIN_DATA(u32 p_handler, const char *gpio_name) { if(p_handler) { return __gpio_get_value(p_handler); } __wrn("OSAL_GPIO_DevREAD_ONEPIN_DATA, hdl is NULL\n"); return -1; }
static bool musb_is_host(void) { u8 devctl = 0; int iddig_state = 1; bool usb_is_host = 0; DBG(0, "will mask PMIC charger detection\n"); #ifndef FPGA_PLATFORM pmic_chrdet_int_en(0); #endif musb_platform_enable(mtk_musb); #ifdef ID_PIN_USE_EX_EINT #ifndef CONFIG_MTK_FPGA #ifdef CONFIG_OF #if defined(CONFIG_MTK_LEGACY) iddig_state = mt_get_gpio_in(iddig_pin); #else iddig_state = __gpio_get_value(iddig_pin); #endif #else iddig_state = mt_get_gpio_in(GPIO_OTG_IDDIG_EINT_PIN); #endif DBG(0, "iddig_state = %d\n", iddig_state); #endif #else iddig_state = 0; devctl = musb_readb(mtk_musb->mregs, MUSB_DEVCTL); DBG(0, "devctl = %x before end session\n", devctl); devctl &= ~MUSB_DEVCTL_SESSION; /* this will cause A-device change back to B-device after A-cable plug out */ musb_writeb(mtk_musb->mregs, MUSB_DEVCTL, devctl); msleep(delay_time); devctl = musb_readb(mtk_musb->mregs, MUSB_DEVCTL); DBG(0, "devctl = %x before set session\n", devctl); devctl |= MUSB_DEVCTL_SESSION; musb_writeb(mtk_musb->mregs, MUSB_DEVCTL, devctl); msleep(delay_time1); devctl = musb_readb(mtk_musb->mregs, MUSB_DEVCTL); DBG(0, "devclt = %x\n", devctl); #endif if (devctl & MUSB_DEVCTL_BDEVICE || iddig_state) { DBG(0, "will unmask PMIC charger detection\n"); #ifndef FPGA_PLATFORM pmic_chrdet_int_en(1); #endif usb_is_host = false; } else { usb_is_host = true; } DBG(0, "usb_is_host = %d\n", usb_is_host); return usb_is_host; }
int cy_as_hal_detect_SD(void) { uint8_t f_det; f_det = __gpio_get_value(AST__rn_b); if( f_det ) // removed; return 0; //inserted return 1; }
static irqreturn_t host_notifier_currentlimit_irq_isr(int irq, void *data) { unsigned long flags = 0; int gpio_value = 0; irqreturn_t ret = IRQ_NONE; spin_lock_irqsave(&ninfo.vbus_gpio.lock, flags); gpio_value = __gpio_get_value(ninfo.pdata->gpio); if (ninfo.vbus_gpio.gpio_status != gpio_value) { ninfo.vbus_gpio.gpio_status = gpio_value; ret = IRQ_WAKE_THREAD; } else ret = IRQ_HANDLED; spin_unlock_irqrestore(&ninfo.vbus_gpio.lock, flags); return ret; }
int gpio_get_value(unsigned gpio) { u32 val; u32 mask; if (gpio >= STLS2F_N_GPIO) return __gpio_get_value(gpio); mask = 1 << (gpio + STLS2F_GPIO_IN_OFFSET); spin_lock(&gpio_lock); val = LOONGSON_GPIODATA; spin_unlock(&gpio_lock); return ((val & mask) != 0); }
unsigned int hwid_map(void) { int i, hwid_logic=0; int rc=-1; for(i=0; i<ARRAY_SIZE(HWID_GPIO); i++) { hwid_logic +=( ( !!__gpio_get_value(HWID_GPIO[i].gpio) ) << i ); } pr_info("HWID_LOGIC 0x%x\r\n",hwid_logic); if(of_machine_is_compatible("qcom,msm8916")) { HWID_MAP=HWID_MAP_8916; pr_info("CPU 8916 HWID MAP\r\n"); } else if (of_machine_is_compatible("qcom,msm8936")) { HWID_MAP=HWID_MAP_8936; pr_info("CPU 8936 HWID MAP\r\n"); } else if (of_machine_is_compatible("qcom,msm8939")) { HWID_MAP=HWID_MAP_8936; //use 8936 HWID MAP replace pr_info("CPU 8939 HWID MAP\r\n"); } else { HWID_MAP=HWID_MAP_8936; pr_info("use default CPU 8936 HWID MAP\r\n"); } for(i=0; HWID_MAP[i].HWID_LOGIC!=0xff; i++) { if(hwid_logic==HWID_MAP[i].HWID_LOGIC) { FIH_PROJECT_ID = HWID_MAP[i].PROJECT; FIH_BAND_ID = HWID_MAP[i].BAND; FIH_PHASE_ID = HWID_MAP[i].PHASE; FIH_SIM_ID = HWID_MAP[i].SIM; rc=0; break; } } return rc; }
static ssize_t data_read_normalmode(struct file *file, char __user *data, size_t count, loff_t *ppos) { ssize_t size = 0; int value = 0; int* gpio = file->private_data; value = __gpio_get_value(*gpio); if(value == 0) size = simple_read_from_buffer(data, count, ppos, "OFF\n", sizeof("OFF\n")); else if(value == 1) size = simple_read_from_buffer(data, count, ppos, "ON\n", sizeof("ON\n")); else pr_err("%s : GPIO_LED wrong data\n", __func__); return size; }
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) { const struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned int type = button->type ?: EV_KEY; int state = (__gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; pr_info("[KEY] code:%d, value:%d\n", button->code, !!state); #ifdef CONFIG_SEC_DEBUG sec_debug_check_crash_key(button->code, state); #endif if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value); } else { input_event(input, type, button->code, !!state); } input_sync(input); }
static irqreturn_t sunxi_isr_gk(int irq, void *dummy) { dprintk(DEBUG_INT, "sunxi gpio key int \n"); mutex_lock(&gk_mutex); if(__gpio_get_value(power_key_io.gpio)){ if (suspend_flg) { input_report_key(sunxigk_dev, KEY_POWER, 1); input_sync(sunxigk_dev); dprintk(DEBUG_INT, "report data: power key down \n"); suspend_flg = 0; } input_report_key(sunxigk_dev, KEY_POWER, 0); input_sync(sunxigk_dev); dprintk(DEBUG_INT, "report data: power key up \n"); }else{ input_report_key(sunxigk_dev, KEY_POWER, 1); input_sync(sunxigk_dev); dprintk(DEBUG_INT, "report data: power key down \n"); suspend_flg = 0; } mutex_unlock(&gk_mutex); return IRQ_HANDLED; }
static void hall_work_func(struct work_struct *work) { int state; state = __gpio_get_value(CEI_HALL_OUT); kpd_print("[Keypad] state = %d , old_INT_stat = %d \n", (int)state, old_INT_stat); mutex_lock(&hall_state_mutex); if(old_INT_stat != state) { if(state == 1) { kpd_print("[Keypad] hall_out (0 -> 1) OPEN\n"); } else { kpd_print("[Keypad] hall_out (1 -> 0) CLOSE\n"); } old_INT_stat = state; switch_set_state((struct switch_dev *)&sdev, state); } mutex_unlock(&hall_state_mutex); }
static int aspenite_u2o_vbus_status(unsigned int base) { int otg_stat1, otg_stat2, otg_pen, status = VBUS_LOW; unsigned long flags; local_irq_save(flags); #if 0 /* remove the workaroud here */ #ifdef CONFIG_USB_OTG /* FIXME on aspenite R0 boards otg stat1/stat2 could not * reflect VBUS status yet, check with U2O itself instead */ if (u2o_get(base, U2xOTGSC) & U2xOTGSC_BSV) status = VBUS_HIGH; else status = VBUS_LOW; return status; #endif #endif if (gpio_request(gpio_usb_otg_pen, "USB OTG Power Enable")) { printk(KERN_ERR "%s Max7312 USB_OTG_PEN GPIO Request" " Failed\n", __func__); return -1; } if (gpio_request(gpio_usb_otg_stat1, "USB OTG VBUS stat1")) { printk(KERN_ERR "%s Max7312 USB_OTG_STAT1 GPIO Request" " Failed\n", __func__); return -1; } if (gpio_request(gpio_usb_otg_stat2, "USB OTG Power Enable")) { printk(KERN_ERR "%s Max7312 USB_OTG_STAT2 GPIO Request" " Failed\n", __func__); return -1; } gpio_direction_input(gpio_usb_otg_pen); gpio_direction_input(gpio_usb_otg_stat1); gpio_direction_input(gpio_usb_otg_stat2); otg_pen = __gpio_get_value(gpio_usb_otg_pen); otg_stat1 = __gpio_get_value(gpio_usb_otg_stat1); otg_stat2 = __gpio_get_value(gpio_usb_otg_stat2); if (otg_pen) { status = VBUS_CHARGE; if (otg_stat1 && otg_stat2) { status |= VBUS_HIGH; } } else { /* workaroud for some aspenite rev1 board that stat1=1 * though vbus high, conflict with max3355 spec * if (!otg_stat1 && !otg_stat2) */ if (!otg_stat2) { status = VBUS_HIGH; } } printk(KERN_DEBUG "%s otg_pen %d stat1 %d stat2 %d status %d\n\n", __func__, otg_pen, otg_stat1, otg_stat2, status); gpio_free(gpio_usb_otg_pen); gpio_free(gpio_usb_otg_stat1); gpio_free(gpio_usb_otg_stat2); local_irq_restore(flags); return status; }
static void hph_switch_gpio_L(void) { gpio_set_value(g_es9018_priv->es9018_data->hph_switch, 0); pr_debug("%s(): hph_switch = %d\n", __func__, __gpio_get_value(g_es9018_priv->es9018_data->hph_switch)); }
static int sr130pc10_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl) { int err = 0; int rc = 0; int temp = 0; struct msm_camera_sensor_info *data = s_ctrl->sensordata; #ifdef CONFIG_LOAD_FILE if (0 > sr130pc10_regs_table_init()) { CDBG("%s file open failed!\n", __func__); rc = -1; goto FAIL_END; } #endif sr130pc10_ctrl->op_mode = 0; sr130pc10_ctrl->dtp_mode = 0; sr130pc10_ctrl->cam_mode = SENSOR_CAMERA; sr130pc10_ctrl->settings.exposure = 0; pr_info("=== Start ==="); rc = msm_camera_request_gpio_table(data, 1); if (rc < 0) pr_info(" request gpio failed"); gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_stby, 0); temp = __gpio_get_value(data->sensor_platform_info->vt_sensor_stby); pr_info("check VT standby : %d", temp); gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_reset, 0); temp = __gpio_get_value(data->sensor_platform_info->vt_sensor_reset); pr_info("check VT reset : %d", temp); gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 0); temp = __gpio_get_value(data->sensor_platform_info->sensor_reset); pr_info("CAM_3M_RST : %d", temp); gpio_set_value_cansleep(data->sensor_platform_info->sensor_stby, 0); temp = __gpio_get_value(data->sensor_platform_info->sensor_stby); pr_info("CAM_3M_ISP_INIT : %d", temp); /*Power on the LDOs */ data->sensor_platform_info->sensor_power_on(1); udelay(10); /*standy VT */ gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_stby, 1); temp = __gpio_get_value(data->sensor_platform_info->vt_sensor_stby); pr_info("check VT standby : %d", temp); udelay(10); /*Set Main clock */ gpio_tlmm_config(GPIO_CFG(data->sensor_platform_info->mclk, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); 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) { gpio_tlmm_config(GPIO_CFG(data->sensor_platform_info->mclk, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); pr_info(" Mclk enable failed"); } if (rc != 0) goto FAIL_END; mdelay(12); /*reset VT */ gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_reset, 1); temp = __gpio_get_value(data->sensor_platform_info->vt_sensor_reset); pr_info("check VT reset : %d", temp); udelay(1500); err = sr130pc10_sensor_write_list(sr130pc10_i2c_check, sizeof(sr130pc10_i2c_check) / sizeof(sr130pc10_i2c_check[0]), "sr130pc10_i2c_check"); if (err == -EINVAL) { cam_err("[sr130pc20] start1 fail!\n"); 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); udelay(10); msm_camera_request_gpio_table(data, 0); return -EIO; } FAIL_END: if (rc) { pr_info("Power up Failed!!"); msm_camera_request_gpio_table(data, 0); } else { pr_info("power up x"); } return rc; }
static int tegra_get_accpower_level(int irq) { return __gpio_get_value((unsigned)irq_to_gpio(irq)); }
static void power_gpio_H(void) { gpio_set_value(g_es9018_priv->es9018_data->power_gpio, 1); pr_debug("%s(): pa_gpio_level = %d\n", __func__, __gpio_get_value(g_es9018_priv->es9018_data->power_gpio)); }
static void __init gpio_btn(void) { int error,error2; int irq; int ret; orion_gpio_set_valid(GPIO_BTN, GPIO_INPUT_OK); orion_gpio_set_valid(GPIO_BTN2, GPIO_OUTPUT_OK); error = gpio_request(GPIO_BTN, "gpio_btn"); error2 = gpio_request(GPIO_BTN2, "gpio_btn2"); if ( error<0 || error2<0 ) { pr_err("gpio_btn: failed to request GPIO %d, error %d; error2 %d \n",GPIO_BTN, error,error2); } error = gpio_direction_input(GPIO_BTN); if ( error<0 ) { pr_err("gpio_btn: failed to configure input for GPIO %d, error %d; error2 %d \n",GPIO_BTN, error,error2); } irq = gpio_to_irq(GPIO_BTN); if ( irq < 0) { pr_err("gpio_btn: Unable to get irq number for GPIO %d, error %d \n",GPIO_BTN, irq); } error = request_irq(irq, gpio_btn_handler, IRQF_TRIGGER_FALLING, "gpio_btn", NULL); if ( error ) { pr_err("gpio_btn: failed to request_irq for GPIO/irq %d %d \n",GPIO_BTN,irq); } //platform_device_register(&gpio_dev_btn); printk("gpio_btn is called sucessfully! the initial value is %d, return value is %d \n",__gpio_get_value(GPIO_BTN),ret); }
/* * Return GPIO level */ int pxa_gpio_get_value(unsigned gpio) { return __gpio_get_value(gpio); }
static long sr130pc10_set_sensor_mode(int mode) { int cnt, vsync_value; printk(KERN_DEBUG "[CAM-SENSOR] =Sensor Mode\n "); switch (mode) { case SENSOR_PREVIEW_MODE: case SENSOR_VIDEO_MODE: printk(KERN_DEBUG "[SR130PC10]-> Preview\n"); if (sr130pc10_ctrl->op_mode == 0) { sr130pc10_sensor_write_list(sr130pc10_reg_init, sizeof(sr130pc10_reg_init) / sizeof(sr130pc10_reg_init[0]), "sr130pc10_reg_init"); sr130pc10_ctrl->op_mode = 1; if (sr130pc10_ctrl->dtp_mode == 1) sr130pc10_check_dataline(1); } factory_test = 0; for (cnt = 0; cnt < 200; cnt++) { vsync_value = __gpio_get_value(14); if (vsync_value) { /*printk(KERN_DEBUG " on preview, start cnt:%d vsync_value:%d\n", cnt, vsync_value); */ break; } else { /*printk(KERN_DEBUG " on preview, " "wait cnt:%d vsync_value:%d\n", cnt, vsync_value);*/ /*msleep(1); changed for coding rule*/ udelay(1000); } } printk(KERN_DEBUG " on preview, " "wait cnt:%d vsync_value:%d\n", cnt, vsync_value); sr130pc10_sensor_write_list(sr130pc10_preview_reg, sizeof(sr130pc10_preview_reg) / sizeof(sr130pc10_preview_reg[0]), "sr130pc10_preview_reg"); /* preview start */ if (sr130pc10_ctrl->cam_mode == SENSOR_MOVIE) sr130pc10_set_movie_mode(SENSOR_MOVIE); sr130pc10_set_exposure_value(0, sr130pc10_ctrl->settings.exposure); break; case SENSOR_SNAPSHOT_MODE: case SENSOR_RAW_SNAPSHOT_MODE: printk(KERN_DEBUG "[PGH}-> Capture\n"); if (Flipmode) { sr130pc10_sensor_write_list( sr130pc10_capture_reg_X_Flip, sizeof(sr130pc10_capture_reg_X_Flip) / sizeof(sr130pc10_capture_reg_X_Flip[0]), "sr130pc10_capture_reg_X_Flip"); /* preview start */ } else { sr130pc10_sensor_write_list(sr130pc10_capture_reg, sizeof(sr130pc10_capture_reg) / sizeof(sr130pc10_capture_reg[0]), "sr130pc10_capture_reg"); /* preview start */ } /*SecFeature : for Android CCD preview mirror / snapshot non-mirror if(factory_test == 0) { if(rotation_status == 90 || rotation_status == 270) { sr130pc10_sensor_write(0x03, 0x00); sr130pc10_sensor_write(0x11, 0x93); } else { sr130pc10_sensor_write(0x03, 0x00); sr130pc10_sensor_write(0x11, 0x90); } } */ break; default: return 0; } return 0; }
static int getGpio(unsigned char gpio) { return __gpio_get_value(gpio); }
static void reset_gpio_L(void) { gpio_set_value(g_es9018_priv->es9018_data->reset_gpio, 0); pr_debug("%s(): pa_gpio_level = %d\n", __func__, __gpio_get_value(g_es9018_priv->es9018_data->reset_gpio)); }