Fix SXGA support to enforce bayer format
[microdia.git] / micron.h
blob8c73e675d927fcc4df8f2650b08b66ec07dc59c9
1 /**
2 * @file micron.h
3 * @author Comer352l
4 * @date 2008-04-25
6 * @brief Common functions and data for Micron sensors.
8 * @note Copyright (C) Comer352l
10 * @par Licences
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef MICRON_H
28 #define MICRON_H
30 /* Registers: */
31 #define MT9V111_IFPREG_OPMODECTL 0x06 /* Operating mode control */
33 #define MT9V111_IFPREG_AE_HWINBOUNDARY 0x26 /* Horizontal boundaries of AE measurement window */
34 #define MT9V111_IFPREG_AE_VWINBOUNDARY 0x27 /* Vertical boundaries of AE measurement window */
35 #define MT9V111_IFPREG_AE_HWINBOUNDARY_BLC 0x2b /* H. bound. of AE meas. win. for back light compensation */
36 #define MT9V111_IFPREG_AE_VWINBOUNDARY_BLC 0x2c /* V. bound. of AE meas. win. for back light compensation */
37 #define MT9V111_IFPREG_AE_TARGETLUMCTL 0x2e /* AE target luminance and tracking accuracy control */
38 #define MT9V111_IFPREG_AE_SPEEDSENSCTL 0x2f /* AE speed and sensitivity control */
39 #define MT9V111_IFPREG_AE_DGAINSLIMITS 0x67 /* AE digital gains limits */
41 #define MT9V111_IFPREG_AWB_TINT 0x21 /* AWB tint */
42 #define MT9V111_IFPREG_AWB_SPEEDCOLORSATCTL 0x25 /* AWB speed and color saturation control */
43 #define MT9V111_IFPREG_AWB_WINBOUNDARY 0x2d /* Boundaries of AWB measurement window */
46 /* Values: */
47 #define MT9V111_ADDRESSSPACE_IFP 0x01 /* IFP-register address space */
48 #define MT9V111_ADDRESSSPACE_SENSOR 0x04 /* sensor-(core-)register address space */
50 #define MT9V111_IFP_OPMODE_AUTOEXPOSURE 0x4000 /* enable auto exposure */
51 #define MT9V111_IFP_OPMODE_AUTOWHITEBALANCE 0x0002 /* enable auto exposure */
52 #define MT9V111_IFP_OPMODE_BYPASSCOLORCORR 0x0010 /* bypass color correction matrix */
53 #define MT9V111_IFP_OPMODE_APERTURECORR 0x1000 /* enable aperture knee correction */
54 #define MT9V111_IFP_OPMODE_ONTHEFLYDEFECTCORR 0x2000 /* enable on-the-fly color correction */
56 #define MT9V111_IFP_AE_TARGETLUMINANCE(x) (x & 0xff) /* AE target luminace */
57 #define MT9V111_IFP_AE_TRACKINGACCURACY(x) ((x & 0xff) << 8) /* AE tracking accuracy */
58 #define MT9V111_IFP_AE_DELAY(x) (x & 0x7) /* AE reaction delay */
59 #define MT9V111_IFP_AE_SPEED(x) ((x & 0x7) << 3) /* AE speed */
60 #define MT9V111_IFP_AE_STEPSIZE_MEDIUMDOWNSLOWUP 0x0000 /* AE step size: medium speed when going down, slow when going up */
61 #define MT9V111_IFP_AE_STEPSIZE_MEDIUM 0x0040 /* AE step size: medium speed */
62 #define MT9V111_IFP_AE_STEPSIZE_FAST 0x0080 /* AE step size: fast speed*/
63 #define MT9V111_IFP_AE_STEPSIZE_FASTDOWNMEDIUMUP 0x00c0 /* AE step size: fast when going down, medium when going up */
64 #define MT9V111_IFP_AE_WINBOUNDARY_LEFT(x) ((x/4) & 0xff) /* left boundary of AE meas. window */
65 #define MT9V111_IFP_AE_WINBOUNDARY_RIGHT(x) (((x/4) & 0xff) << 8) /* right boundary of AE meas. window */
66 #define MT9V111_IFP_AE_WINBOUNDARY_TOP(x) ((x/2) & 0xff) /* top boundary of AE meas. window */
67 #define MT9V111_IFP_AE_WINBOUNDARY_BOTTOM(x) (((x/2) & 0xff) << 8) /* bottom boundary of AE meas. window */
68 #define MT9V111_IFP_AE_WINBOUNDARY_LEFT_BLC(x) ((x/4) & 0xff) /* left boundary of AE meas. window (backlight compensation) */
69 #define MT9V111_IFP_AE_WINBOUNDARY_RIGHT_BLC(x) (((x/4) & 0xff) << 8) /* right boundary of AE meas. window (backlight compensation)*/
70 #define MT9V111_IFP_AE_WINBOUNDARY_TOP_BLC(x) ((x/2) & 0xff) /* top boundary of AE meas. window (backlight compensation)*/
71 #define MT9V111_IFP_AE_WINBOUNDARY_BOTTOM_BLC(x) (((x/2) & 0xff) << 8) /* bottom boundary of AE meas. window (backlight compensation)*/
72 #define MT9V111_IFP_AE_WIN_LARGE 0x0000 /* large AE measurement window */
73 #define MT9V111_IFP_AE_WIN_MEDIUM 0x0004 /* medium AE measurement window (backlight compensation) */
74 #define MT9V111_IFP_AE_WIN_COMBINED 0x0008 /* combined AE meas. win: (large win + (2 * medium win))/3 */
75 #define MT9V111_IFP_AE_MAXGAIN_PRELS(x) (x & 0xff) /* max. digital gain applied before lens shading correction */
76 #define MT9V111_IFP_AE_MAXGAIN_POSTLS(x) ((x & 0xff) << 8) /* max. digital gain applied during lens shading correction */
78 #define MT9V111_IFP_AWB_AUTOSATLOWLIGHT_ENABLE 0x4000 /* enable automatic color saturation control in low light */
79 #define MT9V111_IFP_AWB_ADDON_BLUE(x) (x & 0xff) /* AWB blue channel add-on */
80 #define MT9V111_IFP_AWB_ADDON_RED(x) ((x & 0xff) << 8) /* AWB red channel add-on */
81 #define MT9V111_IFP_AWB_DELAY(x) (x & 0x7) /* AWB reaction delay */
82 #define MT9V111_IFP_AWB_SPEED(x) ((x & 0x7) << 3) /* AWB speed */
83 #define MT9V111_IFP_AWB_SATURATION_BLACKWHITE 0x3000 /* black and white */
84 #define MT9V111_IFP_AWB_SATURATION_25 0x2000 /* 25% of full saturation */
85 #define MT9V111_IFP_AWB_SATURATION_37p5 0x1800 /* 37.5% of full saturation */
86 #define MT9V111_IFP_AWB_SATURATION_50 0x1000 /* 50% of full saturation */
87 #define MT9V111_IFP_AWB_SATURATION_75 0x0800 /* 75% of full saturation */
88 #define MT9V111_IFP_AWB_SATURATION_FULL 0x0000 /* full color saturation */
89 #define MT9V111_IFP_AWB_SATURATION_150 0x2800 /* 150% of full saturation */
90 #define MT9V111_IFP_AWB_WINBOUNDARY_LEFT(x) ((x/64) & 0xf) /* left boundary of AWB meas. window */
91 #define MT9V111_IFP_AWB_WINBOUNDARY_RIGHT(x) (((x/64) & 0xf) << 4) /* right boundary of AWB meas. window */
92 #define MT9V111_IFP_AWB_WINBOUNDARY_TOP(x) (((x/32) & 0xf) << 8) /* top boundary of AWB meas. window */
93 #define MT9V111_IFP_AWB_WINBOUNDARY_BOTTOM(x) (((x/32) & 0xf) << 12) /* bottom boundary of AWB meas. window */
95 extern struct sn9c20x_i2c_regs mt9v112_init[];
96 extern struct sn9c20x_i2c_regs mt9v111_init[];
97 extern struct sn9c20x_i2c_regs mt9v011_init[];
98 extern struct sn9c20x_i2c_regs mt9m111_init[];
99 extern struct sn9c20x_i2c_regs mt9m001_init[];
101 int mt9v111_select_address_space(struct usb_sn9c20x *dev, __u8 address_space);
102 int mt9v111_set_exposure(struct usb_sn9c20x *dev);
103 int mt9v111_set_hvflip(struct usb_sn9c20x *dev);
104 int mt9v111_set_autoexposure(struct usb_sn9c20x *dev);
105 int mt9v111_set_autowhitebalance(struct usb_sn9c20x *dev);
107 int mt9m111_set_exposure(struct usb_sn9c20x *dev);
108 int mt9m111_set_autoexposure(struct usb_sn9c20x *dev);
109 int mt9m111_set_autowhitebalance(struct usb_sn9c20x *dev);
111 int mt9v011_set_exposure(struct usb_sn9c20x *dev);
112 int mt9v011_set_hvflip(struct usb_sn9c20x *dev);
114 int mt9v112_set_hvflip(struct usb_sn9c20x *dev);
116 int mt9v011_probe(struct usb_sn9c20x *dev);
117 int mt9v111_probe(struct usb_sn9c20x *dev);
118 int mt9v112_probe(struct usb_sn9c20x *dev);
119 #endif