Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1 | /* |
Jean-Francois Moine | 5b34e3e | 2009-11-02 10:00:48 -0300 | [diff] [blame] | 2 | * Sonix sn9c102p sn9c105 sn9c120 (jpeg) subdriver |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 3 | * |
Jean-François Moine | 27c6f9e | 2010-04-02 06:59:13 -0300 | [diff] [blame] | 4 | * Copyright (C) 2009-2010 Jean-François Moine <http://moinejf.free.fr> |
Jean-Francois Moine | 5b34e3e | 2009-11-02 10:00:48 -0300 | [diff] [blame] | 5 | * Copyright (C) 2005 Michel Xhaard mxhaard@magic.fr |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | */ |
| 21 | |
| 22 | #define MODULE_NAME "sonixj" |
| 23 | |
Hans de Goede | 9712a8b | 2010-01-31 12:54:29 -0300 | [diff] [blame] | 24 | #include <linux/input.h> |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 25 | #include "gspca.h" |
| 26 | #include "jpeg.h" |
| 27 | |
Jean-François Moine | 27c6f9e | 2010-04-02 06:59:13 -0300 | [diff] [blame] | 28 | MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 29 | MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); |
| 30 | MODULE_LICENSE("GPL"); |
| 31 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 32 | static int starcam; |
| 33 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 34 | /* controls */ |
| 35 | enum e_ctrl { |
| 36 | BRIGHTNESS, |
| 37 | CONTRAST, |
| 38 | COLORS, |
| 39 | BLUE, |
| 40 | RED, |
| 41 | GAMMA, |
| 42 | AUTOGAIN, |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 43 | HFLIP, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 44 | VFLIP, |
| 45 | SHARPNESS, |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 46 | ILLUM, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 47 | FREQ, |
| 48 | NCTRLS /* number of controls */ |
| 49 | }; |
| 50 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 51 | /* specific webcam descriptor */ |
| 52 | struct sd { |
| 53 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
| 54 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 55 | struct gspca_ctrl ctrls[NCTRLS]; |
| 56 | |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 57 | atomic_t avg_lum; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 58 | u32 exposure; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 59 | |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 60 | u8 quality; /* image quality */ |
Jean-Francois Moine | 77ac0ba | 2009-03-02 06:40:52 -0300 | [diff] [blame] | 61 | #define QUALITY_MIN 60 |
| 62 | #define QUALITY_MAX 95 |
| 63 | #define QUALITY_DEF 80 |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 64 | u8 jpegqual; /* webcam quality */ |
| 65 | |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 66 | u8 reg01; |
| 67 | u8 reg17; |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 68 | u8 reg18; |
Jean-Francois Moine | c6c1433 | 2010-12-14 16:15:37 -0300 | [diff] [blame] | 69 | u8 flags; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 70 | |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 71 | s8 ag_cnt; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 72 | #define AG_CNT_START 13 |
| 73 | |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 74 | u8 bridge; |
Hans de Goede | 3647fea | 2008-07-15 05:36:30 -0300 | [diff] [blame] | 75 | #define BRIDGE_SN9C102P 0 |
| 76 | #define BRIDGE_SN9C105 1 |
| 77 | #define BRIDGE_SN9C110 2 |
| 78 | #define BRIDGE_SN9C120 3 |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 79 | u8 sensor; /* Type of image sensor chip */ |
Jean-François Moine | 11ce884 | 2010-07-26 06:39:40 -0300 | [diff] [blame] | 80 | u8 i2c_addr; |
| 81 | |
| 82 | u8 jpeg_hdr[JPEG_HDR_SZ]; |
| 83 | }; |
| 84 | enum sensors { |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 85 | SENSOR_ADCM1700, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 86 | SENSOR_GC0307, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 87 | SENSOR_HV7131R, |
| 88 | SENSOR_MI0360, |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 89 | SENSOR_MI0360B, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 90 | SENSOR_MO4000, |
| 91 | SENSOR_MT9V111, |
| 92 | SENSOR_OM6802, |
| 93 | SENSOR_OV7630, |
| 94 | SENSOR_OV7648, |
| 95 | SENSOR_OV7660, |
| 96 | SENSOR_PO1030, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 97 | SENSOR_PO2030N, |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 98 | SENSOR_SOI768, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 99 | SENSOR_SP80708, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 100 | }; |
| 101 | |
Jean-Francois Moine | b2272a4 | 2010-12-14 16:16:16 -0300 | [diff] [blame] | 102 | /* device flags */ |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 103 | #define F_PDN_INV 0x01 /* inverse pin S_PWR_DN / sn_xxx tables */ |
| 104 | #define F_ILLUM 0x02 /* presence of illuminator */ |
Jean-Francois Moine | b2272a4 | 2010-12-14 16:16:16 -0300 | [diff] [blame] | 105 | |
Jean-Francois Moine | 4fd350e | 2010-12-14 16:16:58 -0300 | [diff] [blame] | 106 | /* sn9c1xx definitions */ |
| 107 | /* register 0x01 */ |
| 108 | #define S_PWR_DN 0x01 /* sensor power down */ |
| 109 | #define S_PDN_INV 0x02 /* inverse pin S_PWR_DN */ |
| 110 | #define V_TX_EN 0x04 /* video transfer enable */ |
| 111 | #define LED 0x08 /* output to pin LED */ |
| 112 | #define SCL_SEL_OD 0x20 /* open-drain mode */ |
| 113 | #define SYS_SEL_48M 0x40 /* system clock 0: 24MHz, 1: 48MHz */ |
| 114 | /* register 0x17 */ |
| 115 | #define MCK_SIZE_MASK 0x1f /* sensor master clock */ |
| 116 | #define SEN_CLK_EN 0x20 /* enable sensor clock */ |
| 117 | #define DEF_EN 0x80 /* defect pixel by 0: soft, 1: hard */ |
| 118 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 119 | /* V4L2 controls supported by the driver */ |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 120 | static void setbrightness(struct gspca_dev *gspca_dev); |
| 121 | static void setcontrast(struct gspca_dev *gspca_dev); |
| 122 | static void setcolors(struct gspca_dev *gspca_dev); |
| 123 | static void setredblue(struct gspca_dev *gspca_dev); |
| 124 | static void setgamma(struct gspca_dev *gspca_dev); |
| 125 | static void setautogain(struct gspca_dev *gspca_dev); |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 126 | static void sethvflip(struct gspca_dev *gspca_dev); |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 127 | static void setsharpness(struct gspca_dev *gspca_dev); |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 128 | static void setillum(struct gspca_dev *gspca_dev); |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 129 | static void setfreq(struct gspca_dev *gspca_dev); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 130 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 131 | static const struct ctrl sd_ctrls[NCTRLS] = { |
| 132 | [BRIGHTNESS] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 133 | { |
| 134 | .id = V4L2_CID_BRIGHTNESS, |
| 135 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 136 | .name = "Brightness", |
| 137 | .minimum = 0, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 138 | .maximum = 0xff, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 139 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 140 | .default_value = 0x80, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 141 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 142 | .set_control = setbrightness |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 143 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 144 | [CONTRAST] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 145 | { |
| 146 | .id = V4L2_CID_CONTRAST, |
| 147 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 148 | .name = "Contrast", |
| 149 | .minimum = 0, |
Jean-Francois Moine | 05b809c | 2008-09-03 16:47:59 -0300 | [diff] [blame] | 150 | #define CONTRAST_MAX 127 |
| 151 | .maximum = CONTRAST_MAX, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 152 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 153 | .default_value = 63, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 154 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 155 | .set_control = setcontrast |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 156 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 157 | [COLORS] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 158 | { |
| 159 | .id = V4L2_CID_SATURATION, |
| 160 | .type = V4L2_CTRL_TYPE_INTEGER, |
Hans de Goede | 3fb4a57 | 2009-06-18 14:31:36 -0300 | [diff] [blame] | 161 | .name = "Saturation", |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 162 | .minimum = 0, |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 163 | .maximum = 40, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 164 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 165 | #define COLORS_DEF 25 |
| 166 | .default_value = COLORS_DEF, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 167 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 168 | .set_control = setcolors |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 169 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 170 | [BLUE] = { |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 171 | { |
| 172 | .id = V4L2_CID_BLUE_BALANCE, |
| 173 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 174 | .name = "Blue Balance", |
| 175 | .minimum = 24, |
| 176 | .maximum = 40, |
| 177 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 178 | .default_value = 32, |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 179 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 180 | .set_control = setredblue |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 181 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 182 | [RED] = { |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 183 | { |
| 184 | .id = V4L2_CID_RED_BALANCE, |
| 185 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 186 | .name = "Red Balance", |
| 187 | .minimum = 24, |
| 188 | .maximum = 40, |
| 189 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 190 | .default_value = 32, |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 191 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 192 | .set_control = setredblue |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 193 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 194 | [GAMMA] = { |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 195 | { |
| 196 | .id = V4L2_CID_GAMMA, |
| 197 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 198 | .name = "Gamma", |
| 199 | .minimum = 0, |
| 200 | .maximum = 40, |
| 201 | .step = 1, |
| 202 | #define GAMMA_DEF 20 |
| 203 | .default_value = GAMMA_DEF, |
| 204 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 205 | .set_control = setgamma |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 206 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 207 | [AUTOGAIN] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 208 | { |
| 209 | .id = V4L2_CID_AUTOGAIN, |
| 210 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 211 | .name = "Auto Gain", |
| 212 | .minimum = 0, |
| 213 | .maximum = 1, |
| 214 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 215 | .default_value = 1 |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 216 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 217 | .set_control = setautogain |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 218 | }, |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 219 | [HFLIP] = { |
| 220 | { |
| 221 | .id = V4L2_CID_HFLIP, |
| 222 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 223 | .name = "Mirror", |
| 224 | .minimum = 0, |
| 225 | .maximum = 1, |
| 226 | .step = 1, |
| 227 | .default_value = 0, |
| 228 | }, |
| 229 | .set_control = sethvflip |
| 230 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 231 | [VFLIP] = { |
Jean-Francois Moine | 6c86274 | 2008-09-08 04:57:26 -0300 | [diff] [blame] | 232 | { |
| 233 | .id = V4L2_CID_VFLIP, |
| 234 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 235 | .name = "Vflip", |
| 236 | .minimum = 0, |
| 237 | .maximum = 1, |
| 238 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 239 | .default_value = 0, |
Jean-Francois Moine | 6c86274 | 2008-09-08 04:57:26 -0300 | [diff] [blame] | 240 | }, |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 241 | .set_control = sethvflip |
Jean-Francois Moine | 6c86274 | 2008-09-08 04:57:26 -0300 | [diff] [blame] | 242 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 243 | [SHARPNESS] = { |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 244 | { |
| 245 | .id = V4L2_CID_SHARPNESS, |
| 246 | .type = V4L2_CTRL_TYPE_INTEGER, |
| 247 | .name = "Sharpness", |
| 248 | .minimum = 0, |
| 249 | .maximum = 255, |
| 250 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 251 | .default_value = 90, |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 252 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 253 | .set_control = setsharpness |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 254 | }, |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 255 | [ILLUM] = { |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 256 | { |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 257 | .id = V4L2_CID_ILLUMINATORS_1, |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 258 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 259 | .name = "Illuminator / infrared", |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 260 | .minimum = 0, |
| 261 | .maximum = 1, |
| 262 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 263 | .default_value = 0, |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 264 | }, |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 265 | .set_control = setillum |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 266 | }, |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 267 | /* ov7630/ov7648/ov7660 only */ |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 268 | [FREQ] = { |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 269 | { |
| 270 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
| 271 | .type = V4L2_CTRL_TYPE_MENU, |
| 272 | .name = "Light frequency filter", |
| 273 | .minimum = 0, |
| 274 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ |
| 275 | .step = 1, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 276 | .default_value = 1, |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 277 | }, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 278 | .set_control = setfreq |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 279 | }, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 280 | }; |
| 281 | |
Jean-Francois Moine | 577cbf4 | 2008-12-05 06:18:37 -0300 | [diff] [blame] | 282 | /* table of the disabled controls */ |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 283 | static const __u32 ctrl_dis[] = { |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 284 | [SENSOR_ADCM1700] = (1 << AUTOGAIN) | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 285 | (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 286 | (1 << VFLIP) | |
| 287 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 288 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 289 | [SENSOR_GC0307] = (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 290 | (1 << VFLIP) | |
| 291 | (1 << FREQ), |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 292 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 293 | [SENSOR_HV7131R] = (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 294 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 295 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 296 | [SENSOR_MI0360] = (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 297 | (1 << VFLIP) | |
| 298 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 299 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 300 | [SENSOR_MI0360B] = (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 301 | (1 << VFLIP) | |
| 302 | (1 << FREQ), |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 303 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 304 | [SENSOR_MO4000] = (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 305 | (1 << VFLIP) | |
| 306 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 307 | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 308 | [SENSOR_MT9V111] = (1 << HFLIP) | |
| 309 | (1 << VFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 310 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 311 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 312 | [SENSOR_OM6802] = (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 313 | (1 << VFLIP) | |
| 314 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 315 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 316 | [SENSOR_OV7630] = (1 << HFLIP), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 317 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 318 | [SENSOR_OV7648] = (1 << HFLIP), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 319 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 320 | [SENSOR_OV7660] = (1 << AUTOGAIN) | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 321 | (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 322 | (1 << VFLIP), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 323 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 324 | [SENSOR_PO1030] = (1 << AUTOGAIN) | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 325 | (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 326 | (1 << VFLIP) | |
| 327 | (1 << FREQ), |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 328 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 329 | [SENSOR_PO2030N] = (1 << AUTOGAIN) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 330 | (1 << FREQ), |
Jean-François Moine | 780e312 | 2010-10-19 04:29:10 -0300 | [diff] [blame] | 331 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 332 | [SENSOR_SOI768] = (1 << AUTOGAIN) | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 333 | (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 334 | (1 << VFLIP) | |
| 335 | (1 << FREQ), |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 336 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 337 | [SENSOR_SP80708] = (1 << AUTOGAIN) | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 338 | (1 << HFLIP) | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 339 | (1 << VFLIP) | |
| 340 | (1 << FREQ), |
Jean-Francois Moine | 577cbf4 | 2008-12-05 06:18:37 -0300 | [diff] [blame] | 341 | }; |
| 342 | |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 343 | static const struct v4l2_pix_format cif_mode[] = { |
| 344 | {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| 345 | .bytesperline = 352, |
| 346 | .sizeimage = 352 * 288 * 4 / 8 + 590, |
| 347 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 348 | .priv = 0}, |
| 349 | }; |
Jean-Francois Moine | cc611b8 | 2008-12-29 07:49:41 -0300 | [diff] [blame] | 350 | static const struct v4l2_pix_format vga_mode[] = { |
Jean-Francois Moine | c2446b3 | 2008-07-05 11:49:20 -0300 | [diff] [blame] | 351 | {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| 352 | .bytesperline = 160, |
Jean-Francois Moine | 5d05294 | 2008-09-03 16:48:09 -0300 | [diff] [blame] | 353 | .sizeimage = 160 * 120 * 4 / 8 + 590, |
Jean-Francois Moine | c2446b3 | 2008-07-05 11:49:20 -0300 | [diff] [blame] | 354 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 355 | .priv = 2}, |
| 356 | {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| 357 | .bytesperline = 320, |
| 358 | .sizeimage = 320 * 240 * 3 / 8 + 590, |
| 359 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 360 | .priv = 1}, |
| 361 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
| 362 | .bytesperline = 640, |
Hans de Goede | a5d1cc3 | 2009-06-18 06:03:20 -0300 | [diff] [blame] | 363 | /* Note 3 / 8 is not large enough, not even 5 / 8 is ?! */ |
| 364 | .sizeimage = 640 * 480 * 3 / 4 + 590, |
Jean-Francois Moine | c2446b3 | 2008-07-05 11:49:20 -0300 | [diff] [blame] | 365 | .colorspace = V4L2_COLORSPACE_JPEG, |
| 366 | .priv = 0}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 367 | }; |
| 368 | |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 369 | static const u8 sn_adcm1700[0x1c] = { |
| 370 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 371 | 0x00, 0x43, 0x60, 0x00, 0x1a, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 372 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 373 | 0x80, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 374 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 375 | 0x03, 0x00, 0x05, 0x01, 0x05, 0x16, 0x12, 0x42, |
| 376 | /* reg18 reg19 reg1a reg1b */ |
| 377 | 0x06, 0x00, 0x00, 0x00 |
| 378 | }; |
| 379 | |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 380 | static const u8 sn_gc0307[0x1c] = { |
| 381 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 382 | 0x00, 0x61, 0x62, 0x00, 0x1a, 0x00, 0x00, 0x00, |
| 383 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 384 | 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 385 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 386 | 0x03, 0x00, 0x03, 0x01, 0x08, 0x28, 0x1e, 0x02, |
| 387 | /* reg18 reg19 reg1a reg1b */ |
| 388 | 0x06, 0x00, 0x00, 0x00 |
| 389 | }; |
| 390 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 391 | static const u8 sn_hv7131[0x1c] = { |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 392 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-François Moine | 19697b5 | 2010-07-14 06:33:51 -0300 | [diff] [blame] | 393 | 0x00, 0x03, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 394 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | 98941e4 | 2009-11-02 09:56:59 -0300 | [diff] [blame] | 395 | 0x81, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 396 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 397 | 0x03, 0x00, 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 398 | /* reg18 reg19 reg1a reg1b */ |
| 399 | 0x0a, 0x00, 0x00, 0x00 |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 400 | }; |
| 401 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 402 | static const u8 sn_mi0360[0x1c] = { |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 403 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-François Moine | 19697b5 | 2010-07-14 06:33:51 -0300 | [diff] [blame] | 404 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 405 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | 98941e4 | 2009-11-02 09:56:59 -0300 | [diff] [blame] | 406 | 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 407 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 408 | 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 409 | /* reg18 reg19 reg1a reg1b */ |
| 410 | 0x06, 0x00, 0x00, 0x00 |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 411 | }; |
| 412 | |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 413 | static const u8 sn_mi0360b[0x1c] = { |
| 414 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 415 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
| 416 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 417 | 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 418 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 419 | 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x40, |
| 420 | /* reg18 reg19 reg1a reg1b */ |
| 421 | 0x06, 0x00, 0x00, 0x00 |
| 422 | }; |
| 423 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 424 | static const u8 sn_mo4000[0x1c] = { |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 425 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 426 | 0x00, 0x23, 0x60, 0x00, 0x1a, 0x00, 0x20, 0x18, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 427 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 428 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 429 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 430 | 0x03, 0x00, 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 431 | /* reg18 reg19 reg1a reg1b */ |
| 432 | 0x08, 0x00, 0x00, 0x00 |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 433 | }; |
| 434 | |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 435 | static const u8 sn_mt9v111[0x1c] = { |
| 436 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 437 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20, |
| 438 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | 98941e4 | 2009-11-02 09:56:59 -0300 | [diff] [blame] | 439 | 0x81, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 440 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 441 | 0x03, 0x00, 0x00, 0x02, 0x1c, 0x28, 0x1e, 0x40, |
| 442 | /* reg18 reg19 reg1a reg1b */ |
| 443 | 0x06, 0x00, 0x00, 0x00 |
| 444 | }; |
| 445 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 446 | static const u8 sn_om6802[0x1c] = { |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 447 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Amauri Magagna | 46b4f2a | 2009-10-17 07:21:29 -0300 | [diff] [blame] | 448 | 0x00, 0x23, 0x72, 0x00, 0x1a, 0x20, 0x20, 0x19, |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 449 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 450 | 0x80, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 451 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 452 | 0x03, 0x00, 0x51, 0x01, 0x00, 0x28, 0x1e, 0x40, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 453 | /* reg18 reg19 reg1a reg1b */ |
| 454 | 0x05, 0x00, 0x00, 0x00 |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 455 | }; |
| 456 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 457 | static const u8 sn_ov7630[0x1c] = { |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 458 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-François Moine | 0a85c74 | 2010-04-25 14:33:31 -0300 | [diff] [blame] | 459 | 0x00, 0x21, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 460 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | 98941e4 | 2009-11-02 09:56:59 -0300 | [diff] [blame] | 461 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 462 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 463 | 0x03, 0x00, 0x04, 0x01, 0x0a, 0x28, 0x1e, 0xc2, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 464 | /* reg18 reg19 reg1a reg1b */ |
| 465 | 0x0b, 0x00, 0x00, 0x00 |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 466 | }; |
| 467 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 468 | static const u8 sn_ov7648[0x1c] = { |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 469 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 470 | 0x00, 0x63, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 471 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | 98941e4 | 2009-11-02 09:56:59 -0300 | [diff] [blame] | 472 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 473 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 474 | 0x03, 0x00, 0x00, 0x01, 0x00, 0x28, 0x1e, 0x00, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 475 | /* reg18 reg19 reg1a reg1b */ |
| 476 | 0x0b, 0x00, 0x00, 0x00 |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 477 | }; |
| 478 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 479 | static const u8 sn_ov7660[0x1c] = { |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 480 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
Jean-Francois Moine | c8b9b2c | 2009-04-26 14:46:12 -0300 | [diff] [blame] | 481 | 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 482 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | c8b9b2c | 2009-04-26 14:46:12 -0300 | [diff] [blame] | 483 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 484 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 485 | 0x03, 0x00, 0x01, 0x01, 0x08, 0x28, 0x1e, 0x20, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 486 | /* reg18 reg19 reg1a reg1b */ |
| 487 | 0x07, 0x00, 0x00, 0x00 |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 488 | }; |
| 489 | |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 490 | static const u8 sn_po1030[0x1c] = { |
| 491 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 492 | 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, |
| 493 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 494 | 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 495 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 496 | 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1e, 0x00, |
| 497 | /* reg18 reg19 reg1a reg1b */ |
| 498 | 0x07, 0x00, 0x00, 0x00 |
| 499 | }; |
| 500 | |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 501 | static const u8 sn_po2030n[0x1c] = { |
| 502 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 503 | 0x00, 0x63, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
| 504 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 505 | 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 506 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 507 | 0x03, 0x00, 0x00, 0x01, 0x14, 0x28, 0x1e, 0x00, |
| 508 | /* reg18 reg19 reg1a reg1b */ |
| 509 | 0x07, 0x00, 0x00, 0x00 |
| 510 | }; |
| 511 | |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 512 | static const u8 sn_soi768[0x1c] = { |
| 513 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 514 | 0x00, 0x21, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, |
| 515 | /* reg8 reg9 rega regb regc regd rege regf */ |
| 516 | 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 517 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 518 | 0x03, 0x00, 0x00, 0x01, 0x08, 0x28, 0x1e, 0x00, |
| 519 | /* reg18 reg19 reg1a reg1b */ |
| 520 | 0x07, 0x00, 0x00, 0x00 |
| 521 | }; |
| 522 | |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 523 | static const u8 sn_sp80708[0x1c] = { |
| 524 | /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ |
| 525 | 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20, |
| 526 | /* reg8 reg9 rega regb regc regd rege regf */ |
Jean-Francois Moine | 98941e4 | 2009-11-02 09:56:59 -0300 | [diff] [blame] | 527 | 0x81, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 528 | /* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ |
| 529 | 0x03, 0x00, 0x00, 0x03, 0x04, 0x28, 0x1e, 0x00, |
| 530 | /* reg18 reg19 reg1a reg1b */ |
| 531 | 0x07, 0x00, 0x00, 0x00 |
| 532 | }; |
| 533 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 534 | /* sequence specific to the sensors - !! index = SENSOR_xxx */ |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 535 | static const u8 *sn_tb[] = { |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 536 | [SENSOR_ADCM1700] = sn_adcm1700, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 537 | [SENSOR_GC0307] = sn_gc0307, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 538 | [SENSOR_HV7131R] = sn_hv7131, |
| 539 | [SENSOR_MI0360] = sn_mi0360, |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 540 | [SENSOR_MI0360B] = sn_mi0360b, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 541 | [SENSOR_MO4000] = sn_mo4000, |
| 542 | [SENSOR_MT9V111] = sn_mt9v111, |
| 543 | [SENSOR_OM6802] = sn_om6802, |
| 544 | [SENSOR_OV7630] = sn_ov7630, |
| 545 | [SENSOR_OV7648] = sn_ov7648, |
| 546 | [SENSOR_OV7660] = sn_ov7660, |
| 547 | [SENSOR_PO1030] = sn_po1030, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 548 | [SENSOR_PO2030N] = sn_po2030n, |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 549 | [SENSOR_SOI768] = sn_soi768, |
| 550 | [SENSOR_SP80708] = sn_sp80708, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 551 | }; |
| 552 | |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 553 | /* default gamma table */ |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 554 | static const u8 gamma_def[17] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 555 | 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, |
| 556 | 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff |
| 557 | }; |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 558 | /* gamma for sensor ADCM1700 */ |
| 559 | static const u8 gamma_spec_0[17] = { |
| 560 | 0x0f, 0x39, 0x5a, 0x74, 0x86, 0x95, 0xa6, 0xb4, |
| 561 | 0xbd, 0xc4, 0xcc, 0xd4, 0xd5, 0xde, 0xe4, 0xed, 0xf5 |
| 562 | }; |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 563 | /* gamma for sensors HV7131R and MT9V111 */ |
| 564 | static const u8 gamma_spec_1[17] = { |
| 565 | 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d, |
| 566 | 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5 |
| 567 | }; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 568 | /* gamma for sensor GC0307 */ |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 569 | static const u8 gamma_spec_2[17] = { |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 570 | 0x14, 0x37, 0x50, 0x6a, 0x7c, 0x8d, 0x9d, 0xab, |
| 571 | 0xb5, 0xbf, 0xc2, 0xcb, 0xd1, 0xd6, 0xdb, 0xe1, 0xeb |
| 572 | }; |
| 573 | /* gamma for sensor SP80708 */ |
| 574 | static const u8 gamma_spec_3[17] = { |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 575 | 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab, |
| 576 | 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6 |
| 577 | }; |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 578 | |
Jean-Francois Moine | 803f9cc | 2008-10-04 14:17:02 -0300 | [diff] [blame] | 579 | /* color matrix and offsets */ |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 580 | static const u8 reg84[] = { |
Jean-Francois Moine | 803f9cc | 2008-10-04 14:17:02 -0300 | [diff] [blame] | 581 | 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, /* YR YG YB gains */ |
| 582 | 0xe8, 0x0f, 0xda, 0x0f, 0x40, 0x00, /* UR UG UB */ |
| 583 | 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f, /* VR VG VB */ |
| 584 | 0x00, 0x00, 0x00 /* YUV offsets */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 585 | }; |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 586 | |
| 587 | #define DELAY 0xdd |
| 588 | |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 589 | static const u8 adcm1700_sensor_init[][8] = { |
| 590 | {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 591 | {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10}, /* reset */ |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 592 | {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 593 | {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 594 | {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 595 | {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10}, |
| 596 | {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10}, |
| 597 | {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10}, |
| 598 | {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10}, |
| 599 | {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 600 | {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 601 | {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 602 | {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 603 | {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 604 | {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 605 | {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 606 | {0xb0, 0x51, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 607 | {} |
| 608 | }; |
| 609 | static const u8 adcm1700_sensor_param1[][8] = { |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 610 | {0xb0, 0x51, 0x26, 0xf9, 0x01, 0x00, 0x00, 0x10}, /* exposure? */ |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 611 | {0xd0, 0x51, 0x1e, 0x8e, 0x8e, 0x8e, 0x8e, 0x10}, |
| 612 | |
| 613 | {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 614 | {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 615 | {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 616 | {0xb0, 0x51, 0x32, 0x00, 0x72, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 617 | {0xd0, 0x51, 0x1e, 0xbe, 0xd7, 0xe8, 0xbe, 0x10}, /* exposure? */ |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 618 | |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 619 | {0xa0, 0x51, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 620 | {0xb0, 0x51, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 621 | {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 622 | {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 623 | {} |
| 624 | }; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 625 | static const u8 gc0307_sensor_init[][8] = { |
| 626 | {0xa0, 0x21, 0x43, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 627 | {0xa0, 0x21, 0x44, 0xa2, 0x00, 0x00, 0x00, 0x10}, |
| 628 | {0xa0, 0x21, 0x01, 0x6a, 0x00, 0x00, 0x00, 0x10}, |
| 629 | {0xa0, 0x21, 0x02, 0x70, 0x00, 0x00, 0x00, 0x10}, |
| 630 | {0xa0, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 631 | {0xa0, 0x21, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 632 | {0xa0, 0x21, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 633 | {0xa0, 0x21, 0x11, 0x05, 0x00, 0x00, 0x00, 0x10}, |
| 634 | {0xa0, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 635 | {0xa0, 0x21, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 636 | {0xa0, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 637 | {0xa0, 0x21, 0x08, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 638 | {0xa0, 0x21, 0x09, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 639 | {0xa0, 0x21, 0x0a, 0xe8, 0x00, 0x00, 0x00, 0x10}, |
| 640 | {0xa0, 0x21, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 641 | {0xa0, 0x21, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 642 | {0xa0, 0x21, 0x0d, 0x22, 0x00, 0x00, 0x00, 0x10}, |
| 643 | {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 644 | {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10}, |
| 645 | {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 646 | {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 647 | {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 648 | {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10}, |
| 649 | {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10}, |
| 650 | {0xa0, 0x21, 0x17, 0x52, 0x00, 0x00, 0x00, 0x10}, |
| 651 | {0xa0, 0x21, 0x18, 0x50, 0x00, 0x00, 0x00, 0x10}, |
| 652 | {0xa0, 0x21, 0x1e, 0x0d, 0x00, 0x00, 0x00, 0x10}, |
| 653 | {0xa0, 0x21, 0x1f, 0x32, 0x00, 0x00, 0x00, 0x10}, |
| 654 | {0xa0, 0x21, 0x61, 0x90, 0x00, 0x00, 0x00, 0x10}, |
| 655 | {0xa0, 0x21, 0x63, 0x70, 0x00, 0x00, 0x00, 0x10}, |
| 656 | {0xa0, 0x21, 0x65, 0x98, 0x00, 0x00, 0x00, 0x10}, |
| 657 | {0xa0, 0x21, 0x67, 0x90, 0x00, 0x00, 0x00, 0x10}, |
| 658 | {0xa0, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 659 | {0xa0, 0x21, 0x04, 0x96, 0x00, 0x00, 0x00, 0x10}, |
| 660 | {0xa0, 0x21, 0x45, 0x27, 0x00, 0x00, 0x00, 0x10}, |
| 661 | {0xa0, 0x21, 0x47, 0x2c, 0x00, 0x00, 0x00, 0x10}, |
| 662 | {0xa0, 0x21, 0x43, 0x47, 0x00, 0x00, 0x00, 0x10}, |
| 663 | {0xa0, 0x21, 0x44, 0xd8, 0x00, 0x00, 0x00, 0x10}, |
| 664 | {} |
| 665 | }; |
| 666 | static const u8 gc0307_sensor_param1[][8] = { |
| 667 | {0xa0, 0x21, 0x68, 0x13, 0x00, 0x00, 0x00, 0x10}, |
| 668 | {0xd0, 0x21, 0x61, 0x80, 0x00, 0x80, 0x00, 0x10}, |
| 669 | {0xc0, 0x21, 0x65, 0x80, 0x00, 0x80, 0x00, 0x10}, |
| 670 | {0xc0, 0x21, 0x63, 0xa0, 0x00, 0xa6, 0x00, 0x10}, |
| 671 | /*param3*/ |
| 672 | {0xa0, 0x21, 0x01, 0x6e, 0x00, 0x00, 0x00, 0x10}, |
| 673 | {0xa0, 0x21, 0x02, 0x88, 0x00, 0x00, 0x00, 0x10}, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 674 | {} |
| 675 | }; |
| 676 | |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 677 | static const u8 hv7131r_sensor_init[][8] = { |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 678 | {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, |
| 679 | {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10}, |
| 680 | {0xd1, 0x11, 0x40, 0xff, 0x7f, 0x7f, 0x7f, 0x10}, |
| 681 | /* {0x91, 0x11, 0x44, 0x00, 0x00, 0x00, 0x00, 0x10}, */ |
| 682 | {0xd1, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 683 | {0xd1, 0x11, 0x14, 0x01, 0xe2, 0x02, 0x82, 0x10}, |
| 684 | /* {0x91, 0x11, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10}, */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 685 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 686 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, |
| 687 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, |
| 688 | {0xc1, 0x11, 0x25, 0x00, 0x61, 0xa8, 0x00, 0x10}, |
| 689 | {0xa1, 0x11, 0x30, 0x22, 0x00, 0x00, 0x00, 0x10}, |
| 690 | {0xc1, 0x11, 0x31, 0x20, 0x2e, 0x20, 0x00, 0x10}, |
| 691 | {0xc1, 0x11, 0x25, 0x00, 0xc3, 0x50, 0x00, 0x10}, |
| 692 | {0xa1, 0x11, 0x30, 0x07, 0x00, 0x00, 0x00, 0x10}, /* gain14 */ |
| 693 | {0xc1, 0x11, 0x31, 0x10, 0x10, 0x10, 0x00, 0x10}, /* r g b 101a10 */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 694 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 695 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, |
| 696 | {0xa1, 0x11, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 7fb101a | 2009-10-22 06:27:14 -0300 | [diff] [blame] | 697 | {0xa1, 0x11, 0x21, 0xd0, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 698 | {0xa1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 699 | {0xa1, 0x11, 0x23, 0x09, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 700 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 701 | {0xa1, 0x11, 0x01, 0x08, 0x00, 0x00, 0x00, 0x10}, |
| 702 | {0xa1, 0x11, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 703 | {0xa1, 0x11, 0x21, 0xd0, 0x00, 0x00, 0x00, 0x10}, |
| 704 | {0xa1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 705 | {0xa1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 23a9827 | 2009-11-02 09:10:25 -0300 | [diff] [blame] | 706 | {0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10}, |
| 707 | /* set sensor clock */ |
Jean-Francois Moine | a5ae206 | 2008-07-04 11:16:16 -0300 | [diff] [blame] | 708 | {} |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 709 | }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 710 | static const u8 mi0360_sensor_init[][8] = { |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 711 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 712 | {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 713 | {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 714 | {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, |
| 715 | {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, |
| 716 | {0xd1, 0x5d, 0x05, 0x00, 0x09, 0x00, 0x53, 0x10}, |
| 717 | {0xb1, 0x5d, 0x0d, 0x00, 0x02, 0x00, 0x00, 0x10}, |
| 718 | {0xd1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 719 | {0xd1, 0x5d, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 720 | {0xd1, 0x5d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 721 | {0xd1, 0x5d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 722 | {0xd1, 0x5d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 723 | {0xd1, 0x5d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 724 | {0xd1, 0x5d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 725 | {0xd1, 0x5d, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 726 | {0xd1, 0x5d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 727 | {0xd1, 0x5d, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 728 | {0xb1, 0x5d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 729 | {0xd1, 0x5d, 0x20, 0x91, 0x01, 0x00, 0x00, 0x10}, |
| 730 | {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 731 | {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 732 | {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10}, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 733 | {0xd1, 0x5d, 0x2f, 0xf7, 0xB0, 0x00, 0x04, 0x10}, |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 734 | {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 735 | {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10}, |
| 736 | {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10}, |
| 737 | {0xd1, 0x5d, 0x40, 0x01, 0xe0, 0x00, 0xd1, 0x10}, |
| 738 | {0xb1, 0x5d, 0x44, 0x00, 0x82, 0x00, 0x00, 0x10}, |
| 739 | {0xd1, 0x5d, 0x58, 0x00, 0x78, 0x00, 0x43, 0x10}, |
| 740 | {0xd1, 0x5d, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 741 | {0xd1, 0x5d, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 742 | {0xd1, 0x5d, 0x5e, 0x00, 0x00, 0xa3, 0x1d, 0x10}, |
| 743 | {0xb1, 0x5d, 0x62, 0x04, 0x11, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 744 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 745 | {0xb1, 0x5d, 0x20, 0x91, 0x01, 0x00, 0x00, 0x10}, |
| 746 | {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, |
| 747 | {0xb1, 0x5d, 0x09, 0x00, 0x64, 0x00, 0x00, 0x10}, |
| 748 | {0xd1, 0x5d, 0x2b, 0x00, 0xa0, 0x00, 0xb0, 0x10}, |
| 749 | {0xd1, 0x5d, 0x2d, 0x00, 0xa0, 0x00, 0xa0, 0x10}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 750 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 751 | {0xb1, 0x5d, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor clck ?2 */ |
| 752 | {0xb1, 0x5d, 0x06, 0x00, 0x30, 0x00, 0x00, 0x10}, |
| 753 | {0xb1, 0x5d, 0x05, 0x00, 0x0a, 0x00, 0x00, 0x10}, |
| 754 | {0xb1, 0x5d, 0x09, 0x02, 0x35, 0x00, 0x00, 0x10}, /* exposure 2 */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 755 | |
Jean-Francois Moine | 8c2ba44 | 2009-01-13 05:55:40 -0300 | [diff] [blame] | 756 | {0xd1, 0x5d, 0x2b, 0x00, 0xb9, 0x00, 0xe3, 0x10}, |
| 757 | {0xd1, 0x5d, 0x2d, 0x00, 0x5f, 0x00, 0xb9, 0x10}, /* 42 */ |
| 758 | /* {0xb1, 0x5d, 0x35, 0x00, 0x67, 0x00, 0x00, 0x10}, * gain orig */ |
| 759 | /* {0xb1, 0x5d, 0x35, 0x00, 0x20, 0x00, 0x00, 0x10}, * gain */ |
| 760 | {0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10}, /* update */ |
| 761 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ |
Jean-Francois Moine | a5ae206 | 2008-07-04 11:16:16 -0300 | [diff] [blame] | 762 | {} |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 763 | }; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 764 | static const u8 mi0360b_sensor_init[][8] = { |
| 765 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, |
| 766 | {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 767 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/ |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 768 | {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 769 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/ |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 770 | {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, |
| 771 | {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, |
| 772 | {0xd1, 0x5d, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 773 | {0xb1, 0x5d, 0x0d, 0x00, 0x02, 0x00, 0x00, 0x10}, |
| 774 | {0xd1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 775 | {0xd1, 0x5d, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 776 | {0xd1, 0x5d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 777 | {0xd1, 0x5d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 778 | {0xd1, 0x5d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 779 | {0xd1, 0x5d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 780 | {0xd1, 0x5d, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 781 | {0xd1, 0x5d, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 782 | {0xd1, 0x5d, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 783 | {0xd1, 0x5d, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 784 | {0xb1, 0x5d, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 785 | {0xd1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, |
| 786 | {0xd1, 0x5d, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 787 | {0xd1, 0x5d, 0x24, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 788 | {0xd1, 0x5d, 0x26, 0x00, 0x00, 0x00, 0x24, 0x10}, |
| 789 | {0xd1, 0x5d, 0x2f, 0xf7, 0xb0, 0x00, 0x04, 0x10}, |
| 790 | {0xd1, 0x5d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 791 | {0xd1, 0x5d, 0x33, 0x00, 0x00, 0x01, 0x00, 0x10}, |
| 792 | {0xb1, 0x5d, 0x3d, 0x06, 0x8f, 0x00, 0x00, 0x10}, |
| 793 | {0xd1, 0x5d, 0x40, 0x01, 0xe0, 0x00, 0xd1, 0x10}, |
| 794 | {0xb1, 0x5d, 0x44, 0x00, 0x82, 0x00, 0x00, 0x10}, |
| 795 | {0xd1, 0x5d, 0x58, 0x00, 0x78, 0x00, 0x43, 0x10}, |
| 796 | {0xd1, 0x5d, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 797 | {0xd1, 0x5d, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 798 | {0xd1, 0x5d, 0x5e, 0x00, 0x00, 0xa3, 0x1d, 0x10}, |
| 799 | {0xb1, 0x5d, 0x62, 0x04, 0x11, 0x00, 0x00, 0x10}, |
| 800 | |
| 801 | {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, |
| 802 | {0xb1, 0x5d, 0x20, 0x11, 0x01, 0x00, 0x00, 0x10}, |
| 803 | {0xb1, 0x5d, 0x09, 0x00, 0x64, 0x00, 0x00, 0x10}, |
| 804 | {0xd1, 0x5d, 0x2b, 0x00, 0x33, 0x00, 0xa0, 0x10}, |
| 805 | {0xd1, 0x5d, 0x2d, 0x00, 0xa0, 0x00, 0x33, 0x10}, |
| 806 | {} |
| 807 | }; |
| 808 | static const u8 mi0360b_sensor_param1[][8] = { |
| 809 | {0xb1, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 810 | {0xb1, 0x5d, 0x06, 0x00, 0x53, 0x00, 0x00, 0x10}, |
| 811 | {0xb1, 0x5d, 0x05, 0x00, 0x09, 0x00, 0x00, 0x10}, |
| 812 | {0xb1, 0x5d, 0x09, 0x02, 0x35, 0x00, 0x00, 0x10}, /* exposure 2 */ |
| 813 | |
| 814 | {0xd1, 0x5d, 0x2b, 0x00, 0xd1, 0x01, 0xc9, 0x10}, |
| 815 | {0xd1, 0x5d, 0x2d, 0x00, 0xed, 0x00, 0xd1, 0x10}, |
| 816 | {0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10}, /* update */ |
| 817 | {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */ |
| 818 | {} |
| 819 | }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 820 | static const u8 mo4000_sensor_init[][8] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 821 | {0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 822 | {0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 823 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 824 | {0xa1, 0x21, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 825 | {0xa1, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 826 | {0xa1, 0x21, 0x05, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 827 | {0xa1, 0x21, 0x06, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 828 | {0xa1, 0x21, 0x06, 0x81, 0x00, 0x00, 0x00, 0x10}, |
| 829 | {0xa1, 0x21, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 830 | {0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 831 | {0xa1, 0x21, 0x11, 0x20, 0x00, 0x00, 0x00, 0x10}, |
| 832 | {0xa1, 0x21, 0x11, 0x30, 0x00, 0x00, 0x00, 0x10}, |
| 833 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, |
| 834 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, |
| 835 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 836 | {0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 837 | {0xa1, 0x21, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x10}, |
| 838 | {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, |
| 839 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 840 | {0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | a5ae206 | 2008-07-04 11:16:16 -0300 | [diff] [blame] | 841 | {} |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 842 | }; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 843 | static const u8 mt9v111_sensor_init[][8] = { |
| 844 | {0xb1, 0x5c, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, /* reset? */ |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 845 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 846 | {0xb1, 0x5c, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 847 | {0xb1, 0x5c, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10}, /* IFP select */ |
| 848 | {0xb1, 0x5c, 0x08, 0x04, 0x80, 0x00, 0x00, 0x10}, /* output fmt ctrl */ |
| 849 | {0xb1, 0x5c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, /* op mode ctrl */ |
Jean-Francois Moine | 2687a2f | 2009-02-01 14:48:55 -0300 | [diff] [blame] | 850 | {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10}, |
| 851 | {0xb1, 0x5c, 0x03, 0x01, 0xe1, 0x00, 0x00, 0x10}, |
| 852 | {0xb1, 0x5c, 0x04, 0x02, 0x81, 0x00, 0x00, 0x10}, |
| 853 | {0xb1, 0x5c, 0x05, 0x00, 0x04, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 854 | {0xb1, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10}, /* sensor select */ |
Jean-Francois Moine | 2687a2f | 2009-02-01 14:48:55 -0300 | [diff] [blame] | 855 | {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10}, |
| 856 | {0xb1, 0x5c, 0x03, 0x01, 0xe6, 0x00, 0x00, 0x10}, |
| 857 | {0xb1, 0x5c, 0x04, 0x02, 0x86, 0x00, 0x00, 0x10}, |
| 858 | {0xb1, 0x5c, 0x05, 0x00, 0x04, 0x00, 0x00, 0x10}, |
| 859 | {0xb1, 0x5c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 860 | {0xb1, 0x5c, 0x08, 0x00, 0x08, 0x00, 0x00, 0x10}, /* row start */ |
Jean-Francois Moine | 2687a2f | 2009-02-01 14:48:55 -0300 | [diff] [blame] | 861 | {0xb1, 0x5c, 0x0e, 0x00, 0x08, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 862 | {0xb1, 0x5c, 0x02, 0x00, 0x16, 0x00, 0x00, 0x10}, /* col start */ |
| 863 | {0xb1, 0x5c, 0x03, 0x01, 0xe7, 0x00, 0x00, 0x10}, /* window height */ |
| 864 | {0xb1, 0x5c, 0x04, 0x02, 0x87, 0x00, 0x00, 0x10}, /* window width */ |
| 865 | {0xb1, 0x5c, 0x07, 0x30, 0x02, 0x00, 0x00, 0x10}, /* output ctrl */ |
| 866 | {0xb1, 0x5c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x10}, /* shutter delay */ |
| 867 | {0xb1, 0x5c, 0x12, 0x00, 0xb0, 0x00, 0x00, 0x10}, /* zoom col start */ |
| 868 | {0xb1, 0x5c, 0x13, 0x00, 0x7c, 0x00, 0x00, 0x10}, /* zoom row start */ |
| 869 | {0xb1, 0x5c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* digital zoom */ |
| 870 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, /* read mode */ |
| 871 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 872 | {} |
| 873 | }; |
| 874 | static const u8 mt9v111_sensor_param1[][8] = { |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 875 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 876 | {0xb1, 0x5c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 2687a2f | 2009-02-01 14:48:55 -0300 | [diff] [blame] | 877 | {0xb1, 0x5c, 0x09, 0x01, 0x2c, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 878 | {0xd1, 0x5c, 0x2b, 0x00, 0x33, 0x00, 0xa0, 0x10}, /* green1 gain */ |
| 879 | {0xd1, 0x5c, 0x2d, 0x00, 0xa0, 0x00, 0x33, 0x10}, /* red gain */ |
| 880 | /*******/ |
| 881 | {0xb1, 0x5c, 0x06, 0x00, 0x1e, 0x00, 0x00, 0x10}, /* vert blanking */ |
| 882 | {0xb1, 0x5c, 0x05, 0x00, 0x0a, 0x00, 0x00, 0x10}, /* horiz blanking */ |
| 883 | {0xd1, 0x5c, 0x2c, 0x00, 0xad, 0x00, 0xad, 0x10}, /* blue gain */ |
| 884 | {0xb1, 0x5c, 0x35, 0x01, 0xc0, 0x00, 0x00, 0x10}, /* global gain */ |
| 885 | {} |
| 886 | }; |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 887 | static const u8 om6802_init0[2][8] = { |
| 888 | /*fixme: variable*/ |
| 889 | {0xa0, 0x34, 0x29, 0x0e, 0x00, 0x00, 0x00, 0x10}, |
| 890 | {0xa0, 0x34, 0x23, 0xb0, 0x00, 0x00, 0x00, 0x10}, |
| 891 | }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 892 | static const u8 om6802_sensor_init[][8] = { |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 893 | {0xa0, 0x34, 0xdf, 0x6d, 0x00, 0x00, 0x00, 0x10}, |
| 894 | /* factory mode */ |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 895 | {0xa0, 0x34, 0xdd, 0x18, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 896 | /* output raw RGB */ |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 897 | {0xa0, 0x34, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 898 | /* {0xa0, 0x34, 0xfb, 0x11, 0x00, 0x00, 0x00, 0x10}, */ |
| 899 | {0xa0, 0x34, 0xf0, 0x04, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 900 | /* auto-exposure speed (0) / white balance mode (auto RGB) */ |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 901 | /* {0xa0, 0x34, 0xf1, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 902 | * set color mode */ |
| 903 | /* {0xa0, 0x34, 0xfe, 0x5b, 0x00, 0x00, 0x00, 0x10}, |
| 904 | * max AGC value in AE */ |
| 905 | /* {0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 906 | * preset AGC */ |
| 907 | /* {0xa0, 0x34, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 908 | * preset brightness */ |
| 909 | /* {0xa0, 0x34, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 910 | * preset contrast */ |
| 911 | /* {0xa0, 0x34, 0xe8, 0x31, 0x00, 0x00, 0x00, 0x10}, |
| 912 | * preset gamma */ |
| 913 | {0xa0, 0x34, 0xe9, 0x0f, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 914 | /* luminance mode (0x4f -> AutoExpo on) */ |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 915 | {0xa0, 0x34, 0xe4, 0xff, 0x00, 0x00, 0x00, 0x10}, |
| 916 | /* preset shutter */ |
| 917 | /* {0xa0, 0x34, 0xef, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 918 | * auto frame rate */ |
| 919 | /* {0xa0, 0x34, 0xfb, 0xee, 0x00, 0x00, 0x00, 0x10}, */ |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 920 | {0xa0, 0x34, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 921 | {} |
| 922 | }; |
| 923 | static const u8 om6802_sensor_param1[][8] = { |
| 924 | {0xa0, 0x34, 0x71, 0x84, 0x00, 0x00, 0x00, 0x10}, |
| 925 | {0xa0, 0x34, 0x72, 0x05, 0x00, 0x00, 0x00, 0x10}, |
| 926 | {0xa0, 0x34, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 927 | {0xa0, 0x34, 0x69, 0x01, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 928 | {} |
| 929 | }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 930 | static const u8 ov7630_sensor_init[][8] = { |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 931 | {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 932 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 933 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 934 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
| 935 | {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 936 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 937 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 05b809c | 2008-09-03 16:47:59 -0300 | [diff] [blame] | 938 | /* win: i2c_r from 00 to 80 */ |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 939 | {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, |
| 940 | {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10}, |
Hans de Goede | cc7b5b5 | 2009-06-18 05:14:42 -0300 | [diff] [blame] | 941 | /* HDG: 0x11 was 0x00 change to 0x01 for better exposure (15 fps instead of 30) |
| 942 | 0x13 was 0xc0 change to 0xc3 for auto gain and exposure */ |
| 943 | {0xd1, 0x21, 0x11, 0x01, 0x48, 0xc3, 0x00, 0x10}, |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 944 | {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10}, |
| 945 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, |
| 946 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 947 | {0xd1, 0x21, 0x1f, 0x00, 0x80, 0x80, 0x80, 0x10}, |
| 948 | {0xd1, 0x21, 0x23, 0xde, 0x10, 0x8a, 0xa0, 0x10}, |
| 949 | {0xc1, 0x21, 0x27, 0xca, 0xa2, 0x74, 0x00, 0x10}, |
| 950 | {0xd1, 0x21, 0x2a, 0x88, 0x00, 0x88, 0x01, 0x10}, |
| 951 | {0xc1, 0x21, 0x2e, 0x80, 0x00, 0x18, 0x00, 0x10}, |
| 952 | {0xa1, 0x21, 0x21, 0x08, 0x00, 0x00, 0x00, 0x10}, |
| 953 | {0xa1, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 954 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 955 | {0xb1, 0x21, 0x32, 0xc2, 0x08, 0x00, 0x00, 0x10}, |
| 956 | {0xb1, 0x21, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 957 | {0xd1, 0x21, 0x60, 0x05, 0x40, 0x12, 0x57, 0x10}, |
| 958 | {0xa1, 0x21, 0x64, 0x73, 0x00, 0x00, 0x00, 0x10}, |
| 959 | {0xd1, 0x21, 0x65, 0x00, 0x55, 0x01, 0xac, 0x10}, |
| 960 | {0xa1, 0x21, 0x69, 0x38, 0x00, 0x00, 0x00, 0x10}, |
| 961 | {0xd1, 0x21, 0x6f, 0x1f, 0x01, 0x00, 0x10, 0x10}, |
| 962 | {0xd1, 0x21, 0x73, 0x50, 0x20, 0x02, 0x01, 0x10}, |
| 963 | {0xd1, 0x21, 0x77, 0xf3, 0x90, 0x98, 0x98, 0x10}, |
| 964 | {0xc1, 0x21, 0x7b, 0x00, 0x4c, 0xf7, 0x00, 0x10}, |
| 965 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, |
| 966 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, |
Jean-François Moine | bdd2b93 | 2010-04-25 14:23:39 -0300 | [diff] [blame] | 967 | {} |
| 968 | }; |
| 969 | static const u8 ov7630_sensor_param1[][8] = { |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 970 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
| 971 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
| 972 | /*fixme: + 0x12, 0x04*/ |
Jean-Francois Moine | 6c86274 | 2008-09-08 04:57:26 -0300 | [diff] [blame] | 973 | /* {0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10}, * COMN |
| 974 | * set by setvflip */ |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 975 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, |
| 976 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 977 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 05b809c | 2008-09-03 16:47:59 -0300 | [diff] [blame] | 978 | /* */ |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 979 | /* {0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10}, * set by setfreq */ |
| 980 | /* {0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10}, * set by setfreq */ |
Jean-Francois Moine | 05b809c | 2008-09-03 16:47:59 -0300 | [diff] [blame] | 981 | /* */ |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 982 | {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 91de65a | 2008-09-03 17:12:18 -0300 | [diff] [blame] | 983 | /* {0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, */ |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 984 | {} |
| 985 | }; |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 986 | |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 987 | static const u8 ov7648_sensor_init[][8] = { |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 988 | {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 989 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 990 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 991 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 992 | {0xd1, 0x21, 0x03, 0xa4, 0x30, 0x88, 0x00, 0x10}, |
| 993 | {0xb1, 0x21, 0x11, 0x80, 0x08, 0x00, 0x00, 0x10}, |
| 994 | {0xc1, 0x21, 0x13, 0xa0, 0x04, 0x84, 0x00, 0x10}, |
| 995 | {0xd1, 0x21, 0x17, 0x1a, 0x02, 0xba, 0xf4, 0x10}, |
| 996 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 997 | {0xd1, 0x21, 0x1f, 0x41, 0xc0, 0x80, 0x80, 0x10}, |
| 998 | {0xd1, 0x21, 0x23, 0xde, 0xa0, 0x80, 0x32, 0x10}, |
| 999 | {0xd1, 0x21, 0x27, 0xfe, 0xa0, 0x00, 0x91, 0x10}, |
| 1000 | {0xd1, 0x21, 0x2b, 0x00, 0x88, 0x85, 0x80, 0x10}, |
| 1001 | {0xc1, 0x21, 0x2f, 0x9c, 0x00, 0xc4, 0x00, 0x10}, |
| 1002 | {0xd1, 0x21, 0x60, 0xa6, 0x60, 0x88, 0x12, 0x10}, |
| 1003 | {0xd1, 0x21, 0x64, 0x88, 0x00, 0x00, 0x94, 0x10}, |
| 1004 | {0xd1, 0x21, 0x68, 0x7a, 0x0c, 0x00, 0x00, 0x10}, |
| 1005 | {0xd1, 0x21, 0x6c, 0x11, 0x33, 0x22, 0x00, 0x10}, |
| 1006 | {0xd1, 0x21, 0x70, 0x11, 0x00, 0x10, 0x50, 0x10}, |
| 1007 | {0xd1, 0x21, 0x74, 0x20, 0x06, 0x00, 0xb5, 0x10}, |
| 1008 | {0xd1, 0x21, 0x78, 0x8a, 0x00, 0x00, 0x00, 0x10}, |
| 1009 | {0xb1, 0x21, 0x7c, 0x00, 0x43, 0x00, 0x00, 0x10}, |
| 1010 | |
| 1011 | {0xd1, 0x21, 0x21, 0x86, 0x00, 0xde, 0xa0, 0x10}, |
| 1012 | /* {0xd1, 0x21, 0x25, 0x80, 0x32, 0xfe, 0xa0, 0x10}, jfm done */ |
| 1013 | /* {0xd1, 0x21, 0x29, 0x00, 0x91, 0x00, 0x88, 0x10}, jfm done */ |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 1014 | /* {0xb1, 0x21, 0x2d, 0x85, 0x00, 0x00, 0x00, 0x10}, set by setfreq */ |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 1015 | {} |
| 1016 | }; |
| 1017 | static const u8 ov7648_sensor_param1[][8] = { |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 1018 | /* {0xa1, 0x21, 0x12, 0x08, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
Jean-Francois Moine | 2797ba2 | 2009-02-05 15:12:24 -0300 | [diff] [blame] | 1019 | /* {0xa1, 0x21, 0x75, 0x06, 0x00, 0x00, 0x00, 0x10}, * COMN |
| 1020 | * set by setvflip */ |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 1021 | {0xa1, 0x21, 0x19, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 1022 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, |
| 1023 | /* {0xa1, 0x21, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
| 1024 | /* {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, * GAIN - def */ |
| 1025 | /* {0xb1, 0x21, 0x01, 0x6c, 0x6c, 0x00, 0x00, 0x10}, * B R - def: 80 */ |
| 1026 | /*...*/ |
| 1027 | {0xa1, 0x21, 0x11, 0x81, 0x00, 0x00, 0x00, 0x10}, /* CLKRC */ |
| 1028 | /* {0xa1, 0x21, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
| 1029 | /* {0xa1, 0x21, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
| 1030 | /* {0xa1, 0x21, 0x2a, 0x91, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
| 1031 | /* {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
| 1032 | /* {0xb1, 0x21, 0x01, 0x64, 0x84, 0x00, 0x00, 0x10}, * B R - def: 80 */ |
| 1033 | |
| 1034 | {} |
| 1035 | }; |
| 1036 | |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1037 | static const u8 ov7660_sensor_init[][8] = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1038 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1039 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1040 | {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1041 | /* Outformat = rawRGB */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1042 | {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */ |
Jean-Francois Moine | d8f400e | 2009-07-08 06:33:44 -0300 | [diff] [blame] | 1043 | {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1044 | /* GAIN BLUE RED VREF */ |
| 1045 | {0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10}, |
| 1046 | /* COM 1 BAVE GEAVE AECHH */ |
| 1047 | {0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10}, /* RAVE COM2 */ |
| 1048 | {0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10}, /* COM 3 4 5 6 */ |
Jean-Francois Moine | 47f7f6f | 2009-08-25 06:14:54 -0300 | [diff] [blame] | 1049 | {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1050 | /* AECH CLKRC COM7 COM8 */ |
| 1051 | {0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10}, /* COM9 COM10 */ |
| 1052 | {0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10}, |
| 1053 | /* HSTART HSTOP VSTRT VSTOP */ |
| 1054 | {0xa1, 0x21, 0x1b, 0x02, 0x00, 0x00, 0x00, 0x10}, /* PSHFT */ |
| 1055 | {0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10}, /* MVFP LAEC */ |
| 1056 | {0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10}, |
| 1057 | /* BOS GBOS GROS ROS (BGGR offset) */ |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1058 | /* {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, */ |
| 1059 | {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10}, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1060 | /* AEW AEB VPT BBIAS */ |
| 1061 | {0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10}, |
| 1062 | /* GbBIAS RSVD EXHCH EXHCL */ |
| 1063 | {0xd1, 0x21, 0x2c, 0x80, 0x00, 0x00, 0x62, 0x10}, |
| 1064 | /* RBIAS ADVFL ASDVFH YAVE */ |
| 1065 | {0xc1, 0x21, 0x30, 0x08, 0x30, 0xb4, 0x00, 0x10}, |
| 1066 | /* HSYST HSYEN HREF */ |
| 1067 | {0xd1, 0x21, 0x33, 0x00, 0x07, 0x84, 0x00, 0x10}, /* reserved */ |
| 1068 | {0xd1, 0x21, 0x37, 0x0c, 0x02, 0x43, 0x00, 0x10}, |
| 1069 | /* ADC ACOM OFON TSLB */ |
| 1070 | {0xd1, 0x21, 0x3b, 0x02, 0x6c, 0x19, 0x0e, 0x10}, |
| 1071 | /* COM11 COM12 COM13 COM14 */ |
| 1072 | {0xd1, 0x21, 0x3f, 0x41, 0xc1, 0x22, 0x08, 0x10}, |
| 1073 | /* EDGE COM15 COM16 COM17 */ |
| 1074 | {0xd1, 0x21, 0x43, 0xf0, 0x10, 0x78, 0xa8, 0x10}, /* reserved */ |
| 1075 | {0xd1, 0x21, 0x47, 0x60, 0x80, 0x00, 0x00, 0x10}, /* reserved */ |
| 1076 | {0xd1, 0x21, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* reserved */ |
| 1077 | {0xd1, 0x21, 0x4f, 0x46, 0x36, 0x0f, 0x17, 0x10}, /* MTX 1 2 3 4 */ |
| 1078 | {0xd1, 0x21, 0x53, 0x7f, 0x96, 0x40, 0x40, 0x10}, /* MTX 5 6 7 8 */ |
| 1079 | {0xb1, 0x21, 0x57, 0x40, 0x0f, 0x00, 0x00, 0x10}, /* MTX9 MTXS */ |
| 1080 | {0xd1, 0x21, 0x59, 0xba, 0x9a, 0x22, 0xb9, 0x10}, /* reserved */ |
| 1081 | {0xd1, 0x21, 0x5d, 0x9b, 0x10, 0xf0, 0x05, 0x10}, /* reserved */ |
| 1082 | {0xa1, 0x21, 0x61, 0x60, 0x00, 0x00, 0x00, 0x10}, /* reserved */ |
| 1083 | {0xd1, 0x21, 0x62, 0x00, 0x00, 0x50, 0x30, 0x10}, |
| 1084 | /* LCC1 LCC2 LCC3 LCC4 */ |
| 1085 | {0xa1, 0x21, 0x66, 0x00, 0x00, 0x00, 0x00, 0x10}, /* LCC5 */ |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1086 | {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10}, /* MANU */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1087 | {0xa1, 0x21, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1088 | /* band gap reference [0:3] DBLV */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1089 | {0xd1, 0x21, 0x6c, 0x30, 0x48, 0x80, 0x74, 0x10}, /* gamma curve */ |
| 1090 | {0xd1, 0x21, 0x70, 0x64, 0x60, 0x5c, 0x58, 0x10}, /* gamma curve */ |
| 1091 | {0xd1, 0x21, 0x74, 0x54, 0x4c, 0x40, 0x38, 0x10}, /* gamma curve */ |
| 1092 | {0xd1, 0x21, 0x78, 0x34, 0x30, 0x2f, 0x2b, 0x10}, /* gamma curve */ |
| 1093 | {0xd1, 0x21, 0x7c, 0x03, 0x07, 0x17, 0x34, 0x10}, /* gamma curve */ |
| 1094 | {0xd1, 0x21, 0x80, 0x41, 0x4d, 0x58, 0x63, 0x10}, /* gamma curve */ |
| 1095 | {0xd1, 0x21, 0x84, 0x6e, 0x77, 0x87, 0x95, 0x10}, /* gamma curve */ |
| 1096 | {0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10}, /* gamma curve */ |
| 1097 | {0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10}, /* reserved */ |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1098 | {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10}, /* DM_LNL/H */ |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 1099 | /* not in all ms-win traces*/ |
Jean-Francois Moine | 47f7f6f | 2009-08-25 06:14:54 -0300 | [diff] [blame] | 1100 | {0xa1, 0x21, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 1101 | {} |
| 1102 | }; |
| 1103 | static const u8 ov7660_sensor_param1[][8] = { |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1104 | {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, /* MVFP */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1105 | /* bits[3..0]reserved */ |
| 1106 | {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 1107 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1108 | /* VREF vertical frame ctrl */ |
| 1109 | {0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1110 | {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* AECH 0x20 */ |
| 1111 | {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFL */ |
| 1112 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFH */ |
| 1113 | {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, /* GAIN */ |
| 1114 | /* {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, * BLUE */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1115 | /****** (some exchanges in the win trace) ******/ |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 1116 | /*fixme:param2*/ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1117 | {0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},/* dummy line hight */ |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1118 | {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10}, /* dummy line low */ |
| 1119 | {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCH */ |
| 1120 | {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCL */ |
| 1121 | /* {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10}, * RED */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1122 | /****** (some exchanges in the win trace) ******/ |
Jean-Francois Moine | 738608a | 2008-07-28 06:41:51 -0300 | [diff] [blame] | 1123 | /******!! startsensor KO if changed !!****/ |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 1124 | /*fixme: param3*/ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1125 | {0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 1126 | {0xa1, 0x21, 0x92, 0xff, 0x00, 0x00, 0x00, 0x10}, |
| 1127 | {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1128 | {0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | a5ae206 | 2008-07-04 11:16:16 -0300 | [diff] [blame] | 1129 | {} |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1130 | }; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1131 | |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1132 | static const u8 po1030_sensor_init[][8] = { |
| 1133 | /* the sensor registers are described in m5602/m5602_po1030.h */ |
| 1134 | {0xa1, 0x6e, 0x3f, 0x20, 0x00, 0x00, 0x00, 0x10}, /* sensor reset */ |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1135 | {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1136 | {0xa1, 0x6e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1137 | {0xa1, 0x6e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1138 | {0xd1, 0x6e, 0x04, 0x02, 0xb1, 0x02, 0x39, 0x10}, |
| 1139 | {0xd1, 0x6e, 0x08, 0x00, 0x01, 0x00, 0x00, 0x10}, |
| 1140 | {0xd1, 0x6e, 0x0c, 0x02, 0x7f, 0x01, 0xe0, 0x10}, |
| 1141 | {0xd1, 0x6e, 0x12, 0x03, 0x02, 0x00, 0x03, 0x10}, |
| 1142 | {0xd1, 0x6e, 0x16, 0x85, 0x40, 0x4a, 0x40, 0x10}, /* r/g1/b/g2 gains */ |
| 1143 | {0xc1, 0x6e, 0x1a, 0x00, 0x80, 0x00, 0x00, 0x10}, |
| 1144 | {0xd1, 0x6e, 0x1d, 0x08, 0x03, 0x00, 0x00, 0x10}, |
| 1145 | {0xd1, 0x6e, 0x23, 0x00, 0xb0, 0x00, 0x94, 0x10}, |
| 1146 | {0xd1, 0x6e, 0x27, 0x58, 0x00, 0x00, 0x00, 0x10}, |
| 1147 | {0xb1, 0x6e, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1148 | {0xd1, 0x6e, 0x2d, 0x14, 0x35, 0x61, 0x84, 0x10}, /* gamma corr */ |
| 1149 | {0xd1, 0x6e, 0x31, 0xa2, 0xbd, 0xd8, 0xff, 0x10}, |
| 1150 | {0xd1, 0x6e, 0x35, 0x06, 0x1e, 0x12, 0x02, 0x10}, /* color matrix */ |
| 1151 | {0xd1, 0x6e, 0x39, 0xaa, 0x53, 0x37, 0xd5, 0x10}, |
| 1152 | {0xa1, 0x6e, 0x3d, 0xf2, 0x00, 0x00, 0x00, 0x10}, |
| 1153 | {0xd1, 0x6e, 0x3e, 0x00, 0x00, 0x80, 0x03, 0x10}, |
| 1154 | {0xd1, 0x6e, 0x42, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1155 | {0xc1, 0x6e, 0x46, 0x00, 0x80, 0x80, 0x00, 0x10}, |
| 1156 | {0xd1, 0x6e, 0x4b, 0x02, 0xef, 0x08, 0xcd, 0x10}, |
| 1157 | {0xd1, 0x6e, 0x4f, 0x00, 0xd0, 0x00, 0xa0, 0x10}, |
| 1158 | {0xd1, 0x6e, 0x53, 0x01, 0xaa, 0x01, 0x40, 0x10}, |
| 1159 | {0xd1, 0x6e, 0x5a, 0x50, 0x04, 0x30, 0x03, 0x10}, /* raw rgb bayer */ |
| 1160 | {0xa1, 0x6e, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1161 | {0xd1, 0x6e, 0x5f, 0x10, 0x40, 0xff, 0x00, 0x10}, |
| 1162 | |
| 1163 | {0xd1, 0x6e, 0x63, 0x40, 0x40, 0x00, 0x00, 0x10}, |
| 1164 | {0xd1, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1165 | {0xd1, 0x6e, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1166 | {0xd1, 0x6e, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1167 | {0xc1, 0x6e, 0x73, 0x10, 0x80, 0xeb, 0x00, 0x10}, |
| 1168 | {} |
| 1169 | }; |
| 1170 | static const u8 po1030_sensor_param1[][8] = { |
| 1171 | /* from ms-win traces - these values change with auto gain/expo/wb.. */ |
| 1172 | {0xa1, 0x6e, 0x1e, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1173 | {0xa1, 0x6e, 0x1e, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1174 | /* mean values */ |
| 1175 | {0xc1, 0x6e, 0x1a, 0x02, 0xd4, 0xa4, 0x00, 0x10}, /* integlines */ |
| 1176 | {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, /* global gain */ |
| 1177 | {0xc1, 0x6e, 0x16, 0x40, 0x40, 0x40, 0x00, 0x10}, /* r/g1/b gains */ |
| 1178 | |
| 1179 | {0xa1, 0x6e, 0x1d, 0x08, 0x00, 0x00, 0x00, 0x10}, /* control1 */ |
| 1180 | {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, /* frameheight */ |
| 1181 | {0xa1, 0x6e, 0x07, 0xd5, 0x00, 0x00, 0x00, 0x10}, |
| 1182 | /* {0xc1, 0x6e, 0x16, 0x49, 0x40, 0x45, 0x00, 0x10}, */ |
| 1183 | {} |
| 1184 | }; |
| 1185 | |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1186 | static const u8 po2030n_sensor_init[][8] = { |
| 1187 | {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10}, |
| 1188 | {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1189 | {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1190 | {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10}, |
| 1191 | {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1192 | {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1193 | {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10}, |
| 1194 | {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1195 | {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10}, |
| 1196 | {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 1197 | {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10}, |
| 1198 | {0xd1, 0x6e, 0x08, 0x00, 0xd0, 0x00, 0x08, 0x10}, |
| 1199 | {0xd1, 0x6e, 0x0c, 0x03, 0x50, 0x01, 0xe8, 0x10}, |
| 1200 | {0xd1, 0x6e, 0x1d, 0x20, 0x0a, 0x19, 0x44, 0x10}, |
| 1201 | {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1202 | {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1203 | {0xd1, 0x6e, 0x29, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1204 | {0xd1, 0x6e, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1205 | {0xd1, 0x6e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1206 | {0xd1, 0x6e, 0x35, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1207 | {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1208 | {0xd1, 0x6e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1209 | {0xd1, 0x6e, 0x41, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1210 | {0xd1, 0x6e, 0x45, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1211 | {0xd1, 0x6e, 0x49, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1212 | {0xd1, 0x6e, 0x4d, 0x00, 0x00, 0x00, 0xed, 0x10}, |
| 1213 | {0xd1, 0x6e, 0x51, 0x17, 0x4a, 0x2f, 0xc0, 0x10}, |
| 1214 | {0xd1, 0x6e, 0x55, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1215 | {0xd1, 0x6e, 0x59, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1216 | {0xd1, 0x6e, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1217 | {0xd1, 0x6e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1218 | {0xd1, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1219 | {0xd1, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1220 | {0xd1, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1221 | {0xd1, 0x6e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1222 | {0xd1, 0x6e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1223 | {0xd1, 0x6e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1224 | {0xd1, 0x6e, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1225 | {0xd1, 0x6e, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1226 | {0xd1, 0x6e, 0x85, 0x00, 0x00, 0x00, 0x08, 0x10}, |
| 1227 | {0xd1, 0x6e, 0x89, 0x01, 0xe8, 0x00, 0x01, 0x10}, |
| 1228 | {0xa1, 0x6e, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1229 | {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1230 | {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x01, 0x10}, |
| 1231 | {0xd1, 0x6e, 0x29, 0xe6, 0x00, 0xbd, 0x03, 0x10}, |
| 1232 | {0xd1, 0x6e, 0x2d, 0x41, 0x38, 0x68, 0x40, 0x10}, |
| 1233 | {0xd1, 0x6e, 0x31, 0x2b, 0x00, 0x36, 0x00, 0x10}, |
| 1234 | {0xd1, 0x6e, 0x35, 0x30, 0x30, 0x08, 0x00, 0x10}, |
| 1235 | {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x33, 0x06, 0x10}, |
| 1236 | {0xb1, 0x6e, 0x3d, 0x06, 0x02, 0x00, 0x00, 0x10}, |
| 1237 | {} |
| 1238 | }; |
| 1239 | static const u8 po2030n_sensor_param1[][8] = { |
| 1240 | {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1241 | {DELAY, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1242 | {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10}, |
| 1243 | {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 1244 | {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10}, |
| 1245 | /*param2*/ |
| 1246 | {0xa1, 0x6e, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1247 | {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1248 | {0xa1, 0x6e, 0x05, 0x6f, 0x00, 0x00, 0x00, 0x10}, |
| 1249 | {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 1250 | {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10}, |
| 1251 | {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 1252 | {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10}, |
| 1253 | /*after start*/ |
| 1254 | {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1255 | {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1256 | {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10}, |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1257 | {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1258 | {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10}, |
| 1259 | {} |
| 1260 | }; |
| 1261 | |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 1262 | static const u8 soi768_sensor_init[][8] = { |
| 1263 | {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1264 | {DELAY, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 96ms */ |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 1265 | {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1266 | {0xa1, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1267 | {0xa1, 0x21, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1268 | {0xa1, 0x21, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1269 | {} |
| 1270 | }; |
| 1271 | static const u8 soi768_sensor_param1[][8] = { |
| 1272 | {0xa1, 0x21, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 1273 | {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1274 | {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1275 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1276 | {0xb1, 0x21, 0x01, 0x7f, 0x7f, 0x00, 0x00, 0x10}, |
| 1277 | /* */ |
| 1278 | /* {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, */ |
| 1279 | /* {0xa1, 0x21, 0x2d, 0x25, 0x00, 0x00, 0x00, 0x10}, */ |
| 1280 | {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1281 | /* {0xb1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, */ |
| 1282 | {0xa1, 0x21, 0x02, 0x8d, 0x00, 0x00, 0x00, 0x10}, |
| 1283 | /* the next sequence should be used for auto gain */ |
| 1284 | {0xa1, 0x21, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10}, |
| 1285 | /* global gain ? : 07 - change with 0x15 at the end */ |
| 1286 | {0xa1, 0x21, 0x10, 0x3f, 0x00, 0x00, 0x00, 0x10}, /* ???? : 063f */ |
| 1287 | {0xa1, 0x21, 0x04, 0x06, 0x00, 0x00, 0x00, 0x10}, |
| 1288 | {0xb1, 0x21, 0x2d, 0x00, 0x02, 0x00, 0x00, 0x10}, |
| 1289 | /* exposure ? : 0200 - change with 0x1e at the end */ |
| 1290 | {} |
| 1291 | }; |
| 1292 | |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 1293 | static const u8 sp80708_sensor_init[][8] = { |
| 1294 | {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10}, |
| 1295 | {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10}, |
| 1296 | {0xa1, 0x18, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1297 | {0xa1, 0x18, 0x0d, 0xc0, 0x00, 0x00, 0x00, 0x10}, |
| 1298 | {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 1299 | {0xa1, 0x18, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x10}, |
| 1300 | {0xa1, 0x18, 0x10, 0x40, 0x00, 0x00, 0x00, 0x10}, |
| 1301 | {0xa1, 0x18, 0x11, 0x4e, 0x00, 0x00, 0x00, 0x10}, |
| 1302 | {0xa1, 0x18, 0x12, 0x53, 0x00, 0x00, 0x00, 0x10}, |
| 1303 | {0xa1, 0x18, 0x15, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1304 | {0xa1, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10}, |
| 1305 | {0xa1, 0x18, 0x19, 0x18, 0x00, 0x00, 0x00, 0x10}, |
| 1306 | {0xa1, 0x18, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 1307 | {0xa1, 0x18, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 1308 | {0xa1, 0x18, 0x1c, 0x28, 0x00, 0x00, 0x00, 0x10}, |
| 1309 | {0xa1, 0x18, 0x1d, 0x02, 0x00, 0x00, 0x00, 0x10}, |
| 1310 | {0xa1, 0x18, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 1311 | {0xa1, 0x18, 0x26, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 1312 | {0xa1, 0x18, 0x27, 0x1e, 0x00, 0x00, 0x00, 0x10}, |
| 1313 | {0xa1, 0x18, 0x28, 0x5a, 0x00, 0x00, 0x00, 0x10}, |
| 1314 | {0xa1, 0x18, 0x29, 0x28, 0x00, 0x00, 0x00, 0x10}, |
| 1315 | {0xa1, 0x18, 0x2a, 0x78, 0x00, 0x00, 0x00, 0x10}, |
| 1316 | {0xa1, 0x18, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 1317 | {0xa1, 0x18, 0x2c, 0xf7, 0x00, 0x00, 0x00, 0x10}, |
| 1318 | {0xa1, 0x18, 0x2d, 0x2d, 0x00, 0x00, 0x00, 0x10}, |
| 1319 | {0xa1, 0x18, 0x2e, 0xd5, 0x00, 0x00, 0x00, 0x10}, |
| 1320 | {0xa1, 0x18, 0x39, 0x42, 0x00, 0x00, 0x00, 0x10}, |
| 1321 | {0xa1, 0x18, 0x3a, 0x67, 0x00, 0x00, 0x00, 0x10}, |
| 1322 | {0xa1, 0x18, 0x3b, 0x87, 0x00, 0x00, 0x00, 0x10}, |
| 1323 | {0xa1, 0x18, 0x3c, 0xa3, 0x00, 0x00, 0x00, 0x10}, |
| 1324 | {0xa1, 0x18, 0x3d, 0xb0, 0x00, 0x00, 0x00, 0x10}, |
| 1325 | {0xa1, 0x18, 0x3e, 0xbc, 0x00, 0x00, 0x00, 0x10}, |
| 1326 | {0xa1, 0x18, 0x3f, 0xc8, 0x00, 0x00, 0x00, 0x10}, |
| 1327 | {0xa1, 0x18, 0x40, 0xd4, 0x00, 0x00, 0x00, 0x10}, |
| 1328 | {0xa1, 0x18, 0x41, 0xdf, 0x00, 0x00, 0x00, 0x10}, |
| 1329 | {0xa1, 0x18, 0x42, 0xea, 0x00, 0x00, 0x00, 0x10}, |
| 1330 | {0xa1, 0x18, 0x43, 0xf5, 0x00, 0x00, 0x00, 0x10}, |
| 1331 | {0xa1, 0x18, 0x45, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1332 | {0xa1, 0x18, 0x46, 0x60, 0x00, 0x00, 0x00, 0x10}, |
| 1333 | {0xa1, 0x18, 0x47, 0x50, 0x00, 0x00, 0x00, 0x10}, |
| 1334 | {0xa1, 0x18, 0x48, 0x30, 0x00, 0x00, 0x00, 0x10}, |
| 1335 | {0xa1, 0x18, 0x49, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 1336 | {0xa1, 0x18, 0x4d, 0xae, 0x00, 0x00, 0x00, 0x10}, |
| 1337 | {0xa1, 0x18, 0x4e, 0x03, 0x00, 0x00, 0x00, 0x10}, |
| 1338 | {0xa1, 0x18, 0x4f, 0x66, 0x00, 0x00, 0x00, 0x10}, |
| 1339 | {0xa1, 0x18, 0x50, 0x1c, 0x00, 0x00, 0x00, 0x10}, |
| 1340 | {0xa1, 0x18, 0x44, 0x10, 0x00, 0x00, 0x00, 0x10}, |
| 1341 | {0xa1, 0x18, 0x4a, 0x30, 0x00, 0x00, 0x00, 0x10}, |
| 1342 | {0xa1, 0x18, 0x51, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1343 | {0xa1, 0x18, 0x52, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1344 | {0xa1, 0x18, 0x53, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1345 | {0xa1, 0x18, 0x54, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1346 | {0xa1, 0x18, 0x55, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1347 | {0xa1, 0x18, 0x56, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1348 | {0xa1, 0x18, 0x57, 0xe0, 0x00, 0x00, 0x00, 0x10}, |
| 1349 | {0xa1, 0x18, 0x58, 0xc0, 0x00, 0x00, 0x00, 0x10}, |
| 1350 | {0xa1, 0x18, 0x59, 0xab, 0x00, 0x00, 0x00, 0x10}, |
| 1351 | {0xa1, 0x18, 0x5a, 0xa0, 0x00, 0x00, 0x00, 0x10}, |
| 1352 | {0xa1, 0x18, 0x5b, 0x99, 0x00, 0x00, 0x00, 0x10}, |
| 1353 | {0xa1, 0x18, 0x5c, 0x90, 0x00, 0x00, 0x00, 0x10}, |
| 1354 | {0xa1, 0x18, 0x5e, 0x24, 0x00, 0x00, 0x00, 0x10}, |
| 1355 | {0xa1, 0x18, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1356 | {0xa1, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1357 | {0xa1, 0x18, 0x61, 0x73, 0x00, 0x00, 0x00, 0x10}, |
| 1358 | {0xa1, 0x18, 0x63, 0x42, 0x00, 0x00, 0x00, 0x10}, |
| 1359 | {0xa1, 0x18, 0x64, 0x42, 0x00, 0x00, 0x00, 0x10}, |
| 1360 | {0xa1, 0x18, 0x65, 0x42, 0x00, 0x00, 0x00, 0x10}, |
| 1361 | {0xa1, 0x18, 0x66, 0x24, 0x00, 0x00, 0x00, 0x10}, |
| 1362 | {0xa1, 0x18, 0x67, 0x24, 0x00, 0x00, 0x00, 0x10}, |
| 1363 | {0xa1, 0x18, 0x68, 0x08, 0x00, 0x00, 0x00, 0x10}, |
| 1364 | {0xa1, 0x18, 0x2f, 0xc9, 0x00, 0x00, 0x00, 0x10}, |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 1365 | {} |
| 1366 | }; |
| 1367 | static const u8 sp80708_sensor_param1[][8] = { |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 1368 | {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 1369 | {0xa1, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x10}, |
| 1370 | {0xa1, 0x18, 0x03, 0x01, 0x00, 0x00, 0x00, 0x10}, |
| 1371 | {0xa1, 0x18, 0x04, 0xa4, 0x00, 0x00, 0x00, 0x10}, |
| 1372 | {0xa1, 0x18, 0x14, 0x3f, 0x00, 0x00, 0x00, 0x10}, |
| 1373 | {0xa1, 0x18, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10}, |
| 1374 | {0xb1, 0x18, 0x11, 0x40, 0x40, 0x00, 0x00, 0x10}, |
| 1375 | {} |
| 1376 | }; |
| 1377 | |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 1378 | static const u8 (*sensor_init[])[8] = { |
| 1379 | [SENSOR_ADCM1700] = adcm1700_sensor_init, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1380 | [SENSOR_GC0307] = gc0307_sensor_init, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 1381 | [SENSOR_HV7131R] = hv7131r_sensor_init, |
| 1382 | [SENSOR_MI0360] = mi0360_sensor_init, |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 1383 | [SENSOR_MI0360B] = mi0360b_sensor_init, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 1384 | [SENSOR_MO4000] = mo4000_sensor_init, |
| 1385 | [SENSOR_MT9V111] = mt9v111_sensor_init, |
| 1386 | [SENSOR_OM6802] = om6802_sensor_init, |
| 1387 | [SENSOR_OV7630] = ov7630_sensor_init, |
| 1388 | [SENSOR_OV7648] = ov7648_sensor_init, |
| 1389 | [SENSOR_OV7660] = ov7660_sensor_init, |
| 1390 | [SENSOR_PO1030] = po1030_sensor_init, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1391 | [SENSOR_PO2030N] = po2030n_sensor_init, |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 1392 | [SENSOR_SOI768] = soi768_sensor_init, |
Jean-François Moine | 9c33afc | 2010-03-17 15:25:32 -0300 | [diff] [blame] | 1393 | [SENSOR_SP80708] = sp80708_sensor_init, |
Jean-Francois Moine | 23a9827 | 2009-11-02 09:10:25 -0300 | [diff] [blame] | 1394 | }; |
| 1395 | |
Jean-Francois Moine | 8295d99 | 2008-09-03 17:12:19 -0300 | [diff] [blame] | 1396 | /* read <len> bytes to gspca_dev->usb_buf */ |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1397 | static void reg_r(struct gspca_dev *gspca_dev, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1398 | u16 value, int len) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1399 | { |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1400 | int ret; |
| 1401 | |
| 1402 | if (gspca_dev->usb_err < 0) |
| 1403 | return; |
Jean-Francois Moine | 8295d99 | 2008-09-03 17:12:19 -0300 | [diff] [blame] | 1404 | #ifdef GSPCA_DEBUG |
| 1405 | if (len > USB_BUF_SZ) { |
| 1406 | err("reg_r: buffer overflow"); |
| 1407 | return; |
| 1408 | } |
| 1409 | #endif |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1410 | ret = usb_control_msg(gspca_dev->dev, |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1411 | usb_rcvctrlpipe(gspca_dev->dev, 0), |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1412 | 0, |
| 1413 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 1414 | value, 0, |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1415 | gspca_dev->usb_buf, len, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1416 | 500); |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1417 | PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1418 | if (ret < 0) { |
| 1419 | err("reg_r err %d", ret); |
| 1420 | gspca_dev->usb_err = ret; |
| 1421 | } |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1422 | } |
| 1423 | |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1424 | static void reg_w1(struct gspca_dev *gspca_dev, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1425 | u16 value, |
| 1426 | u8 data) |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1427 | { |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1428 | int ret; |
| 1429 | |
| 1430 | if (gspca_dev->usb_err < 0) |
| 1431 | return; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1432 | PDEBUG(D_USBO, "reg_w1 [%04x] = %02x", value, data); |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1433 | gspca_dev->usb_buf[0] = data; |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1434 | ret = usb_control_msg(gspca_dev->dev, |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1435 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 1436 | 0x08, |
| 1437 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 1438 | value, |
| 1439 | 0, |
| 1440 | gspca_dev->usb_buf, 1, |
| 1441 | 500); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1442 | if (ret < 0) { |
| 1443 | err("reg_w1 err %d", ret); |
| 1444 | gspca_dev->usb_err = ret; |
| 1445 | } |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1446 | } |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1447 | static void reg_w(struct gspca_dev *gspca_dev, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1448 | u16 value, |
| 1449 | const u8 *buffer, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1450 | int len) |
| 1451 | { |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1452 | int ret; |
| 1453 | |
| 1454 | if (gspca_dev->usb_err < 0) |
| 1455 | return; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1456 | PDEBUG(D_USBO, "reg_w [%04x] = %02x %02x ..", |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1457 | value, buffer[0], buffer[1]); |
Jean-Francois Moine | 8295d99 | 2008-09-03 17:12:19 -0300 | [diff] [blame] | 1458 | #ifdef GSPCA_DEBUG |
| 1459 | if (len > USB_BUF_SZ) { |
| 1460 | err("reg_w: buffer overflow"); |
| 1461 | return; |
Jean-Francois Moine | bf7f0b9 | 2008-07-03 11:09:12 -0300 | [diff] [blame] | 1462 | } |
Jean-Francois Moine | 8295d99 | 2008-09-03 17:12:19 -0300 | [diff] [blame] | 1463 | #endif |
| 1464 | memcpy(gspca_dev->usb_buf, buffer, len); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1465 | ret = usb_control_msg(gspca_dev->dev, |
Jean-Francois Moine | 8295d99 | 2008-09-03 17:12:19 -0300 | [diff] [blame] | 1466 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 1467 | 0x08, |
| 1468 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 1469 | value, 0, |
| 1470 | gspca_dev->usb_buf, len, |
| 1471 | 500); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1472 | if (ret < 0) { |
| 1473 | err("reg_w err %d", ret); |
| 1474 | gspca_dev->usb_err = ret; |
| 1475 | } |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1476 | } |
| 1477 | |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1478 | /* I2C write 1 byte */ |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1479 | static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1480 | { |
| 1481 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1482 | int ret; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1483 | |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1484 | if (gspca_dev->usb_err < 0) |
| 1485 | return; |
Jean-François Moine | cfd23c8 | 2010-04-25 14:27:39 -0300 | [diff] [blame] | 1486 | PDEBUG(D_USBO, "i2c_w1 [%02x] = %02x", reg, val); |
Jean-Francois Moine | a782636 | 2009-11-02 09:21:06 -0300 | [diff] [blame] | 1487 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 1488 | case SENSOR_ADCM1700: |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1489 | case SENSOR_OM6802: |
| 1490 | case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */ |
Jean-Francois Moine | a782636 | 2009-11-02 09:21:06 -0300 | [diff] [blame] | 1491 | gspca_dev->usb_buf[0] = 0x80 | (2 << 4); |
| 1492 | break; |
| 1493 | default: /* i2c command = a1 (400 kHz) */ |
| 1494 | gspca_dev->usb_buf[0] = 0x81 | (2 << 4); |
| 1495 | break; |
| 1496 | } |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1497 | gspca_dev->usb_buf[1] = sd->i2c_addr; |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1498 | gspca_dev->usb_buf[2] = reg; |
| 1499 | gspca_dev->usb_buf[3] = val; |
| 1500 | gspca_dev->usb_buf[4] = 0; |
| 1501 | gspca_dev->usb_buf[5] = 0; |
| 1502 | gspca_dev->usb_buf[6] = 0; |
| 1503 | gspca_dev->usb_buf[7] = 0x10; |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1504 | ret = usb_control_msg(gspca_dev->dev, |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1505 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 1506 | 0x08, |
| 1507 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 1508 | 0x08, /* value = i2c */ |
| 1509 | 0, |
| 1510 | gspca_dev->usb_buf, 8, |
| 1511 | 500); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1512 | if (ret < 0) { |
| 1513 | err("i2c_w1 err %d", ret); |
| 1514 | gspca_dev->usb_err = ret; |
| 1515 | } |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1516 | } |
| 1517 | |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1518 | /* I2C write 8 bytes */ |
| 1519 | static void i2c_w8(struct gspca_dev *gspca_dev, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1520 | const u8 *buffer) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1521 | { |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1522 | int ret; |
| 1523 | |
| 1524 | if (gspca_dev->usb_err < 0) |
| 1525 | return; |
Jean-François Moine | cfd23c8 | 2010-04-25 14:27:39 -0300 | [diff] [blame] | 1526 | PDEBUG(D_USBO, "i2c_w8 [%02x] = %02x ..", |
| 1527 | buffer[2], buffer[3]); |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1528 | memcpy(gspca_dev->usb_buf, buffer, 8); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1529 | ret = usb_control_msg(gspca_dev->dev, |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1530 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 1531 | 0x08, |
| 1532 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 1533 | 0x08, 0, /* value, index */ |
| 1534 | gspca_dev->usb_buf, 8, |
| 1535 | 500); |
Jean-Francois Moine | 8d768e1 | 2008-09-21 03:28:55 -0300 | [diff] [blame] | 1536 | msleep(2); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1537 | if (ret < 0) { |
| 1538 | err("i2c_w8 err %d", ret); |
| 1539 | gspca_dev->usb_err = ret; |
| 1540 | } |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1541 | } |
| 1542 | |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1543 | /* sensor read 'len' (1..5) bytes in gspca_dev->usb_buf */ |
| 1544 | static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1545 | { |
| 1546 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1547 | u8 mode[8]; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1548 | |
Jean-Francois Moine | a782636 | 2009-11-02 09:21:06 -0300 | [diff] [blame] | 1549 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 1550 | case SENSOR_ADCM1700: |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1551 | case SENSOR_OM6802: |
| 1552 | case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */ |
Jean-Francois Moine | a782636 | 2009-11-02 09:21:06 -0300 | [diff] [blame] | 1553 | mode[0] = 0x80 | 0x10; |
| 1554 | break; |
| 1555 | default: /* i2c command = 91 (400 kHz) */ |
| 1556 | mode[0] = 0x81 | 0x10; |
| 1557 | break; |
| 1558 | } |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1559 | mode[1] = sd->i2c_addr; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1560 | mode[2] = reg; |
| 1561 | mode[3] = 0; |
| 1562 | mode[4] = 0; |
| 1563 | mode[5] = 0; |
| 1564 | mode[6] = 0; |
| 1565 | mode[7] = 0x10; |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1566 | i2c_w8(gspca_dev, mode); |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1567 | msleep(2); |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1568 | mode[0] = (mode[0] & 0x81) | (len << 4) | 0x02; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1569 | mode[2] = 0; |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1570 | i2c_w8(gspca_dev, mode); |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1571 | msleep(2); |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1572 | reg_r(gspca_dev, 0x0a, 5); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1573 | } |
| 1574 | |
Jean-Francois Moine | 23a9827 | 2009-11-02 09:10:25 -0300 | [diff] [blame] | 1575 | static void i2c_w_seq(struct gspca_dev *gspca_dev, |
| 1576 | const u8 (*data)[8]) |
| 1577 | { |
| 1578 | while ((*data)[0] != 0) { |
Németh Márton | ccbc5df | 2010-10-18 07:00:48 -0300 | [diff] [blame] | 1579 | if ((*data)[0] != DELAY) |
Jean-Francois Moine | 23a9827 | 2009-11-02 09:10:25 -0300 | [diff] [blame] | 1580 | i2c_w8(gspca_dev, *data); |
| 1581 | else |
| 1582 | msleep((*data)[1]); |
| 1583 | data++; |
| 1584 | } |
| 1585 | } |
| 1586 | |
Jean-François Moine | a79cc7b | 2010-10-29 08:10:37 -0300 | [diff] [blame] | 1587 | /* check the ID of the hv7131 sensor */ |
| 1588 | /* this sequence is needed because it activates the sensor */ |
Jean-Francois Moine | 7fb101a | 2009-10-22 06:27:14 -0300 | [diff] [blame] | 1589 | static void hv7131r_probe(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1590 | { |
Jean-François Moine | a79cc7b | 2010-10-29 08:10:37 -0300 | [diff] [blame] | 1591 | i2c_w1(gspca_dev, 0x02, 0); /* sensor wakeup */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1592 | msleep(10); |
Jean-François Moine | a79cc7b | 2010-10-29 08:10:37 -0300 | [diff] [blame] | 1593 | reg_w1(gspca_dev, 0x02, 0x66); /* Gpio on */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1594 | msleep(10); |
Jean-François Moine | a79cc7b | 2010-10-29 08:10:37 -0300 | [diff] [blame] | 1595 | i2c_r(gspca_dev, 0, 5); /* read sensor id */ |
| 1596 | if (gspca_dev->usb_buf[0] == 0x02 /* chip ID (02 is R) */ |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1597 | && gspca_dev->usb_buf[1] == 0x09 |
Jean-François Moine | a79cc7b | 2010-10-29 08:10:37 -0300 | [diff] [blame] | 1598 | && gspca_dev->usb_buf[2] == 0x01) { |
| 1599 | PDEBUG(D_PROBE, "Sensor HV7131R found"); |
Jean-Francois Moine | 7fb101a | 2009-10-22 06:27:14 -0300 | [diff] [blame] | 1600 | return; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1601 | } |
Jean-François Moine | a79cc7b | 2010-10-29 08:10:37 -0300 | [diff] [blame] | 1602 | warn("Erroneous HV7131R ID 0x%02x 0x%02x 0x%02x", |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1603 | gspca_dev->usb_buf[0], gspca_dev->usb_buf[1], |
| 1604 | gspca_dev->usb_buf[2]); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1605 | } |
| 1606 | |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1607 | static void mi0360_probe(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1608 | { |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1609 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1610 | int i, j; |
Jean-Francois Moine | 92e8c91 | 2009-02-02 16:25:38 -0300 | [diff] [blame] | 1611 | u16 val = 0; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1612 | static const u8 probe_tb[][4][8] = { |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1613 | { /* mi0360 */ |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1614 | {0xb0, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, |
| 1615 | {0x90, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1616 | {0xa2, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1617 | {0xb0, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10} |
| 1618 | }, |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1619 | { /* mt9v111 */ |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1620 | {0xb0, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10}, |
| 1621 | {0x90, 0x5c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1622 | {0xa2, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
| 1623 | {} |
| 1624 | }, |
| 1625 | }; |
| 1626 | |
| 1627 | for (i = 0; i < ARRAY_SIZE(probe_tb); i++) { |
| 1628 | reg_w1(gspca_dev, 0x17, 0x62); |
| 1629 | reg_w1(gspca_dev, 0x01, 0x08); |
| 1630 | for (j = 0; j < 3; j++) |
| 1631 | i2c_w8(gspca_dev, probe_tb[i][j]); |
| 1632 | msleep(2); |
| 1633 | reg_r(gspca_dev, 0x0a, 5); |
| 1634 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
| 1635 | if (probe_tb[i][3][0] != 0) |
| 1636 | i2c_w8(gspca_dev, probe_tb[i][3]); |
| 1637 | reg_w1(gspca_dev, 0x01, 0x29); |
| 1638 | reg_w1(gspca_dev, 0x17, 0x42); |
| 1639 | if (val != 0xffff) |
| 1640 | break; |
| 1641 | } |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1642 | if (gspca_dev->usb_err < 0) |
| 1643 | return; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1644 | switch (val) { |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 1645 | case 0x8221: |
| 1646 | PDEBUG(D_PROBE, "Sensor mi0360b"); |
| 1647 | sd->sensor = SENSOR_MI0360B; |
| 1648 | break; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1649 | case 0x823a: |
| 1650 | PDEBUG(D_PROBE, "Sensor mt9v111"); |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1651 | sd->sensor = SENSOR_MT9V111; |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1652 | break; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1653 | case 0x8243: |
| 1654 | PDEBUG(D_PROBE, "Sensor mi0360"); |
Jean-Francois Moine | 65c5259 | 2009-02-01 14:26:51 -0300 | [diff] [blame] | 1655 | break; |
| 1656 | default: |
| 1657 | PDEBUG(D_PROBE, "Unknown sensor %04x - forced to mi0360", val); |
| 1658 | break; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1659 | } |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1660 | } |
| 1661 | |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 1662 | static void ov7630_probe(struct gspca_dev *gspca_dev) |
| 1663 | { |
| 1664 | struct sd *sd = (struct sd *) gspca_dev; |
| 1665 | u16 val; |
| 1666 | |
| 1667 | /* check ov76xx */ |
| 1668 | reg_w1(gspca_dev, 0x17, 0x62); |
| 1669 | reg_w1(gspca_dev, 0x01, 0x08); |
| 1670 | sd->i2c_addr = 0x21; |
| 1671 | i2c_r(gspca_dev, 0x0a, 2); |
| 1672 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
| 1673 | reg_w1(gspca_dev, 0x01, 0x29); |
| 1674 | reg_w1(gspca_dev, 0x17, 0x42); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1675 | if (gspca_dev->usb_err < 0) |
| 1676 | return; |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 1677 | if (val == 0x7628) { /* soi768 */ |
| 1678 | sd->sensor = SENSOR_SOI768; |
| 1679 | /*fixme: only valid for 0c45:613e?*/ |
| 1680 | gspca_dev->cam.input_flags = |
| 1681 | V4L2_IN_ST_VFLIP | V4L2_IN_ST_HFLIP; |
| 1682 | PDEBUG(D_PROBE, "Sensor soi768"); |
| 1683 | return; |
| 1684 | } |
| 1685 | PDEBUG(D_PROBE, "Sensor ov%04x", val); |
| 1686 | } |
| 1687 | |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1688 | static void ov7648_probe(struct gspca_dev *gspca_dev) |
| 1689 | { |
| 1690 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1691 | u16 val; |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1692 | |
| 1693 | /* check ov76xx */ |
| 1694 | reg_w1(gspca_dev, 0x17, 0x62); |
| 1695 | reg_w1(gspca_dev, 0x01, 0x08); |
| 1696 | sd->i2c_addr = 0x21; |
| 1697 | i2c_r(gspca_dev, 0x0a, 2); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1698 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1699 | reg_w1(gspca_dev, 0x01, 0x29); |
| 1700 | reg_w1(gspca_dev, 0x17, 0x42); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1701 | if ((val & 0xff00) == 0x7600) { /* ov76xx */ |
| 1702 | PDEBUG(D_PROBE, "Sensor ov%04x", val); |
| 1703 | return; |
| 1704 | } |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1705 | |
| 1706 | /* check po1030 */ |
| 1707 | reg_w1(gspca_dev, 0x17, 0x62); |
| 1708 | reg_w1(gspca_dev, 0x01, 0x08); |
| 1709 | sd->i2c_addr = 0x6e; |
| 1710 | i2c_r(gspca_dev, 0x00, 2); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1711 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
| 1712 | reg_w1(gspca_dev, 0x01, 0x29); |
| 1713 | reg_w1(gspca_dev, 0x17, 0x42); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1714 | if (gspca_dev->usb_err < 0) |
| 1715 | return; |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1716 | if (val == 0x1030) { /* po1030 */ |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1717 | PDEBUG(D_PROBE, "Sensor po1030"); |
| 1718 | sd->sensor = SENSOR_PO1030; |
| 1719 | return; |
| 1720 | } |
Jean-François Moine | 0b65632 | 2010-09-13 05:19:58 -0300 | [diff] [blame] | 1721 | err("Unknown sensor %04x", val); |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1722 | } |
| 1723 | |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1724 | /* 0c45:6142 sensor may be po2030n, gc0305 or gc0307 */ |
| 1725 | static void po2030n_probe(struct gspca_dev *gspca_dev) |
| 1726 | { |
| 1727 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1728 | u16 val; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1729 | |
| 1730 | /* check gc0307 */ |
| 1731 | reg_w1(gspca_dev, 0x17, 0x62); |
| 1732 | reg_w1(gspca_dev, 0x01, 0x08); |
| 1733 | reg_w1(gspca_dev, 0x02, 0x22); |
| 1734 | sd->i2c_addr = 0x21; |
| 1735 | i2c_r(gspca_dev, 0x00, 1); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1736 | val = gspca_dev->usb_buf[4]; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1737 | reg_w1(gspca_dev, 0x01, 0x29); /* reset */ |
| 1738 | reg_w1(gspca_dev, 0x17, 0x42); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1739 | if (val == 0x99) { /* gc0307 (?) */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1740 | PDEBUG(D_PROBE, "Sensor gc0307"); |
| 1741 | sd->sensor = SENSOR_GC0307; |
| 1742 | return; |
| 1743 | } |
| 1744 | |
| 1745 | /* check po2030n */ |
| 1746 | reg_w1(gspca_dev, 0x17, 0x62); |
| 1747 | reg_w1(gspca_dev, 0x01, 0x0a); |
| 1748 | sd->i2c_addr = 0x6e; |
| 1749 | i2c_r(gspca_dev, 0x00, 2); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1750 | val = (gspca_dev->usb_buf[3] << 8) | gspca_dev->usb_buf[4]; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1751 | reg_w1(gspca_dev, 0x01, 0x29); |
| 1752 | reg_w1(gspca_dev, 0x17, 0x42); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1753 | if (gspca_dev->usb_err < 0) |
| 1754 | return; |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1755 | if (val == 0x2030) { |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1756 | PDEBUG(D_PROBE, "Sensor po2030n"); |
| 1757 | /* sd->sensor = SENSOR_PO2030N; */ |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1758 | } else { |
Jean-François Moine | 0b65632 | 2010-09-13 05:19:58 -0300 | [diff] [blame] | 1759 | err("Unknown sensor ID %04x", val); |
Jean-François Moine | e3302ca | 2010-04-25 14:41:51 -0300 | [diff] [blame] | 1760 | } |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 1761 | } |
| 1762 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1763 | /* this function is called at probe time */ |
| 1764 | static int sd_config(struct gspca_dev *gspca_dev, |
| 1765 | const struct usb_device_id *id) |
| 1766 | { |
| 1767 | struct sd *sd = (struct sd *) gspca_dev; |
| 1768 | struct cam *cam; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1769 | |
Jean-Francois Moine | eac8f5f | 2010-01-12 07:12:43 -0300 | [diff] [blame] | 1770 | sd->bridge = id->driver_info >> 16; |
Jean-Francois Moine | c6c1433 | 2010-12-14 16:15:37 -0300 | [diff] [blame] | 1771 | sd->sensor = id->driver_info >> 8; |
| 1772 | sd->flags = id->driver_info; |
Jean-Francois Moine | eac8f5f | 2010-01-12 07:12:43 -0300 | [diff] [blame] | 1773 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1774 | cam = &gspca_dev->cam; |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 1775 | if (sd->sensor == SENSOR_ADCM1700) { |
| 1776 | cam->cam_mode = cif_mode; |
| 1777 | cam->nmodes = ARRAY_SIZE(cif_mode); |
| 1778 | } else { |
| 1779 | cam->cam_mode = vga_mode; |
| 1780 | cam->nmodes = ARRAY_SIZE(vga_mode); |
| 1781 | } |
Jean-Francois Moine | 49cb6b0 | 2009-04-25 13:29:01 -0300 | [diff] [blame] | 1782 | cam->npkt = 24; /* 24 packets per ISOC message */ |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 1783 | cam->ctrls = sd->ctrls; |
Jean-Francois Moine | a5ae206 | 2008-07-04 11:16:16 -0300 | [diff] [blame] | 1784 | |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 1785 | sd->ag_cnt = -1; |
Jean-Francois Moine | 77ac0ba | 2009-03-02 06:40:52 -0300 | [diff] [blame] | 1786 | sd->quality = QUALITY_DEF; |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 1787 | sd->jpegqual = 80; |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 1788 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1789 | return 0; |
| 1790 | } |
| 1791 | |
Jean-Francois Moine | 012d6b0 | 2008-09-03 17:12:16 -0300 | [diff] [blame] | 1792 | /* this function is called at probe and resume time */ |
| 1793 | static int sd_init(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1794 | { |
| 1795 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1796 | const u8 *sn9c1xx; |
Jean-François Moine | 19697b5 | 2010-07-14 06:33:51 -0300 | [diff] [blame] | 1797 | u8 regGpio[] = { 0x29, 0x74 }; /* with audio */ |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1798 | u8 regF1; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1799 | |
Hans de Goede | 3647fea | 2008-07-15 05:36:30 -0300 | [diff] [blame] | 1800 | /* setup a selector by bridge */ |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1801 | reg_w1(gspca_dev, 0xf1, 0x01); |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1802 | reg_r(gspca_dev, 0x00, 1); |
Jean-Francois Moine | 4f67f3a | 2010-12-14 16:15:00 -0300 | [diff] [blame] | 1803 | reg_w1(gspca_dev, 0xf1, 0x00); |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 1804 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1805 | regF1 = gspca_dev->usb_buf[0]; |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1806 | if (gspca_dev->usb_err < 0) |
| 1807 | return gspca_dev->usb_err; |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 1808 | PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); |
Hans de Goede | 3647fea | 2008-07-15 05:36:30 -0300 | [diff] [blame] | 1809 | switch (sd->bridge) { |
| 1810 | case BRIDGE_SN9C102P: |
Hans de Goede | 3647fea | 2008-07-15 05:36:30 -0300 | [diff] [blame] | 1811 | case BRIDGE_SN9C105: |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1812 | if (regF1 != 0x11) |
| 1813 | return -ENODEV; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1814 | break; |
| 1815 | default: |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1816 | /* case BRIDGE_SN9C110: */ |
Hans de Goede | e530a5e | 2011-01-06 15:23:55 -0300 | [diff] [blame] | 1817 | /* case BRIDGE_SN9C120: */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1818 | if (regF1 != 0x12) |
| 1819 | return -ENODEV; |
Hans de Goede | e530a5e | 2011-01-06 15:23:55 -0300 | [diff] [blame] | 1820 | } |
| 1821 | |
| 1822 | switch (sd->sensor) { |
| 1823 | case SENSOR_MI0360: |
| 1824 | mi0360_probe(gspca_dev); |
| 1825 | break; |
| 1826 | case SENSOR_OV7630: |
| 1827 | ov7630_probe(gspca_dev); |
| 1828 | break; |
| 1829 | case SENSOR_OV7648: |
| 1830 | ov7648_probe(gspca_dev); |
| 1831 | break; |
| 1832 | case SENSOR_PO2030N: |
| 1833 | po2030n_probe(gspca_dev); |
| 1834 | break; |
| 1835 | } |
| 1836 | |
| 1837 | switch (sd->bridge) { |
| 1838 | case BRIDGE_SN9C102P: |
| 1839 | reg_w1(gspca_dev, 0x02, regGpio[1]); |
| 1840 | break; |
| 1841 | case BRIDGE_SN9C105: |
| 1842 | reg_w(gspca_dev, 0x01, regGpio, 2); |
| 1843 | break; |
| 1844 | case BRIDGE_SN9C110: |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 1845 | reg_w1(gspca_dev, 0x02, 0x62); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1846 | break; |
Hans de Goede | e530a5e | 2011-01-06 15:23:55 -0300 | [diff] [blame] | 1847 | case BRIDGE_SN9C120: |
| 1848 | regGpio[1] = 0x70; /* no audio */ |
| 1849 | reg_w(gspca_dev, 0x01, regGpio, 2); |
| 1850 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1851 | } |
| 1852 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 1853 | if (sd->sensor == SENSOR_OM6802) |
| 1854 | sd->ctrls[SHARPNESS].def = 0x10; |
| 1855 | |
Hans de Goede | 9712a8b | 2010-01-31 12:54:29 -0300 | [diff] [blame] | 1856 | /* Note we do not disable the sensor clock here (power saving mode), |
| 1857 | as that also disables the button on the cam. */ |
| 1858 | reg_w1(gspca_dev, 0xf1, 0x00); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1859 | |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1860 | /* set the i2c address */ |
| 1861 | sn9c1xx = sn_tb[sd->sensor]; |
| 1862 | sd->i2c_addr = sn9c1xx[9]; |
| 1863 | |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1864 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 1865 | if (!(sd->flags & F_ILLUM)) |
| 1866 | gspca_dev->ctrl_dis |= (1 << ILLUM); |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 1867 | |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 1868 | return gspca_dev->usb_err; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1869 | } |
| 1870 | |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1871 | static u32 setexposure(struct gspca_dev *gspca_dev, |
| 1872 | u32 expo) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1873 | { |
| 1874 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1875 | |
| 1876 | switch (sd->sensor) { |
Jean-François Moine | c26b12d | 2010-04-02 07:08:39 -0300 | [diff] [blame] | 1877 | case SENSOR_GC0307: { |
| 1878 | int a, b; |
| 1879 | |
| 1880 | /* expo = 0..255 -> a = 19..43 */ |
| 1881 | a = 19 + expo * 25 / 256; |
| 1882 | i2c_w1(gspca_dev, 0x68, a); |
| 1883 | a -= 12; |
| 1884 | b = a * a * 4; /* heuristic */ |
| 1885 | i2c_w1(gspca_dev, 0x03, b >> 8); |
| 1886 | i2c_w1(gspca_dev, 0x04, b); |
| 1887 | break; |
| 1888 | } |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1889 | case SENSOR_HV7131R: { |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1890 | u8 Expodoit[] = |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1891 | { 0xc1, 0x11, 0x25, 0x00, 0x00, 0x00, 0x00, 0x16 }; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1892 | |
| 1893 | Expodoit[3] = expo >> 16; |
| 1894 | Expodoit[4] = expo >> 8; |
| 1895 | Expodoit[5] = expo; |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1896 | i2c_w8(gspca_dev, Expodoit); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1897 | break; |
| 1898 | } |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 1899 | case SENSOR_MI0360: |
| 1900 | case SENSOR_MI0360B: { |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1901 | u8 expoMi[] = /* exposure 0x0635 -> 4 fp/s 0x10 */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1902 | { 0xb1, 0x5d, 0x09, 0x00, 0x00, 0x00, 0x00, 0x16 }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1903 | static const u8 doit[] = /* update sensor */ |
| 1904 | { 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 }; |
| 1905 | static const u8 sensorgo[] = /* sensor on */ |
| 1906 | { 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1907 | |
| 1908 | if (expo > 0x0635) |
| 1909 | expo = 0x0635; |
| 1910 | else if (expo < 0x0001) |
| 1911 | expo = 0x0001; |
| 1912 | expoMi[3] = expo >> 8; |
| 1913 | expoMi[4] = expo; |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1914 | i2c_w8(gspca_dev, expoMi); |
| 1915 | i2c_w8(gspca_dev, doit); |
| 1916 | i2c_w8(gspca_dev, sensorgo); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1917 | break; |
| 1918 | } |
| 1919 | case SENSOR_MO4000: { |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1920 | u8 expoMof[] = |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1921 | { 0xa1, 0x21, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1922 | u8 expoMo10[] = |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1923 | { 0xa1, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1924 | static const u8 gainMo[] = |
| 1925 | { 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d }; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1926 | |
| 1927 | if (expo > 0x1fff) |
| 1928 | expo = 0x1fff; |
| 1929 | else if (expo < 0x0001) |
| 1930 | expo = 0x0001; |
| 1931 | expoMof[3] = (expo & 0x03fc) >> 2; |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1932 | i2c_w8(gspca_dev, expoMof); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1933 | expoMo10[3] = ((expo & 0x1c00) >> 10) |
| 1934 | | ((expo & 0x0003) << 4); |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 1935 | i2c_w8(gspca_dev, expoMo10); |
| 1936 | i2c_w8(gspca_dev, gainMo); |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1937 | PDEBUG(D_FRAM, "set exposure %d", |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1938 | ((expoMo10[3] & 0x07) << 10) |
| 1939 | | (expoMof[3] << 2) |
| 1940 | | ((expoMo10[3] & 0x30) >> 4)); |
| 1941 | break; |
| 1942 | } |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1943 | case SENSOR_MT9V111: { |
| 1944 | u8 expo_c1[] = |
| 1945 | { 0xb1, 0x5c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
| 1946 | |
| 1947 | if (expo > 0x0280) |
| 1948 | expo = 0x0280; |
| 1949 | else if (expo < 0x0040) |
| 1950 | expo = 0x0040; |
| 1951 | expo_c1[3] = expo >> 8; |
| 1952 | expo_c1[4] = expo; |
| 1953 | i2c_w8(gspca_dev, expo_c1); |
| 1954 | break; |
| 1955 | } |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 1956 | case SENSOR_OM6802: { |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1957 | u8 gainOm[] = |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 1958 | { 0xa0, 0x34, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1959 | /* preset AGC - works when AutoExpo = off */ |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 1960 | |
| 1961 | if (expo > 0x03ff) |
| 1962 | expo = 0x03ff; |
| 1963 | if (expo < 0x0001) |
| 1964 | expo = 0x0001; |
| 1965 | gainOm[3] = expo >> 2; |
| 1966 | i2c_w8(gspca_dev, gainOm); |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 1967 | reg_w1(gspca_dev, 0x96, expo >> 5); |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 1968 | PDEBUG(D_FRAM, "set exposure %d", gainOm[3]); |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 1969 | break; |
| 1970 | } |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1971 | } |
| 1972 | return expo; |
| 1973 | } |
| 1974 | |
| 1975 | static void setbrightness(struct gspca_dev *gspca_dev) |
| 1976 | { |
| 1977 | struct sd *sd = (struct sd *) gspca_dev; |
| 1978 | unsigned int expo; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 1979 | int brightness; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 1980 | u8 k2; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1981 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 1982 | brightness = sd->ctrls[BRIGHTNESS].val; |
| 1983 | k2 = (brightness - 0x80) >> 2; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1984 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 1985 | case SENSOR_ADCM1700: |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 1986 | if (k2 > 0x1f) |
| 1987 | k2 = 0; /* only positive Y offset */ |
| 1988 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1989 | case SENSOR_HV7131R: |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 1990 | expo = brightness << 12; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1991 | if (expo > 0x002dc6c0) |
| 1992 | expo = 0x002dc6c0; |
| 1993 | else if (expo < 0x02a0) |
| 1994 | expo = 0x02a0; |
| 1995 | sd->exposure = setexposure(gspca_dev, expo); |
| 1996 | break; |
| 1997 | case SENSOR_MI0360: |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 1998 | case SENSOR_MO4000: |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 1999 | expo = brightness << 4; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2000 | sd->exposure = setexposure(gspca_dev, expo); |
| 2001 | break; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2002 | case SENSOR_MI0360B: |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2003 | expo = brightness << 2; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2004 | sd->exposure = setexposure(gspca_dev, expo); |
| 2005 | break; |
Jean-François Moine | c26b12d | 2010-04-02 07:08:39 -0300 | [diff] [blame] | 2006 | case SENSOR_GC0307: |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 2007 | case SENSOR_MT9V111: |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2008 | expo = brightness; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 2009 | sd->exposure = setexposure(gspca_dev, expo); |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2010 | return; /* don't set the Y offset */ |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 2011 | case SENSOR_OM6802: |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2012 | expo = brightness << 2; |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 2013 | sd->exposure = setexposure(gspca_dev, expo); |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2014 | k2 = brightness >> 3; |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 2015 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2016 | } |
| 2017 | |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2018 | reg_w1(gspca_dev, 0x96, k2); /* color matrix Y offset */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2019 | } |
| 2020 | |
| 2021 | static void setcontrast(struct gspca_dev *gspca_dev) |
| 2022 | { |
| 2023 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2024 | u8 k2; |
| 2025 | u8 contrast[6]; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2026 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2027 | k2 = sd->ctrls[CONTRAST].val * 0x30 / (CONTRAST_MAX + 1) |
| 2028 | + 0x10; /* 10..40 */ |
Jean-Francois Moine | 91bd341 | 2008-11-23 14:47:50 -0300 | [diff] [blame] | 2029 | contrast[0] = (k2 + 1) / 2; /* red */ |
Jean-Francois Moine | 577cbf4 | 2008-12-05 06:18:37 -0300 | [diff] [blame] | 2030 | contrast[1] = 0; |
Jean-Francois Moine | 91bd341 | 2008-11-23 14:47:50 -0300 | [diff] [blame] | 2031 | contrast[2] = k2; /* green */ |
Jean-Francois Moine | 577cbf4 | 2008-12-05 06:18:37 -0300 | [diff] [blame] | 2032 | contrast[3] = 0; |
Jean-Francois Moine | 91bd341 | 2008-11-23 14:47:50 -0300 | [diff] [blame] | 2033 | contrast[4] = (k2 + 1) / 5; /* blue */ |
Jean-Francois Moine | 577cbf4 | 2008-12-05 06:18:37 -0300 | [diff] [blame] | 2034 | contrast[5] = 0; |
| 2035 | reg_w(gspca_dev, 0x84, contrast, sizeof contrast); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2036 | } |
| 2037 | |
| 2038 | static void setcolors(struct gspca_dev *gspca_dev) |
| 2039 | { |
| 2040 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2041 | int i, v, colors; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2042 | const s16 *uv; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2043 | u8 reg8a[12]; /* U & V gains */ |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2044 | static const s16 uv_com[6] = { /* same as reg84 in signed decimal */ |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 2045 | -24, -38, 64, /* UR UG UB */ |
| 2046 | 62, -51, -9 /* VR VG VB */ |
| 2047 | }; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2048 | static const s16 uv_mi0360b[6] = { |
| 2049 | -20, -38, 64, /* UR UG UB */ |
| 2050 | 60, -51, -9 /* VR VG VB */ |
| 2051 | }; |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2052 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2053 | colors = sd->ctrls[COLORS].val; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2054 | if (sd->sensor == SENSOR_MI0360B) |
| 2055 | uv = uv_mi0360b; |
| 2056 | else |
| 2057 | uv = uv_com; |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 2058 | for (i = 0; i < 6; i++) { |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2059 | v = uv[i] * colors / COLORS_DEF; |
Jean-Francois Moine | bd08883 | 2008-12-02 06:58:57 -0300 | [diff] [blame] | 2060 | reg8a[i * 2] = v; |
| 2061 | reg8a[i * 2 + 1] = (v >> 8) & 0x0f; |
Jean-Francois Moine | d55b83d | 2008-09-03 16:48:01 -0300 | [diff] [blame] | 2062 | } |
Jean-Francois Moine | bd08883 | 2008-12-02 06:58:57 -0300 | [diff] [blame] | 2063 | reg_w(gspca_dev, 0x8a, reg8a, sizeof reg8a); |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 2064 | } |
| 2065 | |
| 2066 | static void setredblue(struct gspca_dev *gspca_dev) |
| 2067 | { |
| 2068 | struct sd *sd = (struct sd *) gspca_dev; |
| 2069 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2070 | reg_w1(gspca_dev, 0x05, sd->ctrls[RED].val); |
Jean-Francois Moine | 9c5f70f | 2008-09-03 16:48:04 -0300 | [diff] [blame] | 2071 | /* reg_w1(gspca_dev, 0x07, 32); */ |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2072 | reg_w1(gspca_dev, 0x06, sd->ctrls[BLUE].val); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2073 | } |
| 2074 | |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 2075 | static void setgamma(struct gspca_dev *gspca_dev) |
| 2076 | { |
| 2077 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2078 | int i, val; |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 2079 | u8 gamma[17]; |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2080 | const u8 *gamma_base; |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 2081 | static const u8 delta[17] = { |
| 2082 | 0x00, 0x14, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1a, |
| 2083 | 0x18, 0x13, 0x10, 0x0e, 0x08, 0x07, 0x04, 0x02, 0x00 |
| 2084 | }; |
| 2085 | |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2086 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2087 | case SENSOR_ADCM1700: |
| 2088 | gamma_base = gamma_spec_0; |
| 2089 | break; |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2090 | case SENSOR_HV7131R: |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2091 | case SENSOR_MI0360B: |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2092 | case SENSOR_MT9V111: |
| 2093 | gamma_base = gamma_spec_1; |
| 2094 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2095 | case SENSOR_GC0307: |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2096 | gamma_base = gamma_spec_2; |
| 2097 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2098 | case SENSOR_SP80708: |
| 2099 | gamma_base = gamma_spec_3; |
| 2100 | break; |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2101 | default: |
| 2102 | gamma_base = gamma_def; |
| 2103 | break; |
| 2104 | } |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 2105 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2106 | val = sd->ctrls[GAMMA].val; |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 2107 | for (i = 0; i < sizeof gamma; i++) |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2108 | gamma[i] = gamma_base[i] |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2109 | + delta[i] * (val - GAMMA_DEF) / 32; |
Jean-Francois Moine | 592f4eb | 2009-01-15 08:01:32 -0300 | [diff] [blame] | 2110 | reg_w(gspca_dev, 0x20, gamma, sizeof gamma); |
| 2111 | } |
| 2112 | |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2113 | static void setautogain(struct gspca_dev *gspca_dev) |
| 2114 | { |
| 2115 | struct sd *sd = (struct sd *) gspca_dev; |
| 2116 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2117 | if (gspca_dev->ctrl_dis & (1 << AUTOGAIN)) |
Jean-Francois Moine | f50ba1b | 2008-09-03 17:12:14 -0300 | [diff] [blame] | 2118 | return; |
Jean-Francois Moine | 2797ba2 | 2009-02-05 15:12:24 -0300 | [diff] [blame] | 2119 | switch (sd->sensor) { |
| 2120 | case SENSOR_OV7630: |
| 2121 | case SENSOR_OV7648: { |
| 2122 | u8 comb; |
| 2123 | |
| 2124 | if (sd->sensor == SENSOR_OV7630) |
| 2125 | comb = 0xc0; |
| 2126 | else |
| 2127 | comb = 0xa0; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2128 | if (sd->ctrls[AUTOGAIN].val) |
Hans de Goede | 1fec747 | 2009-06-18 06:05:07 -0300 | [diff] [blame] | 2129 | comb |= 0x03; |
Jean-Francois Moine | 2797ba2 | 2009-02-05 15:12:24 -0300 | [diff] [blame] | 2130 | i2c_w1(&sd->gspca_dev, 0x13, comb); |
| 2131 | return; |
| 2132 | } |
| 2133 | } |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2134 | if (sd->ctrls[AUTOGAIN].val) |
Jean-Francois Moine | f50ba1b | 2008-09-03 17:12:14 -0300 | [diff] [blame] | 2135 | sd->ag_cnt = AG_CNT_START; |
| 2136 | else |
| 2137 | sd->ag_cnt = -1; |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2138 | } |
| 2139 | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 2140 | static void sethvflip(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 6c86274 | 2008-09-08 04:57:26 -0300 | [diff] [blame] | 2141 | { |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2142 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 2797ba2 | 2009-02-05 15:12:24 -0300 | [diff] [blame] | 2143 | u8 comn; |
| 2144 | |
Jean-François Moine | f6b22e5 | 2010-02-18 04:12:06 -0300 | [diff] [blame] | 2145 | switch (sd->sensor) { |
| 2146 | case SENSOR_HV7131R: |
| 2147 | comn = 0x18; /* clkdiv = 1, ablcen = 1 */ |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2148 | if (sd->ctrls[VFLIP].val) |
Jean-François Moine | f6b22e5 | 2010-02-18 04:12:06 -0300 | [diff] [blame] | 2149 | comn |= 0x01; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2150 | i2c_w1(gspca_dev, 0x01, comn); /* sctra */ |
Jean-François Moine | f6b22e5 | 2010-02-18 04:12:06 -0300 | [diff] [blame] | 2151 | break; |
| 2152 | case SENSOR_OV7630: |
Jean-Francois Moine | 2797ba2 | 2009-02-05 15:12:24 -0300 | [diff] [blame] | 2153 | comn = 0x02; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2154 | if (!sd->ctrls[VFLIP].val) |
Hans de Goede | f800952 | 2009-06-18 14:29:20 -0300 | [diff] [blame] | 2155 | comn |= 0x80; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2156 | i2c_w1(gspca_dev, 0x75, comn); |
Jean-François Moine | f6b22e5 | 2010-02-18 04:12:06 -0300 | [diff] [blame] | 2157 | break; |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 2158 | case SENSOR_OV7648: |
Jean-Francois Moine | 2797ba2 | 2009-02-05 15:12:24 -0300 | [diff] [blame] | 2159 | comn = 0x06; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2160 | if (sd->ctrls[VFLIP].val) |
Hans de Goede | f800952 | 2009-06-18 14:29:20 -0300 | [diff] [blame] | 2161 | comn |= 0x80; |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2162 | i2c_w1(gspca_dev, 0x75, comn); |
Jean-François Moine | f6b22e5 | 2010-02-18 04:12:06 -0300 | [diff] [blame] | 2163 | break; |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 2164 | case SENSOR_PO2030N: |
| 2165 | /* Reg. 0x1E: Timing Generator Control Register 2 (Tgcontrol2) |
| 2166 | * (reset value: 0x0A) |
| 2167 | * bit7: HM: Horizontal Mirror: 0: disable, 1: enable |
| 2168 | * bit6: VM: Vertical Mirror: 0: disable, 1: enable |
| 2169 | * bit5: ST: Shutter Selection: 0: electrical, 1: mechanical |
| 2170 | * bit4: FT: Single Frame Transfer: 0: disable, 1: enable |
| 2171 | * bit3-0: X |
| 2172 | */ |
| 2173 | comn = 0x0a; |
| 2174 | if (sd->ctrls[HFLIP].val) |
| 2175 | comn |= 0x80; |
| 2176 | if (sd->ctrls[VFLIP].val) |
| 2177 | comn |= 0x40; |
| 2178 | i2c_w1(&sd->gspca_dev, 0x1e, comn); |
| 2179 | break; |
Hans de Goede | f800952 | 2009-06-18 14:29:20 -0300 | [diff] [blame] | 2180 | } |
Jean-Francois Moine | 6c86274 | 2008-09-08 04:57:26 -0300 | [diff] [blame] | 2181 | } |
| 2182 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2183 | static void setsharpness(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2184 | { |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2185 | struct sd *sd = (struct sd *) gspca_dev; |
| 2186 | |
| 2187 | reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2188 | } |
| 2189 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 2190 | static void setillum(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 2191 | { |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2192 | struct sd *sd = (struct sd *) gspca_dev; |
| 2193 | |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 2194 | if (gspca_dev->ctrl_dis & (1 << ILLUM)) |
Jean-Francois Moine | 47f7f6f | 2009-08-25 06:14:54 -0300 | [diff] [blame] | 2195 | return; |
Jean-François Moine | a63d601 | 2011-01-13 07:56:00 -0300 | [diff] [blame] | 2196 | switch (sd->sensor) { |
| 2197 | case SENSOR_ADCM1700: |
| 2198 | reg_w1(gspca_dev, 0x02, /* gpio */ |
| 2199 | sd->ctrls[ILLUM].val ? 0x64 : 0x60); |
| 2200 | break; |
| 2201 | case SENSOR_MT9V111: |
| 2202 | if (starcam) |
| 2203 | reg_w1(gspca_dev, 0x02, |
| 2204 | sd->ctrls[ILLUM].val ? |
| 2205 | 0x55 : 0x54); /* 370i */ |
| 2206 | else |
| 2207 | reg_w1(gspca_dev, 0x02, |
| 2208 | sd->ctrls[ILLUM].val ? |
| 2209 | 0x66 : 0x64); /* Clip */ |
| 2210 | break; |
| 2211 | } |
Jean-Francois Moine | 0cae896 | 2008-10-17 07:48:24 -0300 | [diff] [blame] | 2212 | } |
| 2213 | |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2214 | static void setfreq(struct gspca_dev *gspca_dev) |
| 2215 | { |
| 2216 | struct sd *sd = (struct sd *) gspca_dev; |
| 2217 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2218 | if (gspca_dev->ctrl_dis & (1 << FREQ)) |
Jean-Francois Moine | 2795493 | 2009-07-08 05:21:50 -0300 | [diff] [blame] | 2219 | return; |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2220 | if (sd->sensor == SENSOR_OV7660) { |
Jean-Francois Moine | d8f400e | 2009-07-08 06:33:44 -0300 | [diff] [blame] | 2221 | u8 com8; |
| 2222 | |
Jean-Francois Moine | 47f7f6f | 2009-08-25 06:14:54 -0300 | [diff] [blame] | 2223 | com8 = 0xdf; /* auto gain/wb/expo */ |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2224 | switch (sd->ctrls[FREQ].val) { |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2225 | case 0: /* Banding filter disabled */ |
Jean-Francois Moine | 47f7f6f | 2009-08-25 06:14:54 -0300 | [diff] [blame] | 2226 | i2c_w1(gspca_dev, 0x13, com8 | 0x20); |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2227 | break; |
| 2228 | case 1: /* 50 hz */ |
Jean-Francois Moine | d8f400e | 2009-07-08 06:33:44 -0300 | [diff] [blame] | 2229 | i2c_w1(gspca_dev, 0x13, com8); |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2230 | i2c_w1(gspca_dev, 0x3b, 0x0a); |
| 2231 | break; |
| 2232 | case 2: /* 60 hz */ |
Jean-Francois Moine | d8f400e | 2009-07-08 06:33:44 -0300 | [diff] [blame] | 2233 | i2c_w1(gspca_dev, 0x13, com8); |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2234 | i2c_w1(gspca_dev, 0x3b, 0x02); |
| 2235 | break; |
| 2236 | } |
| 2237 | } else { |
| 2238 | u8 reg2a = 0, reg2b = 0, reg2d = 0; |
| 2239 | |
| 2240 | /* Get reg2a / reg2d base values */ |
| 2241 | switch (sd->sensor) { |
| 2242 | case SENSOR_OV7630: |
| 2243 | reg2a = 0x08; |
| 2244 | reg2d = 0x01; |
| 2245 | break; |
| 2246 | case SENSOR_OV7648: |
| 2247 | reg2a = 0x11; |
| 2248 | reg2d = 0x81; |
| 2249 | break; |
| 2250 | } |
| 2251 | |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2252 | switch (sd->ctrls[FREQ].val) { |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2253 | case 0: /* Banding filter disabled */ |
| 2254 | break; |
| 2255 | case 1: /* 50 hz (filter on and framerate adj) */ |
| 2256 | reg2a |= 0x80; |
| 2257 | reg2b = 0xac; |
| 2258 | reg2d |= 0x04; |
| 2259 | break; |
| 2260 | case 2: /* 60 hz (filter on, no framerate adj) */ |
| 2261 | reg2a |= 0x80; |
| 2262 | reg2d |= 0x04; |
| 2263 | break; |
| 2264 | } |
| 2265 | i2c_w1(gspca_dev, 0x2a, reg2a); |
| 2266 | i2c_w1(gspca_dev, 0x2b, reg2b); |
| 2267 | i2c_w1(gspca_dev, 0x2d, reg2d); |
| 2268 | } |
| 2269 | } |
| 2270 | |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 2271 | static void setjpegqual(struct gspca_dev *gspca_dev) |
| 2272 | { |
| 2273 | struct sd *sd = (struct sd *) gspca_dev; |
| 2274 | int i, sc; |
| 2275 | |
| 2276 | if (sd->jpegqual < 50) |
| 2277 | sc = 5000 / sd->jpegqual; |
| 2278 | else |
| 2279 | sc = 200 - sd->jpegqual * 2; |
| 2280 | #if USB_BUF_SZ < 64 |
| 2281 | #error "No room enough in usb_buf for quantization table" |
| 2282 | #endif |
| 2283 | for (i = 0; i < 64; i++) |
| 2284 | gspca_dev->usb_buf[i] = |
| 2285 | (jpeg_head[JPEG_QT0_OFFSET + i] * sc + 50) / 100; |
| 2286 | usb_control_msg(gspca_dev->dev, |
| 2287 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 2288 | 0x08, |
| 2289 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 2290 | 0x0100, 0, |
| 2291 | gspca_dev->usb_buf, 64, |
| 2292 | 500); |
| 2293 | for (i = 0; i < 64; i++) |
| 2294 | gspca_dev->usb_buf[i] = |
| 2295 | (jpeg_head[JPEG_QT1_OFFSET + i] * sc + 50) / 100; |
| 2296 | usb_control_msg(gspca_dev->dev, |
| 2297 | usb_sndctrlpipe(gspca_dev->dev, 0), |
| 2298 | 0x08, |
| 2299 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, |
| 2300 | 0x0140, 0, |
| 2301 | gspca_dev->usb_buf, 64, |
| 2302 | 500); |
| 2303 | |
| 2304 | sd->reg18 ^= 0x40; |
| 2305 | reg_w1(gspca_dev, 0x18, sd->reg18); |
| 2306 | } |
| 2307 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2308 | /* -- start the camera -- */ |
Jean-Francois Moine | 72ab97c | 2008-09-20 06:39:08 -0300 | [diff] [blame] | 2309 | static int sd_start(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2310 | { |
| 2311 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2312 | int i; |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2313 | u8 reg01, reg17; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2314 | u8 reg0102[2]; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2315 | const u8 *sn9c1xx; |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2316 | const u8 (*init)[8]; |
Jean-Francois Moine | 4f67f3a | 2010-12-14 16:15:00 -0300 | [diff] [blame] | 2317 | const u8 *reg9a; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2318 | int mode; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2319 | static const u8 reg9a_def[] = |
| 2320 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; |
| 2321 | static const u8 reg9a_spec[] = |
| 2322 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; |
| 2323 | static const u8 regd4[] = {0x60, 0x00, 0x00}; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2324 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
| 2325 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2326 | static const u8 CA_adcm1700[] = |
| 2327 | { 0x14, 0xec, 0x0a, 0xf6 }; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2328 | static const u8 CA_po2030n[] = |
| 2329 | { 0x1e, 0xe2, 0x14, 0xec }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2330 | static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2331 | static const u8 CE_gc0307[] = |
| 2332 | { 0x32, 0xce, 0x2d, 0xd3 }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2333 | static const u8 CE_ov76xx[] = |
Jean-Francois Moine | 674cbc6 | 2008-10-02 08:06:59 -0300 | [diff] [blame] | 2334 | { 0x32, 0xdd, 0x32, 0xdd }; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2335 | static const u8 CE_po2030n[] = |
| 2336 | { 0x14, 0xe7, 0x1e, 0xdd }; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2337 | |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 2338 | /* create the JPEG header */ |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 2339 | jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, |
| 2340 | 0x21); /* JPEG 422 */ |
| 2341 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); |
| 2342 | |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2343 | /* initialize the bridge */ |
| 2344 | sn9c1xx = sn_tb[sd->sensor]; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2345 | |
| 2346 | /* sensor clock already enabled in sd_init */ |
| 2347 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2348 | reg01 = sn9c1xx[1]; |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 2349 | if (sd->flags & F_PDN_INV) |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2350 | reg01 ^= S_PDN_INV; /* power down inverted */ |
| 2351 | reg_w1(gspca_dev, 0x01, reg01); |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2352 | |
| 2353 | /* configure gpio */ |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2354 | reg0102[0] = reg01; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2355 | reg0102[1] = sn9c1xx[2]; |
| 2356 | if (gspca_dev->audio) |
| 2357 | reg0102[1] |= 0x04; /* keep the audio connection */ |
| 2358 | reg_w(gspca_dev, 0x01, reg0102, 2); |
| 2359 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); |
| 2360 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); |
| 2361 | switch (sd->sensor) { |
| 2362 | case SENSOR_GC0307: |
| 2363 | case SENSOR_OV7660: |
| 2364 | case SENSOR_PO1030: |
| 2365 | case SENSOR_PO2030N: |
| 2366 | case SENSOR_SOI768: |
| 2367 | case SENSOR_SP80708: |
| 2368 | reg9a = reg9a_spec; |
| 2369 | break; |
| 2370 | default: |
| 2371 | reg9a = reg9a_def; |
| 2372 | break; |
| 2373 | } |
| 2374 | reg_w(gspca_dev, 0x9a, reg9a, 6); |
| 2375 | |
| 2376 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); |
| 2377 | |
| 2378 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); |
| 2379 | |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2380 | reg17 = sn9c1xx[0x17]; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2381 | switch (sd->sensor) { |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2382 | case SENSOR_GC0307: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2383 | msleep(50); /*fixme: is it useful? */ |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2384 | break; |
| 2385 | case SENSOR_OM6802: |
| 2386 | msleep(10); |
| 2387 | reg_w1(gspca_dev, 0x02, 0x73); |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2388 | reg17 |= SEN_CLK_EN; |
| 2389 | reg_w1(gspca_dev, 0x17, reg17); |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2390 | reg_w1(gspca_dev, 0x01, 0x22); |
| 2391 | msleep(100); |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2392 | reg01 = SCL_SEL_OD | S_PDN_INV; |
| 2393 | reg17 &= MCK_SIZE_MASK; |
| 2394 | reg17 |= 0x04; /* clock / 4 */ |
| 2395 | break; |
| 2396 | } |
| 2397 | reg01 |= SYS_SEL_48M; |
| 2398 | reg_w1(gspca_dev, 0x01, reg01); |
| 2399 | reg17 |= SEN_CLK_EN; |
| 2400 | reg_w1(gspca_dev, 0x17, reg17); |
| 2401 | reg01 &= ~S_PWR_DN; /* sensor power on */ |
| 2402 | reg_w1(gspca_dev, 0x01, reg01); |
| 2403 | reg01 &= ~SYS_SEL_48M; |
| 2404 | reg_w1(gspca_dev, 0x01, reg01); |
| 2405 | |
| 2406 | switch (sd->sensor) { |
| 2407 | case SENSOR_HV7131R: |
| 2408 | hv7131r_probe(gspca_dev); /*fixme: is it useful? */ |
| 2409 | break; |
| 2410 | case SENSOR_OM6802: |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2411 | msleep(10); |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2412 | reg_w1(gspca_dev, 0x01, reg01); |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2413 | i2c_w8(gspca_dev, om6802_init0[0]); |
| 2414 | i2c_w8(gspca_dev, om6802_init0[1]); |
| 2415 | msleep(15); |
| 2416 | reg_w1(gspca_dev, 0x02, 0x71); |
| 2417 | msleep(150); |
| 2418 | break; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2419 | case SENSOR_SP80708: |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2420 | msleep(100); |
| 2421 | reg_w1(gspca_dev, 0x02, 0x62); |
| 2422 | break; |
Jean-Francois Moine | 5e68f40 | 2010-12-14 16:14:10 -0300 | [diff] [blame] | 2423 | } |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2424 | |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2425 | /* initialize the sensor */ |
| 2426 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); |
| 2427 | |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 2428 | reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); |
| 2429 | reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); |
| 2430 | reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); |
| 2431 | reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]); |
| 2432 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2433 | if (sd->sensor == SENSOR_ADCM1700) { |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2434 | reg_w1(gspca_dev, 0xd2, 0x3a); /* AE_H_SIZE = 116 */ |
| 2435 | reg_w1(gspca_dev, 0xd3, 0x30); /* AE_V_SIZE = 96 */ |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2436 | } else { |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2437 | reg_w1(gspca_dev, 0xd2, 0x6a); /* AE_H_SIZE = 212 */ |
| 2438 | reg_w1(gspca_dev, 0xd3, 0x50); /* AE_V_SIZE = 160 */ |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2439 | } |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 2440 | reg_w1(gspca_dev, 0xc6, 0x00); |
| 2441 | reg_w1(gspca_dev, 0xc7, 0x00); |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2442 | if (sd->sensor == SENSOR_ADCM1700) { |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2443 | reg_w1(gspca_dev, 0xc8, 0x2c); /* AW_H_STOP = 352 */ |
| 2444 | reg_w1(gspca_dev, 0xc9, 0x24); /* AW_V_STOP = 288 */ |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2445 | } else { |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2446 | reg_w1(gspca_dev, 0xc8, 0x50); /* AW_H_STOP = 640 */ |
| 2447 | reg_w1(gspca_dev, 0xc9, 0x3c); /* AW_V_STOP = 480 */ |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2448 | } |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 2449 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 2450 | switch (sd->sensor) { |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2451 | case SENSOR_OM6802: |
| 2452 | /* case SENSOR_OV7648: * fixme: sometimes */ |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 2453 | break; |
Jean-Francois Moine | 568788a | 2008-07-15 11:46:06 -0300 | [diff] [blame] | 2454 | default: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2455 | reg17 |= DEF_EN; |
Jean-Francois Moine | 568788a | 2008-07-15 11:46:06 -0300 | [diff] [blame] | 2456 | break; |
| 2457 | } |
Jean-Francois Moine | 8f47a3c | 2008-07-29 14:14:04 -0300 | [diff] [blame] | 2458 | reg_w1(gspca_dev, 0x17, reg17); |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2459 | |
| 2460 | reg_w1(gspca_dev, 0x05, 0x00); /* red */ |
| 2461 | reg_w1(gspca_dev, 0x07, 0x00); /* green */ |
| 2462 | reg_w1(gspca_dev, 0x06, 0x00); /* blue */ |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 2463 | reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); |
Jean-Francois Moine | b083b92 | 2009-02-01 14:20:07 -0300 | [diff] [blame] | 2464 | |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 2465 | setgamma(gspca_dev); |
| 2466 | |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2467 | /*fixme: 8 times with all zeroes and 1 or 2 times with normal values */ |
Jean-Francois Moine | 05b809c | 2008-09-03 16:47:59 -0300 | [diff] [blame] | 2468 | for (i = 0; i < 8; i++) |
| 2469 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); |
Jean-Francois Moine | 674cbc6 | 2008-10-02 08:06:59 -0300 | [diff] [blame] | 2470 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2471 | case SENSOR_ADCM1700: |
Jean-Francois Moine | c8b9b2c | 2009-04-26 14:46:12 -0300 | [diff] [blame] | 2472 | case SENSOR_OV7660: |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 2473 | case SENSOR_SP80708: |
| 2474 | reg_w1(gspca_dev, 0x9a, 0x05); |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2475 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2476 | case SENSOR_GC0307: |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2477 | case SENSOR_MT9V111: |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2478 | case SENSOR_MI0360B: |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2479 | reg_w1(gspca_dev, 0x9a, 0x07); |
| 2480 | break; |
Jean-François Moine | 0a85c74 | 2010-04-25 14:33:31 -0300 | [diff] [blame] | 2481 | case SENSOR_OV7630: |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2482 | case SENSOR_OV7648: |
| 2483 | reg_w1(gspca_dev, 0x9a, 0x0a); |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 2484 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2485 | case SENSOR_PO2030N: |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2486 | case SENSOR_SOI768: |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2487 | reg_w1(gspca_dev, 0x9a, 0x06); |
| 2488 | break; |
Jean-Francois Moine | 674cbc6 | 2008-10-02 08:06:59 -0300 | [diff] [blame] | 2489 | default: |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 2490 | reg_w1(gspca_dev, 0x9a, 0x08); |
Jean-Francois Moine | 674cbc6 | 2008-10-02 08:06:59 -0300 | [diff] [blame] | 2491 | break; |
| 2492 | } |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2493 | setsharpness(gspca_dev); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2494 | |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2495 | reg_w(gspca_dev, 0x84, reg84, sizeof reg84); |
Jean-Francois Moine | 878b35a | 2009-12-30 04:53:07 -0300 | [diff] [blame] | 2496 | reg_w1(gspca_dev, 0x05, 0x20); /* red */ |
| 2497 | reg_w1(gspca_dev, 0x07, 0x20); /* green */ |
| 2498 | reg_w1(gspca_dev, 0x06, 0x20); /* blue */ |
Jean-Francois Moine | 23a9827 | 2009-11-02 09:10:25 -0300 | [diff] [blame] | 2499 | |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2500 | init = NULL; |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2501 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2502 | reg01 |= SYS_SEL_48M | V_TX_EN; |
| 2503 | reg17 &= ~MCK_SIZE_MASK; |
| 2504 | reg17 |= 0x02; /* clock / 2 */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2505 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2506 | case SENSOR_ADCM1700: |
| 2507 | init = adcm1700_sensor_param1; |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2508 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2509 | case SENSOR_GC0307: |
| 2510 | init = gc0307_sensor_param1; |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2511 | break; |
| 2512 | case SENSOR_HV7131R: |
| 2513 | case SENSOR_MI0360: |
| 2514 | if (mode) |
| 2515 | reg01 |= SYS_SEL_48M; /* 320x240: clk 48Mhz */ |
| 2516 | else |
| 2517 | reg01 &= ~SYS_SEL_48M; /* 640x480: clk 24Mhz */ |
| 2518 | reg17 &= ~MCK_SIZE_MASK; |
| 2519 | reg17 |= 0x01; /* clock / 1 */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2520 | break; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2521 | case SENSOR_MI0360B: |
| 2522 | init = mi0360b_sensor_param1; |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2523 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2524 | case SENSOR_MO4000: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2525 | if (mode) { /* if 320x240 */ |
| 2526 | reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ |
| 2527 | reg17 &= ~MCK_SIZE_MASK; |
| 2528 | reg17 |= 0x01; /* clock / 1 */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2529 | } |
| 2530 | break; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 2531 | case SENSOR_MT9V111: |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2532 | init = mt9v111_sensor_param1; |
Jean-Francois Moine | 0fbe057 | 2009-01-30 12:14:02 -0300 | [diff] [blame] | 2533 | break; |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 2534 | case SENSOR_OM6802: |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2535 | init = om6802_sensor_param1; |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2536 | if (!mode) { /* if 640x480 */ |
| 2537 | reg17 &= ~MCK_SIZE_MASK; |
Jean-François Moine | aa777a8 | 2010-12-28 07:39:13 -0300 | [diff] [blame] | 2538 | reg17 |= 0x04; /* clock / 4 */ |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2539 | } |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 2540 | break; |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 2541 | case SENSOR_OV7630: |
Jean-François Moine | bdd2b93 | 2010-04-25 14:23:39 -0300 | [diff] [blame] | 2542 | init = ov7630_sensor_param1; |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 2543 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2544 | case SENSOR_OV7648: |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2545 | init = ov7648_sensor_param1; |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2546 | reg17 &= ~MCK_SIZE_MASK; |
| 2547 | reg17 |= 0x01; /* clock / 1 */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2548 | break; |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 2549 | case SENSOR_OV7660: |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2550 | init = ov7660_sensor_param1; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2551 | break; |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 2552 | case SENSOR_PO1030: |
| 2553 | init = po1030_sensor_param1; |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 2554 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2555 | case SENSOR_PO2030N: |
| 2556 | init = po2030n_sensor_param1; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2557 | break; |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2558 | case SENSOR_SOI768: |
| 2559 | init = soi768_sensor_param1; |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2560 | break; |
Jean-François Moine | 0303a90 | 2010-10-21 04:05:15 -0300 | [diff] [blame] | 2561 | case SENSOR_SP80708: |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2562 | init = sp80708_sensor_param1; |
Jean-Francois Moine | 5e31dc8 | 2009-02-01 13:59:42 -0300 | [diff] [blame] | 2563 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2564 | } |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2565 | |
| 2566 | /* more sensor initialization - param1 */ |
| 2567 | if (init != NULL) { |
| 2568 | i2c_w_seq(gspca_dev, init); |
| 2569 | /* init = NULL; */ |
| 2570 | } |
| 2571 | |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 2572 | reg_w(gspca_dev, 0xc0, C0, 6); |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2573 | switch (sd->sensor) { |
| 2574 | case SENSOR_ADCM1700: |
| 2575 | case SENSOR_GC0307: |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2576 | case SENSOR_SOI768: |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2577 | reg_w(gspca_dev, 0xca, CA_adcm1700, 4); |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2578 | break; |
| 2579 | case SENSOR_PO2030N: |
| 2580 | reg_w(gspca_dev, 0xca, CA_po2030n, 4); |
| 2581 | break; |
| 2582 | default: |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2583 | reg_w(gspca_dev, 0xca, CA, 4); |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2584 | break; |
| 2585 | } |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 2586 | switch (sd->sensor) { |
Jean-Francois Moine | 6467757 | 2009-12-20 12:31:28 -0300 | [diff] [blame] | 2587 | case SENSOR_ADCM1700: |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 2588 | case SENSOR_OV7630: |
| 2589 | case SENSOR_OV7648: |
Jean-Francois Moine | 674cbc6 | 2008-10-02 08:06:59 -0300 | [diff] [blame] | 2590 | case SENSOR_OV7660: |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2591 | case SENSOR_SOI768: |
Jean-Francois Moine | 6ab0b17 | 2008-09-03 16:47:34 -0300 | [diff] [blame] | 2592 | reg_w(gspca_dev, 0xce, CE_ov76xx, 4); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2593 | break; |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2594 | case SENSOR_GC0307: |
| 2595 | reg_w(gspca_dev, 0xce, CE_gc0307, 4); |
| 2596 | break; |
| 2597 | case SENSOR_PO2030N: |
| 2598 | reg_w(gspca_dev, 0xce, CE_po2030n, 4); |
| 2599 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2600 | default: |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 2601 | reg_w(gspca_dev, 0xce, CE, 4); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2602 | /* ?? {0x1e, 0xdd, 0x2d, 0xe7} */ |
| 2603 | break; |
| 2604 | } |
| 2605 | |
| 2606 | /* here change size mode 0 -> VGA; 1 -> CIF */ |
Jean-Francois Moine | 71cb276 | 2009-03-03 05:33:41 -0300 | [diff] [blame] | 2607 | sd->reg18 = sn9c1xx[0x18] | (mode << 4) | 0x40; |
| 2608 | reg_w1(gspca_dev, 0x18, sd->reg18); |
| 2609 | setjpegqual(gspca_dev); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2610 | |
Jean-Francois Moine | 6001761 | 2008-07-18 08:46:19 -0300 | [diff] [blame] | 2611 | reg_w1(gspca_dev, 0x17, reg17); |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2612 | reg_w1(gspca_dev, 0x01, reg01); |
| 2613 | sd->reg01 = reg01; |
| 2614 | sd->reg17 = reg17; |
Jean-Francois Moine | 3fccb77 | 2009-11-02 09:54:04 -0300 | [diff] [blame] | 2615 | |
Németh Márton | 76ad3b6 | 2010-10-19 03:33:47 -0300 | [diff] [blame] | 2616 | sethvflip(gspca_dev); |
Jean-Francois Moine | 91bd341 | 2008-11-23 14:47:50 -0300 | [diff] [blame] | 2617 | setbrightness(gspca_dev); |
| 2618 | setcontrast(gspca_dev); |
Jean-François Moine | fff2f70 | 2010-04-25 14:31:05 -0300 | [diff] [blame] | 2619 | setcolors(gspca_dev); |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2620 | setautogain(gspca_dev); |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2621 | setfreq(gspca_dev); |
Jean-François Moine | 4bf8b67 | 2010-09-25 06:12:44 -0300 | [diff] [blame] | 2622 | return gspca_dev->usb_err; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2623 | } |
| 2624 | |
| 2625 | static void sd_stopN(struct gspca_dev *gspca_dev) |
| 2626 | { |
| 2627 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2628 | static const u8 stophv7131[] = |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2629 | { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2630 | static const u8 stopmi0360[] = |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2631 | { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2632 | static const u8 stopov7648[] = |
Jean-Francois Moine | 6270330 | 2008-11-11 08:42:56 -0300 | [diff] [blame] | 2633 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2634 | static const u8 stopsoi768[] = |
| 2635 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2636 | u8 reg01; |
| 2637 | u8 reg17; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2638 | |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2639 | reg01 = sd->reg01; |
| 2640 | reg17 = sd->reg17 & ~SEN_CLK_EN; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2641 | switch (sd->sensor) { |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2642 | case SENSOR_ADCM1700: |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2643 | case SENSOR_GC0307: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2644 | case SENSOR_PO2030N: |
| 2645 | case SENSOR_SP80708: |
| 2646 | reg01 |= LED; |
| 2647 | reg_w1(gspca_dev, 0x01, reg01); |
| 2648 | reg01 &= ~(LED | V_TX_EN); |
| 2649 | reg_w1(gspca_dev, 0x01, reg01); |
| 2650 | /* reg_w1(gspca_dev, 0x02, 0x??); * LED off ? */ |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2651 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2652 | case SENSOR_HV7131R: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2653 | reg01 &= ~V_TX_EN; |
| 2654 | reg_w1(gspca_dev, 0x01, reg01); |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 2655 | i2c_w8(gspca_dev, stophv7131); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2656 | break; |
| 2657 | case SENSOR_MI0360: |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2658 | case SENSOR_MI0360B: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2659 | reg01 &= ~V_TX_EN; |
| 2660 | reg_w1(gspca_dev, 0x01, reg01); |
| 2661 | /* reg_w1(gspca_dev, 0x02, 0x40); * LED off ? */ |
Jean-Francois Moine | 739570b | 2008-07-14 09:38:29 -0300 | [diff] [blame] | 2662 | i2c_w8(gspca_dev, stopmi0360); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2663 | break; |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 2664 | case SENSOR_MT9V111: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2665 | case SENSOR_OM6802: |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 2666 | case SENSOR_PO1030: |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2667 | reg01 &= ~V_TX_EN; |
| 2668 | reg_w1(gspca_dev, 0x01, reg01); |
| 2669 | break; |
| 2670 | case SENSOR_OV7630: |
| 2671 | case SENSOR_OV7648: |
| 2672 | reg01 &= ~V_TX_EN; |
| 2673 | reg_w1(gspca_dev, 0x01, reg01); |
| 2674 | i2c_w8(gspca_dev, stopov7648); |
| 2675 | break; |
| 2676 | case SENSOR_OV7660: |
| 2677 | reg01 &= ~V_TX_EN; |
| 2678 | reg_w1(gspca_dev, 0x01, reg01); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2679 | break; |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2680 | case SENSOR_SOI768: |
| 2681 | i2c_w8(gspca_dev, stopsoi768); |
Jean-François Moine | 03ed2a1 | 2010-04-25 14:45:43 -0300 | [diff] [blame] | 2682 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2683 | } |
Jean-Francois Moine | 0e4d413 | 2010-12-14 16:17:40 -0300 | [diff] [blame] | 2684 | |
| 2685 | reg01 |= SCL_SEL_OD; |
| 2686 | reg_w1(gspca_dev, 0x01, reg01); |
| 2687 | reg01 |= S_PWR_DN; /* sensor power down */ |
| 2688 | reg_w1(gspca_dev, 0x01, reg01); |
| 2689 | reg_w1(gspca_dev, 0x17, reg17); |
| 2690 | reg01 &= ~SYS_SEL_48M; /* clock 24MHz */ |
| 2691 | reg_w1(gspca_dev, 0x01, reg01); |
| 2692 | reg01 |= LED; |
| 2693 | reg_w1(gspca_dev, 0x01, reg01); |
Hans de Goede | 9712a8b | 2010-01-31 12:54:29 -0300 | [diff] [blame] | 2694 | /* Don't disable sensor clock as that disables the button on the cam */ |
| 2695 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2696 | } |
| 2697 | |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2698 | static void do_autogain(struct gspca_dev *gspca_dev) |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2699 | { |
| 2700 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2701 | int delta; |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2702 | int expotimes; |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2703 | u8 luma_mean = 130; |
| 2704 | u8 luma_delta = 20; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2705 | |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2706 | /* Thanks S., without your advice, autobright should not work :) */ |
| 2707 | if (sd->ag_cnt < 0) |
| 2708 | return; |
| 2709 | if (--sd->ag_cnt >= 0) |
| 2710 | return; |
| 2711 | sd->ag_cnt = AG_CNT_START; |
| 2712 | |
| 2713 | delta = atomic_read(&sd->avg_lum); |
| 2714 | PDEBUG(D_FRAM, "mean lum %d", delta); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2715 | if (delta < luma_mean - luma_delta || |
| 2716 | delta > luma_mean + luma_delta) { |
| 2717 | switch (sd->sensor) { |
Jean-François Moine | c26b12d | 2010-04-02 07:08:39 -0300 | [diff] [blame] | 2718 | case SENSOR_GC0307: |
| 2719 | expotimes = sd->exposure; |
| 2720 | expotimes += (luma_mean - delta) >> 6; |
| 2721 | if (expotimes < 0) |
| 2722 | expotimes = 0; |
| 2723 | sd->exposure = setexposure(gspca_dev, |
| 2724 | (unsigned int) expotimes); |
| 2725 | break; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2726 | case SENSOR_HV7131R: |
| 2727 | expotimes = sd->exposure >> 8; |
| 2728 | expotimes += (luma_mean - delta) >> 4; |
| 2729 | if (expotimes < 0) |
| 2730 | expotimes = 0; |
| 2731 | sd->exposure = setexposure(gspca_dev, |
| 2732 | (unsigned int) (expotimes << 8)); |
| 2733 | break; |
Amauri Magagna | 46b4f2a | 2009-10-17 07:21:29 -0300 | [diff] [blame] | 2734 | case SENSOR_OM6802: |
| 2735 | expotimes = sd->exposure; |
| 2736 | expotimes += (luma_mean - delta) >> 2; |
| 2737 | if (expotimes < 0) |
| 2738 | expotimes = 0; |
| 2739 | sd->exposure = setexposure(gspca_dev, |
| 2740 | (unsigned int) expotimes); |
| 2741 | setredblue(gspca_dev); |
| 2742 | break; |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2743 | default: |
| 2744 | /* case SENSOR_MO4000: */ |
| 2745 | /* case SENSOR_MI0360: */ |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2746 | /* case SENSOR_MI0360B: */ |
Jean-Francois Moine | 3ef2c5b | 2009-01-29 04:59:45 -0300 | [diff] [blame] | 2747 | /* case SENSOR_MT9V111: */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2748 | expotimes = sd->exposure; |
| 2749 | expotimes += (luma_mean - delta) >> 6; |
| 2750 | if (expotimes < 0) |
| 2751 | expotimes = 0; |
| 2752 | sd->exposure = setexposure(gspca_dev, |
| 2753 | (unsigned int) expotimes); |
Jean-Francois Moine | 403123d | 2008-11-26 04:46:15 -0300 | [diff] [blame] | 2754 | setredblue(gspca_dev); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2755 | break; |
| 2756 | } |
| 2757 | } |
| 2758 | } |
| 2759 | |
Jean-François Moine | 0f77f40 | 2011-02-10 07:01:30 -0300 | [diff] [blame^] | 2760 | /* set the average luminosity from an isoc marker */ |
| 2761 | static void set_lum(struct sd *sd, |
| 2762 | u8 *data) |
| 2763 | { |
| 2764 | int avg_lum; |
| 2765 | |
| 2766 | /* w0 w1 w2 |
| 2767 | * w3 w4 w5 |
| 2768 | * w6 w7 w8 |
| 2769 | */ |
| 2770 | avg_lum = (data[27] << 8) + data[28] /* w3 */ |
| 2771 | |
| 2772 | + (data[31] << 8) + data[32] /* w5 */ |
| 2773 | |
| 2774 | + (data[23] << 8) + data[24] /* w1 */ |
| 2775 | |
| 2776 | + (data[35] << 8) + data[36] /* w7 */ |
| 2777 | |
| 2778 | + (data[29] << 10) + (data[30] << 2); /* w4 * 4 */ |
| 2779 | avg_lum >>= 10; |
| 2780 | atomic_set(&sd->avg_lum, avg_lum); |
| 2781 | } |
| 2782 | |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2783 | /* scan the URB packets */ |
| 2784 | /* This function is run at interrupt level. */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2785 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
Jean-Francois Moine | 9881918 | 2009-01-19 07:37:33 -0300 | [diff] [blame] | 2786 | u8 *data, /* isoc packet */ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2787 | int len) /* iso packet length */ |
| 2788 | { |
| 2789 | struct sd *sd = (struct sd *) gspca_dev; |
Jean-François Moine | 0f77f40 | 2011-02-10 07:01:30 -0300 | [diff] [blame^] | 2790 | int sof; |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2791 | |
Jean-François Moine | a95bd64 | 2010-10-01 07:54:30 -0300 | [diff] [blame] | 2792 | /* the image ends on a 64 bytes block starting with |
| 2793 | * ff d9 ff ff 00 c4 c4 96 |
| 2794 | * and followed by various information including luminosity */ |
| 2795 | /* this block may be splitted between two packets */ |
| 2796 | /* a new image always starts in a new packet */ |
| 2797 | switch (gspca_dev->last_packet_type) { |
| 2798 | case DISCARD_PACKET: /* restart image building */ |
| 2799 | sof = len - 64; |
| 2800 | if (sof >= 0 && data[sof] == 0xff && data[sof + 1] == 0xd9) |
| 2801 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
| 2802 | return; |
| 2803 | case LAST_PACKET: /* put the JPEG 422 header */ |
| 2804 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
| 2805 | sd->jpeg_hdr, JPEG_HDR_SZ); |
| 2806 | break; |
| 2807 | } |
| 2808 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2809 | |
Jean-François Moine | a95bd64 | 2010-10-01 07:54:30 -0300 | [diff] [blame] | 2810 | data = gspca_dev->image; |
| 2811 | if (data == NULL) |
| 2812 | return; |
| 2813 | sof = gspca_dev->image_len - 64; |
| 2814 | if (data[sof] != 0xff |
| 2815 | || data[sof + 1] != 0xd9) |
| 2816 | return; |
| 2817 | |
| 2818 | /* end of image found - remove the trailing data */ |
| 2819 | gspca_dev->image_len = sof + 2; |
| 2820 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
Jean-François Moine | 0f77f40 | 2011-02-10 07:01:30 -0300 | [diff] [blame^] | 2821 | if (sd->ag_cnt >= 0) |
| 2822 | set_lum(sd, data + sof + 2); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2823 | } |
| 2824 | |
Jean-Francois Moine | 77ac0ba | 2009-03-02 06:40:52 -0300 | [diff] [blame] | 2825 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, |
| 2826 | struct v4l2_jpegcompression *jcomp) |
| 2827 | { |
| 2828 | struct sd *sd = (struct sd *) gspca_dev; |
| 2829 | |
| 2830 | if (jcomp->quality < QUALITY_MIN) |
| 2831 | sd->quality = QUALITY_MIN; |
| 2832 | else if (jcomp->quality > QUALITY_MAX) |
| 2833 | sd->quality = QUALITY_MAX; |
| 2834 | else |
| 2835 | sd->quality = jcomp->quality; |
| 2836 | if (gspca_dev->streaming) |
| 2837 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); |
| 2838 | return 0; |
| 2839 | } |
| 2840 | |
| 2841 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, |
| 2842 | struct v4l2_jpegcompression *jcomp) |
| 2843 | { |
| 2844 | struct sd *sd = (struct sd *) gspca_dev; |
| 2845 | |
| 2846 | memset(jcomp, 0, sizeof *jcomp); |
| 2847 | jcomp->quality = sd->quality; |
| 2848 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT |
| 2849 | | V4L2_JPEG_MARKER_DQT; |
| 2850 | return 0; |
| 2851 | } |
| 2852 | |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2853 | static int sd_querymenu(struct gspca_dev *gspca_dev, |
| 2854 | struct v4l2_querymenu *menu) |
| 2855 | { |
| 2856 | switch (menu->id) { |
| 2857 | case V4L2_CID_POWER_LINE_FREQUENCY: |
| 2858 | switch (menu->index) { |
| 2859 | case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ |
| 2860 | strcpy((char *) menu->name, "NoFliker"); |
| 2861 | return 0; |
| 2862 | case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ |
| 2863 | strcpy((char *) menu->name, "50 Hz"); |
| 2864 | return 0; |
| 2865 | case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ |
| 2866 | strcpy((char *) menu->name, "60 Hz"); |
| 2867 | return 0; |
| 2868 | } |
| 2869 | break; |
| 2870 | } |
| 2871 | return -EINVAL; |
| 2872 | } |
| 2873 | |
Jean-François Moine | 2856643 | 2010-10-01 07:33:26 -0300 | [diff] [blame] | 2874 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) |
Hans de Goede | 9712a8b | 2010-01-31 12:54:29 -0300 | [diff] [blame] | 2875 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
| 2876 | u8 *data, /* interrupt packet data */ |
| 2877 | int len) /* interrupt packet length */ |
| 2878 | { |
| 2879 | int ret = -EINVAL; |
| 2880 | |
| 2881 | if (len == 1 && data[0] == 1) { |
| 2882 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); |
| 2883 | input_sync(gspca_dev->input_dev); |
| 2884 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); |
| 2885 | input_sync(gspca_dev->input_dev); |
| 2886 | ret = 0; |
| 2887 | } |
| 2888 | |
| 2889 | return ret; |
| 2890 | } |
| 2891 | #endif |
| 2892 | |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2893 | /* sub-driver description */ |
Jean-Francois Moine | a5ae206 | 2008-07-04 11:16:16 -0300 | [diff] [blame] | 2894 | static const struct sd_desc sd_desc = { |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2895 | .name = MODULE_NAME, |
| 2896 | .ctrls = sd_ctrls, |
Jean-François Moine | 72b667e | 2010-10-02 04:35:25 -0300 | [diff] [blame] | 2897 | .nctrls = NCTRLS, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2898 | .config = sd_config, |
Jean-Francois Moine | 012d6b0 | 2008-09-03 17:12:16 -0300 | [diff] [blame] | 2899 | .init = sd_init, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2900 | .start = sd_start, |
| 2901 | .stopN = sd_stopN, |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2902 | .pkt_scan = sd_pkt_scan, |
Jean-Francois Moine | cebf3b6 | 2008-08-03 07:52:53 -0300 | [diff] [blame] | 2903 | .dq_callback = do_autogain, |
Jean-Francois Moine | 77ac0ba | 2009-03-02 06:40:52 -0300 | [diff] [blame] | 2904 | .get_jcomp = sd_get_jcomp, |
| 2905 | .set_jcomp = sd_set_jcomp, |
Hans de Goede | 37c6dbe | 2009-06-18 07:35:36 -0300 | [diff] [blame] | 2906 | .querymenu = sd_querymenu, |
Jean-François Moine | 2856643 | 2010-10-01 07:33:26 -0300 | [diff] [blame] | 2907 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) |
Hans de Goede | 9712a8b | 2010-01-31 12:54:29 -0300 | [diff] [blame] | 2908 | .int_pkt_scan = sd_int_pkt_scan, |
| 2909 | #endif |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2910 | }; |
| 2911 | |
| 2912 | /* -- module initialisation -- */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2913 | #define BS(bridge, sensor) \ |
Jean-Francois Moine | 9d64fdb | 2008-07-25 08:53:03 -0300 | [diff] [blame] | 2914 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
Jean-Francois Moine | c6c1433 | 2010-12-14 16:15:37 -0300 | [diff] [blame] | 2915 | | (SENSOR_ ## sensor << 8) |
| 2916 | #define BSF(bridge, sensor, flags) \ |
| 2917 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
| 2918 | | (SENSOR_ ## sensor << 8) \ |
| 2919 | | (flags) |
Jean-François Moine | 95c967c | 2011-01-13 05:20:29 -0300 | [diff] [blame] | 2920 | static const struct usb_device_id device_table[] = { |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2921 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
| 2922 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 2923 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)}, |
| 2924 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2925 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
| 2926 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, |
| 2927 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, |
| 2928 | {USB_DEVICE(0x06f8, 0x3004), BS(SN9C105, OV7660)}, |
| 2929 | {USB_DEVICE(0x06f8, 0x3008), BS(SN9C105, OV7660)}, |
| 2930 | /* {USB_DEVICE(0x0c45, 0x603a), BS(SN9C102P, OV7648)}, */ |
| 2931 | {USB_DEVICE(0x0c45, 0x6040), BS(SN9C102P, HV7131R)}, |
| 2932 | /* {USB_DEVICE(0x0c45, 0x607a), BS(SN9C102P, OV7648)}, */ |
| 2933 | /* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */ |
| 2934 | {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)}, |
| 2935 | /* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */ |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 2936 | {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)}, |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2937 | /* or MT9V111 */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2938 | /* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ |
| 2939 | /* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ |
| 2940 | /* {USB_DEVICE(0x0c45, 0x60cc), BS(SN9C105, HV7131GP)}, */ |
Warren Bosworth Focke | c4f95d8 | 2010-05-07 15:40:04 -0300 | [diff] [blame] | 2941 | {USB_DEVICE(0x0c45, 0x60ce), BS(SN9C105, SP80708)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2942 | {USB_DEVICE(0x0c45, 0x60ec), BS(SN9C105, MO4000)}, |
| 2943 | /* {USB_DEVICE(0x0c45, 0x60ef), BS(SN9C105, ICM105C)}, */ |
| 2944 | /* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ |
Jean-François Moine | 6804675 | 2010-05-07 15:35:08 -0300 | [diff] [blame] | 2945 | /* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2946 | {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2947 | {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, |
| 2948 | {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2949 | {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ |
Jean-François Moine | 860e7f4 | 2010-09-13 06:40:17 -0300 | [diff] [blame] | 2950 | {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2951 | /* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ |
| 2952 | {USB_DEVICE(0x0c45, 0x610a), BS(SN9C120, OV7648)}, /*sn9c128*/ |
| 2953 | {USB_DEVICE(0x0c45, 0x610b), BS(SN9C120, OV7660)}, /*sn9c128*/ |
| 2954 | {USB_DEVICE(0x0c45, 0x610c), BS(SN9C120, HV7131R)}, /*sn9c128*/ |
| 2955 | {USB_DEVICE(0x0c45, 0x610e), BS(SN9C120, OV7630)}, /*sn9c128*/ |
| 2956 | /* {USB_DEVICE(0x0c45, 0x610f), BS(SN9C120, S5K53BEB)}, */ |
| 2957 | /* {USB_DEVICE(0x0c45, 0x6122), BS(SN9C110, ICM105C)}, */ |
| 2958 | /* {USB_DEVICE(0x0c45, 0x6123), BS(SN9C110, SanyoCCD)}, */ |
| 2959 | {USB_DEVICE(0x0c45, 0x6128), BS(SN9C120, OM6802)}, /*sn9c325?*/ |
Jean-Francois Moine | d2d16e9 | 2008-09-03 16:47:23 -0300 | [diff] [blame] | 2960 | /*bw600.inf:*/ |
Jean-Francois Moine | b8c8a5b | 2009-11-23 06:46:35 -0300 | [diff] [blame] | 2961 | {USB_DEVICE(0x0c45, 0x612a), BS(SN9C120, OV7648)}, /*sn9c325?*/ |
Alexander Goncharov | 2a3b501 | 2010-09-13 06:58:16 -0300 | [diff] [blame] | 2962 | {USB_DEVICE(0x0c45, 0x612b), BS(SN9C110, ADCM1700)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2963 | {USB_DEVICE(0x0c45, 0x612c), BS(SN9C110, MO4000)}, |
| 2964 | {USB_DEVICE(0x0c45, 0x612e), BS(SN9C110, OV7630)}, |
| 2965 | /* {USB_DEVICE(0x0c45, 0x612f), BS(SN9C110, ICM105C)}, */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2966 | {USB_DEVICE(0x0c45, 0x6130), BS(SN9C120, MI0360)}, |
Jean-François Moine | a067db8 | 2010-10-01 07:51:24 -0300 | [diff] [blame] | 2967 | /* or MT9V111 / MI0360B */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2968 | /* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */ |
| 2969 | {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)}, |
| 2970 | {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2971 | {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)}, |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2972 | {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, |
| 2973 | {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, |
Jean-François Moine | ad98c0f | 2010-03-18 05:15:30 -0300 | [diff] [blame] | 2974 | {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ |
Jean-François Moine | 6804675 | 2010-05-07 15:35:08 -0300 | [diff] [blame] | 2975 | /* or GC0305 / GC0307 */ |
Jean-Francois Moine | d5aa385 | 2009-11-07 06:10:08 -0300 | [diff] [blame] | 2976 | {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ |
| 2977 | {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ |
Jean-François Moine | a63d601 | 2011-01-13 07:56:00 -0300 | [diff] [blame] | 2978 | {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)}, |
Hans de Goede | e48d38f | 2011-01-06 16:21:57 -0300 | [diff] [blame] | 2979 | /* {USB_DEVICE(0x0c45, 0x614c), BS(SN9C120, GC0306)}, */ /*sn9c120b*/ |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 2980 | {} |
| 2981 | }; |
| 2982 | MODULE_DEVICE_TABLE(usb, device_table); |
| 2983 | |
| 2984 | /* -- device connect -- */ |
| 2985 | static int sd_probe(struct usb_interface *intf, |
| 2986 | const struct usb_device_id *id) |
| 2987 | { |
| 2988 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
| 2989 | THIS_MODULE); |
| 2990 | } |
| 2991 | |
| 2992 | static struct usb_driver sd_driver = { |
| 2993 | .name = MODULE_NAME, |
| 2994 | .id_table = device_table, |
| 2995 | .probe = sd_probe, |
| 2996 | .disconnect = gspca_disconnect, |
Jean-Francois Moine | 6a70974 | 2008-09-03 16:48:10 -0300 | [diff] [blame] | 2997 | #ifdef CONFIG_PM |
| 2998 | .suspend = gspca_suspend, |
| 2999 | .resume = gspca_resume, |
| 3000 | #endif |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 3001 | }; |
| 3002 | |
| 3003 | /* -- module insert / remove -- */ |
| 3004 | static int __init sd_mod_init(void) |
| 3005 | { |
Jean-François Moine | 5482643 | 2010-09-13 04:53:03 -0300 | [diff] [blame] | 3006 | return usb_register(&sd_driver); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 3007 | } |
| 3008 | static void __exit sd_mod_exit(void) |
| 3009 | { |
| 3010 | usb_deregister(&sd_driver); |
Jean-Francois Moine | 6a7eba2 | 2008-06-30 15:50:11 -0300 | [diff] [blame] | 3011 | } |
| 3012 | |
| 3013 | module_init(sd_mod_init); |
| 3014 | module_exit(sd_mod_exit); |
Jean-François Moine | 3afef85 | 2011-01-13 06:39:11 -0300 | [diff] [blame] | 3015 | |
| 3016 | module_param(starcam, int, 0644); |
| 3017 | MODULE_PARM_DESC(starcam, |
| 3018 | "StarCam model. 0: Clip, 1: 370i"); |