spca508.c 53 KB

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