supports dual camera for v86
authorwuhao <wuhao@wuhao@rock-chips.com>
Mon, 12 Nov 2012 06:30:22 +0000 (14:30 +0800)
committerwuhao <wuhao@wuhao@rock-chips.com>
Mon, 12 Nov 2012 08:09:46 +0000 (16:09 +0800)
arch/arm/mach-rk2928/board-rk2926-sdk.c
arch/arm/mach-rk2928/board-rk2928-sdk-camera.c
arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c
drivers/media/video/sp2518.c

index 04b777ffb3c8da4c3d8fc7d72c84fd8a0b2f2149..6056fcd5fc1f718fae67b6b5c08c39d255ed1792 100755 (executable)
@@ -905,6 +905,11 @@ static  struct pmu_info  tps65910_ldo_info[] = {
                .max_uv         = 1800000,
        },
        #else
+       {
+               .name          = "vpll",   //vcc25
+               .min_uv          = 1000000,
+               .max_uv         = 2500000,
+       },
        {
                .name          = "vdig1",    //vcc18_cif
                .min_uv          = 1500000,
index 670fc7f6650c83b60cbb79a6ea2f25028f213519..b8ff7918b3ce35fcdbb58f3a69587c08ea43d183 100755 (executable)
  * author: ddl@rock-chips.com
  *****************************************************************************************/
 #ifdef CONFIG_VIDEO_RK29
+#if defined(CONFIG_MACH_RK2926_V86)
+#define CAMERA_NAME                  "sp2518_back"
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_PMU  1
+#define CONFIG_SENSOR_POWER_IOCTL_USR           1
+#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR         1
+#else
 #define CONFIG_SENSOR_POWER_IOCTL_USR     0 //define this refer to your board layout
-#define CONFIG_SENSOR_RESET_IOCTL_USR     0
 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR         0
+#endif
+#define CONFIG_SENSOR_RESET_IOCTL_USR     0
 #define CONFIG_SENSOR_FLASH_IOCTL_USR     0
 
 static void rk_cif_power(int on)
 {
     struct regulator *ldo_18,*ldo_28;
+
+      #if defined(CONFIG_MACH_RK2926_V86)
+      ldo_28 = regulator_get(NULL, "vaux1");   // vcc28_cif
+       ldo_18 = regulator_get(NULL, "vdig1");  // vcc18_cif
+      #else
        ldo_28 = regulator_get(NULL, "ldo7");   // vcc28_cif
        ldo_18 = regulator_get(NULL, "ldo1");   // vcc18_cif
+       #endif
        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){       
-       regulator_disable(ldo_28);
+    if(on == 0){
+      while(regulator_is_enabled(ldo_28)>0)
+           regulator_disable(ldo_28);
        regulator_put(ldo_28);
-       regulator_disable(ldo_18);
+       while(regulator_is_enabled(ldo_18)>0)
+           regulator_disable(ldo_18);
        regulator_put(ldo_18);
        mdelay(500);
         }
@@ -207,9 +222,77 @@ static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
 #endif
 
 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
+static void rk_cif_powerdowen(int on)
+{
+    struct regulator *ldo_28;
+    ldo_28 = regulator_get(NULL, "vpll");   // vcc28_cif
+    if (ldo_28 == NULL || IS_ERR(ldo_28) ){
+            printk("get cif vpll ldo failed!\n");
+            return;
+    }
+    
+    if( CONFIG_SENSOR_POWERDNACTIVE_LEVEL_PMU ) {
+            if(on == 0){//enable camera
+                   regulator_set_voltage(ldo_28, 2500000, 2500000);
+                   regulator_enable(ldo_28);
+                   printk(" %s set  vpll vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
+                   regulator_put(ldo_28);
+            }else{//disable camera
+                   while(regulator_is_enabled(ldo_28)>0){
+                        int a = regulator_disable(ldo_28);
+                  }
+                  regulator_put(ldo_28);
+                  mdelay(500);
+            }
+     }else{
+            
+            if(on == 1){//enable camera
+                   regulator_set_voltage(ldo_28, 2500000, 2500000);
+                   regulator_enable(ldo_28);
+                   printk(" %s set  vpll vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
+                   regulator_put(ldo_28);
+            }else{//disable camera
+                   while(regulator_is_enabled(ldo_28)>0){
+                        regulator_disable(ldo_28);
+                  }
+                  regulator_put(ldo_28);
+                  mdelay(500);
+            }
+     }
+}
 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
 {
-       #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
+    #if defined(CONFIG_MACH_RK2926_V86)
+    int ret = 0; 
+    if(strcmp(res->dev_name,CAMERA_NAME)==0)//"sp2518_back") == 0)
+    { 
+        //Èç¹ûΪpmu¿ØÖƵÄÒý½Å£¬"ov5642_front_1" ¸ù¾Ý sensorÃû×Ö £¬Ç°ºóÖ࣬ sensorÐòºÅÈ·¶¨ 
+        //¾ßÌåpmu¿ØÖƲÙ×÷£¬¿É²Î¿¼ÎļþĩβµÄ²Î¿¼´úÂë 
+        printk("%s.............pwm power\n",__FUNCTION__);
+        rk_cif_powerdowen(on);
+    }else{ //gpio¿ØÖƵIJÙ×÷
+            int camera_powerdown = res->gpio_powerdown;
+            int camera_ioflag = res->gpio_flag;
+            int camera_io_init = res->gpio_init; //  int ret = 0;    
+            if (camera_powerdown != INVALID_GPIO) { 
+                    if (camera_io_init & RK29_CAM_POWERDNACTIVE_MASK) {
+                          if (on) {
+                                gpio_set_value(camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS)); 
+                                printk("%s..%s..PowerDownPin=%d ..PinLevel = %x \n",__FUNCTION__,res->dev_name,camera_powerdown, ((camera_ioflag&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS)); 
+                         } else { 
+                                gpio_set_value(camera_powerdown,(((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS)); 
+                                printk("%s..%s..PowerDownPin= %d..PinLevel = %x   \n",__FUNCTION__,res->dev_name, camera_powerdown, (((~camera_ioflag)&RK29_CAM_POWERDNACTIVE_MASK)>>RK29_CAM_POWERDNACTIVE_BITPOS)); 
+                         }
+                  } else { ret = RK29_CAM_EIO_REQUESTFAIL;
+                                printk("%s..%s..PowerDownPin=%d request failed!\n",__FUNCTION__,res->dev_name,camera_powerdown); } 
+          } else { 
+                ret = RK29_CAM_EIO_INVALID; 
+          }
+    }
+    return ret;
+    #else
+    #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
+    #endif
 }
 #endif
 
index 253c11c967a54c3cc7c8f1ab5b0e4eae65c00a08..895dd2faf0b7ac78683eb360c6313fdc678c59de 100755 (executable)
@@ -542,7 +542,10 @@ static struct regulator_init_data tps65910_ldo8 = {
                .min_uV                 = 1000000,
                .max_uV                 = 2500000,
                .apply_uV               = 1,
+                #if defined(CONFIG_MACH_RK2926_V86)
+                #else
                .always_on = 1,
+                #endif
                .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
                .valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
 
index 21ca5ccecf87502b0204db27a99bb0767340433a..09a103ece714c42870ee849b461940059a421338 100755 (executable)
@@ -3068,7 +3068,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
                ret = -ENODEV;
                goto sensor_video_probe_err;
        }
-       msleep(10);
+       msleep(100);
 
     /* check if it is an sensor sensor */
        ret = sensor_read(client, SENSOR_ID_REG, &pid);