spca508.c 51 KB

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