1 /***************************************************************************
2  * Various definitions for compatibility with OVCAMCHIP external module.   *
3  * This file is part of the W996[87]CF driver for Linux.                   *
4  *                                                                         *
5  * The definitions have been taken from the OVCAMCHIP module written by    *
6  * Mark McClelland.                                                        *
7  *                                                                         *
8  * This program is free software; you can redistribute it and/or modify    *
9  * it under the terms of the GNU General Public License as published by    *
10  * the Free Software Foundation; either version 2 of the License, or       *
11  * (at your option) any later version.                                     *
12  *                                                                         *
13  * This program is distributed in the hope that it will be useful,         *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
16  * GNU General Public License for more details.                            *
17  *                                                                         *
18  * You should have received a copy of the GNU General Public License       *
19  * along with this program; if not, write to the Free Software             *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               *
21  ***************************************************************************/
22 
23 #ifndef _W9968CF_EXTERNALDEF_H_
24 #define _W9968CF_EXTERNALDEF_H_
25 
26 #include <linux/videodev.h>
27 #include <linux/i2c.h>
28 #include <asm/ioctl.h>
29 #include <asm/types.h>
30 
31 #ifndef I2C_DRIVERID_OVCAMCHIP
32 #	define I2C_DRIVERID_OVCAMCHIP 0xf00f
33 #endif
34 
35 /* Controls */
36 enum {
37 	OVCAMCHIP_CID_CONT,       /* Contrast */
38 	OVCAMCHIP_CID_BRIGHT,     /* Brightness */
39 	OVCAMCHIP_CID_SAT,        /* Saturation */
40 	OVCAMCHIP_CID_HUE,        /* Hue */
41 	OVCAMCHIP_CID_EXP,        /* Exposure */
42 	OVCAMCHIP_CID_FREQ,       /* Light frequency */
43 	OVCAMCHIP_CID_BANDFILT,   /* Banding filter */
44 	OVCAMCHIP_CID_AUTOBRIGHT, /* Auto brightness */
45 	OVCAMCHIP_CID_AUTOEXP,    /* Auto exposure */
46 	OVCAMCHIP_CID_BACKLIGHT,  /* Back light compensation */
47 	OVCAMCHIP_CID_MIRROR,     /* Mirror horizontally */
48 };
49 
50 /* I2C addresses */
51 #define OV7xx0_SID   (0x42 >> 1)
52 #define OV6xx0_SID   (0xC0 >> 1)
53 
54 /* Sensor types */
55 enum {
56 	CC_UNKNOWN,
57 	CC_OV76BE,
58 	CC_OV7610,
59 	CC_OV7620,
60 	CC_OV7620AE,
61 	CC_OV6620,
62 	CC_OV6630,
63 	CC_OV6630AE,
64 	CC_OV6630AF,
65 };
66 
67 /* API */
68 struct ovcamchip_control {
69 	__u32 id;
70 	__s32 value;
71 };
72 
73 struct ovcamchip_window {
74 	int x;
75 	int y;
76 	int width;
77 	int height;
78 	int format;
79 	int quarter;  /* Scale width and height down 2x */
80 
81 	/* This stuff will be removed eventually */
82 	int clockdiv; /* Clock divisor setting */
83 };
84 
85 /* Commands.
86    You must call OVCAMCHIP_CMD_INITIALIZE before any of other commands */
87 #define OVCAMCHIP_CMD_Q_SUBTYPE  _IOR  (0x88, 0x00, int)
88 #define OVCAMCHIP_CMD_INITIALIZE _IOW  (0x88, 0x01, int)
89 #define OVCAMCHIP_CMD_S_CTRL     _IOW  (0x88, 0x02, struct ovcamchip_control)
90 #define OVCAMCHIP_CMD_G_CTRL     _IOWR (0x88, 0x03, struct ovcamchip_control)
91 #define OVCAMCHIP_CMD_S_MODE     _IOW  (0x88, 0x04, struct ovcamchip_window)
92 #define OVCAMCHIP_MAX_CMD        _IO   (0x88, 0x3f)
93 
94 #endif /* _W9968CF_EXTERNALDEF_H_ */
95