PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / media / pci / mantis / mantis_input.c
blob0e5252e5c0ef86e1a0ce4af1d25ee9d52dc7aa42
1 /*
2 Mantis PCI bridge driver
4 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
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.
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.
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.
21 #if 0 /* Currently unused */
23 #include <media/rc-core.h>
24 #include <linux/pci.h>
26 #include "dmxdev.h"
27 #include "dvbdev.h"
28 #include "dvb_demux.h"
29 #include "dvb_frontend.h"
30 #include "dvb_net.h"
32 #include "mantis_common.h"
33 #include "mantis_reg.h"
34 #include "mantis_uart.h"
36 #define MODULE_NAME "mantis_core"
37 #define RC_MAP_MANTIS "rc-mantis"
39 static struct rc_map_table mantis_ir_table[] = {
40 { 0x29, KEY_POWER },
41 { 0x28, KEY_FAVORITES },
42 { 0x30, KEY_TEXT },
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 },
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 },
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 },
76 { 0x1f, KEY_REWIND },
77 { 0x2d, KEY_FASTFORWARD },
78 { 0x1e, KEY_PREVIOUS }, /* Replay |< */
79 { 0x1d, KEY_NEXT }, /* Skip >| */
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 */
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 },
100 static 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,
109 int mantis_input_init(struct mantis_pci *mantis)
111 struct rc_dev *dev;
112 int err;
114 err = rc_map_register(&ir_mantis_map);
115 if (err)
116 goto out;
118 dev = rc_allocate_device();
119 if (!dev) {
120 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
121 err = -ENOMEM;
122 goto out_map;
125 sprintf(mantis->input_name, "Mantis %s IR receiver", mantis->hwconfig->model_name);
126 sprintf(mantis->input_phys, "pci-%s/ir0", pci_name(mantis->pdev));
128 dev->input_name = mantis->input_name;
129 dev->input_phys = mantis->input_phys;
130 dev->input_id.bustype = BUS_PCI;
131 dev->input_id.vendor = mantis->vendor_id;
132 dev->input_id.product = mantis->device_id;
133 dev->input_id.version = 1;
134 dev->driver_name = MODULE_NAME;
135 dev->map_name = RC_MAP_MANTIS;
136 dev->dev.parent = &mantis->pdev->dev;
138 err = rc_register_device(dev);
139 if (err) {
140 dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
141 goto out_dev;
144 mantis->rc = dev;
145 return 0;
147 out_dev:
148 rc_free_device(dev);
149 out_map:
150 rc_map_unregister(&ir_mantis_map);
151 out:
152 return err;
155 int mantis_init_exit(struct mantis_pci *mantis)
157 rc_unregister_device(mantis->rc);
158 rc_map_unregister(&ir_mantis_map);
159 return 0;
162 #endif