Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / media / pci / mantis / mantis_input.c
CommitLineData
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
6860f9ca
MCC
21#if 0 /* Currently unused */
22
6bda9644 23#include <media/rc-core.h>
a1497357
MA
24#include <linux/pci.h>
25
26#include "dmxdev.h"
27#include "dvbdev.h"
28#include "dvb_demux.h"
29#include "dvb_frontend.h"
30#include "dvb_net.h"
31
32#include "mantis_common.h"
33#include "mantis_reg.h"
34#include "mantis_uart.h"
35
727e625c 36#define MODULE_NAME "mantis_core"
d8b4b582 37#define RC_MAP_MANTIS "rc-mantis"
727e625c 38
2f4f58d6 39static struct rc_map_table mantis_ir_table[] = {
a1497357
MA
40 { 0x29, KEY_POWER },
41 { 0x28, KEY_FAVORITES },
42 { 0x30, KEY_TEXT },
f5ae4f6f 43 { 0x17, KEY_INFO }, /* Preview */
a1497357 44 { 0x23, KEY_EPG },
f5ae4f6f 45 { 0x3b, KEY_F22 }, /* Record List */
a1497357
MA
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 },
f5ae4f6f
MA
78 { 0x1e, KEY_PREVIOUS }, /* Replay |< */
79 { 0x1d, KEY_NEXT }, /* Skip >| */
a1497357 80
f5ae4f6f
MA
81 { 0x0b, KEY_CAMERA }, /* Capture */
82 { 0x0f, KEY_LANGUAGE }, /* SAP */
83 { 0x18, KEY_MODE }, /* PIP */
84 { 0x12, KEY_ZOOM }, /* Full screen */
a1497357
MA
85 { 0x1c, KEY_SUBTITLE },
86 { 0x2f, KEY_MUTE },
f5ae4f6f
MA
87 { 0x16, KEY_F20 }, /* L/R */
88 { 0x38, KEY_F21 }, /* Hibernate */
a1497357 89
f5ae4f6f
MA
90 { 0x37, KEY_SWITCHVIDEOMODE }, /* A/V */
91 { 0x31, KEY_AGAIN }, /* Recall */
92 { 0x1a, KEY_KPPLUS }, /* Zoom+ */
93 { 0x19, KEY_KPMINUS }, /* Zoom- */
a1497357
MA
94 { 0x27, KEY_RED },
95 { 0x0C, KEY_GREEN },
96 { 0x01, KEY_YELLOW },
97 { 0x00, KEY_BLUE },
98};
99
d100e659 100static struct rc_map_list ir_mantis_map = {
d8b4b582
DH
101 .map = {
102 .scan = mantis_ir_table,
103 .size = ARRAY_SIZE(mantis_ir_table),
52b66144 104 .rc_type = RC_TYPE_UNKNOWN,
d8b4b582
DH
105 .name = RC_MAP_MANTIS,
106 }
a1497357 107};
a1497357
MA
108
109int mantis_input_init(struct mantis_pci *mantis)
110{
d8b4b582 111 struct rc_dev *dev;
a1497357
MA
112 int err;
113
d100e659 114 err = rc_map_register(&ir_mantis_map);
d8b4b582
DH
115 if (err)
116 goto out;
a1497357 117
d8b4b582
DH
118 dev = rc_allocate_device();
119 if (!dev) {
120 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
121 err = -ENOMEM;
122 goto out_map;
123 }
a1497357 124
d8b4b582
DH
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));
a1497357 127
d8b4b582
DH
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;
a1497357 137
d8b4b582 138 err = rc_register_device(dev);
a1497357
MA
139 if (err) {
140 dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
d8b4b582 141 goto out_dev;
a1497357
MA
142 }
143
d8b4b582 144 mantis->rc = dev;
a1497357 145 return 0;
d8b4b582
DH
146
147out_dev:
148 rc_free_device(dev);
149out_map:
d100e659 150 rc_map_unregister(&ir_mantis_map);
d8b4b582
DH
151out:
152 return err;
a1497357
MA
153}
154
6860f9ca 155int mantis_init_exit(struct mantis_pci *mantis)
a1497357 156{
d8b4b582 157 rc_unregister_device(mantis->rc);
d100e659 158 rc_map_unregister(&ir_mantis_map);
a1497357
MA
159 return 0;
160}
d8b4b582 161
6860f9ca 162#endif