aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 5e48c2cc1a44..176017501055 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -59,6 +59,40 @@ const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
59} 59}
60EXPORT_SYMBOL(soc_camera_xlate_by_fourcc); 60EXPORT_SYMBOL(soc_camera_xlate_by_fourcc);
61 61
62/**
63 * soc_camera_apply_sensor_flags() - apply platform SOCAM_SENSOR_INVERT_* flags
64 * @icl: camera platform parameters
65 * @flags: flags to be inverted according to platform configuration
66 * @return: resulting flags
67 */
68unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
69 unsigned long flags)
70{
71 unsigned long f;
72
73 /* If only one of the two polarities is supported, switch to the opposite */
74 if (icl->flags & SOCAM_SENSOR_INVERT_HSYNC) {
75 f = flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW);
76 if (f == SOCAM_HSYNC_ACTIVE_HIGH || f == SOCAM_HSYNC_ACTIVE_LOW)
77 flags ^= SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW;
78 }
79
80 if (icl->flags & SOCAM_SENSOR_INVERT_VSYNC) {
81 f = flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW);
82 if (f == SOCAM_VSYNC_ACTIVE_HIGH || f == SOCAM_VSYNC_ACTIVE_LOW)
83 flags ^= SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW;
84 }
85
86 if (icl->flags & SOCAM_SENSOR_INVERT_PCLK) {
87 f = flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING);
88 if (f == SOCAM_PCLK_SAMPLE_RISING || f == SOCAM_PCLK_SAMPLE_FALLING)
89 flags ^= SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING;
90 }
91
92 return flags;
93}
94EXPORT_SYMBOL(soc_camera_apply_sensor_flags);
95
62static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, 96static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv,
63 struct v4l2_format *f) 97 struct v4l2_format *f)
64{ 98{