Ejemplo n.º 1
0
void * get_camara_interface(int *invvsync)
{
    struct cam_interface *(*cam_table)(int *)=camara_device_table[0];
    struct cam_interface *dev_interface=NULL;

    int i;

    cam_power_set(CAMARA_POWER_ON);

    for(i=0;;i++){
        cam_table=camara_device_table[i];

        if(!*cam_table)
            break;
            
        dev_interface=(*cam_table)(invvsync);
        if(dev_interface){
            printk("get camara interface\n");
            break;
        }
    }
    
    cam_power_set(CAMARA_POWER_OFF);

    if(!dev_interface)
        printk("unkonw camara interface\n");

    return dev_interface;
}
Ejemplo n.º 2
0
/* sensor init */
static int sensor_power_set(int res, int flag)
{
	/*
	 * RES, 0, LOW RESOLUTION, 1 HIGH RESOLUTION
	 * FLAG, 1: ON, 0: OFF
	 * GPIO93 LOW FOR HIGH
	 * GPIO14 LOW FOR LOW
	 */
	int high_pin = mfp_to_gpio(MFP_PIN_GPIO39);
	int low_pin = mfp_to_gpio(MFP_PIN_GPIO40);

	int mipi_sw_sel_pin = mfp_to_gpio(MFP_PIN_GPIO49);
	int mipi_sw_noe_pin = mfp_to_gpio(MFP_PIN_GPIO48);

	cam_power_set(flag);

	if (gpio_request(mipi_sw_noe_pin, "MIPI_SW_NOE")) {
		printk(KERN_ERR "Request GPIO failed,"
			   "gpio: %d\n", mipi_sw_noe_pin);
		return -EIO;
	}
	if (gpio_request(mipi_sw_sel_pin, "MIPI_SW_SEL")) {
		printk(KERN_ERR "Request GPIO failed,"
			   "gpio: %d\n", mipi_sw_sel_pin);
		return -EIO;
	}

	if (res) {
		if (gpio_request(high_pin, "CAM_EANBLE_HI_SENSOR")) {
			printk(KERN_ERR "Request GPIO failed,"
			       "gpio: %d\n", high_pin);
			return -EIO;
		}
		if (flag) {
			gpio_direction_output(high_pin, 0);	/* enable */
			msleep(1);
			gpio_direction_output(mipi_sw_sel_pin, 0);
			gpio_direction_output(mipi_sw_noe_pin, 0);
		} else {
			gpio_direction_output(high_pin, 1);	/* disable */
			gpio_direction_output(mipi_sw_noe_pin, 1);
		}
		gpio_free(high_pin);

	} else {
		if (gpio_request(low_pin, "CAM_EANBLE_LOW_SENSOR")) {
			printk(KERN_ERR "Request GPIO failed,"
			       "gpio: %d\n", low_pin);
			return -EIO;
		}
		if (flag) {
			gpio_direction_output(low_pin, 0);	/* enable */
			msleep(1);
			gpio_direction_output(mipi_sw_sel_pin, 1);
			gpio_direction_output(mipi_sw_noe_pin, 0);
		} else {
			gpio_direction_output(low_pin, 1);	/* disable */
			gpio_direction_output(mipi_sw_noe_pin, 1);
		}
		gpio_free(low_pin);
	}
	gpio_free(mipi_sw_sel_pin);
	gpio_free(mipi_sw_noe_pin);
	return 0;
}