camera rk30: rk_camera_querycap func has bug of quering orintation.
authorroot <root@zyc-desktop.(none)>
Wed, 27 Jun 2012 02:55:42 +0000 (10:55 +0800)
committerroot <root@zyc-desktop.(none)>
Wed, 27 Jun 2012 02:55:42 +0000 (10:55 +0800)
drivers/media/video/rk30_camera_oneframe.c

index 4ae49bec4371fbfff05cbbd4f687465dba0e3f27..b576178e4693d1c9cb6ed590e44d84032922b66c 100755 (executable)
@@ -1741,14 +1741,25 @@ static int rk_camera_querycap(struct soc_camera_host *ici,
 {
     struct rk_camera_dev *pcdev = ici->priv;
     char orientation[5];
+    int i;
 
     strlcpy(cap->card, dev_name(pcdev->icd->pdev), sizeof(cap->card));    
-    if (strcmp(dev_name(pcdev->icd->pdev), pcdev->pdata->info[0].dev_name) == 0) {
-        sprintf(orientation,"-%d",pcdev->pdata->info[0].orientation);
+    memset(orientation,0x00,sizeof(orientation));
+    for (i=0; i<RK_CAM_NUM;i++) {
+        if ((pcdev->pdata->info[i].dev_name!=NULL) && (strcmp(dev_name(pcdev->icd->pdev), pcdev->pdata->info[i].dev_name) == 0)) {
+            sprintf(orientation,"-%d",pcdev->pdata->info[i].orientation);
+        }
+    }
+    
+    if (orientation[0] != '-') {
+        RKCAMERA_TR("%s: %s is not registered in rk29_camera_platform_data, orientation apply default value",__FUNCTION__,dev_name(pcdev->icd->pdev));
+        if (strstr(dev_name(pcdev->icd->pdev),"front")) 
+            strcat(cap->card,"-270");
+        else 
+            strcat(cap->card,"-90");
     } else {
-        sprintf(orientation,"-%d",pcdev->pdata->info[1].orientation);
+        strcat(cap->card,orientation); 
     }
-    strcat(cap->card,orientation); 
     cap->version = RK_CAM_VERSION_CODE;
     cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;