spca500.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. /*
  2. * SPCA500 chip based cameras initialization data
  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. */
  21. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  22. #define MODULE_NAME "spca500"
  23. #include "gspca.h"
  24. #include "jpeg.h"
  25. MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
  26. MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
  27. MODULE_LICENSE("GPL");
  28. /* specific webcam descriptor */
  29. struct sd {
  30. struct gspca_dev gspca_dev; /* !! must be the first item */
  31. struct v4l2_ctrl *jpegqual;
  32. #define QUALITY_MIN 70
  33. #define QUALITY_MAX 95
  34. #define QUALITY_DEF 85
  35. char subtype;
  36. #define AgfaCl20 0
  37. #define AiptekPocketDV 1
  38. #define BenqDC1016 2
  39. #define CreativePCCam300 3
  40. #define DLinkDSC350 4
  41. #define Gsmartmini 5
  42. #define IntelPocketPCCamera 6
  43. #define KodakEZ200 7
  44. #define LogitechClickSmart310 8
  45. #define LogitechClickSmart510 9
  46. #define LogitechTraveler 10
  47. #define MustekGsmart300 11
  48. #define Optimedia 12
  49. #define PalmPixDC85 13
  50. #define ToptroIndus 14
  51. u8 jpeg_hdr[JPEG_HDR_SZ];
  52. };
  53. static const struct v4l2_pix_format vga_mode[] = {
  54. {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
  55. .bytesperline = 320,
  56. .sizeimage = 320 * 240 * 3 / 8 + 590,
  57. .colorspace = V4L2_COLORSPACE_JPEG,
  58. .priv = 1},
  59. {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
  60. .bytesperline = 640,
  61. .sizeimage = 640 * 480 * 3 / 8 + 590,
  62. .colorspace = V4L2_COLORSPACE_JPEG,
  63. .priv = 0},
  64. };
  65. static const struct v4l2_pix_format sif_mode[] = {
  66. {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
  67. .bytesperline = 176,
  68. .sizeimage = 176 * 144 * 3 / 8 + 590,
  69. .colorspace = V4L2_COLORSPACE_JPEG,
  70. .priv = 1},
  71. {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
  72. .bytesperline = 352,
  73. .sizeimage = 352 * 288 * 3 / 8 + 590,
  74. .colorspace = V4L2_COLORSPACE_JPEG,
  75. .priv = 0},
  76. };
  77. /* Frame packet header offsets for the spca500 */
  78. #define SPCA500_OFFSET_PADDINGLB 2
  79. #define SPCA500_OFFSET_PADDINGHB 3
  80. #define SPCA500_OFFSET_MODE 4
  81. #define SPCA500_OFFSET_IMGWIDTH 5
  82. #define SPCA500_OFFSET_IMGHEIGHT 6
  83. #define SPCA500_OFFSET_IMGMODE 7
  84. #define SPCA500_OFFSET_QTBLINDEX 8
  85. #define SPCA500_OFFSET_FRAMSEQ 9
  86. #define SPCA500_OFFSET_CDSPINFO 10
  87. #define SPCA500_OFFSET_GPIO 11
  88. #define SPCA500_OFFSET_AUGPIO 12
  89. #define SPCA500_OFFSET_DATA 16
  90. static const __u16 spca500_visual_defaults[][3] = {
  91. {0x00, 0x0003, 0x816b}, /* SSI not active sync with vsync,
  92. * hue (H byte) = 0,
  93. * saturation/hue enable,
  94. * brightness/contrast enable.
  95. */
  96. {0x00, 0x0000, 0x8167}, /* brightness = 0 */
  97. {0x00, 0x0020, 0x8168}, /* contrast = 0 */
  98. {0x00, 0x0003, 0x816b}, /* SSI not active sync with vsync,
  99. * hue (H byte) = 0, saturation/hue enable,
  100. * brightness/contrast enable.
  101. * was 0x0003, now 0x0000.
  102. */
  103. {0x00, 0x0000, 0x816a}, /* hue (L byte) = 0 */
  104. {0x00, 0x0020, 0x8169}, /* saturation = 0x20 */
  105. {0x00, 0x0050, 0x8157}, /* edge gain high threshold */
  106. {0x00, 0x0030, 0x8158}, /* edge gain low threshold */
  107. {0x00, 0x0028, 0x8159}, /* edge bandwidth high threshold */
  108. {0x00, 0x000a, 0x815a}, /* edge bandwidth low threshold */
  109. {0x00, 0x0001, 0x8202}, /* clock rate compensation = 1/25 sec/frame */
  110. {0x0c, 0x0004, 0x0000},
  111. /* set interface */
  112. {}
  113. };
  114. static const __u16 Clicksmart510_defaults[][3] = {
  115. {0x00, 0x00, 0x8211},
  116. {0x00, 0x01, 0x82c0},
  117. {0x00, 0x10, 0x82cb},
  118. {0x00, 0x0f, 0x800d},
  119. {0x00, 0x82, 0x8225},
  120. {0x00, 0x21, 0x8228},
  121. {0x00, 0x00, 0x8203},
  122. {0x00, 0x00, 0x8204},
  123. {0x00, 0x08, 0x8205},
  124. {0x00, 0xf8, 0x8206},
  125. {0x00, 0x28, 0x8207},
  126. {0x00, 0xa0, 0x8208},
  127. {0x00, 0x08, 0x824a},
  128. {0x00, 0x08, 0x8214},
  129. {0x00, 0x80, 0x82c1},
  130. {0x00, 0x00, 0x82c2},
  131. {0x00, 0x00, 0x82ca},
  132. {0x00, 0x80, 0x82c1},
  133. {0x00, 0x04, 0x82c2},
  134. {0x00, 0x00, 0x82ca},
  135. {0x00, 0xfc, 0x8100},
  136. {0x00, 0xfc, 0x8105},
  137. {0x00, 0x30, 0x8101},
  138. {0x00, 0x00, 0x8102},
  139. {0x00, 0x00, 0x8103},
  140. {0x00, 0x66, 0x8107},
  141. {0x00, 0x00, 0x816b},
  142. {0x00, 0x00, 0x8155},
  143. {0x00, 0x01, 0x8156},
  144. {0x00, 0x60, 0x8157},
  145. {0x00, 0x40, 0x8158},
  146. {0x00, 0x0a, 0x8159},
  147. {0x00, 0x06, 0x815a},
  148. {0x00, 0x00, 0x813f},
  149. {0x00, 0x00, 0x8200},
  150. {0x00, 0x19, 0x8201},
  151. {0x00, 0x00, 0x82c1},
  152. {0x00, 0xa0, 0x82c2},
  153. {0x00, 0x00, 0x82ca},
  154. {0x00, 0x00, 0x8117},
  155. {0x00, 0x00, 0x8118},
  156. {0x00, 0x65, 0x8119},
  157. {0x00, 0x00, 0x811a},
  158. {0x00, 0x00, 0x811b},
  159. {0x00, 0x55, 0x811c},
  160. {0x00, 0x65, 0x811d},
  161. {0x00, 0x55, 0x811e},
  162. {0x00, 0x16, 0x811f},
  163. {0x00, 0x19, 0x8120},
  164. {0x00, 0x80, 0x8103},
  165. {0x00, 0x83, 0x816b},
  166. {0x00, 0x25, 0x8168},
  167. {0x00, 0x01, 0x820f},
  168. {0x00, 0xff, 0x8115},
  169. {0x00, 0x48, 0x8116},
  170. {0x00, 0x50, 0x8151},
  171. {0x00, 0x40, 0x8152},
  172. {0x00, 0x78, 0x8153},
  173. {0x00, 0x40, 0x8154},
  174. {0x00, 0x00, 0x8167},
  175. {0x00, 0x20, 0x8168},
  176. {0x00, 0x00, 0x816a},
  177. {0x00, 0x03, 0x816b},
  178. {0x00, 0x20, 0x8169},
  179. {0x00, 0x60, 0x8157},
  180. {0x00, 0x00, 0x8190},
  181. {0x00, 0x00, 0x81a1},
  182. {0x00, 0x00, 0x81b2},
  183. {0x00, 0x27, 0x8191},
  184. {0x00, 0x27, 0x81a2},
  185. {0x00, 0x27, 0x81b3},
  186. {0x00, 0x4b, 0x8192},
  187. {0x00, 0x4b, 0x81a3},
  188. {0x00, 0x4b, 0x81b4},
  189. {0x00, 0x66, 0x8193},
  190. {0x00, 0x66, 0x81a4},
  191. {0x00, 0x66, 0x81b5},
  192. {0x00, 0x79, 0x8194},
  193. {0x00, 0x79, 0x81a5},
  194. {0x00, 0x79, 0x81b6},
  195. {0x00, 0x8a, 0x8195},
  196. {0x00, 0x8a, 0x81a6},
  197. {0x00, 0x8a, 0x81b7},
  198. {0x00, 0x9b, 0x8196},
  199. {0x00, 0x9b, 0x81a7},
  200. {0x00, 0x9b, 0x81b8},
  201. {0x00, 0xa6, 0x8197},
  202. {0x00, 0xa6, 0x81a8},
  203. {0x00, 0xa6, 0x81b9},
  204. {0x00, 0xb2, 0x8198},
  205. {0x00, 0xb2, 0x81a9},
  206. {0x00, 0xb2, 0x81ba},
  207. {0x00, 0xbe, 0x8199},
  208. {0x00, 0xbe, 0x81aa},
  209. {0x00, 0xbe, 0x81bb},
  210. {0x00, 0xc8, 0x819a},
  211. {0x00, 0xc8, 0x81ab},
  212. {0x00, 0xc8, 0x81bc},
  213. {0x00, 0xd2, 0x819b},
  214. {0x00, 0xd2, 0x81ac},
  215. {0x00, 0xd2, 0x81bd},
  216. {0x00, 0xdb, 0x819c},
  217. {0x00, 0xdb, 0x81ad},
  218. {0x00, 0xdb, 0x81be},
  219. {0x00, 0xe4, 0x819d},
  220. {0x00, 0xe4, 0x81ae},
  221. {0x00, 0xe4, 0x81bf},
  222. {0x00, 0xed, 0x819e},
  223. {0x00, 0xed, 0x81af},
  224. {0x00, 0xed, 0x81c0},
  225. {0x00, 0xf7, 0x819f},
  226. {0x00, 0xf7, 0x81b0},
  227. {0x00, 0xf7, 0x81c1},
  228. {0x00, 0xff, 0x81a0},
  229. {0x00, 0xff, 0x81b1},
  230. {0x00, 0xff, 0x81c2},
  231. {0x00, 0x03, 0x8156},
  232. {0x00, 0x00, 0x8211},
  233. {0x00, 0x20, 0x8168},
  234. {0x00, 0x01, 0x8202},
  235. {0x00, 0x30, 0x8101},
  236. {0x00, 0x00, 0x8111},
  237. {0x00, 0x00, 0x8112},
  238. {0x00, 0x00, 0x8113},
  239. {0x00, 0x00, 0x8114},
  240. {}
  241. };
  242. static const __u8 qtable_creative_pccam[2][64] = {
  243. { /* Q-table Y-components */
  244. 0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12,
  245. 0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11,
  246. 0x04, 0x04, 0x05, 0x07, 0x0c, 0x11, 0x15, 0x11,
  247. 0x04, 0x05, 0x07, 0x09, 0x0f, 0x1a, 0x18, 0x13,
  248. 0x05, 0x07, 0x0b, 0x11, 0x14, 0x21, 0x1f, 0x17,
  249. 0x07, 0x0b, 0x11, 0x13, 0x18, 0x1f, 0x22, 0x1c,
  250. 0x0f, 0x13, 0x17, 0x1a, 0x1f, 0x24, 0x24, 0x1e,
  251. 0x16, 0x1c, 0x1d, 0x1d, 0x22, 0x1e, 0x1f, 0x1e},
  252. { /* Q-table C-components */
  253. 0x05, 0x05, 0x07, 0x0e, 0x1e, 0x1e, 0x1e, 0x1e,
  254. 0x05, 0x06, 0x08, 0x14, 0x1e, 0x1e, 0x1e, 0x1e,
  255. 0x07, 0x08, 0x11, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
  256. 0x0e, 0x14, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
  257. 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
  258. 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
  259. 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
  260. 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}
  261. };
  262. static const __u8 qtable_kodak_ez200[2][64] = {
  263. { /* Q-table Y-components */
  264. 0x02, 0x01, 0x01, 0x02, 0x02, 0x04, 0x05, 0x06,
  265. 0x01, 0x01, 0x01, 0x02, 0x03, 0x06, 0x06, 0x06,
  266. 0x01, 0x01, 0x02, 0x02, 0x04, 0x06, 0x07, 0x06,
  267. 0x01, 0x02, 0x02, 0x03, 0x05, 0x09, 0x08, 0x06,
  268. 0x02, 0x02, 0x04, 0x06, 0x07, 0x0b, 0x0a, 0x08,
  269. 0x02, 0x04, 0x06, 0x06, 0x08, 0x0a, 0x0b, 0x09,
  270. 0x05, 0x06, 0x08, 0x09, 0x0a, 0x0c, 0x0c, 0x0a,
  271. 0x07, 0x09, 0x0a, 0x0a, 0x0b, 0x0a, 0x0a, 0x0a},
  272. { /* Q-table C-components */
  273. 0x02, 0x02, 0x02, 0x05, 0x0a, 0x0a, 0x0a, 0x0a,
  274. 0x02, 0x02, 0x03, 0x07, 0x0a, 0x0a, 0x0a, 0x0a,
  275. 0x02, 0x03, 0x06, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
  276. 0x05, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
  277. 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
  278. 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
  279. 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
  280. 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a}
  281. };
  282. static const __u8 qtable_pocketdv[2][64] = {
  283. { /* Q-table Y-components start registers 0x8800 */
  284. 0x06, 0x04, 0x04, 0x06, 0x0a, 0x10, 0x14, 0x18,
  285. 0x05, 0x05, 0x06, 0x08, 0x0a, 0x17, 0x18, 0x16,
  286. 0x06, 0x05, 0x06, 0x0a, 0x10, 0x17, 0x1c, 0x16,
  287. 0x06, 0x07, 0x09, 0x0c, 0x14, 0x23, 0x20, 0x19,
  288. 0x07, 0x09, 0x0f, 0x16, 0x1b, 0x2c, 0x29, 0x1f,
  289. 0x0a, 0x0e, 0x16, 0x1a, 0x20, 0x2a, 0x2d, 0x25,
  290. 0x14, 0x1a, 0x1f, 0x23, 0x29, 0x30, 0x30, 0x28,
  291. 0x1d, 0x25, 0x26, 0x27, 0x2d, 0x28, 0x29, 0x28,
  292. },
  293. { /* Q-table C-components start registers 0x8840 */
  294. 0x07, 0x07, 0x0a, 0x13, 0x28, 0x28, 0x28, 0x28,
  295. 0x07, 0x08, 0x0a, 0x1a, 0x28, 0x28, 0x28, 0x28,
  296. 0x0a, 0x0a, 0x16, 0x28, 0x28, 0x28, 0x28, 0x28,
  297. 0x13, 0x1a, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
  298. 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
  299. 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
  300. 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28,
  301. 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28}
  302. };
  303. /* read 'len' bytes to gspca_dev->usb_buf */
  304. static void reg_r(struct gspca_dev *gspca_dev,
  305. __u16 index,
  306. __u16 length)
  307. {
  308. usb_control_msg(gspca_dev->dev,
  309. usb_rcvctrlpipe(gspca_dev->dev, 0),
  310. 0,
  311. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  312. 0, /* value */
  313. index, gspca_dev->usb_buf, length, 500);
  314. }
  315. static int reg_w(struct gspca_dev *gspca_dev,
  316. __u16 req, __u16 index, __u16 value)
  317. {
  318. int ret;
  319. PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x", index, value);
  320. ret = usb_control_msg(gspca_dev->dev,
  321. usb_sndctrlpipe(gspca_dev->dev, 0),
  322. req,
  323. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  324. value, index, NULL, 0, 500);
  325. if (ret < 0)
  326. pr_err("reg write: error %d\n", ret);
  327. return ret;
  328. }
  329. /* returns: negative is error, pos or zero is data */
  330. static int reg_r_12(struct gspca_dev *gspca_dev,
  331. __u16 req, /* bRequest */
  332. __u16 index, /* wIndex */
  333. __u16 length) /* wLength (1 or 2 only) */
  334. {
  335. int ret;
  336. gspca_dev->usb_buf[1] = 0;
  337. ret = usb_control_msg(gspca_dev->dev,
  338. usb_rcvctrlpipe(gspca_dev->dev, 0),
  339. req,
  340. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  341. 0, /* value */
  342. index,
  343. gspca_dev->usb_buf, length,
  344. 500); /* timeout */
  345. if (ret < 0) {
  346. pr_err("reg_r_12 err %d\n", ret);
  347. return ret;
  348. }
  349. return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0];
  350. }
  351. /*
  352. * Simple function to wait for a given 8-bit value to be returned from
  353. * a reg_read call.
  354. * Returns: negative is error or timeout, zero is success.
  355. */
  356. static int reg_r_wait(struct gspca_dev *gspca_dev,
  357. __u16 reg, __u16 index, __u16 value)
  358. {
  359. int ret, cnt = 20;
  360. while (--cnt > 0) {
  361. ret = reg_r_12(gspca_dev, reg, index, 1);
  362. if (ret == value)
  363. return 0;
  364. msleep(50);
  365. }
  366. return -EIO;
  367. }
  368. static int write_vector(struct gspca_dev *gspca_dev,
  369. const __u16 data[][3])
  370. {
  371. int ret, i = 0;
  372. while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) {
  373. ret = reg_w(gspca_dev, data[i][0], data[i][2], data[i][1]);
  374. if (ret < 0)
  375. return ret;
  376. i++;
  377. }
  378. return 0;
  379. }
  380. static int spca50x_setup_qtable(struct gspca_dev *gspca_dev,
  381. unsigned int request,
  382. unsigned int ybase,
  383. unsigned int cbase,
  384. const __u8 qtable[2][64])
  385. {
  386. int i, err;
  387. /* loop over y components */
  388. for (i = 0; i < 64; i++) {
  389. err = reg_w(gspca_dev, request, ybase + i, qtable[0][i]);
  390. if (err < 0)
  391. return err;
  392. }
  393. /* loop over c components */
  394. for (i = 0; i < 64; i++) {
  395. err = reg_w(gspca_dev, request, cbase + i, qtable[1][i]);
  396. if (err < 0)
  397. return err;
  398. }
  399. return 0;
  400. }
  401. static void spca500_ping310(struct gspca_dev *gspca_dev)
  402. {
  403. reg_r(gspca_dev, 0x0d04, 2);
  404. PDEBUG(D_STREAM, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x",
  405. gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
  406. }
  407. static void spca500_clksmart310_init(struct gspca_dev *gspca_dev)
  408. {
  409. reg_r(gspca_dev, 0x0d05, 2);
  410. PDEBUG(D_STREAM, "ClickSmart310 init 0x0d05 0x%02x 0x%02x",
  411. gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]);
  412. reg_w(gspca_dev, 0x00, 0x8167, 0x5a);
  413. spca500_ping310(gspca_dev);
  414. reg_w(gspca_dev, 0x00, 0x8168, 0x22);
  415. reg_w(gspca_dev, 0x00, 0x816a, 0xc0);
  416. reg_w(gspca_dev, 0x00, 0x816b, 0x0b);
  417. reg_w(gspca_dev, 0x00, 0x8169, 0x25);
  418. reg_w(gspca_dev, 0x00, 0x8157, 0x5b);
  419. reg_w(gspca_dev, 0x00, 0x8158, 0x5b);
  420. reg_w(gspca_dev, 0x00, 0x813f, 0x03);
  421. reg_w(gspca_dev, 0x00, 0x8151, 0x4a);
  422. reg_w(gspca_dev, 0x00, 0x8153, 0x78);
  423. reg_w(gspca_dev, 0x00, 0x0d01, 0x04);
  424. /* 00 for adjust shutter */
  425. reg_w(gspca_dev, 0x00, 0x0d02, 0x01);
  426. reg_w(gspca_dev, 0x00, 0x8169, 0x25);
  427. reg_w(gspca_dev, 0x00, 0x0d01, 0x02);
  428. }
  429. static void spca500_setmode(struct gspca_dev *gspca_dev,
  430. __u8 xmult, __u8 ymult)
  431. {
  432. int mode;
  433. /* set x multiplier */
  434. reg_w(gspca_dev, 0, 0x8001, xmult);
  435. /* set y multiplier */
  436. reg_w(gspca_dev, 0, 0x8002, ymult);
  437. /* use compressed mode, VGA, with mode specific subsample */
  438. mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
  439. reg_w(gspca_dev, 0, 0x8003, mode << 4);
  440. }
  441. static int spca500_full_reset(struct gspca_dev *gspca_dev)
  442. {
  443. int err;
  444. /* send the reset command */
  445. err = reg_w(gspca_dev, 0xe0, 0x0001, 0x0000);
  446. if (err < 0)
  447. return err;
  448. /* wait for the reset to complete */
  449. err = reg_r_wait(gspca_dev, 0x06, 0x0000, 0x0000);
  450. if (err < 0)
  451. return err;
  452. err = reg_w(gspca_dev, 0xe0, 0x0000, 0x0000);
  453. if (err < 0)
  454. return err;
  455. err = reg_r_wait(gspca_dev, 0x06, 0, 0);
  456. if (err < 0) {
  457. PDEBUG(D_ERR, "reg_r_wait() failed");
  458. return err;
  459. }
  460. /* all ok */
  461. return 0;
  462. }
  463. /* Synchro the Bridge with sensor */
  464. /* Maybe that will work on all spca500 chip */
  465. /* because i only own a clicksmart310 try for that chip */
  466. /* using spca50x_set_packet_size() cause an Ooops here */
  467. /* usb_set_interface from kernel 2.6.x clear all the urb stuff */
  468. /* up-port the same feature as in 2.4.x kernel */
  469. static int spca500_synch310(struct gspca_dev *gspca_dev)
  470. {
  471. if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) {
  472. PDEBUG(D_ERR, "Set packet size: set interface error");
  473. goto error;
  474. }
  475. spca500_ping310(gspca_dev);
  476. reg_r(gspca_dev, 0x0d00, 1);
  477. /* need alt setting here */
  478. PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt);
  479. /* Windoze use pipe with altsetting 6 why 7 here */
  480. if (usb_set_interface(gspca_dev->dev,
  481. gspca_dev->iface,
  482. gspca_dev->alt) < 0) {
  483. PDEBUG(D_ERR, "Set packet size: set interface error");
  484. goto error;
  485. }
  486. return 0;
  487. error:
  488. return -EBUSY;
  489. }
  490. static void spca500_reinit(struct gspca_dev *gspca_dev)
  491. {
  492. int err;
  493. __u8 Data;
  494. /* some unknown command from Aiptek pocket dv and family300 */
  495. reg_w(gspca_dev, 0x00, 0x0d01, 0x01);
  496. reg_w(gspca_dev, 0x00, 0x0d03, 0x00);
  497. reg_w(gspca_dev, 0x00, 0x0d02, 0x01);
  498. /* enable drop packet */
  499. reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  500. err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840,
  501. qtable_pocketdv);
  502. if (err < 0)
  503. PDEBUG(D_ERR|D_STREAM, "spca50x_setup_qtable failed on init");
  504. /* set qtable index */
  505. reg_w(gspca_dev, 0x00, 0x8880, 2);
  506. /* family cam Quicksmart stuff */
  507. reg_w(gspca_dev, 0x00, 0x800a, 0x00);
  508. /* Set agc transfer: synced between frames */
  509. reg_w(gspca_dev, 0x00, 0x820f, 0x01);
  510. /* Init SDRAM - needed for SDRAM access */
  511. reg_w(gspca_dev, 0x00, 0x870a, 0x04);
  512. /*Start init sequence or stream */
  513. reg_w(gspca_dev, 0, 0x8003, 0x00);
  514. /* switch to video camera mode */
  515. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  516. msleep(2000);
  517. if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) {
  518. reg_r(gspca_dev, 0x816b, 1);
  519. Data = gspca_dev->usb_buf[0];
  520. reg_w(gspca_dev, 0x00, 0x816b, Data);
  521. }
  522. }
  523. /* this function is called at probe time */
  524. static int sd_config(struct gspca_dev *gspca_dev,
  525. const struct usb_device_id *id)
  526. {
  527. struct sd *sd = (struct sd *) gspca_dev;
  528. struct cam *cam;
  529. cam = &gspca_dev->cam;
  530. sd->subtype = id->driver_info;
  531. if (sd->subtype != LogitechClickSmart310) {
  532. cam->cam_mode = vga_mode;
  533. cam->nmodes = ARRAY_SIZE(vga_mode);
  534. } else {
  535. cam->cam_mode = sif_mode;
  536. cam->nmodes = ARRAY_SIZE(sif_mode);
  537. }
  538. return 0;
  539. }
  540. /* this function is called at probe and resume time */
  541. static int sd_init(struct gspca_dev *gspca_dev)
  542. {
  543. struct sd *sd = (struct sd *) gspca_dev;
  544. /* initialisation of spca500 based cameras is deferred */
  545. PDEBUG(D_STREAM, "SPCA500 init");
  546. if (sd->subtype == LogitechClickSmart310)
  547. spca500_clksmart310_init(gspca_dev);
  548. /* else
  549. spca500_initialise(gspca_dev); */
  550. PDEBUG(D_STREAM, "SPCA500 init done");
  551. return 0;
  552. }
  553. static int sd_start(struct gspca_dev *gspca_dev)
  554. {
  555. struct sd *sd = (struct sd *) gspca_dev;
  556. int err;
  557. __u8 Data;
  558. __u8 xmult, ymult;
  559. /* create the JPEG header */
  560. jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
  561. 0x22); /* JPEG 411 */
  562. jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual));
  563. if (sd->subtype == LogitechClickSmart310) {
  564. xmult = 0x16;
  565. ymult = 0x12;
  566. } else {
  567. xmult = 0x28;
  568. ymult = 0x1e;
  569. }
  570. /* is there a sensor here ? */
  571. reg_r(gspca_dev, 0x8a04, 1);
  572. PDEBUG(D_STREAM, "Spca500 Sensor Address 0x%02x",
  573. gspca_dev->usb_buf[0]);
  574. PDEBUG(D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02x, Ymult: 0x%02x",
  575. gspca_dev->curr_mode, xmult, ymult);
  576. /* setup qtable */
  577. switch (sd->subtype) {
  578. case LogitechClickSmart310:
  579. spca500_setmode(gspca_dev, xmult, ymult);
  580. /* enable drop packet */
  581. reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  582. reg_w(gspca_dev, 0x00, 0x8880, 3);
  583. err = spca50x_setup_qtable(gspca_dev,
  584. 0x00, 0x8800, 0x8840,
  585. qtable_creative_pccam);
  586. if (err < 0)
  587. PDEBUG(D_ERR, "spca50x_setup_qtable failed");
  588. /* Init SDRAM - needed for SDRAM access */
  589. reg_w(gspca_dev, 0x00, 0x870a, 0x04);
  590. /* switch to video camera mode */
  591. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  592. msleep(500);
  593. if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
  594. PDEBUG(D_ERR, "reg_r_wait() failed");
  595. reg_r(gspca_dev, 0x816b, 1);
  596. Data = gspca_dev->usb_buf[0];
  597. reg_w(gspca_dev, 0x00, 0x816b, Data);
  598. spca500_synch310(gspca_dev);
  599. write_vector(gspca_dev, spca500_visual_defaults);
  600. spca500_setmode(gspca_dev, xmult, ymult);
  601. /* enable drop packet */
  602. err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  603. if (err < 0)
  604. PDEBUG(D_ERR, "failed to enable drop packet");
  605. reg_w(gspca_dev, 0x00, 0x8880, 3);
  606. err = spca50x_setup_qtable(gspca_dev,
  607. 0x00, 0x8800, 0x8840,
  608. qtable_creative_pccam);
  609. if (err < 0)
  610. PDEBUG(D_ERR, "spca50x_setup_qtable failed");
  611. /* Init SDRAM - needed for SDRAM access */
  612. reg_w(gspca_dev, 0x00, 0x870a, 0x04);
  613. /* switch to video camera mode */
  614. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  615. if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
  616. PDEBUG(D_ERR, "reg_r_wait() failed");
  617. reg_r(gspca_dev, 0x816b, 1);
  618. Data = gspca_dev->usb_buf[0];
  619. reg_w(gspca_dev, 0x00, 0x816b, Data);
  620. break;
  621. case CreativePCCam300: /* Creative PC-CAM 300 640x480 CCD */
  622. case IntelPocketPCCamera: /* FIXME: Temporary fix for
  623. * Intel Pocket PC Camera
  624. * - NWG (Sat 29th March 2003) */
  625. /* do a full reset */
  626. err = spca500_full_reset(gspca_dev);
  627. if (err < 0)
  628. PDEBUG(D_ERR, "spca500_full_reset failed");
  629. /* enable drop packet */
  630. err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  631. if (err < 0)
  632. PDEBUG(D_ERR, "failed to enable drop packet");
  633. reg_w(gspca_dev, 0x00, 0x8880, 3);
  634. err = spca50x_setup_qtable(gspca_dev,
  635. 0x00, 0x8800, 0x8840,
  636. qtable_creative_pccam);
  637. if (err < 0)
  638. PDEBUG(D_ERR, "spca50x_setup_qtable failed");
  639. spca500_setmode(gspca_dev, xmult, ymult);
  640. reg_w(gspca_dev, 0x20, 0x0001, 0x0004);
  641. /* switch to video camera mode */
  642. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  643. if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
  644. PDEBUG(D_ERR, "reg_r_wait() failed");
  645. reg_r(gspca_dev, 0x816b, 1);
  646. Data = gspca_dev->usb_buf[0];
  647. reg_w(gspca_dev, 0x00, 0x816b, Data);
  648. /* write_vector(gspca_dev, spca500_visual_defaults); */
  649. break;
  650. case KodakEZ200: /* Kodak EZ200 */
  651. /* do a full reset */
  652. err = spca500_full_reset(gspca_dev);
  653. if (err < 0)
  654. PDEBUG(D_ERR, "spca500_full_reset failed");
  655. /* enable drop packet */
  656. reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  657. reg_w(gspca_dev, 0x00, 0x8880, 0);
  658. err = spca50x_setup_qtable(gspca_dev,
  659. 0x00, 0x8800, 0x8840,
  660. qtable_kodak_ez200);
  661. if (err < 0)
  662. PDEBUG(D_ERR, "spca50x_setup_qtable failed");
  663. spca500_setmode(gspca_dev, xmult, ymult);
  664. reg_w(gspca_dev, 0x20, 0x0001, 0x0004);
  665. /* switch to video camera mode */
  666. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  667. if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0)
  668. PDEBUG(D_ERR, "reg_r_wait() failed");
  669. reg_r(gspca_dev, 0x816b, 1);
  670. Data = gspca_dev->usb_buf[0];
  671. reg_w(gspca_dev, 0x00, 0x816b, Data);
  672. /* write_vector(gspca_dev, spca500_visual_defaults); */
  673. break;
  674. case BenqDC1016:
  675. case DLinkDSC350: /* FamilyCam 300 */
  676. case AiptekPocketDV: /* Aiptek PocketDV */
  677. case Gsmartmini: /*Mustek Gsmart Mini */
  678. case MustekGsmart300: /* Mustek Gsmart 300 */
  679. case PalmPixDC85:
  680. case Optimedia:
  681. case ToptroIndus:
  682. case AgfaCl20:
  683. spca500_reinit(gspca_dev);
  684. reg_w(gspca_dev, 0x00, 0x0d01, 0x01);
  685. /* enable drop packet */
  686. reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  687. err = spca50x_setup_qtable(gspca_dev,
  688. 0x00, 0x8800, 0x8840, qtable_pocketdv);
  689. if (err < 0)
  690. PDEBUG(D_ERR, "spca50x_setup_qtable failed");
  691. reg_w(gspca_dev, 0x00, 0x8880, 2);
  692. /* familycam Quicksmart pocketDV stuff */
  693. reg_w(gspca_dev, 0x00, 0x800a, 0x00);
  694. /* Set agc transfer: synced between frames */
  695. reg_w(gspca_dev, 0x00, 0x820f, 0x01);
  696. /* Init SDRAM - needed for SDRAM access */
  697. reg_w(gspca_dev, 0x00, 0x870a, 0x04);
  698. spca500_setmode(gspca_dev, xmult, ymult);
  699. /* switch to video camera mode */
  700. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  701. reg_r_wait(gspca_dev, 0, 0x8000, 0x44);
  702. reg_r(gspca_dev, 0x816b, 1);
  703. Data = gspca_dev->usb_buf[0];
  704. reg_w(gspca_dev, 0x00, 0x816b, Data);
  705. break;
  706. case LogitechTraveler:
  707. case LogitechClickSmart510:
  708. reg_w(gspca_dev, 0x02, 0x00, 0x00);
  709. /* enable drop packet */
  710. reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
  711. err = spca50x_setup_qtable(gspca_dev,
  712. 0x00, 0x8800,
  713. 0x8840, qtable_creative_pccam);
  714. if (err < 0)
  715. PDEBUG(D_ERR, "spca50x_setup_qtable failed");
  716. reg_w(gspca_dev, 0x00, 0x8880, 3);
  717. reg_w(gspca_dev, 0x00, 0x800a, 0x00);
  718. /* Init SDRAM - needed for SDRAM access */
  719. reg_w(gspca_dev, 0x00, 0x870a, 0x04);
  720. spca500_setmode(gspca_dev, xmult, ymult);
  721. /* switch to video camera mode */
  722. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  723. reg_r_wait(gspca_dev, 0, 0x8000, 0x44);
  724. reg_r(gspca_dev, 0x816b, 1);
  725. Data = gspca_dev->usb_buf[0];
  726. reg_w(gspca_dev, 0x00, 0x816b, Data);
  727. write_vector(gspca_dev, Clicksmart510_defaults);
  728. break;
  729. }
  730. return 0;
  731. }
  732. static void sd_stopN(struct gspca_dev *gspca_dev)
  733. {
  734. reg_w(gspca_dev, 0, 0x8003, 0x00);
  735. /* switch to video camera mode */
  736. reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
  737. reg_r(gspca_dev, 0x8000, 1);
  738. PDEBUG(D_STREAM, "stop SPCA500 done reg8000: 0x%2x",
  739. gspca_dev->usb_buf[0]);
  740. }
  741. static void sd_pkt_scan(struct gspca_dev *gspca_dev,
  742. u8 *data, /* isoc packet */
  743. int len) /* iso packet length */
  744. {
  745. struct sd *sd = (struct sd *) gspca_dev;
  746. int i;
  747. static __u8 ffd9[] = {0xff, 0xd9};
  748. /* frames are jpeg 4.1.1 without 0xff escape */
  749. if (data[0] == 0xff) {
  750. if (data[1] != 0x01) { /* drop packet */
  751. /* gspca_dev->last_packet_type = DISCARD_PACKET; */
  752. return;
  753. }
  754. gspca_frame_add(gspca_dev, LAST_PACKET,
  755. ffd9, 2);
  756. /* put the JPEG header in the new frame */
  757. gspca_frame_add(gspca_dev, FIRST_PACKET,
  758. sd->jpeg_hdr, JPEG_HDR_SZ);
  759. data += SPCA500_OFFSET_DATA;
  760. len -= SPCA500_OFFSET_DATA;
  761. } else {
  762. data += 1;
  763. len -= 1;
  764. }
  765. /* add 0x00 after 0xff */
  766. i = 0;
  767. do {
  768. if (data[i] == 0xff) {
  769. gspca_frame_add(gspca_dev, INTER_PACKET,
  770. data, i + 1);
  771. len -= i;
  772. data += i;
  773. *data = 0x00;
  774. i = 0;
  775. }
  776. i++;
  777. } while (i < len);
  778. gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
  779. }
  780. static void setbrightness(struct gspca_dev *gspca_dev, s32 val)
  781. {
  782. reg_w(gspca_dev, 0x00, 0x8167,
  783. (__u8) (val - 128));
  784. }
  785. static void setcontrast(struct gspca_dev *gspca_dev, s32 val)
  786. {
  787. reg_w(gspca_dev, 0x00, 0x8168, val);
  788. }
  789. static void setcolors(struct gspca_dev *gspca_dev, s32 val)
  790. {
  791. reg_w(gspca_dev, 0x00, 0x8169, val);
  792. }
  793. static int sd_set_jcomp(struct gspca_dev *gspca_dev,
  794. struct v4l2_jpegcompression *jcomp)
  795. {
  796. struct sd *sd = (struct sd *) gspca_dev;
  797. v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
  798. return 0;
  799. }
  800. static int sd_get_jcomp(struct gspca_dev *gspca_dev,
  801. struct v4l2_jpegcompression *jcomp)
  802. {
  803. struct sd *sd = (struct sd *) gspca_dev;
  804. memset(jcomp, 0, sizeof *jcomp);
  805. jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
  806. jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
  807. | V4L2_JPEG_MARKER_DQT;
  808. return 0;
  809. }
  810. static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
  811. {
  812. struct gspca_dev *gspca_dev =
  813. container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
  814. struct sd *sd = (struct sd *)gspca_dev;
  815. gspca_dev->usb_err = 0;
  816. if (!gspca_dev->streaming)
  817. return 0;
  818. switch (ctrl->id) {
  819. case V4L2_CID_BRIGHTNESS:
  820. setbrightness(gspca_dev, ctrl->val);
  821. break;
  822. case V4L2_CID_CONTRAST:
  823. setcontrast(gspca_dev, ctrl->val);
  824. break;
  825. case V4L2_CID_SATURATION:
  826. setcolors(gspca_dev, ctrl->val);
  827. break;
  828. case V4L2_CID_JPEG_COMPRESSION_QUALITY:
  829. jpeg_set_qual(sd->jpeg_hdr, ctrl->val);
  830. break;
  831. }
  832. return gspca_dev->usb_err;
  833. }
  834. static const struct v4l2_ctrl_ops sd_ctrl_ops = {
  835. .s_ctrl = sd_s_ctrl,
  836. };
  837. static int sd_init_controls(struct gspca_dev *gspca_dev)
  838. {
  839. struct sd *sd = (struct sd *)gspca_dev;
  840. struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
  841. gspca_dev->vdev.ctrl_handler = hdl;
  842. v4l2_ctrl_handler_init(hdl, 4);
  843. v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
  844. V4L2_CID_BRIGHTNESS, 0, 255, 1, 127);
  845. v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
  846. V4L2_CID_CONTRAST, 0, 63, 1, 31);
  847. v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
  848. V4L2_CID_SATURATION, 0, 63, 1, 31);
  849. sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
  850. V4L2_CID_JPEG_COMPRESSION_QUALITY,
  851. QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
  852. if (hdl->error) {
  853. pr_err("Could not initialize controls\n");
  854. return hdl->error;
  855. }
  856. return 0;
  857. }
  858. /* sub-driver description */
  859. static const struct sd_desc sd_desc = {
  860. .name = MODULE_NAME,
  861. .config = sd_config,
  862. .init = sd_init,
  863. .init_controls = sd_init_controls,
  864. .start = sd_start,
  865. .stopN = sd_stopN,
  866. .pkt_scan = sd_pkt_scan,
  867. .get_jcomp = sd_get_jcomp,
  868. .set_jcomp = sd_set_jcomp,
  869. };
  870. /* -- module initialisation -- */
  871. static const struct usb_device_id device_table[] = {
  872. {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200},
  873. {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300},
  874. {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler},
  875. {USB_DEVICE(0x046d, 0x0900), .driver_info = LogitechClickSmart310},
  876. {USB_DEVICE(0x046d, 0x0901), .driver_info = LogitechClickSmart510},
  877. {USB_DEVICE(0x04a5, 0x300c), .driver_info = BenqDC1016},
  878. {USB_DEVICE(0x04fc, 0x7333), .driver_info = PalmPixDC85},
  879. {USB_DEVICE(0x055f, 0xc200), .driver_info = MustekGsmart300},
  880. {USB_DEVICE(0x055f, 0xc220), .driver_info = Gsmartmini},
  881. {USB_DEVICE(0x06bd, 0x0404), .driver_info = AgfaCl20},
  882. {USB_DEVICE(0x06be, 0x0800), .driver_info = Optimedia},
  883. {USB_DEVICE(0x084d, 0x0003), .driver_info = DLinkDSC350},
  884. {USB_DEVICE(0x08ca, 0x0103), .driver_info = AiptekPocketDV},
  885. {USB_DEVICE(0x2899, 0x012c), .driver_info = ToptroIndus},
  886. {USB_DEVICE(0x8086, 0x0630), .driver_info = IntelPocketPCCamera},
  887. {}
  888. };
  889. MODULE_DEVICE_TABLE(usb, device_table);
  890. /* -- device connect -- */
  891. static int sd_probe(struct usb_interface *intf,
  892. const struct usb_device_id *id)
  893. {
  894. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  895. THIS_MODULE);
  896. }
  897. static struct usb_driver sd_driver = {
  898. .name = MODULE_NAME,
  899. .id_table = device_table,
  900. .probe = sd_probe,
  901. .disconnect = gspca_disconnect,
  902. #ifdef CONFIG_PM
  903. .suspend = gspca_suspend,
  904. .resume = gspca_resume,
  905. #endif
  906. };
  907. module_usb_driver(sd_driver);