Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * handle saa7134 IR remotes via linux kernel input layer. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/moduleparam.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/delay.h> |
| 25 | #include <linux/sched.h> |
| 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/input.h> |
| 28 | |
| 29 | #include "saa7134-reg.h" |
| 30 | #include "saa7134.h" |
| 31 | |
| 32 | static unsigned int disable_ir = 0; |
| 33 | module_param(disable_ir, int, 0444); |
| 34 | MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); |
| 35 | |
| 36 | static unsigned int ir_debug = 0; |
| 37 | module_param(ir_debug, int, 0644); |
| 38 | MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); |
| 39 | |
| 40 | #define dprintk(fmt, arg...) if (ir_debug) \ |
| 41 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) |
Ricardo Cerqueira | ac9cd97 | 2005-11-08 21:37:56 -0800 | [diff] [blame] | 42 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ |
| 43 | printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Ricardo Cerqueira | ac9cd97 | 2005-11-08 21:37:56 -0800 | [diff] [blame] | 45 | /* -------------------- GPIO generic keycode builder -------------------- */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
| 47 | static int build_key(struct saa7134_dev *dev) |
| 48 | { |
| 49 | struct saa7134_ir *ir = dev->remote; |
| 50 | u32 gpio, data; |
| 51 | |
| 52 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ |
| 53 | saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); |
| 54 | saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); |
| 55 | |
| 56 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 57 | if (ir->polling) { |
| 58 | if (ir->last_gpio == gpio) |
| 59 | return 0; |
| 60 | ir->last_gpio = gpio; |
| 61 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 63 | data = ir_extract_bits(gpio, ir->mask_keycode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | dprintk("build_key gpio=0x%x mask=0x%x data=%d\n", |
| 65 | gpio, ir->mask_keycode, data); |
| 66 | |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 67 | if (ir->polling) { |
| 68 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || |
| 69 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { |
| 70 | ir_input_keydown(ir->dev, &ir->ir, data, data); |
| 71 | } else { |
| 72 | ir_input_nokey(ir->dev, &ir->ir); |
| 73 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | } |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 75 | else { /* IRQ driven mode - handle key press and release in one go */ |
| 76 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || |
| 77 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { |
| 78 | ir_input_keydown(ir->dev, &ir->ir, data, data); |
| 79 | ir_input_nokey(ir->dev, &ir->ir); |
| 80 | } |
| 81 | } |
| 82 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | return 0; |
| 84 | } |
| 85 | |
Ricardo Cerqueira | ac9cd97 | 2005-11-08 21:37:56 -0800 | [diff] [blame] | 86 | /* --------------------- Chip specific I2C key builders ----------------- */ |
| 87 | |
| 88 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
| 89 | { |
| 90 | unsigned char b; |
| 91 | |
| 92 | /* poll IR chip */ |
| 93 | if (1 != i2c_master_recv(&ir->c,&b,1)) { |
| 94 | i2cdprintk("read error\n"); |
| 95 | return -EIO; |
| 96 | } |
| 97 | |
| 98 | /* no button press */ |
| 99 | if (b==0) |
| 100 | return 0; |
| 101 | |
| 102 | /* repeating */ |
| 103 | if (b & 0x80) |
| 104 | return 1; |
| 105 | |
| 106 | *ir_key = b; |
| 107 | *ir_raw = b; |
| 108 | return 1; |
| 109 | } |
| 110 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | void saa7134_input_irq(struct saa7134_dev *dev) |
| 112 | { |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 113 | struct saa7134_ir *ir = dev->remote; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 115 | if (!ir->polling) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | build_key(dev); |
| 117 | } |
| 118 | |
| 119 | static void saa7134_input_timer(unsigned long data) |
| 120 | { |
| 121 | struct saa7134_dev *dev = (struct saa7134_dev*)data; |
| 122 | struct saa7134_ir *ir = dev->remote; |
| 123 | unsigned long timeout; |
| 124 | |
| 125 | build_key(dev); |
| 126 | timeout = jiffies + (ir->polling * HZ / 1000); |
| 127 | mod_timer(&ir->timer, timeout); |
| 128 | } |
| 129 | |
| 130 | int saa7134_input_init1(struct saa7134_dev *dev) |
| 131 | { |
| 132 | struct saa7134_ir *ir; |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 133 | struct input_dev *input_dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | IR_KEYTAB_TYPE *ir_codes = NULL; |
| 135 | u32 mask_keycode = 0; |
| 136 | u32 mask_keydown = 0; |
| 137 | u32 mask_keyup = 0; |
| 138 | int polling = 0; |
| 139 | int ir_type = IR_TYPE_OTHER; |
| 140 | |
Ricardo Cerqueira | cb2444d | 2005-11-08 21:38:47 -0800 | [diff] [blame] | 141 | if (dev->has_remote != SAA7134_REMOTE_GPIO) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | return -ENODEV; |
| 143 | if (disable_ir) |
| 144 | return -ENODEV; |
| 145 | |
| 146 | /* detect & configure */ |
| 147 | switch (dev->board) { |
| 148 | case SAA7134_BOARD_FLYVIDEO2000: |
| 149 | case SAA7134_BOARD_FLYVIDEO3000: |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 150 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
Arnaud Patard | 6af90ab | 2005-11-08 21:36:55 -0800 | [diff] [blame] | 151 | case SAA7134_BOARD_FLYTVPLATINUM_MINI2: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 152 | ir_codes = ir_codes_flyvideo; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | mask_keycode = 0xEC00000; |
| 154 | mask_keydown = 0x0040000; |
| 155 | break; |
| 156 | case SAA7134_BOARD_CINERGY400: |
| 157 | case SAA7134_BOARD_CINERGY600: |
| 158 | case SAA7134_BOARD_CINERGY600_MK3: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 159 | ir_codes = ir_codes_cinergy; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | mask_keycode = 0x00003f; |
| 161 | mask_keyup = 0x040000; |
| 162 | break; |
| 163 | case SAA7134_BOARD_ECS_TVP3XP: |
| 164 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 165 | ir_codes = ir_codes_eztv; |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 166 | mask_keycode = 0x00017c; |
| 167 | mask_keyup = 0x000002; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | polling = 50; // ms |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 169 | break; |
| 170 | case SAA7134_BOARD_KWORLD_XPERT: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | case SAA7134_BOARD_AVACSSMARTTV: |
Nickolay V. Shmyrev | b639f9d | 2006-01-23 09:44:10 -0200 | [diff] [blame] | 172 | ir_codes = ir_codes_pixelview; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | mask_keycode = 0x00001F; |
| 174 | mask_keyup = 0x000020; |
| 175 | polling = 50; // ms |
| 176 | break; |
| 177 | case SAA7134_BOARD_MD2819: |
Mauro Carvalho Chehab | ac19ecc | 2005-06-23 22:05:09 -0700 | [diff] [blame] | 178 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | case SAA7134_BOARD_AVERMEDIA_305: |
| 180 | case SAA7134_BOARD_AVERMEDIA_307: |
Mauro Carvalho Chehab | ac19ecc | 2005-06-23 22:05:09 -0700 | [diff] [blame] | 181 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
| 182 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: |
| 183 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: |
Nickolay V. Shmyrev | b639f9d | 2006-01-23 09:44:10 -0200 | [diff] [blame] | 184 | ir_codes = ir_codes_avermedia; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | mask_keycode = 0x0007C8; |
| 186 | mask_keydown = 0x000010; |
| 187 | polling = 50; // ms |
| 188 | /* Set GPIO pin2 to high to enable the IR controller */ |
| 189 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); |
| 190 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); |
| 191 | break; |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 192 | case SAA7134_BOARD_KWORLD_TERMINATOR: |
Nickolay V. Shmyrev | b639f9d | 2006-01-23 09:44:10 -0200 | [diff] [blame] | 193 | ir_codes = ir_codes_pixelview; |
James R. Webb | dc2286c | 2005-11-08 21:37:00 -0800 | [diff] [blame] | 194 | mask_keycode = 0x00001f; |
| 195 | mask_keyup = 0x000060; |
| 196 | polling = 50; // ms |
| 197 | break; |
Mauro Carvalho Chehab | ac19ecc | 2005-06-23 22:05:09 -0700 | [diff] [blame] | 198 | case SAA7134_BOARD_MANLI_MTV001: |
| 199 | case SAA7134_BOARD_MANLI_MTV002: |
Nickolay V. Shmyrev | a8ff417 | 2005-11-08 21:36:16 -0800 | [diff] [blame] | 200 | case SAA7134_BOARD_BEHOLD_409FM: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 201 | ir_codes = ir_codes_manli; |
Mauro Carvalho Chehab | ac19ecc | 2005-06-23 22:05:09 -0700 | [diff] [blame] | 202 | mask_keycode = 0x001f00; |
| 203 | mask_keyup = 0x004000; |
Mauro Carvalho Chehab | ac19ecc | 2005-06-23 22:05:09 -0700 | [diff] [blame] | 204 | polling = 50; // ms |
| 205 | break; |
Ricardo Cerqueira | 17ce1ff | 2005-11-08 21:38:47 -0800 | [diff] [blame] | 206 | case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 207 | ir_codes = ir_codes_pctv_sedna; |
Pavel Mihaylov | c3d9319 | 2005-11-08 21:38:43 -0800 | [diff] [blame] | 208 | mask_keycode = 0x001f00; |
| 209 | mask_keyup = 0x004000; |
| 210 | polling = 50; // ms |
| 211 | break; |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 212 | case SAA7134_BOARD_GOTVIEW_7135: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 213 | ir_codes = ir_codes_gotview7135; |
Nickolay V. Shmyrev | 6b96144 | 2005-11-08 21:36:22 -0800 | [diff] [blame] | 214 | mask_keycode = 0x0003EC; |
| 215 | mask_keyup = 0x008000; |
| 216 | mask_keydown = 0x000010; |
| 217 | polling = 50; // ms |
| 218 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
Nickolay V. Shmyrev | 2a9a9a8 | 2006-01-09 15:25:33 -0200 | [diff] [blame] | 220 | case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 221 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 222 | ir_codes = ir_codes_videomate_tv_pvr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | mask_keycode = 0x00003F; |
| 224 | mask_keyup = 0x400000; |
| 225 | polling = 50; // ms |
| 226 | break; |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 227 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
| 228 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
Ricardo Cerqueira | 4c0f631 | 2006-01-23 09:42:06 -0200 | [diff] [blame] | 229 | ir_codes = ir_codes_videomate_tv_pvr; |
Nickolay V. Shmyrev | fea095f | 2005-11-08 21:36:47 -0800 | [diff] [blame] | 230 | mask_keycode = 0x003F00; |
| 231 | mask_keyup = 0x040000; |
| 232 | break; |
Giampiero Giancipoli | 3d8466e | 2006-02-07 06:49:09 -0200 | [diff] [blame] | 233 | case SAA7134_BOARD_FLYDVBT_LR301: |
Rudo Thomas | a802917 | 2006-02-27 00:08:46 -0300 | [diff] [blame] | 234 | case SAA7134_BOARD_FLYDVBTDUO: |
Giampiero Giancipoli | 3d8466e | 2006-02-07 06:49:09 -0200 | [diff] [blame] | 235 | ir_codes = ir_codes_flydvb; |
| 236 | mask_keycode = 0x0001F00; |
| 237 | mask_keydown = 0x0040000; |
| 238 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | } |
| 240 | if (NULL == ir_codes) { |
| 241 | printk("%s: Oops: IR config error [card=%d]\n", |
| 242 | dev->name, dev->board); |
| 243 | return -ENODEV; |
| 244 | } |
| 245 | |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 246 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
| 247 | input_dev = input_allocate_device(); |
| 248 | if (!ir || !input_dev) { |
| 249 | kfree(ir); |
| 250 | input_free_device(input_dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | return -ENOMEM; |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 252 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | |
Dmitry Torokhov | d271d1c | 2005-11-20 00:56:54 -0500 | [diff] [blame] | 254 | ir->dev = input_dev; |
| 255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | /* init hardware-specific stuff */ |
| 257 | ir->mask_keycode = mask_keycode; |
| 258 | ir->mask_keydown = mask_keydown; |
| 259 | ir->mask_keyup = mask_keyup; |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 260 | ir->polling = polling; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | |
| 262 | /* init input device */ |
| 263 | snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", |
| 264 | saa7134_boards[dev->board].name); |
| 265 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
| 266 | pci_name(dev->pci)); |
| 267 | |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 268 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
| 269 | input_dev->name = ir->name; |
| 270 | input_dev->phys = ir->phys; |
| 271 | input_dev->id.bustype = BUS_PCI; |
| 272 | input_dev->id.version = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | if (dev->pci->subsystem_vendor) { |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 274 | input_dev->id.vendor = dev->pci->subsystem_vendor; |
| 275 | input_dev->id.product = dev->pci->subsystem_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | } else { |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 277 | input_dev->id.vendor = dev->pci->vendor; |
| 278 | input_dev->id.product = dev->pci->device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | } |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 280 | input_dev->cdev.dev = &dev->pci->dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
| 282 | /* all done */ |
| 283 | dev->remote = ir; |
| 284 | if (ir->polling) { |
| 285 | init_timer(&ir->timer); |
| 286 | ir->timer.function = saa7134_input_timer; |
| 287 | ir->timer.data = (unsigned long)dev; |
| 288 | ir->timer.expires = jiffies + HZ; |
| 289 | add_timer(&ir->timer); |
| 290 | } |
| 291 | |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 292 | input_register_device(ir->dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | void saa7134_input_fini(struct saa7134_dev *dev) |
| 297 | { |
| 298 | if (NULL == dev->remote) |
| 299 | return; |
| 300 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | if (dev->remote->polling) |
| 302 | del_timer_sync(&dev->remote->timer); |
Dmitry Torokhov | b7df391 | 2005-09-15 02:01:53 -0500 | [diff] [blame] | 303 | input_unregister_device(dev->remote->dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | kfree(dev->remote); |
| 305 | dev->remote = NULL; |
| 306 | } |
| 307 | |
Ricardo Cerqueira | ac9cd97 | 2005-11-08 21:37:56 -0800 | [diff] [blame] | 308 | void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) |
| 309 | { |
| 310 | if (disable_ir) { |
Ricardo Cerqueira | cb2444d | 2005-11-08 21:38:47 -0800 | [diff] [blame] | 311 | dprintk("Found supported i2c remote, but IR has been disabled\n"); |
Ricardo Cerqueira | ac9cd97 | 2005-11-08 21:37:56 -0800 | [diff] [blame] | 312 | ir->get_key=NULL; |
| 313 | return; |
| 314 | } |
| 315 | |
| 316 | switch (dev->board) { |
| 317 | case SAA7134_BOARD_PINNACLE_PCTV_110i: |
| 318 | snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); |
| 319 | ir->get_key = get_key_pinnacle; |
| 320 | ir->ir_codes = ir_codes_pinnacle; |
| 321 | break; |
| 322 | case SAA7134_BOARD_UPMOST_PURPLE_TV: |
| 323 | snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); |
| 324 | ir->get_key = get_key_purpletv; |
| 325 | ir->ir_codes = ir_codes_purpletv; |
| 326 | break; |
| 327 | default: |
| 328 | dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); |
| 329 | break; |
| 330 | } |
| 331 | |
| 332 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | /* ---------------------------------------------------------------------- |
| 334 | * Local variables: |
| 335 | * c-basic-offset: 8 |
| 336 | * End: |
| 337 | */ |