aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/mantis/mantis_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/pci/mantis/mantis_input.c')
-rw-r--r--drivers/media/pci/mantis/mantis_input.c110
1 files changed, 16 insertions, 94 deletions
diff --git a/drivers/media/pci/mantis/mantis_input.c b/drivers/media/pci/mantis/mantis_input.c
index 0e5252e5c0ef..7f7f1d4d7bb1 100644
--- a/drivers/media/pci/mantis/mantis_input.c
+++ b/drivers/media/pci/mantis/mantis_input.c
@@ -12,14 +12,8 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 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*/ 15*/
20 16
21#if 0 /* Currently unused */
22
23#include <media/rc-core.h> 17#include <media/rc-core.h>
24#include <linux/pci.h> 18#include <linux/pci.h>
25 19
@@ -30,100 +24,32 @@
30#include "dvb_net.h" 24#include "dvb_net.h"
31 25
32#include "mantis_common.h" 26#include "mantis_common.h"
33#include "mantis_reg.h" 27#include "mantis_input.h"
34#include "mantis_uart.h"
35 28
36#define MODULE_NAME "mantis_core" 29#define MODULE_NAME "mantis_core"
37#define RC_MAP_MANTIS "rc-mantis" 30
38 31void mantis_input_process(struct mantis_pci *mantis, int scancode)
39static struct rc_map_table mantis_ir_table[] = { 32{
40 { 0x29, KEY_POWER }, 33 if (mantis->rc)
41 { 0x28, KEY_FAVORITES }, 34 rc_keydown(mantis->rc, RC_TYPE_UNKNOWN, scancode, 0);
42 { 0x30, KEY_TEXT }, 35}
43 { 0x17, KEY_INFO }, /* Preview */
44 { 0x23, KEY_EPG },
45 { 0x3b, KEY_F22 }, /* Record List */
46 { 0x3c, KEY_1 },
47 { 0x3e, KEY_2 },
48 { 0x39, KEY_3 },
49 { 0x36, KEY_4 },
50 { 0x22, KEY_5 },
51 { 0x20, KEY_6 },
52 { 0x32, KEY_7 },
53 { 0x26, KEY_8 },
54 { 0x24, KEY_9 },
55 { 0x2a, KEY_0 },
56
57 { 0x33, KEY_CANCEL },
58 { 0x2c, KEY_BACK },
59 { 0x15, KEY_CLEAR },
60 { 0x3f, KEY_TAB },
61 { 0x10, KEY_ENTER },
62 { 0x14, KEY_UP },
63 { 0x0d, KEY_RIGHT },
64 { 0x0e, KEY_DOWN },
65 { 0x11, KEY_LEFT },
66
67 { 0x21, KEY_VOLUMEUP },
68 { 0x35, KEY_VOLUMEDOWN },
69 { 0x3d, KEY_CHANNELDOWN },
70 { 0x3a, KEY_CHANNELUP },
71 { 0x2e, KEY_RECORD },
72 { 0x2b, KEY_PLAY },
73 { 0x13, KEY_PAUSE },
74 { 0x25, KEY_STOP },
75
76 { 0x1f, KEY_REWIND },
77 { 0x2d, KEY_FASTFORWARD },
78 { 0x1e, KEY_PREVIOUS }, /* Replay |< */
79 { 0x1d, KEY_NEXT }, /* Skip >| */
80
81 { 0x0b, KEY_CAMERA }, /* Capture */
82 { 0x0f, KEY_LANGUAGE }, /* SAP */
83 { 0x18, KEY_MODE }, /* PIP */
84 { 0x12, KEY_ZOOM }, /* Full screen */
85 { 0x1c, KEY_SUBTITLE },
86 { 0x2f, KEY_MUTE },
87 { 0x16, KEY_F20 }, /* L/R */
88 { 0x38, KEY_F21 }, /* Hibernate */
89
90 { 0x37, KEY_SWITCHVIDEOMODE }, /* A/V */
91 { 0x31, KEY_AGAIN }, /* Recall */
92 { 0x1a, KEY_KPPLUS }, /* Zoom+ */
93 { 0x19, KEY_KPMINUS }, /* Zoom- */
94 { 0x27, KEY_RED },
95 { 0x0C, KEY_GREEN },
96 { 0x01, KEY_YELLOW },
97 { 0x00, KEY_BLUE },
98};
99
100static struct rc_map_list ir_mantis_map = {
101 .map = {
102 .scan = mantis_ir_table,
103 .size = ARRAY_SIZE(mantis_ir_table),
104 .rc_type = RC_TYPE_UNKNOWN,
105 .name = RC_MAP_MANTIS,
106 }
107};
108 36
109int mantis_input_init(struct mantis_pci *mantis) 37int mantis_input_init(struct mantis_pci *mantis)
110{ 38{
111 struct rc_dev *dev; 39 struct rc_dev *dev;
112 int err; 40 int err;
113 41
114 err = rc_map_register(&ir_mantis_map);
115 if (err)
116 goto out;
117
118 dev = rc_allocate_device(); 42 dev = rc_allocate_device();
119 if (!dev) { 43 if (!dev) {
120 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed"); 44 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
121 err = -ENOMEM; 45 err = -ENOMEM;
122 goto out_map; 46 goto out;
123 } 47 }
124 48
125 sprintf(mantis->input_name, "Mantis %s IR receiver", mantis->hwconfig->model_name); 49 snprintf(mantis->input_name, sizeof(mantis->input_name),
126 sprintf(mantis->input_phys, "pci-%s/ir0", pci_name(mantis->pdev)); 50 "Mantis %s IR receiver", mantis->hwconfig->model_name);
51 snprintf(mantis->input_phys, sizeof(mantis->input_phys),
52 "pci-%s/ir0", pci_name(mantis->pdev));
127 53
128 dev->input_name = mantis->input_name; 54 dev->input_name = mantis->input_name;
129 dev->input_phys = mantis->input_phys; 55 dev->input_phys = mantis->input_phys;
@@ -132,7 +58,7 @@ int mantis_input_init(struct mantis_pci *mantis)
132 dev->input_id.product = mantis->device_id; 58 dev->input_id.product = mantis->device_id;
133 dev->input_id.version = 1; 59 dev->input_id.version = 1;
134 dev->driver_name = MODULE_NAME; 60 dev->driver_name = MODULE_NAME;
135 dev->map_name = RC_MAP_MANTIS; 61 dev->map_name = mantis->rc_map_name ? : RC_MAP_EMPTY;
136 dev->dev.parent = &mantis->pdev->dev; 62 dev->dev.parent = &mantis->pdev->dev;
137 63
138 err = rc_register_device(dev); 64 err = rc_register_device(dev);
@@ -146,17 +72,13 @@ int mantis_input_init(struct mantis_pci *mantis)
146 72
147out_dev: 73out_dev:
148 rc_free_device(dev); 74 rc_free_device(dev);
149out_map:
150 rc_map_unregister(&ir_mantis_map);
151out: 75out:
152 return err; 76 return err;
153} 77}
78EXPORT_SYMBOL_GPL(mantis_input_init);
154 79
155int mantis_init_exit(struct mantis_pci *mantis) 80void mantis_input_exit(struct mantis_pci *mantis)
156{ 81{
157 rc_unregister_device(mantis->rc); 82 rc_unregister_device(mantis->rc);
158 rc_map_unregister(&ir_mantis_map);
159 return 0;
160} 83}
161 84EXPORT_SYMBOL_GPL(mantis_input_exit);
162#endif