xref: /linux/drivers/media/usb/gspca/m5602/m5602_s5k4aa.h (revision bd628c1bed7902ec1f24ba0fe70758949146abbe)
1 /*
2  * Driver for the s5k4aa sensor
3  *
4  * Copyright (C) 2008 Erik Andrén
5  * Copyright (C) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project.
6  * Copyright (C) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br>
7  *
8  * Portions of code to USB interface and ALi driver software,
9  * Copyright (c) 2006 Willem Duinker
10  * v4l2 interface modeled after the V4L2 driver
11  * for SN9C10x PC Camera Controllers
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License as
15  * published by the Free Software Foundation, version 2.
16  *
17  */
18 
19 #ifndef M5602_S5K4AA_H_
20 #define M5602_S5K4AA_H_
21 
22 #include <linux/dmi.h>
23 
24 #include "m5602_sensor.h"
25 
26 /*****************************************************************************/
27 
28 #define S5K4AA_PAGE_MAP			0xec
29 
30 #define S5K4AA_PAGE_MAP_0		0x00
31 #define S5K4AA_PAGE_MAP_1		0x01
32 #define S5K4AA_PAGE_MAP_2		0x02
33 
34 /* Sensor register definitions for page 0x02 */
35 #define S5K4AA_READ_MODE		0x03
36 #define S5K4AA_ROWSTART_HI		0x04
37 #define S5K4AA_ROWSTART_LO		0x05
38 #define S5K4AA_COLSTART_HI		0x06
39 #define S5K4AA_COLSTART_LO		0x07
40 #define S5K4AA_WINDOW_HEIGHT_HI		0x08
41 #define S5K4AA_WINDOW_HEIGHT_LO		0x09
42 #define S5K4AA_WINDOW_WIDTH_HI		0x0a
43 #define S5K4AA_WINDOW_WIDTH_LO		0x0b
44 #define S5K4AA_GLOBAL_GAIN__		0x0f
45 /* sync lost, if too low, reduces frame rate if too high */
46 #define S5K4AA_H_BLANK_HI__		0x1d
47 #define S5K4AA_H_BLANK_LO__		0x1e
48 #define S5K4AA_EXPOSURE_HI		0x17
49 #define S5K4AA_EXPOSURE_LO		0x18
50 #define S5K4AA_BRIGHTNESS		0x1f /* (digital?) gain : 5 bits */
51 #define S5K4AA_GAIN			0x20 /* (analogue?) gain : 7 bits */
52 #define S5K4AA_NOISE_SUPP		0x37
53 
54 #define S5K4AA_RM_ROW_SKIP_4X		0x08
55 #define S5K4AA_RM_ROW_SKIP_2X		0x04
56 #define S5K4AA_RM_COL_SKIP_4X		0x02
57 #define S5K4AA_RM_COL_SKIP_2X		0x01
58 #define S5K4AA_RM_H_FLIP		0x40
59 #define S5K4AA_RM_V_FLIP		0x80
60 
61 #define S5K4AA_DEFAULT_GAIN		0x5f
62 #define S5K4AA_DEFAULT_BRIGHTNESS	0x10
63 
64 /*****************************************************************************/
65 
66 /* Kernel module parameters */
67 extern int force_sensor;
68 extern bool dump_sensor;
69 
70 int s5k4aa_probe(struct sd *sd);
71 int s5k4aa_init(struct sd *sd);
72 int s5k4aa_init_controls(struct sd *sd);
73 int s5k4aa_start(struct sd *sd);
74 void s5k4aa_disconnect(struct sd *sd);
75 
76 static const struct m5602_sensor s5k4aa = {
77 	.name = "S5K4AA",
78 	.i2c_slave_id = 0x5a,
79 	.i2c_regW = 2,
80 
81 	.probe = s5k4aa_probe,
82 	.init = s5k4aa_init,
83 	.init_controls = s5k4aa_init_controls,
84 	.start = s5k4aa_start,
85 	.disconnect = s5k4aa_disconnect,
86 };
87 
88 #endif
89