Commit | Line | Data |
---|---|---|
a1497357 MA |
1 | /* |
2 | Mantis PCI bridge driver | |
3 | ||
4 | Copyright (C) Manu Abraham (abraham.manu@gmail.com) | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
19 | */ | |
20 | ||
6bda9644 | 21 | #include <media/rc-core.h> |
a1497357 MA |
22 | #include <linux/pci.h> |
23 | ||
24 | #include "dmxdev.h" | |
25 | #include "dvbdev.h" | |
26 | #include "dvb_demux.h" | |
27 | #include "dvb_frontend.h" | |
28 | #include "dvb_net.h" | |
29 | ||
30 | #include "mantis_common.h" | |
31 | #include "mantis_reg.h" | |
32 | #include "mantis_uart.h" | |
33 | ||
727e625c | 34 | #define MODULE_NAME "mantis_core" |
d8b4b582 | 35 | #define RC_MAP_MANTIS "rc-mantis" |
727e625c | 36 | |
a1497357 MA |
37 | static struct ir_scancode mantis_ir_table[] = { |
38 | { 0x29, KEY_POWER }, | |
39 | { 0x28, KEY_FAVORITES }, | |
40 | { 0x30, KEY_TEXT }, | |
f5ae4f6f | 41 | { 0x17, KEY_INFO }, /* Preview */ |
a1497357 | 42 | { 0x23, KEY_EPG }, |
f5ae4f6f | 43 | { 0x3b, KEY_F22 }, /* Record List */ |
a1497357 MA |
44 | { 0x3c, KEY_1 }, |
45 | { 0x3e, KEY_2 }, | |
46 | { 0x39, KEY_3 }, | |
47 | { 0x36, KEY_4 }, | |
48 | { 0x22, KEY_5 }, | |
49 | { 0x20, KEY_6 }, | |
50 | { 0x32, KEY_7 }, | |
51 | { 0x26, KEY_8 }, | |
52 | { 0x24, KEY_9 }, | |
53 | { 0x2a, KEY_0 }, | |
54 | ||
55 | { 0x33, KEY_CANCEL }, | |
56 | { 0x2c, KEY_BACK }, | |
57 | { 0x15, KEY_CLEAR }, | |
58 | { 0x3f, KEY_TAB }, | |
59 | { 0x10, KEY_ENTER }, | |
60 | { 0x14, KEY_UP }, | |
61 | { 0x0d, KEY_RIGHT }, | |
62 | { 0x0e, KEY_DOWN }, | |
63 | { 0x11, KEY_LEFT }, | |
64 | ||
65 | { 0x21, KEY_VOLUMEUP }, | |
66 | { 0x35, KEY_VOLUMEDOWN }, | |
67 | { 0x3d, KEY_CHANNELDOWN }, | |
68 | { 0x3a, KEY_CHANNELUP }, | |
69 | { 0x2e, KEY_RECORD }, | |
70 | { 0x2b, KEY_PLAY }, | |
71 | { 0x13, KEY_PAUSE }, | |
72 | { 0x25, KEY_STOP }, | |
73 | ||
74 | { 0x1f, KEY_REWIND }, | |
75 | { 0x2d, KEY_FASTFORWARD }, | |
f5ae4f6f MA |
76 | { 0x1e, KEY_PREVIOUS }, /* Replay |< */ |
77 | { 0x1d, KEY_NEXT }, /* Skip >| */ | |
a1497357 | 78 | |
f5ae4f6f MA |
79 | { 0x0b, KEY_CAMERA }, /* Capture */ |
80 | { 0x0f, KEY_LANGUAGE }, /* SAP */ | |
81 | { 0x18, KEY_MODE }, /* PIP */ | |
82 | { 0x12, KEY_ZOOM }, /* Full screen */ | |
a1497357 MA |
83 | { 0x1c, KEY_SUBTITLE }, |
84 | { 0x2f, KEY_MUTE }, | |
f5ae4f6f MA |
85 | { 0x16, KEY_F20 }, /* L/R */ |
86 | { 0x38, KEY_F21 }, /* Hibernate */ | |
a1497357 | 87 | |
f5ae4f6f MA |
88 | { 0x37, KEY_SWITCHVIDEOMODE }, /* A/V */ |
89 | { 0x31, KEY_AGAIN }, /* Recall */ | |
90 | { 0x1a, KEY_KPPLUS }, /* Zoom+ */ | |
91 | { 0x19, KEY_KPMINUS }, /* Zoom- */ | |
a1497357 MA |
92 | { 0x27, KEY_RED }, |
93 | { 0x0C, KEY_GREEN }, | |
94 | { 0x01, KEY_YELLOW }, | |
95 | { 0x00, KEY_BLUE }, | |
96 | }; | |
97 | ||
d8b4b582 DH |
98 | static struct rc_keymap ir_mantis_map = { |
99 | .map = { | |
100 | .scan = mantis_ir_table, | |
101 | .size = ARRAY_SIZE(mantis_ir_table), | |
102 | .ir_type = IR_TYPE_UNKNOWN, | |
103 | .name = RC_MAP_MANTIS, | |
104 | } | |
a1497357 | 105 | }; |
a1497357 MA |
106 | |
107 | int mantis_input_init(struct mantis_pci *mantis) | |
108 | { | |
d8b4b582 | 109 | struct rc_dev *dev; |
a1497357 MA |
110 | int err; |
111 | ||
d8b4b582 DH |
112 | err = ir_register_map(&ir_mantis_map); |
113 | if (err) | |
114 | goto out; | |
a1497357 | 115 | |
d8b4b582 DH |
116 | dev = rc_allocate_device(); |
117 | if (!dev) { | |
118 | dprintk(MANTIS_ERROR, 1, "Remote device allocation failed"); | |
119 | err = -ENOMEM; | |
120 | goto out_map; | |
121 | } | |
a1497357 | 122 | |
d8b4b582 DH |
123 | sprintf(mantis->input_name, "Mantis %s IR receiver", mantis->hwconfig->model_name); |
124 | sprintf(mantis->input_phys, "pci-%s/ir0", pci_name(mantis->pdev)); | |
a1497357 | 125 | |
d8b4b582 DH |
126 | dev->input_name = mantis->input_name; |
127 | dev->input_phys = mantis->input_phys; | |
128 | dev->input_id.bustype = BUS_PCI; | |
129 | dev->input_id.vendor = mantis->vendor_id; | |
130 | dev->input_id.product = mantis->device_id; | |
131 | dev->input_id.version = 1; | |
132 | dev->driver_name = MODULE_NAME; | |
133 | dev->map_name = RC_MAP_MANTIS; | |
134 | dev->dev.parent = &mantis->pdev->dev; | |
a1497357 | 135 | |
d8b4b582 | 136 | err = rc_register_device(dev); |
a1497357 MA |
137 | if (err) { |
138 | dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); | |
d8b4b582 | 139 | goto out_dev; |
a1497357 MA |
140 | } |
141 | ||
d8b4b582 | 142 | mantis->rc = dev; |
a1497357 | 143 | return 0; |
d8b4b582 DH |
144 | |
145 | out_dev: | |
146 | rc_free_device(dev); | |
147 | out_map: | |
148 | ir_unregister_map(&ir_mantis_map); | |
149 | out: | |
150 | return err; | |
a1497357 MA |
151 | } |
152 | ||
153 | int mantis_exit(struct mantis_pci *mantis) | |
154 | { | |
d8b4b582 DH |
155 | rc_unregister_device(mantis->rc); |
156 | ir_unregister_map(&ir_mantis_map); | |
a1497357 MA |
157 | return 0; |
158 | } | |
d8b4b582 | 159 |