static int ce147_disable_gpio(void)
{
	dprintk(CAM_INF, CE147_MOD_NAME "ce147_disable_gpio is called...\n");

	gpio_direction_output(OMAP3430_GPIO_CAMERA_RST, 0);
	msleep(1);

	gpio_direction_output(OMAP3430_GPIO_CAMERA_STBY, 0);
	msleep(1);   

	/*For camera stanby mode [[*/
	gpio_direction_output(OMAP3430_GPIO_VGA_RST, 0);
	msleep(1);   

	isp_set_xclk(NULL, 0, 0);
	msleep(1);  

	gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 0);
	msleep(1);        
	/*For camera stanby mode ]]*/

	gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 0);
	msleep(1);

	gpio_direction_output(OMAP3430_GPIO_CAMERA_1P2V_EN, 0);
	msleep(1);     

	gpio_direction_output(OMAP3430_GPIO_CAMERA_1P8V_EN, 0);
	msleep(1);

	gpio_direction_output(OMAP3430_GPIO_VGA_SEL, 0);
	msleep(1);

	//Disable PMIC
	if(cam_pmic_write_reg(0x08, 0x80) != 0) {
		printk(CE147_MOD_NAME "Could not request enable voltage");
		return -EIO;	   
	} 

	return 0;     
}
Beispiel #2
0
static int s5k5ccgx_enable_gpio(void)
{
	dprintk(CAM_INF, S5K5CCGX_MOD_NAME "s5k5ccgx_enable_gpio is called...\n");

	if (gpio_request(OMAP3430_GPIO_CAMERA_EN,"CAM EN") != 0)
	{
		printk(S5K5CCGX_MOD_NAME "Could not request GPIO %d\n", OMAP3430_GPIO_CAMERA_EN);
		return -EIO;
	}

	if (gpio_request(OMAP3430_GPIO_CAMERA_RST,"CAM RST") != 0)
	{
		printk(S5K5CCGX_MOD_NAME "Could not request GPIO %d\n", OMAP3430_GPIO_CAMERA_RST);
		return -EIO;
	}

	if (gpio_request(OMAP3430_GPIO_CAMERA_MEGA_EN,"CAM STBY") != 0)
	{
		printk(S5K5CCGX_MOD_NAME "Could not request GPIO %d\n",  OMAP3430_GPIO_CAMERA_MEGA_EN);
		return -EIO;
	}

	/* PMIC init */
	if(cam_pmic_write_reg(0x01, 0x80) != 0) //LDO1 CAM_3M_1.2V
	{
		printk(S5K5CCGX_MOD_NAME "Could not request voltage LDO1 1.2V\n");
		return -EIO;
	}

	if(cam_pmic_write_reg(0x04, 0xB1) != 0) //LDO4 CAM_IO_1.8V
	{
		printk(S5K5CCGX_MOD_NAME "Could not request voltage LDO4 1.8V\n");
		return -EIO;
	}

	if(cam_pmic_write_reg(0x05, 0xDD) != 0) //LDO5 CAM_AF_3.0V
	{
		printk(S5K5CCGX_MOD_NAME "Could not request voltage LDO5 3.0V\n");
		return -EIO;
	}

	if(cam_pmic_write_reg(0x08, 0x9B) != 0) // SETTING disable pin(LDO3)
	{
		printk(S5K5CCGX_MOD_NAME "Could not request SETTING disable pin(LDO3)\n");
		return -EIO;
	}

	/* Reset the GPIO pins */
	gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 0);

	gpio_direction_output(OMAP3430_GPIO_CAMERA_RST, 0);

	isp_set_xclk(0,0,0);

	/* Enable sensor module power */
	gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 1);
	mdelay(10);

	/* Clock Enable */
	isp_set_xclk(0,S5K5CCGX_XCLK,0);
	mdelay(10);

	gpio_direction_output(OMAP3430_GPIO_CAMERA_MEGA_EN, 1);
	mdelay(10);

	/* Activate Reset */
	gpio_direction_output(OMAP3430_GPIO_CAMERA_RST, 1);
	mdelay(10);

	return 0;
}
Beispiel #3
0
static int ce147_enable_gpio(void)
{
  dprintk(CAM_INF, CE147_MOD_NAME "ce147_enable_gpio is called...\n");

  if (gpio_request(OMAP3430_GPIO_CAMERA_EN,"CAM EN") != 0)
  {
    printk(CE147_MOD_NAME "Could not request GPIO %d\n", OMAP3430_GPIO_CAMERA_EN);
    return -EIO;
  }

  if (gpio_request(OMAP3430_GPIO_CAMERA_EN2,"CAM EN2") != 0)
  {
	printk(CE147_MOD_NAME "Could not request GPIO %d\n", OMAP3430_GPIO_CAMERA_EN2);
	return -EIO;
  }

#if (CONFIG_SAMSUNG_REL_HW_REV >= 1)  
  if (gpio_request(OMAP3430_GPIO_CAMERA_EN3,"CAM EN3") != 0) 
  {
    printk(CE147_MOD_NAME "Could not request GPIO %d", OMAP3430_GPIO_CAMERA_EN3);
    return -EIO;
  }
#endif  

  if (gpio_request(OMAP3430_GPIO_CAMERA_RST,"CAM RST") != 0)
  {
    printk(CE147_MOD_NAME "Could not request GPIO %d\n", OMAP3430_GPIO_CAMERA_RST);
    return -EIO;
  }

  if (gpio_request(OMAP3430_GPIO_CAMERA_STBY,"CAM STBY") != 0)
  {
    printk(CE147_MOD_NAME "Could not request GPIO %d\n",  OMAP3430_GPIO_CAMERA_STBY);
    return -EIO;
  }

  if (gpio_request(OMAP3430_GPIO_VGA_RST,"VGA RST") != 0)
  {
    printk(CE147_MOD_NAME "Could not request GPIO %d\n",  OMAP3430_GPIO_VGA_RST);
    return -EIO;
  }

  if (gpio_request(OMAP3430_GPIO_VGA_STBY,"VGA STBY") != 0)
  {
    printk(CE147_MOD_NAME "Could not request GPIO %d\n",  OMAP3430_GPIO_VGA_STBY);
    return -EIO;
  }

  /* PMIC init */
  if(cam_pmic_write_reg(0x01, 0x00) != 0) //LDO1 CAM_SENSOR_CORE_1.2V
  {
    printk(CE147_MOD_NAME "Could not request voltage LDO1 1.2V\n");
    return -EIO;      
  }   
  
  if(cam_pmic_write_reg(0x02, 0xF9) != 0) //LDO2 CAM_ISP_SYS_2.8V
  {
    printk(CE147_MOD_NAME "Could not request voltage LDO2 2.8V\n");
    return -EIO;       
  }
  
  if(cam_pmic_write_reg(0x03, 0xEC) != 0) //LDO3 CAM_ISP_HOST_1.8V
  {
    printk(CE147_MOD_NAME "Could not request voltage LDO3 1.8V\n");
    return -EIO;       
  }

  if(cam_pmic_write_reg(0x04, 0xF1) != 0) //LDO4 CAM_ISP_RAM_1.8V  
  {
    printk(CE147_MOD_NAME "Could not request voltage LDO4 1.8V\n");
    return -EIO;       
  }
  
  if(cam_pmic_write_reg(0x05, 0xF9) != 0) //LDO5 CAM_AF_2.8V
  {
    printk(CE147_MOD_NAME "Could not request voltage LDO5 2.8V\n");
    return -EIO;       
  }
  
  if(cam_pmic_write_reg(0x06, 0x0B) != 0) //BUCK CAM_ISP_CORE_1.3V  
  {
    printk(CE147_MOD_NAME "Could not request voltage BUCK 1.3V\n");
    return -EIO;       
  }

  /* Reset the GPIO pins */
  gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 0);
  gpio_direction_output(OMAP3430_GPIO_CAMERA_EN2, 0);
