xref: /openbmc/linux/drivers/media/usb/gspca/gl860/gl860.h (revision 413d6ed3)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* GSPCA subdrivers for Genesys Logic webcams with the GL860 chip
3  * Subdriver declarations
4  *
5  * 2009/10/14 Olivier LORIN <o.lorin@laposte.net>
6  */
7 #ifndef GL860_DEV_H
8 #define GL860_DEV_H
9 
10 #include "gspca.h"
11 
12 #define MODULE_NAME "gspca_gl860"
13 #define DRIVER_VERSION "0.9d10"
14 
15 #define ctrl_in  gl860_RTx
16 #define ctrl_out gl860_RTx
17 
18 #define ID_MI1320   1
19 #define ID_OV2640   2
20 #define ID_OV9655   4
21 #define ID_MI2020   8
22 
23 #define _MI1320_  (((struct sd *) gspca_dev)->sensor == ID_MI1320)
24 #define _MI2020_  (((struct sd *) gspca_dev)->sensor == ID_MI2020)
25 #define _OV2640_  (((struct sd *) gspca_dev)->sensor == ID_OV2640)
26 #define _OV9655_  (((struct sd *) gspca_dev)->sensor == ID_OV9655)
27 
28 #define IMAGE_640   0
29 #define IMAGE_800   1
30 #define IMAGE_1280  2
31 #define IMAGE_1600  3
32 
33 struct sd_gl860 {
34 	u16 backlight;
35 	u16 brightness;
36 	u16 sharpness;
37 	u16 contrast;
38 	u16 gamma;
39 	u16 hue;
40 	u16 saturation;
41 	u16 whitebal;
42 	u8  mirror;
43 	u8  flip;
44 	u8  AC50Hz;
45 };
46 
47 /* Specific webcam descriptor */
48 struct sd {
49 	struct gspca_dev gspca_dev;	/* !! must be the first item */
50 
51 	struct sd_gl860 vcur;
52 	struct sd_gl860 vold;
53 	struct sd_gl860 vmax;
54 
55 	int  (*dev_configure_alt)  (struct gspca_dev *);
56 	int  (*dev_init_at_startup)(struct gspca_dev *);
57 	int  (*dev_init_pre_alt)   (struct gspca_dev *);
58 	void (*dev_post_unset_alt) (struct gspca_dev *);
59 	int  (*dev_camera_settings)(struct gspca_dev *);
60 
61 	u8   swapRB;
62 	u8   mirrorMask;
63 	u8   sensor;
64 	s32  nbIm;
65 	s32  nbRightUp;
66 	u8   waitSet;
67 };
68 
69 struct validx {
70 	u16 val;
71 	u16 idx;
72 };
73 
74 struct idxdata {
75 	u8 idx;
76 	u8 data[3];
77 };
78 
79 int fetch_validx(struct gspca_dev *gspca_dev, struct validx *tbl, int len);
80 int keep_on_fetching_validx(struct gspca_dev *gspca_dev, struct validx *tbl,
81 				int len, int n);
82 void fetch_idxdata(struct gspca_dev *gspca_dev, struct idxdata *tbl, int len);
83 
84 int gl860_RTx(struct gspca_dev *gspca_dev,
85 			unsigned char pref, u32 req, u16 val, u16 index,
86 			s32 len, void *pdata);
87 
88 void mi1320_init_settings(struct gspca_dev *);
89 void ov2640_init_settings(struct gspca_dev *);
90 void ov9655_init_settings(struct gspca_dev *);
91 void mi2020_init_settings(struct gspca_dev *);
92 
93 #endif
94