saa6752hs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. #include <linux/module.h>
  2. #include <linux/kernel.h>
  3. #include <linux/sched.h>
  4. #include <linux/string.h>
  5. #include <linux/timer.h>
  6. #include <linux/delay.h>
  7. #include <linux/errno.h>
  8. #include <linux/slab.h>
  9. #include <linux/poll.h>
  10. #include <linux/i2c.h>
  11. #include <linux/types.h>
  12. #include <linux/videodev.h>
  13. #include <linux/init.h>
  14. #include <linux/crc32.h>
  15. #include <media/id.h>
  16. #define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
  17. #define MPEG_VIDEO_MAX_BITRATE_MAX 27000
  18. #define MPEG_TOTAL_TARGET_BITRATE_MAX 27000
  19. #define MPEG_PID_MAX ((1 << 14) - 1)
  20. /* Addresses to scan */
  21. static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END};
  22. I2C_CLIENT_INSMOD;
  23. MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder");
  24. MODULE_AUTHOR("Andrew de Quincey");
  25. MODULE_LICENSE("GPL");
  26. static struct i2c_driver driver;
  27. static struct i2c_client client_template;
  28. enum saa6752hs_videoformat {
  29. SAA6752HS_VF_D1 = 0, /* standard D1 video format: 720x576 */
  30. SAA6752HS_VF_2_3_D1 = 1,/* 2/3D1 video format: 480x576 */
  31. SAA6752HS_VF_1_2_D1 = 2,/* 1/2D1 video format: 352x576 */
  32. SAA6752HS_VF_SIF = 3, /* SIF video format: 352x288 */
  33. SAA6752HS_VF_UNKNOWN,
  34. };
  35. static const struct v4l2_format v4l2_format_table[] =
  36. {
  37. [SAA6752HS_VF_D1] =
  38. { .fmt = { .pix = { .width = 720, .height = 576 }}},
  39. [SAA6752HS_VF_2_3_D1] =
  40. { .fmt = { .pix = { .width = 480, .height = 576 }}},
  41. [SAA6752HS_VF_1_2_D1] =
  42. { .fmt = { .pix = { .width = 352, .height = 576 }}},
  43. [SAA6752HS_VF_SIF] =
  44. { .fmt = { .pix = { .width = 352, .height = 288 }}},
  45. [SAA6752HS_VF_UNKNOWN] =
  46. { .fmt = { .pix = { .width = 0, .height = 0}}},
  47. };
  48. struct saa6752hs_state {
  49. struct i2c_client client;
  50. struct v4l2_mpeg_compression params;
  51. enum saa6752hs_videoformat video_format;
  52. };
  53. enum saa6752hs_command {
  54. SAA6752HS_COMMAND_RESET = 0,
  55. SAA6752HS_COMMAND_STOP = 1,
  56. SAA6752HS_COMMAND_START = 2,
  57. SAA6752HS_COMMAND_PAUSE = 3,
  58. SAA6752HS_COMMAND_RECONFIGURE = 4,
  59. SAA6752HS_COMMAND_SLEEP = 5,
  60. SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6,
  61. SAA6752HS_COMMAND_MAX
  62. };
  63. /* ---------------------------------------------------------------------- */
  64. static u8 PAT[] = {
  65. 0xc2, // i2c register
  66. 0x00, // table number for encoder
  67. 0x47, // sync
  68. 0x40, 0x00, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0)
  69. 0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
  70. 0x00, // PSI pointer to start of table
  71. 0x00, // tid(0)
  72. 0xb0, 0x0d, // section_syntax_indicator(1), section_length(13)
  73. 0x00, 0x01, // transport_stream_id(1)
  74. 0xc1, // version_number(0), current_next_indicator(1)
  75. 0x00, 0x00, // section_number(0), last_section_number(0)
  76. 0x00, 0x01, // program_number(1)
  77. 0xe0, 0x00, // PMT PID
  78. 0x00, 0x00, 0x00, 0x00 // CRC32
  79. };
  80. static u8 PMT[] = {
  81. 0xc2, // i2c register
  82. 0x01, // table number for encoder
  83. 0x47, // sync
  84. 0x40, 0x00, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid
  85. 0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
  86. 0x00, // PSI pointer to start of table
  87. 0x02, // tid(2)
  88. 0xb0, 0x17, // section_syntax_indicator(1), section_length(23)
  89. 0x00, 0x01, // program_number(1)
  90. 0xc1, // version_number(0), current_next_indicator(1)
  91. 0x00, 0x00, // section_number(0), last_section_number(0)
  92. 0xe0, 0x00, // PCR_PID
  93. 0xf0, 0x00, // program_info_length(0)
  94. 0x02, 0xe0, 0x00, 0xf0, 0x00, // video stream type(2), pid
  95. 0x04, 0xe0, 0x00, 0xf0, 0x00, // audio stream type(4), pid
  96. 0x00, 0x00, 0x00, 0x00 // CRC32
  97. };
  98. static struct v4l2_mpeg_compression param_defaults =
  99. {
  100. .st_type = V4L2_MPEG_TS_2,
  101. .st_bitrate = {
  102. .mode = V4L2_BITRATE_CBR,
  103. .target = 7000,
  104. },
  105. .ts_pid_pmt = 16,
  106. .ts_pid_video = 260,
  107. .ts_pid_audio = 256,
  108. .ts_pid_pcr = 259,
  109. .vi_type = V4L2_MPEG_VI_2,
  110. .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3,
  111. .vi_bitrate = {
  112. .mode = V4L2_BITRATE_VBR,
  113. .target = 4000,
  114. .max = 6000,
  115. },
  116. .au_type = V4L2_MPEG_AU_2_II,
  117. .au_bitrate = {
  118. .mode = V4L2_BITRATE_CBR,
  119. .target = 256,
  120. },
  121. };
  122. /* ---------------------------------------------------------------------- */
  123. static int saa6752hs_chip_command(struct i2c_client* client,
  124. enum saa6752hs_command command)
  125. {
  126. unsigned char buf[3];
  127. unsigned long timeout;
  128. int status = 0;
  129. // execute the command
  130. switch(command) {
  131. case SAA6752HS_COMMAND_RESET:
  132. buf[0] = 0x00;
  133. break;
  134. case SAA6752HS_COMMAND_STOP:
  135. buf[0] = 0x03;
  136. break;
  137. case SAA6752HS_COMMAND_START:
  138. buf[0] = 0x02;
  139. break;
  140. case SAA6752HS_COMMAND_PAUSE:
  141. buf[0] = 0x04;
  142. break;
  143. case SAA6752HS_COMMAND_RECONFIGURE:
  144. buf[0] = 0x05;
  145. break;
  146. case SAA6752HS_COMMAND_SLEEP:
  147. buf[0] = 0x06;
  148. break;
  149. case SAA6752HS_COMMAND_RECONFIGURE_FORCE:
  150. buf[0] = 0x07;
  151. break;
  152. default:
  153. return -EINVAL;
  154. }
  155. // set it and wait for it to be so
  156. i2c_master_send(client, buf, 1);
  157. timeout = jiffies + HZ * 3;
  158. for (;;) {
  159. // get the current status
  160. buf[0] = 0x10;
  161. i2c_master_send(client, buf, 1);
  162. i2c_master_recv(client, buf, 1);
  163. if (!(buf[0] & 0x20))
  164. break;
  165. if (time_after(jiffies,timeout)) {
  166. status = -ETIMEDOUT;
  167. break;
  168. }
  169. // wait a bit
  170. msleep(10);
  171. }
  172. // delay a bit to let encoder settle
  173. msleep(50);
  174. // done
  175. return status;
  176. }
  177. static int saa6752hs_set_bitrate(struct i2c_client* client,
  178. struct v4l2_mpeg_compression* params)
  179. {
  180. u8 buf[3];
  181. // set the bitrate mode
  182. buf[0] = 0x71;
  183. buf[1] = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? 0 : 1;
  184. i2c_master_send(client, buf, 2);
  185. // set the video bitrate
  186. if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) {
  187. // set the target bitrate
  188. buf[0] = 0x80;
  189. buf[1] = params->vi_bitrate.target >> 8;
  190. buf[2] = params->vi_bitrate.target & 0xff;
  191. i2c_master_send(client, buf, 3);
  192. // set the max bitrate
  193. buf[0] = 0x81;
  194. buf[1] = params->vi_bitrate.max >> 8;
  195. buf[2] = params->vi_bitrate.max & 0xff;
  196. i2c_master_send(client, buf, 3);
  197. } else {
  198. // set the target bitrate (no max bitrate for CBR)
  199. buf[0] = 0x81;
  200. buf[1] = params->vi_bitrate.target >> 8;
  201. buf[2] = params->vi_bitrate.target & 0xff;
  202. i2c_master_send(client, buf, 3);
  203. }
  204. // set the audio bitrate
  205. buf[0] = 0x94;
  206. buf[1] = (256 == params->au_bitrate.target) ? 0 : 1;
  207. i2c_master_send(client, buf, 2);
  208. // set the total bitrate
  209. buf[0] = 0xb1;
  210. buf[1] = params->st_bitrate.target >> 8;
  211. buf[2] = params->st_bitrate.target & 0xff;
  212. i2c_master_send(client, buf, 3);
  213. // return success
  214. return 0;
  215. }
  216. static void saa6752hs_set_subsampling(struct i2c_client* client,
  217. struct v4l2_format* f)
  218. {
  219. struct saa6752hs_state *h = i2c_get_clientdata(client);
  220. int dist_352, dist_480, dist_720;
  221. /*
  222. FIXME: translate and round width/height into EMPRESS
  223. subsample type:
  224. type | PAL | NTSC
  225. ---------------------------
  226. SIF | 352x288 | 352x240
  227. 1/2 D1 | 352x576 | 352x480
  228. 2/3 D1 | 480x576 | 480x480
  229. D1 | 720x576 | 720x480
  230. */
  231. dist_352 = abs(f->fmt.pix.width - 352);
  232. dist_480 = abs(f->fmt.pix.width - 480);
  233. dist_720 = abs(f->fmt.pix.width - 720);
  234. if (dist_720 < dist_480) {
  235. f->fmt.pix.width = 720;
  236. f->fmt.pix.height = 576;
  237. h->video_format = SAA6752HS_VF_D1;
  238. }
  239. else if (dist_480 < dist_352) {
  240. f->fmt.pix.width = 480;
  241. f->fmt.pix.height = 576;
  242. h->video_format = SAA6752HS_VF_2_3_D1;
  243. }
  244. else {
  245. f->fmt.pix.width = 352;
  246. if (abs(f->fmt.pix.height - 576) <
  247. abs(f->fmt.pix.height - 288)) {
  248. f->fmt.pix.height = 576;
  249. h->video_format = SAA6752HS_VF_1_2_D1;
  250. }
  251. else {
  252. f->fmt.pix.height = 288;
  253. h->video_format = SAA6752HS_VF_SIF;
  254. }
  255. }
  256. }
  257. static void saa6752hs_set_params(struct i2c_client* client,
  258. struct v4l2_mpeg_compression* params)
  259. {
  260. struct saa6752hs_state *h = i2c_get_clientdata(client);
  261. /* check PIDs */
  262. if (params->ts_pid_pmt <= MPEG_PID_MAX)
  263. h->params.ts_pid_pmt = params->ts_pid_pmt;
  264. if (params->ts_pid_pcr <= MPEG_PID_MAX)
  265. h->params.ts_pid_pcr = params->ts_pid_pcr;
  266. if (params->ts_pid_video <= MPEG_PID_MAX)
  267. h->params.ts_pid_video = params->ts_pid_video;
  268. if (params->ts_pid_audio <= MPEG_PID_MAX)
  269. h->params.ts_pid_audio = params->ts_pid_audio;
  270. /* check bitrate parameters */
  271. if ((params->vi_bitrate.mode == V4L2_BITRATE_CBR) ||
  272. (params->vi_bitrate.mode == V4L2_BITRATE_VBR))
  273. h->params.vi_bitrate.mode = params->vi_bitrate.mode;
  274. if (params->vi_bitrate.mode != V4L2_BITRATE_NONE)
  275. h->params.st_bitrate.target = params->st_bitrate.target;
  276. if (params->vi_bitrate.mode != V4L2_BITRATE_NONE)
  277. h->params.vi_bitrate.target = params->vi_bitrate.target;
  278. if (params->vi_bitrate.mode == V4L2_BITRATE_VBR)
  279. h->params.vi_bitrate.max = params->vi_bitrate.max;
  280. if (params->au_bitrate.mode != V4L2_BITRATE_NONE)
  281. h->params.au_bitrate.target = params->au_bitrate.target;
  282. /* aspect ratio */
  283. if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 ||
  284. params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9)
  285. h->params.vi_aspect_ratio = params->vi_aspect_ratio;
  286. /* range checks */
  287. if (h->params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX)
  288. h->params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX;
  289. if (h->params.vi_bitrate.target > MPEG_VIDEO_TARGET_BITRATE_MAX)
  290. h->params.vi_bitrate.target = MPEG_VIDEO_TARGET_BITRATE_MAX;
  291. if (h->params.vi_bitrate.max > MPEG_VIDEO_MAX_BITRATE_MAX)
  292. h->params.vi_bitrate.max = MPEG_VIDEO_MAX_BITRATE_MAX;
  293. if (h->params.au_bitrate.target <= 256)
  294. h->params.au_bitrate.target = 256;
  295. else
  296. h->params.au_bitrate.target = 384;
  297. }
  298. static int saa6752hs_init(struct i2c_client* client)
  299. {
  300. unsigned char buf[9], buf2[4];
  301. struct saa6752hs_state *h;
  302. u32 crc;
  303. unsigned char localPAT[256];
  304. unsigned char localPMT[256];
  305. h = i2c_get_clientdata(client);
  306. // Set video format - must be done first as it resets other settings
  307. buf[0] = 0x41;
  308. buf[1] = h->video_format;
  309. i2c_master_send(client, buf, 2);
  310. // set bitrate
  311. saa6752hs_set_bitrate(client, &h->params);
  312. // Set GOP structure {3, 13}
  313. buf[0] = 0x72;
  314. buf[1] = 0x03;
  315. buf[2] = 0x0D;
  316. i2c_master_send(client,buf,3);
  317. // Set minimum Q-scale {4}
  318. buf[0] = 0x82;
  319. buf[1] = 0x04;
  320. i2c_master_send(client,buf,2);
  321. // Set maximum Q-scale {12}
  322. buf[0] = 0x83;
  323. buf[1] = 0x0C;
  324. i2c_master_send(client,buf,2);
  325. // Set Output Protocol
  326. buf[0] = 0xD0;
  327. buf[1] = 0x81;
  328. i2c_master_send(client,buf,2);
  329. // Set video output stream format {TS}
  330. buf[0] = 0xB0;
  331. buf[1] = 0x05;
  332. i2c_master_send(client,buf,2);
  333. /* compute PAT */
  334. memcpy(localPAT, PAT, sizeof(PAT));
  335. localPAT[17] = 0xe0 | ((h->params.ts_pid_pmt >> 8) & 0x0f);
  336. localPAT[18] = h->params.ts_pid_pmt & 0xff;
  337. crc = crc32_be(~0, &localPAT[7], sizeof(PAT) - 7 - 4);
  338. localPAT[sizeof(PAT) - 4] = (crc >> 24) & 0xFF;
  339. localPAT[sizeof(PAT) - 3] = (crc >> 16) & 0xFF;
  340. localPAT[sizeof(PAT) - 2] = (crc >> 8) & 0xFF;
  341. localPAT[sizeof(PAT) - 1] = crc & 0xFF;
  342. /* compute PMT */
  343. memcpy(localPMT, PMT, sizeof(PMT));
  344. localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f);
  345. localPMT[4] = h->params.ts_pid_pmt & 0xff;
  346. localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F);
  347. localPMT[16] = h->params.ts_pid_pcr & 0xFF;
  348. localPMT[20] = 0xE0 | ((h->params.ts_pid_video >> 8) & 0x0F);
  349. localPMT[21] = h->params.ts_pid_video & 0xFF;
  350. localPMT[25] = 0xE0 | ((h->params.ts_pid_audio >> 8) & 0x0F);
  351. localPMT[26] = h->params.ts_pid_audio & 0xFF;
  352. crc = crc32_be(~0, &localPMT[7], sizeof(PMT) - 7 - 4);
  353. localPMT[sizeof(PMT) - 4] = (crc >> 24) & 0xFF;
  354. localPMT[sizeof(PMT) - 3] = (crc >> 16) & 0xFF;
  355. localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF;
  356. localPMT[sizeof(PMT) - 1] = crc & 0xFF;
  357. // Set Audio PID
  358. buf[0] = 0xC1;
  359. buf[1] = (h->params.ts_pid_audio >> 8) & 0xFF;
  360. buf[2] = h->params.ts_pid_audio & 0xFF;
  361. i2c_master_send(client,buf,3);
  362. // Set Video PID
  363. buf[0] = 0xC0;
  364. buf[1] = (h->params.ts_pid_video >> 8) & 0xFF;
  365. buf[2] = h->params.ts_pid_video & 0xFF;
  366. i2c_master_send(client,buf,3);
  367. // Set PCR PID
  368. buf[0] = 0xC4;
  369. buf[1] = (h->params.ts_pid_pcr >> 8) & 0xFF;
  370. buf[2] = h->params.ts_pid_pcr & 0xFF;
  371. i2c_master_send(client,buf,3);
  372. // Send SI tables
  373. i2c_master_send(client,localPAT,sizeof(PAT));
  374. i2c_master_send(client,localPMT,sizeof(PMT));
  375. // mute then unmute audio. This removes buzzing artefacts
  376. buf[0] = 0xa4;
  377. buf[1] = 1;
  378. i2c_master_send(client, buf, 2);
  379. buf[1] = 0;
  380. i2c_master_send(client, buf, 2);
  381. // start it going
  382. saa6752hs_chip_command(client, SAA6752HS_COMMAND_START);
  383. // readout current state
  384. buf[0] = 0xE1;
  385. buf[1] = 0xA7;
  386. buf[2] = 0xFE;
  387. buf[3] = 0x82;
  388. buf[4] = 0xB0;
  389. i2c_master_send(client, buf, 5);
  390. i2c_master_recv(client, buf2, 4);
  391. // change aspect ratio
  392. buf[0] = 0xE0;
  393. buf[1] = 0xA7;
  394. buf[2] = 0xFE;
  395. buf[3] = 0x82;
  396. buf[4] = 0xB0;
  397. buf[5] = buf2[0];
  398. switch(h->params.vi_aspect_ratio) {
  399. case V4L2_MPEG_ASPECT_16_9:
  400. buf[6] = buf2[1] | 0x40;
  401. break;
  402. case V4L2_MPEG_ASPECT_4_3:
  403. default:
  404. buf[6] = buf2[1] & 0xBF;
  405. break;
  406. break;
  407. }
  408. buf[7] = buf2[2];
  409. buf[8] = buf2[3];
  410. i2c_master_send(client, buf, 9);
  411. // return success
  412. return 0;
  413. }
  414. static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
  415. {
  416. struct saa6752hs_state *h;
  417. printk("saa6752hs: chip found @ 0x%x\n", addr<<1);
  418. if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL)))
  419. return -ENOMEM;
  420. memset(h,0,sizeof(*h));
  421. h->client = client_template;
  422. h->params = param_defaults;
  423. h->client.adapter = adap;
  424. h->client.addr = addr;
  425. i2c_set_clientdata(&h->client, h);
  426. i2c_attach_client(&h->client);
  427. return 0;
  428. }
  429. static int saa6752hs_probe(struct i2c_adapter *adap)
  430. {
  431. if (adap->class & I2C_CLASS_TV_ANALOG)
  432. return i2c_probe(adap, &addr_data, saa6752hs_attach);
  433. return 0;
  434. }
  435. static int saa6752hs_detach(struct i2c_client *client)
  436. {
  437. struct saa6752hs_state *h;
  438. h = i2c_get_clientdata(client);
  439. i2c_detach_client(client);
  440. kfree(h);
  441. return 0;
  442. }
  443. static int
  444. saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
  445. {
  446. struct saa6752hs_state *h = i2c_get_clientdata(client);
  447. struct v4l2_mpeg_compression *params = arg;
  448. int err = 0;
  449. switch (cmd) {
  450. case VIDIOC_S_MPEGCOMP:
  451. if (NULL == params) {
  452. /* apply settings and start encoder */
  453. saa6752hs_init(client);
  454. break;
  455. }
  456. saa6752hs_set_params(client, params);
  457. /* fall through */
  458. case VIDIOC_G_MPEGCOMP:
  459. *params = h->params;
  460. break;
  461. case VIDIOC_G_FMT:
  462. {
  463. struct v4l2_format *f = arg;
  464. if (h->video_format == SAA6752HS_VF_UNKNOWN)
  465. h->video_format = SAA6752HS_VF_D1;
  466. f->fmt.pix.width =
  467. v4l2_format_table[h->video_format].fmt.pix.width;
  468. f->fmt.pix.height =
  469. v4l2_format_table[h->video_format].fmt.pix.height;
  470. break ;
  471. }
  472. case VIDIOC_S_FMT:
  473. {
  474. struct v4l2_format *f = arg;
  475. saa6752hs_set_subsampling(client, f);
  476. break;
  477. }
  478. default:
  479. /* nothing */
  480. break;
  481. }
  482. return err;
  483. }
  484. /* ----------------------------------------------------------------------- */
  485. static struct i2c_driver driver = {
  486. .owner = THIS_MODULE,
  487. .name = "i2c saa6752hs MPEG encoder",
  488. .id = I2C_DRIVERID_SAA6752HS,
  489. .flags = I2C_DF_NOTIFY,
  490. .attach_adapter = saa6752hs_probe,
  491. .detach_client = saa6752hs_detach,
  492. .command = saa6752hs_command,
  493. };
  494. static struct i2c_client client_template =
  495. {
  496. .name = "saa6752hs",
  497. .flags = I2C_CLIENT_ALLOW_USE,
  498. .driver = &driver,
  499. };
  500. static int __init saa6752hs_init_module(void)
  501. {
  502. return i2c_add_driver(&driver);
  503. }
  504. static void __exit saa6752hs_cleanup_module(void)
  505. {
  506. i2c_del_driver(&driver);
  507. }
  508. module_init(saa6752hs_init_module);
  509. module_exit(saa6752hs_cleanup_module);
  510. /*
  511. * Overrides for Emacs so that we follow Linus's tabbing style.
  512. * ---------------------------------------------------------------------------
  513. * Local variables:
  514. * c-basic-offset: 8
  515. * End:
  516. */