]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/media/pci/mantis/mantis_input.c
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.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.
a1497357
MA
15*/
16
6bda9644 17#include <media/rc-core.h>
a1497357
MA
18#include <linux/pci.h>
19
20#include "dmxdev.h"
21#include "dvbdev.h"
22#include "dvb_demux.h"
23#include "dvb_frontend.h"
24#include "dvb_net.h"
25
26#include "mantis_common.h"
a96762da 27#include "mantis_input.h"
a1497357 28
727e625c 29#define MODULE_NAME "mantis_core"
a96762da
JK
30
31void mantis_input_process(struct mantis_pci *mantis, int scancode)
32{
33 if (mantis->rc)
34 rc_keydown(mantis->rc, RC_TYPE_UNKNOWN, scancode, 0);
35}
a1497357
MA
36
37int mantis_input_init(struct mantis_pci *mantis)
38{
d8b4b582 39 struct rc_dev *dev;
a1497357
MA
40 int err;
41
0f7499fd 42 dev = rc_allocate_device(RC_DRIVER_SCANCODE);
d8b4b582
DH
43 if (!dev) {
44 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
45 err = -ENOMEM;
a96762da 46 goto out;
d8b4b582 47 }
a1497357 48
a96762da 49 snprintf(mantis->input_name, sizeof(mantis->input_name),
9d605e63 50 "Mantis %s IR receiver", mantis->hwconfig->model_name);
a96762da 51 snprintf(mantis->input_phys, sizeof(mantis->input_phys),
9d605e63 52 "pci-%s/ir0", pci_name(mantis->pdev));
a1497357 53
d8b4b582
DH
54 dev->input_name = mantis->input_name;
55 dev->input_phys = mantis->input_phys;
56 dev->input_id.bustype = BUS_PCI;
57 dev->input_id.vendor = mantis->vendor_id;
58 dev->input_id.product = mantis->device_id;
59 dev->input_id.version = 1;
60 dev->driver_name = MODULE_NAME;
a96762da 61 dev->map_name = mantis->rc_map_name ? : RC_MAP_EMPTY;
d8b4b582 62 dev->dev.parent = &mantis->pdev->dev;
a1497357 63
d8b4b582 64 err = rc_register_device(dev);
a1497357
MA
65 if (err) {
66 dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
d8b4b582 67 goto out_dev;
a1497357
MA
68 }
69
d8b4b582 70 mantis->rc = dev;
a1497357 71 return 0;
d8b4b582
DH
72
73out_dev:
74 rc_free_device(dev);
d8b4b582
DH
75out:
76 return err;
a1497357 77}
a96762da 78EXPORT_SYMBOL_GPL(mantis_input_init);
a1497357 79
a96762da 80void mantis_input_exit(struct mantis_pci *mantis)
a1497357 81{
d8b4b582 82 rc_unregister_device(mantis->rc);
a1497357 83}
a96762da 84EXPORT_SYMBOL_GPL(mantis_input_exit);