radio-tea5764.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * driver/media/radio/radio-tea5764.c
  3. *
  4. * Driver for TEA5764 radio chip for linux 2.6.
  5. * This driver is for TEA5764 chip from NXP, used in EZX phones from Motorola.
  6. * The I2C protocol is used for communicate with chip.
  7. *
  8. * Based in radio-tea5761.c Copyright (C) 2005 Nokia Corporation
  9. *
  10. * Copyright (c) 2008 Fabio Belavenuto <belavenuto@gmail.com>
  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. * (at your option) 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. * History:
  27. * 2008-12-06 Fabio Belavenuto <belavenuto@gmail.com>
  28. * initial code
  29. *
  30. * TODO:
  31. * add platform_data support for IRQs platform dependencies
  32. * add RDS support
  33. */
  34. #include <linux/kernel.h>
  35. #include <linux/slab.h>
  36. #include <linux/module.h>
  37. #include <linux/init.h> /* Initdata */
  38. #include <linux/videodev2.h> /* kernel radio structs */
  39. #include <linux/i2c.h> /* I2C */
  40. #include <media/v4l2-common.h>
  41. #include <media/v4l2-ioctl.h>
  42. #define DRIVER_VERSION "0.0.2"
  43. #define DRIVER_AUTHOR "Fabio Belavenuto <belavenuto@gmail.com>"
  44. #define DRIVER_DESC "A driver for the TEA5764 radio chip for EZX Phones."
  45. #define PINFO(format, ...)\
  46. printk(KERN_INFO KBUILD_MODNAME ": "\
  47. DRIVER_VERSION ": " format "\n", ## __VA_ARGS__)
  48. #define PWARN(format, ...)\
  49. printk(KERN_WARNING KBUILD_MODNAME ": "\
  50. DRIVER_VERSION ": " format "\n", ## __VA_ARGS__)
  51. # define PDEBUG(format, ...)\
  52. printk(KERN_DEBUG KBUILD_MODNAME ": "\
  53. DRIVER_VERSION ": " format "\n", ## __VA_ARGS__)
  54. /* Frequency limits in MHz -- these are European values. For Japanese
  55. devices, that would be 76000 and 91000. */
  56. #define FREQ_MIN 87500
  57. #define FREQ_MAX 108000
  58. #define FREQ_MUL 16
  59. /* TEA5764 registers */
  60. #define TEA5764_MANID 0x002b
  61. #define TEA5764_CHIPID 0x5764
  62. #define TEA5764_INTREG_BLMSK 0x0001
  63. #define TEA5764_INTREG_FRRMSK 0x0002
  64. #define TEA5764_INTREG_LEVMSK 0x0008
  65. #define TEA5764_INTREG_IFMSK 0x0010
  66. #define TEA5764_INTREG_BLMFLAG 0x0100
  67. #define TEA5764_INTREG_FRRFLAG 0x0200
  68. #define TEA5764_INTREG_LEVFLAG 0x0800
  69. #define TEA5764_INTREG_IFFLAG 0x1000
  70. #define TEA5764_FRQSET_SUD 0x8000
  71. #define TEA5764_FRQSET_SM 0x4000
  72. #define TEA5764_TNCTRL_PUPD1 0x8000
  73. #define TEA5764_TNCTRL_PUPD0 0x4000
  74. #define TEA5764_TNCTRL_BLIM 0x2000
  75. #define TEA5764_TNCTRL_SWPM 0x1000
  76. #define TEA5764_TNCTRL_IFCTC 0x0800
  77. #define TEA5764_TNCTRL_AFM 0x0400
  78. #define TEA5764_TNCTRL_SMUTE 0x0200
  79. #define TEA5764_TNCTRL_SNC 0x0100
  80. #define TEA5764_TNCTRL_MU 0x0080
  81. #define TEA5764_TNCTRL_SSL1 0x0040
  82. #define TEA5764_TNCTRL_SSL0 0x0020
  83. #define TEA5764_TNCTRL_HLSI 0x0010
  84. #define TEA5764_TNCTRL_MST 0x0008
  85. #define TEA5764_TNCTRL_SWP 0x0004
  86. #define TEA5764_TNCTRL_DTC 0x0002
  87. #define TEA5764_TNCTRL_AHLSI 0x0001
  88. #define TEA5764_TUNCHK_LEVEL(x) (((x) & 0x00F0) >> 4)
  89. #define TEA5764_TUNCHK_IFCNT(x) (((x) & 0xFE00) >> 9)
  90. #define TEA5764_TUNCHK_TUNTO 0x0100
  91. #define TEA5764_TUNCHK_LD 0x0008
  92. #define TEA5764_TUNCHK_STEREO 0x0004
  93. #define TEA5764_TESTREG_TRIGFR 0x0800
  94. struct tea5764_regs {
  95. u16 intreg; /* INTFLAG & INTMSK */
  96. u16 frqset; /* FRQSETMSB & FRQSETLSB */
  97. u16 tnctrl; /* TNCTRL1 & TNCTRL2 */
  98. u16 frqchk; /* FRQCHKMSB & FRQCHKLSB */
  99. u16 tunchk; /* IFCHK & LEVCHK */
  100. u16 testreg; /* TESTBITS & TESTMODE */
  101. u16 rdsstat; /* RDSSTAT1 & RDSSTAT2 */
  102. u16 rdslb; /* RDSLBMSB & RDSLBLSB */
  103. u16 rdspb; /* RDSPBMSB & RDSPBLSB */
  104. u16 rdsbc; /* RDSBBC & RDSGBC */
  105. u16 rdsctrl; /* RDSCTRL1 & RDSCTRL2 */
  106. u16 rdsbbl; /* PAUSEDET & RDSBBL */
  107. u16 manid; /* MANID1 & MANID2 */
  108. u16 chipid; /* CHIPID1 & CHIPID2 */
  109. } __attribute__ ((packed));
  110. struct tea5764_write_regs {
  111. u8 intreg; /* INTMSK */
  112. u16 frqset; /* FRQSETMSB & FRQSETLSB */
  113. u16 tnctrl; /* TNCTRL1 & TNCTRL2 */
  114. u16 testreg; /* TESTBITS & TESTMODE */
  115. u16 rdsctrl; /* RDSCTRL1 & RDSCTRL2 */
  116. u16 rdsbbl; /* PAUSEDET & RDSBBL */
  117. } __attribute__ ((packed));
  118. #ifndef RADIO_TEA5764_XTAL
  119. #define RADIO_TEA5764_XTAL 1
  120. #endif
  121. static int radio_nr = -1;
  122. static int use_xtal = RADIO_TEA5764_XTAL;
  123. struct tea5764_device {
  124. struct i2c_client *i2c_client;
  125. struct video_device *videodev;
  126. struct tea5764_regs regs;
  127. struct mutex mutex;
  128. };
  129. /* I2C code related */
  130. int tea5764_i2c_read(struct tea5764_device *radio)
  131. {
  132. int i;
  133. u16 *p = (u16 *) &radio->regs;
  134. struct i2c_msg msgs[1] = {
  135. { radio->i2c_client->addr, I2C_M_RD, sizeof(radio->regs),
  136. (void *)&radio->regs },
  137. };
  138. if (i2c_transfer(radio->i2c_client->adapter, msgs, 1) != 1)
  139. return -EIO;
  140. for (i = 0; i < sizeof(struct tea5764_regs) / sizeof(u16); i++)
  141. p[i] = __be16_to_cpu(p[i]);
  142. return 0;
  143. }
  144. int tea5764_i2c_write(struct tea5764_device *radio)
  145. {
  146. struct tea5764_write_regs wr;
  147. struct tea5764_regs *r = &radio->regs;
  148. struct i2c_msg msgs[1] = {
  149. { radio->i2c_client->addr, 0, sizeof(wr), (void *) &wr },
  150. };
  151. wr.intreg = r->intreg & 0xff;
  152. wr.frqset = __cpu_to_be16(r->frqset);
  153. wr.tnctrl = __cpu_to_be16(r->tnctrl);
  154. wr.testreg = __cpu_to_be16(r->testreg);
  155. wr.rdsctrl = __cpu_to_be16(r->rdsctrl);
  156. wr.rdsbbl = __cpu_to_be16(r->rdsbbl);
  157. if (i2c_transfer(radio->i2c_client->adapter, msgs, 1) != 1)
  158. return -EIO;
  159. return 0;
  160. }
  161. /* V4L2 code related */
  162. static struct v4l2_queryctrl radio_qctrl[] = {
  163. {
  164. .id = V4L2_CID_AUDIO_MUTE,
  165. .name = "Mute",
  166. .minimum = 0,
  167. .maximum = 1,
  168. .default_value = 1,
  169. .type = V4L2_CTRL_TYPE_BOOLEAN,
  170. }
  171. };
  172. static void tea5764_power_up(struct tea5764_device *radio)
  173. {
  174. struct tea5764_regs *r = &radio->regs;
  175. if (!(r->tnctrl & TEA5764_TNCTRL_PUPD0)) {
  176. r->tnctrl &= ~(TEA5764_TNCTRL_AFM | TEA5764_TNCTRL_MU |
  177. TEA5764_TNCTRL_HLSI);
  178. if (!use_xtal)
  179. r->testreg |= TEA5764_TESTREG_TRIGFR;
  180. else
  181. r->testreg &= ~TEA5764_TESTREG_TRIGFR;
  182. r->tnctrl |= TEA5764_TNCTRL_PUPD0;
  183. tea5764_i2c_write(radio);
  184. }
  185. }
  186. static void tea5764_power_down(struct tea5764_device *radio)
  187. {
  188. struct tea5764_regs *r = &radio->regs;
  189. if (r->tnctrl & TEA5764_TNCTRL_PUPD0) {
  190. r->tnctrl &= ~TEA5764_TNCTRL_PUPD0;
  191. tea5764_i2c_write(radio);
  192. }
  193. }
  194. static void tea5764_set_freq(struct tea5764_device *radio, int freq)
  195. {
  196. struct tea5764_regs *r = &radio->regs;
  197. /* formula: (freq [+ or -] 225000) / 8192 */
  198. if (r->tnctrl & TEA5764_TNCTRL_HLSI)
  199. r->frqset = (freq + 225000) / 8192;
  200. else
  201. r->frqset = (freq - 225000) / 8192;
  202. }
  203. static int tea5764_get_freq(struct tea5764_device *radio)
  204. {
  205. struct tea5764_regs *r = &radio->regs;
  206. if (r->tnctrl & TEA5764_TNCTRL_HLSI)
  207. return (r->frqchk * 8192) - 225000;
  208. else
  209. return (r->frqchk * 8192) + 225000;
  210. }
  211. /* tune an frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */
  212. static void tea5764_tune(struct tea5764_device *radio, int freq)
  213. {
  214. tea5764_set_freq(radio, freq);
  215. if (tea5764_i2c_write(radio))
  216. PWARN("Could not set frequency!");
  217. }
  218. static void tea5764_set_audout_mode(struct tea5764_device *radio, int audmode)
  219. {
  220. struct tea5764_regs *r = &radio->regs;
  221. int tnctrl = r->tnctrl;
  222. if (audmode == V4L2_TUNER_MODE_MONO)
  223. r->tnctrl |= TEA5764_TNCTRL_MST;
  224. else
  225. r->tnctrl &= ~TEA5764_TNCTRL_MST;
  226. if (tnctrl != r->tnctrl)
  227. tea5764_i2c_write(radio);
  228. }
  229. static int tea5764_get_audout_mode(struct tea5764_device *radio)
  230. {
  231. struct tea5764_regs *r = &radio->regs;
  232. if (r->tnctrl & TEA5764_TNCTRL_MST)
  233. return V4L2_TUNER_MODE_MONO;
  234. else
  235. return V4L2_TUNER_MODE_STEREO;
  236. }
  237. static void tea5764_mute(struct tea5764_device *radio, int on)
  238. {
  239. struct tea5764_regs *r = &radio->regs;
  240. int tnctrl = r->tnctrl;
  241. if (on)
  242. r->tnctrl |= TEA5764_TNCTRL_MU;
  243. else
  244. r->tnctrl &= ~TEA5764_TNCTRL_MU;
  245. if (tnctrl != r->tnctrl)
  246. tea5764_i2c_write(radio);
  247. }
  248. static int tea5764_is_muted(struct tea5764_device *radio)
  249. {
  250. return radio->regs.tnctrl & TEA5764_TNCTRL_MU;
  251. }
  252. /* V4L2 vidioc */
  253. static int vidioc_querycap(struct file *file, void *priv,
  254. struct v4l2_capability *v)
  255. {
  256. struct tea5764_device *radio = video_drvdata(file);
  257. struct video_device *dev = radio->videodev;
  258. strlcpy(v->driver, dev->dev.driver->name, sizeof(v->driver));
  259. strlcpy(v->card, dev->name, sizeof(v->card));
  260. snprintf(v->bus_info, sizeof(v->bus_info),
  261. "I2C:%s", dev_name(&dev->dev));
  262. v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
  263. return 0;
  264. }
  265. static int vidioc_g_tuner(struct file *file, void *priv,
  266. struct v4l2_tuner *v)
  267. {
  268. struct tea5764_device *radio = video_drvdata(file);
  269. struct tea5764_regs *r = &radio->regs;
  270. if (v->index > 0)
  271. return -EINVAL;
  272. memset(v, 0, sizeof(*v));
  273. strcpy(v->name, "FM");
  274. v->type = V4L2_TUNER_RADIO;
  275. tea5764_i2c_read(radio);
  276. v->rangelow = FREQ_MIN * FREQ_MUL;
  277. v->rangehigh = FREQ_MAX * FREQ_MUL;
  278. v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
  279. if (r->tunchk & TEA5764_TUNCHK_STEREO)
  280. v->rxsubchans = V4L2_TUNER_SUB_STEREO;
  281. else
  282. v->rxsubchans = V4L2_TUNER_SUB_MONO;
  283. v->audmode = tea5764_get_audout_mode(radio);
  284. v->signal = TEA5764_TUNCHK_LEVEL(r->tunchk) * 0xffff / 0xf;
  285. v->afc = TEA5764_TUNCHK_IFCNT(r->tunchk);
  286. return 0;
  287. }
  288. static int vidioc_s_tuner(struct file *file, void *priv,
  289. struct v4l2_tuner *v)
  290. {
  291. struct tea5764_device *radio = video_drvdata(file);
  292. if (v->index > 0)
  293. return -EINVAL;
  294. tea5764_set_audout_mode(radio, v->audmode);
  295. return 0;
  296. }
  297. static int vidioc_s_frequency(struct file *file, void *priv,
  298. struct v4l2_frequency *f)
  299. {
  300. struct tea5764_device *radio = video_drvdata(file);
  301. if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
  302. return -EINVAL;
  303. if (f->frequency == 0) {
  304. /* We special case this as a power down control. */
  305. tea5764_power_down(radio);
  306. }
  307. if (f->frequency < (FREQ_MIN * FREQ_MUL))
  308. return -EINVAL;
  309. if (f->frequency > (FREQ_MAX * FREQ_MUL))
  310. return -EINVAL;
  311. tea5764_power_up(radio);
  312. tea5764_tune(radio, (f->frequency * 125) / 2);
  313. return 0;
  314. }
  315. static int vidioc_g_frequency(struct file *file, void *priv,
  316. struct v4l2_frequency *f)
  317. {
  318. struct tea5764_device *radio = video_drvdata(file);
  319. struct tea5764_regs *r = &radio->regs;
  320. if (f->tuner != 0)
  321. return -EINVAL;
  322. tea5764_i2c_read(radio);
  323. memset(f, 0, sizeof(*f));
  324. f->type = V4L2_TUNER_RADIO;
  325. if (r->tnctrl & TEA5764_TNCTRL_PUPD0)
  326. f->frequency = (tea5764_get_freq(radio) * 2) / 125;
  327. else
  328. f->frequency = 0;
  329. return 0;
  330. }
  331. static int vidioc_queryctrl(struct file *file, void *priv,
  332. struct v4l2_queryctrl *qc)
  333. {
  334. int i;
  335. for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
  336. if (qc->id && qc->id == radio_qctrl[i].id) {
  337. memcpy(qc, &(radio_qctrl[i]), sizeof(*qc));
  338. return 0;
  339. }
  340. }
  341. return -EINVAL;
  342. }
  343. static int vidioc_g_ctrl(struct file *file, void *priv,
  344. struct v4l2_control *ctrl)
  345. {
  346. struct tea5764_device *radio = video_drvdata(file);
  347. switch (ctrl->id) {
  348. case V4L2_CID_AUDIO_MUTE:
  349. tea5764_i2c_read(radio);
  350. ctrl->value = tea5764_is_muted(radio) ? 1 : 0;
  351. return 0;
  352. }
  353. return -EINVAL;
  354. }
  355. static int vidioc_s_ctrl(struct file *file, void *priv,
  356. struct v4l2_control *ctrl)
  357. {
  358. struct tea5764_device *radio = video_drvdata(file);
  359. switch (ctrl->id) {
  360. case V4L2_CID_AUDIO_MUTE:
  361. tea5764_mute(radio, ctrl->value);
  362. return 0;
  363. }
  364. return -EINVAL;
  365. }
  366. static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
  367. {
  368. *i = 0;
  369. return 0;
  370. }
  371. static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
  372. {
  373. if (i != 0)
  374. return -EINVAL;
  375. return 0;
  376. }
  377. static int vidioc_g_audio(struct file *file, void *priv,
  378. struct v4l2_audio *a)
  379. {
  380. if (a->index > 1)
  381. return -EINVAL;
  382. strcpy(a->name, "Radio");
  383. a->capability = V4L2_AUDCAP_STEREO;
  384. return 0;
  385. }
  386. static int vidioc_s_audio(struct file *file, void *priv,
  387. struct v4l2_audio *a)
  388. {
  389. if (a->index != 0)
  390. return -EINVAL;
  391. return 0;
  392. }
  393. /* File system interface */
  394. static const struct v4l2_file_operations tea5764_fops = {
  395. .owner = THIS_MODULE,
  396. .unlocked_ioctl = video_ioctl2,
  397. };
  398. static const struct v4l2_ioctl_ops tea5764_ioctl_ops = {
  399. .vidioc_querycap = vidioc_querycap,
  400. .vidioc_g_tuner = vidioc_g_tuner,
  401. .vidioc_s_tuner = vidioc_s_tuner,
  402. .vidioc_g_audio = vidioc_g_audio,
  403. .vidioc_s_audio = vidioc_s_audio,
  404. .vidioc_g_input = vidioc_g_input,
  405. .vidioc_s_input = vidioc_s_input,
  406. .vidioc_g_frequency = vidioc_g_frequency,
  407. .vidioc_s_frequency = vidioc_s_frequency,
  408. .vidioc_queryctrl = vidioc_queryctrl,
  409. .vidioc_g_ctrl = vidioc_g_ctrl,
  410. .vidioc_s_ctrl = vidioc_s_ctrl,
  411. };
  412. /* V4L2 interface */
  413. static struct video_device tea5764_radio_template = {
  414. .name = "TEA5764 FM-Radio",
  415. .fops = &tea5764_fops,
  416. .ioctl_ops = &tea5764_ioctl_ops,
  417. .release = video_device_release,
  418. };
  419. /* I2C probe: check if the device exists and register with v4l if it is */
  420. static int __devinit tea5764_i2c_probe(struct i2c_client *client,
  421. const struct i2c_device_id *id)
  422. {
  423. struct tea5764_device *radio;
  424. struct tea5764_regs *r;
  425. int ret;
  426. PDEBUG("probe");
  427. radio = kzalloc(sizeof(struct tea5764_device), GFP_KERNEL);
  428. if (!radio)
  429. return -ENOMEM;
  430. mutex_init(&radio->mutex);
  431. radio->i2c_client = client;
  432. ret = tea5764_i2c_read(radio);
  433. if (ret)
  434. goto errfr;
  435. r = &radio->regs;
  436. PDEBUG("chipid = %04X, manid = %04X", r->chipid, r->manid);
  437. if (r->chipid != TEA5764_CHIPID ||
  438. (r->manid & 0x0fff) != TEA5764_MANID) {
  439. PWARN("This chip is not a TEA5764!");
  440. ret = -EINVAL;
  441. goto errfr;
  442. }
  443. radio->videodev = video_device_alloc();
  444. if (!(radio->videodev)) {
  445. ret = -ENOMEM;
  446. goto errfr;
  447. }
  448. memcpy(radio->videodev, &tea5764_radio_template,
  449. sizeof(tea5764_radio_template));
  450. i2c_set_clientdata(client, radio);
  451. video_set_drvdata(radio->videodev, radio);
  452. radio->videodev->lock = &radio->mutex;
  453. /* initialize and power off the chip */
  454. tea5764_i2c_read(radio);
  455. tea5764_set_audout_mode(radio, V4L2_TUNER_MODE_STEREO);
  456. tea5764_mute(radio, 1);
  457. tea5764_power_down(radio);
  458. ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr);
  459. if (ret < 0) {
  460. PWARN("Could not register video device!");
  461. goto errrel;
  462. }
  463. PINFO("registered.");
  464. return 0;
  465. errrel:
  466. video_device_release(radio->videodev);
  467. errfr:
  468. kfree(radio);
  469. return ret;
  470. }
  471. static int __devexit tea5764_i2c_remove(struct i2c_client *client)
  472. {
  473. struct tea5764_device *radio = i2c_get_clientdata(client);
  474. PDEBUG("remove");
  475. if (radio) {
  476. tea5764_power_down(radio);
  477. video_unregister_device(radio->videodev);
  478. kfree(radio);
  479. }
  480. return 0;
  481. }
  482. /* I2C subsystem interface */
  483. static const struct i2c_device_id tea5764_id[] = {
  484. { "radio-tea5764", 0 },
  485. { } /* Terminating entry */
  486. };
  487. MODULE_DEVICE_TABLE(i2c, tea5764_id);
  488. static struct i2c_driver tea5764_i2c_driver = {
  489. .driver = {
  490. .name = "radio-tea5764",
  491. .owner = THIS_MODULE,
  492. },
  493. .probe = tea5764_i2c_probe,
  494. .remove = __devexit_p(tea5764_i2c_remove),
  495. .id_table = tea5764_id,
  496. };
  497. /* init the driver */
  498. static int __init tea5764_init(void)
  499. {
  500. int ret = i2c_add_driver(&tea5764_i2c_driver);
  501. printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ": "
  502. DRIVER_DESC "\n");
  503. return ret;
  504. }
  505. /* cleanup the driver */
  506. static void __exit tea5764_exit(void)
  507. {
  508. i2c_del_driver(&tea5764_i2c_driver);
  509. }
  510. MODULE_AUTHOR(DRIVER_AUTHOR);
  511. MODULE_DESCRIPTION(DRIVER_DESC);
  512. MODULE_LICENSE("GPL");
  513. MODULE_VERSION(DRIVER_VERSION);
  514. module_param(use_xtal, int, 0);
  515. MODULE_PARM_DESC(use_xtal, "Chip have a xtal connected in board");
  516. module_param(radio_nr, int, 0);
  517. MODULE_PARM_DESC(radio_nr, "video4linux device number to use");
  518. module_init(tea5764_init);
  519. module_exit(tea5764_exit);