aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/omap1_camera.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c
index 8a947e603aca..f24bcaf1d88c 100644
--- a/drivers/media/video/omap1_camera.c
+++ b/drivers/media/video/omap1_camera.c
@@ -102,10 +102,10 @@
102/* end of OMAP1 Camera Interface registers */ 102/* end of OMAP1 Camera Interface registers */
103 103
104 104
105#define SOCAM_BUS_FLAGS (SOCAM_MASTER | \ 105#define SOCAM_BUS_FLAGS (V4L2_MBUS_MASTER | \
106 SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH | \ 106 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | \
107 SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING | \ 107 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | \
108 SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8) 108 V4L2_MBUS_DATA_ACTIVE_HIGH)
109 109
110 110
111#define FIFO_SIZE ((THRESHOLD_MASK >> THRESHOLD_SHIFT) + 1) 111#define FIFO_SIZE ((THRESHOLD_MASK >> THRESHOLD_SHIFT) + 1)
@@ -1438,41 +1438,55 @@ static int omap1_cam_querycap(struct soc_camera_host *ici,
1438static int omap1_cam_set_bus_param(struct soc_camera_device *icd, 1438static int omap1_cam_set_bus_param(struct soc_camera_device *icd,
1439 __u32 pixfmt) 1439 __u32 pixfmt)
1440{ 1440{
1441 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1441 struct device *dev = icd->parent; 1442 struct device *dev = icd->parent;
1442 struct soc_camera_host *ici = to_soc_camera_host(dev); 1443 struct soc_camera_host *ici = to_soc_camera_host(dev);
1443 struct omap1_cam_dev *pcdev = ici->priv; 1444 struct omap1_cam_dev *pcdev = ici->priv;
1444 const struct soc_camera_format_xlate *xlate; 1445 const struct soc_camera_format_xlate *xlate;
1445 const struct soc_mbus_pixelfmt *fmt; 1446 const struct soc_mbus_pixelfmt *fmt;
1446 unsigned long camera_flags, common_flags; 1447 struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,};
1448 unsigned long common_flags;
1447 u32 ctrlclock, mode; 1449 u32 ctrlclock, mode;
1448 int ret; 1450 int ret;
1449 1451
1450 camera_flags = icd->ops->query_bus_param(icd); 1452 ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg);
1451 1453 if (!ret) {
1452 common_flags = soc_camera_bus_param_compatible(camera_flags, 1454 common_flags = soc_mbus_config_compatible(&cfg, SOCAM_BUS_FLAGS);
1453 SOCAM_BUS_FLAGS); 1455 if (!common_flags) {
1454 if (!common_flags) 1456 dev_warn(dev,
1455 return -EINVAL; 1457 "Flags incompatible: camera 0x%x, host 0x%x\n",
1458 cfg.flags, SOCAM_BUS_FLAGS);
1459 return -EINVAL;
1460 }
1461 } else if (ret != -ENOIOCTLCMD) {
1462 return ret;
1463 } else {
1464 common_flags = SOCAM_BUS_FLAGS;
1465 }
1456 1466
1457 /* Make choices, possibly based on platform configuration */ 1467 /* Make choices, possibly based on platform configuration */
1458 if ((common_flags & SOCAM_PCLK_SAMPLE_RISING) && 1468 if ((common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) &&
1459 (common_flags & SOCAM_PCLK_SAMPLE_FALLING)) { 1469 (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)) {
1460 if (!pcdev->pdata || 1470 if (!pcdev->pdata ||
1461 pcdev->pdata->flags & OMAP1_CAMERA_LCLK_RISING) 1471 pcdev->pdata->flags & OMAP1_CAMERA_LCLK_RISING)
1462 common_flags &= ~SOCAM_PCLK_SAMPLE_FALLING; 1472 common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_FALLING;
1463 else 1473 else
1464 common_flags &= ~SOCAM_PCLK_SAMPLE_RISING; 1474 common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_RISING;
1465 } 1475 }
1466 1476
1467 ret = icd->ops->set_bus_param(icd, common_flags); 1477 cfg.flags = common_flags;
1468 if (ret < 0) 1478 ret = v4l2_subdev_call(sd, video, s_mbus_config, &cfg);
1479 if (ret < 0 && ret != -ENOIOCTLCMD) {
1480 dev_dbg(dev, "camera s_mbus_config(0x%lx) returned %d\n",
1481 common_flags, ret);
1469 return ret; 1482 return ret;
1483 }
1470 1484
1471 ctrlclock = CAM_READ_CACHE(pcdev, CTRLCLOCK); 1485 ctrlclock = CAM_READ_CACHE(pcdev, CTRLCLOCK);
1472 if (ctrlclock & LCLK_EN) 1486 if (ctrlclock & LCLK_EN)
1473 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~LCLK_EN); 1487 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~LCLK_EN);
1474 1488
1475 if (common_flags & SOCAM_PCLK_SAMPLE_RISING) { 1489 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) {
1476 dev_dbg(dev, "CTRLCLOCK_REG |= POLCLK\n"); 1490 dev_dbg(dev, "CTRLCLOCK_REG |= POLCLK\n");
1477 ctrlclock |= POLCLK; 1491 ctrlclock |= POLCLK;
1478 } else { 1492 } else {
@@ -1716,5 +1730,5 @@ MODULE_PARM_DESC(sg_mode, "videobuf mode, 0: dma-contig (default), 1: dma-sg");
1716MODULE_DESCRIPTION("OMAP1 Camera Interface driver"); 1730MODULE_DESCRIPTION("OMAP1 Camera Interface driver");
1717MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>"); 1731MODULE_AUTHOR("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>");
1718MODULE_LICENSE("GPL v2"); 1732MODULE_LICENSE("GPL v2");
1719MODULE_LICENSE(DRIVER_VERSION); 1733MODULE_VERSION(DRIVER_VERSION);
1720MODULE_ALIAS("platform:" DRIVER_NAME); 1734MODULE_ALIAS("platform:" DRIVER_NAME);