spca508.c 54 KB

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