#if (CONFIG_SAMSUNG_REL_HW_REV >= 1)    
  gpio_direction_output(OMAP3430_GPIO_CAMERA_EN3, 0);      
#endif  
  gpio_direction_output(OMAP3430_GPIO_CAMERA_RST, 0);
  gpio_direction_output(OMAP3430_GPIO_VGA_RST, 0);
  gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 0);  

  isp_set_xclk(0,0,0);

  /* Enable sensor module power */
  gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 1);
  udelay(250);
  gpio_direction_output(OMAP3430_GPIO_CAMERA_EN2, 1);
#if (CONFIG_SAMSUNG_REL_HW_REV >= 1)  
  mdelay(2);
  gpio_direction_output(OMAP3430_GPIO_CAMERA_EN3, 1);
#endif  
  mdelay(5);

  gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 1);  
  mdelay(1);  
  /* Clock Enable */
  isp_set_xclk(0,CE147_XCLK,0);
  mdelay(5);
  gpio_direction_output(OMAP3430_GPIO_VGA_RST, 1);  
  mdelay(8); 
  gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 0); 
  mdelay(5); 
  
  gpio_direction_output(OMAP3430_GPIO_CAMERA_STBY, 1);
  mdelay(10);

  /* Activate Reset */
  gpio_direction_output(OMAP3430_GPIO_CAMERA_RST, 1);
  mdelay(10);

  return 0; 
}
static int ce147_standby_gpio(void)
{
	/* Reset the GPIO pins */
	gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 0);
	gpio_direction_output(OMAP3430_GPIO_CAMERA_1P8V_EN, 0);  
	gpio_direction_output(OMAP3430_GPIO_CAMERA_1P2V_EN, 0);  
	gpio_direction_output(OMAP3430_GPIO_CAMERA_STBY, 0);
	gpio_direction_output(OMAP3430_GPIO_CAMERA_RST, 0);    
	gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 0);        
	gpio_direction_output(OMAP3430_GPIO_VGA_RST, 0);    

	/* XCLK init */
	isp_set_xclk(NULL, 0, 0);

	/* VGA Switch on */  
	gpio_direction_output(OMAP3430_GPIO_VGA_SEL, 0);

	/* PMIC init (need to cam_en high) */  
	if(cam_pmic_write_reg(0x06, 0x09) != 0) {//BUCK 1.2V  
		printk(CE147_MOD_NAME "Could not request voltage BUCK 1.2V");
		return -EIO;       
	}  

	if(cam_pmic_write_reg(0x05, 0xEC) != 0) {//LDO5 1.8V
		printk(CE147_MOD_NAME "Could not request voltage LDO5 1.8V");
		return -EIO;       
	}

	if(cam_pmic_write_reg(0x04, 0xF1) != 0) {//LDO4 1.8V  
		printk(CE147_MOD_NAME "Could not request voltage LDO4 1.8V");
		return -EIO;       
	}

	if(cam_pmic_write_reg(0x03, 0x79) != 0) {//LDO3 2.8V
		printk(CE147_MOD_NAME "Could not request voltage LDO3 2.8V");
		return -EIO;       
	}

	if(cam_pmic_write_reg(0x02, 0x79) != 0) {//LDO2 2.8V
		printk(CE147_MOD_NAME "Could not request voltage LDO2 2.8V");
		return -EIO;       
	}

	if(cam_pmic_write_reg(0x01, 0x79) != 0) {//LDO1 2.8V
		printk(CE147_MOD_NAME "Could not request voltage LDO1 2.8V");
		return -EIO;      
	} 

	//Enable PMIC
	if(cam_pmic_write_reg(0x08, 0xBF) != 0) {
		printk(CE147_MOD_NAME "Could not request enable voltage");
		return -EIO;       
	} 

	/* Enable sensor module power */ 
	gpio_direction_output(OMAP3430_GPIO_CAMERA_1P2V_EN, 1);
	msleep(1); 

	gpio_direction_output(OMAP3430_GPIO_CAMERA_EN, 1);
	msleep(1);  

	gpio_direction_output(OMAP3430_GPIO_CAMERA_1P8V_EN, 1);
	msleep(1);  

	/* Activate STBY */
	gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 1);     
	msleep(1);        

	/* Clock Enable */
	isp_set_xclk(NULL, CE147_XCLK, 0);
	msleep(1); 

	/* Activate Reset */
	gpio_direction_output(OMAP3430_GPIO_VGA_RST, 1);
	msleep(5);

	/* Activate STBY */
	gpio_direction_output(OMAP3430_GPIO_VGA_STBY, 0);     
	msleep(1);        

	/* VGA switch off */
	gpio_direction_output(OMAP3430_GPIO_VGA_SEL, 1);  
	msleep(1); 

	return 0;
}