spca508.c 41 KB

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