/*
*
* handle saa7134 IR remotes via linux kernel input layer.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include "saa7134-reg.h"
#include "saa7134.h"
static unsigned int disable_ir = 0;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
static unsigned int ir_debug = 0;
module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
#define dprintk(fmt, arg...) if (ir_debug) \
printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg)
#define i2cdprintk(fmt, arg...) if (ir_debug) \
printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg)
/* ---------------------------------------------------------------------- */
static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
[ 15 ] = KEY_KP0,
[ 3 ] = KEY_KP1,
[ 4 ] = KEY_KP2,
[ 5 ] = KEY_KP3,
[ 7 ] = KEY_KP4,
[ 8 ] = KEY_KP5,
[ 9 ] = KEY_KP6,
[ 11 ] = KEY_KP7,
[ 12 ] = KEY_KP8,
[ 13 ] = KEY_KP9,
[ 14 ] = KEY_TUNER, // Air/Cable
[ 17 ] = KEY_VIDEO, // Video
[ 21 ] = KEY_AUDIO, // Audio
[ 0 ] = KEY_POWER, // Pover
[ 2 ] = KEY_ZOOM, // Fullscreen
[ 27 ] = KEY_MUTE, // Mute
[ 20 ] = KEY_VOLUMEUP,
[ 23 ] = KEY_VOLUMEDOWN,
[ 18 ] = KEY_CHANNELUP, // Channel +
[ 19 ] = KEY_CHANNELDOWN, // Channel -
[ 6 ] = KEY_AGAIN, // Recal
[ 16 ] = KEY_KPENTER, // Enter
[ 26 ] = KEY_F22, // Stereo
[ 24 ] = KEY_EDIT, // AV Source
};
static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = {
[ 0 ] = KEY_KP0,
[ 1 ] = KEY_KP1,
[ 2 ] = KEY_KP2,
[ 3 ] = KEY_KP3,
[ 4 ] = KEY_KP4,
[ 5 ] = KEY_KP5,
[ 6 ] = KEY_KP6,
[ 7 ] = KEY_KP7,
[ 8 ] = KEY_KP8,
[ 9 ] = KEY_KP9,
[ 0x0a ] = KEY_POWER,
[ 0x0b ] = KEY_PROG1, // app
[ 0x0c ] = KEY_ZOOM, // zoom/fullscreen
[ 0x0d ] = KEY_CHANNELUP, // channel
[ 0x0e ] = KEY_CHANNELDOWN, // channel-
[ 0x0f ] = KEY_VOLUMEUP,
[ 0x10 ] = KEY_VOLUMEDOWN,
[ 0x11 ] = KEY_TUNER, // AV
[ 0x12 ] = KEY_NUMLOCK, // -/--
[ 0x13 ] = KEY_AUDIO, // audio
[ 0x14 ] = KEY_MUTE,
[ 0x15 ] = KEY_UP,
[ 0x16 ] = KEY_DOWN,
[ 0x17 ] = KEY_LEFT,
[ 0x18 ] = KEY_RIGHT,
[ 0x19 ] = BTN_LEFT,
[ 0x1a ] = BTN_RIGHT,
[ 0x1b ] = KEY_WWW, // text
[ 0x1c ] = KEY_REWIND,
[ 0x1d ] = KEY_FORWARD,
[ 0x1e ] = KEY_RECORD,
[ 0x1f ] = KEY_PLAY,
[ 0x20 ] = KEY_PREVIOUSSONG,
[ 0x21 ] = KEY_NEXTSONG,
[ 0x22 ] = KEY_PAUSE,
[ 0x23 ] = KEY_STOP,
};
/* Alfons Geser <a.geser@cox.net>
* updates from Job D. R. Borges <jobdrb@ig.com.br> */
static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = {
[ 18 ] = KEY_POWER,
[ 1 ] = KEY_TV, // DVR
[ 21 ] = KEY_DVD, // DVD
[ 23 ] = KEY_AUDIO, // music
// DVR mode / DVD mode / music mode
[ 27 ] = KEY_MUTE, // mute
[ 2 ] = KEY_LANGUAGE, // MTS/SAP / audio / autoseek
[ 30 ] = KEY_SUBTITLE, // closed captioning / subtitle / seek
[ 22 ] = KEY_ZOOM, // full screen
[ 28 ] = KEY_VIDEO, // video source / eject / delall
[ 29 ] = KEY_RESTART, // playback / angle / del
[ 47 ] = KEY_SEARCH, // scan / menu / playlist
[ 48 ] = KEY_CHANNEL