spca508.c 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536
  1. /*
  2. * SPCA508 chip based cameras subdriver
  3. *
  4. * Copyright (C) 2009 Jean-Francois Moine <http://moinejf.free.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  17. #define MODULE_NAME "spca508"
  18. #include "gspca.h"
  19. MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
  20. MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
  21. MODULE_LICENSE("GPL");
  22. /* specific webcam descriptor */
  23. struct sd {
  24. struct gspca_dev gspca_dev; /* !! must be the first item */
  25. u8 subtype;
  26. #define CreativeVista 0
  27. #define HamaUSBSightcam 1
  28. #define HamaUSBSightcam2 2
  29. #define IntelEasyPCCamera 3
  30. #define MicroInnovationIC200 4
  31. #define ViewQuestVQ110 5
  32. };
  33. static const struct v4l2_pix_format sif_mode[] = {
  34. {160, 120, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
  35. .bytesperline = 160,
  36. .sizeimage = 160 * 120 * 3 / 2,
  37. .colorspace = V4L2_COLORSPACE_SRGB,
  38. .priv = 3},
  39. {176, 144, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
  40. .bytesperline = 176,
  41. .sizeimage = 176 * 144 * 3 / 2,
  42. .colorspace = V4L2_COLORSPACE_SRGB,
  43. .priv = 2},
  44. {320, 240, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
  45. .bytesperline = 320,
  46. .sizeimage = 320 * 240 * 3 / 2,
  47. .colorspace = V4L2_COLORSPACE_SRGB,
  48. .priv = 1},
  49. {352, 288, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
  50. .bytesperline = 352,
  51. .sizeimage = 352 * 288 * 3 / 2,
  52. .colorspace = V4L2_COLORSPACE_SRGB,
  53. .priv = 0},
  54. };
  55. /* Frame packet header offsets for the spca508 */
  56. #define SPCA508_OFFSET_DATA 37
  57. /*
  58. * Initialization data: this is the first set-up data written to the
  59. * device (before the open data).
  60. */
  61. static const u16 spca508_init_data[][2] = {
  62. {0x0000, 0x870b},
  63. {0x0020, 0x8112}, /* Video drop enable, ISO streaming disable */
  64. {0x0003, 0x8111}, /* Reset compression & memory */
  65. {0x0000, 0x8110}, /* Disable all outputs */
  66. /* READ {0x0000, 0x8114} -> 0000: 00 */
  67. {0x0000, 0x8114}, /* SW GPIO data */
  68. {0x0008, 0x8110}, /* Enable charge pump output */
  69. {0x0002, 0x8116}, /* 200 kHz pump clock */
  70. /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE:) */
  71. {0x0003, 0x8111}, /* Reset compression & memory */
  72. {0x0000, 0x8111}, /* Normal mode (not reset) */
  73. {0x0098, 0x8110},
  74. /* Enable charge pump output, sync.serial,external 2x clock */
  75. {0x000d, 0x8114}, /* SW GPIO data */
  76. {0x0002, 0x8116}, /* 200 kHz pump clock */
  77. {0x0020, 0x8112}, /* Video drop enable, ISO streaming disable */
  78. /* --------------------------------------- */
  79. {0x000f, 0x8402}, /* memory bank */
  80. {0x0000, 0x8403}, /* ... address */
  81. /* --------------------------------------- */
  82. /* 0x88__ is Synchronous Serial Interface. */
  83. /* TBD: This table could be expressed more compactly */
  84. /* using spca508_write_i2c_vector(). */
  85. /* TBD: Should see if the values in spca50x_i2c_data */
  86. /* would work with the VQ110 instead of the values */
  87. /* below. */
  88. {0x00c0, 0x8804}, /* SSI slave addr */
  89. {0x0008, 0x8802}, /* 375 Khz SSI clock */
  90. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  91. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  92. {0x0008, 0x8802}, /* 375 Khz SSI clock */
  93. {0x0012, 0x8801}, /* SSI reg addr */
  94. {0x0080, 0x8800}, /* SSI data to write */
  95. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  96. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  97. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  98. {0x0008, 0x8802}, /* 375 Khz SSI clock */
  99. {0x0012, 0x8801}, /* SSI reg addr */
  100. {0x0000, 0x8800}, /* SSI data to write */
  101. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  102. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  103. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  104. {0x0008, 0x8802}, /* 375 Khz SSI clock */
  105. {0x0011, 0x8801}, /* SSI reg addr */
  106. {0x0040, 0x8800}, /* SSI data to write */
  107. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  108. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  109. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  110. {0x0008, 0x8802},
  111. {0x0013, 0x8801},
  112. {0x0000, 0x8800},
  113. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  114. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  115. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  116. {0x0008, 0x8802},
  117. {0x0014, 0x8801},
  118. {0x0000, 0x8800},
  119. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  120. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  121. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  122. {0x0008, 0x8802},
  123. {0x0015, 0x8801},
  124. {0x0001, 0x8800},
  125. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  126. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  127. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  128. {0x0008, 0x8802},
  129. {0x0016, 0x8801},
  130. {0x0003, 0x8800},
  131. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  132. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  133. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  134. {0x0008, 0x8802},
  135. {0x0017, 0x8801},
  136. {0x0036, 0x8800},
  137. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  138. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  139. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  140. {0x0008, 0x8802},
  141. {0x0018, 0x8801},
  142. {0x00ec, 0x8800},
  143. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  144. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  145. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  146. {0x0008, 0x8802},
  147. {0x001a, 0x8801},
  148. {0x0094, 0x8800},
  149. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  150. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  151. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  152. {0x0008, 0x8802},
  153. {0x001b, 0x8801},
  154. {0x0000, 0x8800},
  155. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  156. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  157. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  158. {0x0008, 0x8802},
  159. {0x0027, 0x8801},
  160. {0x00a2, 0x8800},
  161. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  162. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  163. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  164. {0x0008, 0x8802},
  165. {0x0028, 0x8801},
  166. {0x0040, 0x8800},
  167. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  168. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  169. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  170. {0x0008, 0x8802},
  171. {0x002a, 0x8801},
  172. {0x0084, 0x8800},
  173. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  174. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  175. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  176. {0x0008, 0x8802},
  177. {0x002b, 0x8801},
  178. {0x00a8, 0x8800},
  179. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  180. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  181. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  182. {0x0008, 0x8802},
  183. {0x002c, 0x8801},
  184. {0x00fe, 0x8800},
  185. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  186. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  187. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  188. {0x0008, 0x8802},
  189. {0x002d, 0x8801},
  190. {0x0003, 0x8800},
  191. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  192. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  193. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  194. {0x0008, 0x8802},
  195. {0x0038, 0x8801},
  196. {0x0083, 0x8800},
  197. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  198. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  199. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  200. {0x0008, 0x8802},
  201. {0x0033, 0x8801},
  202. {0x0081, 0x8800},
  203. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  204. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  205. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  206. {0x0008, 0x8802},
  207. {0x0034, 0x8801},
  208. {0x004a, 0x8800},
  209. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  210. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  211. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  212. {0x0008, 0x8802},
  213. {0x0039, 0x8801},
  214. {0x0000, 0x8800},
  215. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  216. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  217. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  218. {0x0008, 0x8802},
  219. {0x0010, 0x8801},
  220. {0x00a8, 0x8800},
  221. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  222. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  223. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  224. {0x0008, 0x8802},
  225. {0x0006, 0x8801},
  226. {0x0058, 0x8800},
  227. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  228. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  229. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  230. {0x0008, 0x8802},
  231. {0x0000, 0x8801},
  232. {0x0004, 0x8800},
  233. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  234. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  235. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  236. {0x0008, 0x8802},
  237. {0x0040, 0x8801},
  238. {0x0080, 0x8800},
  239. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  240. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  241. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  242. {0x0008, 0x8802},
  243. {0x0041, 0x8801},
  244. {0x000c, 0x8800},
  245. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  246. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  247. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  248. {0x0008, 0x8802},
  249. {0x0042, 0x8801},
  250. {0x000c, 0x8800},
  251. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  252. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  253. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  254. {0x0008, 0x8802},
  255. {0x0043, 0x8801},
  256. {0x0028, 0x8800},
  257. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  258. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  259. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  260. {0x0008, 0x8802},
  261. {0x0044, 0x8801},
  262. {0x0080, 0x8800},
  263. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  264. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  265. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  266. {0x0008, 0x8802},
  267. {0x0045, 0x8801},
  268. {0x0020, 0x8800},
  269. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  270. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  271. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  272. {0x0008, 0x8802},
  273. {0x0046, 0x8801},
  274. {0x0020, 0x8800},
  275. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  276. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  277. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  278. {0x0008, 0x8802},
  279. {0x0047, 0x8801},
  280. {0x0080, 0x8800},
  281. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  282. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  283. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  284. {0x0008, 0x8802},
  285. {0x0048, 0x8801},
  286. {0x004c, 0x8800},
  287. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  288. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  289. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  290. {0x0008, 0x8802},
  291. {0x0049, 0x8801},
  292. {0x0084, 0x8800},
  293. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  294. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  295. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  296. {0x0008, 0x8802},
  297. {0x004a, 0x8801},
  298. {0x0084, 0x8800},
  299. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  300. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  301. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  302. {0x0008, 0x8802},
  303. {0x004b, 0x8801},
  304. {0x0084, 0x8800},
  305. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  306. /* --------------------------------------- */
  307. {0x0012, 0x8700}, /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
  308. {0x0000, 0x8701}, /* CKx1 clock delay adj */
  309. {0x0000, 0x8701}, /* CKx1 clock delay adj */
  310. {0x0001, 0x870c}, /* CKOx2 output */
  311. /* --------------------------------------- */
  312. {0x0080, 0x8600}, /* Line memory read counter (L) */
  313. {0x0001, 0x8606}, /* reserved */
  314. {0x0064, 0x8607}, /* Line memory read counter (H) 0x6480=25,728 */
  315. {0x002a, 0x8601}, /* CDSP sharp interpolation mode,
  316. * line sel for color sep, edge enhance enab */
  317. {0x0000, 0x8602}, /* optical black level for user settng = 0 */
  318. {0x0080, 0x8600}, /* Line memory read counter (L) */
  319. {0x000a, 0x8603}, /* optical black level calc mode:
  320. * auto; optical black offset = 10 */
  321. {0x00df, 0x865b}, /* Horiz offset for valid pixels (L)=0xdf */
  322. {0x0012, 0x865c}, /* Vert offset for valid lines (L)=0x12 */
  323. /* The following two lines seem to be the "wrong" resolution. */
  324. /* But perhaps these indicate the actual size of the sensor */
  325. /* rather than the size of the current video mode. */
  326. {0x0058, 0x865d}, /* Horiz valid pixels (*4) (L) = 352 */
  327. {0x0048, 0x865e}, /* Vert valid lines (*4) (L) = 288 */
  328. {0x0015, 0x8608}, /* A11 Coef ... */
  329. {0x0030, 0x8609},
  330. {0x00fb, 0x860a},
  331. {0x003e, 0x860b},
  332. {0x00ce, 0x860c},
  333. {0x00f4, 0x860d},
  334. {0x00eb, 0x860e},
  335. {0x00dc, 0x860f},
  336. {0x0039, 0x8610},
  337. {0x0001, 0x8611}, /* R offset for white balance ... */
  338. {0x0000, 0x8612},
  339. {0x0001, 0x8613},
  340. {0x0000, 0x8614},
  341. {0x005b, 0x8651}, /* R gain for white balance ... */
  342. {0x0040, 0x8652},
  343. {0x0060, 0x8653},
  344. {0x0040, 0x8654},
  345. {0x0000, 0x8655},
  346. {0x0001, 0x863f}, /* Fixed gamma correction enable, USB control,
  347. * lum filter disable, lum noise clip disable */
  348. {0x00a1, 0x8656}, /* Window1 size 256x256, Windows2 size 64x64,
  349. * gamma look-up disable,
  350. * new edge enhancement enable */
  351. {0x0018, 0x8657}, /* Edge gain high thresh */
  352. {0x0020, 0x8658}, /* Edge gain low thresh */
  353. {0x000a, 0x8659}, /* Edge bandwidth high threshold */
  354. {0x0005, 0x865a}, /* Edge bandwidth low threshold */
  355. /* -------------------------------- */
  356. {0x0030, 0x8112}, /* Video drop enable, ISO streaming enable */
  357. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  358. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  359. {0xa908, 0x8802},
  360. {0x0034, 0x8801}, /* SSI reg addr */
  361. {0x00ca, 0x8800},
  362. /* SSI data to write */
  363. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  364. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  365. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  366. {0x1f08, 0x8802},
  367. {0x0006, 0x8801},
  368. {0x0080, 0x8800},
  369. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  370. /* ----- Read back coefs we wrote earlier. */
  371. /* READ { 0x0000, 0x8608 } -> 0000: 15 */
  372. /* READ { 0x0000, 0x8609 } -> 0000: 30 */
  373. /* READ { 0x0000, 0x860a } -> 0000: fb */
  374. /* READ { 0x0000, 0x860b } -> 0000: 3e */
  375. /* READ { 0x0000, 0x860c } -> 0000: ce */
  376. /* READ { 0x0000, 0x860d } -> 0000: f4 */
  377. /* READ { 0x0000, 0x860e } -> 0000: eb */
  378. /* READ { 0x0000, 0x860f } -> 0000: dc */
  379. /* READ { 0x0000, 0x8610 } -> 0000: 39 */
  380. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  381. /* READ { 0x0001, 0x8802 } -> 0000: 08 */
  382. {0xb008, 0x8802},
  383. {0x0006, 0x8801},
  384. {0x007d, 0x8800},
  385. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  386. /* This chunk is seemingly redundant with */
  387. /* earlier commands (A11 Coef...), but if I disable it, */
  388. /* the image appears too dark. Maybe there was some kind of */
  389. /* reset since the earlier commands, so this is necessary again. */
  390. {0x0015, 0x8608},
  391. {0x0030, 0x8609},
  392. {0xfffb, 0x860a},
  393. {0x003e, 0x860b},
  394. {0xffce, 0x860c},
  395. {0xfff4, 0x860d},
  396. {0xffeb, 0x860e},
  397. {0xffdc, 0x860f},
  398. {0x0039, 0x8610},
  399. {0x0018, 0x8657},
  400. {0x0000, 0x8508}, /* Disable compression. */
  401. /* Previous line was:
  402. {0x0021, 0x8508}, * Enable compression. */
  403. {0x0032, 0x850b}, /* compression stuff */
  404. {0x0003, 0x8509}, /* compression stuff */
  405. {0x0011, 0x850a}, /* compression stuff */
  406. {0x0021, 0x850d}, /* compression stuff */
  407. {0x0010, 0x850c}, /* compression stuff */
  408. {0x0003, 0x8500}, /* *** Video mode: 160x120 */
  409. {0x0001, 0x8501}, /* Hardware-dominated snap control */
  410. {0x0061, 0x8656}, /* Window1 size 128x128, Windows2 size 128x128,
  411. * gamma look-up disable,
  412. * new edge enhancement enable */
  413. {0x0018, 0x8617}, /* Window1 start X (*2) */
  414. {0x0008, 0x8618}, /* Window1 start Y (*2) */
  415. {0x0061, 0x8656}, /* Window1 size 128x128, Windows2 size 128x128,
  416. * gamma look-up disable,
  417. * new edge enhancement enable */
  418. {0x0058, 0x8619}, /* Window2 start X (*2) */
  419. {0x0008, 0x861a}, /* Window2 start Y (*2) */
  420. {0x00ff, 0x8615}, /* High lum thresh for white balance */
  421. {0x0000, 0x8616}, /* Low lum thresh for white balance */
  422. {0x0012, 0x8700}, /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
  423. {0x0012, 0x8700}, /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
  424. /* READ { 0x0000, 0x8656 } -> 0000: 61 */
  425. {0x0028, 0x8802}, /* 375 Khz SSI clock, SSI r/w sync with VSYNC */
  426. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  427. /* READ { 0x0001, 0x8802 } -> 0000: 28 */
  428. {0x1f28, 0x8802}, /* 375 Khz SSI clock, SSI r/w sync with VSYNC */
  429. {0x0010, 0x8801}, /* SSI reg addr */
  430. {0x003e, 0x8800}, /* SSI data to write */
  431. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  432. {0x0028, 0x8802},
  433. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  434. /* READ { 0x0001, 0x8802 } -> 0000: 28 */
  435. {0x1f28, 0x8802},
  436. {0x0000, 0x8801},
  437. {0x001f, 0x8800},
  438. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  439. {0x0001, 0x8602}, /* optical black level for user settning = 1 */
  440. /* Original: */
  441. {0x0023, 0x8700}, /* Clock speed 48Mhz/(3+2)/4= 2.4 Mhz */
  442. {0x000f, 0x8602}, /* optical black level for user settning = 15 */
  443. {0x0028, 0x8802},
  444. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  445. /* READ { 0x0001, 0x8802 } -> 0000: 28 */
  446. {0x1f28, 0x8802},
  447. {0x0010, 0x8801},
  448. {0x007b, 0x8800},
  449. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  450. {0x002f, 0x8651}, /* R gain for white balance ... */
  451. {0x0080, 0x8653},
  452. /* READ { 0x0000, 0x8655 } -> 0000: 00 */
  453. {0x0000, 0x8655},
  454. {0x0030, 0x8112}, /* Video drop enable, ISO streaming enable */
  455. {0x0020, 0x8112}, /* Video drop enable, ISO streaming disable */
  456. /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE: (ALT=0) ) */
  457. {}
  458. };
  459. /*
  460. * Initialization data for Intel EasyPC Camera CS110
  461. */
  462. static const u16 spca508cs110_init_data[][2] = {
  463. {0x0000, 0x870b}, /* Reset CTL3 */
  464. {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
  465. {0x0000, 0x8111}, /* Normal operation on reset */
  466. {0x0090, 0x8110},
  467. /* External Clock 2x & Synchronous Serial Interface Output */
  468. {0x0020, 0x8112}, /* Video Drop packet enable */
  469. {0x0000, 0x8114}, /* Software GPIO output data */
  470. {0x0001, 0x8114},
  471. {0x0001, 0x8114},
  472. {0x0001, 0x8114},
  473. {0x0003, 0x8114},
  474. /* Initial sequence Synchronous Serial Interface */
  475. {0x000f, 0x8402}, /* Memory bank Address */
  476. {0x0000, 0x8403}, /* Memory bank Address */
  477. {0x00ba, 0x8804}, /* SSI Slave address */
  478. {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */
  479. {0x0010, 0x8802}, /* 93.75kHz SSI Clock two DataByte */
  480. {0x0001, 0x8801},
  481. {0x000a, 0x8805}, /* a - NWG: Dunno what this is about */
  482. {0x0000, 0x8800},
  483. {0x0010, 0x8802},
  484. {0x0002, 0x8801},
  485. {0x0000, 0x8805},
  486. {0x0000, 0x8800},
  487. {0x0010, 0x8802},
  488. {0x0003, 0x8801},
  489. {0x0027, 0x8805},
  490. {0x0001, 0x8800},
  491. {0x0010, 0x8802},
  492. {0x0004, 0x8801},
  493. {0x0065, 0x8805},
  494. {0x0001, 0x8800},
  495. {0x0010, 0x8802},
  496. {0x0005, 0x8801},
  497. {0x0003, 0x8805},
  498. {0x0000, 0x8800},
  499. {0x0010, 0x8802},
  500. {0x0006, 0x8801},
  501. {0x001c, 0x8805},
  502. {0x0000, 0x8800},
  503. {0x0010, 0x8802},
  504. {0x0007, 0x8801},
  505. {0x002a, 0x8805},
  506. {0x0000, 0x8800},
  507. {0x0010, 0x8802},
  508. {0x0002, 0x8704}, /* External input CKIx1 */
  509. {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */
  510. {0x009a, 0x8600}, /* Line memory Read Counter (L) */
  511. {0x0001, 0x865b}, /* 1 Horizontal Offset for Valid Pixel(L) */
  512. {0x0003, 0x865c}, /* 3 Vertical Offset for Valid Lines(L) */
  513. {0x0058, 0x865d}, /* 58 Horizontal Valid Pixel Window(L) */
  514. {0x0006, 0x8660}, /* Nibble data + input order */
  515. {0x000a, 0x8602}, /* Optical black level set to 0x0a */
  516. {0x0000, 0x8603}, /* Optical black level Offset */
  517. /* {0x0000, 0x8611}, * 0 R Offset for white Balance */
  518. /* {0x0000, 0x8612}, * 1 Gr Offset for white Balance */
  519. /* {0x0000, 0x8613}, * 1f B Offset for white Balance */
  520. /* {0x0000, 0x8614}, * f0 Gb Offset for white Balance */
  521. {0x0040, 0x8651}, /* 2b BLUE gain for white balance good at all 60 */
  522. {0x0030, 0x8652}, /* 41 Gr Gain for white Balance (L) */
  523. {0x0035, 0x8653}, /* 26 RED gain for white balance */
  524. {0x0035, 0x8654}, /* 40Gb Gain for white Balance (L) */
  525. {0x0041, 0x863f},
  526. /* Fixed Gamma correction enabled (makes colours look better) */
  527. {0x0000, 0x8655},
  528. /* High bits for white balance*****brightness control*** */
  529. {}
  530. };
  531. static const u16 spca508_sightcam_init_data[][2] = {
  532. /* This line seems to setup the frame/canvas */
  533. {0x000f, 0x8402},
  534. /* These 6 lines are needed to startup the webcam */
  535. {0x0090, 0x8110},
  536. {0x0001, 0x8114},
  537. {0x0001, 0x8114},
  538. {0x0001, 0x8114},
  539. {0x0003, 0x8114},
  540. {0x0080, 0x8804},
  541. /* This part seems to make the pictures darker? (autobrightness?) */
  542. {0x0001, 0x8801},
  543. {0x0004, 0x8800},
  544. {0x0003, 0x8801},
  545. {0x00e0, 0x8800},
  546. {0x0004, 0x8801},
  547. {0x00b4, 0x8800},
  548. {0x0005, 0x8801},
  549. {0x0000, 0x8800},
  550. {0x0006, 0x8801},
  551. {0x00e0, 0x8800},
  552. {0x0007, 0x8801},
  553. {0x000c, 0x8800},
  554. /* This section is just needed, it probably
  555. * does something like the previous section,
  556. * but the cam won't start if it's not included.
  557. */
  558. {0x0014, 0x8801},
  559. {0x0008, 0x8800},
  560. {0x0015, 0x8801},
  561. {0x0067, 0x8800},
  562. {0x0016, 0x8801},
  563. {0x0000, 0x8800},
  564. {0x0017, 0x8801},
  565. {0x0020, 0x8800},
  566. {0x0018, 0x8801},
  567. {0x0044, 0x8800},
  568. /* Makes the picture darker - and the
  569. * cam won't start if not included
  570. */
  571. {0x001e, 0x8801},
  572. {0x00ea, 0x8800},
  573. {0x001f, 0x8801},
  574. {0x0001, 0x8800},
  575. {0x0003, 0x8801},
  576. {0x00e0, 0x8800},
  577. /* seems to place the colors ontop of each other #1 */
  578. {0x0006, 0x8704},
  579. {0x0001, 0x870c},
  580. {0x0016, 0x8600},
  581. {0x0002, 0x8606},
  582. /* if not included the pictures becomes _very_ dark */
  583. {0x0064, 0x8607},
  584. {0x003a, 0x8601},
  585. {0x0000, 0x8602},
  586. /* seems to place the colors ontop of each other #2 */
  587. {0x0016, 0x8600},
  588. {0x0018, 0x8617},
  589. {0x0008, 0x8618},
  590. {0x00a1, 0x8656},
  591. /* webcam won't start if not included */
  592. {0x0007, 0x865b},
  593. {0x0001, 0x865c},
  594. {0x0058, 0x865d},
  595. {0x0048, 0x865e},
  596. /* adjusts the colors */
  597. {0x0049, 0x8651},
  598. {0x0040, 0x8652},
  599. {0x004c, 0x8653},
  600. {0x0040, 0x8654},
  601. {}
  602. };
  603. static const u16 spca508_sightcam2_init_data[][2] = {
  604. {0x0020, 0x8112},
  605. {0x000f, 0x8402},
  606. {0x0000, 0x8403},
  607. {0x0008, 0x8201},
  608. {0x0008, 0x8200},
  609. {0x0001, 0x8200},
  610. {0x0009, 0x8201},
  611. {0x0008, 0x8200},
  612. {0x0001, 0x8200},
  613. {0x000a, 0x8201},
  614. {0x0008, 0x8200},
  615. {0x0001, 0x8200},
  616. {0x000b, 0x8201},
  617. {0x0008, 0x8200},
  618. {0x0001, 0x8200},
  619. {0x000c, 0x8201},
  620. {0x0008, 0x8200},
  621. {0x0001, 0x8200},
  622. {0x000d, 0x8201},
  623. {0x0008, 0x8200},
  624. {0x0001, 0x8200},
  625. {0x000e, 0x8201},
  626. {0x0008, 0x8200},
  627. {0x0001, 0x8200},
  628. {0x0007, 0x8201},
  629. {0x0008, 0x8200},
  630. {0x0001, 0x8200},
  631. {0x000f, 0x8201},
  632. {0x0008, 0x8200},
  633. {0x0001, 0x8200},
  634. {0x0018, 0x8660},
  635. {0x0010, 0x8201},
  636. {0x0008, 0x8200},
  637. {0x0001, 0x8200},
  638. {0x0011, 0x8201},
  639. {0x0008, 0x8200},
  640. {0x0001, 0x8200},
  641. {0x0000, 0x86b0},
  642. {0x0034, 0x86b1},
  643. {0x0000, 0x86b2},
  644. {0x0049, 0x86b3},
  645. {0x0000, 0x86b4},
  646. {0x0000, 0x86b4},
  647. {0x0012, 0x8201},
  648. {0x0008, 0x8200},
  649. {0x0001, 0x8200},
  650. {0x0013, 0x8201},
  651. {0x0008, 0x8200},
  652. {0x0001, 0x8200},
  653. {0x0001, 0x86b0},
  654. {0x00aa, 0x86b1},
  655. {0x0000, 0x86b2},
  656. {0x00e4, 0x86b3},
  657. {0x0000, 0x86b4},
  658. {0x0000, 0x86b4},
  659. {0x0018, 0x8660},
  660. {0x0090, 0x8110},
  661. {0x0001, 0x8114},
  662. {0x0001, 0x8114},
  663. {0x0001, 0x8114},
  664. {0x0003, 0x8114},
  665. {0x0080, 0x8804},
  666. {0x0003, 0x8801},
  667. {0x0012, 0x8800},
  668. {0x0004, 0x8801},
  669. {0x0005, 0x8800},
  670. {0x0005, 0x8801},
  671. {0x0000, 0x8800},
  672. {0x0006, 0x8801},
  673. {0x0000, 0x8800},
  674. {0x0007, 0x8801},
  675. {0x0000, 0x8800},
  676. {0x0008, 0x8801},
  677. {0x0005, 0x8800},
  678. {0x000a, 0x8700},
  679. {0x000e, 0x8801},
  680. {0x0004, 0x8800},
  681. {0x0005, 0x8801},
  682. {0x0047, 0x8800},
  683. {0x0006, 0x8801},
  684. {0x0000, 0x8800},
  685. {0x0007, 0x8801},
  686. {0x00c0, 0x8800},
  687. {0x0008, 0x8801},
  688. {0x0003, 0x8800},
  689. {0x0013, 0x8801},
  690. {0x0001, 0x8800},
  691. {0x0009, 0x8801},
  692. {0x0000, 0x8800},
  693. {0x000a, 0x8801},
  694. {0x0000, 0x8800},
  695. {0x000b, 0x8801},
  696. {0x0000, 0x8800},
  697. {0x000c, 0x8801},
  698. {0x0000, 0x8800},
  699. {0x000e, 0x8801},
  700. {0x0004, 0x8800},
  701. {0x000f, 0x8801},
  702. {0x0000, 0x8800},
  703. {0x0010, 0x8801},
  704. {0x0006, 0x8800},
  705. {0x0011, 0x8801},
  706. {0x0006, 0x8800},
  707. {0x0012, 0x8801},
  708. {0x0000, 0x8800},
  709. {0x0013, 0x8801},
  710. {0x0001, 0x8800},
  711. {0x000a, 0x8700},
  712. {0x0000, 0x8702},
  713. {0x0000, 0x8703},
  714. {0x00c2, 0x8704},
  715. {0x0001, 0x870c},
  716. {0x0044, 0x8600},
  717. {0x0002, 0x8606},
  718. {0x0064, 0x8607},
  719. {0x003a, 0x8601},
  720. {0x0008, 0x8602},
  721. {0x0044, 0x8600},
  722. {0x0018, 0x8617},
  723. {0x0008, 0x8618},
  724. {0x00a1, 0x8656},
  725. {0x0004, 0x865b},
  726. {0x0002, 0x865c},
  727. {0x0058, 0x865d},
  728. {0x0048, 0x865e},
  729. {0x0012, 0x8608},
  730. {0x002c, 0x8609},
  731. {0x0002, 0x860a},
  732. {0x002c, 0x860b},
  733. {0x00db, 0x860c},
  734. {0x00f9, 0x860d},
  735. {0x00f1, 0x860e},
  736. {0x00e3, 0x860f},
  737. {0x002c, 0x8610},
  738. {0x006c, 0x8651},
  739. {0x0041, 0x8652},
  740. {0x0059, 0x8653},
  741. {0x0040, 0x8654},
  742. {0x00fa, 0x8611},
  743. {0x00ff, 0x8612},
  744. {0x00f8, 0x8613},
  745. {0x0000, 0x8614},
  746. {0x0001, 0x863f},
  747. {0x0000, 0x8640},
  748. {0x0026, 0x8641},
  749. {0x0045, 0x8642},
  750. {0x0060, 0x8643},
  751. {0x0075, 0x8644},
  752. {0x0088, 0x8645},
  753. {0x009b, 0x8646},
  754. {0x00b0, 0x8647},
  755. {0x00c5, 0x8648},
  756. {0x00d2, 0x8649},
  757. {0x00dc, 0x864a},
  758. {0x00e5, 0x864b},
  759. {0x00eb, 0x864c},
  760. {0x00f0, 0x864d},
  761. {0x00f6, 0x864e},
  762. {0x00fa, 0x864f},
  763. {0x00ff, 0x8650},
  764. {0x0060, 0x8657},
  765. {0x0010, 0x8658},
  766. {0x0018, 0x8659},
  767. {0x0005, 0x865a},
  768. {0x0018, 0x8660},
  769. {0x0003, 0x8509},
  770. {0x0011, 0x850a},
  771. {0x0032, 0x850b},
  772. {0x0010, 0x850c},
  773. {0x0021, 0x850d},
  774. {0x0001, 0x8500},
  775. {0x0000, 0x8508},
  776. {0x0012, 0x8608},
  777. {0x002c, 0x8609},
  778. {0x0002, 0x860a},
  779. {0x0039, 0x860b},
  780. {0x00d0, 0x860c},
  781. {0x00f7, 0x860d},
  782. {0x00ed, 0x860e},
  783. {0x00db, 0x860f},
  784. {0x0039, 0x8610},
  785. {0x0012, 0x8657},
  786. {0x000c, 0x8619},
  787. {0x0004, 0x861a},
  788. {0x00a1, 0x8656},
  789. {0x00c8, 0x8615},
  790. {0x0032, 0x8616},
  791. {0x0030, 0x8112},
  792. {0x0020, 0x8112},
  793. {0x0020, 0x8112},
  794. {0x000f, 0x8402},
  795. {0x0000, 0x8403},
  796. {0x0090, 0x8110},
  797. {0x0001, 0x8114},
  798. {0x0001, 0x8114},
  799. {0x0001, 0x8114},
  800. {0x0003, 0x8114},
  801. {0x0080, 0x8804},
  802. {0x0003, 0x8801},
  803. {0x0012, 0x8800},
  804. {0x0004, 0x8801},
  805. {0x0005, 0x8800},
  806. {0x0005, 0x8801},
  807. {0x0047, 0x8800},
  808. {0x0006, 0x8801},
  809. {0x0000, 0x8800},
  810. {0x0007, 0x8801},
  811. {0x00c0, 0x8800},
  812. {0x0008, 0x8801},
  813. {0x0003, 0x8800},
  814. {0x000a, 0x8700},
  815. {0x000e, 0x8801},
  816. {0x0004, 0x8800},
  817. {0x0005, 0x8801},
  818. {0x0047, 0x8800},
  819. {0x0006, 0x8801},
  820. {0x0000, 0x8800},
  821. {0x0007, 0x8801},
  822. {0x00c0, 0x8800},
  823. {0x0008, 0x8801},
  824. {0x0003, 0x8800},
  825. {0x0013, 0x8801},
  826. {0x0001, 0x8800},
  827. {0x0009, 0x8801},
  828. {0x0000, 0x8800},
  829. {0x000a, 0x8801},
  830. {0x0000, 0x8800},
  831. {0x000b, 0x8801},
  832. {0x0000, 0x8800},
  833. {0x000c, 0x8801},
  834. {0x0000, 0x8800},
  835. {0x000e, 0x8801},
  836. {0x0004, 0x8800},
  837. {0x000f, 0x8801},
  838. {0x0000, 0x8800},
  839. {0x0010, 0x8801},
  840. {0x0006, 0x8800},
  841. {0x0011, 0x8801},
  842. {0x0006, 0x8800},
  843. {0x0012, 0x8801},
  844. {0x0000, 0x8800},
  845. {0x0013, 0x8801},
  846. {0x0001, 0x8800},
  847. {0x000a, 0x8700},
  848. {0x0000, 0x8702},
  849. {0x0000, 0x8703},
  850. {0x00c2, 0x8704},
  851. {0x0001, 0x870c},
  852. {0x0044, 0x8600},
  853. {0x0002, 0x8606},
  854. {0x0064, 0x8607},
  855. {0x003a, 0x8601},
  856. {0x0008, 0x8602},
  857. {0x0044, 0x8600},
  858. {0x0018, 0x8617},
  859. {0x0008, 0x8618},
  860. {0x00a1, 0x8656},
  861. {0x0004, 0x865b},
  862. {0x0002, 0x865c},
  863. {0x0058, 0x865d},
  864. {0x0048, 0x865e},
  865. {0x0012, 0x8608},
  866. {0x002c, 0x8609},
  867. {0x0002, 0x860a},
  868. {0x002c, 0x860b},
  869. {0x00db, 0x860c},
  870. {0x00f9, 0x860d},
  871. {0x00f1, 0x860e},
  872. {0x00e3, 0x860f},
  873. {0x002c, 0x8610},
  874. {0x006c, 0x8651},
  875. {0x0041, 0x8652},
  876. {0x0059, 0x8653},
  877. {0x0040, 0x8654},
  878. {0x00fa, 0x8611},
  879. {0x00ff, 0x8612},
  880. {0x00f8, 0x8613},
  881. {0x0000, 0x8614},
  882. {0x0001, 0x863f},
  883. {0x0000, 0x8640},
  884. {0x0026, 0x8641},
  885. {0x0045, 0x8642},
  886. {0x0060, 0x8643},
  887. {0x0075, 0x8644},
  888. {0x0088, 0x8645},
  889. {0x009b, 0x8646},
  890. {0x00b0, 0x8647},
  891. {0x00c5, 0x8648},
  892. {0x00d2, 0x8649},
  893. {0x00dc, 0x864a},
  894. {0x00e5, 0x864b},
  895. {0x00eb, 0x864c},
  896. {0x00f0, 0x864d},
  897. {0x00f6, 0x864e},
  898. {0x00fa, 0x864f},
  899. {0x00ff, 0x8650},
  900. {0x0060, 0x8657},
  901. {0x0010, 0x8658},
  902. {0x0018, 0x8659},
  903. {0x0005, 0x865a},
  904. {0x0018, 0x8660},
  905. {0x0003, 0x8509},
  906. {0x0011, 0x850a},
  907. {0x0032, 0x850b},
  908. {0x0010, 0x850c},
  909. {0x0021, 0x850d},
  910. {0x0001, 0x8500},
  911. {0x0000, 0x8508},
  912. {0x0012, 0x8608},
  913. {0x002c, 0x8609},
  914. {0x0002, 0x860a},
  915. {0x0039, 0x860b},
  916. {0x00d0, 0x860c},
  917. {0x00f7, 0x860d},
  918. {0x00ed, 0x860e},
  919. {0x00db, 0x860f},
  920. {0x0039, 0x8610},
  921. {0x0012, 0x8657},
  922. {0x0064, 0x8619},
  923. /* This line starts it all, it is not needed here */
  924. /* since it has been build into the driver */
  925. /* jfm: don't start now */
  926. /* {0x0030, 0x8112}, */
  927. {}
  928. };
  929. /*
  930. * Initialization data for Creative Webcam Vista
  931. */
  932. static const u16 spca508_vista_init_data[][2] = {
  933. {0x0008, 0x8200}, /* Clear register */
  934. {0x0000, 0x870b}, /* Reset CTL3 */
  935. {0x0020, 0x8112}, /* Video Drop packet enable */
  936. {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
  937. {0x0000, 0x8110}, /* Disable everything */
  938. {0x0000, 0x8114}, /* Software GPIO output data */
  939. {0x0000, 0x8114},
  940. {0x0003, 0x8111},
  941. {0x0000, 0x8111},
  942. {0x0090, 0x8110}, /* Enable: SSI output, External 2X clock output */
  943. {0x0020, 0x8112},
  944. {0x0000, 0x8114},
  945. {0x0001, 0x8114},
  946. {0x0001, 0x8114},
  947. {0x0001, 0x8114},
  948. {0x0003, 0x8114},
  949. {0x000f, 0x8402}, /* Memory bank Address */
  950. {0x0000, 0x8403}, /* Memory bank Address */
  951. {0x00ba, 0x8804}, /* SSI Slave address */
  952. {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */
  953. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  954. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  955. {0x0010, 0x8802}, /* Will write 2 bytes (DATA1+DATA2) */
  956. {0x0020, 0x8801}, /* Register address for SSI read/write */
  957. {0x0044, 0x8805}, /* DATA2 */
  958. {0x0004, 0x8800}, /* DATA1 -> write triggered */
  959. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  960. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  961. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  962. {0x0010, 0x8802},
  963. {0x0009, 0x8801},
  964. {0x0042, 0x8805},
  965. {0x0001, 0x8800},
  966. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  967. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  968. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  969. {0x0010, 0x8802},
  970. {0x003c, 0x8801},
  971. {0x0001, 0x8805},
  972. {0x0000, 0x8800},
  973. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  974. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  975. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  976. {0x0010, 0x8802},
  977. {0x0001, 0x8801},
  978. {0x000a, 0x8805},
  979. {0x0000, 0x8800},
  980. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  981. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  982. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  983. {0x0010, 0x8802},
  984. {0x0002, 0x8801},
  985. {0x0000, 0x8805},
  986. {0x0000, 0x8800},
  987. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  988. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  989. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  990. {0x0010, 0x8802},
  991. {0x0003, 0x8801},
  992. {0x0027, 0x8805},
  993. {0x0001, 0x8800},
  994. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  995. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  996. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  997. {0x0010, 0x8802},
  998. {0x0004, 0x8801},
  999. {0x0065, 0x8805},
  1000. {0x0001, 0x8800},
  1001. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1002. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1003. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1004. {0x0010, 0x8802},
  1005. {0x0005, 0x8801},
  1006. {0x0003, 0x8805},
  1007. {0x0000, 0x8800},
  1008. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1009. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1010. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1011. {0x0010, 0x8802},
  1012. {0x0006, 0x8801},
  1013. {0x001c, 0x8805},
  1014. {0x0000, 0x8800},
  1015. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1016. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1017. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1018. {0x0010, 0x8802},
  1019. {0x0007, 0x8801},
  1020. {0x002a, 0x8805},
  1021. {0x0000, 0x8800},
  1022. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1023. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1024. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1025. {0x0010, 0x8802},
  1026. {0x000e, 0x8801},
  1027. {0x0000, 0x8805},
  1028. {0x0000, 0x8800},
  1029. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1030. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1031. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1032. {0x0010, 0x8802},
  1033. {0x0028, 0x8801},
  1034. {0x002e, 0x8805},
  1035. {0x0000, 0x8800},
  1036. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1037. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1038. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1039. {0x0010, 0x8802},
  1040. {0x0039, 0x8801},
  1041. {0x0013, 0x8805},
  1042. {0x0000, 0x8800},
  1043. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1044. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1045. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1046. {0x0010, 0x8802},
  1047. {0x003b, 0x8801},
  1048. {0x000c, 0x8805},
  1049. {0x0000, 0x8800},
  1050. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1051. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1052. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1053. {0x0010, 0x8802},
  1054. {0x0035, 0x8801},
  1055. {0x0028, 0x8805},
  1056. {0x0000, 0x8800},
  1057. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1058. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1059. /* READ { 0x0001, 0x8802 } -> 0000: 10 */
  1060. {0x0010, 0x8802},
  1061. {0x0009, 0x8801},
  1062. {0x0042, 0x8805},
  1063. {0x0001, 0x8800},
  1064. /* READ { 0x0001, 0x8803 } -> 0000: 00 */
  1065. {0x0050, 0x8703},
  1066. {0x0002, 0x8704}, /* External input CKIx1 */
  1067. {0x0001, 0x870c}, /* Select CKOx2 output */
  1068. {0x009a, 0x8600}, /* Line memory Read Counter (L) */
  1069. {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */
  1070. {0x0023, 0x8601},
  1071. {0x0010, 0x8602},
  1072. {0x000a, 0x8603},
  1073. {0x009a, 0x8600},
  1074. {0x0001, 0x865b}, /* 1 Horizontal Offset for Valid Pixel(L) */
  1075. {0x0003, 0x865c}, /* Vertical offset for valid lines (L) */
  1076. {0x0058, 0x865d}, /* Horizontal valid pixels window (L) */
  1077. {0x0048, 0x865e}, /* Vertical valid lines window (L) */
  1078. {0x0000, 0x865f},
  1079. {0x0006, 0x8660},
  1080. /* Enable nibble data input, select nibble input order */
  1081. {0x0013, 0x8608}, /* A11 Coeficients for color correction */
  1082. {0x0028, 0x8609},
  1083. /* Note: these values are confirmed at the end of array */
  1084. {0x0005, 0x860a}, /* ... */
  1085. {0x0025, 0x860b},
  1086. {0x00e1, 0x860c},
  1087. {0x00fa, 0x860d},
  1088. {0x00f4, 0x860e},
  1089. {0x00e8, 0x860f},
  1090. {0x0025, 0x8610}, /* A33 Coef. */
  1091. {0x00fc, 0x8611}, /* White balance offset: R */
  1092. {0x0001, 0x8612}, /* White balance offset: Gr */
  1093. {0x00fe, 0x8613}, /* White balance offset: B */
  1094. {0x0000, 0x8614}, /* White balance offset: Gb */
  1095. {0x0064, 0x8651}, /* R gain for white balance (L) */
  1096. {0x0040, 0x8652}, /* Gr gain for white balance (L) */
  1097. {0x0066, 0x8653}, /* B gain for white balance (L) */
  1098. {0x0040, 0x8654}, /* Gb gain for white balance (L) */
  1099. {0x0001, 0x863f}, /* Enable fixed gamma correction */
  1100. {0x00a1, 0x8656}, /* Size - Window1: 256x256, Window2: 128x128,
  1101. * UV division: UV no change,
  1102. * Enable New edge enhancement */
  1103. {0x0018, 0x8657}, /* Edge gain high threshold */
  1104. {0x0020, 0x8658}, /* Edge gain low threshold */
  1105. {0x000a, 0x8659}, /* Edge bandwidth high threshold */
  1106. {0x0005, 0x865a}, /* Edge bandwidth low threshold */
  1107. {0x0064, 0x8607}, /* UV filter enable */
  1108. {0x0016, 0x8660},
  1109. {0x0000, 0x86b0}, /* Bad pixels compensation address */
  1110. {0x00dc, 0x86b1}, /* X coord for bad pixels compensation (L) */
  1111. {0x0000, 0x86b2},
  1112. {0x0009, 0x86b3}, /* Y coord for bad pixels compensation (L) */
  1113. {0x0000, 0x86b4},
  1114. {0x0001, 0x86b0},
  1115. {0x00f5, 0x86b1},
  1116. {0x0000, 0x86b2},
  1117. {0x00c6, 0x86b3},
  1118. {0x0000, 0x86b4},
  1119. {0x0002, 0x86b0},
  1120. {0x001c, 0x86b1},
  1121. {0x0001, 0x86b2},
  1122. {0x00d7, 0x86b3},
  1123. {0x0000, 0x86b4},
  1124. {0x0003, 0x86b0},
  1125. {0x001c, 0x86b1},
  1126. {0x0001, 0x86b2},
  1127. {0x00d8, 0x86b3},
  1128. {0x0000, 0x86b4},
  1129. {0x0004, 0x86b0},
  1130. {0x001d, 0x86b1},
  1131. {0x0001, 0x86b2},
  1132. {0x00d8, 0x86b3},
  1133. {0x0000, 0x86b4},
  1134. {0x001e, 0x8660},
  1135. /* READ { 0x0000, 0x8608 } -> 0000: 13 */
  1136. /* READ { 0x0000, 0x8609 } -> 0000: 28 */
  1137. /* READ { 0x0000, 0x8610 } -> 0000: 05 */
  1138. /* READ { 0x0000, 0x8611 } -> 0000: 25 */
  1139. /* READ { 0x0000, 0x8612 } -> 0000: e1 */
  1140. /* READ { 0x0000, 0x8613 } -> 0000: fa */
  1141. /* READ { 0x0000, 0x8614 } -> 0000: f4 */
  1142. /* READ { 0x0000, 0x8615 } -> 0000: e8 */
  1143. /* READ { 0x0000, 0x8616 } -> 0000: 25 */
  1144. {}
  1145. };
  1146. static int reg_write(struct gspca_dev *gspca_dev, u16 index, u16 value)
  1147. {
  1148. int ret;
  1149. struct usb_device *dev = gspca_dev->dev;
  1150. ret = usb_control_msg(dev,
  1151. usb_sndctrlpipe(dev, 0),
  1152. 0, /* request */
  1153. USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  1154. value, index, NULL, 0, 500);
  1155. gspca_dbg(gspca_dev, D_USBO, "reg write i:0x%04x = 0x%02x\n",
  1156. index, value);
  1157. if (ret < 0)
  1158. pr_err("reg write: error %d\n", ret);
  1159. return ret;
  1160. }
  1161. /* read 1 byte */
  1162. /* returns: negative is error, pos or zero is data */
  1163. static int reg_read(struct gspca_dev *gspca_dev,
  1164. u16 index) /* wIndex */
  1165. {
  1166. int ret;
  1167. ret = usb_control_msg(gspca_dev->dev,
  1168. usb_rcvctrlpipe(gspca_dev->dev, 0),
  1169. 0, /* register */
  1170. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  1171. 0, /* value */
  1172. index,
  1173. gspca_dev->usb_buf, 1,
  1174. 500); /* timeout */
  1175. gspca_dbg(gspca_dev, D_USBI, "reg read i:%04x --> %02x\n",
  1176. index, gspca_dev->usb_buf[0]);
  1177. if (ret < 0) {
  1178. pr_err("reg_read err %d\n", ret);
  1179. return ret;
  1180. }
  1181. return gspca_dev->usb_buf[0];
  1182. }
  1183. /* send 1 or 2 bytes to the sensor via the Synchronous Serial Interface */
  1184. static int ssi_w(struct gspca_dev *gspca_dev,
  1185. u16 reg, u16 val)
  1186. {
  1187. int ret, retry;
  1188. ret = reg_write(gspca_dev, 0x8802, reg >> 8);
  1189. if (ret < 0)
  1190. goto out;
  1191. ret = reg_write(gspca_dev, 0x8801, reg & 0x00ff);
  1192. if (ret < 0)
  1193. goto out;
  1194. if ((reg & 0xff00) == 0x1000) { /* if 2 bytes */
  1195. ret = reg_write(gspca_dev, 0x8805, val & 0x00ff);
  1196. if (ret < 0)
  1197. goto out;
  1198. val >>= 8;
  1199. }
  1200. ret = reg_write(gspca_dev, 0x8800, val);
  1201. if (ret < 0)
  1202. goto out;
  1203. /* poll until not busy */
  1204. retry = 10;
  1205. for (;;) {
  1206. ret = reg_read(gspca_dev, 0x8803);
  1207. if (ret < 0)
  1208. break;
  1209. if (gspca_dev->usb_buf[0] == 0)
  1210. break;
  1211. if (--retry <= 0) {
  1212. gspca_err(gspca_dev, "ssi_w busy %02x\n",
  1213. gspca_dev->usb_buf[0]);
  1214. ret = -1;
  1215. break;
  1216. }
  1217. msleep(8);
  1218. }
  1219. out:
  1220. return ret;
  1221. }
  1222. static int write_vector(struct gspca_dev *gspca_dev,
  1223. const u16 (*data)[2])
  1224. {
  1225. int ret = 0;
  1226. while ((*data)[1] != 0) {
  1227. if ((*data)[1] & 0x8000) {
  1228. if ((*data)[1] == 0xdd00) /* delay */
  1229. msleep((*data)[0]);
  1230. else
  1231. ret = reg_write(gspca_dev, (*data)[1],
  1232. (*data)[0]);
  1233. } else {
  1234. ret = ssi_w(gspca_dev, (*data)[1], (*data)[0]);
  1235. }
  1236. if (ret < 0)
  1237. break;
  1238. data++;
  1239. }
  1240. return ret;
  1241. }
  1242. /* this function is called at probe time */
  1243. static int sd_config(struct gspca_dev *gspca_dev,
  1244. const struct usb_device_id *id)
  1245. {
  1246. struct sd *sd = (struct sd *) gspca_dev;
  1247. struct cam *cam;
  1248. const u16 (*init_data)[2];
  1249. static const u16 (*(init_data_tb[]))[2] = {
  1250. spca508_vista_init_data, /* CreativeVista 0 */
  1251. spca508_sightcam_init_data, /* HamaUSBSightcam 1 */
  1252. spca508_sightcam2_init_data, /* HamaUSBSightcam2 2 */
  1253. spca508cs110_init_data, /* IntelEasyPCCamera 3 */
  1254. spca508cs110_init_data, /* MicroInnovationIC200 4 */
  1255. spca508_init_data, /* ViewQuestVQ110 5 */
  1256. };
  1257. int data1, data2;
  1258. /* Read from global register the USB product and vendor IDs, just to
  1259. * prove that we can communicate with the device. This works, which
  1260. * confirms at we are communicating properly and that the device
  1261. * is a 508. */
  1262. data1 = reg_read(gspca_dev, 0x8104);
  1263. data2 = reg_read(gspca_dev, 0x8105);
  1264. gspca_dbg(gspca_dev, D_PROBE, "Webcam Vendor ID: 0x%02x%02x\n",
  1265. data2, data1);
  1266. data1 = reg_read(gspca_dev, 0x8106);
  1267. data2 = reg_read(gspca_dev, 0x8107);
  1268. gspca_dbg(gspca_dev, D_PROBE, "Webcam Product ID: 0x%02x%02x\n",
  1269. data2, data1);
  1270. data1 = reg_read(gspca_dev, 0x8621);
  1271. gspca_dbg(gspca_dev, D_PROBE, "Window 1 average luminance: %d\n",
  1272. data1);
  1273. cam = &gspca_dev->cam;
  1274. cam->cam_mode = sif_mode;
  1275. cam->nmodes = ARRAY_SIZE(sif_mode);
  1276. sd->subtype = id->driver_info;
  1277. init_data = init_data_tb[sd->subtype];
  1278. return write_vector(gspca_dev, init_data);
  1279. }
  1280. /* this function is called at probe and resume time */
  1281. static int sd_init(struct gspca_dev *gspca_dev)
  1282. {
  1283. return 0;
  1284. }
  1285. static int sd_start(struct gspca_dev *gspca_dev)
  1286. {
  1287. int mode;
  1288. mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
  1289. reg_write(gspca_dev, 0x8500, mode);
  1290. switch (mode) {
  1291. case 0:
  1292. case 1:
  1293. reg_write(gspca_dev, 0x8700, 0x28); /* clock */
  1294. break;
  1295. default:
  1296. /* case 2: */
  1297. /* case 3: */
  1298. reg_write(gspca_dev, 0x8700, 0x23); /* clock */
  1299. break;
  1300. }
  1301. reg_write(gspca_dev, 0x8112, 0x10 | 0x20);
  1302. return 0;
  1303. }
  1304. static void sd_stopN(struct gspca_dev *gspca_dev)
  1305. {
  1306. /* Video ISO disable, Video Drop Packet enable: */
  1307. reg_write(gspca_dev, 0x8112, 0x20);
  1308. }
  1309. static void sd_pkt_scan(struct gspca_dev *gspca_dev,
  1310. u8 *data, /* isoc packet */
  1311. int len) /* iso packet length */
  1312. {
  1313. switch (data[0]) {
  1314. case 0: /* start of frame */
  1315. gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
  1316. data += SPCA508_OFFSET_DATA;
  1317. len -= SPCA508_OFFSET_DATA;
  1318. gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
  1319. break;
  1320. case 0xff: /* drop */
  1321. break;
  1322. default:
  1323. data += 1;
  1324. len -= 1;
  1325. gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
  1326. break;
  1327. }
  1328. }
  1329. static void setbrightness(struct gspca_dev *gspca_dev, s32 brightness)
  1330. {
  1331. /* MX seem contrast */
  1332. reg_write(gspca_dev, 0x8651, brightness);
  1333. reg_write(gspca_dev, 0x8652, brightness);
  1334. reg_write(gspca_dev, 0x8653, brightness);
  1335. reg_write(gspca_dev, 0x8654, brightness);
  1336. }
  1337. static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
  1338. {
  1339. struct gspca_dev *gspca_dev =
  1340. container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
  1341. gspca_dev->usb_err = 0;
  1342. if (!gspca_dev->streaming)
  1343. return 0;
  1344. switch (ctrl->id) {
  1345. case V4L2_CID_BRIGHTNESS:
  1346. setbrightness(gspca_dev, ctrl->val);
  1347. break;
  1348. }
  1349. return gspca_dev->usb_err;
  1350. }
  1351. static const struct v4l2_ctrl_ops sd_ctrl_ops = {
  1352. .s_ctrl = sd_s_ctrl,
  1353. };
  1354. static int sd_init_controls(struct gspca_dev *gspca_dev)
  1355. {
  1356. struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
  1357. gspca_dev->vdev.ctrl_handler = hdl;
  1358. v4l2_ctrl_handler_init(hdl, 5);
  1359. v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
  1360. V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
  1361. if (hdl->error) {
  1362. pr_err("Could not initialize controls\n");
  1363. return hdl->error;
  1364. }
  1365. return 0;
  1366. }
  1367. /* sub-driver description */
  1368. static const struct sd_desc sd_desc = {
  1369. .name = MODULE_NAME,
  1370. .config = sd_config,
  1371. .init = sd_init,
  1372. .init_controls = sd_init_controls,
  1373. .start = sd_start,
  1374. .stopN = sd_stopN,
  1375. .pkt_scan = sd_pkt_scan,
  1376. };
  1377. /* -- module initialisation -- */
  1378. static const struct usb_device_id device_table[] = {
  1379. {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
  1380. {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
  1381. {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
  1382. {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
  1383. {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
  1384. {USB_DEVICE(0x8086, 0x0110), .driver_info = IntelEasyPCCamera},
  1385. {}
  1386. };
  1387. MODULE_DEVICE_TABLE(usb, device_table);
  1388. /* -- device connect -- */
  1389. static int sd_probe(struct usb_interface *intf,
  1390. const struct usb_device_id *id)
  1391. {
  1392. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  1393. THIS_MODULE);
  1394. }
  1395. static struct usb_driver sd_driver = {
  1396. .name = MODULE_NAME,
  1397. .id_table = device_table,
  1398. .probe = sd_probe,
  1399. .disconnect = gspca_disconnect,
  1400. #ifdef CONFIG_PM
  1401. .suspend = gspca_suspend,
  1402. .resume = gspca_resume,
  1403. .reset_resume = gspca_resume,
  1404. #endif
  1405. };
  1406. module_usb_driver(sd_driver);