No subject
Jonathan
Jonathan
Mon Aug 24 09:56:15 EDT 2009
uk</a>><br>
Date: Sat, 4 Jul 2009 13:25:06 +0000<br>
Subject: [PATCH 02/10] ov7670: Temporary soc-camera support<br>
<br>
Signed-off-by: Jonathan Cameron <<a href=3D"mailto:jic23 at cam.ac.uk">jic2=
3 at cam.ac.uk</a>><br>
---<br>
drivers/media/video/ov7670.c | 50 ++++++++++++++++++++++++++++=
++++++++++++++<br>
1 files changed, 50 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c<br=
>
index 0e2184e..910a499 100644<br>
--- a/drivers/media/video/ov7670.c<br>
+++ b/drivers/media/video/ov7670.c<br>
@@ -19,6 +19,8 @@<br>
#include <media/v4l2-chip-ident.h><br>
#include <media/v4l2-i2c-drv.h><br>
<br>
+#include <media/soc_camera.h><br>
+#include <linux/autoconf.h><br>
<br>
MODULE_AUTHOR("Jonathan Corbet <<a href=3D"mailto:corbet at lwn.=
net">corbet at lwn.net</a>>");<br>
MODULE_DESCRIPTION("A low-level driver for OmniVision ov7670 sen=
sors");<br>
@@ -745,6 +747,10 @@ static int ov7670_s_fmt(struct v4l2_subdev *sd, struct=
v4l2_format *fmt)<br>
struct ov7670_info *info =3D to_state(sd);<br>
unsigned char com7, clkrc =3D 0;<br>
<br>
+ ret =3D ov7670_init(sd, 0);<br>
+ if (ret)<br>
+ return ret;<br>
+<br>
ret =3D ov7670_try_fmt_internal(sd, fmt, &o=
vfmt, &wsize);<br>
if (ret)<br>
return ret;<br>
@@ -1239,6 +1245,41 @@ static const struct v4l2_subdev_ops ov7670_ops =3D {=
<br>
};<br>
<br>
/* ------------------------------------------------------------------=
----- */<br>
+static unsigned long ov7670_soc_query_bus_param(struct soc_camera_device *=
icd)<br>
+{<br>
+ struct soc_camera_link *icl =3D to_soc_camera_link(i=
cd);<br>
+<br>
+ unsigned long flags =3D SOCAM_PCLK_SAMPLE_RISING | S=
OCAM_MASTER |<br>
+ SOCAM_VSYNC_ACTIVE_HIGH =
| SOCAM_HSYNC_ACTIVE_HIGH |<br>
+ SOCAM_DATAWIDTH_8 | SOCA=
M_DATA_ACTIVE_HIGH;<br>
+<br>
+ return soc_camera_apply_sensor_flags(icl, flags);<br=
>
+}<br>
+<br>
+/* This device only supports one bus option */<br>
+static int ov7670_soc_set_bus_param(struct soc_camera_device *icd,<br>
+ &nb=
sp; unsigned long flags)<br>
+{<br>
+ return 0;<br>
+}<br>
+<br>
+static struct soc_camera_ops ov7670_soc_ops =3D {<br>
+ .set_bus_param =3D ov7670_soc_set_bus_param,<br>
+ .query_bus_param =3D ov7670_soc_query_bus_param,<br>
+};<br>
+<br>
+#define SETFOURCC(type) .name =3D (#type), .fourcc =3D (V4L2_PIX_FMT_ ## t=
ype)<br>
+static const struct soc_camera_data_format ov7670_soc_fmt_lists[] =3D {<br=
>
+ {<br>
+ SETFOURCC(YUYV),<br>
+ .depth =3D 16,<br>
+ .colorspace =3D V4L2_COL=
ORSPACE_JPEG,<br>
+ }, {<br>
+ SETFOURCC(RGB565),<br>
+ .depth =3D 16,<br>
+ .colorspace =3D V4L2_COL=
ORSPACE_SRGB,<br>
+ },<br>
+};<br>
<br>
static int ov7670_probe(struct i2c_client *client,<br>
&nbs=
p; const struct i2c_device_id *id)<br>
@@ -1246,7 +1287,16 @@ static int ov7670_probe(struct i2c_client *client,<b=
r>
struct v4l2_subdev *sd;<br>
struct ov7670_info *info;<br>
int ret;<br>
+ struct soc_camera_device *icd =3D client->dev.pla=
tform_data;<br>
+<br>
+ if (!icd) {<br>
+ dev_err(&client->=
dev, "OV7670: missing soc-camera data!\n");<br>
+ return -EINVAL;<br>
+ }<br>
<br>
+ icd->ops =3D &ov7670_soc_ops;<br>
+ icd->formats =3D ov7670_soc_fmt_lists;<br>
+ icd->num_formats =3D ARRAY_SIZE(ov7670_soc_fmt_li=
sts);<br>
info =3D kzalloc(sizeof(struct ov7670_info), GF=
P_KERNEL);<br>
if (info =3D=3D NULL)<br>
return -ENOMEM;<br>
<font color=3D"#888888">--<br>
1.6.3.3<br>
<br>
<br>
<br>
</font></blockquote></div><br><br clear=3D"all"><br>-- <br>=D3=D0=CB=BD,=C9=
=FA=CF=A2=C2=D6=BB=D8=D5=DF=CE=AA=C9=FA<br>=D6=AA=CE=D2,=BF=C9=D0=D0=C4=E6=
=CC=EC=D5=DF=CE=AA=C1=E9<br>=D7=D4=CA=C0=C9=CF=C9=FA=C1=E9=D6=AA=D3=D0=CE=
=D2=CA=B1=C6=F0=A3=AC<br>=BC=B4=D6=AA=C7=F7=B1=DC=A3=AC<br>=D2=D4=C0=FB=CE=
=D2=D5=DF=CE=AA=C9=C6=A3=AC=D2=D4=BA=A6=CE=D2=D5=DF=CE=AA=B6=F1=A3=AC<br>=
=CB=B9=CE=AA=B6=C0=D3=FB=D6=AE=D0=C4=A3=AC=D2=E0=CA=C7=C3=C9=C3=C1=D4=B4=C1=
=F7=A1=A3<br>=BE=FD=D7=D3=B9=A4=D7=F7=CA=D2<br><a href=3D"http://www.junzij=
u.com.cn">www.junziju.com.cn</a><br>=D6=D0=B9=FA=B5=E7=D7=D3=C9=E8=BC=C6=C2=
=DB=CC=B3<br>
<a href=3D"http://www.eledsn.com">www.eledsn.com</a><br>
--001636e9087a46691e0477753ba4--
More information about the linux-arm-kernel
mailing list