spca508.c 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673
  1. /*
  2. * SPCA508 chip based cameras subdriver
  3. *
  4. * V4L2 by 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. unsigned char brightness;
  29. char 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 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_TYPE 1
  80. #define SPCA508_OFFSET_COMPRESS 2
  81. #define SPCA508_OFFSET_FRAMSEQ 8
  82. #define SPCA508_OFFSET_WIN1LUM 11
  83. #define SPCA508_OFFSET_DATA 37
  84. #define SPCA508_SNAPBIT 0x20
  85. #define SPCA508_SNAPCTRL 0x40
  86. /*************** I2c ****************/
  87. #define SPCA508_INDEX_I2C_BASE 0x8800
  88. /*
  89. * Initialization data: this is the first set-up data written to the
  90. * device (before the open data).
  91. */
  92. static const u16 spca508_init_data[][2] =
  93. {
  94. /* line URB value, index */
  95. /* 44274 1804 */ {0x0000, 0x870b},
  96. /* 44299 1805 */ {0x0020, 0x8112},
  97. /* Video drop enable, ISO streaming disable */
  98. /* 44324 1806 */ {0x0003, 0x8111},
  99. /* Reset compression & memory */
  100. /* 44349 1807 */ {0x0000, 0x8110},
  101. /* Disable all outputs */
  102. /* 44372 1808 */ /* READ {0x0000, 0x8114} -> 0000: 00 */
  103. /* 44398 1809 */ {0x0000, 0x8114},
  104. /* SW GPIO data */
  105. /* 44423 1810 */ {0x0008, 0x8110},
  106. /* Enable charge pump output */
  107. /* 44527 1811 */ {0x0002, 0x8116},
  108. /* 200 kHz pump clock */
  109. /* 44555 1812 */
  110. /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE:) */
  111. /* 44590 1813 */ {0x0003, 0x8111},
  112. /* Reset compression & memory */
  113. /* 44615 1814 */ {0x0000, 0x8111},
  114. /* Normal mode (not reset) */
  115. /* 44640 1815 */ {0x0098, 0x8110},
  116. /* Enable charge pump output, sync.serial,external 2x clock */
  117. /* 44665 1816 */ {0x000d, 0x8114},
  118. /* SW GPIO data */
  119. /* 44690 1817 */ {0x0002, 0x8116},
  120. /* 200 kHz pump clock */
  121. /* 44715 1818 */ {0x0020, 0x8112},
  122. /* Video drop enable, ISO streaming disable */
  123. /* --------------------------------------- */
  124. /* 44740 1819 */ {0x000f, 0x8402},
  125. /* memory bank */
  126. /* 44765 1820 */ {0x0000, 0x8403},
  127. /* ... address */
  128. /* --------------------------------------- */
  129. /* 0x88__ is Synchronous Serial Interface. */
  130. /* TBD: This table could be expressed more compactly */
  131. /* using spca508_write_i2c_vector(). */
  132. /* TBD: Should see if the values in spca50x_i2c_data */
  133. /* would work with the VQ110 instead of the values */
  134. /* below. */
  135. /* 44790 1821 */ {0x00c0, 0x8804},
  136. /* SSI slave addr */
  137. /* 44815 1822 */ {0x0008, 0x8802},
  138. /* 375 Khz SSI clock */
  139. /* 44838 1823 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  140. /* 44862 1824 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  141. /* 44888 1825 */ {0x0008, 0x8802},
  142. /* 375 Khz SSI clock */
  143. /* 44913 1826 */ {0x0012, 0x8801},
  144. /* SSI reg addr */
  145. /* 44938 1827 */ {0x0080, 0x8800},
  146. /* SSI data to write */
  147. /* 44961 1828 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  148. /* 44985 1829 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  149. /* 45009 1830 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  150. /* 45035 1831 */ {0x0008, 0x8802},
  151. /* 375 Khz SSI clock */
  152. /* 45060 1832 */ {0x0012, 0x8801},
  153. /* SSI reg addr */
  154. /* 45085 1833 */ {0x0000, 0x8800},
  155. /* SSI data to write */
  156. /* 45108 1834 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  157. /* 45132 1835 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  158. /* 45156 1836 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  159. /* 45182 1837 */ {0x0008, 0x8802},
  160. /* 375 Khz SSI clock */
  161. /* 45207 1838 */ {0x0011, 0x8801},
  162. /* SSI reg addr */
  163. /* 45232 1839 */ {0x0040, 0x8800},
  164. /* SSI data to write */
  165. /* 45255 1840 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  166. /* 45279 1841 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  167. /* 45303 1842 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  168. /* 45329 1843 */ {0x0008, 0x8802},
  169. /* 45354 1844 */ {0x0013, 0x8801},
  170. /* 45379 1845 */ {0x0000, 0x8800},
  171. /* 45402 1846 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  172. /* 45426 1847 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  173. /* 45450 1848 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  174. /* 45476 1849 */ {0x0008, 0x8802},
  175. /* 45501 1850 */ {0x0014, 0x8801},
  176. /* 45526 1851 */ {0x0000, 0x8800},
  177. /* 45549 1852 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  178. /* 45573 1853 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  179. /* 45597 1854 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  180. /* 45623 1855 */ {0x0008, 0x8802},
  181. /* 45648 1856 */ {0x0015, 0x8801},
  182. /* 45673 1857 */ {0x0001, 0x8800},
  183. /* 45696 1858 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  184. /* 45720 1859 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  185. /* 45744 1860 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  186. /* 45770 1861 */ {0x0008, 0x8802},
  187. /* 45795 1862 */ {0x0016, 0x8801},
  188. /* 45820 1863 */ {0x0003, 0x8800},
  189. /* 45843 1864 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  190. /* 45867 1865 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  191. /* 45891 1866 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  192. /* 45917 1867 */ {0x0008, 0x8802},
  193. /* 45942 1868 */ {0x0017, 0x8801},
  194. /* 45967 1869 */ {0x0036, 0x8800},
  195. /* 45990 1870 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  196. /* 46014 1871 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  197. /* 46038 1872 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  198. /* 46064 1873 */ {0x0008, 0x8802},
  199. /* 46089 1874 */ {0x0018, 0x8801},
  200. /* 46114 1875 */ {0x00ec, 0x8800},
  201. /* 46137 1876 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  202. /* 46161 1877 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  203. /* 46185 1878 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  204. /* 46211 1879 */ {0x0008, 0x8802},
  205. /* 46236 1880 */ {0x001a, 0x8801},
  206. /* 46261 1881 */ {0x0094, 0x8800},
  207. /* 46284 1882 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  208. /* 46308 1883 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  209. /* 46332 1884 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  210. /* 46358 1885 */ {0x0008, 0x8802},
  211. /* 46383 1886 */ {0x001b, 0x8801},
  212. /* 46408 1887 */ {0x0000, 0x8800},
  213. /* 46431 1888 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  214. /* 46455 1889 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  215. /* 46479 1890 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  216. /* 46505 1891 */ {0x0008, 0x8802},
  217. /* 46530 1892 */ {0x0027, 0x8801},
  218. /* 46555 1893 */ {0x00a2, 0x8800},
  219. /* 46578 1894 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  220. /* 46602 1895 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  221. /* 46626 1896 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  222. /* 46652 1897 */ {0x0008, 0x8802},
  223. /* 46677 1898 */ {0x0028, 0x8801},
  224. /* 46702 1899 */ {0x0040, 0x8800},
  225. /* 46725 1900 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  226. /* 46749 1901 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  227. /* 46773 1902 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  228. /* 46799 1903 */ {0x0008, 0x8802},
  229. /* 46824 1904 */ {0x002a, 0x8801},
  230. /* 46849 1905 */ {0x0084, 0x8800},
  231. /* 46872 1906 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  232. /* 46896 1907 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  233. /* 46920 1908 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  234. /* 46946 1909 */ {0x0008, 0x8802},
  235. /* 46971 1910 */ {0x002b, 0x8801},
  236. /* 46996 1911 */ {0x00a8, 0x8800},
  237. /* 47019 1912 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  238. /* 47043 1913 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  239. /* 47067 1914 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  240. /* 47093 1915 */ {0x0008, 0x8802},
  241. /* 47118 1916 */ {0x002c, 0x8801},
  242. /* 47143 1917 */ {0x00fe, 0x8800},
  243. /* 47166 1918 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  244. /* 47190 1919 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  245. /* 47214 1920 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  246. /* 47240 1921 */ {0x0008, 0x8802},
  247. /* 47265 1922 */ {0x002d, 0x8801},
  248. /* 47290 1923 */ {0x0003, 0x8800},
  249. /* 47313 1924 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  250. /* 47337 1925 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  251. /* 47361 1926 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  252. /* 47387 1927 */ {0x0008, 0x8802},
  253. /* 47412 1928 */ {0x0038, 0x8801},
  254. /* 47437 1929 */ {0x0083, 0x8800},
  255. /* 47460 1930 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  256. /* 47484 1931 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  257. /* 47508 1932 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  258. /* 47534 1933 */ {0x0008, 0x8802},
  259. /* 47559 1934 */ {0x0033, 0x8801},
  260. /* 47584 1935 */ {0x0081, 0x8800},
  261. /* 47607 1936 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  262. /* 47631 1937 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  263. /* 47655 1938 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  264. /* 47681 1939 */ {0x0008, 0x8802},
  265. /* 47706 1940 */ {0x0034, 0x8801},
  266. /* 47731 1941 */ {0x004a, 0x8800},
  267. /* 47754 1942 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  268. /* 47778 1943 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  269. /* 47802 1944 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  270. /* 47828 1945 */ {0x0008, 0x8802},
  271. /* 47853 1946 */ {0x0039, 0x8801},
  272. /* 47878 1947 */ {0x0000, 0x8800},
  273. /* 47901 1948 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  274. /* 47925 1949 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  275. /* 47949 1950 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  276. /* 47975 1951 */ {0x0008, 0x8802},
  277. /* 48000 1952 */ {0x0010, 0x8801},
  278. /* 48025 1953 */ {0x00a8, 0x8800},
  279. /* 48048 1954 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  280. /* 48072 1955 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  281. /* 48096 1956 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  282. /* 48122 1957 */ {0x0008, 0x8802},
  283. /* 48147 1958 */ {0x0006, 0x8801},
  284. /* 48172 1959 */ {0x0058, 0x8800},
  285. /* 48195 1960 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  286. /* 48219 1961 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  287. /* 48243 1962 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  288. /* 48269 1963 */ {0x0008, 0x8802},
  289. /* 48294 1964 */ {0x0000, 0x8801},
  290. /* 48319 1965 */ {0x0004, 0x8800},
  291. /* 48342 1966 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  292. /* 48366 1967 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  293. /* 48390 1968 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  294. /* 48416 1969 */ {0x0008, 0x8802},
  295. /* 48441 1970 */ {0x0040, 0x8801},
  296. /* 48466 1971 */ {0x0080, 0x8800},
  297. /* 48489 1972 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  298. /* 48513 1973 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  299. /* 48537 1974 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  300. /* 48563 1975 */ {0x0008, 0x8802},
  301. /* 48588 1976 */ {0x0041, 0x8801},
  302. /* 48613 1977 */ {0x000c, 0x8800},
  303. /* 48636 1978 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  304. /* 48660 1979 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  305. /* 48684 1980 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  306. /* 48710 1981 */ {0x0008, 0x8802},
  307. /* 48735 1982 */ {0x0042, 0x8801},
  308. /* 48760 1983 */ {0x000c, 0x8800},
  309. /* 48783 1984 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  310. /* 48807 1985 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  311. /* 48831 1986 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  312. /* 48857 1987 */ {0x0008, 0x8802},
  313. /* 48882 1988 */ {0x0043, 0x8801},
  314. /* 48907 1989 */ {0x0028, 0x8800},
  315. /* 48930 1990 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  316. /* 48954 1991 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  317. /* 48978 1992 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  318. /* 49004 1993 */ {0x0008, 0x8802},
  319. /* 49029 1994 */ {0x0044, 0x8801},
  320. /* 49054 1995 */ {0x0080, 0x8800},
  321. /* 49077 1996 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  322. /* 49101 1997 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  323. /* 49125 1998 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  324. /* 49151 1999 */ {0x0008, 0x8802},
  325. /* 49176 2000 */ {0x0045, 0x8801},
  326. /* 49201 2001 */ {0x0020, 0x8800},
  327. /* 49224 2002 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  328. /* 49248 2003 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  329. /* 49272 2004 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  330. /* 49298 2005 */ {0x0008, 0x8802},
  331. /* 49323 2006 */ {0x0046, 0x8801},
  332. /* 49348 2007 */ {0x0020, 0x8800},
  333. /* 49371 2008 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  334. /* 49395 2009 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  335. /* 49419 2010 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  336. /* 49445 2011 */ {0x0008, 0x8802},
  337. /* 49470 2012 */ {0x0047, 0x8801},
  338. /* 49495 2013 */ {0x0080, 0x8800},
  339. /* 49518 2014 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  340. /* 49542 2015 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  341. /* 49566 2016 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  342. /* 49592 2017 */ {0x0008, 0x8802},
  343. /* 49617 2018 */ {0x0048, 0x8801},
  344. /* 49642 2019 */ {0x004c, 0x8800},
  345. /* 49665 2020 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  346. /* 49689 2021 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  347. /* 49713 2022 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  348. /* 49739 2023 */ {0x0008, 0x8802},
  349. /* 49764 2024 */ {0x0049, 0x8801},
  350. /* 49789 2025 */ {0x0084, 0x8800},
  351. /* 49812 2026 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  352. /* 49836 2027 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  353. /* 49860 2028 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  354. /* 49886 2029 */ {0x0008, 0x8802},
  355. /* 49911 2030 */ {0x004a, 0x8801},
  356. /* 49936 2031 */ {0x0084, 0x8800},
  357. /* 49959 2032 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  358. /* 49983 2033 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  359. /* 50007 2034 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  360. /* 50033 2035 */ {0x0008, 0x8802},
  361. /* 50058 2036 */ {0x004b, 0x8801},
  362. /* 50083 2037 */ {0x0084, 0x8800},
  363. /* 50106 2038 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  364. /* --------------------------------------- */
  365. /* 50132 2039 */ {0x0012, 0x8700},
  366. /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
  367. /* 50157 2040 */ {0x0000, 0x8701},
  368. /* CKx1 clock delay adj */
  369. /* 50182 2041 */ {0x0000, 0x8701},
  370. /* CKx1 clock delay adj */
  371. /* 50207 2042 */ {0x0001, 0x870c},
  372. /* CKOx2 output */
  373. /* --------------------------------------- */
  374. /* 50232 2043 */ {0x0080, 0x8600},
  375. /* Line memory read counter (L) */
  376. /* 50257 2044 */ {0x0001, 0x8606},
  377. /* reserved */
  378. /* 50282 2045 */ {0x0064, 0x8607},
  379. /* Line memory read counter (H) 0x6480=25,728 */
  380. /* 50307 2046 */ {0x002a, 0x8601},
  381. /* CDSP sharp interpolation mode,
  382. * line sel for color sep, edge enhance enab */
  383. /* 50332 2047 */ {0x0000, 0x8602},
  384. /* optical black level for user settng = 0 */
  385. /* 50357 2048 */ {0x0080, 0x8600},
  386. /* Line memory read counter (L) */
  387. /* 50382 2049 */ {0x000a, 0x8603},
  388. /* optical black level calc mode: auto; optical black offset = 10 */
  389. /* 50407 2050 */ {0x00df, 0x865b},
  390. /* Horiz offset for valid pixels (L)=0xdf */
  391. /* 50432 2051 */ {0x0012, 0x865c},
  392. /* Vert offset for valid lines (L)=0x12 */
  393. /* The following two lines seem to be the "wrong" resolution. */
  394. /* But perhaps these indicate the actual size of the sensor */
  395. /* rather than the size of the current video mode. */
  396. /* 50457 2052 */ {0x0058, 0x865d},
  397. /* Horiz valid pixels (*4) (L) = 352 */
  398. /* 50482 2053 */ {0x0048, 0x865e},
  399. /* Vert valid lines (*4) (L) = 288 */
  400. /* 50507 2054 */ {0x0015, 0x8608},
  401. /* A11 Coef ... */
  402. /* 50532 2055 */ {0x0030, 0x8609},
  403. /* 50557 2056 */ {0x00fb, 0x860a},
  404. /* 50582 2057 */ {0x003e, 0x860b},
  405. /* 50607 2058 */ {0x00ce, 0x860c},
  406. /* 50632 2059 */ {0x00f4, 0x860d},
  407. /* 50657 2060 */ {0x00eb, 0x860e},
  408. /* 50682 2061 */ {0x00dc, 0x860f},
  409. /* 50707 2062 */ {0x0039, 0x8610},
  410. /* 50732 2063 */ {0x0001, 0x8611},
  411. /* R offset for white balance ... */
  412. /* 50757 2064 */ {0x0000, 0x8612},
  413. /* 50782 2065 */ {0x0001, 0x8613},
  414. /* 50807 2066 */ {0x0000, 0x8614},
  415. /* 50832 2067 */ {0x005b, 0x8651},
  416. /* R gain for white balance ... */
  417. /* 50857 2068 */ {0x0040, 0x8652},
  418. /* 50882 2069 */ {0x0060, 0x8653},
  419. /* 50907 2070 */ {0x0040, 0x8654},
  420. /* 50932 2071 */ {0x0000, 0x8655},
  421. /* 50957 2072 */ {0x0001, 0x863f},
  422. /* Fixed gamma correction enable, USB control,
  423. * lum filter disable, lum noise clip disable */
  424. /* 50982 2073 */ {0x00a1, 0x8656},
  425. /* Window1 size 256x256, Windows2 size 64x64,
  426. * gamma look-up disable, new edge enhancement enable */
  427. /* 51007 2074 */ {0x0018, 0x8657},
  428. /* Edge gain high thresh */
  429. /* 51032 2075 */ {0x0020, 0x8658},
  430. /* Edge gain low thresh */
  431. /* 51057 2076 */ {0x000a, 0x8659},
  432. /* Edge bandwidth high threshold */
  433. /* 51082 2077 */ {0x0005, 0x865a},
  434. /* Edge bandwidth low threshold */
  435. /* -------------------------------- */
  436. /* 51107 2078 */ {0x0030, 0x8112},
  437. /* Video drop enable, ISO streaming enable */
  438. /* 51130 2079 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  439. /* 51154 2080 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  440. /* 51180 2081 */ {0xa908, 0x8802},
  441. /* 51205 2082 */ {0x0034, 0x8801},
  442. /* SSI reg addr */
  443. /* 51230 2083 */ {0x00ca, 0x8800},
  444. /* SSI data to write */
  445. /* 51253 2084 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  446. /* 51277 2085 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  447. /* 51301 2086 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  448. /* 51327 2087 */ {0x1f08, 0x8802},
  449. /* 51352 2088 */ {0x0006, 0x8801},
  450. /* 51377 2089 */ {0x0080, 0x8800},
  451. /* 51400 2090 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  452. /* ----- Read back coefs we wrote earlier. */
  453. /* 51424 2091 */ /* READ { 0, 0x0000, 0x8608 } -> 0000: 15 */
  454. /* 51448 2092 */ /* READ { 0, 0x0000, 0x8609 } -> 0000: 30 */
  455. /* 51472 2093 */ /* READ { 0, 0x0000, 0x860a } -> 0000: fb */
  456. /* 51496 2094 */ /* READ { 0, 0x0000, 0x860b } -> 0000: 3e */
  457. /* 51520 2095 */ /* READ { 0, 0x0000, 0x860c } -> 0000: ce */
  458. /* 51544 2096 */ /* READ { 0, 0x0000, 0x860d } -> 0000: f4 */
  459. /* 51568 2097 */ /* READ { 0, 0x0000, 0x860e } -> 0000: eb */
  460. /* 51592 2098 */ /* READ { 0, 0x0000, 0x860f } -> 0000: dc */
  461. /* 51616 2099 */ /* READ { 0, 0x0000, 0x8610 } -> 0000: 39 */
  462. /* 51640 2100 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  463. /* 51664 2101 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 08 */
  464. /* 51690 2102 */ {0xb008, 0x8802},
  465. /* 51715 2103 */ {0x0006, 0x8801},
  466. /* 51740 2104 */ {0x007d, 0x8800},
  467. /* 51763 2105 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  468. /* This chunk is seemingly redundant with */
  469. /* earlier commands (A11 Coef...), but if I disable it, */
  470. /* the image appears too dark. Maybe there was some kind of */
  471. /* reset since the earlier commands, so this is necessary again. */
  472. /* 51789 2106 */ {0x0015, 0x8608},
  473. /* 51814 2107 */ {0x0030, 0x8609},
  474. /* 51839 2108 */ {0xfffb, 0x860a},
  475. /* 51864 2109 */ {0x003e, 0x860b},
  476. /* 51889 2110 */ {0xffce, 0x860c},
  477. /* 51914 2111 */ {0xfff4, 0x860d},
  478. /* 51939 2112 */ {0xffeb, 0x860e},
  479. /* 51964 2113 */ {0xffdc, 0x860f},
  480. /* 51989 2114 */ {0x0039, 0x8610},
  481. /* 52014 2115 */ {0x0018, 0x8657},
  482. /* 52039 2116 */ {0x0000, 0x8508},
  483. /* Disable compression. */
  484. /* Previous line was:
  485. * 52039 2116 * { 0, 0x0021, 0x8508 }, * Enable compression. */
  486. /* 52064 2117 */ {0x0032, 0x850b},
  487. /* compression stuff */
  488. /* 52089 2118 */ {0x0003, 0x8509},
  489. /* compression stuff */
  490. /* 52114 2119 */ {0x0011, 0x850a},
  491. /* compression stuff */
  492. /* 52139 2120 */ {0x0021, 0x850d},
  493. /* compression stuff */
  494. /* 52164 2121 */ {0x0010, 0x850c},
  495. /* compression stuff */
  496. /* 52189 2122 */ {0x0003, 0x8500},
  497. /* *** Video mode: 160x120 */
  498. /* 52214 2123 */ {0x0001, 0x8501},
  499. /* Hardware-dominated snap control */
  500. /* 52239 2124 */ {0x0061, 0x8656},
  501. /* Window1 size 128x128, Windows2 size 128x128,
  502. * gamma look-up disable, new edge enhancement enable */
  503. /* 52264 2125 */ {0x0018, 0x8617},
  504. /* Window1 start X (*2) */
  505. /* 52289 2126 */ {0x0008, 0x8618},
  506. /* Window1 start Y (*2) */
  507. /* 52314 2127 */ {0x0061, 0x8656},
  508. /* Window1 size 128x128, Windows2 size 128x128,
  509. * gamma look-up disable, new edge enhancement enable */
  510. /* 52339 2128 */ {0x0058, 0x8619},
  511. /* Window2 start X (*2) */
  512. /* 52364 2129 */ {0x0008, 0x861a},
  513. /* Window2 start Y (*2) */
  514. /* 52389 2130 */ {0x00ff, 0x8615},
  515. /* High lum thresh for white balance */
  516. /* 52414 2131 */ {0x0000, 0x8616},
  517. /* Low lum thresh for white balance */
  518. /* 52439 2132 */ {0x0012, 0x8700},
  519. /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
  520. /* 52464 2133 */ {0x0012, 0x8700},
  521. /* Clock speed 48Mhz/(2+2)/2= 6 Mhz */
  522. /* 52487 2134 */ /* READ { 0, 0x0000, 0x8656 } -> 0000: 61 */
  523. /* 52513 2135 */ {0x0028, 0x8802},
  524. /* 375 Khz SSI clock, SSI r/w sync with VSYNC */
  525. /* 52536 2136 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  526. /* 52560 2137 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */
  527. /* 52586 2138 */ {0x1f28, 0x8802},
  528. /* 375 Khz SSI clock, SSI r/w sync with VSYNC */
  529. /* 52611 2139 */ {0x0010, 0x8801},
  530. /* SSI reg addr */
  531. /* 52636 2140 */ {0x003e, 0x8800},
  532. /* SSI data to write */
  533. /* 52659 2141 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  534. /* 52685 2142 */ {0x0028, 0x8802},
  535. /* 52708 2143 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  536. /* 52732 2144 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */
  537. /* 52758 2145 */ {0x1f28, 0x8802},
  538. /* 52783 2146 */ {0x0000, 0x8801},
  539. /* 52808 2147 */ {0x001f, 0x8800},
  540. /* 52831 2148 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  541. /* 52857 2149 */ {0x0001, 0x8602},
  542. /* optical black level for user settning = 1 */
  543. /* Original: */
  544. /* 52882 2150 */ {0x0023, 0x8700},
  545. /* Clock speed 48Mhz/(3+2)/4= 2.4 Mhz */
  546. /* 52907 2151 */ {0x000f, 0x8602},
  547. /* optical black level for user settning = 15 */
  548. /* 52932 2152 */ {0x0028, 0x8802},
  549. /* 52955 2153 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  550. /* 52979 2154 */ /* READ { 0, 0x0001, 0x8802 } -> 0000: 28 */
  551. /* 53005 2155 */ {0x1f28, 0x8802},
  552. /* 53030 2156 */ {0x0010, 0x8801},
  553. /* 53055 2157 */ {0x007b, 0x8800},
  554. /* 53078 2158 */ /* READ { 0, 0x0001, 0x8803 } -> 0000: 00 */
  555. /* 53104 2159 */ {0x002f, 0x8651},
  556. /* R gain for white balance ... */
  557. /* 53129 2160 */ {0x0080, 0x8653},
  558. /* 53152 2161 */ /* READ { 0, 0x0000, 0x8655 } -> 0000: 00 */
  559. /* 53178 2162 */ {0x0000, 0x8655},
  560. /* 53203 2163 */ {0x0030, 0x8112},
  561. /* Video drop enable, ISO streaming enable */
  562. /* 53228 2164 */ {0x0020, 0x8112},
  563. /* Video drop enable, ISO streaming disable */
  564. /* 53252 2165 */
  565. /* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE: (ALT=0) ) */
  566. {}
  567. };
  568. /*
  569. * Initialization data for Intel EasyPC Camera CS110
  570. */
  571. static const u16 spca508cs110_init_data[][2] = {
  572. {0x0000, 0x870b}, /* Reset CTL3 */
  573. {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
  574. {0x0000, 0x8111}, /* Normal operation on reset */
  575. {0x0090, 0x8110},
  576. /* External Clock 2x & Synchronous Serial Interface Output */
  577. {0x0020, 0x8112}, /* Video Drop packet enable */
  578. {0x0000, 0x8114}, /* Software GPIO output data */
  579. {0x0001, 0x8114},
  580. {0x0001, 0x8114},
  581. {0x0001, 0x8114},
  582. {0x0003, 0x8114},
  583. /* Initial sequence Synchronous Serial Interface */
  584. {0x000f, 0x8402}, /* Memory bank Address */
  585. {0x0000, 0x8403}, /* Memory bank Address */
  586. {0x00ba, 0x8804}, /* SSI Slave address */
  587. {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */
  588. {0x0010, 0x8802}, /* 93.75kHz SSI Clock two DataByte */
  589. {0x0001, 0x8801},
  590. {0x000a, 0x8805},/* a - NWG: Dunno what this is about */
  591. {0x0000, 0x8800},
  592. {0x0010, 0x8802},
  593. {0x0002, 0x8801},
  594. {0x0000, 0x8805},
  595. {0x0000, 0x8800},
  596. {0x0010, 0x8802},
  597. {0x0003, 0x8801},
  598. {0x0027, 0x8805},
  599. {0x0001, 0x8800},
  600. {0x0010, 0x8802},
  601. {0x0004, 0x8801},
  602. {0x0065, 0x8805},
  603. {0x0001, 0x8800},
  604. {0x0010, 0x8802},
  605. {0x0005, 0x8801},
  606. {0x0003, 0x8805},
  607. {0x0000, 0x8800},
  608. {0x0010, 0x8802},
  609. {0x0006, 0x8801},
  610. {0x001c, 0x8805},
  611. {0x0000, 0x8800},
  612. {0x0010, 0x8802},
  613. {0x0007, 0x8801},
  614. {0x002a, 0x8805},
  615. {0x0000, 0x8800},
  616. {0x0010, 0x8802},
  617. {0x0002, 0x8704}, /* External input CKIx1 */
  618. {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */
  619. {0x009a, 0x8600}, /* Line memory Read Counter (L) */
  620. {0x0001, 0x865b}, /* 1 Horizontal Offset for Valid Pixel(L) */
  621. {0x0003, 0x865c}, /* 3 Vertical Offset for Valid Lines(L) */
  622. {0x0058, 0x865d}, /* 58 Horizontal Valid Pixel Window(L) */
  623. {0x0006, 0x8660}, /* Nibble data + input order */
  624. {0x000a, 0x8602}, /* Optical black level set to 0x0a */
  625. /* 1945 */ {0x0000, 0x8603}, /* Optical black level Offset */
  626. /* 1962 * {0, 0x0000, 0x8611}, * 0 R Offset for white Balance */
  627. /* 1963 * {0, 0x0000, 0x8612}, * 1 Gr Offset for white Balance */
  628. /* 1964 * {0, 0x0000, 0x8613}, * 1f B Offset for white Balance */
  629. /* 1965 * {0, 0x0000, 0x8614}, * f0 Gb Offset for white Balance */
  630. {0x0040, 0x8651}, /* 2b BLUE gain for white balance good at all 60 */
  631. {0x0030, 0x8652}, /* 41 Gr Gain for white Balance (L) */
  632. {0x0035, 0x8653}, /* 26 RED gain for white balance */
  633. {0x0035, 0x8654}, /* 40Gb Gain for white Balance (L) */
  634. {0x0041, 0x863f},
  635. /* Fixed Gamma correction enabled (makes colours look better) */
  636. /* 2422 */ {0x0000, 0x8655},
  637. /* High bits for white balance*****brightness control*** */
  638. {}
  639. };
  640. static const u16 spca508_sightcam_init_data[][2] = {
  641. /* This line seems to setup the frame/canvas */
  642. /*368 */ {0x000f, 0x8402},
  643. /* Theese 6 lines are needed to startup the webcam */
  644. /*398 */ {0x0090, 0x8110},
  645. /*399 */ {0x0001, 0x8114},
  646. /*400 */ {0x0001, 0x8114},
  647. /*401 */ {0x0001, 0x8114},
  648. /*402 */ {0x0003, 0x8114},
  649. /*403 */ {0x0080, 0x8804},
  650. /* This part seems to make the pictures darker? (autobrightness?) */
  651. /*436 */ {0x0001, 0x8801},
  652. /*437 */ {0x0004, 0x8800},
  653. /*439 */ {0x0003, 0x8801},
  654. /*440 */ {0x00e0, 0x8800},
  655. /*442 */ {0x0004, 0x8801},
  656. /*443 */ {0x00b4, 0x8800},
  657. /*445 */ {0x0005, 0x8801},
  658. /*446 */ {0x0000, 0x8800},
  659. /*448 */ {0x0006, 0x8801},
  660. /*449 */ {0x00e0, 0x8800},
  661. /*451 */ {0x0007, 0x8801},
  662. /*452 */ {0x000c, 0x8800},
  663. /* This section is just needed, it probably
  664. * does something like the previous section,
  665. * but the cam won't start if it's not included.
  666. */
  667. /*484 */ {0x0014, 0x8801},
  668. /*485 */ {0x0008, 0x8800},
  669. /*487 */ {0x0015, 0x8801},
  670. /*488 */ {0x0067, 0x8800},
  671. /*490 */ {0x0016, 0x8801},
  672. /*491 */ {0x0000, 0x8800},
  673. /*493 */ {0x0017, 0x8801},
  674. /*494 */ {0x0020, 0x8800},
  675. /*496 */ {0x0018, 0x8801},
  676. /*497 */ {0x0044, 0x8800},
  677. /* Makes the picture darker - and the
  678. * cam won't start if not included
  679. */
  680. /*505 */ {0x001e, 0x8801},
  681. /*506 */ {0x00ea, 0x8800},
  682. /*508 */ {0x001f, 0x8801},
  683. /*509 */ {0x0001, 0x8800},
  684. /*511 */ {0x0003, 0x8801},
  685. /*512 */ {0x00e0, 0x8800},
  686. /* seems to place the colors ontop of each other #1 */
  687. /*517 */ {0x0006, 0x8704},
  688. /*518 */ {0x0001, 0x870c},
  689. /*519 */ {0x0016, 0x8600},
  690. /*520 */ {0x0002, 0x8606},
  691. /* if not included the pictures becomes _very_ dark */
  692. /*521 */ {0x0064, 0x8607},
  693. /*522 */ {0x003a, 0x8601},
  694. /*523 */ {0x0000, 0x8602},
  695. /* seems to place the colors ontop of each other #2 */
  696. /*524 */ {0x0016, 0x8600},
  697. /*525 */ {0x0018, 0x8617},
  698. /*526 */ {0x0008, 0x8618},
  699. /*527 */ {0x00a1, 0x8656},
  700. /* webcam won't start if not included */
  701. /*528 */ {0x0007, 0x865b},
  702. /*529 */ {0x0001, 0x865c},
  703. /*530 */ {0x0058, 0x865d},
  704. /*531 */ {0x0048, 0x865e},
  705. /* adjusts the colors */
  706. /*541 */ {0x0049, 0x8651},
  707. /*542 */ {0x0040, 0x8652},
  708. /*543 */ {0x004c, 0x8653},
  709. /*544 */ {0x0040, 0x8654},
  710. {}
  711. };
  712. static const u16 spca508_sightcam2_init_data[][2] = {
  713. /* 35 */ {0x0020, 0x8112},
  714. /* 36 */ {0x000f, 0x8402},
  715. /* 37 */ {0x0000, 0x8403},
  716. /* 38 */ {0x0008, 0x8201},
  717. /* 39 */ {0x0008, 0x8200},
  718. /* 40 */ {0x0001, 0x8200},
  719. /* 43 */ {0x0009, 0x8201},
  720. /* 44 */ {0x0008, 0x8200},
  721. /* 45 */ {0x0001, 0x8200},
  722. /* 48 */ {0x000a, 0x8201},
  723. /* 49 */ {0x0008, 0x8200},
  724. /* 50 */ {0x0001, 0x8200},
  725. /* 53 */ {0x000b, 0x8201},
  726. /* 54 */ {0x0008, 0x8200},
  727. /* 55 */ {0x0001, 0x8200},
  728. /* 58 */ {0x000c, 0x8201},
  729. /* 59 */ {0x0008, 0x8200},
  730. /* 60 */ {0x0001, 0x8200},
  731. /* 63 */ {0x000d, 0x8201},
  732. /* 64 */ {0x0008, 0x8200},
  733. /* 65 */ {0x0001, 0x8200},
  734. /* 68 */ {0x000e, 0x8201},
  735. /* 69 */ {0x0008, 0x8200},
  736. /* 70 */ {0x0001, 0x8200},
  737. /* 73 */ {0x0007, 0x8201},
  738. /* 74 */ {0x0008, 0x8200},
  739. /* 75 */ {0x0001, 0x8200},
  740. /* 78 */ {0x000f, 0x8201},
  741. /* 79 */ {0x0008, 0x8200},
  742. /* 80 */ {0x0001, 0x8200},
  743. /* 84 */ {0x0018, 0x8660},
  744. /* 85 */ {0x0010, 0x8201},
  745. /* 86 */ {0x0008, 0x8200},
  746. /* 87 */ {0x0001, 0x8200},
  747. /* 90 */ {0x0011, 0x8201},
  748. /* 91 */ {0x0008, 0x8200},
  749. /* 92 */ {0x0001, 0x8200},
  750. /* 95 */ {0x0000, 0x86b0},
  751. /* 96 */ {0x0034, 0x86b1},
  752. /* 97 */ {0x0000, 0x86b2},
  753. /* 98 */ {0x0049, 0x86b3},
  754. /* 99 */ {0x0000, 0x86b4},
  755. /* 100 */ {0x0000, 0x86b4},
  756. /* 101 */ {0x0012, 0x8201},
  757. /* 102 */ {0x0008, 0x8200},
  758. /* 103 */ {0x0001, 0x8200},
  759. /* 106 */ {0x0013, 0x8201},
  760. /* 107 */ {0x0008, 0x8200},
  761. /* 108 */ {0x0001, 0x8200},
  762. /* 111 */ {0x0001, 0x86b0},
  763. /* 112 */ {0x00aa, 0x86b1},
  764. /* 113 */ {0x0000, 0x86b2},
  765. /* 114 */ {0x00e4, 0x86b3},
  766. /* 115 */ {0x0000, 0x86b4},
  767. /* 116 */ {0x0000, 0x86b4},
  768. /* 118 */ {0x0018, 0x8660},
  769. /* 119 */ {0x0090, 0x8110},
  770. /* 120 */ {0x0001, 0x8114},
  771. /* 121 */ {0x0001, 0x8114},
  772. /* 122 */ {0x0001, 0x8114},
  773. /* 123 */ {0x0003, 0x8114},
  774. /* 124 */ {0x0080, 0x8804},
  775. /* 157 */ {0x0003, 0x8801},
  776. /* 158 */ {0x0012, 0x8800},
  777. /* 160 */ {0x0004, 0x8801},
  778. /* 161 */ {0x0005, 0x8800},
  779. /* 163 */ {0x0005, 0x8801},
  780. /* 164 */ {0x0000, 0x8800},
  781. /* 166 */ {0x0006, 0x8801},
  782. /* 167 */ {0x0000, 0x8800},
  783. /* 169 */ {0x0007, 0x8801},
  784. /* 170 */ {0x0000, 0x8800},
  785. /* 172 */ {0x0008, 0x8801},
  786. /* 173 */ {0x0005, 0x8800},
  787. /* 175 */ {0x000a, 0x8700},
  788. /* 176 */ {0x000e, 0x8801},
  789. /* 177 */ {0x0004, 0x8800},
  790. /* 179 */ {0x0005, 0x8801},
  791. /* 180 */ {0x0047, 0x8800},
  792. /* 182 */ {0x0006, 0x8801},
  793. /* 183 */ {0x0000, 0x8800},
  794. /* 185 */ {0x0007, 0x8801},
  795. /* 186 */ {0x00c0, 0x8800},
  796. /* 188 */ {0x0008, 0x8801},
  797. /* 189 */ {0x0003, 0x8800},
  798. /* 191 */ {0x0013, 0x8801},
  799. /* 192 */ {0x0001, 0x8800},
  800. /* 194 */ {0x0009, 0x8801},
  801. /* 195 */ {0x0000, 0x8800},
  802. /* 197 */ {0x000a, 0x8801},
  803. /* 198 */ {0x0000, 0x8800},
  804. /* 200 */ {0x000b, 0x8801},
  805. /* 201 */ {0x0000, 0x8800},
  806. /* 203 */ {0x000c, 0x8801},
  807. /* 204 */ {0x0000, 0x8800},
  808. /* 206 */ {0x000e, 0x8801},
  809. /* 207 */ {0x0004, 0x8800},
  810. /* 209 */ {0x000f, 0x8801},
  811. /* 210 */ {0x0000, 0x8800},
  812. /* 212 */ {0x0010, 0x8801},
  813. /* 213 */ {0x0006, 0x8800},
  814. /* 215 */ {0x0011, 0x8801},
  815. /* 216 */ {0x0006, 0x8800},
  816. /* 218 */ {0x0012, 0x8801},
  817. /* 219 */ {0x0000, 0x8800},
  818. /* 221 */ {0x0013, 0x8801},
  819. /* 222 */ {0x0001, 0x8800},
  820. /* 224 */ {0x000a, 0x8700},
  821. /* 225 */ {0x0000, 0x8702},
  822. /* 226 */ {0x0000, 0x8703},
  823. /* 227 */ {0x00c2, 0x8704},
  824. /* 228 */ {0x0001, 0x870c},
  825. /* 229 */ {0x0044, 0x8600},
  826. /* 230 */ {0x0002, 0x8606},
  827. /* 231 */ {0x0064, 0x8607},
  828. /* 232 */ {0x003a, 0x8601},
  829. /* 233 */ {0x0008, 0x8602},
  830. /* 234 */ {0x0044, 0x8600},
  831. /* 235 */ {0x0018, 0x8617},
  832. /* 236 */ {0x0008, 0x8618},
  833. /* 237 */ {0x00a1, 0x8656},
  834. /* 238 */ {0x0004, 0x865b},
  835. /* 239 */ {0x0002, 0x865c},
  836. /* 240 */ {0x0058, 0x865d},
  837. /* 241 */ {0x0048, 0x865e},
  838. /* 242 */ {0x0012, 0x8608},
  839. /* 243 */ {0x002c, 0x8609},
  840. /* 244 */ {0x0002, 0x860a},
  841. /* 245 */ {0x002c, 0x860b},
  842. /* 246 */ {0x00db, 0x860c},
  843. /* 247 */ {0x00f9, 0x860d},
  844. /* 248 */ {0x00f1, 0x860e},
  845. /* 249 */ {0x00e3, 0x860f},
  846. /* 250 */ {0x002c, 0x8610},
  847. /* 251 */ {0x006c, 0x8651},
  848. /* 252 */ {0x0041, 0x8652},
  849. /* 253 */ {0x0059, 0x8653},
  850. /* 254 */ {0x0040, 0x8654},
  851. /* 255 */ {0x00fa, 0x8611},
  852. /* 256 */ {0x00ff, 0x8612},
  853. /* 257 */ {0x00f8, 0x8613},
  854. /* 258 */ {0x0000, 0x8614},
  855. /* 259 */ {0x0001, 0x863f},
  856. /* 260 */ {0x0000, 0x8640},
  857. /* 261 */ {0x0026, 0x8641},
  858. /* 262 */ {0x0045, 0x8642},
  859. /* 263 */ {0x0060, 0x8643},
  860. /* 264 */ {0x0075, 0x8644},
  861. /* 265 */ {0x0088, 0x8645},
  862. /* 266 */ {0x009b, 0x8646},
  863. /* 267 */ {0x00b0, 0x8647},
  864. /* 268 */ {0x00c5, 0x8648},
  865. /* 269 */ {0x00d2, 0x8649},
  866. /* 270 */ {0x00dc, 0x864a},
  867. /* 271 */ {0x00e5, 0x864b},
  868. /* 272 */ {0x00eb, 0x864c},
  869. /* 273 */ {0x00f0, 0x864d},
  870. /* 274 */ {0x00f6, 0x864e},
  871. /* 275 */ {0x00fa, 0x864f},
  872. /* 276 */ {0x00ff, 0x8650},
  873. /* 277 */ {0x0060, 0x8657},
  874. /* 278 */ {0x0010, 0x8658},
  875. /* 279 */ {0x0018, 0x8659},
  876. /* 280 */ {0x0005, 0x865a},
  877. /* 281 */ {0x0018, 0x8660},
  878. /* 282 */ {0x0003, 0x8509},
  879. /* 283 */ {0x0011, 0x850a},
  880. /* 284 */ {0x0032, 0x850b},
  881. /* 285 */ {0x0010, 0x850c},
  882. /* 286 */ {0x0021, 0x850d},
  883. /* 287 */ {0x0001, 0x8500},
  884. /* 288 */ {0x0000, 0x8508},
  885. /* 289 */ {0x0012, 0x8608},
  886. /* 290 */ {0x002c, 0x8609},
  887. /* 291 */ {0x0002, 0x860a},
  888. /* 292 */ {0x0039, 0x860b},
  889. /* 293 */ {0x00d0, 0x860c},
  890. /* 294 */ {0x00f7, 0x860d},
  891. /* 295 */ {0x00ed, 0x860e},
  892. /* 296 */ {0x00db, 0x860f},
  893. /* 297 */ {0x0039, 0x8610},
  894. /* 298 */ {0x0012, 0x8657},
  895. /* 299 */ {0x000c, 0x8619},
  896. /* 300 */ {0x0004, 0x861a},
  897. /* 301 */ {0x00a1, 0x8656},
  898. /* 302 */ {0x00c8, 0x8615},
  899. /* 303 */ {0x0032, 0x8616},
  900. /* 306 */ {0x0030, 0x8112},
  901. /* 313 */ {0x0020, 0x8112},
  902. /* 314 */ {0x0020, 0x8112},
  903. /* 315 */ {0x000f, 0x8402},
  904. /* 316 */ {0x0000, 0x8403},
  905. /* 317 */ {0x0090, 0x8110},
  906. /* 318 */ {0x0001, 0x8114},
  907. /* 319 */ {0x0001, 0x8114},
  908. /* 320 */ {0x0001, 0x8114},
  909. /* 321 */ {0x0003, 0x8114},
  910. /* 322 */ {0x0080, 0x8804},
  911. /* 355 */ {0x0003, 0x8801},
  912. /* 356 */ {0x0012, 0x8800},
  913. /* 358 */ {0x0004, 0x8801},
  914. /* 359 */ {0x0005, 0x8800},
  915. /* 361 */ {0x0005, 0x8801},
  916. /* 362 */ {0x0047, 0x8800},
  917. /* 364 */ {0x0006, 0x8801},
  918. /* 365 */ {0x0000, 0x8800},
  919. /* 367 */ {0x0007, 0x8801},
  920. /* 368 */ {0x00c0, 0x8800},
  921. /* 370 */ {0x0008, 0x8801},
  922. /* 371 */ {0x0003, 0x8800},
  923. /* 373 */ {0x000a, 0x8700},
  924. /* 374 */ {0x000e, 0x8801},
  925. /* 375 */ {0x0004, 0x8800},
  926. /* 377 */ {0x0005, 0x8801},
  927. /* 378 */ {0x0047, 0x8800},
  928. /* 380 */ {0x0006, 0x8801},
  929. /* 381 */ {0x0000, 0x8800},
  930. /* 383 */ {0x0007, 0x8801},
  931. /* 384 */ {0x00c0, 0x8800},
  932. /* 386 */ {0x0008, 0x8801},
  933. /* 387 */ {0x0003, 0x8800},
  934. /* 389 */ {0x0013, 0x8801},
  935. /* 390 */ {0x0001, 0x8800},
  936. /* 392 */ {0x0009, 0x8801},
  937. /* 393 */ {0x0000, 0x8800},
  938. /* 395 */ {0x000a, 0x8801},
  939. /* 396 */ {0x0000, 0x8800},
  940. /* 398 */ {0x000b, 0x8801},
  941. /* 399 */ {0x0000, 0x8800},
  942. /* 401 */ {0x000c, 0x8801},
  943. /* 402 */ {0x0000, 0x8800},
  944. /* 404 */ {0x000e, 0x8801},
  945. /* 405 */ {0x0004, 0x8800},
  946. /* 407 */ {0x000f, 0x8801},
  947. /* 408 */ {0x0000, 0x8800},
  948. /* 410 */ {0x0010, 0x8801},
  949. /* 411 */ {0x0006, 0x8800},
  950. /* 413 */ {0x0011, 0x8801},
  951. /* 414 */ {0x0006, 0x8800},
  952. /* 416 */ {0x0012, 0x8801},
  953. /* 417 */ {0x0000, 0x8800},
  954. /* 419 */ {0x0013, 0x8801},
  955. /* 420 */ {0x0001, 0x8800},
  956. /* 422 */ {0x000a, 0x8700},
  957. /* 423 */ {0x0000, 0x8702},
  958. /* 424 */ {0x0000, 0x8703},
  959. /* 425 */ {0x00c2, 0x8704},
  960. /* 426 */ {0x0001, 0x870c},
  961. /* 427 */ {0x0044, 0x8600},
  962. /* 428 */ {0x0002, 0x8606},
  963. /* 429 */ {0x0064, 0x8607},
  964. /* 430 */ {0x003a, 0x8601},
  965. /* 431 */ {0x0008, 0x8602},
  966. /* 432 */ {0x0044, 0x8600},
  967. /* 433 */ {0x0018, 0x8617},
  968. /* 434 */ {0x0008, 0x8618},
  969. /* 435 */ {0x00a1, 0x8656},
  970. /* 436 */ {0x0004, 0x865b},
  971. /* 437 */ {0x0002, 0x865c},
  972. /* 438 */ {0x0058, 0x865d},
  973. /* 439 */ {0x0048, 0x865e},
  974. /* 440 */ {0x0012, 0x8608},
  975. /* 441 */ {0x002c, 0x8609},
  976. /* 442 */ {0x0002, 0x860a},
  977. /* 443 */ {0x002c, 0x860b},
  978. /* 444 */ {0x00db, 0x860c},
  979. /* 445 */ {0x00f9, 0x860d},
  980. /* 446 */ {0x00f1, 0x860e},
  981. /* 447 */ {0x00e3, 0x860f},
  982. /* 448 */ {0x002c, 0x8610},
  983. /* 449 */ {0x006c, 0x8651},
  984. /* 450 */ {0x0041, 0x8652},
  985. /* 451 */ {0x0059, 0x8653},
  986. /* 452 */ {0x0040, 0x8654},
  987. /* 453 */ {0x00fa, 0x8611},
  988. /* 454 */ {0x00ff, 0x8612},
  989. /* 455 */ {0x00f8, 0x8613},
  990. /* 456 */ {0x0000, 0x8614},
  991. /* 457 */ {0x0001, 0x863f},
  992. /* 458 */ {0x0000, 0x8640},
  993. /* 459 */ {0x0026, 0x8641},
  994. /* 460 */ {0x0045, 0x8642},
  995. /* 461 */ {0x0060, 0x8643},
  996. /* 462 */ {0x0075, 0x8644},
  997. /* 463 */ {0x0088, 0x8645},
  998. /* 464 */ {0x009b, 0x8646},
  999. /* 465 */ {0x00b0, 0x8647},
  1000. /* 466 */ {0x00c5, 0x8648},
  1001. /* 467 */ {0x00d2, 0x8649},
  1002. /* 468 */ {0x00dc, 0x864a},
  1003. /* 469 */ {0x00e5, 0x864b},
  1004. /* 470 */ {0x00eb, 0x864c},
  1005. /* 471 */ {0x00f0, 0x864d},
  1006. /* 472 */ {0x00f6, 0x864e},
  1007. /* 473 */ {0x00fa, 0x864f},
  1008. /* 474 */ {0x00ff, 0x8650},
  1009. /* 475 */ {0x0060, 0x8657},
  1010. /* 476 */ {0x0010, 0x8658},
  1011. /* 477 */ {0x0018, 0x8659},
  1012. /* 478 */ {0x0005, 0x865a},
  1013. /* 479 */ {0x0018, 0x8660},
  1014. /* 480 */ {0x0003, 0x8509},
  1015. /* 481 */ {0x0011, 0x850a},
  1016. /* 482 */ {0x0032, 0x850b},
  1017. /* 483 */ {0x0010, 0x850c},
  1018. /* 484 */ {0x0021, 0x850d},
  1019. /* 485 */ {0x0001, 0x8500},
  1020. /* 486 */ {0x0000, 0x8508},
  1021. /* 487 */ {0x0012, 0x8608},
  1022. /* 488 */ {0x002c, 0x8609},
  1023. /* 489 */ {0x0002, 0x860a},
  1024. /* 490 */ {0x0039, 0x860b},
  1025. /* 491 */ {0x00d0, 0x860c},
  1026. /* 492 */ {0x00f7, 0x860d},
  1027. /* 493 */ {0x00ed, 0x860e},
  1028. /* 494 */ {0x00db, 0x860f},
  1029. /* 495 */ {0x0039, 0x8610},
  1030. /* 496 */ {0x0012, 0x8657},
  1031. /* 497 */ {0x0064, 0x8619},
  1032. /* This line starts it all, it is not needed here */
  1033. /* since it has been build into the driver */
  1034. /* jfm: don't start now */
  1035. /* 590 * {0x0030, 0x8112}, */
  1036. {}
  1037. };
  1038. /*
  1039. * Initialization data for Creative Webcam Vista
  1040. */
  1041. static const u16 spca508_vista_init_data[][2] = {
  1042. {0x0008, 0x8200}, /* Clear register */
  1043. {0x0000, 0x870b}, /* Reset CTL3 */
  1044. {0x0020, 0x8112}, /* Video Drop packet enable */
  1045. {0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
  1046. {0x0000, 0x8110}, /* Disable everything */
  1047. {0x0000, 0x8114}, /* Software GPIO output data */
  1048. {0x0000, 0x8114},
  1049. {0x0003, 0x8111},
  1050. {0x0000, 0x8111},
  1051. {0x0090, 0x8110}, /* Enable: SSI output, External 2X clock output */
  1052. {0x0020, 0x8112},
  1053. {0x0000, 0x8114},
  1054. {0x0001, 0x8114},
  1055. {0x0001, 0x8114},
  1056. {0x0001, 0x8114},
  1057. {0x0003, 0x8114},
  1058. {0x000f, 0x8402}, /* Memory bank Address */
  1059. {0x0000, 0x8403}, /* Memory bank Address */
  1060. {0x00ba, 0x8804}, /* SSI Slave address */
  1061. {0x0010, 0x8802}, /* 93.75kHz SSI Clock Two DataByte */
  1062. /* READ { 0, 0x0001, 0x8803 } ->
  1063. 0000: 00 */
  1064. /* READ { 0, 0x0001, 0x8802 } ->
  1065. 0000: 10 */
  1066. {0x0010, 0x8802}, /* Will write 2 bytes (DATA1+DATA2) */
  1067. {0x0020, 0x8801}, /* Register address for SSI read/write */
  1068. {0x0044, 0x8805}, /* DATA2 */
  1069. {0x0004, 0x8800}, /* DATA1 -> write triggered */
  1070. /* READ { 0, 0x0001, 0x8803 } ->
  1071. 0000: 00 */
  1072. /* READ { 0, 0x0001, 0x8803 } ->
  1073. 0000: 00 */
  1074. /* READ { 0, 0x0001, 0x8802 } ->
  1075. 0000: 10 */
  1076. {0x0010, 0x8802},
  1077. {0x0009, 0x8801},
  1078. {0x0042, 0x8805},
  1079. {0x0001, 0x8800},
  1080. /* READ { 0, 0x0001, 0x8803 } ->
  1081. 0000: 00 */
  1082. /* READ { 0, 0x0001, 0x8803 } ->
  1083. 0000: 00 */
  1084. /* READ { 0, 0x0001, 0x8802 } ->
  1085. 0000: 10 */
  1086. {0x0010, 0x8802},
  1087. {0x003c, 0x8801},
  1088. {0x0001, 0x8805},
  1089. {0x0000, 0x8800},
  1090. /* READ { 0, 0x0001, 0x8803 } ->
  1091. 0000: 00 */
  1092. /* READ { 0, 0x0001, 0x8803 } ->
  1093. 0000: 00 */
  1094. /* READ { 0, 0x0001, 0x8802 } ->
  1095. 0000: 10 */
  1096. {0x0010, 0x8802},
  1097. {0x0001, 0x8801},
  1098. {0x000a, 0x8805},
  1099. {0x0000, 0x8800},
  1100. /* READ { 0, 0x0001, 0x8803 } ->
  1101. 0000: 00 */
  1102. /* READ { 0, 0x0001, 0x8803 } ->
  1103. 0000: 00 */
  1104. /* READ { 0, 0x0001, 0x8802 } ->
  1105. 0000: 10 */
  1106. {0x0010, 0x8802},
  1107. {0x0002, 0x8801},
  1108. {0x0000, 0x8805},
  1109. {0x0000, 0x8800},
  1110. /* READ { 0, 0x0001, 0x8803 } ->
  1111. 0000: 00 */
  1112. /* READ { 0, 0x0001, 0x8803 } ->
  1113. 0000: 00 */
  1114. /* READ { 0, 0x0001, 0x8802 } ->
  1115. 0000: 10 */
  1116. {0x0010, 0x8802},
  1117. {0x0003, 0x8801},
  1118. {0x0027, 0x8805},
  1119. {0x0001, 0x8800},
  1120. /* READ { 0, 0x0001, 0x8803 } ->
  1121. 0000: 00 */
  1122. /* READ { 0, 0x0001, 0x8803 } ->
  1123. 0000: 00 */
  1124. /* READ { 0, 0x0001, 0x8802 } ->
  1125. 0000: 10 */
  1126. {0x0010, 0x8802},
  1127. {0x0004, 0x8801},
  1128. {0x0065, 0x8805},
  1129. {0x0001, 0x8800},
  1130. /* READ { 0, 0x0001, 0x8803 } ->
  1131. 0000: 00 */
  1132. /* READ { 0, 0x0001, 0x8803 } ->
  1133. 0000: 00 */
  1134. /* READ { 0, 0x0001, 0x8802 } ->
  1135. 0000: 10 */
  1136. {0x0010, 0x8802},
  1137. {0x0005, 0x8801},
  1138. {0x0003, 0x8805},
  1139. {0x0000, 0x8800},
  1140. /* READ { 0, 0x0001, 0x8803 } ->
  1141. 0000: 00 */
  1142. /* READ { 0, 0x0001, 0x8803 } ->
  1143. 0000: 00 */
  1144. /* READ { 0, 0x0001, 0x8802 } ->
  1145. 0000: 10 */
  1146. {0x0010, 0x8802},
  1147. {0x0006, 0x8801},
  1148. {0x001c, 0x8805},
  1149. {0x0000, 0x8800},
  1150. /* READ { 0, 0x0001, 0x8803 } ->
  1151. 0000: 00 */
  1152. /* READ { 0, 0x0001, 0x8803 } ->
  1153. 0000: 00 */
  1154. /* READ { 0, 0x0001, 0x8802 } ->
  1155. 0000: 10 */
  1156. {0x0010, 0x8802},
  1157. {0x0007, 0x8801},
  1158. {0x002a, 0x8805},
  1159. {0x0000, 0x8800},
  1160. /* READ { 0, 0x0001, 0x8803 } ->
  1161. 0000: 00 */
  1162. /* READ { 0, 0x0001, 0x8803 } ->
  1163. 0000: 00 */
  1164. /* READ { 0, 0x0001, 0x8802 } ->
  1165. 0000: 10 */
  1166. {0x0010, 0x8802},
  1167. {0x000e, 0x8801},
  1168. {0x0000, 0x8805},
  1169. {0x0000, 0x8800},
  1170. /* READ { 0, 0x0001, 0x8803 } ->
  1171. 0000: 00 */
  1172. /* READ { 0, 0x0001, 0x8803 } ->
  1173. 0000: 00 */
  1174. /* READ { 0, 0x0001, 0x8802 } ->
  1175. 0000: 10 */
  1176. {0x0010, 0x8802},
  1177. {0x0028, 0x8801},
  1178. {0x002e, 0x8805},
  1179. {0x0000, 0x8800},
  1180. /* READ { 0, 0x0001, 0x8803 } ->
  1181. 0000: 00 */
  1182. /* READ { 0, 0x0001, 0x8803 } ->
  1183. 0000: 00 */
  1184. /* READ { 0, 0x0001, 0x8802 } ->
  1185. 0000: 10 */
  1186. {0x0010, 0x8802},
  1187. {0x0039, 0x8801},
  1188. {0x0013, 0x8805},
  1189. {0x0000, 0x8800},
  1190. /* READ { 0, 0x0001, 0x8803 } ->
  1191. 0000: 00 */
  1192. /* READ { 0, 0x0001, 0x8803 } ->
  1193. 0000: 00 */
  1194. /* READ { 0, 0x0001, 0x8802 } ->
  1195. 0000: 10 */
  1196. {0x0010, 0x8802},
  1197. {0x003b, 0x8801},
  1198. {0x000c, 0x8805},
  1199. {0x0000, 0x8800},
  1200. /* READ { 0, 0x0001, 0x8803 } ->
  1201. 0000: 00 */
  1202. /* READ { 0, 0x0001, 0x8803 } ->
  1203. 0000: 00 */
  1204. /* READ { 0, 0x0001, 0x8802 } ->
  1205. 0000: 10 */
  1206. {0x0010, 0x8802},
  1207. {0x0035, 0x8801},
  1208. {0x0028, 0x8805},
  1209. {0x0000, 0x8800},
  1210. /* READ { 0, 0x0001, 0x8803 } ->
  1211. 0000: 00 */
  1212. /* READ { 0, 0x0001, 0x8803 } ->
  1213. 0000: 00 */
  1214. /* READ { 0, 0x0001, 0x8802 } ->
  1215. 0000: 10 */
  1216. {0x0010, 0x8802},
  1217. {0x0009, 0x8801},
  1218. {0x0042, 0x8805},
  1219. {0x0001, 0x8800},
  1220. /* READ { 0, 0x0001, 0x8803 } ->
  1221. 0000: 00 */
  1222. {0x0050, 0x8703},
  1223. {0x0002, 0x8704}, /* External input CKIx1 */
  1224. {0x0001, 0x870c}, /* Select CKOx2 output */
  1225. {0x009a, 0x8600}, /* Line memory Read Counter (L) */
  1226. {0x0001, 0x8606}, /* 1 Line memory Read Counter (H) Result: (d)410 */
  1227. {0x0023, 0x8601},
  1228. {0x0010, 0x8602},
  1229. {0x000a, 0x8603},
  1230. {0x009A, 0x8600},
  1231. {0x0001, 0x865b}, /* 1 Horizontal Offset for Valid Pixel(L) */
  1232. {0x0003, 0x865c}, /* Vertical offset for valid lines (L) */
  1233. {0x0058, 0x865d}, /* Horizontal valid pixels window (L) */
  1234. {0x0048, 0x865e}, /* Vertical valid lines window (L) */
  1235. {0x0000, 0x865f},
  1236. {0x0006, 0x8660},
  1237. /* Enable nibble data input, select nibble input order */
  1238. {0x0013, 0x8608}, /* A11 Coeficients for color correction */
  1239. {0x0028, 0x8609},
  1240. /* Note: these values are confirmed at the end of array */
  1241. {0x0005, 0x860a}, /* ... */
  1242. {0x0025, 0x860b},
  1243. {0x00e1, 0x860c},
  1244. {0x00fa, 0x860D},
  1245. {0x00f4, 0x860e},
  1246. {0x00e8, 0x860f},
  1247. {0x0025, 0x8610}, /* A33 Coef. */
  1248. {0x00fc, 0x8611}, /* White balance offset: R */
  1249. {0x0001, 0x8612}, /* White balance offset: Gr */
  1250. {0x00fe, 0x8613}, /* White balance offset: B */
  1251. {0x0000, 0x8614}, /* White balance offset: Gb */
  1252. {0x0064, 0x8651}, /* R gain for white balance (L) */
  1253. {0x0040, 0x8652}, /* Gr gain for white balance (L) */
  1254. {0x0066, 0x8653}, /* B gain for white balance (L) */
  1255. {0x0040, 0x8654}, /* Gb gain for white balance (L) */
  1256. {0x0001, 0x863f}, /* Enable fixed gamma correction */
  1257. {0x00a1, 0x8656}, /* Size - Window1: 256x256, Window2: 128x128 */
  1258. /* UV division: UV no change, Enable New edge enhancement */
  1259. {0x0018, 0x8657}, /* Edge gain high threshold */
  1260. {0x0020, 0x8658}, /* Edge gain low threshold */
  1261. {0x000A, 0x8659}, /* Edge bandwidth high threshold */
  1262. {0x0005, 0x865a}, /* Edge bandwidth low threshold */
  1263. {0x0064, 0x8607}, /* UV filter enable */
  1264. {0x0016, 0x8660},
  1265. {0x0000, 0x86b0}, /* Bad pixels compensation address */
  1266. {0x00dc, 0x86b1}, /* X coord for bad pixels compensation (L) */
  1267. {0x0000, 0x86b2},
  1268. {0x0009, 0x86b3}, /* Y coord for bad pixels compensation (L) */
  1269. {0x0000, 0x86b4},
  1270. {0x0001, 0x86b0},
  1271. {0x00f5, 0x86b1},
  1272. {0x0000, 0x86b2},
  1273. {0x00c6, 0x86b3},
  1274. {0x0000, 0x86b4},
  1275. {0x0002, 0x86b0},
  1276. {0x001c, 0x86b1},
  1277. {0x0001, 0x86b2},
  1278. {0x00d7, 0x86b3},
  1279. {0x0000, 0x86b4},
  1280. {0x0003, 0x86b0},
  1281. {0x001c, 0x86b1},
  1282. {0x0001, 0x86b2},
  1283. {0x00d8, 0x86b3},
  1284. {0x0000, 0x86b4},
  1285. {0x0004, 0x86b0},
  1286. {0x001d, 0x86b1},
  1287. {0x0001, 0x86b2},
  1288. {0x00d8, 0x86b3},
  1289. {0x0000, 0x86b4},
  1290. {0x001e, 0x8660},
  1291. /* READ { 0, 0x0000, 0x8608 } ->
  1292. 0000: 13 */
  1293. /* READ { 0, 0x0000, 0x8609 } ->
  1294. 0000: 28 */
  1295. /* READ { 0, 0x0000, 0x8610 } ->
  1296. 0000: 05 */
  1297. /* READ { 0, 0x0000, 0x8611 } ->
  1298. 0000: 25 */
  1299. /* READ { 0, 0x0000, 0x8612 } ->
  1300. 0000: e1 */
  1301. /* READ { 0, 0x0000, 0x8613 } ->
  1302. 0000: fa */
  1303. /* READ { 0, 0x0000, 0x8614 } ->
  1304. 0000: f4 */
  1305. /* READ { 0, 0x0000, 0x8615 } ->
  1306. 0000: e8 */
  1307. /* READ { 0, 0x0000, 0x8616 } ->
  1308. 0000: 25 */
  1309. {}
  1310. };
  1311. static int reg_write(struct usb_device *dev,
  1312. __u16 index, __u16 value)
  1313. {
  1314. int ret;
  1315. ret = usb_control_msg(dev,
  1316. usb_sndctrlpipe(dev, 0),
  1317. 0, /* request */
  1318. USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  1319. value, index, NULL, 0, 500);
  1320. PDEBUG(D_USBO, "reg write i:0x%04x = 0x%02x",
  1321. index, value);
  1322. if (ret < 0)
  1323. PDEBUG(D_ERR|D_USBO, "reg write: error %d", ret);
  1324. return ret;
  1325. }
  1326. /* read 1 byte */
  1327. /* returns: negative is error, pos or zero is data */
  1328. static int reg_read(struct gspca_dev *gspca_dev,
  1329. __u16 index) /* wIndex */
  1330. {
  1331. int ret;
  1332. ret = usb_control_msg(gspca_dev->dev,
  1333. usb_rcvctrlpipe(gspca_dev->dev, 0),
  1334. 0, /* register */
  1335. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  1336. 0, /* value */
  1337. index,
  1338. gspca_dev->usb_buf, 1,
  1339. 500); /* timeout */
  1340. PDEBUG(D_USBI, "reg read i:%04x --> %02x",
  1341. index, gspca_dev->usb_buf[0]);
  1342. if (ret < 0) {
  1343. PDEBUG(D_ERR|D_USBI, "reg_read err %d", ret);
  1344. return ret;
  1345. }
  1346. return gspca_dev->usb_buf[0];
  1347. }
  1348. static int write_vector(struct gspca_dev *gspca_dev,
  1349. const u16 data[][2])
  1350. {
  1351. struct usb_device *dev = gspca_dev->dev;
  1352. int ret, i = 0;
  1353. while (data[i][1] != 0) {
  1354. ret = reg_write(dev, data[i][1], data[i][0]);
  1355. if (ret < 0)
  1356. return ret;
  1357. i++;
  1358. }
  1359. return 0;
  1360. }
  1361. /* this function is called at probe time */
  1362. static int sd_config(struct gspca_dev *gspca_dev,
  1363. const struct usb_device_id *id)
  1364. {
  1365. struct sd *sd = (struct sd *) gspca_dev;
  1366. struct cam *cam;
  1367. int data1, data2;
  1368. /* Read from global register the USB product and vendor IDs, just to
  1369. * prove that we can communicate with the device. This works, which
  1370. * confirms at we are communicating properly and that the device
  1371. * is a 508. */
  1372. data1 = reg_read(gspca_dev, 0x8104);
  1373. data2 = reg_read(gspca_dev, 0x8105);
  1374. PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1);
  1375. data1 = reg_read(gspca_dev, 0x8106);
  1376. data2 = reg_read(gspca_dev, 0x8107);
  1377. PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1);
  1378. data1 = reg_read(gspca_dev, 0x8621);
  1379. PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
  1380. cam = &gspca_dev->cam;
  1381. cam->cam_mode = sif_mode;
  1382. cam->nmodes = ARRAY_SIZE(sif_mode);
  1383. sd->subtype = id->driver_info;
  1384. sd->brightness = BRIGHTNESS_DEF;
  1385. switch (sd->subtype) {
  1386. case ViewQuestVQ110:
  1387. if (write_vector(gspca_dev, spca508_init_data))
  1388. return -1;
  1389. break;
  1390. default:
  1391. /* case MicroInnovationIC200: */
  1392. /* case IntelEasyPCCamera: */
  1393. if (write_vector(gspca_dev, spca508cs110_init_data))
  1394. return -1;
  1395. break;
  1396. case HamaUSBSightcam:
  1397. if (write_vector(gspca_dev, spca508_sightcam_init_data))
  1398. return -1;
  1399. break;
  1400. case HamaUSBSightcam2:
  1401. if (write_vector(gspca_dev, spca508_sightcam2_init_data))
  1402. return -1;
  1403. break;
  1404. case CreativeVista:
  1405. if (write_vector(gspca_dev, spca508_vista_init_data))
  1406. return -1;
  1407. break;
  1408. }
  1409. return 0; /* success */
  1410. }
  1411. /* this function is called at probe and resume time */
  1412. static int sd_init(struct gspca_dev *gspca_dev)
  1413. {
  1414. /* write_vector(gspca_dev, spca508_open_data); */
  1415. return 0;
  1416. }
  1417. static int sd_start(struct gspca_dev *gspca_dev)
  1418. {
  1419. int mode;
  1420. mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
  1421. reg_write(gspca_dev->dev, 0x8500, mode);
  1422. switch (mode) {
  1423. case 0:
  1424. case 1:
  1425. reg_write(gspca_dev->dev, 0x8700, 0x28); /* clock */
  1426. break;
  1427. default:
  1428. /* case 2: */
  1429. /* case 3: */
  1430. reg_write(gspca_dev->dev, 0x8700, 0x23); /* clock */
  1431. break;
  1432. }
  1433. reg_write(gspca_dev->dev, 0x8112, 0x10 | 0x20);
  1434. return 0;
  1435. }
  1436. static void sd_stopN(struct gspca_dev *gspca_dev)
  1437. {
  1438. /* Video ISO disable, Video Drop Packet enable: */
  1439. reg_write(gspca_dev->dev, 0x8112, 0x20);
  1440. }
  1441. static void sd_pkt_scan(struct gspca_dev *gspca_dev,
  1442. struct gspca_frame *frame, /* target */
  1443. __u8 *data, /* isoc packet */
  1444. int len) /* iso packet length */
  1445. {
  1446. switch (data[0]) {
  1447. case 0: /* start of frame */
  1448. frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
  1449. data, 0);
  1450. data += SPCA508_OFFSET_DATA;
  1451. len -= SPCA508_OFFSET_DATA;
  1452. gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
  1453. data, len);
  1454. break;
  1455. case 0xff: /* drop */
  1456. /* gspca_dev->last_packet_type = DISCARD_PACKET; */
  1457. break;
  1458. default:
  1459. data += 1;
  1460. len -= 1;
  1461. gspca_frame_add(gspca_dev, INTER_PACKET, frame,
  1462. data, len);
  1463. break;
  1464. }
  1465. }
  1466. static void setbrightness(struct gspca_dev *gspca_dev)
  1467. {
  1468. struct sd *sd = (struct sd *) gspca_dev;
  1469. __u8 brightness = sd->brightness;
  1470. /* MX seem contrast */
  1471. reg_write(gspca_dev->dev, 0x8651, brightness);
  1472. reg_write(gspca_dev->dev, 0x8652, brightness);
  1473. reg_write(gspca_dev->dev, 0x8653, brightness);
  1474. reg_write(gspca_dev->dev, 0x8654, brightness);
  1475. }
  1476. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
  1477. {
  1478. struct sd *sd = (struct sd *) gspca_dev;
  1479. sd->brightness = val;
  1480. if (gspca_dev->streaming)
  1481. setbrightness(gspca_dev);
  1482. return 0;
  1483. }
  1484. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
  1485. {
  1486. struct sd *sd = (struct sd *) gspca_dev;
  1487. *val = sd->brightness;
  1488. return 0;
  1489. }
  1490. /* sub-driver description */
  1491. static const struct sd_desc sd_desc = {
  1492. .name = MODULE_NAME,
  1493. .ctrls = sd_ctrls,
  1494. .nctrls = ARRAY_SIZE(sd_ctrls),
  1495. .config = sd_config,
  1496. .init = sd_init,
  1497. .start = sd_start,
  1498. .stopN = sd_stopN,
  1499. .pkt_scan = sd_pkt_scan,
  1500. };
  1501. /* -- module initialisation -- */
  1502. static const __devinitdata struct usb_device_id device_table[] = {
  1503. {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
  1504. {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
  1505. {USB_DEVICE(0x0461, 0x0815), .driver_info = MicroInnovationIC200},
  1506. {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
  1507. {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
  1508. {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
  1509. {USB_DEVICE(0x8086, 0x0110), .driver_info = IntelEasyPCCamera},
  1510. {}
  1511. };
  1512. MODULE_DEVICE_TABLE(usb, device_table);
  1513. /* -- device connect -- */
  1514. static int sd_probe(struct usb_interface *intf,
  1515. const struct usb_device_id *id)
  1516. {
  1517. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  1518. THIS_MODULE);
  1519. }
  1520. static struct usb_driver sd_driver = {
  1521. .name = MODULE_NAME,
  1522. .id_table = device_table,
  1523. .probe = sd_probe,
  1524. .disconnect = gspca_disconnect,
  1525. #ifdef CONFIG_PM
  1526. .suspend = gspca_suspend,
  1527. .resume = gspca_resume,
  1528. #endif
  1529. };
  1530. /* -- module insert / remove -- */
  1531. static int __init sd_mod_init(void)
  1532. {
  1533. int ret;
  1534. ret = usb_register(&sd_driver);
  1535. if (ret < 0)
  1536. return ret;
  1537. PDEBUG(D_PROBE, "registered");
  1538. return 0;
  1539. }
  1540. static void __exit sd_mod_exit(void)
  1541. {
  1542. usb_deregister(&sd_driver);
  1543. PDEBUG(D_PROBE, "deregistered");
  1544. }
  1545. module_init(sd_mod_init);
  1546. module_exit(sd_mod_exit);