rk3066: fix board-rk30-ds975.c for rk_cif_power
authorwbx <wbx@rock-chips.com>
Fri, 8 Mar 2013 09:48:47 +0000 (17:48 +0800)
committerwbx <wbx@rock-chips.com>
Fri, 8 Mar 2013 09:51:52 +0000 (17:51 +0800)
arch/arm/mach-rk30/board-rk30-ds975.c

index ca328e49cb1f3236feb0bbd30b011a466edbf77a..f80c96eb912ae499aa54042911172698a0540c31 100755 (executable)
@@ -351,18 +351,31 @@ struct rk29_keys_platform_data rk29_keys_pdata = {
 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR         0
 #define CONFIG_SENSOR_FLASH_IOCTL_USR     0
 
-static void rk_cif_power(int on)
+static void rk_cif_power(struct rk29camera_gpio_res *res,int on)
 {
     struct regulator *ldo_18,*ldo_28;
+       int camera_power = res->gpio_power;
+         int camera_ioflag = res->gpio_flag;
+         int camera_io_init = res->gpio_init;
        ldo_28 = regulator_get(NULL, "ldo7");   // vcc28_cif
        ldo_18 = regulator_get(NULL, "ldo1");   // vcc18_cif
-
+       if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)){
+        printk("get cif ldo failed!\n");
+               return;
+           }
     if(on == 0){       
+               while(regulator_is_enabled(ldo_28)>0)   
        regulator_disable(ldo_28);
        regulator_put(ldo_28);
+               while(regulator_is_enabled(ldo_18)>0)
        regulator_disable(ldo_18);
        regulator_put(ldo_18);
-       mdelay(500);
+       mdelay(10);
+       if (camera_power != INVALID_GPIO)  {
+                 if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {
+                         gpio_set_value(camera_power, (((~camera_ioflag)&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
+                       }
+               }
         }
     else{
        regulator_set_voltage(ldo_28, 2800000, 2800000);
@@ -375,14 +388,21 @@ static void rk_cif_power(int on)
        regulator_enable(ldo_18);
     // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
        regulator_put(ldo_18);
+       if (camera_power != INVALID_GPIO)  {
+                 if (camera_io_init & RK29_CAM_POWERACTIVE_MASK) {
+                       gpio_set_value(camera_power, ((camera_ioflag&RK29_CAM_POWERACTIVE_MASK)>>RK29_CAM_POWERACTIVE_BITPOS));
+                       mdelay(10);
         }
+       }
+    }
 }
 
 #if CONFIG_SENSOR_POWER_IOCTL_USR
 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
 {
        //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
-    rk_cif_power(on);
+    rk_cif_power(res,on);
+       return 0;
 }
 #endif