cx88-input.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /*
  2. *
  3. * Device driver for GPIO attached remote control interfaces
  4. * on Conexant 2388x based TV/DVB cards.
  5. *
  6. * Copyright (c) 2003 Pavel Machek
  7. * Copyright (c) 2004 Gerd Knorr
  8. * Copyright (c) 2004, 2005 Chris Pascoe
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. #include <linux/init.h>
  25. #include <linux/hrtimer.h>
  26. #include <linux/pci.h>
  27. #include <linux/slab.h>
  28. #include <linux/module.h>
  29. #include "cx88.h"
  30. #include <media/rc-core.h>
  31. #define MODULE_NAME "cx88xx"
  32. /* ---------------------------------------------------------------------- */
  33. struct cx88_IR {
  34. struct cx88_core *core;
  35. struct rc_dev *dev;
  36. int users;
  37. char name[32];
  38. char phys[32];
  39. /* sample from gpio pin 16 */
  40. u32 sampling;
  41. /* poll external decoder */
  42. int polling;
  43. struct hrtimer timer;
  44. u32 gpio_addr;
  45. u32 last_gpio;
  46. u32 mask_keycode;
  47. u32 mask_keydown;
  48. u32 mask_keyup;
  49. };
  50. static unsigned ir_samplerate = 4;
  51. module_param(ir_samplerate, uint, 0444);
  52. MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4");
  53. static int ir_debug;
  54. module_param(ir_debug, int, 0644); /* debug level [IR] */
  55. MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
  56. #define ir_dprintk(fmt, arg...) if (ir_debug) \
  57. printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
  58. #define dprintk(fmt, arg...) if (ir_debug) \
  59. printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
  60. /* ---------------------------------------------------------------------- */
  61. static void cx88_ir_handle_key(struct cx88_IR *ir)
  62. {
  63. struct cx88_core *core = ir->core;
  64. u32 gpio, data, auxgpio;
  65. /* read gpio value */
  66. gpio = cx_read(ir->gpio_addr);
  67. switch (core->boardnr) {
  68. case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
  69. /* This board apparently uses a combination of 2 GPIO
  70. to represent the keys. Additionally, the second GPIO
  71. can be used for parity.
  72. Example:
  73. for key "5"
  74. gpio = 0x758, auxgpio = 0xe5 or 0xf5
  75. for key "Power"
  76. gpio = 0x758, auxgpio = 0xed or 0xfd
  77. */
  78. auxgpio = cx_read(MO_GP1_IO);
  79. /* Take out the parity part */
  80. gpio=(gpio & 0x7fd) + (auxgpio & 0xef);
  81. break;
  82. case CX88_BOARD_WINFAST_DTV1000:
  83. case CX88_BOARD_WINFAST_DTV1800H:
  84. case CX88_BOARD_WINFAST_DTV1800H_XC4000:
  85. case CX88_BOARD_WINFAST_DTV2000H_PLUS:
  86. case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
  87. gpio = (gpio & 0x6ff) | ((cx_read(MO_GP1_IO) << 8) & 0x900);
  88. auxgpio = gpio;
  89. break;
  90. default:
  91. auxgpio = gpio;
  92. }
  93. if (ir->polling) {
  94. if (ir->last_gpio == auxgpio)
  95. return;
  96. ir->last_gpio = auxgpio;
  97. }
  98. /* extract data */
  99. data = ir_extract_bits(gpio, ir->mask_keycode);
  100. ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
  101. gpio, data,
  102. ir->polling ? "poll" : "irq",
  103. (gpio & ir->mask_keydown) ? " down" : "",
  104. (gpio & ir->mask_keyup) ? " up" : "");
  105. if (ir->core->boardnr == CX88_BOARD_NORWOOD_MICRO) {
  106. u32 gpio_key = cx_read(MO_GP0_IO);
  107. data = (data << 4) | ((gpio_key & 0xf0) >> 4);
  108. rc_keydown(ir->dev, data, 0);
  109. } else if (ir->mask_keydown) {
  110. /* bit set on keydown */
  111. if (gpio & ir->mask_keydown)
  112. rc_keydown_notimeout(ir->dev, data, 0);
  113. else
  114. rc_keyup(ir->dev);
  115. } else if (ir->mask_keyup) {
  116. /* bit cleared on keydown */
  117. if (0 == (gpio & ir->mask_keyup))
  118. rc_keydown_notimeout(ir->dev, data, 0);
  119. else
  120. rc_keyup(ir->dev);
  121. } else {
  122. /* can't distinguish keydown/up :-/ */
  123. rc_keydown_notimeout(ir->dev, data, 0);
  124. rc_keyup(ir->dev);
  125. }
  126. }
  127. static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer)
  128. {
  129. unsigned long missed;
  130. struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
  131. cx88_ir_handle_key(ir);
  132. missed = hrtimer_forward_now(&ir->timer,
  133. ktime_set(0, ir->polling * 1000000));
  134. if (missed > 1)
  135. ir_dprintk("Missed ticks %ld\n", missed - 1);
  136. return HRTIMER_RESTART;
  137. }
  138. static int __cx88_ir_start(void *priv)
  139. {
  140. struct cx88_core *core = priv;
  141. struct cx88_IR *ir;
  142. if (!core || !core->ir)
  143. return -EINVAL;
  144. ir = core->ir;
  145. if (ir->polling) {
  146. hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
  147. ir->timer.function = cx88_ir_work;
  148. hrtimer_start(&ir->timer,
  149. ktime_set(0, ir->polling * 1000000),
  150. HRTIMER_MODE_REL);
  151. }
  152. if (ir->sampling) {
  153. core->pci_irqmask |= PCI_INT_IR_SMPINT;
  154. cx_write(MO_DDS_IO, 0x33F286 * ir_samplerate); /* samplerate */
  155. cx_write(MO_DDSCFG_IO, 0x5); /* enable */
  156. }
  157. return 0;
  158. }
  159. static void __cx88_ir_stop(void *priv)
  160. {
  161. struct cx88_core *core = priv;
  162. struct cx88_IR *ir;
  163. if (!core || !core->ir)
  164. return;
  165. ir = core->ir;
  166. if (ir->sampling) {
  167. cx_write(MO_DDSCFG_IO, 0x0);
  168. core->pci_irqmask &= ~PCI_INT_IR_SMPINT;
  169. }
  170. if (ir->polling)
  171. hrtimer_cancel(&ir->timer);
  172. }
  173. int cx88_ir_start(struct cx88_core *core)
  174. {
  175. if (core->ir->users)
  176. return __cx88_ir_start(core);
  177. return 0;
  178. }
  179. void cx88_ir_stop(struct cx88_core *core)
  180. {
  181. if (core->ir->users)
  182. __cx88_ir_stop(core);
  183. }
  184. static int cx88_ir_open(struct rc_dev *rc)
  185. {
  186. struct cx88_core *core = rc->priv;
  187. core->ir->users++;
  188. return __cx88_ir_start(core);
  189. }
  190. static void cx88_ir_close(struct rc_dev *rc)
  191. {
  192. struct cx88_core *core = rc->priv;
  193. core->ir->users--;
  194. if (!core->ir->users)
  195. __cx88_ir_stop(core);
  196. }
  197. /* ---------------------------------------------------------------------- */
  198. int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
  199. {
  200. struct cx88_IR *ir;
  201. struct rc_dev *dev;
  202. char *ir_codes = NULL;
  203. u64 rc_type = RC_TYPE_OTHER;
  204. int err = -ENOMEM;
  205. u32 hardware_mask = 0; /* For devices with a hardware mask, when
  206. * used with a full-code IR table
  207. */
  208. ir = kzalloc(sizeof(*ir), GFP_KERNEL);
  209. dev = rc_allocate_device();
  210. if (!ir || !dev)
  211. goto err_out_free;
  212. ir->dev = dev;
  213. /* detect & configure */
  214. switch (core->boardnr) {
  215. case CX88_BOARD_DNTV_LIVE_DVB_T:
  216. case CX88_BOARD_KWORLD_DVB_T:
  217. case CX88_BOARD_KWORLD_DVB_T_CX22702:
  218. ir_codes = RC_MAP_DNTV_LIVE_DVB_T;
  219. ir->gpio_addr = MO_GP1_IO;
  220. ir->mask_keycode = 0x1f;
  221. ir->mask_keyup = 0x60;
  222. ir->polling = 50; /* ms */
  223. break;
  224. case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
  225. ir_codes = RC_MAP_CINERGY_1400;
  226. ir->sampling = 0xeb04; /* address */
  227. break;
  228. case CX88_BOARD_HAUPPAUGE:
  229. case CX88_BOARD_HAUPPAUGE_DVB_T1:
  230. case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
  231. case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
  232. case CX88_BOARD_HAUPPAUGE_HVR1100:
  233. case CX88_BOARD_HAUPPAUGE_HVR3000:
  234. case CX88_BOARD_HAUPPAUGE_HVR4000:
  235. case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
  236. case CX88_BOARD_PCHDTV_HD3000:
  237. case CX88_BOARD_PCHDTV_HD5500:
  238. case CX88_BOARD_HAUPPAUGE_IRONLY:
  239. ir_codes = RC_MAP_HAUPPAUGE;
  240. ir->sampling = 1;
  241. break;
  242. case CX88_BOARD_WINFAST_DTV2000H:
  243. case CX88_BOARD_WINFAST_DTV2000H_J:
  244. case CX88_BOARD_WINFAST_DTV1800H:
  245. case CX88_BOARD_WINFAST_DTV1800H_XC4000:
  246. case CX88_BOARD_WINFAST_DTV2000H_PLUS:
  247. ir_codes = RC_MAP_WINFAST;
  248. ir->gpio_addr = MO_GP0_IO;
  249. ir->mask_keycode = 0x8f8;
  250. ir->mask_keyup = 0x100;
  251. ir->polling = 50; /* ms */
  252. break;
  253. case CX88_BOARD_WINFAST2000XP_EXPERT:
  254. case CX88_BOARD_WINFAST_DTV1000:
  255. case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
  256. ir_codes = RC_MAP_WINFAST;
  257. ir->gpio_addr = MO_GP0_IO;
  258. ir->mask_keycode = 0x8f8;
  259. ir->mask_keyup = 0x100;
  260. ir->polling = 1; /* ms */
  261. break;
  262. case CX88_BOARD_IODATA_GVBCTV7E:
  263. ir_codes = RC_MAP_IODATA_BCTV7E;
  264. ir->gpio_addr = MO_GP0_IO;
  265. ir->mask_keycode = 0xfd;
  266. ir->mask_keydown = 0x02;
  267. ir->polling = 5; /* ms */
  268. break;
  269. case CX88_BOARD_PROLINK_PLAYTVPVR:
  270. case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
  271. /*
  272. * It seems that this hardware is paired with NEC extended
  273. * address 0x866b. So, unfortunately, its usage with other
  274. * IR's with different address won't work. Still, there are
  275. * other IR's from the same manufacturer that works, like the
  276. * 002-T mini RC, provided with newer PV hardware
  277. */
  278. ir_codes = RC_MAP_PIXELVIEW_MK12;
  279. ir->gpio_addr = MO_GP1_IO;
  280. ir->mask_keyup = 0x80;
  281. ir->polling = 10; /* ms */
  282. hardware_mask = 0x3f; /* Hardware returns only 6 bits from command part */
  283. break;
  284. case CX88_BOARD_PROLINK_PV_8000GT:
  285. case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
  286. ir_codes = RC_MAP_PIXELVIEW_NEW;
  287. ir->gpio_addr = MO_GP1_IO;
  288. ir->mask_keycode = 0x3f;
  289. ir->mask_keyup = 0x80;
  290. ir->polling = 1; /* ms */
  291. break;
  292. case CX88_BOARD_KWORLD_LTV883:
  293. ir_codes = RC_MAP_PIXELVIEW;
  294. ir->gpio_addr = MO_GP1_IO;
  295. ir->mask_keycode = 0x1f;
  296. ir->mask_keyup = 0x60;
  297. ir->polling = 1; /* ms */
  298. break;
  299. case CX88_BOARD_ADSTECH_DVB_T_PCI:
  300. ir_codes = RC_MAP_ADSTECH_DVB_T_PCI;
  301. ir->gpio_addr = MO_GP1_IO;
  302. ir->mask_keycode = 0xbf;
  303. ir->mask_keyup = 0x40;
  304. ir->polling = 50; /* ms */
  305. break;
  306. case CX88_BOARD_MSI_TVANYWHERE_MASTER:
  307. ir_codes = RC_MAP_MSI_TVANYWHERE;
  308. ir->gpio_addr = MO_GP1_IO;
  309. ir->mask_keycode = 0x1f;
  310. ir->mask_keyup = 0x40;
  311. ir->polling = 1; /* ms */
  312. break;
  313. case CX88_BOARD_AVERTV_303:
  314. case CX88_BOARD_AVERTV_STUDIO_303:
  315. ir_codes = RC_MAP_AVERTV_303;
  316. ir->gpio_addr = MO_GP2_IO;
  317. ir->mask_keycode = 0xfb;
  318. ir->mask_keydown = 0x02;
  319. ir->polling = 50; /* ms */
  320. break;
  321. case CX88_BOARD_OMICOM_SS4_PCI:
  322. case CX88_BOARD_SATTRADE_ST4200:
  323. case CX88_BOARD_TBS_8920:
  324. case CX88_BOARD_TBS_8910:
  325. case CX88_BOARD_PROF_7300:
  326. case CX88_BOARD_PROF_7301:
  327. case CX88_BOARD_PROF_6200:
  328. ir_codes = RC_MAP_TBS_NEC;
  329. ir->sampling = 0xff00; /* address */
  330. break;
  331. case CX88_BOARD_TEVII_S464:
  332. case CX88_BOARD_TEVII_S460:
  333. case CX88_BOARD_TEVII_S420:
  334. ir_codes = RC_MAP_TEVII_NEC;
  335. ir->sampling = 0xff00; /* address */
  336. break;
  337. case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
  338. ir_codes = RC_MAP_DNTV_LIVE_DVBT_PRO;
  339. ir->sampling = 0xff00; /* address */
  340. break;
  341. case CX88_BOARD_NORWOOD_MICRO:
  342. ir_codes = RC_MAP_NORWOOD;
  343. ir->gpio_addr = MO_GP1_IO;
  344. ir->mask_keycode = 0x0e;
  345. ir->mask_keyup = 0x80;
  346. ir->polling = 50; /* ms */
  347. break;
  348. case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
  349. ir_codes = RC_MAP_NPGTECH;
  350. ir->gpio_addr = MO_GP0_IO;
  351. ir->mask_keycode = 0xfa;
  352. ir->polling = 50; /* ms */
  353. break;
  354. case CX88_BOARD_PINNACLE_PCTV_HD_800i:
  355. ir_codes = RC_MAP_PINNACLE_PCTV_HD;
  356. ir->sampling = 1;
  357. break;
  358. case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
  359. ir_codes = RC_MAP_POWERCOLOR_REAL_ANGEL;
  360. ir->gpio_addr = MO_GP2_IO;
  361. ir->mask_keycode = 0x7e;
  362. ir->polling = 100; /* ms */
  363. break;
  364. case CX88_BOARD_TWINHAN_VP1027_DVBS:
  365. ir_codes = RC_MAP_TWINHAN_VP1027_DVBS;
  366. rc_type = RC_TYPE_NEC;
  367. ir->sampling = 0xff00; /* address */
  368. break;
  369. }
  370. if (!ir_codes) {
  371. err = -ENODEV;
  372. goto err_out_free;
  373. }
  374. /*
  375. * The usage of mask_keycode were very convenient, due to several
  376. * reasons. Among others, the scancode tables were using the scancode
  377. * as the index elements. So, the less bits it was used, the smaller
  378. * the table were stored. After the input changes, the better is to use
  379. * the full scancodes, since it allows replacing the IR remote by
  380. * another one. Unfortunately, there are still some hardware, like
  381. * Pixelview Ultra Pro, where only part of the scancode is sent via
  382. * GPIO. So, there's no way to get the full scancode. Due to that,
  383. * hardware_mask were introduced here: it represents those hardware
  384. * that has such limits.
  385. */
  386. if (hardware_mask && !ir->mask_keycode)
  387. ir->mask_keycode = hardware_mask;
  388. /* init input device */
  389. snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
  390. snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
  391. dev->input_name = ir->name;
  392. dev->input_phys = ir->phys;
  393. dev->input_id.bustype = BUS_PCI;
  394. dev->input_id.version = 1;
  395. if (pci->subsystem_vendor) {
  396. dev->input_id.vendor = pci->subsystem_vendor;
  397. dev->input_id.product = pci->subsystem_device;
  398. } else {
  399. dev->input_id.vendor = pci->vendor;
  400. dev->input_id.product = pci->device;
  401. }
  402. dev->dev.parent = &pci->dev;
  403. dev->map_name = ir_codes;
  404. dev->driver_name = MODULE_NAME;
  405. dev->priv = core;
  406. dev->open = cx88_ir_open;
  407. dev->close = cx88_ir_close;
  408. dev->scanmask = hardware_mask;
  409. if (ir->sampling) {
  410. dev->driver_type = RC_DRIVER_IR_RAW;
  411. dev->timeout = 10 * 1000 * 1000; /* 10 ms */
  412. } else {
  413. dev->driver_type = RC_DRIVER_SCANCODE;
  414. dev->allowed_protos = rc_type;
  415. }
  416. ir->core = core;
  417. core->ir = ir;
  418. /* all done */
  419. err = rc_register_device(dev);
  420. if (err)
  421. goto err_out_free;
  422. return 0;
  423. err_out_free:
  424. rc_free_device(dev);
  425. core->ir = NULL;
  426. kfree(ir);
  427. return err;
  428. }
  429. int cx88_ir_fini(struct cx88_core *core)
  430. {
  431. struct cx88_IR *ir = core->ir;
  432. /* skip detach on non attached boards */
  433. if (NULL == ir)
  434. return 0;
  435. cx88_ir_stop(core);
  436. rc_unregister_device(ir->dev);
  437. kfree(ir);
  438. /* done */
  439. core->ir = NULL;
  440. return 0;
  441. }
  442. /* ---------------------------------------------------------------------- */
  443. void cx88_ir_irq(struct cx88_core *core)
  444. {
  445. struct cx88_IR *ir = core->ir;
  446. u32 samples;
  447. unsigned todo, bits;
  448. struct ir_raw_event ev;
  449. if (!ir || !ir->sampling)
  450. return;
  451. /*
  452. * Samples are stored in a 32 bit register, oldest sample in
  453. * the msb. A set bit represents space and an unset bit
  454. * represents a pulse.
  455. */
  456. samples = cx_read(MO_SAMPLE_IO);
  457. if (samples == 0xff && ir->dev->idle)
  458. return;
  459. init_ir_raw_event(&ev);
  460. for (todo = 32; todo > 0; todo -= bits) {
  461. ev.pulse = samples & 0x80000000 ? false : true;
  462. bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples));
  463. ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate;
  464. ir_raw_event_store_with_filter(ir->dev, &ev);
  465. samples <<= bits;
  466. }
  467. ir_raw_event_handle(ir->dev);
  468. }
  469. static int get_key_pvr2000(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
  470. {
  471. int flags, code;
  472. /* poll IR chip */
  473. flags = i2c_smbus_read_byte_data(ir->c, 0x10);
  474. if (flags < 0) {
  475. dprintk("read error\n");
  476. return 0;
  477. }
  478. /* key pressed ? */
  479. if (0 == (flags & 0x80))
  480. return 0;
  481. /* read actual key code */
  482. code = i2c_smbus_read_byte_data(ir->c, 0x00);
  483. if (code < 0) {
  484. dprintk("read error\n");
  485. return 0;
  486. }
  487. dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
  488. code & 0xff, flags & 0xff);
  489. *ir_key = code & 0xff;
  490. *ir_raw = code;
  491. return 1;
  492. }
  493. void cx88_i2c_init_ir(struct cx88_core *core)
  494. {
  495. struct i2c_board_info info;
  496. const unsigned short default_addr_list[] = {
  497. 0x18, 0x6b, 0x71,
  498. I2C_CLIENT_END
  499. };
  500. const unsigned short pvr2000_addr_list[] = {
  501. 0x18, 0x1a,
  502. I2C_CLIENT_END
  503. };
  504. const unsigned short *addr_list = default_addr_list;
  505. const unsigned short *addrp;
  506. /* Instantiate the IR receiver device, if present */
  507. if (0 != core->i2c_rc)
  508. return;
  509. memset(&info, 0, sizeof(struct i2c_board_info));
  510. strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
  511. switch (core->boardnr) {
  512. case CX88_BOARD_LEADTEK_PVR2000:
  513. addr_list = pvr2000_addr_list;
  514. core->init_data.name = "cx88 Leadtek PVR 2000 remote";
  515. core->init_data.type = RC_TYPE_UNKNOWN;
  516. core->init_data.get_key = get_key_pvr2000;
  517. core->init_data.ir_codes = RC_MAP_EMPTY;
  518. break;
  519. }
  520. /*
  521. * We can't call i2c_new_probed_device() because it uses
  522. * quick writes for probing and at least some RC receiver
  523. * devices only reply to reads.
  524. * Also, Hauppauge XVR needs to be specified, as address 0x71
  525. * conflicts with another remote type used with saa7134
  526. */
  527. for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) {
  528. info.platform_data = NULL;
  529. memset(&core->init_data, 0, sizeof(core->init_data));
  530. if (*addrp == 0x71) {
  531. /* Hauppauge XVR */
  532. core->init_data.name = "cx88 Hauppauge XVR remote";
  533. core->init_data.ir_codes = RC_MAP_HAUPPAUGE;
  534. core->init_data.type = RC_TYPE_RC5;
  535. core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
  536. info.platform_data = &core->init_data;
  537. }
  538. if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
  539. I2C_SMBUS_READ, 0,
  540. I2C_SMBUS_QUICK, NULL) >= 0) {
  541. info.addr = *addrp;
  542. i2c_new_device(&core->i2c_adap, &info);
  543. break;
  544. }
  545. }
  546. }
  547. /* ---------------------------------------------------------------------- */
  548. MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe");
  549. MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");
  550. MODULE_LICENSE("GPL");