spca508.c 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531
  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. PDEBUG(D_USBO, "reg write i:0x%04x = 0x%02x",
  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. PDEBUG(D_USBI, "reg read i:%04x --> %02x",
  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. PERR("ssi_w busy %02x", gspca_dev->usb_buf[0]);
  1213. ret = -1;
  1214. break;
  1215. }
  1216. msleep(8);
  1217. }
  1218. out:
  1219. return ret;
  1220. }
  1221. static int write_vector(struct gspca_dev *gspca_dev,
  1222. const u16 (*data)[2])
  1223. {
  1224. int ret = 0;
  1225. while ((*data)[1] != 0) {
  1226. if ((*data)[1] & 0x8000) {
  1227. if ((*data)[1] == 0xdd00) /* delay */
  1228. msleep((*data)[0]);
  1229. else
  1230. ret = reg_write(gspca_dev, (*data)[1],
  1231. (*data)[0]);
  1232. } else {
  1233. ret = ssi_w(gspca_dev, (*data)[1], (*data)[0]);
  1234. }
  1235. if (ret < 0)
  1236. break;
  1237. data++;
  1238. }
  1239. return ret;
  1240. }
  1241. /* this function is called at probe time */
  1242. static int sd_config(struct gspca_dev *gspca_dev,
  1243. const struct usb_device_id *id)
  1244. {
  1245. struct sd *sd = (struct sd *) gspca_dev;
  1246. struct cam *cam;
  1247. const u16 (*init_data)[2];
  1248. static const u16 (*(init_data_tb[]))[2] = {
  1249. spca508_vista_init_data, /* CreativeVista 0 */
  1250. spca508_sightcam_init_data, /* HamaUSBSightcam 1 */
  1251. spca508_sightcam2_init_data, /* HamaUSBSightcam2 2 */
  1252. spca508cs110_init_data, /* IntelEasyPCCamera 3 */
  1253. spca508cs110_init_data, /* MicroInnovationIC200 4 */
  1254. spca508_init_data, /* ViewQuestVQ110 5 */
  1255. };
  1256. int data1, data2;
  1257. /* Read from global register the USB product and vendor IDs, just to
  1258. * prove that we can communicate with the device. This works, which
  1259. * confirms at we are communicating properly and that the device
  1260. * is a 508. */
  1261. data1 = reg_read(gspca_dev, 0x8104);
  1262. data2 = reg_read(gspca_dev, 0x8105);
  1263. PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1);
  1264. data1 = reg_read(gspca_dev, 0x8106);
  1265. data2 = reg_read(gspca_dev, 0x8107);
  1266. PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1);
  1267. data1 = reg_read(gspca_dev, 0x8621);
  1268. PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
  1269. cam = &gspca_dev->cam;
  1270. cam->cam_mode = sif_mode;
  1271. cam->nmodes = ARRAY_SIZE(sif_mode);
  1272. sd->subtype = id->driver_info;
  1273. init_data = init_data_tb[sd->subtype];
  1274. return write_vector(gspca_dev, init_data);
  1275. }
  1276. /* this function is called at probe and resume time */
  1277. static int sd_init(struct gspca_dev *gspca_dev)
  1278. {
  1279. return 0;
  1280. }
  1281. static int sd_start(struct gspca_dev *gspca_dev)
  1282. {
  1283. int mode;
  1284. mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
  1285. reg_write(gspca_dev, 0x8500, mode);
  1286. switch (mode) {
  1287. case 0:
  1288. case 1:
  1289. reg_write(gspca_dev, 0x8700, 0x28); /* clock */
  1290. break;
  1291. default:
  1292. /* case 2: */
  1293. /* case 3: */
  1294. reg_write(gspca_dev, 0x8700, 0x23); /* clock */
  1295. break;
  1296. }
  1297. reg_write(gspca_dev, 0x8112, 0x10 | 0x20);
  1298. return 0;
  1299. }
  1300. static void sd_stopN(struct gspca_dev *gspca_dev)
  1301. {
  1302. /* Video ISO disable, Video Drop Packet enable: */
  1303. reg_write(gspca_dev, 0x8112, 0x20);
  1304. }
  1305. static void sd_pkt_scan(struct gspca_dev *gspca_dev,
  1306. u8 *data, /* isoc packet */
  1307. int len) /* iso packet length */
  1308. {
  1309. switch (data[0]) {
  1310. case 0: /* start of frame */
  1311. gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
  1312. data += SPCA508_OFFSET_DATA;
  1313. len -= SPCA508_OFFSET_DATA;
  1314. gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
  1315. break;
  1316. case 0xff: /* drop */
  1317. break;
  1318. default:
  1319. data += 1;
  1320. len -= 1;
  1321. gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
  1322. break;
  1323. }
  1324. }
  1325. static void setbrightness(struct gspca_dev *gspca_dev, s32 brightness)
  1326. {
  1327. /* MX seem contrast */
  1328. reg_write(gspca_dev, 0x8651, brightness);
  1329. reg_write(gspca_dev, 0x8652, brightness);
  1330. reg_write(gspca_dev, 0x8653, brightness);
  1331. reg_write(gspca_dev, 0x8654, brightness);
  1332. }
  1333. static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
  1334. {
  1335. struct gspca_dev *gspca_dev =
  1336. container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
  1337. gspca_dev->usb_err = 0;
  1338. if (!gspca_dev->streaming)
  1339. return 0;
  1340. switch (ctrl->id) {
  1341. case V4L2_CID_BRIGHTNESS:
  1342. setbrightness(gspca_dev, ctrl->val);
  1343. break;
  1344. }
  1345. return gspca_dev->usb_err;
  1346. }
  1347. static const struct v4l2_ctrl_ops sd_ctrl_ops = {
  1348. .s_ctrl = sd_s_ctrl,
  1349. };
  1350. static int sd_init_controls(struct gspca_dev *gspca_dev)
  1351. {
  1352. struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
  1353. gspca_dev->vdev.ctrl_handler = hdl;
  1354. v4l2_ctrl_handler_init(hdl, 5);
  1355. v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
  1356. V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
  1357. if (hdl->error) {
  1358. pr_err("Could not initialize controls\n");
  1359. return hdl->error;
  1360. }
  1361. return 0;
  1362. }
  1363. /* sub-driver description */
  1364. static const struct sd_desc sd_desc = {
  1365. .name = MODULE_NAME,
  1366. .config = sd_config,
  1367. .init = sd_init,
  1368. .init_controls = sd_init_controls,
  1369. .start = sd_start,
  1370. .stopN = sd_stopN,
  1371. .pkt_scan = sd_pkt_scan,
  1372. };
  1373. /* -- module initialisation -- */
  1374. static const struct usb_device_id device_table[] = {
  1375. {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
  1376. {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
  1377. {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
  1378. {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
  1379. {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
  1380. {USB_DEVICE(0x8086, 0x0110), .driver_info = IntelEasyPCCamera},
  1381. {}
  1382. };
  1383. MODULE_DEVICE_TABLE(usb, device_table);
  1384. /* -- device connect -- */
  1385. static int sd_probe(struct usb_interface *intf,
  1386. const struct usb_device_id *id)
  1387. {
  1388. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  1389. THIS_MODULE);
  1390. }
  1391. static struct usb_driver sd_driver = {
  1392. .name = MODULE_NAME,
  1393. .id_table = device_table,
  1394. .probe = sd_probe,
  1395. .disconnect = gspca_disconnect,
  1396. #ifdef CONFIG_PM
  1397. .suspend = gspca_suspend,
  1398. .resume = gspca_resume,
  1399. .reset_resume = gspca_resume,
  1400. #endif
  1401. };
  1402. module_usb_driver(sd_driver);