···11+/*22+ Mantis PCI bridge driver33+44+ Copyright (C) Manu Abraham (abraham.manu@gmail.com)55+66+ This program is free software; you can redistribute it and/or modify77+ it under the terms of the GNU General Public License as published by88+ the Free Software Foundation; either version 2 of the License, or99+ (at your option) any later version.1010+1111+ This program is distributed in the hope that it will be useful,1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ GNU General Public License for more details.1515+1616+ You should have received a copy of the GNU General Public License1717+ along with this program; if not, write to the Free Software1818+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1919+*/2020+2121+#include <linux/input.h>2222+#include <media/ir-common.h>2323+#include <linux/pci.h>2424+2525+#include "dmxdev.h"2626+#include "dvbdev.h"2727+#include "dvb_demux.h"2828+#include "dvb_frontend.h"2929+#include "dvb_net.h"3030+3131+#include "mantis_common.h"3232+#include "mantis_reg.h"3333+#include "mantis_uart.h"3434+3535+static struct ir_scancode mantis_ir_table[] = {3636+ { 0x29, KEY_POWER },3737+ { 0x28, KEY_FAVORITES },3838+ { 0x30, KEY_TEXT },3939+ { 0x17, KEY_INFO }, // Preview4040+ { 0x23, KEY_EPG },4141+ { 0x3b, KEY_F22 },// Record List4242+ { 0x3c, KEY_1 },4343+ { 0x3e, KEY_2 },4444+ { 0x39, KEY_3 },4545+ { 0x36, KEY_4 },4646+ { 0x22, KEY_5 },4747+ { 0x20, KEY_6 },4848+ { 0x32, KEY_7 },4949+ { 0x26, KEY_8 },5050+ { 0x24, KEY_9 },5151+ { 0x2a, KEY_0 },5252+5353+ { 0x33, KEY_CANCEL },5454+ { 0x2c, KEY_BACK },5555+ { 0x15, KEY_CLEAR },5656+ { 0x3f, KEY_TAB },5757+ { 0x10, KEY_ENTER },5858+ { 0x14, KEY_UP },5959+ { 0x0d, KEY_RIGHT },6060+ { 0x0e, KEY_DOWN },6161+ { 0x11, KEY_LEFT },6262+6363+ { 0x21, KEY_VOLUMEUP },6464+ { 0x35, KEY_VOLUMEDOWN },6565+ { 0x3d, KEY_CHANNELDOWN },6666+ { 0x3a, KEY_CHANNELUP },6767+ { 0x2e, KEY_RECORD },6868+ { 0x2b, KEY_PLAY },6969+ { 0x13, KEY_PAUSE },7070+ { 0x25, KEY_STOP },7171+7272+ { 0x1f, KEY_REWIND },7373+ { 0x2d, KEY_FASTFORWARD },7474+ { 0x1e, KEY_PREVIOUS }, // Replay |<7575+ { 0x1d, KEY_NEXT }, // Skip >|7676+7777+ { 0x0b, KEY_CAMERA }, // Capture7878+ { 0x0f, KEY_LANGUAGE }, // SAP7979+ { 0x18, KEY_MODE }, // PIP8080+ { 0x12, KEY_ZOOM }, // Full screen,8181+ { 0x1c, KEY_SUBTITLE },8282+ { 0x2f, KEY_MUTE },8383+ { 0x16, KEY_F20 }, // L/R,8484+ { 0x38, KEY_F21 }, // Hibernate,8585+8686+ { 0x37, KEY_SWITCHVIDEOMODE }, // A/V8787+ { 0x31, KEY_AGAIN }, // Recall,8888+ { 0x1a, KEY_KPPLUS }, // Zoom+,8989+ { 0x19, KEY_KPMINUS }, // Zoom-,9090+ { 0x27, KEY_RED },9191+ { 0x0C, KEY_GREEN },9292+ { 0x01, KEY_YELLOW },9393+ { 0x00, KEY_BLUE },9494+};9595+9696+struct ir_scancode_table ir_mantis = {9797+ .scan = mantis_ir_table,9898+ .size = ARRAY_SIZE(mantis_ir_table),9999+};100100+EXPORT_SYMBOL_GPL(ir_mantis);101101+102102+int mantis_input_init(struct mantis_pci *mantis)103103+{104104+ struct input_dev *rc;105105+ struct ir_input_state rc_state;106106+ char name[80], dev[80];107107+ int err;108108+109109+ rc = input_allocate_device();110110+ if (!rc) {111111+ dprintk(MANTIS_ERROR, 1, "Input device allocate failed");112112+ return -ENOMEM;113113+ }114114+115115+ sprintf(name, "Mantis %s IR receiver", mantis->hwconfig->model_name);116116+ sprintf(dev, "pci-%s/ir0", pci_name(mantis->pdev));117117+118118+ rc->name = name;119119+ rc->phys = dev;120120+121121+ ir_input_init(rc, &rc_state, IR_TYPE_OTHER, &ir_mantis);122122+123123+ rc->id.bustype = BUS_PCI;124124+ rc->id.vendor = mantis->vendor_id;125125+ rc->id.product = mantis->device_id;126126+ rc->id.version = 1;127127+ rc->dev = mantis->pdev->dev;128128+129129+ err = input_register_device(rc);130130+ if (err) {131131+ dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);132132+ return -ENODEV;133133+ }134134+135135+ mantis->rc = rc;136136+137137+ return 0;138138+}139139+140140+int mantis_exit(struct mantis_pci *mantis)141141+{142142+ struct input_dev *rc = mantis->rc;143143+144144+ input_unregister_device(rc);145145+146146+ return 0;147147+}
+43-12
drivers/media/dvb/mantis/mantis_uart.c
···11+/*22+ Mantis PCI bridge driver33+44+ Copyright (C) Manu Abraham (abraham.manu@gmail.com)55+66+ This program is free software; you can redistribute it and/or modify77+ it under the terms of the GNU General Public License as published by88+ the Free Software Foundation; either version 2 of the License, or99+ (at your option) any later version.1010+1111+ This program is distributed in the hope that it will be useful,1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ GNU General Public License for more details.1515+1616+ You should have received a copy of the GNU General Public License1717+ along with this program; if not, write to the Free Software1818+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1919+*/2020+121#include <linux/kernel.h>222#include <linux/spinlock.h>32344-#include <asm/irq.h>524#include <linux/signal.h>625#include <linux/sched.h>726#include <linux/interrupt.h>···3819struct mantis_uart_params {3920 enum mantis_baud baud_rate;4021 enum mantis_parity parity;2222+};2323+2424+static struct {2525+ char string[7];2626+} rates[5] = {2727+ { "9600" },2828+ { "19200" },2929+ { "38400" },3030+ { "57600" },3131+ { "115200" }3232+};3333+3434+static struct {3535+ char string[5];3636+} parity[3] = {3737+ { "NONE" },3838+ { "ODD" },3939+ { "EVEN" }4140};42414342#define UART_MAX_BUF 16···9760 u8 buf[16];9861 int i;9962100100- dprintk(MANTIS_DEBUG, 1, "UART read");10163 mantis_uart_read(mantis, buf);10264103103- dprintk(MANTIS_DEBUG, 1, "UART: ");10465 for (i = 0; i < (config->bytes + 1); i++)105105- dprintk(MANTIS_DEBUG, 0, "<%02x> ", buf[i]);6666+ dprintk(MANTIS_INFO, 1, "UART BUF:%d <%02x> ", i, buf[i]);1066710768 dprintk(MANTIS_DEBUG, 0, "\n");10869}···10873static int mantis_uart_setup(struct mantis_pci *mantis,10974 struct mantis_uart_params *params)11075{111111- char* rates[] = { "B_9600", "B_19200", "B_38400", "B_57600", "B_115200" };112112- char* parity[] = { "NONE", "ODD", "EVEN" };113113-11476 u32 reg;115115-116116- dprintk(MANTIS_DEBUG, 1, "Set Parity <%s> Baud Rate <%s>",117117- parity[params->parity],118118- rates[params->baud_rate]);1197712078 mmwrite((mmread(MANTIS_UART_CTL) | (params->parity & 0x3)), MANTIS_UART_CTL);12179···144116 struct mantis_hwconfig *config = mantis->hwconfig;145117 struct mantis_uart_params params;146118147147- dprintk(MANTIS_DEBUG, 1, "Initializing UART ..");148119 /* default parity: */149120 params.baud_rate = config->baud_rate;150121 params.parity = config->parity;122122+ dprintk(MANTIS_INFO, 1, "Initializing UART @ %sbps parity:%s",123123+ rates[params.baud_rate].string,124124+ parity[params.parity].string);151125152126 init_waitqueue_head(&mantis->uart_wq);153127 spin_lock_init(&mantis->uart_lock);···172142 mmwrite(mmread(MANTIS_UART_CTL) | MANTIS_UART_RXINT, MANTIS_UART_CTL);173143174144 schedule_work(&mantis->uart_work);145145+ dprintk(MANTIS_DEBUG, 1, "UART succesfully initialized");175146176147 return 0;177148}