diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 10:58:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 10:58:25 -0400 |
commit | 1046a2c428bedd64c960dcfd0c57cc69a82fea2f (patch) | |
tree | d34b83e0ac61b51305cece031f7ff49579e3fe76 /drivers/media/video/mx1_camera.c | |
parent | 46e85f5f1c2a1d106c1ec0fa2a06280276b8e052 (diff) | |
parent | b3f4e1eba45eda5d1213810ef3bc53e5247df2df (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (144 commits)
[media] saa7134.h: Suppress compiler warnings when CONFIG_VIDEO_SAA7134_RC is not set
[media] it913x [VER 1.07] Support for single ITE 9135 devices
[media] Support for Terratec G1
[media] cx25821: off by one in cx25821_vidioc_s_input()
[media] media: tea5764: reconcile Kconfig symbol and macro
[media] omap_vout: Add poll() support
[media] omap3isp: preview: Add crop support on the sink pad
[media] omap3isp: preview: Rename min/max input/output sizes defines
[media] omap3isp: preview: Remove horizontal averager support
[media] omap3isp: Report the ISP revision through the media controller API
[media] omap3isp: ccdc: remove redundant operation
[media] omap3isp: Fix memory leaks in initialization error paths
[media] omap3isp: Add missing mutex_destroy() calls
[media] omap3isp: Move *_init_entities() functions to the init/cleanup section
[media] omap3isp: Move media_entity_cleanup() from unregister() to cleanup()
[media] MFC: Change MFC firmware binary name
[media] vb2: add vb2_get_unmapped_area in vb2 core
[media] v4l: Add v4l2 subdev driver for S5K6AAFX sensor
[media] v4l: Add AUTO option for the V4L2_CID_POWER_LINE_FREQUENCY control
[media] media: ov6650: stylistic improvements
...
Diffstat (limited to 'drivers/media/video/mx1_camera.c')
-rw-r--r-- | drivers/media/video/mx1_camera.c | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 087db12a3a67..18e94c7d2be8 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -78,11 +78,10 @@ | |||
78 | #define CSI_IRQ_MASK (CSISR_SFF_OR_INT | CSISR_RFF_OR_INT | \ | 78 | #define CSI_IRQ_MASK (CSISR_SFF_OR_INT | CSISR_RFF_OR_INT | \ |
79 | CSISR_STATFF_INT | CSISR_RXFF_INT | CSISR_SOF_INT) | 79 | CSISR_STATFF_INT | CSISR_RXFF_INT | CSISR_SOF_INT) |
80 | 80 | ||
81 | #define CSI_BUS_FLAGS (SOCAM_MASTER | SOCAM_HSYNC_ACTIVE_HIGH | \ | 81 | #define CSI_BUS_FLAGS (V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | \ |
82 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW | \ | 82 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | \ |
83 | SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING | \ | 83 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | \ |
84 | SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_LOW | \ | 84 | V4L2_MBUS_DATA_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_LOW) |
85 | SOCAM_DATAWIDTH_8) | ||
86 | 85 | ||
87 | #define MAX_VIDEO_MEM 16 /* Video memory limit in megabytes */ | 86 | #define MAX_VIDEO_MEM 16 /* Video memory limit in megabytes */ |
88 | 87 | ||
@@ -490,59 +489,73 @@ static int mx1_camera_set_crop(struct soc_camera_device *icd, | |||
490 | 489 | ||
491 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | 490 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) |
492 | { | 491 | { |
492 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | ||
493 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 493 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
494 | struct mx1_camera_dev *pcdev = ici->priv; | 494 | struct mx1_camera_dev *pcdev = ici->priv; |
495 | unsigned long camera_flags, common_flags; | 495 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; |
496 | unsigned long common_flags; | ||
496 | unsigned int csicr1; | 497 | unsigned int csicr1; |
497 | int ret; | 498 | int ret; |
498 | 499 | ||
499 | camera_flags = icd->ops->query_bus_param(icd); | ||
500 | |||
501 | /* MX1 supports only 8bit buswidth */ | 500 | /* MX1 supports only 8bit buswidth */ |
502 | common_flags = soc_camera_bus_param_compatible(camera_flags, | 501 | ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg); |
503 | CSI_BUS_FLAGS); | 502 | if (!ret) { |
504 | if (!common_flags) | 503 | common_flags = soc_mbus_config_compatible(&cfg, CSI_BUS_FLAGS); |
505 | return -EINVAL; | 504 | if (!common_flags) { |
505 | dev_warn(icd->parent, | ||
506 | "Flags incompatible: camera 0x%x, host 0x%x\n", | ||
507 | cfg.flags, CSI_BUS_FLAGS); | ||
508 | return -EINVAL; | ||
509 | } | ||
510 | } else if (ret != -ENOIOCTLCMD) { | ||
511 | return ret; | ||
512 | } else { | ||
513 | common_flags = CSI_BUS_FLAGS; | ||
514 | } | ||
506 | 515 | ||
507 | /* Make choises, based on platform choice */ | 516 | /* Make choises, based on platform choice */ |
508 | if ((common_flags & SOCAM_VSYNC_ACTIVE_HIGH) && | 517 | if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) && |
509 | (common_flags & SOCAM_VSYNC_ACTIVE_LOW)) { | 518 | (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) { |
510 | if (!pcdev->pdata || | 519 | if (!pcdev->pdata || |
511 | pcdev->pdata->flags & MX1_CAMERA_VSYNC_HIGH) | 520 | pcdev->pdata->flags & MX1_CAMERA_VSYNC_HIGH) |
512 | common_flags &= ~SOCAM_VSYNC_ACTIVE_LOW; | 521 | common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW; |
513 | else | 522 | else |
514 | common_flags &= ~SOCAM_VSYNC_ACTIVE_HIGH; | 523 | common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH; |
515 | } | 524 | } |
516 | 525 | ||
517 | if ((common_flags & SOCAM_PCLK_SAMPLE_RISING) && | 526 | if ((common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) && |
518 | (common_flags & SOCAM_PCLK_SAMPLE_FALLING)) { | 527 | (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)) { |
519 | if (!pcdev->pdata || | 528 | if (!pcdev->pdata || |
520 | pcdev->pdata->flags & MX1_CAMERA_PCLK_RISING) | 529 | pcdev->pdata->flags & MX1_CAMERA_PCLK_RISING) |
521 | common_flags &= ~SOCAM_PCLK_SAMPLE_FALLING; | 530 | common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_FALLING; |
522 | else | 531 | else |
523 | common_flags &= ~SOCAM_PCLK_SAMPLE_RISING; | 532 | common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_RISING; |
524 | } | 533 | } |
525 | 534 | ||
526 | if ((common_flags & SOCAM_DATA_ACTIVE_HIGH) && | 535 | if ((common_flags & V4L2_MBUS_DATA_ACTIVE_HIGH) && |
527 | (common_flags & SOCAM_DATA_ACTIVE_LOW)) { | 536 | (common_flags & V4L2_MBUS_DATA_ACTIVE_LOW)) { |
528 | if (!pcdev->pdata || | 537 | if (!pcdev->pdata || |
529 | pcdev->pdata->flags & MX1_CAMERA_DATA_HIGH) | 538 | pcdev->pdata->flags & MX1_CAMERA_DATA_HIGH) |
530 | common_flags &= ~SOCAM_DATA_ACTIVE_LOW; | 539 | common_flags &= ~V4L2_MBUS_DATA_ACTIVE_LOW; |
531 | else | 540 | else |
532 | common_flags &= ~SOCAM_DATA_ACTIVE_HIGH; | 541 | common_flags &= ~V4L2_MBUS_DATA_ACTIVE_HIGH; |
533 | } | 542 | } |
534 | 543 | ||
535 | ret = icd->ops->set_bus_param(icd, common_flags); | 544 | cfg.flags = common_flags; |
536 | if (ret < 0) | 545 | ret = v4l2_subdev_call(sd, video, s_mbus_config, &cfg); |
546 | if (ret < 0 && ret != -ENOIOCTLCMD) { | ||
547 | dev_dbg(icd->parent, "camera s_mbus_config(0x%lx) returned %d\n", | ||
548 | common_flags, ret); | ||
537 | return ret; | 549 | return ret; |
550 | } | ||
538 | 551 | ||
539 | csicr1 = __raw_readl(pcdev->base + CSICR1); | 552 | csicr1 = __raw_readl(pcdev->base + CSICR1); |
540 | 553 | ||
541 | if (common_flags & SOCAM_PCLK_SAMPLE_RISING) | 554 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
542 | csicr1 |= CSICR1_REDGE; | 555 | csicr1 |= CSICR1_REDGE; |
543 | if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) | 556 | if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) |
544 | csicr1 |= CSICR1_SOF_POL; | 557 | csicr1 |= CSICR1_SOF_POL; |
545 | if (common_flags & SOCAM_DATA_ACTIVE_LOW) | 558 | if (common_flags & V4L2_MBUS_DATA_ACTIVE_LOW) |
546 | csicr1 |= CSICR1_DATA_POL; | 559 | csicr1 |= CSICR1_DATA_POL; |
547 | 560 | ||
548 | __raw_writel(csicr1, pcdev->base + CSICR1); | 561 | __raw_writel(csicr1, pcdev->base + CSICR1); |