V4L/DVB (12954): gspca - gl860: Addition of GL860 based webcams
[sfrench/cifs-2.6.git] / drivers / media / video / gspca / gl860 / gl860.h
1 /* @file gl860.h
2  * @author Olivier LORIN, tirĂ© du pilote Syntek par Nicolas VIVIEN
3  * @date 2009-08-27
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef GL860_DEV_H
19 #define GL860_DEV_H
20 #include <linux/version.h>
21
22 #include "gspca.h"
23
24 #define MODULE_NAME "gspca_gl860"
25 #define DRIVER_VERSION "0.9d10"
26
27 #define ctrl_in  gl860_RTx
28 #define ctrl_out gl860_RTx
29
30 #define ID_MI1320   1
31 #define ID_OV2640   2
32 #define ID_OV9655   4
33 #define ID_MI2020   8
34 #define ID_MI2020b 16
35
36 #define _MI1320_  (((struct sd *) gspca_dev)->sensor == ID_MI1320)
37 #define _MI2020_  (((struct sd *) gspca_dev)->sensor == ID_MI2020)
38 #define _MI2020b_ (((struct sd *) gspca_dev)->sensor == ID_MI2020b)
39 #define _MI2020c_ 0
40 #define _OV2640_  (((struct sd *) gspca_dev)->sensor == ID_OV2640)
41 #define _OV9655_  (((struct sd *) gspca_dev)->sensor == ID_OV9655)
42
43 #define IMAGE_640   0
44 #define IMAGE_800   1
45 #define IMAGE_1280  2
46 #define IMAGE_1600 3
47
48 struct sd_gl860 {
49         u16 backlight;
50         u16 brightness;
51         u16 sharpness;
52         u16 contrast;
53         u16 gamma;
54         u16 hue;
55         u16 saturation;
56         u16 whitebal;
57         u8  mirror;
58         u8  flip;
59         u8  AC50Hz;
60 };
61
62 /* Specific webcam descriptor */
63 struct sd {
64         struct gspca_dev gspca_dev;     /* !! must be the first item */
65
66         struct sd_gl860 vcur;
67         struct sd_gl860 vold;
68         struct sd_gl860 vmax;
69
70         int  (*dev_configure_alt)  (struct gspca_dev *);
71         int  (*dev_init_at_startup)(struct gspca_dev *);
72         int  (*dev_init_pre_alt)   (struct gspca_dev *);
73         void (*dev_post_unset_alt) (struct gspca_dev *);
74         int  (*dev_camera_settings)(struct gspca_dev *);
75
76         u8   swapRB;
77         u8  mirrorMask;
78         u8  sensor;
79         s32 nbIm;
80         s32 nbRightUp;
81         u8   waitSet;
82 };
83
84 struct validx {
85         u16 val;
86         u16 idx;
87 };
88
89 struct idxdata {
90         u8 idx;
91         u8 data[3];
92 };
93
94 int fetch_validx(struct gspca_dev *gspca_dev, struct validx *tbl, int len);
95 int keep_on_fetching_validx(struct gspca_dev *gspca_dev, struct validx *tbl,
96                                 int len, int n);
97 void fetch_idxdata(struct gspca_dev *gspca_dev, struct idxdata *tbl, int len);
98
99 int gl860_RTx(struct gspca_dev *gspca_dev,
100                         unsigned char pref, u32 req, u16 val, u16 index,
101                         s32 len, void *pdata);
102
103 void mi1320_init_settings(struct gspca_dev *);
104 void ov2640_init_settings(struct gspca_dev *);
105 void ov9655_init_settings(struct gspca_dev *);
106 void mi2020_init_settings(struct gspca_dev *);
107
108 #endif