2009-12-11 20:41:07 -03: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 13:28:38 -03:00
# include <media/rc-core.h>
2009-12-11 20:41:07 -03:00
# include <linux/pci.h>
# include "dmxdev.h"
# include "dvbdev.h"
# include "dvb_demux.h"
# include "dvb_frontend.h"
# include "dvb_net.h"
# include "mantis_common.h"
2015-06-06 16:58:13 -03:00
# include "mantis_input.h"
2009-12-11 20:41:07 -03:00
2010-03-12 21:18:14 -03:00
# define MODULE_NAME "mantis_core"
2015-06-06 16:58:13 -03:00
void mantis_input_process ( struct mantis_pci * mantis , int scancode )
{
if ( mantis - > rc )
rc_keydown ( mantis - > rc , RC_TYPE_UNKNOWN , scancode , 0 ) ;
}
2009-12-11 20:41:07 -03:00
int mantis_input_init ( struct mantis_pci * mantis )
{
2010-10-29 16:08:23 -03:00
struct rc_dev * dev ;
2009-12-11 20:41:07 -03:00
int err ;
2016-12-16 06:50:58 -02:00
dev = rc_allocate_device ( RC_DRIVER_SCANCODE ) ;
2010-10-29 16:08:23 -03:00
if ( ! dev ) {
dprintk ( MANTIS_ERROR , 1 , " Remote device allocation failed " ) ;
err = - ENOMEM ;
2015-06-06 16:58:13 -03:00
goto out ;
2010-10-29 16:08:23 -03:00
}
2009-12-11 20:41:07 -03:00
2015-06-06 16:58:13 -03:00
snprintf ( mantis - > input_name , sizeof ( mantis - > input_name ) ,
2015-06-10 12:06:34 -03:00
" Mantis %s IR receiver " , mantis - > hwconfig - > model_name ) ;
2015-06-06 16:58:13 -03:00
snprintf ( mantis - > input_phys , sizeof ( mantis - > input_phys ) ,
2015-06-10 12:06:34 -03:00
" pci-%s/ir0 " , pci_name ( mantis - > pdev ) ) ;
2009-12-11 20:41:07 -03:00
2010-10-29 16:08:23 -03:00
dev - > input_name = mantis - > input_name ;
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-06 16:58:13 -03:00
dev - > map_name = mantis - > rc_map_name ? : RC_MAP_EMPTY ;
2010-10-29 16:08:23 -03:00
dev - > dev . parent = & mantis - > pdev - > dev ;
2009-12-11 20:41:07 -03:00
2010-10-29 16:08:23 -03:00
err = rc_register_device ( dev ) ;
2009-12-11 20:41:07 -03:00
if ( err ) {
dprintk ( MANTIS_ERROR , 1 , " IR device registration failed, ret = %d " , err ) ;
2010-10-29 16:08:23 -03:00
goto out_dev ;
2009-12-11 20:41:07 -03:00
}
2010-10-29 16:08:23 -03:00
mantis - > rc = dev ;
2009-12-11 20:41:07 -03:00
return 0 ;
2010-10-29 16:08:23 -03:00
out_dev :
rc_free_device ( dev ) ;
out :
return err ;
2009-12-11 20:41:07 -03:00
}
2015-06-06 16:58:13 -03:00
EXPORT_SYMBOL_GPL ( mantis_input_init ) ;
2009-12-11 20:41:07 -03:00
2015-06-06 16:58:13 -03:00
void mantis_input_exit ( struct mantis_pci * mantis )
2009-12-11 20:41:07 -03:00
{
2010-10-29 16:08:23 -03:00
rc_unregister_device ( mantis - > rc ) ;
2009-12-11 20:41:07 -03:00
}
2015-06-06 16:58:13 -03:00
EXPORT_SYMBOL_GPL ( mantis_input_exit ) ;