2009-12-12 06:41:07 +07:00
|
|
|
/*
|
|
|
|
Mantis PCI bridge driver
|
|
|
|
|
|
|
|
Copyright (C) Manu Abraham (abraham.manu@gmail.com)
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2010-11-17 23:28:38 +07:00
|
|
|
#include <media/rc-core.h>
|
2009-12-12 06:41:07 +07:00
|
|
|
#include <linux/pci.h>
|
|
|
|
|
2017-12-29 01:03:51 +07:00
|
|
|
#include <media/dmxdev.h>
|
|
|
|
#include <media/dvbdev.h>
|
|
|
|
#include <media/dvb_demux.h>
|
|
|
|
#include <media/dvb_frontend.h>
|
|
|
|
#include <media/dvb_net.h>
|
2009-12-12 06:41:07 +07:00
|
|
|
|
|
|
|
#include "mantis_common.h"
|
2015-06-07 02:58:13 +07:00
|
|
|
#include "mantis_input.h"
|
2009-12-12 06:41:07 +07:00
|
|
|
|
2010-03-13 07:18:14 +07:00
|
|
|
#define MODULE_NAME "mantis_core"
|
2015-06-07 02:58:13 +07:00
|
|
|
|
|
|
|
void mantis_input_process(struct mantis_pci *mantis, int scancode)
|
|
|
|
{
|
|
|
|
if (mantis->rc)
|
2017-08-08 03:20:58 +07:00
|
|
|
rc_keydown(mantis->rc, RC_PROTO_UNKNOWN, scancode, 0);
|
2015-06-07 02:58:13 +07:00
|
|
|
}
|
2009-12-12 06:41:07 +07:00
|
|
|
|
|
|
|
int mantis_input_init(struct mantis_pci *mantis)
|
|
|
|
{
|
2010-10-30 02:08:23 +07:00
|
|
|
struct rc_dev *dev;
|
2009-12-12 06:41:07 +07:00
|
|
|
int err;
|
|
|
|
|
2016-12-16 15:50:58 +07:00
|
|
|
dev = rc_allocate_device(RC_DRIVER_SCANCODE);
|
2010-10-30 02:08:23 +07:00
|
|
|
if (!dev) {
|
|
|
|
dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
|
|
|
|
err = -ENOMEM;
|
2015-06-07 02:58:13 +07:00
|
|
|
goto out;
|
2010-10-30 02:08:23 +07:00
|
|
|
}
|
2009-12-12 06:41:07 +07:00
|
|
|
|
2017-07-01 23:13:19 +07:00
|
|
|
snprintf(mantis->device_name, sizeof(mantis->device_name),
|
2015-06-10 22:06:34 +07:00
|
|
|
"Mantis %s IR receiver", mantis->hwconfig->model_name);
|
2015-06-07 02:58:13 +07:00
|
|
|
snprintf(mantis->input_phys, sizeof(mantis->input_phys),
|
2015-06-10 22:06:34 +07:00
|
|
|
"pci-%s/ir0", pci_name(mantis->pdev));
|
2009-12-12 06:41:07 +07:00
|
|
|
|
2017-07-01 23:13:19 +07:00
|
|
|
dev->device_name = mantis->device_name;
|
2010-10-30 02:08:23 +07:00
|
|
|
dev->input_phys = mantis->input_phys;
|
|
|
|
dev->input_id.bustype = BUS_PCI;
|
|
|
|
dev->input_id.vendor = mantis->vendor_id;
|
|
|
|
dev->input_id.product = mantis->device_id;
|
|
|
|
dev->input_id.version = 1;
|
|
|
|
dev->driver_name = MODULE_NAME;
|
2015-06-07 02:58:13 +07:00
|
|
|
dev->map_name = mantis->rc_map_name ? : RC_MAP_EMPTY;
|
2010-10-30 02:08:23 +07:00
|
|
|
dev->dev.parent = &mantis->pdev->dev;
|
2009-12-12 06:41:07 +07:00
|
|
|
|
2010-10-30 02:08:23 +07:00
|
|
|
err = rc_register_device(dev);
|
2009-12-12 06:41:07 +07:00
|
|
|
if (err) {
|
|
|
|
dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
|
2010-10-30 02:08:23 +07:00
|
|
|
goto out_dev;
|
2009-12-12 06:41:07 +07:00
|
|
|
}
|
|
|
|
|
2010-10-30 02:08:23 +07:00
|
|
|
mantis->rc = dev;
|
2009-12-12 06:41:07 +07:00
|
|
|
return 0;
|
2010-10-30 02:08:23 +07:00
|
|
|
|
|
|
|
out_dev:
|
|
|
|
rc_free_device(dev);
|
|
|
|
out:
|
|
|
|
return err;
|
2009-12-12 06:41:07 +07:00
|
|
|
}
|
2015-06-07 02:58:13 +07:00
|
|
|
EXPORT_SYMBOL_GPL(mantis_input_init);
|
2009-12-12 06:41:07 +07:00
|
|
|
|
2015-06-07 02:58:13 +07:00
|
|
|
void mantis_input_exit(struct mantis_pci *mantis)
|
2009-12-12 06:41:07 +07:00
|
|
|
{
|
2010-10-30 02:08:23 +07:00
|
|
|
rc_unregister_device(mantis->rc);
|
2009-12-12 06:41:07 +07:00
|
|
|
}
|
2015-06-07 02:58:13 +07:00
|
|
|
EXPORT_SYMBOL_GPL(mantis_input_exit);
|