spca508.c 41 KB

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