Signed-off-by: Kuninori Morimoto <morimoto.kunin...@renesas.com>
---
 drivers/media/video/sh_mobile_ceu_camera.c |   25 +++++++++++++++++++++++++
 include/media/sh_mobile_ceu.h              |    3 +++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c 
b/drivers/media/video/sh_mobile_ceu_camera.c
index 746aed0..e5cee0f 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -660,6 +660,31 @@ static int sh_mobile_ceu_set_bus_param(struct 
soc_camera_device *icd,
        if (!common_flags)
                return -EINVAL;
 
+       /* Make choises, based on platform preferences */
+       if ((common_flags & SOCAM_HSYNC_ACTIVE_HIGH) &&
+           (common_flags & SOCAM_HSYNC_ACTIVE_LOW)) {
+               if (pcdev->pdata->flags & SH_CEU_FLAG_HSP)
+                       common_flags &= ~SOCAM_HSYNC_ACTIVE_HIGH;
+               else
+                       common_flags &= ~SOCAM_HSYNC_ACTIVE_LOW;
+       }
+
+       if ((common_flags & SOCAM_VSYNC_ACTIVE_HIGH) &&
+           (common_flags & SOCAM_VSYNC_ACTIVE_LOW)) {
+               if (pcdev->pdata->flags & SH_CEU_FLAG_VSP)
+                       common_flags &= ~SOCAM_VSYNC_ACTIVE_HIGH;
+               else
+                       common_flags &= ~SOCAM_VSYNC_ACTIVE_LOW;
+       }
+
+       if ((common_flags & SOCAM_PCLK_SAMPLE_RISING) &&
+           (common_flags & SOCAM_PCLK_SAMPLE_FALLING)) {
+               if (pcdev->pdata->flags & SH_CEU_FLAG_PCP)
+                       common_flags &= ~SOCAM_PCLK_SAMPLE_RISING;
+               else
+                       common_flags &= ~SOCAM_PCLK_SAMPLE_FALLING;
+       }
+
        ret = icd->ops->set_bus_param(icd, common_flags);
        if (ret < 0)
                return ret;
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 0f3524c..3726daf 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -3,6 +3,9 @@
 
 #define SH_CEU_FLAG_USE_8BIT_BUS       (1 << 0) /* use  8bit bus width */
 #define SH_CEU_FLAG_USE_16BIT_BUS      (1 << 1) /* use 16bit bus width */
+#define SH_CEU_FLAG_PCP                        (1 << 2) /* Pixel clock 
polarity */
+#define SH_CEU_FLAG_HSP                        (1 << 3) /* Horizontal sync 
polarity */
+#define SH_CEU_FLAG_VSP                        (1 << 4) /* Vertical sync 
polarity */
 
 struct sh_mobile_ceu_info {
        unsigned long flags;
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to