t613.c 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  1. /*
  2. *Notes: * t613 + tas5130A
  3. * * Focus to light do not balance well as in win.
  4. * Quality in win is not good, but its kinda better.
  5. * * Fix some "extraneous bytes", most of apps will show the image anyway
  6. * * Gamma table, is there, but its really doing something?
  7. * * 7~8 Fps, its ok, max on win its 10.
  8. * Costantino Leandro
  9. *
  10. * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. */
  26. #define MODULE_NAME "t613"
  27. #include "gspca.h"
  28. #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
  29. static const char version[] = "2.1.0";
  30. struct control_menu_info {
  31. int value;
  32. char name[32];
  33. };
  34. #define MAX_GAMMA 0x10 /* 0 to 15 */
  35. /* From LUVCVIEW */
  36. #define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3)
  37. MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>");
  38. MODULE_DESCRIPTION("GSPCA/T613 (JPEG Compliance) USB Camera Driver");
  39. MODULE_LICENSE("GPL");
  40. struct sd {
  41. struct gspca_dev gspca_dev; /* !! must be the first item */
  42. unsigned char brightness;
  43. unsigned char contrast;
  44. unsigned char colors;
  45. unsigned char autogain;
  46. unsigned char gamma;
  47. unsigned char sharpness;
  48. unsigned char freq;
  49. unsigned char whitebalance;
  50. unsigned char mirror;
  51. unsigned char effect;
  52. };
  53. /* V4L2 controls supported by the driver */
  54. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
  55. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
  56. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
  57. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
  58. static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
  59. static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
  60. static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val);
  61. static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val);
  62. static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val);
  63. static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val);
  64. static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val);
  65. static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val);
  66. static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
  67. static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
  68. static int sd_setwhitebalance(struct gspca_dev *gspca_dev, __s32 val);
  69. static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val);
  70. static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val);
  71. static int sd_getflip(struct gspca_dev *gspca_dev, __s32 *val);
  72. static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val);
  73. static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val);
  74. static int sd_querymenu(struct gspca_dev *gspca_dev,
  75. struct v4l2_querymenu *menu);
  76. static struct ctrl sd_ctrls[] = {
  77. #define SD_BRIGHTNESS 0
  78. {
  79. {
  80. .id = V4L2_CID_BRIGHTNESS,
  81. .type = V4L2_CTRL_TYPE_INTEGER,
  82. .name = "Brightness",
  83. .minimum = 0,
  84. .maximum = 0x0f,
  85. .step = 1,
  86. .default_value = 0x09,
  87. },
  88. .set = sd_setbrightness,
  89. .get = sd_getbrightness,
  90. },
  91. #define SD_CONTRAST 1
  92. {
  93. {
  94. .id = V4L2_CID_CONTRAST,
  95. .type = V4L2_CTRL_TYPE_INTEGER,
  96. .name = "Contrast",
  97. .minimum = 0,
  98. .maximum = 0x0d,
  99. .step = 1,
  100. .default_value = 0x07,
  101. },
  102. .set = sd_setcontrast,
  103. .get = sd_getcontrast,
  104. },
  105. #define SD_COLOR 2
  106. {
  107. {
  108. .id = V4L2_CID_SATURATION,
  109. .type = V4L2_CTRL_TYPE_INTEGER,
  110. .name = "Color",
  111. .minimum = 0,
  112. .maximum = 0x0f,
  113. .step = 1,
  114. .default_value = 0x05,
  115. },
  116. .set = sd_setcolors,
  117. .get = sd_getcolors,
  118. },
  119. #define SD_GAMMA 3
  120. {
  121. {
  122. .id = V4L2_CID_GAMMA, /* (gamma on win) */
  123. .type = V4L2_CTRL_TYPE_INTEGER,
  124. .name = "Gamma (Untested)",
  125. .minimum = 0,
  126. .maximum = MAX_GAMMA,
  127. .step = 1,
  128. .default_value = 0x09,
  129. },
  130. .set = sd_setgamma,
  131. .get = sd_getgamma,
  132. },
  133. #define SD_AUTOGAIN 4
  134. {
  135. {
  136. .id = V4L2_CID_GAIN, /* here, i activate only the lowlight,
  137. * some apps dont bring up the
  138. * backligth_compensation control) */
  139. .type = V4L2_CTRL_TYPE_INTEGER,
  140. .name = "Low Light",
  141. .minimum = 0,
  142. .maximum = 1,
  143. .step = 1,
  144. .default_value = 0x01,
  145. },
  146. .set = sd_setlowlight,
  147. .get = sd_getlowlight,
  148. },
  149. #define SD_MIRROR 5
  150. {
  151. {
  152. .id = V4L2_CID_HFLIP,
  153. .type = V4L2_CTRL_TYPE_BOOLEAN,
  154. .name = "Mirror Image",
  155. .minimum = 0,
  156. .maximum = 1,
  157. .step = 1,
  158. .default_value = 0,
  159. },
  160. .set = sd_setflip,
  161. .get = sd_getflip
  162. },
  163. #define SD_LIGHTFREQ 6
  164. {
  165. {
  166. .id = V4L2_CID_POWER_LINE_FREQUENCY,
  167. .type = V4L2_CTRL_TYPE_MENU,
  168. .name = "Light Frequency Filter",
  169. .minimum = 1, /* 1 -> 0x50, 2->0x60 */
  170. .maximum = 2,
  171. .step = 1,
  172. .default_value = 1,
  173. },
  174. .set = sd_setfreq,
  175. .get = sd_getfreq},
  176. #define SD_WHITE_BALANCE 7
  177. {
  178. {
  179. .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE,
  180. .type = V4L2_CTRL_TYPE_INTEGER,
  181. .name = "White Balance",
  182. .minimum = 0,
  183. .maximum = 1,
  184. .step = 1,
  185. .default_value = 1,
  186. },
  187. .set = sd_setwhitebalance,
  188. .get = sd_getwhitebalance
  189. },
  190. #define SD_SHARPNESS 8 /* (aka definition on win) */
  191. {
  192. {
  193. .id = V4L2_CID_SHARPNESS,
  194. .type = V4L2_CTRL_TYPE_INTEGER,
  195. .name = "Sharpness",
  196. .minimum = 0,
  197. .maximum = MAX_GAMMA, /* 0 to 16 */
  198. .step = 1,
  199. .default_value = 0x06,
  200. },
  201. .set = sd_setsharpness,
  202. .get = sd_getsharpness,
  203. },
  204. #define SD_EFFECTS 9
  205. {
  206. {
  207. .id = V4L2_CID_EFFECTS,
  208. .type = V4L2_CTRL_TYPE_MENU,
  209. .name = "Webcam Effects",
  210. .minimum = 0,
  211. .maximum = 4,
  212. .step = 1,
  213. .default_value = 0,
  214. },
  215. .set = sd_seteffect,
  216. .get = sd_geteffect
  217. },
  218. };
  219. static struct control_menu_info effects_control[] = {
  220. {0, "Normal"},
  221. {1, "Emboss"}, /* disabled */
  222. {2, "Monochrome"},
  223. {3, "Sepia"},
  224. {4, "Sketch"},
  225. {5, "Sun Effect"}, /* disabled */
  226. {6, "Negative"},
  227. };
  228. #define NUM_EFFECTS_CONTROL \
  229. (sizeof(effects_control)/sizeof(effects_control[0]))
  230. static struct cam_mode vga_mode_t16[] = {
  231. {V4L2_PIX_FMT_JPEG, 160, 120, 4},
  232. {V4L2_PIX_FMT_JPEG, 176, 144, 3},
  233. {V4L2_PIX_FMT_JPEG, 320, 240, 2},
  234. {V4L2_PIX_FMT_JPEG, 352, 288, 1},
  235. {V4L2_PIX_FMT_JPEG, 640, 480, 0},
  236. };
  237. #define T16_OFFSET_DATA 631
  238. #define MAX_EFFECTS 7
  239. /* easily done by soft, this table could be removed,
  240. * i keep it here just in case */
  241. unsigned char effects_table[MAX_EFFECTS][6] = {
  242. {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */
  243. {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */
  244. {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */
  245. {0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x80}, /* Sepia */
  246. {0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x02}, /* Croquis */
  247. {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x10}, /* Sun Effect */
  248. {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */
  249. };
  250. unsigned char gamma_table[MAX_GAMMA][34] = {
  251. {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85,
  252. 0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9,
  253. 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb,
  254. 0x9c, 0xe3, 0x9d, 0xea, 0x9e, 0xf1, 0x9f, 0xf8,
  255. 0xa0, 0xff},
  256. {0x90, 0x00, 0x91, 0x33, 0x92, 0x5A, 0x93, 0x75,
  257. 0x94, 0x85, 0x95, 0x93, 0x96, 0xA1, 0x97, 0xAD,
  258. 0x98, 0xB7, 0x99, 0xC2, 0x9A, 0xCB, 0x9B, 0xD4,
  259. 0x9C, 0xDE, 0x9D, 0xE7, 0x9E, 0xF0, 0x9F, 0xF7,
  260. 0xa0, 0xff},
  261. {0x90, 0x00, 0x91, 0x2F, 0x92, 0x51, 0x93, 0x6B,
  262. 0x94, 0x7C, 0x95, 0x8A, 0x96, 0x99, 0x97, 0xA6,
  263. 0x98, 0xB1, 0x99, 0xBC, 0x9A, 0xC6, 0x9B, 0xD0,
  264. 0x9C, 0xDB, 0x9D, 0xE4, 0x9E, 0xED, 0x9F, 0xF6,
  265. 0xa0, 0xff},
  266. {0x90, 0x00, 0x91, 0x29, 0x92, 0x48, 0x93, 0x60,
  267. 0x94, 0x72, 0x95, 0x81, 0x96, 0x90, 0x97, 0x9E,
  268. 0x98, 0xAA, 0x99, 0xB5, 0x9A, 0xBF, 0x9B, 0xCB,
  269. 0x9C, 0xD6, 0x9D, 0xE1, 0x9E, 0xEB, 0x9F, 0xF5,
  270. 0xa0, 0xff},
  271. {0x90, 0x00, 0x91, 0x23, 0x92, 0x3F, 0x93, 0x55,
  272. 0x94, 0x68, 0x95, 0x77, 0x96, 0x86, 0x97, 0x95,
  273. 0x98, 0xA2, 0x99, 0xAD, 0x9A, 0xB9, 0x9B, 0xC6,
  274. 0x9C, 0xD2, 0x9D, 0xDE, 0x9E, 0xE9, 0x9F, 0xF4,
  275. 0xa0, 0xff},
  276. {0x90, 0x00, 0x91, 0x1B, 0x92, 0x33, 0x93, 0x48,
  277. 0x94, 0x59, 0x95, 0x69, 0x96, 0x79, 0x97, 0x87,
  278. 0x98, 0x96, 0x99, 0xA3, 0x9A, 0xB1, 0x9B, 0xBE,
  279. 0x9C, 0xCC, 0x9D, 0xDA, 0x9E, 0xE7, 0x9F, 0xF3,
  280. 0xa0, 0xff},
  281. {0x90, 0x00, 0x91, 0x02, 0x92, 0x10, 0x93, 0x20,
  282. 0x94, 0x32, 0x95, 0x40, 0x96, 0x57, 0x97, 0x67,
  283. 0x98, 0x77, 0x99, 0x88, 0x9a, 0x99, 0x9b, 0xaa,
  284. 0x9c, 0xbb, 0x9d, 0xcc, 0x9e, 0xdd, 0x9f, 0xee,
  285. 0xa0, 0xff},
  286. {0x90, 0x00, 0x91, 0x02, 0x92, 0x14, 0x93, 0x26,
  287. 0x94, 0x38, 0x95, 0x4A, 0x96, 0x60, 0x97, 0x70,
  288. 0x98, 0x80, 0x99, 0x90, 0x9A, 0xA0, 0x9B, 0xB0,
  289. 0x9C, 0xC0, 0x9D, 0xD0, 0x9E, 0xE0, 0x9F, 0xF0,
  290. 0xa0, 0xff},
  291. {0x90, 0x00, 0x91, 0x10, 0x92, 0x22, 0x93, 0x35,
  292. 0x94, 0x47, 0x95, 0x5A, 0x96, 0x69, 0x97, 0x79,
  293. 0x98, 0x88, 0x99, 0x97, 0x9A, 0xA7, 0x9B, 0xB6,
  294. 0x9C, 0xC4, 0x9D, 0xD3, 0x9E, 0xE0, 0x9F, 0xF0,
  295. 0xa0, 0xff},
  296. {0x90, 0x00, 0x91, 0x10, 0x92, 0x26, 0x93, 0x40,
  297. 0x94, 0x54, 0x95, 0x65, 0x96, 0x75, 0x97, 0x84,
  298. 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd,
  299. 0x9c, 0xca, 0x9d, 0xd6, 0x9e, 0xe0, 0x9f, 0xf0,
  300. 0xa0, 0xff},
  301. {0x90, 0x00, 0x91, 0x18, 0x92, 0x2B, 0x93, 0x44,
  302. 0x94, 0x60, 0x95, 0x70, 0x96, 0x80, 0x97, 0x8E,
  303. 0x98, 0x9C, 0x99, 0xAA, 0x9A, 0xB7, 0x9B, 0xC4,
  304. 0x9C, 0xD0, 0x9D, 0xD8, 0x9E, 0xE2, 0x9F, 0xF0,
  305. 0xa0, 0xff},
  306. {0x90, 0x00, 0x91, 0x1A, 0x92, 0x34, 0x93, 0x52,
  307. 0x94, 0x66, 0x95, 0x7E, 0x96, 0x8D, 0x97, 0x9B,
  308. 0x98, 0xA8, 0x99, 0xB4, 0x9A, 0xC0, 0x9B, 0xCB,
  309. 0x9C, 0xD6, 0x9D, 0xE1, 0x9E, 0xEB, 0x9F, 0xF5,
  310. 0xa0, 0xff},
  311. {0x90, 0x00, 0x91, 0x3F, 0x92, 0x5A, 0x93, 0x6E,
  312. 0x94, 0x7F, 0x95, 0x8E, 0x96, 0x9C, 0x97, 0xA8,
  313. 0x98, 0xB4, 0x99, 0xBF, 0x9A, 0xC9, 0x9B, 0xD3,
  314. 0x9C, 0xDC, 0x9D, 0xE5, 0x9E, 0xEE, 0x9F, 0xF6,
  315. 0xA0, 0xFF},
  316. {0x90, 0x00, 0x91, 0x54, 0x92, 0x6F, 0x93, 0x83,
  317. 0x94, 0x93, 0x95, 0xA0, 0x96, 0xAD, 0x97, 0xB7,
  318. 0x98, 0xC2, 0x99, 0xCB, 0x9A, 0xD4, 0x9B, 0xDC,
  319. 0x9C, 0xE4, 0x9D, 0xEB, 0x9E, 0xF2, 0x9F, 0xF9,
  320. 0xa0, 0xff},
  321. {0x90, 0x00, 0x91, 0x6E, 0x92, 0x88, 0x93, 0x9A,
  322. 0x94, 0xA8, 0x95, 0xB3, 0x96, 0xBD, 0x97, 0xC6,
  323. 0x98, 0xCF, 0x99, 0xD6, 0x9A, 0xDD, 0x9B, 0xE3,
  324. 0x9C, 0xE9, 0x9D, 0xEF, 0x9E, 0xF4, 0x9F, 0xFA,
  325. 0xa0, 0xff},
  326. {0x90, 0x00, 0x91, 0x93, 0x92, 0xA8, 0x93, 0xB7,
  327. 0x94, 0xC1, 0x95, 0xCA, 0x96, 0xD2, 0x97, 0xD8,
  328. 0x98, 0xDE, 0x99, 0xE3, 0x9A, 0xE8, 0x9B, 0xED,
  329. 0x9C, 0xF1, 0x9D, 0xF5, 0x9E, 0xF8, 0x9F, 0xFC,
  330. 0xA0, 0xFF}
  331. };
  332. static __u8 tas5130a_sensor_init[][8] = {
  333. {0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09},
  334. {0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09},
  335. {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
  336. {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
  337. {},
  338. };
  339. static void t16RegRead(struct usb_device *dev,
  340. __u16 index, __u8 *buffer, __u16 length)
  341. {
  342. usb_control_msg(dev,
  343. usb_rcvctrlpipe(dev, 0),
  344. 0, /* request */
  345. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  346. 0, /* value */
  347. index, buffer, length, 500);
  348. }
  349. static void t16RegWrite(struct usb_device *dev,
  350. __u16 value,
  351. __u16 index, __u8 *buffer, __u16 length)
  352. {
  353. usb_control_msg(dev,
  354. usb_sndctrlpipe(dev, 0),
  355. 0, /* request */
  356. USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  357. value, index, buffer, length, 500);
  358. }
  359. /* this function is called at probe time */
  360. static int sd_config(struct gspca_dev *gspca_dev,
  361. const struct usb_device_id *id)
  362. {
  363. struct sd *sd = (struct sd *) gspca_dev;
  364. struct cam *cam;
  365. cam = &gspca_dev->cam;
  366. cam->dev_name = (char *) id->driver_info;
  367. cam->epaddr = 0x01;
  368. cam->cam_mode = vga_mode_t16;
  369. cam->nmodes = ARRAY_SIZE(vga_mode_t16);
  370. sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
  371. sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
  372. sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
  373. sd->gamma = sd_ctrls[SD_GAMMA].qctrl.default_value;
  374. sd->mirror = sd_ctrls[SD_MIRROR].qctrl.default_value;
  375. sd->freq = sd_ctrls[SD_LIGHTFREQ].qctrl.default_value;
  376. sd->whitebalance = sd_ctrls[SD_WHITE_BALANCE].qctrl.default_value;
  377. sd->sharpness = sd_ctrls[SD_SHARPNESS].qctrl.default_value;
  378. sd->effect = sd_ctrls[SD_EFFECTS].qctrl.default_value;
  379. return 0;
  380. }
  381. static int init_default_parameters(struct gspca_dev *gspca_dev)
  382. {
  383. struct usb_device *dev = gspca_dev->dev;
  384. /* some of this registers are not really neded, because
  385. * they are overriden by setbrigthness, setcontrast, etc,
  386. * but wont hurt anyway, and can help someone with similar webcam
  387. * to see the initial parameters.*/
  388. int i = 0;
  389. __u8 test_byte;
  390. static unsigned char read_indexs[] =
  391. { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5,
  392. 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 };
  393. static unsigned char n1[6] =
  394. {0x08, 0x03, 0x09, 0x03, 0x12, 0x04};
  395. static unsigned char n2[2] =
  396. {0x08, 0x00};
  397. static unsigned char nset[6] =
  398. { 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 };
  399. static unsigned char n3[6] =
  400. {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04};
  401. static unsigned char n4[0x46] =
  402. {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c,
  403. 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68,
  404. 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1,
  405. 0xa2, 0x60, 0xa5, 0x30, 0xa6, 0x3a, 0xa8, 0xe8,
  406. 0xae, 0x05, 0xb1, 0x00, 0xbb, 0x04, 0xbc, 0x48,
  407. 0xbe, 0x36, 0xc6, 0x88, 0xe9, 0x00, 0xc5, 0xc0,
  408. 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68,
  409. 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40,
  410. 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46};
  411. static unsigned char nset4[18] = {
  412. 0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, 0xe4, 0xa8,
  413. 0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8,
  414. 0xe8, 0xe0
  415. };
  416. /* ojo puede ser 0xe6 en vez de 0xe9 */
  417. static unsigned char nset2[20] = {
  418. 0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb,
  419. 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27,
  420. 0xd8, 0xc8, 0xd9, 0xfc
  421. };
  422. static unsigned char missing[8] =
  423. { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
  424. static unsigned char nset3[18] = {
  425. 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8,
  426. 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8,
  427. 0xcf, 0xe0
  428. };
  429. static unsigned char nset5[4] =
  430. { 0x8f, 0x24, 0xc3, 0x00 }; /* bright */
  431. static unsigned char nset6[34] = {
  432. 0x90, 0x00, 0x91, 0x1c, 0x92, 0x30, 0x93, 0x43, 0x94, 0x54,
  433. 0x95, 0x65, 0x96, 0x75, 0x97, 0x84,
  434. 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca,
  435. 0x9d, 0xd8, 0x9e, 0xe5, 0x9f, 0xf2,
  436. 0xa0, 0xff
  437. }; /* Gamma */
  438. static unsigned char nset7[4] =
  439. { 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */
  440. static unsigned char nset9[4] =
  441. { 0x0b, 0x04, 0x0a, 0x78 };
  442. static unsigned char nset8[6] =
  443. { 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 };
  444. static unsigned char nset10[6] =
  445. { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 };
  446. t16RegWrite(dev, 0x01, 0x0000, n1, 0x06);
  447. t16RegWrite(dev, 0x01, 0x0000, nset, 0x06);
  448. t16RegRead(dev, 0x0063, &test_byte, 1);
  449. t16RegWrite(dev, 0x01, 0x0000, n2, 0x02);
  450. while (read_indexs[i] != 0x00) {
  451. t16RegRead(dev, read_indexs[i], &test_byte, 1);
  452. PDEBUG(D_CONF, "Reg 0x%x => 0x%x", read_indexs[i],
  453. test_byte);
  454. i++;
  455. }
  456. t16RegWrite(dev, 0x01, 0x0000, n3, 0x06);
  457. t16RegWrite(dev, 0x01, 0x0000, n4, 0x46);
  458. t16RegRead(dev, 0x0080, &test_byte, 1);
  459. t16RegWrite(dev, 0x00, 0x2c80, 0x00, 0x0);
  460. t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
  461. t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
  462. t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
  463. t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
  464. t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
  465. t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0);
  466. t16RegWrite(dev, 0x01, 00, nset5, 0x04);
  467. t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0);
  468. t16RegWrite(dev, 0x01, 00, nset6, 0x22);
  469. t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0);
  470. t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0);
  471. t16RegWrite(dev, 0x01, 00, missing, 0x08);
  472. t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0);
  473. t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0);
  474. t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0);
  475. t16RegWrite(dev, 0x01, 00, nset7, 0x4);
  476. t16RegWrite(dev, 0x01, 00, nset10, 0x06);
  477. t16RegWrite(dev, 0x01, 00, nset8, 0x06);
  478. t16RegWrite(dev, 0x01, 00, nset9, 0x04);
  479. t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x0);
  480. t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
  481. t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
  482. t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
  483. return 0;
  484. }
  485. static void setbrightness(struct gspca_dev *gspca_dev)
  486. {
  487. struct sd *sd = (struct sd *) gspca_dev;
  488. struct usb_device *dev = gspca_dev->dev;
  489. unsigned int brightness;
  490. unsigned char set6[4] = { 0x8f, 0x26, 0xc3, 0x80 };
  491. brightness = sd->brightness;
  492. if (brightness < 7) {
  493. set6[3] = 0x70 - (brightness * 0xa);
  494. } else {
  495. set6[1] = 0x24;
  496. set6[3] = 0x00 + ((brightness - 7) * 0xa);
  497. }
  498. t16RegWrite(dev, 0x01, 0x0000, set6, 4);
  499. }
  500. static void setflip(struct gspca_dev *gspca_dev)
  501. {
  502. struct sd *sd = (struct sd *) gspca_dev;
  503. struct usb_device *dev = gspca_dev->dev;
  504. unsigned char flipcmd[8] =
  505. { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 };
  506. if (sd->mirror == 1)
  507. flipcmd[3] = 0x01;
  508. t16RegWrite(dev, 0x01, 0x0000, flipcmd, 8);
  509. }
  510. static void seteffect(struct gspca_dev *gspca_dev)
  511. {
  512. struct sd *sd = (struct sd *) gspca_dev;
  513. struct usb_device *dev = gspca_dev->dev;
  514. t16RegWrite(dev, 0x01, 0x0000, effects_table[sd->effect], 0x06);
  515. if (sd->effect == 1 || sd->effect == 5) {
  516. PDEBUG(D_CONF,
  517. "This effect have been disabled for webcam \"safety\"");
  518. return;
  519. }
  520. if (sd->effect == 1 || sd->effect == 4)
  521. t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x00);
  522. else
  523. t16RegWrite(dev, 0x00, 0xfaa6, 0x00, 0x00);
  524. }
  525. static void setwhitebalance(struct gspca_dev *gspca_dev)
  526. {
  527. struct sd *sd = (struct sd *) gspca_dev;
  528. struct usb_device *dev = gspca_dev->dev;
  529. unsigned char white_balance[8] =
  530. { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
  531. if (sd->whitebalance == 1)
  532. white_balance[7] = 0x3c;
  533. t16RegWrite(dev, 0x01, 0x0000, white_balance, 8);
  534. }
  535. static void setlightfreq(struct gspca_dev *gspca_dev)
  536. {
  537. struct sd *sd = (struct sd *) gspca_dev;
  538. struct usb_device *dev = gspca_dev->dev;
  539. __u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 };
  540. if (sd->freq == 2) /* 60hz */
  541. freq[1] = 0x00;
  542. t16RegWrite(dev, 0x1, 0x0000, freq, 0x4);
  543. }
  544. static void setcontrast(struct gspca_dev *gspca_dev)
  545. {
  546. struct sd *sd = (struct sd *) gspca_dev;
  547. struct usb_device *dev = gspca_dev->dev;
  548. unsigned int contrast = sd->contrast;
  549. __u16 reg_to_write = 0x00;
  550. if (contrast < 7)
  551. reg_to_write = 0x8ea9 - (0x200 * contrast);
  552. else
  553. reg_to_write = (0x00a9 + ((contrast - 7) * 0x200));
  554. t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0);
  555. }
  556. static void setcolors(struct gspca_dev *gspca_dev)
  557. {
  558. struct sd *sd = (struct sd *) gspca_dev;
  559. struct usb_device *dev = gspca_dev->dev;
  560. __u16 reg_to_write = 0x00;
  561. reg_to_write = 0xc0bb + sd->colors * 0x100;
  562. t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0);
  563. }
  564. static void setgamma(struct gspca_dev *gspca_dev)
  565. {
  566. }
  567. static void setsharpness(struct gspca_dev *gspca_dev)
  568. {
  569. struct sd *sd = (struct sd *) gspca_dev;
  570. struct usb_device *dev = gspca_dev->dev;
  571. __u16 reg_to_write = 0x00;
  572. reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
  573. t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0x00);
  574. }
  575. static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
  576. {
  577. struct sd *sd = (struct sd *) gspca_dev;
  578. sd->brightness = val;
  579. if (gspca_dev->streaming)
  580. setbrightness(gspca_dev);
  581. return 0;
  582. }
  583. static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
  584. {
  585. struct sd *sd = (struct sd *) gspca_dev;
  586. *val = sd->brightness;
  587. return *val;
  588. }
  589. static int sd_setwhitebalance(struct gspca_dev *gspca_dev, __s32 val)
  590. {
  591. struct sd *sd = (struct sd *) gspca_dev;
  592. sd->whitebalance = val;
  593. if (gspca_dev->streaming)
  594. setwhitebalance(gspca_dev);
  595. return 0;
  596. }
  597. static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val)
  598. {
  599. struct sd *sd = (struct sd *) gspca_dev;
  600. *val = sd->whitebalance;
  601. return *val;
  602. }
  603. static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val)
  604. {
  605. struct sd *sd = (struct sd *) gspca_dev;
  606. sd->mirror = val;
  607. if (gspca_dev->streaming)
  608. setflip(gspca_dev);
  609. return 0;
  610. }
  611. static int sd_getflip(struct gspca_dev *gspca_dev, __s32 *val)
  612. {
  613. struct sd *sd = (struct sd *) gspca_dev;
  614. *val = sd->mirror;
  615. return *val;
  616. }
  617. static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val)
  618. {
  619. struct sd *sd = (struct sd *) gspca_dev;
  620. sd->effect = val;
  621. if (gspca_dev->streaming)
  622. seteffect(gspca_dev);
  623. return 0;
  624. }
  625. static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val)
  626. {
  627. struct sd *sd = (struct sd *) gspca_dev;
  628. *val = sd->effect;
  629. return *val;
  630. }
  631. static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
  632. {
  633. struct sd *sd = (struct sd *) gspca_dev;
  634. sd->contrast = val;
  635. if (gspca_dev->streaming)
  636. setcontrast(gspca_dev);
  637. return 0;
  638. }
  639. static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
  640. {
  641. struct sd *sd = (struct sd *) gspca_dev;
  642. *val = sd->contrast;
  643. return *val;
  644. }
  645. static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)
  646. {
  647. struct sd *sd = (struct sd *) gspca_dev;
  648. sd->colors = val;
  649. if (gspca_dev->streaming)
  650. setcolors(gspca_dev);
  651. return 0;
  652. }
  653. static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
  654. {
  655. struct sd *sd = (struct sd *) gspca_dev;
  656. *val = sd->colors;
  657. return 0;
  658. }
  659. static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val)
  660. {
  661. struct sd *sd = (struct sd *) gspca_dev;
  662. sd->gamma = val;
  663. if (gspca_dev->streaming)
  664. setgamma(gspca_dev);
  665. return 0;
  666. }
  667. static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val)
  668. {
  669. struct sd *sd = (struct sd *) gspca_dev;
  670. *val = sd->gamma;
  671. return 0;
  672. }
  673. static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val)
  674. {
  675. struct sd *sd = (struct sd *) gspca_dev;
  676. sd->freq = val;
  677. if (gspca_dev->streaming)
  678. setlightfreq(gspca_dev);
  679. return 0;
  680. }
  681. static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
  682. {
  683. struct sd *sd = (struct sd *) gspca_dev;
  684. *val = sd->freq;
  685. return 0;
  686. }
  687. static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
  688. {
  689. struct sd *sd = (struct sd *) gspca_dev;
  690. sd->sharpness = val;
  691. if (gspca_dev->streaming)
  692. setsharpness(gspca_dev);
  693. return 0;
  694. }
  695. static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
  696. {
  697. struct sd *sd = (struct sd *) gspca_dev;
  698. *val = sd->sharpness;
  699. return 0;
  700. }
  701. /* Low Light set here......*/
  702. static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val)
  703. {
  704. struct sd *sd = (struct sd *) gspca_dev;
  705. struct usb_device *dev = gspca_dev->dev;
  706. sd->autogain = val;
  707. if (val != 0)
  708. t16RegWrite(dev, 0x00, 0xf48e, 0x00, 0);
  709. else
  710. t16RegWrite(dev, 0x00, 0xb48e, 0x00, 0);
  711. return 0;
  712. }
  713. static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val)
  714. {
  715. struct sd *sd = (struct sd *) gspca_dev;
  716. *val = sd->autogain;
  717. return 0;
  718. }
  719. static void sd_start(struct gspca_dev *gspca_dev)
  720. {
  721. struct usb_device *dev = gspca_dev->dev;
  722. int mode;
  723. __u8 test_byte;
  724. static __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 };
  725. __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 };
  726. static __u8 t3[] =
  727. { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06,
  728. 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 };
  729. static __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
  730. mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode;
  731. switch (mode) {
  732. case 1: /* 352x288 */
  733. t2[1] = 0x40;
  734. break;
  735. case 2: /* 320x240 */
  736. t2[1] = 0x10;
  737. break;
  738. case 3: /* 176x144 */
  739. t2[1] = 0x50;
  740. break;
  741. case 4: /* 160x120 */
  742. t2[1] = 0x20;
  743. break;
  744. default: /* 640x480 (0x00) */
  745. break;
  746. }
  747. t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[0], 0x8);
  748. t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8);
  749. t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8);
  750. t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
  751. t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00);
  752. /* just in case and to keep sync with logs (for mine) */
  753. t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
  754. t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00);
  755. /* just in case and to keep sync with logs (for mine) */
  756. t16RegWrite(dev, 0x01, 0x0000, t1, 4);
  757. t16RegWrite(dev, 0x01, 0x0000, t2, 6);
  758. t16RegRead(dev, 0x0012, &test_byte, 0x1);
  759. t16RegWrite(dev, 0x01, 0x0000, t3, 0x10);
  760. t16RegWrite(dev, 0x00, 0x0013, 0x00, 0x00);
  761. t16RegWrite(dev, 0x01, 0x0000, t4, 0x4);
  762. /* restart on each start, just in case, sometimes regs goes wrong
  763. * when using controls from app */
  764. setbrightness(gspca_dev);
  765. setcontrast(gspca_dev);
  766. setcolors(gspca_dev);
  767. }
  768. static void sd_stopN(struct gspca_dev *gspca_dev)
  769. {
  770. }
  771. static void sd_stop0(struct gspca_dev *gspca_dev)
  772. {
  773. }
  774. static void sd_close(struct gspca_dev *gspca_dev)
  775. {
  776. }
  777. static void sd_pkt_scan(struct gspca_dev *gspca_dev,
  778. struct gspca_frame *frame, /* target */
  779. unsigned char *data, /* isoc packet */
  780. int len) /* iso packet length */
  781. {
  782. int sof = 0;
  783. static unsigned char ffd9[] = { 0xff, 0xd9 };
  784. if (data[0] == 0x5a) {
  785. /* Control Packet, after this came the header again,
  786. * but extra bytes came in the packet before this,
  787. * sometimes an EOF arrives, sometimes not... */
  788. return;
  789. }
  790. if (data[len - 1] == 0xff && data[len] == 0xd9) {
  791. /* Just in case, i have seen packets with the marker,
  792. * other's do not include it... */
  793. data += 2;
  794. len -= 4;
  795. } else if (data[2] == 0xff && data[3] == 0xd8) {
  796. sof = 1;
  797. data += 2;
  798. len -= 2;
  799. } else {
  800. data += 2;
  801. len -= 2;
  802. }
  803. if (sof) {
  804. /* extra bytes....., could be processed too but would be
  805. * a waste of time, right now leave the application and
  806. * libjpeg do it for ourserlves.. */
  807. frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
  808. ffd9, 2);
  809. gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len);
  810. return;
  811. }
  812. gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
  813. }
  814. static int sd_querymenu(struct gspca_dev *gspca_dev,
  815. struct v4l2_querymenu *menu)
  816. {
  817. memset(menu->name, 0, sizeof menu->name);
  818. switch (menu->id) {
  819. case V4L2_CID_POWER_LINE_FREQUENCY:
  820. switch (menu->index) {
  821. case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
  822. strcpy(menu->name, "50 Hz");
  823. return 0;
  824. case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
  825. strcpy(menu->name, "60 Hz");
  826. return 0;
  827. }
  828. break;
  829. case V4L2_CID_EFFECTS:
  830. if (menu->index < 0 || menu->index >= NUM_EFFECTS_CONTROL)
  831. return -EINVAL;
  832. strncpy((char *) menu->name,
  833. effects_control[menu->index].name, 32);
  834. break;
  835. }
  836. return 0;
  837. }
  838. /* this function is called at open time */
  839. static int sd_open(struct gspca_dev *gspca_dev)
  840. {
  841. init_default_parameters(gspca_dev);
  842. return 0;
  843. }
  844. /* sub-driver description */
  845. static struct sd_desc sd_desc = {
  846. .name = MODULE_NAME,
  847. .ctrls = sd_ctrls,
  848. .nctrls = ARRAY_SIZE(sd_ctrls),
  849. .config = sd_config,
  850. .open = sd_open,
  851. .start = sd_start,
  852. .stopN = sd_stopN,
  853. .stop0 = sd_stop0,
  854. .close = sd_close,
  855. .pkt_scan = sd_pkt_scan,
  856. .querymenu = sd_querymenu,
  857. };
  858. /* -- module initialisation -- */
  859. #define DVNM(name) .driver_info = (kernel_ulong_t) name
  860. static __devinitdata struct usb_device_id device_table[] = {
  861. {USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")},
  862. {}
  863. };
  864. MODULE_DEVICE_TABLE(usb, device_table);
  865. /* -- device connect -- */
  866. static int sd_probe(struct usb_interface *intf,
  867. const struct usb_device_id *id)
  868. {
  869. return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
  870. THIS_MODULE);
  871. }
  872. static struct usb_driver sd_driver = {
  873. .name = MODULE_NAME,
  874. .id_table = device_table,
  875. .probe = sd_probe,
  876. .disconnect = gspca_disconnect,
  877. };
  878. /* -- module insert / remove -- */
  879. static int __init sd_mod_init(void)
  880. {
  881. if (usb_register(&sd_driver) < 0)
  882. return -1;
  883. PDEBUG(D_PROBE, "v%s registered", version);
  884. return 0;
  885. }
  886. static void __exit sd_mod_exit(void)
  887. {
  888. usb_deregister(&sd_driver);
  889. PDEBUG(D_PROBE, "deregistered");
  890. }
  891. module_init(sd_mod_init);
  892. module_exit(sd_mod_exit);