diff options
Diffstat (limited to 'drivers')
90 files changed, 1811 insertions, 7835 deletions
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c index 43415f69839..bea75f2cb21 100644 --- a/drivers/block/ps2esdi.c +++ b/drivers/block/ps2esdi.c @@ -43,6 +43,7 @@ #include <linux/init.h> #include <linux/ioport.h> #include <linux/module.h> +#include <linux/hdreg.h> #include <asm/system.h> #include <asm/io.h> diff --git a/drivers/char/esp.c b/drivers/char/esp.c index dd5dc8fa490..3f3ac039f4d 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -2492,6 +2492,7 @@ static int __init espserial_init(void) } memset((void *)info, 0, sizeof(struct esp_struct)); + spin_lock_init(&info->lock); /* rx_trigger, tx_trigger are needed by autoconfig */ info->config.rx_trigger = rx_trigger; info->config.tx_trigger = tx_trigger; @@ -2528,7 +2529,6 @@ static int __init espserial_init(void) init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->delta_msr_wait); init_waitqueue_head(&info->break_wait); - spin_lock_init(&info->lock); ports = info; printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", info->line, info->port, info->irq); diff --git a/drivers/char/rio/brates.h b/drivers/char/rio/brates.h deleted file mode 100644 index dd686d58fd6..00000000000 --- a/drivers/char/rio/brates.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* BRATES.H ******* - ******* ******* - **************************************************************************** - - Author : Jeremy Rolls - Date : 1 Nov 1990 - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _brates_h -#ifndef lint -/* static char * _brates_h_sccs = "@(#)brates.h 1.4"; */ -#endif -#define _brates_h 1 -/* List of baud rate defines. Most are borrowed from /usr/include/sys/termio.h -*/ -#ifndef INKERNEL - -#define B0 0x00 -#define B50 0x01 -#define B75 0x02 -#define B110 0x03 -#define B134 0x04 -#define B150 0x05 -#define B200 0x06 -#define B300 0x07 -#define B600 0x08 -#define B1200 0x09 -#define B1800 0x0a -#define B2400 0x0b -#define B4800 0x0c -#define B9600 0x0d -#define B19200 0x0e -#define B38400 0x0f - -#endif - -/* -** The following baudrates may or may not be defined -** on various UNIX systems. -** If they are not then we define them. -** If they are then we do not define them ;-) -** -** This is appalling that we use same definitions as UNIX -** for our own download code as there is no garuntee that -** B57600 will be defined as 0x11 by a UNIX system.... -** Arghhhhh!!!!!!!!!!!!!! -*/ -#if !defined(B56000) -#define B56000 0x10 -#endif - -#if !defined(B57600) -#define B57600 0x11 -#endif - -#if !defined(B64000) -#define B64000 0x12 -#endif - -#if !defined(B115200) -#define B115200 0x13 -#endif - - -#if !defined(B2000) -#define B2000 0x14 -#endif - - -#define MAX_RATE B2000 - -struct baud_rate { /* Tag for baud rates */ - /* short host_rate, *//* As passed by the driver */ - short divisor, /* The divisor */ - prescaler; /* The pre-scaler */ -}; - -#endif diff --git a/drivers/char/rio/chan.h b/drivers/char/rio/chan.h deleted file mode 100644 index af14311f9b6..00000000000 --- a/drivers/char/rio/chan.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -#ifndef _chan_h -#define _chan_h - -#ifndef lint -#ifdef SCCS -static char *_rio_chan_h_sccs = "@(#)chan.h 1.1"; -#endif -#endif - -#define Link0 0 -#define Link1 1 -#define Link2 2 -#define Link3 3 - -#endif diff --git a/drivers/char/rio/cmd.h b/drivers/char/rio/cmd.h deleted file mode 100644 index 797b62400c9..00000000000 --- a/drivers/char/rio/cmd.h +++ /dev/null @@ -1,83 +0,0 @@ - - -/**************************************************************************** - ******* ******* - ******* C O M M A N D P A C K E T H E A D E R S - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - - -#ifndef _cmd_h -#define _cmd_h - -#ifndef lint -#ifdef SCCS -static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1"; -#endif -#endif - - -#define PRE_EMPTIVE_CMD 0x80 -#define INLINE_CMD ~PRE_EMPTIVE_CMD - -#define CMD_IGNORE_PKT ( (ushort) 0) -#define CMD_STATUS_REQ ( (ushort) 1) -#define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */ -#define CMD_CONF_PORT ( (ushort) 3) -#define CMD_CONF_UNIT ( (ushort) 4) -#define CMD_ROUTE_MAP_REQ ( (ushort) 5) -#define CMD_FLUSH_TX ( (ushort) 6) -#define CMD_FLUSH_RX ( (ushort) 7) -#define CMD_PARTION_PORT ( (ushort) 8) -#define CMD_RESET_PORT ( (ushort) 0x0a) -#define CMD_BOOT_UNIT ( (ushort) 0x0b) -#define CMD_FOUND_UNIT ( (ushort) 0x0c) -#define CMD_ATTACHED_RTA_2 ( (ushort) 0x0d) -#define CMD_PROVIDE_BOOT ( (ushort) 0x0e) -#define CMD_CIRRUS ( (ushort) 0x0f) - -#define FORM_STATUS_PKT ( (ushort) 1 ) -#define FORM_POLL_PKT ( (ushort) 2 ) -#define FORM_LINK_STATUS_PKT ( (ushort) 3 ) - - -#define CMD_DATA_PORT ( (ushort) 1 ) -#define CMD_DATA ( (ushort) 2 ) - -#define CMD_TX_PART ( (ushort) 2 ) -#define CMD_RX_PART ( (ushort) 3 ) -#define CMD_RX_LIMIT ( (ushort) 4 ) - -#endif - -/*********** end of file ***********/ diff --git a/drivers/char/rio/data.h b/drivers/char/rio/data.h deleted file mode 100644 index dabc2d1fa40..00000000000 --- a/drivers/char/rio/data.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Module : data.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:09 -** Retrieved : 11/6/98 11:34:21 -** -** ident @(#)data.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_datadex__ -#define __rio_datadex__ - -#ifndef lint -static char *_data_h_sccs_ = "@(#)data.h 1.2"; -#endif - -#endif diff --git a/drivers/char/rio/debug.h b/drivers/char/rio/debug.h deleted file mode 100644 index 6ae95c00db4..00000000000 --- a/drivers/char/rio/debug.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** File: debug.h -** -** Author: David Dix -** -** Created: 12th March 1993 -** -** Last modified: 93/04/27 -** - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _debug_h_ -#define _debug_h_ - - -#if defined(DCIRRUS) -#define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn)) -#else -#define DBPACKET(pkt, opt, str, c) -#endif /* DCIRRUS */ - - -#endif /* _debug_h_ */ diff --git a/drivers/char/rio/eisa.h b/drivers/char/rio/eisa.h deleted file mode 100644 index c2abaf0eab0..00000000000 --- a/drivers/char/rio/eisa.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Module : eisa.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:10 -** Retrieved : 11/6/98 11:34:21 -** -** ident @(#)eisa.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_eisa_h__ -#define __rio_eisa_h__ - -#ifdef SCCS_LABELS -#ifndef lint -static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2"; -#endif -#endif - -/* -** things to do with the EISA bus -*/ - -#define RIO_EISA_STRING_ADDRESS 0xfffd9 /* where EISA is stored */ - -#define RIO_MAX_EISA_SLOTS 16 /* how many EISA slots? */ - -#define RIO_EISA_IDENT 0x984D /* Specialix */ -#define RIO_EISA_PRODUCT_CODE 0x14 /* Code 14 */ -#define RIO_EISA_ENABLE_BIT 0x01 /* To enable card */ - -#define EISA_MEMORY_BASE_LO 0xC00 /* A16-A23 */ -#define EISA_MEMORY_BASE_HI 0xC01 /* A24-A31 */ -#define EISA_INTERRUPT_VEC 0xC02 /* see below */ -#define EISA_CONTROL_PORT 0xC02 /* see below */ -#define EISA_INTERRUPT_RESET 0xC03 /* read to clear IRQ */ - -#define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */ -#define EISA_PRODUCT_IDENT_HI 0xC81 -#define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */ -#define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */ -#define EISA_ENABLE 0xC84 /* set LSB to enable card */ -#define EISA_UNIQUE_NUM_0 0xC88 /* vomit */ -#define EISA_UNIQUE_NUM_1 0xC8A -#define EISA_UNIQUE_NUM_2 0xC90 /* bit strangely arranged */ -#define EISA_UNIQUE_NUM_3 0xC92 -#define EISA_MANUF_YEAR 0xC98 /* when */ -#define EISA_MANUF_WEEK 0xC9A /* more when */ - -#define EISA_TP_BOOT_FROM_RAM 0x01 -#define EISA_TP_BOOT_FROM_LINK 0x00 -#define EISA_TP_FAST_LINKS 0x02 -#define EISA_TP_SLOW_LINKS 0x00 -#define EISA_TP_BUS_ENABLE 0x04 -#define EISA_TP_BUS_DISABLE 0x00 -#define EISA_TP_RUN 0x08 -#define EISA_TP_RESET 0x00 -#define EISA_POLLED 0x00 -#define EISA_IRQ_3 0x30 -#define EISA_IRQ_4 0x40 -#define EISA_IRQ_5 0x50 -#define EISA_IRQ_6 0x60 -#define EISA_IRQ_7 0x70 -#define EISA_IRQ_9 0x90 -#define EISA_IRQ_10 0xA0 -#define EISA_IRQ_11 0xB0 -#define EISA_IRQ_12 0xC0 -#define EISA_IRQ_14 0xE0 -#define EISA_IRQ_15 0xF0 - -#define EISA_INTERRUPT_MASK 0xF0 -#define EISA_CONTROL_MASK 0x0F - -#define RIO_EISA_DEFAULT_MODE EISA_TP_SLOW_LINKS - -#define RIOEisaToIvec(X) (uchar )((uchar)((X) & EISA_INTERRUPT_MASK)>>4) - -#define INBZ(z,x) inb(((z)<<12) | (x)) -#define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y) - -#endif /* __rio_eisa_h__ */ diff --git a/drivers/char/rio/enable.h b/drivers/char/rio/enable.h deleted file mode 100644 index e06673fa48c..00000000000 --- a/drivers/char/rio/enable.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* E N A B L E H E A D E R S - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS -static char *_rio_enable_h_sccs = "@(#)enable.h 1.1"; -#endif -#endif - - -#define ENABLE_LTT TRUE -#define ENABLE_LRT TRUE - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/formpkt.h b/drivers/char/rio/formpkt.h deleted file mode 100644 index 3c7c91ace3e..00000000000 --- a/drivers/char/rio/formpkt.h +++ /dev/null @@ -1,153 +0,0 @@ - - -/**************************************************************************** - ******* ******* - ******* F O R M P A C K E T H E A D E R F I L E - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _formpkt_h -#define _formpkt_h 1 - -#ifndef lint -#ifdef SCCS -static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1"; -#endif -#endif - -typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1; -struct FORM_BOOT_PKT_1 { - ushort pkt_number; - ushort pkt_total; - ushort boot_top; -}; - -typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2; -struct FORM_BOOT_PKT_2 { - ushort pkt_number; - char boot_data[10]; -}; - - -typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA; -struct FORM_ATTACH_RTA { - char cmd_code; - char booter_serial[4]; - char booter_link; - char bootee_serial[4]; - char bootee_link; -}; - - -typedef struct FORM_BOOT_ID FORM_BOOT_ID; -struct FORM_BOOT_ID { - char cmd_code; - char bootee_serial[4]; - char bootee_prod_id; - char bootee_link; -}; - - - -typedef struct FORM_ROUTE_1 FORM_ROUTE_1; -struct FORM_ROUTE_1 { - char cmd_code; - char pkt_number; - char total_in_sequence; - char unit_id; - char host_unit_id; -}; - -typedef struct FORM_ROUTE_2 FORM_ROUTE_2; -struct FORM_ROUTE_2 { - char cmd_code; - char pkt_number; - char total_in_sequence; - char route_data[9]; -}; - -typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ; -struct FORM_ROUTE_REQ { - char cmd_code; - char pkt_number; - char total_in_sequence; - char route_data[10]; -}; - - -typedef struct FORM_ERROR FORM_ERROR; -struct FORM_ERROR { - char cmd_code; - char error_code; - -}; - -typedef struct FORM_STATUS FORM_STATUS; -struct FORM_STATUS { - char cmd_code; - char status_code; - char last_packet_valid; - char tx_buffer; - char rx_buffer; - char port_status; - char phb_status; -}; - - -typedef struct FORM_LINK_STATUS FORM_LINK_STATUS; -struct FORM_LINK_STATUS { - char cmd_code; - char status_code; - char link_number; - ushort rx_errors; - ushort tx_errors; - ushort csum_errors; - ushort disconnects; -}; - - - -typedef struct FORM_PARTITION FORM_PARTITION; -struct FORM_PARTITION { - char cmd_code; - char status_code; - char port_number; - char tx_max; - char rx_max; - char rx_limit; -}; - - -#endif - -/*********** end of file ***********/ diff --git a/drivers/char/rio/hosthw.h b/drivers/char/rio/hosthw.h deleted file mode 100644 index 6281fe47f4e..00000000000 --- a/drivers/char/rio/hosthw.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* H O S T H A R D W A R E - ******* ******* - **************************************************************************** - - Author : Ian Nandhra / Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2"; -#endif -#endif - -#define SET_OTHER_INTERRUPT ( (volatile u_short *) 0x7c80 ) -#define SET_EISA_INTERRUPT ( (volatile u_short *) 0x7ef0 ) - -#define EISA_HOST 0x30 -#define AT_HOST 0xa0 -#define MCA_HOST 0xb0 -#define PCI_HOST 0xd0 - -#define PRODUCT_MASK 0xf0 - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/lrt.h b/drivers/char/rio/lrt.h deleted file mode 100644 index b41764d7a22..00000000000 --- a/drivers/char/rio/lrt.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* L R T - ******* ******* - **************************************************************************** - - Author : Ian Nandhra / Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1"; -#endif -#endif - - -#ifdef DCIRRUS -#define LRT_STACK (unsigned short) 600 -#else -#define LRT_STACK (ushort) 200 -#endif - - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/ltt.h b/drivers/char/rio/ltt.h deleted file mode 100644 index ab04004d404..00000000000 --- a/drivers/char/rio/ltt.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* L T T - ******* ******* - **************************************************************************** - - Author : Ian Nandhra / Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1"; -#endif -#endif - -#ifdef DCIRRUS -#define LTT_STACK (unsigned short) 600 -#else -#define LTT_STACK (ushort) 200 -#endif - - - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/lttwake.h b/drivers/char/rio/lttwake.h deleted file mode 100644 index fdf0c1f250a..00000000000 --- a/drivers/char/rio/lttwake.h +++ /dev/null @@ -1,50 +0,0 @@ - - - -/**************************************************************************** - ******* ******* - ******* L T T W A K E U P H E A D E R - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1"; -#endif -#endif - -#define LTT_WAKEUP_STACK 500 -#define LTT_WAKEUP_INTERVAL (int) (500 * MILLISECOND) - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/mca.h b/drivers/char/rio/mca.h deleted file mode 100644 index d01e76be7a1..00000000000 --- a/drivers/char/rio/mca.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Module : mca.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:11 -** Retrieved : 11/6/98 11:34:21 -** -** ident @(#)mca.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_mca_h__ -#define __rio_mca_h__ - -#ifdef SCCS_LABELS -static char *_mca_h_sccs_ = "@(#)mca.h 1.2"; -#endif - -/* -** Micro Channel stuff -*/ - -#define McaMaxSlots 8 -#define McaSlotSelect 0x96 -#define McaSlotEnable 0x08 -#define McaIdLow 0x100 -#define McaIdHigh 0x101 -#define McaIrqEnable 0x102 -#define McaMemory 0x103 -#define McaRIOId 0x6a5c -#define McaIrq9 0x00 -#define McaIrq3 0x02 -#define McaIrq4 0x04 -#define McaIrq7 0x06 -#define McaIrq10 0x08 -#define McaIrq11 0x0A -#define McaIrq12 0x0C -#define McaIrq15 0x0E -#define McaIrqMask 0x0E -#define McaCardEnable 0x01 -#define McaAddress(X) (((X)&0xFF)<<16) - -#define McaTpFastLinks 0x40 -#define McaTpSlowLinks 0x00 -#define McaTpBootFromRam 0x01 -#define McaTpBootFromLink 0x00 -#define McaTpBusEnable 0x02 -#define McaTpBusDisable 0x00 - -#define RIO_MCA_DEFAULT_MODE SLOW_LINKS - -#endif /* __rio_mca_h__ */ diff --git a/drivers/char/rio/mesg.h b/drivers/char/rio/mesg.h deleted file mode 100644 index dd9be586ec6..00000000000 --- a/drivers/char/rio/mesg.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Module : mesg.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:12 -** Retrieved : 11/6/98 11:34:21 -** -** ident @(#)mesg.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_mesg_h__ -#define __rio_mesg_h__ - -#ifdef SCCS_LABELS -static char *_mesg_h_sccs_ = "@(#)mesg.h 1.2"; -#endif - - -#endif /* __rio_mesg_h__ */ diff --git a/drivers/char/rio/poll.h b/drivers/char/rio/poll.h deleted file mode 100644 index 9616ee4c6cd..00000000000 --- a/drivers/char/rio/poll.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* P O L L - ******* ******* - **************************************************************************** - - Author : Ian Nandhra / Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _poll_h -#define _poll_h - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_poll_h_sccs = "@(#)poll.h 1.2"; -#endif -#endif - - -#ifdef HOST -#define POLL_STACK 100 -#endif -#ifdef RTA -#define POLL_STACK 200 -#endif - -#define POLL_PERIOD (int) SECOND - -/* The various poll commands */ -#define POLL_POLL 0 /* We are connected and happy.. */ -#define POLL_INTRO 1 /* Introduction packet */ -#define POLL_TOPOLOGY 2 /* Topology update */ -#define POLL_ASSIGN 3 /* ID assign */ -#define POLL_FOAD 4 /* F*** Off And Die */ -#define POLL_LMD 5 /* Let Me Die */ -#define POLL_DYB 6 /* Die You Ba***** */ - -/* The way data fields are split up for POLL packets */ -#define POLL_HOST_SERIAL 2 /* Host who booted me */ -#define POLL_MY_SERIAL 6 /* My serial number */ -#define POLL_YOUR_ID 1 /* Your ID number */ -#define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */ - -#endif - -/*********** end of file ***********/ diff --git a/drivers/char/rio/proto.h b/drivers/char/rio/proto.h deleted file mode 100644 index f9a3376333e..00000000000 --- a/drivers/char/rio/proto.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef _prototypes_h -#define _prototypes_h - - -/* -** boot.c -*/ -void init_boot(char *p, short stage); - -/* -** disconct.c -*/ -void kill_boot(LPB * link); -void disconnected(LPB * link); -short boot_3(LPB * link, PKT * pkt); -short send_3_pkt(LPB * link, PKT * pkt); - -/* -** error.c -*/ -void du_error(void); - -/* -** formpkt.c -*/ -ushort sum_it(PKT * pkt); -void form_rup_pkt(RUP * form_rup, PKT * pkt); -void form_poll_pkt(int type, LPB * link, int node); -void form_route_pkt(int type, PKT * pkt, LPB * link); - -/* -** idle.c -*/ -void idle(Process * idle_p); - -/* -** init.c -*/ -void general_init(void); -void mem_halt(int error); - -/* -** linkinit.c -*/ -void initlink(u_short number, LPB * link); -void runlink(LPB * link); - -/* -** list.c -*/ -PKT *get_free_start(void); -void put_free_start(PKT * pkt); - -#ifdef HOST -int can_remove_transmit(PKT ** pkt, PKT * pointer); -#endif - -#ifdef RTA -int spl7(void); -int spl0(void); -Q_BUF *get_free_q(void); -PKT *get_free_end(void); -int add_end(PKT * pkt, PHB * phb, int type); -unsigned short free_packets(PHB * phb, int type); -int can_remove_start(PKT ** pkt, PHB * phb, int type); -int can_add_start(PHB * phb, int type); -int can_add_end(PHB * phb, int type); -void put_free_end(PKT * pkt); -int remove_start(PKT ** pkt, PHB * phb, int type); -#endif - -/* -** Lrt.c -*/ -void lrt(Process * lrt_p, LPB * link); - -#ifdef RTA -void set_led_red(LPB * link); -#endif - -/* -** ltt.c -*/ -void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]); -void send_poll(LPB * link); -void request_id(LPB * link); -void send_topology_update(LPB * link); -void send_topology(LPB * link); -void supply_id(LPB * link); - -#ifdef RTA -void redirect_queue(LPB * link, ushort flush); -int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link); -#endif - -#ifdef TESTING_PERF -int consume_cpu(void); -#endif - -/* -** lttwake.c -*/ -#ifdef HOST -void ltt_wakeup(Process * ltt_wakeup_p); -#endif - -/* -** mapgen.c -*/ -void generate_id_map(short mapping, ROUTE_STR route[]); -void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); -void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); -void init_sys_map(void); - -/* -** mmu.c -*/ -char *rio_malloc(unsigned int amount); -char *rio_calloc(unsigned int num, unsigned int size); -ERROR rio_mmu_init(uint total_mem); - -/* -** partn.c -*/ -void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit); - -/* -** poll.c -*/ -void tx_poll(Process * tx_poll_p); - -/* -** process.c -*/ -int get_proc_space(Process ** pd, int **pws, int wssize); - -/* -** readrom.c -*/ -void read_serial_number(char *buf); - -/* -** rio.c -*/ -int main(void); - -/* -** route.c -*/ -void route_update(PKT * pkt, LPB * link); - -/* -** rtainit.c -*/ -#if defined(RTA) -void rta_init(ushort RtaType); -#endif /* defined(RTA) */ - -/* -** rupboot.c -*/ -void rup_boot(PKT * pkt, RUP * this_rup, LPB * link); - -#ifdef RTA -void kill_your_neighbour(int link_to_kill); -#endif - -/* -** rupcmd.c -*/ -void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link); - -/* -** ruperr.c -*/ -void rup_error(PKT * pkt, RUP * this_rup, LPB * link); -void illegal_cmd(PKT * src_pkt); - -/* -** ruppoll.c -*/ -void rup_poll(PKT * pkt, RUP * this_rup, LPB * link); - -/* -** ruppower.c -*/ -void rup_power(PKT * pkt, RUP * this_rup, LPB * link); - -/* -** ruprm.c -*/ -void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link); - -/* -** rupstat.c -*/ -void rup_status(PKT * pkt, RUP * this_rup, LPB * link); - -/* -** rupsync.c -*/ -void rup_sync(PKT * pkt); - -/* -** rxpkt.c -*/ -ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link); - -/* -** sendsts.c -*/ -void send_status(PKT * requesting_pkt, RUP * this_rup); - -/* -** serial.c -*/ -void assign_serial(char *ser_in, char *ser_out); -int cmp_serial(char *ser_1, char *ser_2); - -/* -** txpkt.c -*/ -ERROR tx_pkt(PKT * pkt, LPB * link); -short send_sync(LPB * link); - -#endif /* _prototypes_h */ diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 8825bd61b7d..c9af283a811 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -132,16 +132,6 @@ more than 512 ports.... */ */ #define IRQ_RATE_LIMIT 200 -#if 0 -/* Not implemented */ -/* - * The following defines are mostly for testing purposes. But if you need - * some nice reporting in your syslog, you can define them also. - */ -#define RIO_REPORT_FIFO -#define RIO_REPORT_OVERRUN -#endif - /* These constants are derived from SCO Source */ static struct Conf @@ -573,21 +563,6 @@ static void rio_shutdown_port(void *ptr) PortP = (struct Port *) ptr; PortP->gs.tty = NULL; -#if 0 - port->gs.flags &= ~GS_ACTIVE; - if (!port->gs.tty) { - rio_dprintk(RIO_DBUG_TTY, "No tty.\n"); - return; - } - if (!port->gs.tty->termios) { - rio_dprintk(RIO_DEBUG_TTY, "No termios.\n"); - return; - } - if (port->gs.tty->termios->c_cflag & HUPCL) { - rio_setsignals(port, 0, 0); - } -#endif - func_exit(); } @@ -663,11 +638,6 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd rc = 0; switch (cmd) { -#if 0 - case TIOCGSOFTCAR: - rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg); - break; -#endif case TIOCSSOFTCAR: if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); @@ -709,36 +679,6 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); break; -#if 0 - /* - * note: these IOCTLs no longer reach here. Use - * tiocmset/tiocmget driver methods instead. The - * #if 0 disablement predates this comment. - */ - case TIOCMGET: - rc = -EFAULT; - if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) { - rc = 0; - ival = rio_getsignals(port); - put_user(ival, (unsigned int *) arg); - } - break; - case TIOCMBIS: - if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { - rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1)); - } - break; - case TIOCMBIC: - if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { - rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1)); - } - break; - case TIOCMSET: - if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { - rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0)); - } - break; -#endif default: rc = -ENOIOCTLCMD; break; diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index 34cbb13aad4..92df43552f1 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c @@ -665,13 +665,6 @@ struct PKT *PacketP; struct CmdBlk *CmdBlkP; uint sequence; -#ifdef CHECK - CheckHost(Host); - CheckRup(Rup); - CheckHostP(HostP); - CheckPacketP(PacketP); -#endif - /* ** If we haven't been told what to boot, we can't boot it. */ @@ -956,11 +949,6 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st MyType = "RTA"; MyName = HostP->Mapping[Rup].Name; } -#ifdef CHECK - CheckString(MyType); - CheckString(MyName); -#endif - MyLink = RBYTE(PktCmdP->LinkNum); /* @@ -1309,52 +1297,3 @@ struct Host *HostP; } } -#if 0 -/* - Function: This function is to disable the disk interrupt - Returns : Nothing -*/ -void -disable_interrupt(vector) -int vector; -{ - int ps; - int val; - - disable(ps); - if (vector > 40) { - val = 1 << (vector - 40); - __outb(S8259+1, __inb(S8259+1) | val); - } - else { - val = 1 << (vector - 32); - __outb(M8259+1, __inb(M8259+1) | val); - } - restore(ps); -} - -/* - Function: This function is to enable the disk interrupt - Returns : Nothing -*/ -void -enable_interrupt(vector) -int vector; -{ - int ps; - int val; - - disable(ps); - if (vector > 40) { - val = 1 << (vector - 40); - val = ~val; - __outb(S8259+1, __inb(S8259+1) & val); - } - else { - val = 1 << (vector - 32); - val = ~val; - __outb(M8259+1, __inb(M8259+1) & val); - } - restore(ps); -} -#endif diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index b97dd9fdb6b..694bfb9d937 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c @@ -387,12 +387,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * func_enter(); -#ifdef CHECK - CheckHost(Host); - CheckHostP(HostP); - CheckPacketP(PacketP); -#endif - /* ** 16 port RTA note: ** Command rup packets coming from the RTA will have pkt->data[1] (which @@ -406,10 +400,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); -#ifdef CHECK - CheckRup(rup); - CheckUnixRupP(UnixRupP); -#endif if (UnixRupP->BaseSysPort == NO_PORT) { rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); @@ -429,9 +419,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); return TRUE; } -#ifdef CHECK - CheckSysPort(SysPort); -#endif PortP = p->RIOPortp[SysPort]; rio_spin_lock_irqsave(&PortP->portSem, flags); switch (RBYTE(PktCmdP->Command)) { @@ -604,11 +591,6 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) struct UnixRup *UnixRupP; unsigned long flags; -#ifdef CHECK - CheckHostP(HostP); - CheckRup(Rup); - CheckCmdBlkP(CmdBlkP); -#endif if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); RIOFreeCmdBlk(CmdBlkP); @@ -806,9 +788,6 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ** If it returns RIO_FAIL then don't ** send this command yet! */ -#ifdef CHECK - CheckCmdBlkP(CmdBlkP); -#endif if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); } else { @@ -816,9 +795,6 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) /* ** Whammy! blat that pack! */ -#ifdef CHECK - CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); -#endif HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); /* @@ -852,9 +828,6 @@ int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) unsigned long flags; rio_spin_lock_irqsave(&PortP->portSem, flags); -#ifdef CHECK - CheckPortP(PortP); -#endif PortP->WflushFlag++; PortP->MagicFlags |= MAGIC_FLUSH; rio_spin_unlock_irqrestore(&PortP->portSem, flags); @@ -894,9 +867,6 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) rio_spin_lock_irqsave(&PortP->portSem, flags); -#ifdef CHECK - CheckPortP(PortP); -#endif rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n"); if (PortP->InUse) { diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index 0b7700d2f04..fcf18a06122 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c @@ -308,12 +308,7 @@ int su; } case RIO_DEBUG_MEM: -#ifdef DEBUG_MEM_SUPPORT - RIO_DEBUG_CTRL, if (su) - return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); - else -#endif - return -EPERM; + return -EPERM; case RIO_ALL_MODEM: rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); @@ -591,12 +586,7 @@ int su; case RIO_GET_LOG: rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); -#ifdef LOGGING - RIOGetLog(arg); - return 0; -#else return -EINVAL; -#endif case RIO_GET_MODTYPE: if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { @@ -684,52 +674,6 @@ int su; rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); for (loop = PortSetup.From; loop <= PortSetup.To; loop++) { rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); -#if 0 - PortP = p->RIOPortp[loop]; - if (!PortP->TtyP) - PortP->TtyP = &p->channel[loop]; - - rio_spin_lock_irqsave(&PortP->portSem, flags); - if (PortSetup.IxAny) - PortP->Config |= RIO_IXANY; - else - PortP->Config &= ~RIO_IXANY; - if (PortSetup.IxOn) - PortP->Config |= RIO_IXON; - else - PortP->Config &= ~RIO_IXON; - - /* - ** If the port needs to wait for all a processes output - ** to drain before closing then this flag will be set. - */ - if (PortSetup.Drain) { - PortP->Config |= RIO_WAITDRAIN; - } else { - PortP->Config &= ~RIO_WAITDRAIN; - } - /* - ** Store settings if locking or unlocking port or if the - ** port is not locked, when setting the store option. - */ - if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) { - PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag; - PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag; - PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag; - PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag; - PortP->StoredTty.line = PortP->TtyP->tm.c_line; - bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5); - } - PortP->Lock = PortSetup.Lock; - PortP->Store = PortSetup.Store; - PortP->Xprint.XpCps = PortSetup.XpCps; - bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN); - bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN); - PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; - PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; - PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); -#endif } rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval); @@ -801,12 +745,6 @@ int su; rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); PortP = (p->RIOPortp[PortTty.port]); -#if 0 - PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; - PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag; - PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag; - PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag; -#endif if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -824,15 +762,6 @@ int su; return -ENXIO; } PortP = (p->RIOPortp[PortTty.port]); -#if 0 - rio_spin_lock_irqsave(&PortP->portSem, flags); - PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag; - PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag; - PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag; - PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); -#endif - RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); return retval; @@ -909,23 +838,6 @@ int su; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return retval; -#ifdef DEBUG_SUPPORTED - case RIO_READ_LEVELS: - { - int num; - rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); - for (num = 0; RIODbInf[num].Flag; num++); - rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num); - if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) { - rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); - p->RIOError.Error = COPYOUT_FAILED; - return -EFAULT; - } - rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num); - return retval; - } -#endif - case RIO_READ_CONFIG: rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { @@ -1084,30 +996,13 @@ int su; (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); p->RIOHosts[Host].Flags = RC_WAITING; -#if 0 - RIOSetupDataStructs(p); -#endif } RIOFoadWakeup(p); p->RIONumBootPkts = 0; p->RIOBooting = 0; - -#ifdef RINGBUFFER_SUPPORT - for (loop = 0; loop < RIO_PORTS; loop++) - if (p->RIOPortp[loop]->TxRingBuffer) - sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize); -#endif -#if 0 - bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port)); -#else printk("HEEEEELP!\n"); -#endif for (loop = 0; loop < RIO_PORTS; loop++) { -#if 0 - p->RIOPortp[loop]->TtyP = &p->channel[loop]; -#endif - spin_lock_init(&p->RIOPortp[loop]->portSem); p->RIOPortp[loop]->InUse = NOT_INUSE; } @@ -1653,10 +1548,6 @@ uchar Cmd; ushort rup; int port; -#ifdef CHECK - CheckPortP(PortP); -#endif - if (PortP->State & RIO_DELETED) { rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); return RIO_FAIL; diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 898a126ae3e..0d44ef464e6 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -87,222 +87,8 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; int RIOPCIinit(struct rio_info *p, int Mode); -#if 0 -static void RIOAllocateInterrupts(struct rio_info *); -static int RIOReport(struct rio_info *); -static void RIOStopInterrupts(struct rio_info *, int, int); -#endif - static int RIOScrub(int, BYTE *, int); -#if 0 -extern int rio_intr(); - -/* -** Init time code. -*/ -void -rioinit( p, info ) -struct rio_info * p; -struct RioHostInfo * info; -{ - /* - ** Multi-Host card support - taking the easy way out - sorry ! - ** We allocate and set up the Host and Port structs when the - ** driver is called to 'install' the first host. - ** We check for this first 'call' by testing the RIOPortp pointer. - */ - if ( !p->RIOPortp ) - { - rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n"); - - RIOAllocDataStructs(p); /* allocate host/port structs */ - RIOSetupDataStructs(p); /* setup topology structs */ - } - - RIOInitHosts( p, info ); /* hunt down the hardware */ - - RIOAllocateInterrupts(p); /* allocate interrupts */ - RIOReport(p); /* show what we found */ -} - -/* -** Initialise the Cards -*/ -void -RIOInitHosts(p, info) -struct rio_info * p; -struct RioHostInfo * info; -{ -/* -** 15.10.1998 ARG - ESIL 0762 part fix -** If there is no ISA card definition - we always look for PCI cards. -** As we currently only support one host card this lets an ISA card -** definition take precedence over PLUG and PLAY. -** No ISA card - we are PLUG and PLAY with PCI. -*/ - - /* - ** Note - for PCI both these will be zero, that's okay because - ** RIOPCIInit() fills them in if a card is found. - */ - p->RIOHosts[p->RIONumHosts].Ivec = info->vector; - p->RIOHosts[p->RIONumHosts].PaddrP = info->location; - - /* - ** Check that we are able to accommodate another host - */ - if ( p->RIONumHosts >= RIO_HOSTS ) - { - p->RIOFailed++; - return; - } - - if ( info->bus & ISA_BUS ) - { - rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts); - RIOISAinit(p, p->mode); - } - else - { - rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts); - RIOPCIinit(p, RIO_PCI_DEFAULT_MODE); - } - - rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts); - - -#ifdef FUTURE_RELEASE - if (p->bus & EISA_BUS) - /* EISA card */ - RIOEISAinit(p, RIO_EISA_DEFAULT_MODE); - - if (p->bus & MCA_BUS) - /* MCA card */ - RIOMCAinit(p, RIO_MCA_DEFAULT_MODE); -#endif -} - -/* -** go through memory for an AT host that we pass in the device info -** structure and initialise -*/ -void -RIOISAinit(p, mode) -struct rio_info * p; -int mode; -{ - - /* XXX Need to implement this. */ -#if 0 - p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec, - (int (*)())rio_intr, (char*)p->RIONumHosts); - - rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid ); - - if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) { - return; - } - else { - rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n"); - p->RIOFailed++; - } -#endif - -} - -/* -** RIODoAT : -** -** Map in a boards physical address, check that the board is there, -** test the board and if everything is okay assign the board an entry -** in the Rio Hosts structure. -*/ -int -RIODoAT(p, Base, mode) -struct rio_info * p; -int Base; -int mode; -{ -#define FOUND 1 -#define NOT_FOUND 0 - - caddr_t cardAddr; - - /* - ** Check to see if we actually have a board at this physical address. - */ - if ((cardAddr = RIOCheckForATCard(Base)) != 0) { - /* - ** Now test the board to see if it is working. - */ - if (RIOBoardTest(Base, cardAddr, RIO_AT, 0) == RIO_SUCCESS) { - /* - ** Fill out a slot in the Rio host structure. - */ - if (RIOAssignAT(p, Base, cardAddr, mode)) { - return(FOUND); - } - } - RIOMapout(Base, RIO_AT_MEM_SIZE, cardAddr); - } - return(NOT_FOUND); -} - -caddr_t -RIOCheckForATCard(Base) -int Base; -{ - int off; - struct DpRam *cardp; /* (Points at the host) */ - caddr_t virtAddr; - unsigned char RIOSigTab[24]; -/* -** Table of values to search for as prom signature of a host card -*/ - strcpy(RIOSigTab, "JBJGPGGHINSMJPJR"); - - /* - ** Hey! Yes, You reading this code! Yo, grab a load a this: - ** - ** IF the card is using WORD MODE rather than BYTE MODE - ** then it will occupy 128K of PHYSICAL memory area. So, - ** you might think that the following Mapin is wrong. Well, - ** it isn't, because the SECOND 64K of occupied space is an - ** EXACT COPY of the FIRST 64K. (good?), so, we need only - ** map it in in one 64K block. - */ - if (RIOMapin(Base, RIO_AT_MEM_SIZE, &virtAddr) == -1) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't map the board in!\n"); - return((caddr_t)0); - } - - /* - ** virtAddr points to the DP ram of the system. - ** We now cast this to a pointer to a RIO Host, - ** and have a rummage about in the PROM. - */ - cardp = (struct DpRam *)virtAddr; - - for (off=0; RIOSigTab[off]; off++) { - if ((RBYTE(cardp->DpSignature[off]) & 0xFF) != RIOSigTab[off]) { - /* - ** Signature mismatch - card not at this address - */ - RIOMapout(Base, RIO_AT_MEM_SIZE, virtAddr); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't match the signature 0x%x 0x%x!\n", - (int)cardp, off); - return((caddr_t)0); - } - } - - /* - ** If we get here then we must have found a valid board so return - ** its virtual address. - */ - return(virtAddr); -} -#endif /** ** RIOAssignAT : @@ -367,667 +153,6 @@ int mode; rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); return(1); } -#if 0 -#ifdef FUTURE_RELEASE -int RIOMCAinit(int Mode) -{ - uchar SlotNumber; - caddr_t Caddr; - uint Paddr; - uint Ivec; - int Handle; - int ret = 0; - - /* - ** Valid mode information for MCA cards - ** is only FAST LINKS - */ - Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks; - rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode); - - - /* - ** Check out each of the slots - */ - for (SlotNumber = 0; SlotNumber < McaMaxSlots; SlotNumber++) { - /* - ** Enable the slot we want to talk to - */ - outb( McaSlotSelect, SlotNumber | McaSlotEnable ); - - /* - ** Read the ID word from the slot - */ - if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId) - { - rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber); - - /* - ** Card appears to be a RIO MCA card! - */ - RIOMachineType |= (1<<RIO_MCA); - - /* - ** Just check we haven't found too many wonderful objects - */ - if ( RIONumHosts >= RIO_HOSTS ) - { - Rprintf(RIOMesgTooManyCards); - return(ret); - } - - /* - ** McaIrqEnable contains the interrupt vector, and a card - ** enable bit. - */ - Ivec = inb(McaIrqEnable); - - rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec); - - switch ( Ivec & McaIrqMask ) - { - case McaIrq9: - rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n"); - break; - case McaIrq3: - rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n"); - break; - case McaIrq4: - rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n"); - break; - case McaIrq7: - rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n"); - break; - case McaIrq10: - rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n"); - break; - case McaIrq11: - rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n"); - break; - case McaIrq12: - rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n"); - break; - case McaIrq15: - rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n"); - break; - } - - /* - ** If the card enable bit isn't set, then set it! - */ - if ((Ivec & McaCardEnable) != McaCardEnable) { - rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n"); - outb(McaIrqEnable,Ivec|McaCardEnable); - } else - rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n"); - - /* - ** Convert the IRQ enable mask into something useful - */ - Ivec = RIOMcaToIvec[Ivec & McaIrqMask]; - - /* - ** Find the physical address - */ - rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory)); - Paddr = McaAddress(inb(McaMemory)); - - rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr); - - if ( Paddr != 0 ) - { - - /* - ** Tell the memory mapper that we want to talk to it - */ - Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr ); - - if ( Handle == -1 ) { - rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr; - continue; - } - - rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr); - - /* - ** And check that it is actually there! - */ - if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS ) - { - rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n"); - rio_dprintk (RIO_DEBUG_INIT, "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", - SlotNumber, RIO_MCA, Paddr, Caddr, Mode); - - /* - ** Board has passed its scrub test. Fill in all the - ** transient stuff. - */ - p->RIOHosts[RIONumHosts].Slot = SlotNumber; - p->RIOHosts[RIONumHosts].Ivec = Ivec; - p->RIOHosts[RIONumHosts].Type = RIO_MCA; - p->RIOHosts[RIONumHosts].Copy = bcopy; - p->RIOHosts[RIONumHosts].PaddrP = Paddr; - p->RIOHosts[RIONumHosts].Caddr = Caddr; - p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr; - p->RIOHosts[RIONumHosts].Mode = Mode; - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt , 0xff); - p->RIOHosts[RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)| - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)| - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)| - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24); - RIONumHosts++; - ret++; - } - else - { - /* - ** It failed the test, so ignore it. - */ - rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n"); - RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr ); - } - } - else - { - rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber); - } - } - else - { - rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber); - } - } - /* - ** Now we have checked all the slots, turn off the MCA slot selector - */ - outb(McaSlotSelect,0); - rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber); - return ret; -} - -int RIOEISAinit( int Mode ) -{ - static int EISADone = 0; - uint Paddr; - int PollIntMixMsgDone = 0; - caddr_t Caddr; - ushort Ident; - uchar EisaSlot; - uchar Ivec; - int ret = 0; - - /* - ** The only valid mode information for EISA hosts is fast or slow - ** links. - */ - Mode = (Mode & FAST_LINKS) ? EISA_TP_FAST_LINKS : EISA_TP_SLOW_LINKS; - - if ( EISADone ) - { - rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n"); - return(0); - } - - EISADone++; - - rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n"); - - - /* - ** First check all cards to see if ANY are set for polled mode operation. - ** If so, set ALL to polled. - */ - - for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ ) - { - Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) | - INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO); - - if ( Ident == RIO_EISA_IDENT ) - { - rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n"); - - if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE ) - { - rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n", - INBZ(EisaSlot, EISA_PRODUCT_NUMBER)); - continue; /* next slot */ - } - /* - ** Its a Specialix RIO! - */ - rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n", - INBZ(EisaSlot, EISA_REVISION_NUMBER)); - - RIOMachineType |= (1<<RIO_EISA); - - /* - ** Just check we haven't found too many wonderful objects - */ - if ( RIONumHosts >= RIO_HOSTS ) - { - Rprintf(RIOMesgTooManyCards); - return 0; - } - - /* - ** Ensure that the enable bit is set! - */ - OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT ); - - /* - ** EISA_INTERRUPT_VEC contains the interrupt vector. - */ - Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC); - -#ifdef RIODEBUG - switch ( Ivec & EISA_INTERRUPT_MASK ) - { - case EISA_IRQ_3: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n"); - break; - case EISA_IRQ_4: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n"); - break; - case EISA_IRQ_5: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n"); - break; - case EISA_IRQ_6: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n"); - break; - case EISA_IRQ_7: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n"); - break; - case EISA_IRQ_9: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n"); - break; - case EISA_IRQ_10: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n"); - break; - case EISA_IRQ_11: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n"); - break; - case EISA_IRQ_12: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n"); - break; - case EISA_IRQ_14: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n"); - break; - case EISA_IRQ_15: - rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n"); - break; - case EISA_POLLED: - rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n"); - break; - default: - rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n"); - Ivec &= EISA_CONTROL_MASK; - } -#endif - - if ( (Ivec & EISA_INTERRUPT_MASK) == - EISA_POLLED ) - { - RIOWillPoll = 1; - break; /* From EisaSlot loop */ - } - } - } - - /* - ** Do it all again now we know whether to change all cards to polled - ** mode or not - */ - - for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ ) - { - Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) | - INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO); - - if ( Ident == RIO_EISA_IDENT ) - { - if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE ) - continue; /* next slot */ - - /* - ** Its a Specialix RIO! - */ - - /* - ** Ensure that the enable bit is set! - */ - OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT ); - - /* - ** EISA_INTERRUPT_VEC contains the interrupt vector. - */ - Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC); - - if ( RIOWillPoll ) - { - /* - ** If we are going to operate in polled mode, but this - ** board is configured to be interrupt driven, display - ** the message explaining the situation to the punter, - ** assuming we haven't already done so. - */ - - if ( !PollIntMixMsgDone && - (Ivec & EISA_INTERRUPT_MASK) != EISA_POLLED ) - { - Rprintf(RIOMesgAllPolled); - PollIntMixMsgDone = 1; - } - - /* - ** Ungraciously ignore whatever the board reports as its - ** interrupt vector... - */ - - Ivec &= ~EISA_INTERRUPT_MASK; - - /* - ** ...and force it to dance to the poll tune. - */ - - Ivec |= EISA_POLLED; - } - - /* - ** Convert the IRQ enable mask into something useful (0-15) - */ - Ivec = RIOEisaToIvec(Ivec); - - rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n", - EisaSlot, Ivec); - - /* - ** Find the physical address - */ - Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) | - (INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16); - - rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr); - - if ( Paddr == 0 ) - { - rio_dprintk (RIO_DEBUG_INIT, - "Board in slot %d configured for address zero!\n", EisaSlot); - continue; - } - - /* - ** Tell the memory mapper that we want to talk to it - */ - rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n"); - - if (RIOMapin( Paddr, RIO_EISA_MEM_SIZE, &Caddr) == -1) { - rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", - RIO_EISA_MEM_SIZE,Paddr); - continue; - } - - rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr); - - /* - ** And check that it is actually there! - */ - if ( RIOBoardTest( Paddr,Caddr,RIO_EISA,EisaSlot) == RIO_SUCCESS ) - { - rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n"); - rio_dprintk (RIO_DEBUG_INIT, - "Slot %d. Ivec %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", - EisaSlot,Ivec,RIO_EISA,Paddr,Caddr,Mode); - - /* - ** Board has passed its scrub test. Fill in all the - ** transient stuff. - */ - p->RIOHosts[RIONumHosts].Slot = EisaSlot; - p->RIOHosts[RIONumHosts].Ivec = Ivec; - p->RIOHosts[RIONumHosts].Type = RIO_EISA; - p->RIOHosts[RIONumHosts].Copy = bcopy; - p->RIOHosts[RIONumHosts].PaddrP = Paddr; - p->RIOHosts[RIONumHosts].Caddr = Caddr; - p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr; - p->RIOHosts[RIONumHosts].Mode = Mode; - /* - ** because the EISA prom is mapped into IO space, we - ** need to copy the unqiue number into the memory area - ** that it would have occupied, so that the download - ** code can determine its ID and card type. - */ - WBYTE(p->RIOHosts[RIONumHosts].Unique[0],INBZ(EisaSlot,EISA_UNIQUE_NUM_0)); - WBYTE(p->RIOHosts[RIONumHosts].Unique[1],INBZ(EisaSlot,EISA_UNIQUE_NUM_1)); - WBYTE(p->RIOHosts[RIONumHosts].Unique[2],INBZ(EisaSlot,EISA_UNIQUE_NUM_2)); - WBYTE(p->RIOHosts[RIONumHosts].Unique[3],INBZ(EisaSlot,EISA_UNIQUE_NUM_3)); - p->RIOHosts[RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)| - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)| - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)| - ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24); - INBZ(EisaSlot,EISA_INTERRUPT_RESET); - RIONumHosts++; - ret++; - } - else - { - /* - ** It failed the test, so ignore it. - */ - rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n"); - - RIOMapout(Paddr, RIO_EISA_MEM_SIZE, Caddr ); - } - } - } - if (RIOMachineType & RIO_EISA) - return ret+1; - return ret; -} -#endif - - -#ifndef linux - -#define CONFIG_ADDRESS 0xcf8 -#define CONFIG_DATA 0xcfc -#define FORWARD_REG 0xcfa - - -static int -read_config(int bus_number, int device_num, int r_number) -{ - unsigned int cav; - unsigned int val; - -/* - Build config_address_value: - - 31 24 23 16 15 11 10 8 7 0 - ------------------------------------------------------ - |1| 0000000 | bus_number | device # | 000 | register | - ------------------------------------------------------ -*/ - - cav = r_number & 0xff; - cav |= ((device_num & 0x1f) << 11); - cav |= ((bus_number & 0xff) << 16); - cav |= 0x80000000; /* Enable bit */ - outpd(CONFIG_ADDRESS,cav); - val = inpd(CONFIG_DATA); - outpd(CONFIG_ADDRESS,0); - return val; -} - -static -write_config(bus_number,device_num,r_number,val) -{ - unsigned int cav; - -/* - Build config_address_value: - - 31 24 23 16 15 11 10 8 7 0 - ------------------------------------------------------ - |1| 0000000 | bus_number | device # | 000 | register | - ------------------------------------------------------ -*/ - - cav = r_number & 0xff; - cav |= ((device_num & 0x1f) << 11); - cav |= ((bus_number & 0xff) << 16); - cav |= 0x80000000; /* Enable bit */ - outpd(CONFIG_ADDRESS, cav); - outpd(CONFIG_DATA, val); - outpd(CONFIG_ADDRESS, 0); - return val; -} -#else -/* XXX Implement these... */ -static int -read_config(int bus_number, int device_num, int r_number) -{ - return 0; -} - -static int -write_config(int bus_number, int device_num, int r_number) -{ - return 0; -} - -#endif - -int -RIOPCIinit(p, Mode) -struct rio_info *p; -int Mode; -{ - #define MAX_PCI_SLOT 32 - #define RIO_PCI_JET_CARD 0x200011CB - - static int slot; /* count of machine's PCI slots searched so far */ - caddr_t Caddr; /* Virtual address of the current PCI host card. */ - unsigned char Ivec; /* interrupt vector for the current PCI host */ - unsigned long Paddr; /* Physical address for the current PCI host */ - int Handle; /* Handle to Virtual memory allocated for current PCI host */ - - - rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot); - - /* - ** Initialise the search status - */ - p->RIOLastPCISearch = RIO_FAIL; - - while ( (slot < MAX_PCI_SLOT) & (p->RIOLastPCISearch != RIO_SUCCESS) ) - { - rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot); - - if (read_config(0,slot,0) == RIO_PCI_JET_CARD) { - p->RIOHosts[p->RIONumHosts].Ivec = 0; - Paddr = read_config(0,slot,0x18); - Paddr = Paddr - (Paddr & 0x1); /* Mask off the io bit */ - - if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) { - rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */ - slot++; - continue; - } - - p->RIOHosts[p->RIONumHosts].PaddrP = Paddr; - Ivec = (read_config(0,slot,0x3c) & 0xff); - - rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec); - - Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr ); - if (Handle == -1) { - rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr); - slot++; - continue; - } - p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32; - p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec, - (int (*)())rio_intr, (char *)p->RIONumHosts); - if (RIOBoardTest( Paddr, Caddr, RIO_PCI, 0 ) == RIO_SUCCESS) { - rio_dprintk (RIO_DEBUG_INIT, ("Board has passed test\n"); - rio_dprintk (RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, Mode); - - /* - ** Board has passed its scrub test. Fill in all the - ** transient stuff. - */ - p->RIOHosts[p->RIONumHosts].Slot = 0; - p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32; - p->RIOHosts[p->RIONumHosts].Type = RIO_PCI; - p->RIOHosts[p->RIONumHosts].Copy = rio_pcicopy; - p->RIOHosts[p->RIONumHosts].PaddrP = Paddr; - p->RIOHosts[p->RIONumHosts].Caddr = Caddr; - p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)Caddr; - p->RIOHosts[p->RIONumHosts].Mode = Mode; - -#if 0 - WBYTE(p->RIOHosts[p->RIONumHosts].Control, - BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - p->RIOHosts[p->RIONumHosts].Mode | - INTERRUPT_DISABLE ); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); - WBYTE(p->RIOHosts[p->RIONumHosts].Control, - BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - p->RIOHosts[p->RIONumHosts].Mode | - INTERRUPT_DISABLE ); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); -#else - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); -#endif - p->RIOHosts[p->RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); - - rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n", - p->RIOHosts[p->RIONumHosts].UniqueNum); - - p->RIOLastPCISearch = RIO_SUCCESS; - p->RIONumHosts++; - } - } - slot++; - } - - if ( slot >= MAX_PCI_SLOT ) { - rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n", - MAX_PCI_SLOT); - } - - - /* - ** I don't think we want to do this anymore - ** - - if (!p->RIOLastPCISearch == RIO_FAIL ) { - p->RIOFailed++; - } - - ** - */ -} - -#ifdef FUTURE_RELEASE -void riohalt( void ) -{ - int host; - for ( host=0; host<p->RIONumHosts; host++ ) - { - rio_dprintk (RIO_DEBUG_INIT, "Stop host %d\n", host); - (void)RIOBoardTest( p->RIOHosts[host].PaddrP, p->RIOHosts[host].Caddr, p->RIOHosts[host].Type,p->RIOHosts[host].Slot ); - } -} -#endif -#endif static uchar val[] = { #ifdef VERY_LONG_TEST @@ -1262,200 +387,6 @@ int size; return RIO_SUCCESS; } -/* -** try to ensure that every host is either in polled mode -** or is in interrupt mode. Only allow interrupt mode if -** all hosts can interrupt (why?) -** and force into polled mode if told to. Patch up the -** interrupt vector & salute The Queen when you've done. -*/ -#if 0 -static void -RIOAllocateInterrupts(p) -struct rio_info * p; -{ - int Host; - - /* - ** Easy case - if we have been told to poll, then we poll. - */ - if (p->mode & POLLED_MODE) { - RIOStopInterrupts(p, 0, 0); - return; - } - - /* - ** check - if any host has been set to polled mode, then all must be. - */ - for (Host=0; Host<p->RIONumHosts; Host++) { - if ( (p->RIOHosts[Host].Type != RIO_AT) && - (p->RIOHosts[Host].Ivec == POLLED) ) { - RIOStopInterrupts(p, 1, Host ); - return; - } - } - for (Host=0; Host<p->RIONumHosts; Host++) { - if (p->RIOHosts[Host].Type == RIO_AT) { - if ( (p->RIOHosts[Host].Ivec - 32) == 0) { - RIOStopInterrupts(p, 2, Host ); - return; - } - } - } -} - -/* -** something has decided that we can't be doing with these -** new-fangled interrupt thingies. Set everything up to just -** poll. -*/ -static void -RIOStopInterrupts(p, Reason, Host) -struct rio_info * p; -int Reason; -int Host; -{ -#ifdef FUTURE_RELEASE - switch (Reason) { - case 0: /* forced into polling by rio_polled */ - break; - case 1: /* SCU has set 'Host' into polled mode */ - break; - case 2: /* there aren't enough interrupt vectors for 'Host' */ - break; - } -#endif - - for (Host=0; Host<p->RIONumHosts; Host++ ) { - struct Host *HostP = &p->RIOHosts[Host]; - - switch (HostP->Type) { - case RIO_AT: - /* - ** The AT host has it's interrupts disabled by clearing the - ** int_enable bit. - */ - HostP->Mode &= ~INTERRUPT_ENABLE; - HostP->Ivec = POLLED; - break; -#ifdef FUTURE_RELEASE - case RIO_EISA: - /* - ** The EISA host has it's interrupts disabled by setting the - ** Ivec to zero - */ - HostP->Ivec = POLLED; - break; -#endif - case RIO_PCI: - /* - ** The PCI host has it's interrupts disabled by clearing the - ** int_enable bit, like a regular host card. - */ - HostP->Mode &= ~RIO_PCI_INT_ENABLE; - HostP->Ivec = POLLED; - break; -#ifdef FUTURE_RELEASE - case RIO_MCA: - /* - ** There's always one, isn't there? - ** The MCA host card cannot have it's interrupts disabled. - */ - RIOPatchVec(HostP); - break; -#endif - } - } -} - -/* -** This function is called at init time to setup the data structures. -*/ -void -RIOAllocDataStructs(p) -struct rio_info * p; -{ - int port, - host, - tm; - - p->RIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port)); - if (!p->RIOPortp) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n"); - p->RIOFailed++; - return; - } - bzero( p->RIOPortp, sizeof(struct Port) * RIO_PORTS ); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for port structs\n"); - rio_dprintk (RIO_DEBUG_INIT, "First RIO port struct @0x%x, size=0x%x bytes\n", - (int)p->RIOPortp, sizeof(struct Port)); - - for( port=0; port<RIO_PORTS; port++ ) { - p->RIOPortp[port].PortNum = port; - p->RIOPortp[port].TtyP = &p->channel[port]; - sreset (p->RIOPortp[port].InUse); /* Let the first guy uses it */ - p->RIOPortp[port].portSem = -1; /* Let the first guy takes it */ - p->RIOPortp[port].ParamSem = -1; /* Let the first guy takes it */ - p->RIOPortp[port].timeout_id = 0; /* Let the first guy takes it */ - } - - p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host)); - if (!p->RIOHosts) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n"); - p->RIOFailed++; - return; - } - bzero(p->RIOHosts, sizeof(struct Host)*RIO_HOSTS); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for host structs\n"); - rio_dprintk (RIO_DEBUG_INIT, "First RIO host struct @0x%x, size=0x%x bytes\n", - (int)p->RIOHosts, sizeof(struct Host)); - - for( host=0; host<RIO_HOSTS; host++ ) { - spin_lock_init (&p->RIOHosts[host].HostLock); - p->RIOHosts[host].timeout_id = 0; /* Let the first guy takes it */ - } - /* - ** check that the buffer size is valid, round down to the next power of - ** two if necessary; if the result is zero, then, hey, no double buffers. - */ - for ( tm = 1; tm && tm <= p->RIOConf.BufferSize; tm <<= 1 ) - ; - tm >>= 1; - p->RIOBufferSize = tm; - p->RIOBufferMask = tm ? tm - 1 : 0; -} - -/* -** this function gets called whenever the data structures need to be -** re-setup, for example, after a riohalt (why did I ever invent it?) -*/ -void -RIOSetupDataStructs(p) -struct rio_info * p; -{ - int host, entry, rup; - - for ( host=0; host<RIO_HOSTS; host++ ) { - struct Host *HostP = &p->RIOHosts[host]; - for ( entry=0; entry<LINKS_PER_UNIT; entry++ ) { - HostP->Topology[entry].Unit = ROUTE_DISCONNECT; - HostP->Topology[entry].Link = NO_LINK; - } - bcopy("HOST X", HostP->Name, 7); - HostP->Name[5] = '1'+host; - for (rup=0; rup<(MAX_RUP + LINKS_PER_UNIT); rup++) { - if (rup < MAX_RUP) { - for (entry=0; entry<LINKS_PER_UNIT; entry++ ) { - HostP->Mapping[rup].Topology[entry].Unit = ROUTE_DISCONNECT; - HostP->Mapping[rup].Topology[entry].Link = NO_LINK; - } - RIODefaultName(p, HostP, rup); - } - spin_lock_init(&HostP->UnixRups[rup].RupLock); - } - } -} -#endif int RIODefaultName(p, HostP, UnitId) @@ -1463,10 +394,6 @@ struct rio_info * p; struct Host * HostP; uint UnitId; { -#ifdef CHECK - CheckHost( Host ); - CheckUnitId( UnitId ); -#endif bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); if ((UnitId+1) > 9) { @@ -1483,33 +410,6 @@ uint UnitId; #define RIO_RELEASE "Linux" #define RELEASE_ID "1.0" -#if 0 -static int -RIOReport(p) -struct rio_info * p; -{ - char * RIORelease = RIO_RELEASE; - char * RIORelID = RELEASE_ID; - int host; - - rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID); - - if ( p->RIONumHosts==0 ) { - rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n"); - return(0); - } - - for ( host=0; host < p->RIONumHosts; host++ ) { - struct Host *HostP = &p->RIOHosts[host]; - switch ( HostP->Type ) { - case RIO_AT: - rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP); - } - } - return 0; -} -#endif - static struct rioVersion stVersion; struct rioVersion * @@ -1523,27 +423,6 @@ RIOVersid(void) return &stVersion; } -#if 0 -int -RIOMapin(paddr, size, vaddr) -paddr_t paddr; -int size; -caddr_t * vaddr; -{ - *vaddr = (caddr_t)permap( (long)paddr, size); - return ((int)*vaddr); -} - -void -RIOMapout(paddr, size, vaddr) -paddr_t paddr; -long size; -caddr_t vaddr; -{ -} -#endif - - void RIOHostReset(Type, DpRamP, Slot) uint Type; @@ -1570,31 +449,6 @@ uint Slot; WBYTE(DpRamP->DpResetTpu, 0xFF); udelay(3); break; -#ifdef FUTURE_RELEASE - case RIO_EISA: - /* - ** Bet this doesn't work! - */ - OUTBZ( Slot, EISA_CONTROL_PORT, - EISA_TP_RUN | EISA_TP_BUS_DISABLE | - EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM ); - OUTBZ( Slot, EISA_CONTROL_PORT, - EISA_TP_RESET | EISA_TP_BUS_DISABLE | - EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM ); - suspend( 3 ); - OUTBZ( Slot, EISA_CONTROL_PORT, - EISA_TP_RUN | EISA_TP_BUS_DISABLE | - EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM ); - break; - case RIO_MCA: - WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable ); - WBYTE(DpRamP->DpResetTpu , 0xFF ); - suspend( 3 ); - WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable ); - WBYTE(DpRamP->DpResetTpu , 0xFF ); - suspend( 3 ); - break; -#endif case RIO_PCI: rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; @@ -1604,12 +458,6 @@ uint Slot; /* for (i=0; i<6000; i++); */ /* suspend( 3 ); */ break; -#ifdef FUTURE_RELEASE - default: - Rprintf(RIOMesgNoSupport,Type,DpRamP,Slot); - return; -#endif - default: rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); break; diff --git a/drivers/char/rio/riolocks.h b/drivers/char/rio/riolocks.h deleted file mode 100644 index 0e0cdacebe0..00000000000 --- a/drivers/char/rio/riolocks.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Module : riolocks.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:13 -** Retrieved : 11/6/98 11:34:22 -** -** ident @(#)riolocks.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_riolocks_h__ -#define __rio_riolocks_h__ - -#ifdef SCCS_LABELS -static char *_riolocks_h_sccs_ = "@(#)riolocks.h 1.2"; -#endif - -#define LOCKB(lk) lockb(lk); -#define UNLOCKB(lk, oldspl) unlockb(lk, oldspl); - -#endif diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index 4cc7f4942bf..c622f46d6d7 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c @@ -195,27 +195,6 @@ int SleepFlag; ** paramed with OPEN, we want to restore the saved port termio, but ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. */ -#if 0 - if (PortP->FirstOpen) { - PortP->StoredTty.iflag = TtyP->tm.c_iflag; - PortP->StoredTty.oflag = TtyP->tm.c_oflag; - PortP->StoredTty.cflag = TtyP->tm.c_cflag; - PortP->StoredTty.lflag = TtyP->tm.c_lflag; - PortP->StoredTty.line = TtyP->tm.c_line; - for (i = 0; i < NCC + 5; i++) - PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i]; - PortP->FirstOpen = 0; - } else if (PortP->Store || PortP->Lock) { - rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n"); - TtyP->tm.c_iflag = PortP->StoredTty.iflag; - TtyP->tm.c_oflag = PortP->StoredTty.oflag; - TtyP->tm.c_cflag = PortP->StoredTty.cflag; - TtyP->tm.c_lflag = PortP->StoredTty.lflag; - TtyP->tm.c_line = PortP->StoredTty.line; - for (i = 0; i < NCC + 5; i++) - TtyP->tm.c_cc[i] = PortP->StoredTty.cc[i]; - } -#endif } /* @@ -273,16 +252,6 @@ int SleepFlag; phb_param_ptr = (struct phb_param *) PacketP->data; -#if 0 - /* - ** COR 1 - */ - if (TtyP->tm.c_iflag & INPCK) { - rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); - Cor1 |= COR1_INPCK; - } -#endif - switch (TtyP->termios->c_cflag & CSIZE) { case CS5: { @@ -524,10 +493,6 @@ int SleepFlag; if (TtyP->termios->c_cflag & XMT1EN) rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n"); #endif -#if 0 - if (TtyP->termios->c_cflag & LOBLK) - rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); -#endif if (TtyP->termios->c_lflag & ISIG) rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); if (TtyP->termios->c_lflag & ICANON) @@ -572,14 +537,6 @@ int SleepFlag; rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n"); if (TtyP->termios->c_oflag & TABDLY) rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n"); -#if 0 - if (TtyP->termios->c_oflag & BSDLY) - rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n"); - if (TtyP->termios->c_oflag & VTDLY) - rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n"); - if (TtyP->termios->c_oflag & FFDLY) - rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n"); -#endif /* ** These things are kind of useful in a later life! */ diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index 0f4cd33ba64..f98888f5265 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c @@ -112,15 +112,6 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) int Lies; unsigned long flags; -#ifdef STACK - RIOStackCheck("RIORouteRup"); -#endif -#ifdef CHECK - CheckPacketP(PacketP); - CheckHostP(HostP); - CheckRup(Rup); - CheckHost(Host); -#endif /* ** Is this unit telling us it's current link topology? */ @@ -540,9 +531,6 @@ uint unit; for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { ushort dest_port = port + 8; -#if 0 - uint PktInt; -#endif WORD *TxPktP; PKT *Pkt; @@ -623,10 +611,6 @@ uint UnitId; unsigned long flags; rio_spin_lock_irqsave(&HostP->HostLock, flags); -#ifdef CHECK - CheckHostP(HostP); - CheckUnitId(UnitId); -#endif if (RIOCheck(HostP, UnitId)) { rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); rio_spin_unlock_irqrestore(&HostP->HostLock, flags); @@ -651,10 +635,6 @@ uint UnitId; { uint link, unit; -#ifdef CHECK - CheckHostP(HostP); - CheckUnitId(UnitId); -#endif UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */ @@ -684,10 +664,6 @@ uint UnitId; { unsigned char link; -#ifdef CHECK - CheckHostP(HostP); - CheckUnitId(UnitId); -#endif /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index 42c3dffcbbb..a86b216ab65 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c @@ -754,11 +754,6 @@ struct Map *HostMapP; ushort RtaType; unsigned long flags; -#ifdef CHECK - CheckHostP(HostP); - CheckHostMapP(HostMapP); -#endif - rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); /* @@ -784,9 +779,6 @@ struct Map *HostMapP; rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); PortP = p->RIOPortp[SysPort]; -#if 0 - PortP->TtyP = &p->channel[SysPort]; -#endif rio_dprintk(RIO_DEBUG_TABLE, "Map port\n"); /* diff --git a/drivers/char/rio/riotime.h b/drivers/char/rio/riotime.h deleted file mode 100644 index 35e01cd103d..00000000000 --- a/drivers/char/rio/riotime.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* T I M E - ******* ******* - **************************************************************************** - - Author : Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _riotime_h -#define _riotime_h 1 - -#ifndef lint -#ifdef SCCS -static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1"; -#endif -#endif - -#define TWO_POWER_FIFTEEN (ushort)32768 -#define RioTime() riotime -#define RioTimeAfter(time1,time2) ((ushort)time1 - (ushort)time2) < TWO_POWER_FIFTEEN -#define RioTimePlus(time1,time2) ((ushort)time1 + (ushort)time2) - -/************************************** - * Convert a RIO tick (1/10th second) - * into transputer low priority ticks - *************************************/ -#define RioTimeToLow(time) (time*(100000 / 64)) -#define RioLowToTime(time) ((time*64)/100000) - -#define RIOTENTHSECOND (ushort)1 -#define RIOSECOND (ushort)(RIOTENTHSECOND * 10) -#endif - -/*********** end of file ***********/ diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 5894a25b011..6379816ed17 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c @@ -89,16 +89,9 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; #include "list.h" #include "sam.h" -#if 0 -static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int); -#endif - static void RIOClearUp(struct Port *PortP); int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); -#if 0 -static int RIOCookMode(struct ttystatics *); -#endif extern int conv_vb[]; /* now defined in ttymgr.c */ extern int conv_bv[]; /* now defined in ttymgr.c */ @@ -226,33 +219,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) ** until the RTA is present then we must spin here waiting for ** the RTA to boot. */ -#if 0 - if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { - if (PortP->WaitUntilBooted) { - rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); - do { - if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { - rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); - func_exit(); - return -EINTR; - } - if (repeat_this-- <= 0) { - rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); - RIOPreemptiveCmd(p, PortP, FCLOSE); - pseterr(EINTR); - func_exit(); - return -EIO; - } - } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); - rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); - } else { - rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); - pseterr(ENXIO); - func_exit(); - return 0; - } - } -#else /* I find the above code a bit hairy. I find the below code easier to read and shorter. Now, if it works too that would be great... -- REW @@ -281,21 +247,10 @@ int riotopen(struct tty_struct *tty, struct file *filp) } } rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); -#endif -#if 0 - tp = PortP->TtyP; /* get tty struct */ -#endif rio_spin_lock_irqsave(&PortP->portSem, flags); if (p->RIOHalted) { goto bombout; } -#if 0 - retval = gs_init_port(&PortP->gs); - if (retval) { - func_exit(); - return retval; - } -#endif /* ** If the port is in the final throws of being closed, @@ -363,11 +318,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) command piggybacks the parameters immediately. -- REW */ RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ -#if 0 - /* This delay of 1 second was annoying. I removed it. -- REW */ - RIODelay(PortP, HUNDRED_MS * 10); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */ -#endif rio_spin_lock_irqsave(&PortP->portSem, flags); /* @@ -439,9 +389,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) PortP->State |= RIO_WOPEN; rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) -#if 0 - if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH)) -#endif { /* ** ACTION: verify that this is a good thing @@ -505,10 +452,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) */ int riotclose(void *ptr) { -#if 0 - register uint SysPort = dev; - struct ttystatics *tp; /* pointer to our ttystruct */ -#endif struct Port *PortP = ptr; /* pointer to the port structure */ int deleted = 0; int try = -1; /* Disable the timeouts by setting them to -1 */ @@ -534,13 +477,6 @@ int riotclose(void *ptr) end_time = jiffies + MAX_SCHEDULE_TIMEOUT; Modem = rio_ismodem(tty); -#if 0 - /* What F.CKING cache? Even then, a higly idle multiprocessor, - system with large caches this won't work . Better find out when - this doesn't work asap, and fix the cause. -- REW */ - - RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */ -#endif rio_spin_lock_irqsave(&PortP->portSem, flags); /* @@ -703,45 +639,6 @@ int riotclose(void *ptr) } -/* -** decide if we need to use the line discipline. -** This routine can return one of three values: -** COOK_RAW if no processing has to be done by the line discipline or the card -** COOK_WELL if the line discipline must be used to do the processing -** COOK_MEDIUM if the card can do all the processing necessary. -*/ -#if 0 -static int RIOCookMode(struct ttystatics *tp) -{ - /* - ** We can't handle tm.c_mstate != 0 on SCO - ** We can't handle mapping - ** We can't handle non-ttwrite line disc. - ** We can't handle lflag XCASE - ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3) - */ - -#ifdef CHECK - CheckTtyP(tp); -#endif - if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ - return COOK_RAW; /* Raw mode o/p */ - - if (tp->tm.c_lflag & XCASE) - return COOK_WELL; /* Use line disc */ - - if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3)) - return COOK_WELL; /* Use line disc for strange modes */ - - if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */ - return COOK_RAW; - - /* - ** So, we need to output process! - */ - return COOK_MEDIUM; -} -#endif static void RIOClearUp(PortP) struct Port *PortP; @@ -776,11 +673,6 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len unsigned long flags; rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); -#ifdef CHECK - CheckPortP(PortP); - if (len < 1 || len > 2) - cprintf(("STUPID LENGTH %d\n", len)); -#endif if (PortP->State & RIO_DELETED) { rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); @@ -852,478 +744,3 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len } -#if 0 -/* -** This is an ioctl interface. This is the twentieth century. You know what -** its all about. -*/ -int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) -{ - register struct Port *PortP; - register struct ttystatics *tp; - int current; - int ParamSemIncremented = 0; - int old_oflag, old_cflag, old_iflag, changed, oldcook; - int i; - unsigned char sio_regs[5]; /* Here be magic */ - short vpix_cflag; - short divisor; - int baud; - uint SysPort = rio_minor(tty); - int Modem = rio_ismodem(tty); - int ioctl_processed; - - rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty"); - - if (SysPort >= RIO_PORTS) { - rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); - return -ENXIO; - } - - PortP = p->RIOPortp[SysPort]; - tp = PortP->TtyP; - - rio_spin_lock_irqsave(&PortP->portSem, flags); - -#ifdef STATS - PortP->Stat.IoctlCnt++; -#endif - - if (PortP->State & RIO_DELETED) { - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return -EIO; - } - - - if (p->RIOHalted) { - RIOClearUp(PortP); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return -EIO; - } - - /* - ** Count ioctls for port statistics reporting - */ - if (PortP->statsGather) - PortP->ioctls++; - - /* - ** Specialix RIO Ioctl calls - */ - switch (cmd) { - - case TCRIOTRIAD: - if (arg) - PortP->State |= RIO_TRIAD_MODE; - else - PortP->State &= ~RIO_TRIAD_MODE; - /* - ** Normally, when istrip is set on a port, a config is - ** sent to the RTA instructing the CD1400 to do the - ** stripping. In TRIAD mode, the interrupt receive routine - ** must do the stripping instead, since it has to detect - ** an 8 bit function key sequence. If istrip is set with - ** TRIAD mode on(off), and 8 bit data is being read by - ** the port, the user then turns TRIAD mode off(on), the RTA - ** must be reconfigured (not) to do the stripping. - ** Hence we call RIOParam here. - */ - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - return 0; - - case TCRIOTSTATE: - rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis"); - /* MonitorTstate = 0 ; */ - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - return 0; - - case TCRIOSTATE: /* current state of Modem input pins */ - rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n"); - if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) - rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); - PortP->State |= RIO_BUSY; - current = PortP->ModemState; - if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) { - rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n"); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EFAULT); - } - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOMBIS: /* Set modem lines */ - case TCRIOMBIC: /* Clear modem lines */ - rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); - if (cmd == TCRIOMBIS) { - uint state; - state = (uint) arg; - PortP->ModemState |= (ushort) state; - PortP->ModemLines = (ulong) arg; - if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) - rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n"); - } else { - uint state; - - state = (uint) arg; - PortP->ModemState &= ~(ushort) state; - PortP->ModemLines = (ulong) arg; - if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) - rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); - } - PortP->State |= RIO_BUSY; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOXPON: /* set Xprint ON string */ - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n"); - if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) { - rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); - PortP->Xprint.XpOn[0] = '\0'; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EFAULT); - } - PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; - PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOXPOFF: /* set Xprint OFF string */ - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n"); - if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) { - rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); - PortP->Xprint.XpOff[0] = '\0'; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EFAULT); - } - PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; - PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOXPCPS: /* set Xprint CPS string */ - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n"); - if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) { - rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EINVAL); - return 0; - } - PortP->Xprint.XpCps = (uint) arg; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOXPRINT: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n"); - if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) { - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EFAULT); - } - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOIXANYON: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n"); - PortP->Config |= RIO_IXANY; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOIXANYOFF: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); - PortP->Config &= ~RIO_IXANY; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOIXONON: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n"); - PortP->Config |= RIO_IXON; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - - case TCRIOIXONOFF: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); - PortP->Config &= ~RIO_IXON; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; - -/* -** 15.10.1998 ARG - ESIL 0761 part fix -** Added support for CTS and RTS flow control ioctls : -*/ - case TCRIOCTSFLOWEN: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); - PortP->Config |= RIO_CTSFLOW; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - return 0; - - case TCRIOCTSFLOWDIS: - rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); - PortP->Config &= ~RIO_CTSFLOW; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - return 0; - - case TCRIORTSFLOWEN: - rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); - PortP->Config |= RIO_RTSFLOW; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - return 0; - - case TCRIORTSFLOWDIS: - rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); - PortP->Config &= ~RIO_RTSFLOW; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - return 0; - -/* end ESIL 0761 part fix */ - - } - - - /* Lynx IOCTLS */ - switch (cmd) { - case TIOCSETP: - case TIOCSETN: - case OTIOCSETP: - case OTIOCSETN: - ioctl_processed++; - ttyseth(PortP, tp, (struct old_sgttyb *) arg); - break; - case TCSETA: - case TCSETAW: - case TCSETAF: - ioctl_processed++; - rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n"); - ttyseth_pv(PortP, tp, (struct termios *) arg, 0); - break; - case TCSETAP: /* posix tcsetattr() */ - case TCSETAWP: /* posix tcsetattr() */ - case TCSETAFP: /* posix tcsetattr() */ - rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); - ttyseth_pv(PortP, tp, (struct termios *) arg, 1); - ioctl_processed++; - break; - } - - /* - ** If its any of the commands that require the port to be in the - ** non-busy state wait until all output has drained - */ - if (!ioctl_processed) - switch (cmd) { - case TCSETAW: - case TCSETAF: - case TCSETA: - case TCSBRK: -#define OLD_POSIX ('x' << 8) -#define OLD_POSIX_SETA (OLD_POSIX | 2) -#define OLD_POSIX_SETAW (OLD_POSIX | 3) -#define OLD_POSIX_SETAF (OLD_POSIX | 4) -#define NEW_POSIX (('i' << 24) | ('X' << 16)) -#define NEW_POSIX_SETA (NEW_POSIX | 2) -#define NEW_POSIX_SETAW (NEW_POSIX | 3) -#define NEW_POSIX_SETAF (NEW_POSIX | 4) - case OLD_POSIX_SETA: - case OLD_POSIX_SETAW: - case OLD_POSIX_SETAF: - case NEW_POSIX_SETA: - case NEW_POSIX_SETAW: - case NEW_POSIX_SETAF: -#ifdef TIOCSETP - case TIOCSETP: -#endif - case TIOCSETD: - case TIOCSETN: - rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); - /* - ** Wait for drain here, at least as far as the double buffer - ** being empty. - */ - /* XXX Does the above comment mean that this has - still to be implemented? -- REW */ - /* XXX Is the locking OK together with locking - in txenable? (Deadlock?) -- REW */ - - RIOTxEnable((char *) PortP); - break; - default: - break; - } - - old_cflag = tp->tm.c_cflag; - old_iflag = tp->tm.c_iflag; - old_oflag = tp->tm.c_oflag; - oldcook = PortP->CookMode; - - if (p->RIOHalted) { - RIOClearUp(PortP); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EIO); - return 0; - } - - PortP->FlushCmdBodge = 0; - - /* - ** If the port is locked, and it is reconfigured, we want - ** to restore the state of the tty structure so the change is NOT - ** made. - */ - if (PortP->Lock) { - tp->tm.c_iflag = PortP->StoredTty.iflag; - tp->tm.c_oflag = PortP->StoredTty.oflag; - tp->tm.c_cflag = PortP->StoredTty.cflag; - tp->tm.c_lflag = PortP->StoredTty.lflag; - tp->tm.c_line = PortP->StoredTty.line; - for (i = 0; i < NCC + 1; i++) - tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; - } else { - /* - ** If the port is set to store the parameters, and it is - ** reconfigured, we want to save the current tty struct so it - ** may be restored on the next open. - */ - if (PortP->Store) { - PortP->StoredTty.iflag = tp->tm.c_iflag; - PortP->StoredTty.oflag = tp->tm.c_oflag; - PortP->StoredTty.cflag = tp->tm.c_cflag; - PortP->StoredTty.lflag = tp->tm.c_lflag; - PortP->StoredTty.line = tp->tm.c_line; - for (i = 0; i < NCC + 1; i++) - PortP->StoredTty.cc[i] = tp->tm.c_cc[i]; - } - } - - changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag); - - PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ - - rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook); - -#ifdef MODEM_SUPPORT - /* - ** kludge to force CARR_ON if CLOCAL set - */ - if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { - tp->tm.c_state |= CARR_ON; - wakeup((caddr_t) & tp->tm.c_canq); - } -#endif - - if (p->RIOHalted) { - RIOClearUp(PortP); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EIO); - return 0; - } - /* - ** Re-configure if modes or cooking have changed - */ - if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); - RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); - rio_spin_lock_irqsave(&PortP->portSem, flags); - } - - if (p->RIOHalted) { - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - RIOClearUp(PortP); - pseterr(EIO); - return 0; - } - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return 0; -} - -/* - ttyseth -- set hardware dependent tty settings -*/ -void ttyseth(PortP, s, sg) -struct Port *PortP; -struct ttystatics *s; -struct old_sgttyb *sg; -{ - struct old_sgttyb *tsg; - struct termios *tp = &s->tm; - - tsg = &s->sg; - - if (sg->sg_flags & (EVENP | ODDP)) { - tp->c_cflag &= PARENB; - if (sg->sg_flags & EVENP) { - if (sg->sg_flags & ODDP) { - tp->c_cflag &= V_CS7; - tp->c_cflag &= ~PARENB; - } else { - tp->c_cflag &= V_CS7; - tp->c_cflag &= PARENB; - tp->c_cflag &= PARODD; - } - } else if (sg->sg_flags & ODDP) { - tp->c_cflag &= V_CS7; - tp->c_cflag &= PARENB; - tp->c_cflag &= PARODD; - } else { - tp->c_cflag &= V_CS7; - tp->c_cflag &= PARENB; - } - } -/* - * Use ispeed as the desired speed. Most implementations don't handle - * separate input and output speeds very well. If the RIO handles this, - * I will have to use separate sets of flags to store them in the - * Port structure. - */ - if (!sg->sg_ospeed) - sg->sg_ospeed = sg->sg_ispeed; - else - sg->sg_ispeed = sg->sg_ospeed; - if (sg->sg_ispeed > V_EXTB) - sg->sg_ispeed = V_EXTB; - if (sg->sg_ispeed < V_B0) - sg->sg_ispeed = V_B0; - *tsg = *sg; - tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed]; -} - -/* - ttyseth_pv -- set hardware dependent tty settings using either the - POSIX termios structure or the System V termio structure. - sysv = 0 => (POSIX): struct termios *sg - sysv != 0 => (System V): struct termio *sg -*/ -static void ttyseth_pv(PortP, s, sg, sysv) -struct Port *PortP; -struct ttystatics *s; -struct termios *sg; -int sysv; -{ - int speed; - unsigned char csize; - unsigned char cread; - unsigned int lcr_flags; - int ps; - - if (sysv) { - /* sg points to a System V termio structure */ - csize = ((struct termio *) sg)->c_cflag & CSIZE; - cread = ((struct termio *) sg)->c_cflag & CREAD; - speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD]; - } else { - /* sg points to a POSIX termios structure */ - csize = sg->c_cflag & CSIZE; - cread = sg->c_cflag & CREAD; - speed = conv_vb[sg->c_cflag & V_CBAUD]; - } - if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { - s->sg.sg_ispeed = speed; - s->sg.sg_ospeed = speed; - s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed]; - } -} -#endif diff --git a/drivers/char/rio/riowinif.h b/drivers/char/rio/riowinif.h deleted file mode 100644 index f802d7593b8..00000000000 --- a/drivers/char/rio/riowinif.h +++ /dev/null @@ -1,1329 +0,0 @@ -/************************************************************************/ -/* */ -/* Title : RIO Shared Memory Window Inteface */ -/* */ -/* Author : N.P.Vassallo */ -/* */ -/* Creation : 7th June 1999 */ -/* */ -/* Version : 1.0.0 */ -/* */ -/* Copyright : (c) Specialix International Ltd. 1999 * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ -/* Description : Prototypes, structures and definitions */ -/* describing RIO host card shared memory */ -/* window interface structures: */ -/* PARMMAP */ -/* RUP */ -/* PHB */ -/* LPB */ -/* PKT */ -/* */ -/************************************************************************/ - -/* History... - -1.0.0 07/06/99 NPV Creation. (based on PARMMAP.H) - -*/ - -#ifndef _riowinif_h /* If RIOWINDIF.H not already defined */ -#define _riowinif_h 1 - -/***************************************************************************** -******************************** ********************************* -******************************** General ********************************* -******************************** ********************************* -*****************************************************************************/ - -#define TPNULL ((_u16)(0x8000)) - -/***************************************************************************** -******************************** ******************************** -******************************** PARM_MAP ******************************** -******************************** ******************************** -*****************************************************************************/ - -/* The PARM_MAP structure defines global values relating to the Host Card / RTA - and is the main structure from which all other structures are referenced. */ - -typedef struct _PARM_MAP { - _u16 phb_ptr; /* 0x00 Pointer to the PHB array */ - _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ - _u16 free_list; /* 0x04 Free List pointer */ - _u16 free_list_end; /* 0x06 Free List End pointer */ - _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */ - _u16 unit_id_ptr; /* 0x0A Unit Id */ - _u16 link_str_ptr; /* 0x0C Link Structure Array */ - _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */ - _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */ - _u16 port_route_map_ptr; /* 0x12 Port Route Map */ - _u16 route_ptr; /* 0x14 Route Map */ - _u16 map_present; /* 0x16 Route Map present */ - _u16 pkt_num; /* 0x18 Total number of packets */ - _u16 q_num; /* 0x1A Total number of Q packets */ - _u16 buffers_per_port; /* 0x1C Number of buffers per port */ - _u16 heap_size; /* 0x1E Initial size of heap */ - _u16 heap_left; /* 0x20 Current Heap left */ - _u16 error; /* 0x22 Error code */ - _u16 tx_max; /* 0x24 Max number of tx pkts per phb */ - _u16 rx_max; /* 0x26 Max number of rx pkts per phb */ - _u16 rx_limit; /* 0x28 For high / low watermarks */ - _u16 links; /* 0x2A Links to use */ - _u16 timer; /* 0x2C Interrupts per second */ - _u16 rups; /* 0x2E Pointer to the RUPs */ - _u16 max_phb; /* 0x30 Mostly for debugging */ - _u16 living; /* 0x32 Just increments!! */ - _u16 init_done; /* 0x34 Initialisation over */ - _u16 booting_link; /* 0x36 */ - _u16 idle_count; /* 0x38 Idle time counter */ - _u16 busy_count; /* 0x3A Busy counter */ - _u16 idle_control; /* 0x3C Control Idle Process */ - _u16 tx_intr; /* 0x3E TX interrupt pending */ - _u16 rx_intr; /* 0x40 RX interrupt pending */ - _u16 rup_intr; /* 0x42 RUP interrupt pending */ - -} PARM_MAP; - -/* Same thing again, but defined as offsets... */ - -#define PM_phb_ptr 0x00 /* 0x00 Pointer to the PHB array */ -#define PM_phb_num_ptr 0x02 /* 0x02 Ptr to Number of PHB's */ -#define PM_free_list 0x04 /* 0x04 Free List pointer */ -#define PM_free_list_end 0x06 /* 0x06 Free List End pointer */ -#define PM_q_free_list_ptr 0x08 /* 0x08 Ptr to Q_BUF variable */ -#define PM_unit_id_ptr 0x0A /* 0x0A Unit Id */ -#define PM_link_str_ptr 0x0C /* 0x0C Link Structure Array */ -#define PM_bootloader_1 0x0E /* 0x0E 1st Stage Boot Loader */ -#define PM_bootloader_2 0x10 /* 0x10 2nd Stage Boot Loader */ -#define PM_port_route_map_ptr 0x12 /* 0x12 Port Route Map */ -#define PM_route_ptr 0x14 /* 0x14 Route Map */ -#define PM_map_present 0x16 /* 0x16 Route Map present */ -#define PM_pkt_num 0x18 /* 0x18 Total number of packets */ -#define PM_q_num 0x1A /* 0x1A Total number of Q packets */ -#define PM_buffers_per_port 0x1C /* 0x1C Number of buffers per port */ -#define PM_heap_size 0x1E /* 0x1E Initial size of heap */ -#define PM_heap_left 0x20 /* 0x20 Current Heap left */ -#define PM_error 0x22 /* 0x22 Error code */ -#define PM_tx_max 0x24 /* 0x24 Max number of tx pkts per phb */ -#define PM_rx_max 0x26 /* 0x26 Max number of rx pkts per phb */ -#define PM_rx_limit 0x28 /* 0x28 For high / low watermarks */ -#define PM_links 0x2A /* 0x2A Links to use */ -#define PM_timer 0x2C /* 0x2C Interrupts per second */ -#define PM_rups 0x2E /* 0x2E Pointer to the RUPs */ -#define PM_max_phb 0x30 /* 0x30 Mostly for debugging */ -#define PM_living 0x32 /* 0x32 Just increments!! */ -#define PM_init_done 0x34 /* 0x34 Initialisation over */ -#define PM_booting_link 0x36 /* 0x36 */ -#define PM_idle_count 0x38 /* 0x38 Idle time counter */ -#define PM_busy_count 0x3A /* 0x3A Busy counter */ -#define PM_idle_control 0x3C /* 0x3C Control Idle Process */ -#define PM_tx_intr 0x3E /* 0x4E TX interrupt pending */ -#define PM_rx_intr 0x40 /* 0x40 RX interrupt pending */ -#define PM_rup_intr 0x42 /* 0x42 RUP interrupt pending */ -#define sizeof_PARM_MAP 0x44 /* structure size = 0x44 */ - -/* PARM_MAP.error definitions... */ -#define E_NO_ERROR 0x00 -#define E_PROCESS_NOT_INIT 0x01 -#define E_LINK_TIMEOUT 0x02 -#define E_NO_ROUTE 0x03 -#define E_CONFUSED 0x04 -#define E_HOME 0x05 -#define E_CSUM_FAIL 0x06 -#define E_DISCONNECTED 0x07 -#define E_BAD_RUP 0x08 -#define E_NO_VIRGIN 0x09 -#define E_BOOT_RUP_BUSY 0x10 -#define E_CHANALLOC 0x80 -#define E_POLL_ALLOC 0x81 -#define E_LTTWAKE 0x82 -#define E_LTT_ALLOC 0x83 -#define E_LRT_ALLOC 0x84 -#define E_CIRRUS 0x85 -#define E_MONITOR 0x86 -#define E_PHB_ALLOC 0x87 -#define E_ARRAY_ALLOC 0x88 -#define E_QBUF_ALLOC 0x89 -#define E_PKT_ALLOC 0x8a -#define E_GET_TX_Q_BUF 0x8b -#define E_GET_RX_Q_BUF 0x8c -#define E_MEM_OUT 0x8d -#define E_MMU_INIT 0x8e -#define E_LTT_INIT 0x8f -#define E_LRT_INIT 0x90 -#define E_LINK_RUN 0x91 -#define E_MONITOR_ALLOC 0x92 -#define E_MONITOR_INIT 0x93 -#define E_POLL_INIT 0x94 - -/* PARM_MAP.links definitions... */ -#define RIO_LINK_ENABLE 0x80FF - -/***************************************************************************** -********************************** *********************************** -********************************** RUP *********************************** -********************************** *********************************** -*****************************************************************************/ - -/* The RUP (Remote Unit Port) structure relates to the Remote Terminal Adapters - attached to the system and there is normally an array of MAX_RUPS (=16) structures - in a host card, defined by PARM_MAP->rup. */ - -typedef struct _RUP { - _u16 txpkt; /* 0x00 Outgoing packet */ - _u16 rxpkt; /* 0x02 ncoming packet */ - _u16 link; /* 0x04 Which link to send packet down ? */ - _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */ - _u16 handshake; /* 0x08 Handshaking */ - _u16 timeout; /* 0x0A Timeout */ - _u16 status; /* 0x0C Status */ - _u16 txcontrol; /* 0x0E Transmit control */ - _u16 rxcontrol; /* 0x10 Receive control */ - -} RUP; - -/* Same thing again, but defined as offsets... */ - -#define RUP_txpkt 0x00 /* 0x00 Outgoing packet */ -#define RUP_rxpkt 0x02 /* 0x02 Incoming packet */ -#define RUP_link 0x04 /* 0x04 Which link to send packet down ? */ -#define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */ -#define RUP_handshake 0x08 /* 0x08 Handshaking */ -#define RUP_timeout 0x0A /* 0x0A Timeout */ -#define RUP_status 0x0C /* 0x0C Status */ -#define RUP_txcontrol 0x0E /* 0x0E Transmit control */ -#define RUP_rxcontrol 0x10 /* 0x10 Receive control */ -#define sizeof_RUP 0x12 /* structure size = 0x12 */ - -#define MAX_RUP 16 - -/* RUP.txcontrol definitions... */ -#define TX_RUP_INACTIVE 0 /* Nothing to transmit */ -#define TX_PACKET_READY 1 /* Transmit packet ready */ -#define TX_LOCK_RUP 2 /* Transmit side locked */ - -/* RUP.txcontrol definitions... */ -#define RX_RUP_INACTIVE 0 /* Nothing received */ -#define RX_PACKET_READY 1 /* Packet received */ - -#define RUP_NO_OWNER 0xFF /* RUP not owned by any process */ - -/***************************************************************************** -********************************** *********************************** -********************************** PHB *********************************** -********************************** *********************************** -*****************************************************************************/ - -/* The PHB (Port Header Block) structure relates to the serial ports attached - to the system and there is normally an array of MAX_PHBS (=128) structures - in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */ - -typedef struct _PHB { - _u16 source; /* 0x00 Location of the PHB in the host card */ - _u16 handshake; /* 0x02 Used to manage receive packet flow control */ - _u16 status; /* 0x04 Internal port transmit/receive status */ - _u16 timeout; /* 0x06 Time period to wait for an ACK */ - _u16 link; /* 0x08 The host link associated with the PHB */ - _u16 destination; /* 0x0A Location of the remote port on the network */ - - _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */ - _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */ - _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */ - _u16 tx_remove; /* 0x12 current position in the packet pointer array */ - - _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */ - _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */ - _u16 rx_add; /* 0x18 position in the packet array for new receive packets */ - _u16 rx_remove; /* 0x1A current position in the packet pointer array */ - -} PHB; - -/* Same thing again, but defined as offsets... */ - -#define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */ -#define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */ -#define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */ -#define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */ -#define PHB_link 0x08 /* 0x08 The host link associated with the PHB */ -#define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */ -#define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */ -#define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */ -#define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */ -#define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */ -#define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */ -#define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */ -#define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */ -#define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */ -#define sizeof_PHB 0x1C /* structure size = 0x1C */ - -/* PHB.handshake definitions... */ -#define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */ -#define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */ -#define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET) - /* Reset by ltt */ - -#define MAX_PHB 128 /* range 0-127 */ - -/***************************************************************************** -********************************** *********************************** -********************************** LPB *********************************** -********************************** *********************************** -*****************************************************************************/ - -/* The LPB (Link Parameter Block) structure relates to a RIO Network Link - and there is normally an array of MAX_LINKS (=4) structures in a host card, - defined by PARM_MAP->link_str_ptr. */ - -typedef struct _LPB { - _u16 link_number; /* 0x00 Link Number */ - _u16 in_ch; /* 0x02 Link In Channel */ - _u16 out_ch; /* 0x04 Link Out Channel */ - _u8 attached_serial[4]; /* 0x06 Attached serial number */ - _u8 attached_host_serial[4]; /* 0x0A Serial number of Host who booted other end */ - _u16 descheduled; /* 0x0E Currently Descheduled */ - _u16 state; /* 0x10 Current state */ - _u16 send_poll; /* 0x12 Send a Poll Packet */ - _u16 ltt_p; /* 0x14 Process Descriptor */ - _u16 lrt_p; /* 0x16 Process Descriptor */ - _u16 lrt_status; /* 0x18 Current lrt status */ - _u16 ltt_status; /* 0x1A Current ltt status */ - _u16 timeout; /* 0x1C Timeout value */ - _u16 topology; /* 0x1E Topology bits */ - _u16 mon_ltt; /* 0x20 */ - _u16 mon_lrt; /* 0x22 */ - _u16 num_pkts; /* 0x24 */ - _u16 add_packet_list; /* 0x26 Add packets to here */ - _u16 remove_packet_list; /* 0x28 Send packets from here */ - - _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */ - _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */ - - RUP rup; /* 0x2E RUP structure for HOST to driver comms */ - RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */ - _u16 attached_link; /* 0x52 Number of attached link */ - _u16 csum_errors; /* 0x54 csum errors */ - _u16 num_disconnects; /* 0x56 number of disconnects */ - _u16 num_sync_rcvd; /* 0x58 # sync's received */ - _u16 num_sync_rqst; /* 0x5A # sync requests */ - _u16 num_tx; /* 0x5C Num pkts sent */ - _u16 num_rx; /* 0x5E Num pkts received */ - _u16 module_attached; /* 0x60 Module tpyes of attached */ - _u16 led_timeout; /* 0x62 LED timeout */ - _u16 first_port; /* 0x64 First port to service */ - _u16 last_port; /* 0x66 Last port to service */ - -} LPB; - -/* Same thing again, but defined as offsets... */ - -#define LPB_link_number 0x00 /* 0x00 Link Number */ -#define LPB_in_ch 0x02 /* 0x02 Link In Channel */ -#define LPB_out_ch 0x04 /* 0x04 Link Out Channel */ -#define LPB_attached_serial 0x06 /* 0x06 Attached serial number */ -#define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */ -#define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */ -#define LPB_state 0x10 /* 0x10 Current state */ -#define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */ -#define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */ -#define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */ -#define LPB_lrt_status 0x18 /* 0x18 Current lrt status */ -#define LPB_ltt_status 0x1A /* 0x1A Current ltt status */ -#define LPB_timeout 0x1C /* 0x1C Timeout value */ -#define LPB_topology 0x1E /* 0x1E Topology bits */ -#define LPB_mon_ltt 0x20 /* 0x20 */ -#define LPB_mon_lrt 0x22 /* 0x22 */ -#define LPB_num_pkts 0x24 /* 0x24 */ -#define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */ -#define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */ -#define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */ -#define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */ -#define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */ -#define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */ -#define LPB_attached_link 0x52 /* 0x52 Number of attached link */ -#define LPB_csum_errors 0x54 /* 0x54 csum errors */ -#define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */ -#define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */ -#define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */ -#define LPB_num_tx 0x5C /* 0x5C Num pkts sent */ -#define LPB_num_rx 0x5E /* 0x5E Num pkts received */ -#define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */ -#define LPB_led_timeout 0x62 /* 0x62 LED timeout */ -#define LPB_first_port 0x64 /* 0x64 First port to service */ -#define LPB_last_port 0x66 /* 0x66 Last port to service */ -#define sizeof_LPB 0x68 /* structure size = 0x68 */ - -#define LINKS_PER_UNIT 4 /* number of links from a host */ - -/***************************************************************************** -******************************** ******************************* -******************************** FREE_LIST ******************************* -******************************** ******************************* -*****************************************************************************/ - -/* Used to overlay packet headers when allocating/freeing packets from the free list */ - -typedef struct _FREE_LIST { - _u16 next; /* 0x00 offset of next list item */ - _u16 prev; /* 0x02 offset of previous list item */ - -} FREE_LIST; - -/* Same thing again, but defined as offsets... */ - -#define FL_next 0x00 /* 0x00 offset of next list item */ -#define FL_prev 0x02 /* 0x02 offset of previous list item */ - -/***************************************************************************** -********************************** *********************************** -********************************** PKT *********************************** -********************************** *********************************** -*****************************************************************************/ - -/* The PKT is the main unit of communication between Host Cards and RTAs across - the RIO network. */ - -#define PKT_MAX_DATA_LEN 72 /* Size of packet data */ - -typedef struct _PKT { - _u8 dest_unit; /* 0x00 Destination Unit Id */ - _u8 dest_port; /* 0x01 Destination Port */ - _u8 src_unit; /* 0x02 Source Unit Id */ - _u8 src_port; /* 0x03 Source Port */ - _u8 len; /* 0x04 Length (in bytes) of data field */ - _u8 control; /* 0x05 */ - _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */ - _u16 csum; /* 0x4E C-SUM */ - -} PKT; - -/* Same thing again, but defined as offsets... */ - -#define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */ -#define PKT_dest_port 0x01 /* 0x01 Destination Port */ -#define PKT_src_unit 0x02 /* 0x02 Source Unit Id */ -#define PKT_src_port 0x03 /* 0x03 Source Port */ -#define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */ -#define PKT_control 0x05 /* 0x05 */ -#define PKT_data 0x06 /* 0x06 Actual data */ -#define PKT_csum 0x4E /* 0x4E C-SUM */ -#define sizeof_PKT 0x50 /* structure size = 0x50 */ - -/* PKT.len definitions... */ -#define PKT_CMD_BIT 0x80 -#define PKT_CMD_DATA 0x80 -#define PKT_LEN_MASK 0x7F - -/* PKT.control definitions... */ -#define PKT_ACK 0x40 -#define PKT_TGL 0x20 -#define DATA_WNDW 0x10 -#define PKT_TTL_MASK 0x0F -#define MAX_TTL 0x0F - -/***************************************************************************** -***************************** **************************** -***************************** Control Packets **************************** -***************************** **************************** -*****************************************************************************/ - -/* The following definitions and structures define the control packets sent - between the driver and RIO Ports, RTAs and Host Cards. */ - -#define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */ - -/* "in-band" and "pre-emptive" port commands... */ -#define OPEN 0x00 /* Driver->RIO Open a port */ -#define CONFIG 0x01 /* Driver->RIO Configure a port */ -#define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */ -#define CLOSE 0x03 /* Driver->RIO Close a port */ -#define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */ -#define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */ -#define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */ -#define SBREAK 0x07 /* Driver->RIO Start break */ -#define EBREAK 0x08 /* Driver->RIO End break */ -#define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */ -#define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */ -#define XPRINT 0x0B /* Driver->RIO Xprint packet */ -#define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ -#define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */ -#define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ -#define PCLOSE 0x0F /* Driver->RIO Pseudo close */ -#define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */ -#define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */ -#define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */ - -/* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */ -#define SYNC_RUP 0xFF /* Download internal */ -#define COMMAND_RUP 0xFE /* Command ack/status */ -#define ERROR_RUP 0xFD /* Download internal */ -#define POLL_RUP 0xFC /* Download internal */ -#define BOOT_RUP 0xFB /* Used to boot RTAs */ -#define ROUTE_RUP 0xFA /* Used to specify routing/topology */ -#define STATUS_RUP 0xF9 /* Not used */ -#define POWER_RUP 0xF8 /* Download internal */ - -/* COMMAND_RUP definitions... */ -#define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */ -#define BREAK_RECEIVED (0x21|PRE_EMPTIVE) /* RIO->Driver Break received */ -#define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */ - -/* BOOT_RUP definitions... */ -#define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */ -#define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */ -#define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */ -#define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */ -#define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */ -#define IDENTIFY 0x30 /* Driver->RIO Identify RTA */ -#define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */ -#define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */ -#define IWAIT 0x33 /* Driver->RIO Pause booting process */ - -/* ROUTE_RUP definitions... */ -#define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */ -#define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */ -#define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */ -#define ROUTE_USED 0x03 /* Driver->RIO Not used */ -#define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */ -#define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */ -#define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */ - -/***************************************************************************** -********************************** ********************************** -********************************** OPEN ********************************** -********************************** ********************************** -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - Sent to open a port. - Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */ - -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */ -#define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */ -#define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */ -#define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */ -#define PKT_TxXon (PKT_Data+5) /* Transmit XON character */ -#define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */ -#define PKT_RxXon (PKT_Data+7) /* Receive XON character */ -#define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */ -#define PKT_Lnext (PKT_Data+9) /* Lnext character */ -#define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */ -#define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */ - -/* COR1 definitions... */ -#define COR1_PARITY 0xE0 /* Parity mask */ -#define COR1_NONE 0x00 /* No parity */ -#define COR1_SPACE 0x20 /* Space parity */ -#define COR1_EVEN 0x40 /* Even parity */ -#define COR1_MARK 0xA0 /* Mark parity */ -#define COR1_ODD 0xC0 /* Odd parity */ - -#define COR1_STOPBITS 0x0C /* Stop bits mask */ -#define COR1_STOP1 0x00 /* 1 stop bit */ -#define COR1_STOP1_5 0x04 /* 1.5 stop bits */ -#define COR1_STOP2 0x08 /* 2 stop bits */ - -#define COR1_DATABITS 0x03 /* Data bits mask */ -#define COR1_DATA5 0x00 /* 5 data bits */ -#define COR1_DATA6 0x01 /* 6 data bits */ -#define COR1_DATA7 0x02 /* 7 data bits */ -#define COR1_DATA8 0x03 /* 8 data bits */ - -/* COR2 definitions... */ -#define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */ -#define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */ -#define COR2_HUPCL 0x20 /* Hang Up On Close */ -#define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */ -#define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */ -#define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */ -#define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */ - -/* COR4 definition... */ -#define COR4_IGNCR 0x80 /* Discard received CR */ -#define COR4_ICRNL 0x40 /* Map received CR -> NL */ -#define COR4_INLCR 0x20 /* Map received NL -> CR */ -#define COR4_IGNBRK 0x10 /* Ignore Received Break */ -#define COR4_NBRKINT 0x08 /* No interrupt on rx Break */ -#define COR4_IGNPAR 0x04 /* ignore rx parity error chars */ -#define COR4_PARMRK 0x02 /* Mark rx parity error chars */ -#define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */ - -/* COR5 definitions... */ -#define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */ -#define COR5_LNE 0x40 /* Enable LNEXT processing */ -#define COR5_CMOE 0x20 /* Match good & error characters */ -#define COR5_TAB3 0x10 /* TAB3 mode */ -#define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */ -#define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */ -#define COR5_ONLCR 0x02 /* NL -> CR NL on output */ -#define COR5_OCRNL 0x01 /* CR -> NL on output */ - -/* RxBaud and TxBaud definitions... */ -#define RIO_B0 0x00 /* RTS / DTR signals dropped */ -#define RIO_B50 0x01 /* 50 baud */ -#define RIO_B75 0x02 /* 75 baud */ -#define RIO_B110 0x03 /* 110 baud */ -#define RIO_B134 0x04 /* 134.5 baud */ -#define RIO_B150 0x05 /* 150 baud */ -#define RIO_B200 0x06 /* 200 baud */ -#define RIO_B300 0x07 /* 300 baud */ -#define RIO_B600 0x08 /* 600 baud */ -#define RIO_B1200 0x09 /* 1200 baud */ -#define RIO_B1800 0x0A /* 1800 baud */ -#define RIO_B2400 0x0B /* 2400 baud */ -#define RIO_B4800 0x0C /* 4800 baud */ -#define RIO_B9600 0x0D /* 9600 baud */ -#define RIO_B19200 0x0E /* 19200 baud */ -#define RIO_B38400 0x0F /* 38400 baud */ -#define RIO_B56000 0x10 /* 56000 baud */ -#define RIO_B57600 0x11 /* 57600 baud */ -#define RIO_B64000 0x12 /* 64000 baud */ -#define RIO_B115200 0x13 /* 115200 baud */ -#define RIO_B2000 0x14 /* 2000 baud */ - -/***************************************************************************** -********************************* ********************************* -********************************* CONFIG ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - CONFIG is sent from the driver to configure an already opened port. - Packet structure is same as OPEN. */ - -/***************************************************************************** -********************************* ********************************** -********************************* MOPEN ********************************** -********************************* ********************************** -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - MOPEN is sent from the driver to open a port attached to a modem. (in-band) - Packet structure is same as OPEN. */ - -/***************************************************************************** -********************************* ********************************** -********************************* CLOSE ********************************** -********************************* ********************************** -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - CLOSE is sent from the driver to close a previously opened port. - No parameters. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -/***************************************************************************** -********************************* ********************************* -********************************* WFLUSH ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - WFLUSH is sent pre-emptively from the driver to flush the write buffers and - packets of a port. (pre-emptive) - - WFLUSH is also sent in-band from the driver to a port as a marker to end - write flushing previously started by a pre-emptive WFLUSH packet. (in-band) - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ - -/***************************************************************************** -********************************* ********************************* -********************************* RFLUSH ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - RFLUSH is sent pre-emptively from the driver to flush the read buffers and - packets of a port. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -/***************************************************************************** -********************************* ********************************* -********************************* RESUME ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - RESUME is sent pre-emptively from the driver to cause a port to resume - transmission of data if blocked by XOFF. (as if XON had been received) - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -/***************************************************************************** -********************************* ********************************* -********************************* SBREAK ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - SBREAK is sent in-band from the driver to a port to suspend data and start - break signal transmission. - - If the break delay is 0, the break signal will be acknowledged with a - RUP_COMMAND, COMPLETE packet and continue until an EBREAK packet is received. - - Otherwise, there is no acknowledgement and the break signal will last for the - specified number of mS. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */ - -/***************************************************************************** -********************************* ********************************* -********************************* EBREAK ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - EBREAK is sent in-band from the driver to a port to stop transmission of a - break signal. - - No parameters. */ - -/***************************************************************************** -********************************* ******************************** -********************************* SUSPEND ******************************** -********************************* ******************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - SUSPEND is sent pre-emptively from the driver to cause a port to suspend - transmission of data. (as if XOFF had been received) - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -/***************************************************************************** -********************************* ********************************* -********************************* FCLOSE ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - FCLOSE is sent pre-emptively from the driver to force close a port. - A force close flushes receive and transmit queues, and also lowers all output - modem signals if the COR5_HUPCL (Hang Up On Close) flag is set. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -/***************************************************************************** -********************************* ********************************* -********************************* XPRINT ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - XPRINT is sent as a normal I/O data packet except that the PKT_CMD_BIT of - the "len" field is set, and the first "data" byte is XPRINT. - - The I/O data in the XPRINT packet will contain the following: - - Transparent Print Start Sequence - - Transparent Print Data - - Transparent Print Stop Sequence. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -/***************************************************************************** -********************************** ********************************** -********************************** MBIS ********************************** -********************************** ********************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - MBIS is sent pre-emptively from the driver to set a port's modem signals. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif -#define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ - -/* ModemSet definitions... */ -#define MBIS_RTS 0x01 /* RTS modem signal */ -#define MBIS_DTR 0x02 /* DTR modem signal */ - -/***************************************************************************** -********************************** ********************************** -********************************** MBIC ********************************** -********************************** ********************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - MBIC is sent pre-emptively from the driver to clear a port's modem signals. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -#define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */ - -/* ModemClear definitions... */ -#define MBIC_RTS 0x01 /* RTS modem signal */ -#define MBIC_DTR 0x02 /* DTR modem signal */ - -/***************************************************************************** -********************************** ********************************** -********************************** MSET ********************************** -********************************** ********************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#endif - -#define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ - -/* ModemSet definitions... */ -#define MSET_RTS 0x01 /* RTS modem signal */ -#define MSET_DTR 0x02 /* DTR modem signal */ - -/***************************************************************************** -********************************* ********************************* -********************************* PCLOSE ********************************* -********************************* ********************************* -*****************************************************************************/ - -/* (Driver->RIO,in-band) - - PCLOSE is sent from the driver to pseudo close a previously opened port. - - The port will close when all data has been sent/received, however, the - port's transmit / receive and modem signals will be left enabled and the - port marked internally as Pseudo Closed. */ - -#define PKT_Cmd (PKT_Data+0) /* Command code */ - -/***************************************************************************** -********************************** ********************************** -********************************** MGET ********************************** -********************************** ********************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - MGET is sent pre-emptively from the driver to request the port's current modem signals. */ - -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ - -/***************************************************************************** -********************************* ******************************** -********************************* MEMDUMP ******************************** -********************************* ******************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - MEMDUMP is sent pre-emptively from the driver to request a dump of 32 bytes - of the specified port's RTA address space. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_SubCmd (PKT_Data+5) /* Sub Command */ -#define PKT_Address (PKT_Data+6) /* Requested address */ - -/***************************************************************************** -****************************** ***************************** -****************************** READ_REGISTER ***************************** -****************************** ***************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - READ_REGISTER is sent pre-emptively from the driver to request the contents - of the CD1400 register specified in address. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_SubCmd (PKT_Data+5) /* Sub Command */ -#define PKT_Address (PKT_Data+6) /* Requested address */ - -/***************************************************************************** -************************ ************************** -************************ COMMAND_RUP - COMPLETE ************************** -************************ ************************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - COMMAND_RUP - COMPLETE is sent in response to all port I/O control command - packets, except MEMDUMP and READ_REGISTER. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ -#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ -#define PKT_PortStatus (PKT_Data+4) /* Port signal status */ -#define PKT_SubCmd (PKT_Data+5) /* Sub Command */ - -/* ModemStatus definitions... */ -#define MODEM_DSR 0x80 /* Data Set Ready modem state */ -#define MODEM_CTS 0x40 /* Clear To Send modem state */ -#define MODEM_RI 0x20 /* Ring Indicate modem state */ -#define MODEM_CD 0x10 /* Carrier Detect modem state */ -#define MODEM_TSTOP 0x08 /* Transmit Stopped state */ -#define MODEM_TEMPTY 0x04 /* Transmit Empty state */ -#define MODEM_DTR 0x02 /* DTR modem output state */ -#define MODEM_RTS 0x01 /* RTS modem output state */ - -/* PortStatus definitions... */ -#define PORT_ISOPEN 0x01 /* Port open ? */ -#define PORT_HUPCL 0x02 /* Hangup on close? */ -#define PORT_MOPENPEND 0x04 /* Modem open pending */ -#define PORT_ISPARALLEL 0x08 /* Parallel port */ -#define PORT_BREAK 0x10 /* Port on break */ -#define PORT_STATUSPEND 0020 /* Status packet pending */ -#define PORT_BREAKPEND 0x40 /* Break packet pending */ -#define PORT_MODEMPEND 0x80 /* Modem status packet pending */ - -/***************************************************************************** -************************ ************************** -************************ COMMAND_RUP - COMPLETE ************************** -************************ ************************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - COMMAND_RUP - COMPLETE is sent in response to all port I/O control command - packets, except MEMDUMP and READ_REGISTER. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ -#endif -#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ -#define PKT_PortStatus (PKT_Data+4) /* Port signal status */ -#if 0 -#define PKT_SubCmd (PKT_Data+5) /* Sub Command */ -#endif - -/* ModemStatus definitions... */ -#define MODEM_DSR 0x80 /* Data Set Ready modem state */ -#define MODEM_CTS 0x40 /* Clear To Send modem state */ -#define MODEM_RI 0x20 /* Ring Indicate modem state */ -#define MODEM_CD 0x10 /* Carrier Detect modem state */ -#define MODEM_TSTOP 0x08 /* Transmit Stopped state */ -#define MODEM_TEMPTY 0x04 /* Transmit Empty state */ -#define MODEM_DTR 0x02 /* DTR modem output state */ -#define MODEM_RTS 0x01 /* RTS modem output state */ - -/* PortStatus definitions... */ -#define PORT_ISOPEN 0x01 /* Port open ? */ -#define PORT_HUPCL 0x02 /* Hangup on close? */ -#define PORT_MOPENPEND 0x04 /* Modem open pending */ -#define PORT_ISPARALLEL 0x08 /* Parallel port */ -#define PORT_BREAK 0x10 /* Port on break */ -#define PORT_STATUSPEND 0020 /* Status packet pending */ -#define PORT_BREAKPEND 0x40 /* Break packet pending */ -#define PORT_MODEMPEND 0x80 /* Modem status packet pending */ - -/***************************************************************************** -******************** ******************** -******************** COMMAND_RUP - COMPLETE - MEMDUMP ******************** -******************** ******************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - COMMAND_RUP - COMPLETE - MEMDUMP is sent as an acknowledgement for a MEMDUMP - port I/O control command packet. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ -#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ -#define PKT_PortStatus (PKT_Data+4) /* Port signal status */ -#define PKT_SubCmd (PKT_Data+5) /* Sub Command */ -#define PKT_Address (PKT_Data+6) /* Requested address */ -#endif -#define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */ - -/***************************************************************************** -***************** ***************** -***************** COMMAND_RUP - COMPLETE - READ_REGISTER ***************** -***************** ***************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - COMMAND_RUP - COMPLETE - READ_REGISTER is sent as an acknowledgement for a - READ_REGISTER port I/O control command packet. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /*Command code */ -#define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */ -#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ -#endif -#define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */ -#if 0 -#define PKT_PortStatus (PKT_Data+4) /* Port signal status */ -#define PKT_SubCmd (PKT_Data+5) /* Sub Command */ -#endif - -/***************************************************************************** -********************* *********************** -********************* COMMAND_RUP - BREAK_RECEIVED *********************** -********************* *********************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ -#endif - -/***************************************************************************** -********************* ************************* -********************* COMMAND_RUP - MODEM_STATUS ************************* -********************* ************************* -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - COMMAND_RUP - MODEM_STATUS packets are sent whenever the port detects a - change in the input modem signal states. - - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ -#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ -#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ -#endif - -/***************************************************************************** -************************ ************************* -************************ BOOT_RUP - BOOT_REQUEST ************************* -************************ ************************* -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - BOOT_RUP - BOOT_REQUEST packets are sent to the Driver from RIO to request - firmware code to load onto attached RTAs. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif - -/***************************************************************************** -************************ ************************ -************************ BOOT_RUP - BOOT_SEQUENCE ************************ -************************ ************************ -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - BOOT_RUP - BOOT_SEQUENCE packets are sent from the Driver to RIO in response - to a BOOT_RUP - BOOT_REQUEST packet. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */ -#define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */ -#define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */ -#define PKT_CmdString (PKT_Data+8) /* Command string */ - -/***************************************************************************** -************************ *********************** -************************ BOOT_RUP - BOOT_COMPLETED *********************** -************************ *********************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - BOOT_RUP - BOOT_COMPLETE is sent to the Driver from RIO when downloading of - RTA firmware has completed. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */ -#define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ - -/***************************************************************************** -************************ *********************** -************************ BOOT_RUP - Packet Request *********************** -************************ *********************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent - from RIO to the Driver as a request for a firmware boot packet. */ - -#define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ - -/***************************************************************************** -*********************** *********************** -*********************** BOOT_RUP - Packet Response *********************** -*********************** *********************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - In response to a BOOT_RUP boot packet request, the driver fills out the response - packet with the 70 bytes of the requested sequence. - */ -#if 0 -#define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ -#endif -#define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */ - -/***************************************************************************** -**************************** **************************** -**************************** BOOT_RUP - IFOAD **************************** -**************************** **************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - BOOT_RUP - IFOAD packets are sent from the Driver to an RTA to cause the - RTA to shut down and reboot. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */ -#define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */ - -#define IFOADID1 0xAD -#define IFOADID2 0xF0 - -/***************************************************************************** -************************** *************************** -************************** BOOT_RUP - IDENTIFY *************************** -************************** *************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - BOOT_RUP - IDENTIFY packets are sent from the Driver to an RTA to cause the - RTA to flash its LEDs for a period of time. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */ - -/***************************************************************************** -**************************** *************************** -**************************** BOOT_RUP - ZOMBIE *************************** -**************************** *************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - BOOT_RUP - ZOMBIE packets are sent from the Driver to an RTA to cause the - RTA to shut down and flash it's LEDs. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */ -#define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */ - -#define ZOMBIEID1 0x52 -#define ZOMBIEID2 0x21 - -/***************************************************************************** -**************************** **************************** -**************************** BOOT_RUP - UFOAD **************************** -**************************** **************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - BOOT_RUP - UFOAD packets are sent from the Driver to an RTA to cause the RTA - to ask it's neighbouring RTA to shut down and reboot. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ -#endif -#define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */ -#define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */ - -#define UFOADID1 0x1E -#define UFOADID2 0x0D - -/***************************************************************************** -**************************** **************************** -**************************** BOOT_RUP - IWAIT **************************** -**************************** **************************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - BOOT_RUP - IWAIT packets are sent from the Driver to an RTA to cause the RTA - to pause booting on the specified link for 30 seconds. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ -#endif -#define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */ -#define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */ - -#define IWAITID1 0xDE -#define IWAITID2 0xB1 - -/***************************************************************************** -************************ *********************** -************************ ROUTE_RUP - ROUTE_REQUEST *********************** -************************ *********************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - ROUTE_RUP - ROUTE_REQUEST packets are sent from a newly booted or connected - RTA to a Driver to request an ID (RUP or unit number). - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ -#define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */ - -/* ModuleTypes definitions... */ -#define MOD_BLANK 0x0F /* Blank plate attached */ -#define MOD_RS232DB25 0x00 /* RS232 DB25 connector */ -#define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */ -#define MOD_RS422DB25 0x02 /* RS422 DB25 connector */ -#define MOD_RS485DB25 0x03 /* RS485 DB25 connector */ -#define MOD_PARALLEL 0x04 /* Centronics parallel */ - -#define MOD2 0x08 /* Set to indicate Rev2 module */ - -/***************************************************************************** -************************* ************************* -************************* ROUTE_RUP - ROUTE_FOAD ************************* -************************* ************************* -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - ROUTE_RUP - ROUTE_FOAD packet is sent as a response to a ROUTE_RUP - ROUTE_REQUEST - packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_RouteCmdString (PKT_Data+2) /* Command string */ - -/***************************************************************************** -*********************** *********************** -*********************** ROUTE_RUP - ROUTE_ALLOCATE *********************** -*********************** *********************** -*****************************************************************************/ - -/* (Driver->RIO,pre-emptive) - - ROUTE_RUP - ROUTE_ALLOCATE packet is sent as a response to a ROUTE_RUP - ROUTE_REQUEST - packet to allocate the RTA's Id number (RUP number 1..16) - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */ -#if 0 -#define PKT_RouteCmdString (PKT_Data+2) /* Command string */ -#endif -#define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */ - -/***************************************************************************** -*********************** *********************** -*********************** ROUTE_RUP - ROUTE_TOPOLOGY *********************** -*********************** *********************** -*****************************************************************************/ - -/* (RIO->Driver,pre-emptive) - - ROUTE_RUP - ROUTE_TOPOLOGY packet is sent to inform the driver of an RTA's - current link status. - */ -#if 0 -#define PKT_Cmd (PKT_Data+0) /* Command code */ -#endif -#define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */ -#define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */ -#define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */ -#define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */ -#define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */ -#define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */ -#define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */ -#define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */ -#define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */ - -#endif /* _sxwinif_h */ - -/* End of RIOWINIF.H */ diff --git a/drivers/char/rio/riscos.h b/drivers/char/rio/riscos.h deleted file mode 100644 index 60d66d0056a..00000000000 --- a/drivers/char/rio/riscos.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** Module : riscos.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:19 -** Retrieved : 11/6/98 11:34:22 -** -** ident @(#)riscos.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_riscos_h__ -#define __rio_riscos_h__ - -#ifdef SCCS_LABELS -static char *_riscos_h_sccs_ = "@(#)riscos.h 1.2"; -#endif - -/* -** This module used to define all those little itsy bits required for RISC/OS -** now it's full of null macros. -*/ - -/* -** RBYTE reads a byte from a location. -** RWORD reads a word from a location. -** WBYTE writes a byte to a location. -** WWORD writes a word to a location. -** RINDW reads a word through a pointer. -** WINDW writes a word through a pointer. -** RIOSWAB swaps the two bytes of a word, if needed. -*/ - -#define RIOSWAB(N) (N) -#define WBYTE(A,V) (A)=(uchar)(V) -#define WWORD(A,V) (A)=(ushort)(V) -#define RBYTE(A) (uchar)(A) -#define RWORD(A) (ushort)(A) -#define RINDW(A) (*(ushort *)(A)) -#define WINDW(A,V) (*(ushort *)(A)=(ushort)(V)) - -#endif /* __rio_riscos_h__ */ diff --git a/drivers/char/rio/rtahw.h b/drivers/char/rio/rtahw.h deleted file mode 100644 index e6c2cdfd3a1..00000000000 --- a/drivers/char/rio/rtahw.h +++ /dev/null @@ -1,75 +0,0 @@ - -/**************************************************************************** - ******* ******* - ******* R T A H A R D W A R E - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5"; -#endif -#endif - -#define WATCHDOG_ADDR ((unsigned short *)0x7a00) -#define RTA_LED_ADDR ((unsigned short *)0x7c00) -#define SERIALNUM_ADDR ((unsigned char *)0x7809) -#define LATCH_ADDR ((unsigned char *)0x7800) - -/* -** Here we define where the cd1400 chips are in memory. -*/ -#define CD1400_ONE_ADDR (0x7300) -#define CD1400_TWO_ADDR (0x7200) -#define CD1400_THREE_ADDR (0x7100) -#define CD1400_FOUR_ADDR (0x7000) - -/* -** Define the different types of modules we can have -*/ -enum module { - MOD_BLANK = 0x0f, /* Blank plate attached */ - MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */ - MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */ - MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */ - MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */ - MOD_PARALLEL = 0x04 /* Centronics parallel */ -}; - -#define TYPE_HOST 0 -#define TYPE_RTA8 1 -#define TYPE_RTA16 2 - -#define WATCH_DOG WATCHDOG_ADDR - -/*********** end of file ***********/ diff --git a/drivers/char/rio/rupstat.h b/drivers/char/rio/rupstat.h deleted file mode 100644 index 56d828c63d2..00000000000 --- a/drivers/char/rio/rupstat.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* RUPSTAT - ******* ******* - **************************************************************************** - - Author : Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _rupstat_h -#define _rupstat_h - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1"; -#endif -#endif - -#define STATUS_SYNC 0 -#define STATUS_REQ_TOP 1 -#define STATUS_TOPOLOGY 2 - -#endif diff --git a/drivers/char/rio/selftest.h b/drivers/char/rio/selftest.h deleted file mode 100644 index 7a3dba35232..00000000000 --- a/drivers/char/rio/selftest.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -** File: selftest.h -** -** Author: David Dix -** -** Created: 15th March 1993 -** -** Last modified: 94/06/14 -** - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _selftests_h_ -#define _selftests_h_ - -/* -** Selftest identifier... -*/ -#define SELFTEST_MAGIC 0x5a5a - -/* -** This is the structure of the packet that is sent back after each -** selftest on a booting RTA. -*/ -typedef struct { - short magic; /* Identifies packet type */ - int test; /* Test number, see below */ - unsigned int result; /* Result value */ - unsigned int dataIn; - unsigned int dataOut; -} selftestStruct; - -/* -** The different tests are identified by the following data values. -*/ -enum test { - TESTS_COMPLETE = 0x00, - MEMTEST_ADDR = 0x01, - MEMTEST_BIT = 0x02, - MEMTEST_FILL = 0x03, - MEMTEST_DATABUS = 0x04, - MEMTEST_ADDRBUS = 0x05, - CD1400_INIT = 0x10, - CD1400_LOOP = 0x11, - CD1400_INTERRUPT = 0x12 -}; - -enum result { - E_PORT = 0x10, - E_TX = 0x11, - E_RX = 0x12, - E_EXCEPT = 0x13, - E_COMPARE = 0x14, - E_MODEM = 0x15, - E_TIMEOUT = 0x16, - E_INTERRUPT = 0x17 -}; -#endif /* _selftests_h_ */ diff --git a/drivers/char/rio/sysmap.h b/drivers/char/rio/sysmap.h deleted file mode 100644 index e1c6f1160df..00000000000 --- a/drivers/char/rio/sysmap.h +++ /dev/null @@ -1,62 +0,0 @@ - -/**************************************************************************** - ******* ******* - ******* S Y S T E M M A P H E A D E R - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1"; -#endif -#endif - -#define SYSTEM_MAP_LEN 64 /* Len of System Map array */ - - -typedef struct SYS_MAP SYS_MAP; -typedef struct SYS_MAP_LINK SYS_MAP_LINK; - -struct SYS_MAP_LINK { - short id; /* Unit Id */ - short link; /* Id's Link */ - short been_here; /* Used by map_gen */ -}; - -struct SYS_MAP { - char serial_num[4]; - SYS_MAP_LINK link[4]; -}; - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/timeouts.h b/drivers/char/rio/timeouts.h deleted file mode 100644 index a8b5be3ca9b..00000000000 --- a/drivers/char/rio/timeouts.h +++ /dev/null @@ -1,50 +0,0 @@ - -/**************************************************************************** - ******* ******* - ******* T I M E O U T S - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3"; -#endif -#endif - -#define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ -#define SECOND (int) 15625 /* Low priority ticks */ - -#define TX_TIMEOUT (int) (200 * MILLISECOND) - - -/*********** end of file ***********/ diff --git a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c deleted file mode 100644 index 17390d762cf..00000000000 --- a/drivers/ieee1394/amdtp.c +++ /dev/null @@ -1,1297 +0,0 @@ -/* -*- c-basic-offset: 8 -*- - * - * amdtp.c - Audio and Music Data Transmission Protocol Driver - * Copyright (C) 2001 Kristian Høgsberg - * - * 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. - */ - -/* OVERVIEW - * -------- - * - * The AMDTP driver is designed to expose the IEEE1394 bus as a - * regular OSS soundcard, i.e. you can link /dev/dsp to /dev/amdtp and - * then your favourite MP3 player, game or whatever sound program will - * output to an IEEE1394 isochronous channel. The signal destination - * could be a set of IEEE1394 loudspeakers (if and when such things - * become available) or an amplifier with IEEE1394 input (like the - * Sony STR-LSA1). The driver only handles the actual streaming, some - * connection management is also required for this to actually work. - * That is outside the scope of this driver, and furthermore it is not - * really standardized yet. - * - * The Audio and Music Data Tranmission Protocol is available at - * - * http://www.1394ta.org/Download/Technology/Specifications/2001/AM20Final-jf2.pdf - * - * - * TODO - * ---- - * - * - We should be able to change input sample format between LE/BE, as - * we already shift the bytes around when we construct the iso - * packets. - * - * - Fix DMA stop after bus reset! - * - * - Clean up iso context handling in ohci1394. - * - * - * MAYBE TODO - * ---------- - * - * - Receive data for local playback or recording. Playback requires - * soft syncing with the sound card. - * - * - Signal processing, i.e. receive packets, do some processing, and - * transmit them again using the same packet structure and timestamps - * offset by processing time. - * - * - Maybe make an ALSA interface, that is, create a file_ops - * implementation that recognizes ALSA ioctls and uses defaults for - * things that can't be controlled through ALSA (iso channel). - * - * Changes: - * - * - Audit copy_from_user in amdtp_write. - * Daniele Bellucci <bellucda@tiscali.it> - * - */ - -#include <linux/module.h> -#include <linux/list.h> -#include <linux/sched.h> -#include <linux/types.h> -#include <linux/fs.h> -#include <linux/ioctl.h> -#include <linux/wait.h> -#include <linux/pci.h> -#include <linux/interrupt.h> -#include <linux/poll.h> -#include <linux/compat.h> -#include <linux/cdev.h> -#include <asm/uaccess.h> -#include <asm/atomic.h> - -#include "hosts.h" -#include "highlevel.h" -#include "ieee1394.h" -#include "ieee1394_core.h" -#include "ohci1394.h" - -#include "amdtp.h" -#include "cmp.h" - -#define FMT_AMDTP 0x10 -#define FDF_AM824 0x00 -#define FDF_SFC_32KHZ 0x00 -#define FDF_SFC_44K1HZ 0x01 -#define FDF_SFC_48KHZ 0x02 -#define FDF_SFC_88K2HZ 0x03 -#define FDF_SFC_96KHZ 0x04 -#define FDF_SFC_176K4HZ 0x05 -#define FDF_SFC_192KHZ 0x06 - -struct descriptor_block { - struct output_more_immediate { - u32 control; - u32 pad0; - u32 skip; - u32 pad1; - u32 header[4]; - } header_desc; - - struct output_last { - u32 control; - u32 data_address; - u32 branch; - u32 status; - } payload_desc; -}; - -struct packet { - struct descriptor_block *db; - dma_addr_t db_bus; - struct iso_packet *payload; - dma_addr_t payload_bus; -}; - -#include <asm/byteorder.h> - -#if defined __BIG_ENDIAN_BITFIELD - -struct iso_packet { - /* First quadlet */ - unsigned int dbs : 8; - unsigned int eoh0 : 2; - unsigned int sid : 6; - - unsigned int dbc : 8; - unsigned int fn : 2; - unsigned int qpc : 3; - unsigned int sph : 1; - unsigned int reserved : 2; - - /* Second quadlet */ - unsigned int fdf : 8; - unsigned int eoh1 : 2; - unsigned int fmt : 6; - - unsigned int syt : 16; - - quadlet_t data[0]; -}; - -#elif defined __LITTLE_ENDIAN_BITFIELD - -struct iso_packet { - /* First quadlet */ - unsigned int sid : 6; - unsigned int eoh0 : 2; - unsigned int dbs : 8; - - unsigned int reserved : 2; - unsigned int sph : 1; - unsigned int qpc : 3; - unsigned int fn : 2; - unsigned int dbc : 8; - - /* Second quadlet */ - unsigned int fmt : 6; - unsigned int eoh1 : 2; - unsigned int fdf : 8; - - unsigned int syt : 16; - - quadlet_t data[0]; -}; - -#else - -#error Unknown bitfield type - -#endif - -struct fraction { - int integer; - int numerator; - int denominator; -}; - -#define PACKET_LIST_SIZE 256 -#define MAX_PACKET_LISTS 4 - -struct packet_list { - struct list_head link; - int last_cycle_count; - struct packet packets[PACKET_LIST_SIZE]; -}; - -#define BUFFER_SIZE 128 - -/* This implements a circular buffer for incoming samples. */ - -struct buffer { - size_t head, tail, length, size; - unsigned char data[0]; -}; - -struct stream { - int iso_channel; - int format; - int rate; - int dimension; - int fdf; - int mode; - int sample_format; - struct cmp_pcr *opcr; - - /* Input samples are copied here. */ - struct buffer *input; - - /* ISO Packer state */ - unsigned char dbc; - struct packet_list *current_packet_list; - int current_packet; - struct fraction ready_samples, samples_per_cycle; - - /* We use these to generate control bits when we are packing - * iec958 data. - */ - int iec958_frame_count; - int iec958_rate_code; - - /* The cycle_count and cycle_offset fields are used for the - * synchronization timestamps (syt) in the cip header. They - * are incremented by at least a cycle every time we put a - * time stamp in a packet. As we don't time stamp all - * packages, cycle_count isn't updated in every cycle, and - * sometimes it's incremented by 2. Thus, we have - * cycle_count2, which is simply incremented by one with each - * packet, so we can compare it to the transmission time - * written back in the dma programs. - */ - atomic_t cycle_count, cycle_count2; - struct fraction cycle_offset, ticks_per_syt_offset; - int syt_interval; - int stale_count; - - /* Theses fields control the sample output to the DMA engine. - * The dma_packet_lists list holds packet lists currently - * queued for dma; the head of the list is currently being - * processed. The last program in a packet list generates an - * interrupt, which removes the head from dma_packet_lists and - * puts it back on the free list. - */ - struct list_head dma_packet_lists; - struct list_head free_packet_lists; - wait_queue_head_t packet_list_wait; - spinlock_t packet_list_lock; - struct ohci1394_iso_tasklet iso_tasklet; - struct pci_pool *descriptor_pool, *packet_pool; - - /* Streams at a host controller are chained through this field. */ - struct list_head link; - struct amdtp_host *host; -}; - -struct amdtp_host { - struct hpsb_host *host; - struct ti_ohci *ohci; - struct list_head stream_list; - spinlock_t stream_list_lock; -}; - -static struct hpsb_highlevel amdtp_highlevel; - - -/* FIXME: This doesn't belong here... */ - -#define OHCI1394_CONTEXT_CYCLE_MATCH 0x80000000 -#define OHCI1394_CONTEXT_RUN 0x00008000 -#define OHCI1394_CONTEXT_WAKE 0x00001000 -#define OHCI1394_CONTEXT_DEAD 0x00000800 -#define OHCI1394_CONTEXT_ACTIVE 0x00000400 - -static void ohci1394_start_it_ctx(struct ti_ohci *ohci, int ctx, - dma_addr_t first_cmd, int z, int cycle_match) -{ - reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1 << ctx); - reg_write(ohci, OHCI1394_IsoXmitCommandPtr + ctx * 16, first_cmd | z); - reg_write(ohci, OHCI1394_IsoXmitContextControlClear + ctx * 16, ~0); - wmb(); - reg_write(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16, - OHCI1394_CONTEXT_CYCLE_MATCH | (cycle_match << 16) | - OHCI1394_CONTEXT_RUN); -} - -static void ohci1394_wake_it_ctx(struct ti_ohci *ohci, int ctx) -{ - reg_write(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16, - OHCI1394_CONTEXT_WAKE); -} - -static void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous) -{ - u32 control; - int wait; - - reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 1 << ctx); - reg_write(ohci, OHCI1394_IsoXmitContextControlClear + ctx * 16, - OHCI1394_CONTEXT_RUN); - wmb(); - - if (synchronous) { - for (wait = 0; wait < 5; wait++) { - control = reg_read(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16); - if ((control & OHCI1394_CONTEXT_ACTIVE) == 0) - break; - - schedule_timeout_interruptible(1); - } - } -} - -/* Note: we can test if free_packet_lists is empty without aquiring - * the packet_list_lock. The interrupt handler only adds to the free - * list, there is no race condition between testing the list non-empty - * and acquiring the lock. - */ - -static struct packet_list *stream_get_free_packet_list(struct stream *s) -{ - struct packet_list *pl; - unsigned long flags; - - if (list_empty(&s->free_packet_lists)) - return NULL; - - spin_lock_irqsave(&s->packet_list_lock, flags); - pl = list_entry(s->free_packet_lists.next, struct packet_list, link); - list_del(&pl->link); - spin_unlock_irqrestore(&s->packet_list_lock, flags); - - return pl; -} - -static void stream_start_dma(struct stream *s, struct packet_list *pl) -{ - u32 syt_cycle, cycle_count, start_cycle; - - cycle_count = reg_read(s->host->ohci, - OHCI1394_IsochronousCycleTimer) >> 12; - syt_cycle = (pl->last_cycle_count - PACKET_LIST_SIZE + 1) & 0x0f; - - /* We program the DMA controller to start transmission at - * least 17 cycles from now - this happens when the lower four - * bits of cycle_count is 0x0f and syt_cycle is 0, in this - * case the start cycle is cycle_count - 15 + 32. */ - start_cycle = (cycle_count & ~0x0f) + 32 + syt_cycle; - if ((start_cycle & 0x1fff) >= 8000) - start_cycle = start_cycle - 8000 + 0x2000; - - ohci1394_start_it_ctx(s->host->ohci, s->iso_tasklet.context, - pl->packets[0].db_bus, 3, - start_cycle & 0x7fff); -} - -static void stream_put_dma_packet_list(struct stream *s, - struct packet_list *pl) -{ - unsigned long flags; - struct packet_list *prev; - - /* Remember the cycle_count used for timestamping the last packet. */ - pl->last_cycle_count = atomic_read(&s->cycle_count2) - 1; - pl->packets[PACKET_LIST_SIZE - 1].db->payload_desc.branch = 0; - - spin_lock_irqsave(&s->packet_list_lock, flags); - list_add_tail(&pl->link, &s->dma_packet_lists); - spin_unlock_irqrestore(&s->packet_list_lock, flags); - - prev = list_entry(pl->link.prev, struct packet_list, link); - if (pl->link.prev != &s->dma_packet_lists) { - struct packet *last = &prev->packets[PACKET_LIST_SIZE - 1]; - last->db->payload_desc.branch = pl->packets[0].db_bus | 3; - last->db->header_desc.skip = pl->packets[0].db_bus | 3; - ohci1394_wake_it_ctx(s->host->ohci, s->iso_tasklet.context); - } - else - stream_start_dma(s, pl); -} - -static void stream_shift_packet_lists(unsigned long l) -{ - struct stream *s = (struct stream *) l; - struct packet_list *pl; - struct packet *last; - int diff; - - if (list_empty(&s->dma_packet_lists)) { - HPSB_ERR("empty dma_packet_lists in %s", __FUNCTION__); - return; - } - - /* Now that we know the list is non-empty, we can get the head - * of the list without locking, because the process context - * only adds to the tail. - */ - pl = list_entry(s->dma_packet_lists.next, struct packet_list, link); - last = &pl->packets[PACKET_LIST_SIZE - 1]; - - /* This is weird... if we stop dma processing in the middle of - * a packet list, the dma context immediately generates an - * interrupt if we enable it again later. This only happens - * when amdtp_release is interrupted while waiting for dma to - * complete, though. Anyway, we detect this by seeing that - * the status of the dma descriptor that we expected an - * interrupt from is still 0. - */ - if (last->db->payload_desc.status == 0) { - HPSB_INFO("weird interrupt..."); - return; - } - - /* If the last descriptor block does not specify a branch - * address, we have a sample underflow. - */ - if (last->db->payload_desc.branch == 0) - HPSB_INFO("FIXME: sample underflow..."); - - /* Here we check when (which cycle) the last packet was sent - * and compare it to what the iso packer was using at the - * time. If there is a mismatch, we adjust the cycle count in - * the iso packer. However, there are still up to - * MAX_PACKET_LISTS packet lists queued with bad time stamps, - * so we disable time stamp monitoring for the next - * MAX_PACKET_LISTS packet lists. - */ - diff = (last->db->payload_desc.status - pl->last_cycle_count) & 0xf; - if (diff > 0 && s->stale_count == 0) { - atomic_add(diff, &s->cycle_count); - atomic_add(diff, &s->cycle_count2); - s->stale_count = MAX_PACKET_LISTS; - } - - if (s->stale_count > 0) - s->stale_count--; - - /* Finally, we move the packet list that was just processed - * back to the free list, and notify any waiters. - */ - spin_lock(&s->packet_list_lock); - list_del(&pl->link); - list_add_tail(&pl->link, &s->free_packet_lists); - spin_unlock(&s->packet_list_lock); - - wake_up_interruptible(&s->packet_list_wait); -} - -static struct packet *stream_current_packet(struct stream *s) -{ - if (s->current_packet_list == NULL && - (s->current_packet_list = stream_get_free_packet_list(s)) == NULL) - return NULL; - - return &s->current_packet_list->packets[s->current_packet]; -} - -static void stream_queue_packet(struct stream *s) -{ - s->current_packet++; - if (s->current_packet == PACKET_LIST_SIZE) { - stream_put_dma_packet_list(s, s->current_packet_list); - s->current_packet_list = NULL; - s->current_packet = 0; - } -} - -/* Integer fractional math. When we transmit a 44k1Hz signal we must - * send 5 41/80 samples per isochronous cycle, as these occur 8000 - * times a second. Of course, we must send an integral number of - * samples in a packet, so we use the integer math to alternate - * between sending 5 and 6 samples per packet. - */ - -static void fraction_init(struct fraction *f, int numerator, int denominator) -{ - f->integer = numerator / denominator; - f->numerator = numerator % denominator; - f->denominator = denominator; -} - -static __inline__ void fraction_add(struct fraction *dst, - struct fraction *src1, - struct fraction *src2) -{ - /* assert: src1->denominator == src2->denominator */ - - int sum, denom; - - /* We use these two local variables to allow gcc to optimize - * the division and the modulo into only one division. */ - - sum = src1->numerator + src2->numerator; - denom = src1->denominator; - dst->integer = src1->integer + src2->integer + sum / denom; - dst->numerator = sum % denom; - dst->denominator = denom; -} - -static __inline__ void fraction_sub_int(struct fraction *dst, - struct fraction *src, int integer) -{ - dst->integer = src->integer - integer; - dst->numerator = src->numerator; - dst->denominator = src->denominator; -} - -static __inline__ int fraction_floor(struct fraction *frac) -{ - return frac->integer; -} - -static __inline__ int fraction_ceil(struct fraction *frac) -{ - return frac->integer + (frac->numerator > 0 ? 1 : 0); -} - -static void packet_initialize(struct packet *p, struct packet *next) -{ - /* Here we initialize the dma descriptor block for - * transferring one iso packet. We use two descriptors per - * packet: an OUTPUT_MORE_IMMMEDIATE descriptor for the - * IEEE1394 iso packet header and an OUTPUT_LAST descriptor - * for the payload. - */ - - p->db->header_desc.control = - DMA_CTL_OUTPUT_MORE | DMA_CTL_IMMEDIATE | 8; - - if (next) { - p->db->payload_desc.control = - DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH; - p->db->payload_desc.branch = next->db_bus | 3; - p->db->header_desc.skip = next->db_bus | 3; - } - else { - p->db->payload_desc.control = - DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH | - DMA_CTL_UPDATE | DMA_CTL_IRQ; - p->db->payload_desc.branch = 0; - p->db->header_desc.skip = 0; - } - p->db->payload_desc.data_address = p->payload_bus; - p->db->payload_desc.status = 0; -} - -static struct packet_list *packet_list_alloc(struct stream *s) -{ - int i; - struct packet_list *pl; - struct packet *next; - - pl = kmalloc(sizeof *pl, SLAB_KERNEL); - if (pl == NULL) - return NULL; - - for (i = 0; i < PACKET_LIST_SIZE; i++) { - struct packet *p = &pl->packets[i]; - p->db = pci_pool_alloc(s->descriptor_pool, SLAB_KERNEL, - &p->db_bus); - p->payload = pci_pool_alloc(s->packet_pool, SLAB_KERNEL, - &p->payload_bus); - } - - for (i = 0; i < PACKET_LIST_SIZE; i++) { - if (i < PACKET_LIST_SIZE - 1) - next = &pl->packets[i + 1]; - else - next = NULL; - packet_initialize(&pl->packets[i], next); - } - - return pl; -} - -static void packet_list_free(struct packet_list *pl, struct stream *s) -{ - int i; - - for (i = 0; i < PACKET_LIST_SIZE; i++) { - struct packet *p = &pl->packets[i]; - pci_pool_free(s->descriptor_pool, p->db, p->db_bus); - pci_pool_free(s->packet_pool, p->payload, p->payload_bus); - } - kfree(pl); -} - -static struct buffer *buffer_alloc(int size) -{ - struct buffer *b; - - b = kmalloc(sizeof *b + size, SLAB_KERNEL); - if (b == NULL) - return NULL; - b->head = 0; - b->tail = 0; - b->length = 0; - b->size = size; - - return b; -} - -static unsigned char *buffer_get_bytes(struct buffer *buffer, int size) -{ - unsigned char *p; - - if (buffer->head + size > buffer->size) - BUG(); - - p = &buffer->data[buffer->head]; - buffer->head += size; - if (buffer->head == buffer->size) - buffer->head = 0; - buffer->length -= size; - - return p; -} - -static unsigned char *buffer_put_bytes(struct buffer *buffer, - size_t max, size_t *actual) -{ - size_t length; - unsigned char *p; - - p = &buffer->data[buffer->tail]; - length = min(buffer->size - buffer->length, max); - if (buffer->tail + length < buffer->size) { - *actual = length; - buffer->tail += length; - } - else { - *actual = buffer->size - buffer->tail; - buffer->tail = 0; - } - - buffer->length += *actual; - return p; -} - -static u32 get_iec958_header_bits(struct stream *s, int sub_frame, u32 sample) -{ - int csi, parity, shift; - int block_start; - u32 bits; - - switch (s->iec958_frame_count) { - case 1: - csi = s->format == AMDTP_FORMAT_IEC958_AC3; - break; - case 2: - case 9: - csi = 1; - break; - case 24 ... 27: - csi = (s->iec958_rate_code >> (27 - s->iec958_frame_count)) & 0x01; - break; - default: - csi = 0; - break; - } - - block_start = (s->iec958_frame_count == 0 && sub_frame == 0); - - /* The parity bit is the xor of the sample bits and the - * channel status info bit. */ - for (shift = 16, parity = sample ^ csi; shift > 0; shift >>= 1) - parity ^= (parity >> shift); - - bits = (block_start << 5) | /* Block start bit */ - ((sub_frame == 0) << 4) | /* Subframe bit */ - ((parity & 1) << 3) | /* Parity bit */ - (csi << 2); /* Channel status info bit */ - - return bits; -} - -static u32 get_header_bits(struct stream *s, int sub_frame, u32 sample) -{ - switch (s->format) { - case AMDTP_FORMAT_IEC958_PCM: - case AMDTP_FORMAT_IEC958_AC3: - return get_iec958_header_bits(s, sub_frame, sample); - - case AMDTP_FORMAT_RAW: - return 0x40; - - default: - return 0; - } -} - -static void fill_payload_le16(struct stream *s, quadlet_t *data, int nevents) -{ - quadlet_t *event, sample, bits; - unsigned char *p; - int i, j; - - for (i = 0, event = data; i < nevents; i++) { - - for (j = 0; j < s->dimension; j++) { - p = buffer_get_bytes(s->input, 2); - sample = (p[1] << 16) | (p[0] << 8); - bits = get_header_bits(s, j, sample); - event[j] = cpu_to_be32((bits << 24) | sample); - } - - event += s->dimension; - if (++s->iec958_frame_count == 192) - s->iec958_frame_count = 0; - } -} - -static void fill_packet(struct stream *s, struct packet *packet, int nevents) -{ - int syt_index, syt, size; - u32 control; - - size = (nevents * s->dimension + 2) * sizeof(quadlet_t); - - /* Update DMA descriptors */ - packet->db->payload_desc.status = 0; - control = packet->db->payload_desc.control & 0xffff0000; - packet->db->payload_desc.control = control | size; - - /* Fill IEEE1394 headers */ - packet->db->header_desc.header[0] = - (IEEE1394_SPEED_100 << 16) | (0x01 << 14) | - (s->iso_channel << 8) | (TCODE_ISO_DATA << 4); - packet->db->header_desc.header[1] = size << 16; - - /* Calculate synchronization timestamp (syt). First we - * determine syt_index, that is, the index in the packet of - * the sample for which the timestamp is valid. */ - syt_index = (s->syt_interval - s->dbc) & (s->syt_interval - 1); - if (syt_index < nevents) { - syt = ((atomic_read(&s->cycle_count) << 12) | - s->cycle_offset.integer) & 0xffff; - fraction_add(&s->cycle_offset, - &s->cycle_offset, &s->ticks_per_syt_offset); - - /* This next addition should be modulo 8000 (0x1f40), - * but we only use the lower 4 bits of cycle_count, so - * we don't need the modulo. */ - atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count); - s->cycle_offset.integer %= 3072; - } - else - syt = 0xffff; - - atomic_inc(&s->cycle_count2); - - /* Fill cip header */ - packet->payload->eoh0 = 0; - packet->payload->sid = s->host->host->node_id & 0x3f; - packet->payload->dbs = s->dimension; - packet->payload->fn = 0; - packet->payload->qpc = 0; - packet->payload->sph = 0; - packet->payload->reserved = 0; - packet->payload->dbc = s->dbc; - packet->payload->eoh1 = 2; - packet->payload->fmt = FMT_AMDTP; - packet->payload->fdf = s->fdf; - packet->payload->syt = cpu_to_be16(syt); - - switch (s->sample_format) { - case AMDTP_INPUT_LE16: - fill_payload_le16(s, packet->payload->data, nevents); - break; - } - - s->dbc += nevents; -} - -static void stream_flush(struct stream *s) -{ - struct packet *p; - int nevents; - struct fraction next; - - /* The AMDTP specifies two transmission modes: blocking and - * non-blocking. In blocking mode you always transfer - * syt_interval or zero samples, whereas in non-blocking mode - * you send as many samples as you have available at transfer - * time. - * - * The fraction samples_per_cycle specifies the number of - * samples that become available per cycle. We add this to - * the fraction ready_samples, which specifies the number of - * leftover samples from the previous transmission. The sum, - * stored in the fraction next, specifies the number of - * samples available for transmission, and from this we - * determine the number of samples to actually transmit. - */ - - while (1) { - fraction_add(&next, &s->ready_samples, &s->samples_per_cycle); - if (s->mode == AMDTP_MODE_BLOCKING) { - if (fraction_floor(&next) >= s->syt_interval) - nevents = s->syt_interval; - else - nevents = 0; - } - else - nevents = fraction_floor(&next); - - p = stream_current_packet(s); - if (s->input->length < nevents * s->dimension * 2 || p == NULL) - break; - - fill_packet(s, p, nevents); - stream_queue_packet(s); - - /* Now that we have successfully queued the packet for - * transmission, we update the fraction ready_samples. */ - fraction_sub_int(&s->ready_samples, &next, nevents); - } -} - -static int stream_alloc_packet_lists(struct stream *s) -{ - int max_nevents, max_packet_size, i; - - if (s->mode == AMDTP_MODE_BLOCKING) - max_nevents = s->syt_interval; - else - max_nevents = fraction_ceil(&s->samples_per_cycle); - - max_packet_size = max_nevents * s->dimension * 4 + 8; - s->packet_pool = pci_pool_create("packet pool", s->host->ohci->dev, - max_packet_size, 0, 0); - - if (s->packet_pool == NULL) - return -1; - - INIT_LIST_HEAD(&s->free_packet_lists); - INIT_LIST_HEAD(&s->dma_packet_lists); - for (i = 0; i < MAX_PACKET_LISTS; i++) { - struct packet_list *pl = packet_list_alloc(s); - if (pl == NULL) - break; - list_add_tail(&pl->link, &s->free_packet_lists); - } - - return i < MAX_PACKET_LISTS ? -1 : 0; -} - -static void stream_free_packet_lists(struct stream *s) -{ - struct packet_list *packet_l, *packet_l_next; - - if (s->current_packet_list != NULL) - packet_list_free(s->current_packet_list, s); - list_for_each_entry_safe(packet_l, packet_l_next, &s->dma_packet_lists, link) - packet_list_free(packet_l, s); - list_for_each_entry_safe(packet_l, packet_l_next, &s->free_packet_lists, link) - packet_list_free(packet_l, s); - if (s->packet_pool != NULL) - pci_pool_destroy(s->packet_pool); - - s->current_packet_list = NULL; - INIT_LIST_HEAD(&s->free_packet_lists); - INIT_LIST_HEAD(&s->dma_packet_lists); - s->packet_pool = NULL; -} - -static void plug_update(struct cmp_pcr *plug, void *data) -{ - struct stream *s = data; - - HPSB_INFO("plug update: p2p_count=%d, channel=%d", - plug->p2p_count, plug->channel); - s->iso_channel = plug->channel; - if (plug->p2p_count > 0) { - struct packet_list *pl; - - pl = list_entry(s->dma_packet_lists.next, struct packet_list, link); - stream_start_dma(s, pl); - } - else { - ohci1394_stop_it_ctx(s->host->ohci, s->iso_tasklet.context, 0); - } -} - -static int stream_configure(struct stream *s, int cmd, struct amdtp_ioctl *cfg) -{ - const int transfer_delay = 9000; - - if (cfg->format <= AMDTP_FORMAT_IEC958_AC3) - s->format = cfg->format; - else - return -EINVAL; - - switch (cfg->rate) { - case 32000: - s->syt_interval = 8; - s->fdf = FDF_SFC_32KHZ; - s->iec958_rate_code = 0x0c; - break; - case 44100: - s->syt_interval = 8; - s->fdf = FDF_SFC_44K1HZ; - s->iec958_rate_code = 0x00; - break; - case 48000: - s->syt_interval = 8; - s->fdf = FDF_SFC_48KHZ; - s->iec958_rate_code = 0x04; - break; - case 88200: - s->syt_interval = 16; - s->fdf = FDF_SFC_88K2HZ; - s->iec958_rate_code = 0x00; - break; - case 96000: - s->syt_interval = 16; - s->fdf = FDF_SFC_96KHZ; - s->iec958_rate_code = 0x00; - break; - case 176400: - s->syt_interval = 32; - s->fdf = FDF_SFC_176K4HZ; - s->iec958_rate_code = 0x00; - break; - case 192000: - s->syt_interval = 32; - s->fdf = FDF_SFC_192KHZ; - s->iec958_rate_code = 0x00; - break; - - default: - return -EINVAL; - } - - s->rate = cfg->rate; - fraction_init(&s->samples_per_cycle, s->rate, 8000); - fraction_init(&s->ready_samples, 0, 8000); - - /* The ticks_per_syt_offset is initialized to the number of - * ticks between syt_interval events. The number of ticks per - * second is 24.576e6, so the number of ticks between - * syt_interval events is 24.576e6 * syt_interval / rate. - */ - fraction_init(&s->ticks_per_syt_offset, - 24576000 * s->syt_interval, s->rate); - fraction_init(&s->cycle_offset, (transfer_delay % 3072) * s->rate, s->rate); - atomic_set(&s->cycle_count, transfer_delay / 3072); - atomic_set(&s->cycle_count2, 0); - - s->mode = cfg->mode; - s->sample_format = AMDTP_INPUT_LE16; - - /* When using the AM824 raw subformat we can stream signals of - * any dimension. The IEC958 subformat, however, only - * supports 2 channels. - */ - if (s->format == AMDTP_FORMAT_RAW || cfg->dimension == 2) - s->dimension = cfg->dimension; - else - return -EINVAL; - - if (s->opcr != NULL) { - cmp_unregister_opcr(s->host->host, s->opcr); - s->opcr = NULL; - } - - switch(cmd) { - case AMDTP_IOC_PLUG: - s->opcr = cmp_register_opcr(s->host->host, cfg->u.plug, - /*payload*/ 12, plug_update, s); - if (s->opcr == NULL) - return -EINVAL; - s->iso_channel = s->opcr->channel; - break; - - case AMDTP_IOC_CHANNEL: - if (cfg->u.channel >= 0 && cfg->u.channel < 64) - s->iso_channel = cfg->u.channel; - else - return -EINVAL; - break; - } - - /* The ioctl settings were all valid, so we realloc the packet - * lists to make sure the packet size is big enough. - */ - if (s->packet_pool != NULL) - stream_free_packet_lists(s); - - if (stream_alloc_packet_lists(s) < 0) { - stream_free_packet_lists(s); - return -ENOMEM; - } - - return 0; -} - -static struct stream *stream_alloc(struct amdtp_host *host) -{ - struct stream *s; - unsigned long flags; - - s = kmalloc(sizeof(struct stream), SLAB_KERNEL); - if (s == NULL) - return NULL; - - memset(s, 0, sizeof(struct stream)); - s->host = host; - - s->input = buffer_alloc(BUFFER_SIZE); - if (s->input == NULL) { - kfree(s); - return NULL; - } - - s->descriptor_pool = pci_pool_create("descriptor pool", host->ohci->dev, - sizeof(struct descriptor_block), - 16, 0); - - if (s->descriptor_pool == NULL) { - kfree(s->input); - kfree(s); - return NULL; - } - - INIT_LIST_HEAD(&s->free_packet_lists); - INIT_LIST_HEAD(&s->dma_packet_lists); - - init_waitqueue_head(&s->packet_list_wait); - spin_lock_init(&s->packet_list_lock); - - ohci1394_init_iso_tasklet(&s->iso_tasklet, OHCI_ISO_TRANSMIT, - stream_shift_packet_lists, - (unsigned long) s); - - if (ohci1394_register_iso_tasklet(host->ohci, &s->iso_tasklet) < 0) { - pci_pool_destroy(s->descriptor_pool); - kfree(s->input); - kfree(s); - return NULL; - } - - spin_lock_irqsave(&host->stream_list_lock, flags); - list_add_tail(&s->link, &host->stream_list); - spin_unlock_irqrestore(&host->stream_list_lock, flags); - - return s; -} - -static void stream_free(struct stream *s) -{ - unsigned long flags; - - /* Stop the DMA. We wait for the dma packet list to become - * empty and let the dma controller run out of programs. This - * seems to be more reliable than stopping it directly, since - * that sometimes generates an it transmit interrupt if we - * later re-enable the context. - */ - wait_event_interruptible(s->packet_list_wait, - list_empty(&s->dma_packet_lists)); - - ohci1394_stop_it_ctx(s->host->ohci, s->iso_tasklet.context, 1); - ohci1394_unregister_iso_tasklet(s->host->ohci, &s->iso_tasklet); - - if (s->opcr != NULL) - cmp_unregister_opcr(s->host->host, s->opcr); - - spin_lock_irqsave(&s->host->stream_list_lock, flags); - list_del(&s->link); - spin_unlock_irqrestore(&s->host->stream_list_lock, flags); - - kfree(s->input); - - stream_free_packet_lists(s); - pci_pool_destroy(s->descriptor_pool); - - kfree(s); -} - -/* File operations */ - -static ssize_t amdtp_write(struct file *file, const char __user *buffer, size_t count, - loff_t *offset_is_ignored) -{ - struct stream *s = file->private_data; - unsigned char *p; - int i; - size_t length; - - if (s->packet_pool == NULL) - return -EBADFD; - - /* Fill the circular buffer from the input buffer and call the - * iso packer when the buffer is full. The iso packer may - * leave bytes in the buffer for two reasons: either the - * remaining bytes wasn't enough to build a new packet, or - * there were no free packet lists. In the first case we - * re-fill the buffer and call the iso packer again or return - * if we used all the data from userspace. In the second - * case, the wait_event_interruptible will block until the irq - * handler frees a packet list. - */ - - for (i = 0; i < count; i += length) { - p = buffer_put_bytes(s->input, count - i, &length); - if (copy_from_user(p, buffer + i, length)) - return -EFAULT; - if (s->input->length < s->input->size) - continue; - - stream_flush(s); - - if (s->current_packet_list != NULL) - continue; - - if (file->f_flags & O_NONBLOCK) - return i + length > 0 ? i + length : -EAGAIN; - - if (wait_event_interruptible(s->packet_list_wait, - !list_empty(&s->free_packet_lists))) - return -EINTR; - } - - return count; -} - -static long amdtp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - struct stream *s = file->private_data; - struct amdtp_ioctl cfg; - int err; - lock_kernel(); - switch(cmd) - { - case AMDTP_IOC_PLUG: - case AMDTP_IOC_CHANNEL: - if (copy_from_user(&cfg, (struct amdtp_ioctl __user *) arg, sizeof cfg)) - err = -EFAULT; - else - err = stream_configure(s, cmd, &cfg); - break; - - default: - err = -EINVAL; - break; - } - unlock_kernel(); - return err; -} - -static unsigned int amdtp_poll(struct file *file, poll_table *pt) -{ - struct stream *s = file->private_data; - - poll_wait(file, &s->packet_list_wait, pt); - - if (!list_empty(&s->free_packet_lists)) - return POLLOUT | POLLWRNORM; - else - return 0; -} - -static int amdtp_open(struct inode *inode, struct file *file) -{ - struct amdtp_host *host; - int i = ieee1394_file_to_instance(file); - - host = hpsb_get_hostinfo_bykey(&amdtp_highlevel, i); - if (host == NULL) - return -ENODEV; - - file->private_data = stream_alloc(host); - if (file->private_data == NULL) - return -ENOMEM; - - return 0; -} - -static int amdtp_release(struct inode *inode, struct file *file) -{ - struct stream *s = file->private_data; - - stream_free(s); - - return 0; -} - -static struct cdev amdtp_cdev; -static struct file_operations amdtp_fops = -{ - .owner = THIS_MODULE, - .write = amdtp_write, - .poll = amdtp_poll, - .unlocked_ioctl = amdtp_ioctl, - .compat_ioctl = amdtp_ioctl, /* All amdtp ioctls are compatible */ - .open = amdtp_open, - .release = amdtp_release -}; - -/* IEEE1394 Subsystem functions */ - -static void amdtp_add_host(struct hpsb_host *host) -{ - struct amdtp_host *ah; - int minor; - - if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME) != 0) - return; - - ah = hpsb_create_hostinfo(&amdtp_highlevel, host, sizeof(*ah)); - if (!ah) { - HPSB_ERR("amdtp: Unable able to alloc hostinfo"); - return; - } - - ah->host = host; - ah->ohci = host->hostdata; - - hpsb_set_hostinfo_key(&amdtp_highlevel, host, ah->host->id); - - minor = IEEE1394_MINOR_BLOCK_AMDTP * 16 + ah->host->id; - - INIT_LIST_HEAD(&ah->stream_list); - spin_lock_init(&ah->stream_list_lock); - - devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor), - S_IFCHR|S_IRUSR|S_IWUSR, "amdtp/%d", ah->host->id); -} - -static void amdtp_remove_host(struct hpsb_host *host) -{ - struct amdtp_host *ah = hpsb_get_hostinfo(&amdtp_highlevel, host); - - if (ah) - devfs_remove("amdtp/%d", ah->host->id); - - return; -} - -static struct hpsb_highlevel amdtp_highlevel = { - .name = "amdtp", - .add_host = amdtp_add_host, - .remove_host = amdtp_remove_host, -}; - -/* Module interface */ - -MODULE_AUTHOR("Kristian Hogsberg <hogsberg@users.sf.net>"); -MODULE_DESCRIPTION("Driver for Audio & Music Data Transmission Protocol " - "on OHCI boards."); -MODULE_SUPPORTED_DEVICE("amdtp"); -MODULE_LICENSE("GPL"); - -static int __init amdtp_init_module (void) -{ - cdev_init(&amdtp_cdev, &amdtp_fops); - amdtp_cdev.owner = THIS_MODULE; - kobject_set_name(&amdtp_cdev.kobj, "amdtp"); - if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) { - HPSB_ERR("amdtp: unable to add char device"); - return -EIO; - } - - devfs_mk_dir("amdtp"); - - hpsb_register_highlevel(&amdtp_highlevel); - - HPSB_INFO("Loaded AMDTP driver"); - - return 0; -} - -static void __exit amdtp_exit_module (void) -{ - hpsb_unregister_highlevel(&amdtp_highlevel); - devfs_remove("amdtp"); - cdev_del(&amdtp_cdev); - - HPSB_INFO("Unloaded AMDTP driver"); -} - -module_init(amdtp_init_module); -module_exit(amdtp_exit_module); diff --git a/drivers/ieee1394/amdtp.h b/drivers/ieee1394/amdtp.h deleted file mode 100644 index 531f28e3ab5..00000000000 --- a/drivers/ieee1394/amdtp.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c-basic-offset: 8 -*- */ - -#ifndef __AMDTP_H -#define __AMDTP_H - -#include <asm/types.h> -#include "ieee1394-ioctl.h" - -/* The userspace interface for the Audio & Music Data Transmission - * Protocol driver is really simple. First, open /dev/amdtp, use the - * ioctl to configure format, rate, dimension and either plug or - * channel, then start writing samples. - * - * The formats supported by the driver are listed below. - * AMDTP_FORMAT_RAW corresponds to the AM824 raw format, which can - * carry any number of channels, so use this if you're streaming - * multichannel audio. The AMDTP_FORMAT_IEC958_PCM corresponds to the - * AM824 IEC958 encapsulation without the IEC958 data bit set, using - * AMDTP_FORMAT_IEC958_AC3 will transmit the samples with the data bit - * set, suitable for transmitting compressed AC-3 audio. - * - * The rate field specifies the transmission rate; supported values - * are 32000, 44100, 48000, 88200, 96000, 176400 and 192000. - * - * The dimension field specifies the dimension of the signal, that is, - * the number of audio channels. Only AMDTP_FORMAT_RAW supports - * settings greater than 2. - * - * The mode field specifies which transmission mode to use. The AMDTP - * specifies two different transmission modes: blocking and - * non-blocking. The blocking transmission mode always send a fixed - * number of samples, typically 8, 16 or 32. To exactly match the - * transmission rate, the driver alternates between sending empty and - * non-empty packets. In non-blocking mode, the driver transmits as - * small packets as possible. For example, for a transmission rate of - * 44100Hz, the driver should send 5 41/80 samples in every cycle, but - * this is not possible so instead the driver alternates between - * sending 5 and 6 samples. - * - * The last thing to specify is either the isochronous channel to use - * or the output plug to connect to. If you know what channel the - * destination device will listen on, you can specify the channel - * directly and use the AMDTP_IOC_CHANNEL ioctl. However, if the - * destination device chooses the channel and uses the IEC61883-1 plug - * mechanism, you can specify an output plug to connect to. The - * driver will pick up the channel number from the plug once the - * destination device locks the output plug control register. In this - * case set the plug field and use the AMDTP_IOC_PLUG ioctl. - * - * Having configured the interface, the driver now accepts writes of - * regular 16 bit signed little endian samples, with the channels - * interleaved. For example, 4 channels would look like: - * - * | sample 0 | sample 1 ... - * | ch. 0 | ch. 1 | ch. 2 | ch. 3 | ch. 0 | ... - * | lsb | msb | lsb | msb | lsb | msb | lsb | msb | lsb | msb | ... - * - */ - -enum { - AMDTP_FORMAT_RAW, - AMDTP_FORMAT_IEC958_PCM, - AMDTP_FORMAT_IEC958_AC3 -}; - -enum { - AMDTP_MODE_BLOCKING, - AMDTP_MODE_NON_BLOCKING, -}; - -enum { - AMDTP_INPUT_LE16, - AMDTP_INPUT_BE16, -}; - -struct amdtp_ioctl { - __u32 format; - __u32 rate; - __u32 dimension; - __u32 mode; - union { __u32 channel; __u32 plug; } u; -}; - -#endif /* __AMDTP_H */ diff --git a/drivers/ieee1394/cmp.c b/drivers/ieee1394/cmp.c deleted file mode 100644 index 69aed26e83a..00000000000 --- a/drivers/ieee1394/cmp.c +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- c-basic-offset: 8 -*- - * - * cmp.c - Connection Management Procedures - * Copyright (C) 2001 Kristian Høgsberg - * - * 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. - */ - -/* TODO - * ---- - * - * - Implement IEC61883-1 output plugs and connection management. - * This should probably be part of the general subsystem, as it could - * be shared with dv1394. - * - * - Add IEC61883 unit directory when loading this module. This - * requires a run-time changeable config rom. - */ - -#include <linux/module.h> -#include <linux/list.h> -#include <linux/sched.h> -#include <linux/types.h> -#include <linux/wait.h> -#include <linux/interrupt.h> - -#include "hosts.h" -#include "highlevel.h" -#include "ieee1394.h" -#include "ieee1394_core.h" -#include "cmp.h" - -struct plug { - union { - struct cmp_pcr pcr; - quadlet_t quadlet; - } u; - void (*update)(struct cmp_pcr *plug, void *data); - void *data; -}; - -struct cmp_host { - struct hpsb_host *host; - - union { - struct cmp_mpr ompr; - quadlet_t ompr_quadlet; - } u; - struct plug opcr[2]; - - union { - struct cmp_mpr impr; - quadlet_t impr_quadlet; - } v; - struct plug ipcr[2]; -}; - -enum { - CMP_P2P_CONNECTION, - CMP_BC_CONNECTION -}; - -#define CSR_PCR_MAP 0x900 -#define CSR_PCR_MAP_END 0x9fc - -static struct hpsb_highlevel cmp_highlevel; - -static void cmp_add_host(struct hpsb_host *host); -static void cmp_host_reset(struct hpsb_host *host); -static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf, - u64 addr, size_t length, u16 flags); -static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, - u64 addr, quadlet_t data, quadlet_t arg, int extcode, u16 flags); - -static struct hpsb_highlevel cmp_highlevel = { - .name = "cmp", - .add_host = cmp_add_host, - .host_reset = cmp_host_reset, -}; - -static struct hpsb_address_ops pcr_ops = { - .read = pcr_read, - .lock = pcr_lock, -}; - - -struct cmp_pcr * -cmp_register_opcr(struct hpsb_host *host, int opcr_number, int payload, - void (*update)(struct cmp_pcr *pcr, void *data), - void *data) -{ - struct cmp_host *ch; - struct plug *plug; - - ch = hpsb_get_hostinfo(&cmp_highlevel, host); - - if (opcr_number >= ch->u.ompr.nplugs || - ch->opcr[opcr_number].update != NULL) - return NULL; - - plug = &ch->opcr[opcr_number]; - plug->u.pcr.online = 1; - plug->u.pcr.bcast_count = 0; - plug->u.pcr.p2p_count = 0; - plug->u.pcr.overhead = 0; - plug->u.pcr.payload = payload; - plug->update = update; - plug->data = data; - - return &plug->u.pcr; -} - -void cmp_unregister_opcr(struct hpsb_host *host, struct cmp_pcr *opcr) -{ - struct cmp_host *ch; - struct plug *plug; - - ch = hpsb_get_hostinfo(&cmp_highlevel, host); - plug = (struct plug *)opcr; - if (plug - ch->opcr >= ch->u.ompr.nplugs) BUG(); - - plug->u.pcr.online = 0; - plug->update = NULL; -} - -static void reset_plugs(struct cmp_host *ch) -{ - int i; - - ch->u.ompr.non_persistent_ext = 0xff; - for (i = 0; i < ch->u.ompr.nplugs; i++) { - ch->opcr[i].u.pcr.bcast_count = 0; - ch->opcr[i].u.pcr.p2p_count = 0; - ch->opcr[i].u.pcr.overhead = 0; - } -} - -static void cmp_add_host(struct hpsb_host *host) -{ - struct cmp_host *ch = hpsb_create_hostinfo(&cmp_highlevel, host, sizeof (*ch)); - - if (ch == NULL) { - HPSB_ERR("Failed to allocate cmp_host"); - return; - } - - hpsb_register_addrspace(&cmp_highlevel, host, &pcr_ops, - CSR_REGISTER_BASE + CSR_PCR_MAP, - CSR_REGISTER_BASE + CSR_PCR_MAP_END); - - ch->host = host; - ch->u.ompr.rate = IEEE1394_SPEED_100; - ch->u.ompr.bcast_channel_base = 63; - ch->u.ompr.nplugs = 2; - - reset_plugs(ch); -} - -static void cmp_host_reset(struct hpsb_host *host) -{ - struct cmp_host *ch; - - ch = hpsb_get_hostinfo(&cmp_highlevel, host); - if (ch == NULL) { - HPSB_ERR("cmp: Tried to reset unknown host"); - return; - } - - reset_plugs(ch); -} - -static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf, - u64 addr, size_t length, u16 flags) -{ - int csraddr = addr - CSR_REGISTER_BASE; - int plug; - struct cmp_host *ch; - - if (length != 4) - return RCODE_TYPE_ERROR; - - ch = hpsb_get_hostinfo(&cmp_highlevel, host); - if (csraddr == 0x900) { - *buf = cpu_to_be32(ch->u.ompr_quadlet); - return RCODE_COMPLETE; - } - else if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) { - plug = (csraddr - 0x904) / 4; - *buf = cpu_to_be32(ch->opcr[plug].u.quadlet); - return RCODE_COMPLETE; - } - else if (csraddr < 0x980) { - return RCODE_ADDRESS_ERROR; - } - else if (csraddr == 0x980) { - *buf = cpu_to_be32(ch->v.impr_quadlet); - return RCODE_COMPLETE; - } - else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) { - plug = (csraddr - 0x984) / 4; - *buf = cpu_to_be32(ch->ipcr[plug].u.quadlet); - return RCODE_COMPLETE; - } - else - return RCODE_ADDRESS_ERROR; -} - -static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, - u64 addr, quadlet_t data, quadlet_t arg, int extcode, u16 flags) -{ - int csraddr = addr - CSR_REGISTER_BASE; - int plug; - struct cmp_host *ch; - - ch = hpsb_get_hostinfo(&cmp_highlevel, host); - - if (extcode != EXTCODE_COMPARE_SWAP) - return RCODE_TYPE_ERROR; - - if (csraddr == 0x900) { - /* FIXME: Ignore writes to bits 30-31 and 0-7 */ - *store = cpu_to_be32(ch->u.ompr_quadlet); - if (arg == cpu_to_be32(ch->u.ompr_quadlet)) - ch->u.ompr_quadlet = be32_to_cpu(data); - - return RCODE_COMPLETE; - } - if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) { - plug = (csraddr - 0x904) / 4; - *store = cpu_to_be32(ch->opcr[plug].u.quadlet); - - if (arg == *store) - ch->opcr[plug].u.quadlet = be32_to_cpu(data); - - if (be32_to_cpu(*store) != ch->opcr[plug].u.quadlet && - ch->opcr[plug].update != NULL) - ch->opcr[plug].update(&ch->opcr[plug].u.pcr, - ch->opcr[plug].data); - - return RCODE_COMPLETE; - } - else if (csraddr < 0x980) { - return RCODE_ADDRESS_ERROR; - } - else if (csraddr == 0x980) { - /* FIXME: Ignore writes to bits 24-31 and 0-7 */ - *store = cpu_to_be32(ch->u.ompr_quadlet); - if (arg == cpu_to_be32(ch->u.ompr_quadlet)) - ch->u.ompr_quadlet = be32_to_cpu(data); - - return RCODE_COMPLETE; - } - else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) { - plug = (csraddr - 0x984) / 4; - *store = cpu_to_be32(ch->ipcr[plug].u.quadlet); - - if (arg == *store) - ch->ipcr[plug].u.quadlet = be32_to_cpu(data); - - if (be32_to_cpu(*store) != ch->ipcr[plug].u.quadlet && - ch->ipcr[plug].update != NULL) - ch->ipcr[plug].update(&ch->ipcr[plug].u.pcr, - ch->ipcr[plug].data); - - return RCODE_COMPLETE; - } - else - return RCODE_ADDRESS_ERROR; -} - - -/* Module interface */ - -MODULE_AUTHOR("Kristian Hogsberg <hogsberg@users.sf.net>"); -MODULE_DESCRIPTION("Connection Management Procedures (CMP)"); -MODULE_SUPPORTED_DEVICE("cmp"); -MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(cmp_register_opcr); -EXPORT_SYMBOL(cmp_unregister_opcr); - -static int __init cmp_init_module (void) -{ - hpsb_register_highlevel (&cmp_highlevel); - - HPSB_INFO("Loaded CMP driver"); - - return 0; -} - -static void __exit cmp_exit_module (void) -{ - hpsb_unregister_highlevel(&cmp_highlevel); - - HPSB_INFO("Unloaded CMP driver"); -} - -module_init(cmp_init_module); -module_exit(cmp_exit_module); diff --git a/drivers/ieee1394/cmp.h b/drivers/ieee1394/cmp.h deleted file mode 100644 index f9288bfcd49..00000000000 --- a/drivers/ieee1394/cmp.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __CMP_H -#define __CMP_H - -struct cmp_mpr { - u32 nplugs:5; - u32 reserved:3; - u32 persistent_ext:8; - u32 non_persistent_ext:8; - u32 bcast_channel_base:6; - u32 rate:2; -} __attribute__((packed)); - -struct cmp_pcr { - u32 payload:10; - u32 overhead:4; - u32 speed:2; - u32 channel:6; - u32 reserved:2; - u32 p2p_count:6; - u32 bcast_count:1; - u32 online:1; -} __attribute__((packed)); - -struct cmp_pcr *cmp_register_opcr(struct hpsb_host *host, int plug, - int payload, - void (*update)(struct cmp_pcr *plug, - void *data), - void *data); -void cmp_unregister_opcr(struct hpsb_host *host, struct cmp_pcr *plug); - -#endif /* __CMP_H */ diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 2c674023a6a..b1b14f8d4dd 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -98,7 +98,7 @@ config TOUCHSCREEN_MK712 config TOUCHSCREEN_HP600 tristate "HP Jornada 680/690 touchscreen" - depends on SH_HP600 && SH_ADC + depends on SH_HP6XX && SH_ADC help Say Y here if you have a HP Jornada 680 or 690 and want to support the built-in touchscreen. diff --git a/drivers/md/md.c b/drivers/md/md.c index 1778104e106..7145cd150f7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3395,6 +3395,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) mddev->ctime = get_seconds(); mddev->level = info->level; + mddev->clevel[0] = 0; mddev->size = info->size; mddev->raid_disks = info->raid_disks; /* don't set md_minor, it is determined by which /dev/md* was diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c index f2957145003..a04bb61f21f 100644 --- a/drivers/media/dvb/bt8xx/bt878.c +++ b/drivers/media/dvb/bt8xx/bt878.c @@ -542,7 +542,7 @@ static struct pci_driver bt878_pci_driver = { .remove = bt878_remove, }; -static int bt878_pci_driver_registered = 0; +static int bt878_pci_driver_registered; /*******************************/ /* Module management functions */ diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 44fcbe77c8f..ea27b15007e 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -893,7 +893,7 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub) return 0; } -static int dvb_bt8xx_remove(struct bttv_sub_device *sub) +static void dvb_bt8xx_remove(struct bttv_sub_device *sub) { struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev); @@ -911,8 +911,6 @@ static int dvb_bt8xx_remove(struct bttv_sub_device *sub) dvb_unregister_adapter(&card->dvb_adapter); kfree(card); - - return 0; } static struct bttv_sub_driver driver = { diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 06b696e9acb..54f8b95717b 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c @@ -33,7 +33,7 @@ #include <linux/device.h> #include <linux/fs.h> #include <linux/cdev.h> - +#include <linux/mutex.h> #include "dvbdev.h" static int dvbdev_debug; @@ -44,7 +44,7 @@ MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off)."); #define dprintk if (dvbdev_debug) printk static LIST_HEAD(dvb_adapter_list); -static DECLARE_MUTEX(dvbdev_register_lock); +static DEFINE_MUTEX(dvbdev_register_lock); static const char * const dnames[] = { "video", "audio", "sec", "frontend", "demux", "dvr", "ca", @@ -202,11 +202,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, struct dvb_device *dvbdev; int id; - if (down_interruptible (&dvbdev_register_lock)) + if (mutex_lock_interruptible(&dvbdev_register_lock)) return -ERESTARTSYS; if ((id = dvbdev_get_free_id (adap, type)) < 0) { - up (&dvbdev_register_lock); + mutex_unlock(&dvbdev_register_lock); *pdvbdev = NULL; printk ("%s: could get find free device id...\n", __FUNCTION__); return -ENFILE; @@ -215,11 +215,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, *pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL); if (!dvbdev) { - up(&dvbdev_register_lock); + mutex_unlock(&dvbdev_register_lock); return -ENOMEM; } - up (&dvbdev_register_lock); + mutex_unlock(&dvbdev_register_lock); memcpy(dvbdev, template, sizeof(struct dvb_device)); dvbdev->type = type; @@ -289,11 +289,11 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu { int num; - if (down_interruptible (&dvbdev_register_lock)) + if (mutex_lock_interruptible(&dvbdev_register_lock)) return -ERESTARTSYS; if ((num = dvbdev_get_free_adapter_num ()) < 0) { - up (&dvbdev_register_lock); + mutex_unlock(&dvbdev_register_lock); return -ENFILE; } @@ -309,7 +309,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu list_add_tail (&adap->list_head, &dvb_adapter_list); - up (&dvbdev_register_lock); + mutex_unlock(&dvbdev_register_lock); return num; } @@ -320,10 +320,10 @@ int dvb_unregister_adapter(struct dvb_adapter *adap) { devfs_remove("dvb/adapter%d", adap->num); - if (down_interruptible (&dvbdev_register_lock)) + if (mutex_lock_interruptible(&dvbdev_register_lock)) return -ERESTARTSYS; list_del (&adap->list_head); - up (&dvbdev_register_lock); + mutex_unlock(&dvbdev_register_lock); return 0; } EXPORT_SYMBOL(dvb_unregister_adapter); diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 18d169836c9..a7fb06f4cd3 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -691,6 +691,8 @@ module_init (cxusb_module_init); module_exit (cxusb_module_exit); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); +MODULE_AUTHOR("Michael Krufky <mkrufky@m1k.net>"); +MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); MODULE_VERSION("1.0-alpha"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 757075f007c..1b9934ea5b0 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c @@ -333,7 +333,7 @@ struct dvb_pll_desc dvb_pll_tbmv30111in = { .name = "Samsung TBMV30111IN", .min = 54000000, .max = 860000000, - .count = 4, + .count = 6, .entries = { { 172000000, 44000000, 166666, 0xb4, 0x01 }, { 214000000, 44000000, 166666, 0xb4, 0x02 }, diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 327a8089193..27494901975 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -81,7 +81,7 @@ static int adac = DVB_ADAC_TI; static int hw_sections; static int rgb_on; static int volume = 255; -static int budgetpatch = 0; +static int budgetpatch; module_param_named(debug, av7110_debug, int, 0644); MODULE_PARM_DESC(debug, "debug level (bitmask, default 0)"); @@ -103,7 +103,7 @@ MODULE_PARM_DESC(budgetpatch, "use budget-patch hardware modification: default 0 static void restart_feeds(struct av7110 *av7110); -static int av7110_num = 0; +static int av7110_num; #define FE_FUNC_OVERRIDE(fe_func, av7110_copy, av7110_func) \ {\ diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c index cb377452b57..b2e63e9fc05 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.c +++ b/drivers/media/dvb/ttpci/av7110_hw.c @@ -146,52 +146,52 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len) { int i; int blocks, rest; - u32 base, bootblock = BOOT_BLOCK; + u32 base, bootblock = AV7110_BOOT_BLOCK; dprintk(4, "%p\n", av7110); - blocks = len / BOOT_MAX_SIZE; - rest = len % BOOT_MAX_SIZE; + blocks = len / AV7110_BOOT_MAX_SIZE; + rest = len % AV7110_BOOT_MAX_SIZE; base = DRAM_START_CODE; for (i = 0; i < blocks; i++) { - if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { + if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i); return -ETIMEDOUT; } dprintk(4, "writing DRAM block %d\n", i); mwdebi(av7110, DEBISWAB, bootblock, - ((char*)data) + i * BOOT_MAX_SIZE, BOOT_MAX_SIZE); + ((char*)data) + i * AV7110_BOOT_MAX_SIZE, AV7110_BOOT_MAX_SIZE); bootblock ^= 0x1400; - iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4); - iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, BOOT_MAX_SIZE, 2); - iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); - base += BOOT_MAX_SIZE; + iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4); + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, AV7110_BOOT_MAX_SIZE, 2); + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); + base += AV7110_BOOT_MAX_SIZE; } if (rest > 0) { - if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { + if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n"); return -ETIMEDOUT; } if (rest > 4) mwdebi(av7110, DEBISWAB, bootblock, - ((char*)data) + i * BOOT_MAX_SIZE, rest); + ((char*)data) + i * AV7110_BOOT_MAX_SIZE, rest); else mwdebi(av7110, DEBISWAB, bootblock, - ((char*)data) + i * BOOT_MAX_SIZE - 4, rest + 4); + ((char*)data) + i * AV7110_BOOT_MAX_SIZE - 4, rest + 4); - iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4); - iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, rest, 2); - iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); + iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4); + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, rest, 2); + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); } - if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { + if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n"); return -ETIMEDOUT; } - iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, 0, 2); - iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); - if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BOOT_COMPLETE) < 0) { + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, 0, 2); + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); + if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_AV7110_BOOT_COMPLETE) < 0) { printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n"); return -ETIMEDOUT; } @@ -262,7 +262,7 @@ int av7110_bootarm(struct av7110 *av7110) //saa7146_setgpio(dev, 3, SAA7146_GPIO_INPUT); mwdebi(av7110, DEBISWAB, DPRAM_BASE, bootcode, sizeof(bootcode)); - iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); + iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); if (saa7146_wait_for_debi_done(av7110->dev, 1)) { printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " diff --git a/drivers/media/dvb/ttpci/av7110_hw.h b/drivers/media/dvb/ttpci/av7110_hw.h index 84b83299b8b..4e173c67fbb 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.h +++ b/drivers/media/dvb/ttpci/av7110_hw.h @@ -18,7 +18,7 @@ enum av7110_bootstate { BOOTSTATE_BUFFER_EMPTY = 0, BOOTSTATE_BUFFER_FULL = 1, - BOOTSTATE_BOOT_COMPLETE = 2 + BOOTSTATE_AV7110_BOOT_COMPLETE = 2 }; enum av7110_type_rec_play_format @@ -295,11 +295,11 @@ enum av7110_command_type { #define DPRAM_BASE 0x4000 /* boot protocol area */ -#define BOOT_STATE (DPRAM_BASE + 0x3F8) -#define BOOT_SIZE (DPRAM_BASE + 0x3FA) -#define BOOT_BASE (DPRAM_BASE + 0x3FC) -#define BOOT_BLOCK (DPRAM_BASE + 0x400) -#define BOOT_MAX_SIZE 0xc00 +#define AV7110_BOOT_STATE (DPRAM_BASE + 0x3F8) +#define AV7110_BOOT_SIZE (DPRAM_BASE + 0x3FA) +#define AV7110_BOOT_BASE (DPRAM_BASE + 0x3FC) +#define AV7110_BOOT_BLOCK (DPRAM_BASE + 0x400) +#define AV7110_BOOT_MAX_SIZE 0xc00 /* firmware command protocol area */ #define IRQ_STATE (DPRAM_BASE + 0x0F4) diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index dd24896906f..faf728366c4 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -8,7 +8,8 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o zr36067-objs := zoran_procfs.o zoran_device.o \ zoran_driver.o zoran_card.o -tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o +tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \ + mt20xx.o tda8290.o tea5767.o msp3400-objs := msp3400-driver.o msp3400-kthreads.o diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 7d5a068353f..994b75fe165 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -129,9 +129,9 @@ static unsigned char yuv[MAX_AR_FRAME_BYTES]; static int freq = DEFAULT_FREQ; /* BCLK: available 50 or 70 (MHz) */ static int vga = 0; /* default mode(0:QVGA mode, other:VGA mode) */ static int vga_interlace = 0; /* 0 is normal mode for, else interlace mode */ -MODULE_PARM(freq, "i"); -MODULE_PARM(vga, "i"); -MODULE_PARM(vga_interlace, "i"); +module_param(freq, int, 0); +module_param(vga, int, 0); +module_param(vga_interlace, int, 0); static int ar_initialize(struct video_device *dev); diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 07c78f1f7a4..cc54b62f460 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -43,7 +43,7 @@ static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, I2C_CLIENT_END }; I2C_CLIENT_INSMOD; -int debug = 0; /* debug output */ +int debug; /* debug output */ module_param(debug, int, 0644); /* ---------------------------------------------------------------------- */ diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c index a48de3c0e3f..b4aca724927 100644 --- a/drivers/media/video/btcx-risc.c +++ b/drivers/media/video/btcx-risc.c @@ -37,7 +37,7 @@ MODULE_DESCRIPTION("some code shared by bttv and cx88xx drivers"); MODULE_AUTHOR("Gerd Knorr"); MODULE_LICENSE("GPL"); -static unsigned int debug = 0; +static unsigned int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)"); diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 65323e78d5f..9749d6ed623 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -92,8 +92,8 @@ static void identify_by_eeprom(struct bttv *btv, static int __devinit pvr_boot(struct bttv *btv); /* config variables */ -static unsigned int triton1=0; -static unsigned int vsfx=0; +static unsigned int triton1; +static unsigned int vsfx; static unsigned int latency = UNSET; int no_overlay=-1; @@ -106,7 +106,7 @@ static struct bttv *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL }; #ifdef MODULE static unsigned int autoload = 1; #else -static unsigned int autoload = 0; +static unsigned int autoload; #endif static unsigned int gpiomask = UNSET; static unsigned int audioall = UNSET; diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 0e697034678..aa4c4c52188 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -48,47 +48,46 @@ unsigned int bttv_num; /* number of Bt848s in use */ struct bttv bttvs[BTTV_MAX]; -unsigned int bttv_debug = 0; +unsigned int bttv_debug; unsigned int bttv_verbose = 1; -unsigned int bttv_gpio = 0; +unsigned int bttv_gpio; /* config variables */ #ifdef __BIG_ENDIAN static unsigned int bigendian=1; #else -static unsigned int bigendian=0; +static unsigned int bigendian; #endif static unsigned int radio[BTTV_MAX]; -static unsigned int irq_debug = 0; +static unsigned int irq_debug; static unsigned int gbuffers = 8; static unsigned int gbufsize = 0x208000; static int video_nr = -1; static int radio_nr = -1; static int vbi_nr = -1; -static int debug_latency = 0; +static int debug_latency; -static unsigned int fdsr = 0; +static unsigned int fdsr; /* options */ -static unsigned int combfilter = 0; -static unsigned int lumafilter = 0; +static unsigned int combfilter; +static unsigned int lumafilter; static unsigned int automute = 1; -static unsigned int chroma_agc = 0; +static unsigned int chroma_agc; static unsigned int adc_crush = 1; static unsigned int whitecrush_upper = 0xCF; static unsigned int whitecrush_lower = 0x7F; -static unsigned int vcr_hack = 0; -static unsigned int irq_iswitch = 0; +static unsigned int vcr_hack; +static unsigned int irq_iswitch; static unsigned int uv_ratio = 50; -static unsigned int full_luma_range = 0; -static unsigned int coring = 0; +static unsigned int full_luma_range; +static unsigned int coring; extern int no_overlay; /* API features (turn on/off stuff for testing) */ static unsigned int v4l2 = 1; - /* insmod args */ module_param(bttv_verbose, int, 0644); module_param(bttv_gpio, int, 0644); @@ -685,16 +684,16 @@ int check_alloc_btres(struct bttv *btv, struct bttv_fh *fh, int bit) return 1; /* is it free? */ - down(&btv->reslock); + mutex_lock(&btv->reslock); if (btv->resources & bit) { /* no, someone else uses it */ - up(&btv->reslock); + mutex_unlock(&btv->reslock); return 0; } /* it's free, grab it */ fh->resources |= bit; btv->resources |= bit; - up(&btv->reslock); + mutex_unlock(&btv->reslock); return 1; } @@ -717,10 +716,10 @@ void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) /* trying to free ressources not allocated by us ... */ printk("bttv: BUG! (btres)\n"); } - down(&btv->reslock); + mutex_lock(&btv->reslock); fh->resources &= ~bits; btv->resources &= ~bits; - up(&btv->reslock); + mutex_unlock(&btv->reslock); } /* ----------------------------------------------------------------------- */ @@ -1537,12 +1536,12 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) case VIDIOCSFREQ: { unsigned long *freq = arg; - down(&btv->lock); + mutex_lock(&btv->lock); btv->freq=*freq; bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq); if (btv->has_matchbox && btv->radio_user) tea5757_set_freq(btv,*freq); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -1572,10 +1571,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (v->mode >= BTTV_TVNORMS) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); set_tvnorm(btv,v->mode); bttv_call_i2c_clients(btv,cmd,v); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -1612,17 +1611,17 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (v->norm >= BTTV_TVNORMS) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); if (channel == btv->input && v->norm == btv->tvnorm) { /* nothing to do */ - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } btv->tvnorm = v->norm; set_input(btv,v->channel); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -1635,14 +1634,14 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) v->flags |= VIDEO_AUDIO_MUTABLE; v->mode = VIDEO_SOUND_MONO; - down(&btv->lock); + mutex_lock(&btv->lock); bttv_call_i2c_clients(btv,cmd,v); /* card specific hooks */ if (btv->audio_hook) btv->audio_hook(btv,v,0); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } case VIDIOCSAUDIO: @@ -1653,7 +1652,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (audio >= bttv_tvcards[btv->c.type].audio_inputs) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE); bttv_call_i2c_clients(btv,cmd,v); @@ -1661,7 +1660,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (btv->audio_hook) btv->audio_hook(btv,v,1); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -1695,10 +1694,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (i == BTTV_TVNORMS) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); set_tvnorm(btv,i); i2c_vidiocschan(btv); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } case VIDIOC_QUERYSTD: @@ -1756,9 +1755,9 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (*i > bttv_tvcards[btv->c.type].video_inputs) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); set_input(btv,*i); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -1770,7 +1769,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return -EINVAL; if (0 != t->index) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); memset(t,0,sizeof(*t)); strcpy(t->name, "Television"); t->type = V4L2_TUNER_ANALOG_TV; @@ -1805,7 +1804,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) } } /* FIXME: fill capability+audmode */ - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } case VIDIOC_S_TUNER: @@ -1816,7 +1815,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return -EINVAL; if (0 != t->index) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); { struct video_audio va; memset(&va, 0, sizeof(struct video_audio)); @@ -1833,7 +1832,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (btv->audio_hook) btv->audio_hook(btv,&va,1); } - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -1854,12 +1853,12 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return -EINVAL; if (unlikely (f->type != V4L2_TUNER_ANALOG_TV)) return -EINVAL; - down(&btv->lock); + mutex_lock(&btv->lock); btv->freq = f->frequency; bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq); if (btv->has_matchbox && btv->radio_user) tea5757_set_freq(btv,btv->freq); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } case VIDIOC_LOG_STATUS: @@ -3157,7 +3156,7 @@ static int radio_open(struct inode *inode, struct file *file) return -ENODEV; dprintk("bttv%d: open called (radio)\n",btv->c.nr); - down(&btv->lock); + mutex_lock(&btv->lock); btv->radio_user++; @@ -3166,7 +3165,7 @@ static int radio_open(struct inode *inode, struct file *file) bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); audio_mux(btv,AUDIO_RADIO); - up(&btv->lock); + mutex_unlock(&btv->lock); return 0; } @@ -3921,8 +3920,8 @@ static int __devinit bttv_probe(struct pci_dev *dev, sprintf(btv->c.name,"bttv%d",btv->c.nr); /* initialize structs / fill in defaults */ - init_MUTEX(&btv->lock); - init_MUTEX(&btv->reslock); + mutex_init(&btv->lock); + mutex_init(&btv->reslock); spin_lock_init(&btv->s_lock); spin_lock_init(&btv->gpio_lock); init_waitqueue_head(&btv->gpioq); diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 748d630c7fe..614c1201855 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -41,9 +41,9 @@ static struct i2c_client bttv_i2c_client_template; static int attach_inform(struct i2c_client *client); -static int i2c_debug = 0; -static int i2c_hw = 0; -static int i2c_scan = 0; +static int i2c_debug; +static int i2c_hw; +static int i2c_scan; module_param(i2c_debug, int, 0644); module_param(i2c_hw, int, 0444); module_param(i2c_scan, int, 0444); diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index dd00c20ab95..9cb72f176f7 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h @@ -35,6 +35,7 @@ #include <linux/videodev.h> #include <linux/pci.h> #include <linux/input.h> +#include <linux/mutex.h> #include <asm/scatterlist.h> #include <asm/io.h> @@ -309,9 +310,9 @@ struct bttv { /* locking */ spinlock_t s_lock; - struct semaphore lock; + struct mutex lock; int resources; - struct semaphore reslock; + struct mutex reslock; #ifdef VIDIOC_G_PRIORITY struct v4l2_prio_state prio; #endif diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 1d75a42629d..c66c2c1f480 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -43,7 +43,7 @@ MODULE_LICENSE("GPL"); static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; -int cx25840_debug = 0; +static int cx25840_debug; module_param_named(debug,cx25840_debug, int, 0644); diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 76fcb4e995c..53308911ae6 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -31,8 +31,7 @@ config VIDEO_CX88_DVB config VIDEO_CX88_ALSA tristate "ALSA DMA audio support" - depends on VIDEO_CX88 && SND - select SND_PCM_OSS + depends on VIDEO_CX88 && SND && EXPERIMENTAL ---help--- This is a video4linux driver for direct (DMA) audio on Conexant 2388x based TV cards. diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index e4b2134fe56..6e5eaa22619 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile @@ -5,6 +5,7 @@ cx8802-objs := cx88-mpeg.o obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o +obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o EXTRA_CFLAGS += -I$(src)/.. EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 7695b521eb3..a2e36a1e5f5 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -116,7 +116,7 @@ MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Conexant,23881}," "{{Conexant,23882}," "{{Conexant,23883}"); -static unsigned int debug = 0; +static unsigned int debug; module_param(debug,int,0644); MODULE_PARM_DESC(debug,"enable debug messages"); @@ -333,10 +333,10 @@ static snd_pcm_hardware_t snd_cx88_digital_hw = { .channels_min = 1, .channels_max = 2, .buffer_bytes_max = (2*2048), - .period_bytes_min = 256, + .period_bytes_min = 2048, .period_bytes_max = 2048, .periods_min = 2, - .periods_max = 16, + .periods_max = 2, }; /* @@ -653,7 +653,7 @@ static void snd_cx88_dev_free(snd_card_t * card) * Alsa Constructor - Component probe */ -static int devno=0; +static int devno; static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci, snd_cx88_card_t **rchip) { @@ -805,7 +805,6 @@ static struct pci_driver cx88_audio_pci_driver = { .id_table = cx88_audio_pci_tbl, .probe = cx88_audio_initdev, .remove = cx88_audio_finidev, - SND_PCI_PM_CALLBACKS }; /**************************************************************************** diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 194446f28c5..8d6d6a6cf78 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -32,6 +32,7 @@ #include <linux/pci.h> #include <linux/delay.h> #include <linux/videodev2.h> +#include <linux/mutex.h> #include "cx88.h" #include <media/v4l2-common.h> @@ -75,7 +76,7 @@ MODULE_PARM_DESC(nocomb,"disable comb filter"); static unsigned int cx88_devcount; static LIST_HEAD(cx88_devlist); -static DECLARE_MUTEX(devlist); +static DEFINE_MUTEX(devlist); #define NO_SYNC_LINE (-1U) @@ -1036,7 +1037,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) struct list_head *item; int i; - down(&devlist); + mutex_lock(&devlist); list_for_each(item,&cx88_devlist) { core = list_entry(item, struct cx88_core, devlist); if (pci->bus->number != core->pci_bus) @@ -1047,7 +1048,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) if (0 != get_ressources(core,pci)) goto fail_unlock; atomic_inc(&core->refcount); - up(&devlist); + mutex_unlock(&devlist); return core; } core = kzalloc(sizeof(*core),GFP_KERNEL); @@ -1122,13 +1123,13 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) cx88_card_setup(core); cx88_ir_init(core,pci); - up(&devlist); + mutex_unlock(&devlist); return core; fail_free: kfree(core); fail_unlock: - up(&devlist); + mutex_unlock(&devlist); return NULL; } @@ -1140,14 +1141,14 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) if (!atomic_dec_and_test(&core->refcount)) return; - down(&devlist); + mutex_lock(&devlist); cx88_ir_fini(core); if (0 == core->i2c_rc) i2c_bit_del_bus(&core->i2c_adap); list_del(&core->devlist); iounmap(core->lmmio); cx88_devcount--; - up(&devlist); + mutex_unlock(&devlist); kfree(core); } diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 24118e43e73..da8d97ce0c4 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -60,6 +60,11 @@ static unsigned int audio_debug = 0; module_param(audio_debug, int, 0644); MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); +static unsigned int always_analog = 0; +module_param(always_analog,int,0644); +MODULE_PARM_DESC(always_analog,"force analog audio out"); + + #define dprintk(fmt, arg...) if (audio_debug) \ printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) @@ -155,7 +160,8 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) cx_write(AUD_I2SOUTPUTCNTL, 1); cx_write(AUD_I2SCNTL, 0); /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */ - } else { + } + if ((always_analog) || (!cx88_boards[core->board].blackbird)) { ctl |= EN_DAC_ENABLE; cx_write(AUD_CTL, ctl); } diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c index 372cd29cedb..751a754a45e 100644 --- a/drivers/media/video/cx88/cx88-vp3054-i2c.c +++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c @@ -32,6 +32,10 @@ #include "cx88-vp3054-i2c.h" +MODULE_DESCRIPTION("driver for cx2388x VP3054 design"); +MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); +MODULE_LICENSE("GPL"); + /* ----------------------------------------------------------------------- */ static void vp3054_bit_setscl(void *data, int state) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 9b94f77d6fd..30dfa5370c7 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -76,6 +76,58 @@ static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = { [ 0x40 ] = KEY_ZOOM, }; +static IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE] = { + [ 0x3a ] = KEY_KP0, + [ 0x31 ] = KEY_KP1, + [ 0x32 ] = KEY_KP2, + [ 0x33 ] = KEY_KP3, + [ 0x34 ] = KEY_KP4, + [ 0x35 ] = KEY_KP5, + [ 0x36 ] = KEY_KP6, + [ 0x37 ] = KEY_KP7, + [ 0x38 ] = KEY_KP8, + [ 0x39 ] = KEY_KP9, + + [ 0x2f ] = KEY_POWER, + + [ 0x2e ] = KEY_P, + [ 0x1f ] = KEY_L, + [ 0x2b ] = KEY_I, + + [ 0x2d ] = KEY_ZOOM, + [ 0x1e ] = KEY_ZOOM, + [ 0x1b ] = KEY_VOLUMEUP, + [ 0x0f ] = KEY_VOLUMEDOWN, + [ 0x17 ] = KEY_CHANNELUP, + [ 0x1c ] = KEY_CHANNELDOWN, + [ 0x25 ] = KEY_INFO, + + [ 0x3c ] = KEY_MUTE, + + [ 0x3d ] = KEY_LEFT, + [ 0x3b ] = KEY_RIGHT, + + [ 0x3f ] = KEY_UP, + [ 0x3e ] = KEY_DOWN, + [ 0x1a ] = KEY_PAUSE, + + [ 0x1d ] = KEY_MENU, + [ 0x19 ] = KEY_PLAY, + [ 0x16 ] = KEY_REWIND, + [ 0x13 ] = KEY_FORWARD, + [ 0x15 ] = KEY_PAUSE, + [ 0x0e ] = KEY_REWIND, + [ 0x0d ] = KEY_PLAY, + [ 0x0b ] = KEY_STOP, + [ 0x07 ] = KEY_FORWARD, + [ 0x27 ] = KEY_RECORD, + [ 0x26 ] = KEY_TUNER, + [ 0x29 ] = KEY_TEXT, + [ 0x2a ] = KEY_MEDIA, + [ 0x18 ] = KEY_EPG, + [ 0x27 ] = KEY_RECORD, +}; + /* ----------------------------------------------------------------------- */ static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) @@ -138,6 +190,28 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) return 1; } +static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char buf[3]; + + /* poll IR chip */ + + if (3 != i2c_master_recv(&ir->c,buf,3)) { + dprintk("read error\n"); + return -EIO; + } + + dprintk("key %02x\n", buf[2]&0x3f); + if (buf[0]!=0x00){ + return 0; + } + + *ir_key = buf[2]&0x3f; + *ir_raw = buf[2]&0x3f; + + return 1; +} + /* ----------------------------------------------------------------------- */ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) { @@ -159,6 +233,9 @@ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); break; case (EM2820_BOARD_PINNACLE_USB_2): + ir->ir_codes = ir_codes_em_pinnacle_usb; + ir->get_key = get_key_pinnacle_usb; + snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)"); break; case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): ir->ir_codes = ir_codes_hauppauge_new; diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 3323dffe26a..eea304f7517 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -29,6 +29,7 @@ #include <linux/i2c.h> #include <linux/version.h> #include <linux/video_decoder.h> +#include <linux/mutex.h> #include "em28xx.h" #include <media/tuner.h> @@ -191,7 +192,7 @@ static struct v4l2_queryctrl saa711x_qctrl[] = { static struct usb_driver em28xx_usb_driver; -static DECLARE_MUTEX(em28xx_sysfs_lock); +static DEFINE_MUTEX(em28xx_sysfs_lock); static DECLARE_RWSEM(em28xx_disconnect); /********************* v4l2 interface ******************************************/ @@ -394,7 +395,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) */ static void em28xx_release_resources(struct em28xx *dev) { - down(&em28xx_sysfs_lock); + mutex_lock(&em28xx_sysfs_lock); em28xx_info("V4L2 device /dev/video%d deregistered\n", dev->vdev->minor); @@ -403,7 +404,7 @@ static void em28xx_release_resources(struct em28xx *dev) /* video_unregister_device(dev->vbi_dev); */ em28xx_i2c_unregister(dev); usb_put_dev(dev->udev); - up(&em28xx_sysfs_lock); + mutex_unlock(&em28xx_sysfs_lock); } /* diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 9b05a0ab776..69ed369c2f4 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c @@ -66,12 +66,12 @@ MODULE_LICENSE("GPL"); /* module parameters */ static int opmode = OPMODE_AUTO; -int msp_debug = 0; /* msp_debug output */ -int msp_once = 0; /* no continous stereo monitoring */ -int msp_amsound = 0; /* hard-wire AM sound at 6.5 Hz (france), - the autoscan seems work well only with FM... */ +int msp_debug; /* msp_debug output */ +int msp_once; /* no continous stereo monitoring */ +int msp_amsound; /* hard-wire AM sound at 6.5 Hz (france), + the autoscan seems work well only with FM... */ int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */ -int msp_dolby = 0; +int msp_dolby; int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual (msp34xxg only) 0x00a0-0x03c0 */ @@ -1031,8 +1031,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) } default: - /* nothing */ - break; + /* unknown */ + return -EINVAL; } return 0; } diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h index 70a5ef8ba01..a9ac57d0700 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400.h @@ -6,14 +6,6 @@ /* ---------------------------------------------------------------------- */ -struct msp_matrix { - int input; - int output; -}; - -/* ioctl for MSP_SET_MATRIX will have to be registered */ -#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) - /* This macro is allowed for *constants* only, gcc must calculate it at compile time. Remember -- no floats in kernel mode */ #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24))) diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 0bf1caac588..c7c9f3f8715 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c @@ -353,8 +353,8 @@ static int mt2032_init(struct i2c_client *c) } while (xok != 1 ); t->xogc=xogc; - t->tv_freq = mt2032_set_tv_freq; - t->radio_freq = mt2032_set_radio_freq; + t->set_tv_freq = mt2032_set_tv_freq; + t->set_radio_freq = mt2032_set_radio_freq; return(1); } @@ -481,8 +481,8 @@ static int mt2050_init(struct i2c_client *c) i2c_master_recv(c,buf,1); tuner_dbg("mt2050: sro is %x\n",buf[0]); - t->tv_freq = mt2050_set_tv_freq; - t->radio_freq = mt2050_set_radio_freq; + t->set_tv_freq = mt2050_set_tv_freq; + t->set_radio_freq = mt2050_set_radio_freq; return 0; } @@ -494,8 +494,8 @@ int microtune_init(struct i2c_client *c) int company_code; memset(buf,0,sizeof(buf)); - t->tv_freq = NULL; - t->radio_freq = NULL; + t->set_tv_freq = NULL; + t->set_radio_freq = NULL; t->standby = NULL; if (t->std & V4L2_STD_525_60) { tuner_dbg("pinnacle ntsc\n"); diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index b19c33434ea..f3fc361bec9 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c @@ -76,9 +76,9 @@ static volatile struct planb_registers *planb_regs; static int def_norm = PLANB_DEF_NORM; /* default norm */ static int video_nr = -1; -MODULE_PARM(def_norm, "i"); +module_param(def_norm, int, 0); MODULE_PARM_DESC(def_norm, "Default startup norm (0=PAL, 1=NTSC, 2=SECAM)"); -MODULE_PARM(video_nr,"i"); +module_param(video_nr, int, 0); MODULE_LICENSE("GPL"); diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index e70b17ef36e..d17395c4f55 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -50,15 +50,15 @@ static unsigned int rbds = 0; static unsigned int plvl = 0; static unsigned int bufblocks = 100; -MODULE_PARM(debug, "i"); +module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); -MODULE_PARM(xtal, "i"); +module_param(xtal, int, 0); MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0"); -MODULE_PARM(rbds, "i"); +module_param(rbds, int, 0); MODULE_PARM_DESC(rbds, "select mode, 0=RDS, 1=RBDS, default 0"); -MODULE_PARM(plvl, "i"); +module_param(plvl, int, 0); MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0"); -MODULE_PARM(bufblocks, "i"); +module_param(bufblocks, int, 0); MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100"); MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder"); diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index ae53063875f..6c161f2f5e2 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -52,7 +52,7 @@ MODULE_LICENSE("GPL"); #include <linux/video_decoder.h> static int debug = 0; -MODULE_PARM(debug, "i"); +module_param(debug, int, 0644); MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)"); diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 275d06af69d..c64718aec9c 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2515,6 +2515,7 @@ struct saa7134_board saa7134_boards[] = { .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .mpeg = SAA7134_MPEG_DVB, + .gpiomask = 1 << 21, .inputs = {{ .name = name_tv, .vmux = 1, @@ -2529,6 +2530,11 @@ struct saa7134_board saa7134_boards[] = { .vmux = 8, .amux = LINE1, }}, + .radio = { + .name = name_radio, + .amux = TV, + .gpio = 0x0200000, + }, }, [SAA7134_BOARD_MSI_TVATANYWHERE_PLUS] = { .name = "MSI TV@Anywhere plus", diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 3983a6524ca..028904bd94a 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -31,6 +31,7 @@ #include <linux/sound.h> #include <linux/interrupt.h> #include <linux/delay.h> +#include <linux/mutex.h> #include "saa7134-reg.h" #include "saa7134.h" @@ -84,7 +85,7 @@ MODULE_PARM_DESC(radio_nr, "radio device number"); MODULE_PARM_DESC(tuner, "tuner type"); MODULE_PARM_DESC(card, "card type"); -static DECLARE_MUTEX(devlist_lock); +static DEFINE_MUTEX(devlist_lock); LIST_HEAD(saa7134_devlist); static LIST_HEAD(mops_list); static unsigned int saa7134_devcount; @@ -140,7 +141,7 @@ static int pending_call(struct notifier_block *self, unsigned long state, return NOTIFY_DONE; } -static int pending_registered=0; +static int pending_registered; static struct notifier_block pending_notifier = { .notifier_call = pending_call, }; @@ -969,13 +970,13 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, pci_set_drvdata(pci_dev,dev); saa7134_devcount++; - down(&devlist_lock); + mutex_lock(&devlist_lock); list_for_each(item,&mops_list) { mops = list_entry(item, struct saa7134_mpeg_ops, next); mpeg_ops_attach(mops, dev); } list_add_tail(&dev->devlist,&saa7134_devlist); - up(&devlist_lock); + mutex_unlock(&devlist_lock); /* check for signal */ saa7134_irq_video_intl(dev); @@ -1031,13 +1032,13 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) saa7134_hwfini(dev); /* unregister */ - down(&devlist_lock); + mutex_lock(&devlist_lock); list_del(&dev->devlist); list_for_each(item,&mops_list) { mops = list_entry(item, struct saa7134_mpeg_ops, next); mpeg_ops_detach(mops, dev); } - up(&devlist_lock); + mutex_unlock(&devlist_lock); saa7134_devcount--; saa7134_i2c_unregister(dev); @@ -1071,13 +1072,13 @@ int saa7134_ts_register(struct saa7134_mpeg_ops *ops) struct list_head *item; struct saa7134_dev *dev; - down(&devlist_lock); + mutex_lock(&devlist_lock); list_for_each(item,&saa7134_devlist) { dev = list_entry(item, struct saa7134_dev, devlist); mpeg_ops_attach(ops, dev); } list_add_tail(&ops->next,&mops_list); - up(&devlist_lock); + mutex_unlock(&devlist_lock); return 0; } @@ -1086,13 +1087,13 @@ void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops) struct list_head *item; struct saa7134_dev *dev; - down(&devlist_lock); + mutex_lock(&devlist_lock); list_del(&ops->next); list_for_each(item,&saa7134_devlist) { dev = list_entry(item, struct saa7134_dev, devlist); mpeg_ops_detach(ops, dev); } - up(&devlist_lock); + mutex_unlock(&devlist_lock); } EXPORT_SYMBOL(saa7134_ts_register); diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 93268427750..afa4dcb3f96 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -180,8 +180,8 @@ static void tvaudio_init(struct saa7134_dev *dev) saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); - // frame locked audio was reported not to be reliable - saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x02); + /* frame locked audio is mandatory for NICAM */ + saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01); saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); @@ -809,7 +809,12 @@ static int tvaudio_thread_ddep(void *data) dprintk("ddep override: %s\n",stdres[audio_ddep]); } else if (&card(dev).radio == dev->input) { dprintk("FM Radio\n"); - norms = (0x0f << 2) | 0x01; + if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { + norms = (0x11 << 2) | 0x01; + saa_dsp_writel(dev, 0x42c >> 2, 0x729555); + } else { + norms = (0x0f << 2) | 0x01; + } } else { /* (let chip) scan for sound carrier */ norms = 0; diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 2498b76df42..7b4fb282ac8 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -567,8 +567,8 @@ int tda8290_init(struct i2c_client *c) } tuner_info("tuner: type set to %s\n", c->name); - t->tv_freq = set_tv_freq; - t->radio_freq = set_radio_freq; + t->set_tv_freq = set_tv_freq; + t->set_radio_freq = set_radio_freq; t->has_signal = has_signal; t->standby = standby; t->tda827x_lpsel = 0; diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index 921fe72f23d..c2b98f81c19 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c @@ -62,7 +62,7 @@ extern int tuner_debug; #define TEA5767_PORT1_HIGH 0x01 -/* Forth register */ +/* Fourth register */ #define TEA5767_PORT2_HIGH 0x80 /* Chips stops working. Only I2C bus remains on */ #define TEA5767_STDBY 0x40 @@ -85,7 +85,7 @@ extern int tuner_debug; /* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ #define TEA5767_SRCH_IND 0x01 -/* Fiveth register */ +/* Fifth register */ /* By activating, it will use Xtal at 13 MHz as reference for divider */ #define TEA5767_PLLREF_ENABLE 0x80 @@ -109,13 +109,13 @@ extern int tuner_debug; #define TEA5767_STEREO_MASK 0x80 #define TEA5767_IF_CNTR_MASK 0x7f -/* Four register */ +/* Fourth register */ #define TEA5767_ADC_LEVEL_MASK 0xf0 /* should be 0 */ #define TEA5767_CHIP_ID_MASK 0x0f -/* Fiveth register */ +/* Fifth register */ /* Reserved for future extensions */ #define TEA5767_RESERVED_MASK 0xff @@ -220,19 +220,19 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq) tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); buffer[2] |= TEA5767_HIGH_LO_INJECT; buffer[4] |= TEA5767_PLLREF_ENABLE; - div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000; + div = (frq * (4000 / 16) + 700000 + 225000 + 25000) / 50000; break; case TEA5767_LOW_LO_13MHz: tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); buffer[4] |= TEA5767_PLLREF_ENABLE; - div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000; + div = (frq * (4000 / 16) - 700000 - 225000 + 25000) / 50000; break; case TEA5767_LOW_LO_32768: tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); buffer[3] |= TEA5767_XTAL_32768; /* const 700=4000*175 Khz - to adjust freq to right value */ - div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15; + div = ((frq * (4000 / 16) - 700000 - 225000) + 16384) >> 15; break; case TEA5767_HIGH_LO_32768: default: @@ -350,8 +350,8 @@ int tea5767_tuner_init(struct i2c_client *c) tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); strlcpy(c->name, "tea5767", sizeof(c->name)); - t->tv_freq = set_tv_freq; - t->radio_freq = set_radio_freq; + t->set_tv_freq = set_tv_freq; + t->set_radio_freq = set_radio_freq; t->has_signal = tea5767_signal; t->is_stereo = tea5767_stereo; t->standby = tea5767_standby; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index f30ef79d795..2995b22acb4 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -82,7 +82,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) tuner_warn ("tuner type not set\n"); return; } - if (NULL == t->tv_freq) { + if (NULL == t->set_tv_freq) { tuner_warn ("Tuner has no way to set tv freq\n"); return; } @@ -90,8 +90,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", freq / 16, freq % 16 * 100 / 16, tv_range[0], tv_range[1]); + /* V4L2 spec: if the freq is not possible then the closest + possible value should be selected */ + if (freq < tv_range[0] * 16) + freq = tv_range[0] * 16; + else + freq = tv_range[1] * 16; } - t->tv_freq(c, freq); + t->set_tv_freq(c, freq); } static void set_radio_freq(struct i2c_client *c, unsigned int freq) @@ -102,18 +108,23 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) tuner_warn ("tuner type not set\n"); return; } - if (NULL == t->radio_freq) { + if (NULL == t->set_radio_freq) { tuner_warn ("tuner has no way to set radio frequency\n"); return; } - if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) { + if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) { tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", freq / 16000, freq % 16000 * 100 / 16000, radio_range[0], radio_range[1]); + /* V4L2 spec: if the freq is not possible then the closest + possible value should be selected */ + if (freq < radio_range[0] * 16000) + freq = radio_range[0] * 16000; + else + freq = radio_range[1] * 16000; } - t->radio_freq(c, freq); - return; + t->set_radio_freq(c, freq); } static void set_freq(struct i2c_client *c, unsigned long freq) @@ -125,15 +136,16 @@ static void set_freq(struct i2c_client *c, unsigned long freq) tuner_dbg("radio freq set to %lu.%02lu\n", freq / 16000, freq % 16000 * 100 / 16000); set_radio_freq(c, freq); + t->radio_freq = freq; break; case V4L2_TUNER_ANALOG_TV: case V4L2_TUNER_DIGITAL_TV: tuner_dbg("tv freq set to %lu.%02lu\n", freq / 16, freq % 16 * 100 / 16); set_tv_freq(c, freq); + t->tv_freq = freq; break; } - t->freq = freq; } static void set_type(struct i2c_client *c, unsigned int type, @@ -212,7 +224,7 @@ static void set_type(struct i2c_client *c, unsigned int type, if (t->mode_mask == T_UNINITIALIZED) t->mode_mask = new_mode_mask; - set_freq(c, t->freq); + set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq); tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", c->adapter->name, c->driver->driver.name, c->addr << 1, type, t->mode_mask); @@ -377,11 +389,11 @@ static void tuner_status(struct i2c_client *client) default: p = "undefined"; break; } if (t->mode == V4L2_TUNER_RADIO) { - freq = t->freq / 16000; - freq_fraction = (t->freq % 16000) * 100 / 16000; + freq = t->radio_freq / 16000; + freq_fraction = (t->radio_freq % 16000) * 100 / 16000; } else { - freq = t->freq / 16; - freq_fraction = (t->freq % 16) * 100 / 16; + freq = t->tv_freq / 16; + freq_fraction = (t->tv_freq % 16) * 100 / 16; } tuner_info("Tuner mode: %s\n", p); tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); @@ -456,7 +468,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) t->type = TUNER_TEA5767; t->mode_mask = T_RADIO; t->mode = T_STANDBY; - t->freq = 87.5 * 16; /* Sets freq to FM range */ + t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */ default_mode_mask &= ~T_RADIO; goto register_client; @@ -469,7 +481,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) if (default_mode_mask != T_UNINITIALIZED) { tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); t->mode_mask = default_mode_mask; - t->freq = 400 * 16; /* Sets freq to VHF High */ + t->tv_freq = 400 * 16; /* Sets freq to VHF High */ + t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */ default_mode_mask = T_UNINITIALIZED; } @@ -565,16 +578,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) set_addr(client, (struct tuner_setup *)arg); break; case AUDC_SET_RADIO: - set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); + if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") + == EINVAL) + return 0; + if (t->radio_freq) + set_freq(client, t->radio_freq); break; case TUNER_SET_STANDBY: - { - if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) - return 0; - if (t->standby) - t->standby (client); - break; - } + if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) + return 0; + if (t->standby) + t->standby (client); + break; case VIDIOCSAUDIO: if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) return 0; @@ -583,7 +598,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) /* Should be implemented, since bttv calls it */ tuner_dbg("VIDIOCSAUDIO not implemented.\n"); - break; /* --- v4l ioctls --- */ /* take care: bttv does userspace copying, we'll get a @@ -609,8 +623,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) if (vc->norm < ARRAY_SIZE(map)) t->std = map[vc->norm]; tuner_fixup_std(t); - if (t->freq) - set_tv_freq(client, t->freq); + if (t->tv_freq) + set_tv_freq(client, t->tv_freq); return 0; } case VIDIOCSFREQ: @@ -684,15 +698,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) t->std = *id; tuner_fixup_std(t); - if (t->freq) - set_freq(client, t->freq); + if (t->tv_freq) + set_freq(client, t->tv_freq); break; } case VIDIOC_S_FREQUENCY: { struct v4l2_frequency *f = arg; - t->freq = f->frequency; switch_v4l2(); if (V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode) { @@ -700,7 +713,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) == EINVAL) return 0; } - set_freq(client,t->freq); + set_freq(client,f->frequency); break; } @@ -712,7 +725,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; switch_v4l2(); f->type = t->mode; - f->frequency = t->freq; + f->frequency = (V4L2_TUNER_RADIO == t->mode) ? + t->radio_freq : t->tv_freq; break; } case VIDIOC_G_TUNER: @@ -763,7 +777,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) if (V4L2_TUNER_RADIO == t->mode) { t->audmode = tuner->audmode; - set_radio_freq(client, t->freq); + set_radio_freq(client, t->radio_freq); } break; } @@ -791,8 +805,13 @@ static int tuner_resume(struct device *dev) struct tuner *t = i2c_get_clientdata (c); tuner_dbg ("resume\n"); - if (t->freq) - set_freq(c, t->freq); + if (V4L2_TUNER_RADIO == t->mode) { + if (t->radio_freq) + set_freq(c, t->radio_freq); + } else { + if (t->tv_freq) + set_freq(c, t->tv_freq); + } return 0; } diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index e5fb7436583..37977ff4978 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -79,722 +79,16 @@ MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner"); #define TUNER_PLL_LOCKED 0x40 #define TUNER_STEREO_MK3 0x04 -#define TUNER_MAX_RANGES 3 - -/* ---------------------------------------------------------------------- */ - -struct tunertype -{ - char *name; - - int count; - struct { - unsigned short thresh; - unsigned char cb; - } ranges[TUNER_MAX_RANGES]; - unsigned char config; -}; - -/* - * The floats in the tuner struct are computed at compile time - * by gcc and cast back to integers. Thus we don't violate the - * "no float in kernel" rule. +#define TUNER_PARAM_ANALOG 0 /* to be removed */ +/* FIXME: + * Right now, all tuners are using the first tuner_params[] array element + * for analog mode. In the future, we will be merging similar tuner + * definitions together, such that each tuner definition will have a + * tuner_params struct for each available video standard. At that point, + * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array + * element will be chosen based on the video standard in use. + * */ -static struct tunertype tuners[] = { - /* 0-9 */ - [TUNER_TEMIC_PAL] = { /* TEMIC PAL */ - .name = "Temic PAL (4002 FH5)", - .count = 3, - .ranges = { - { 16 * 140.25 /*MHz*/, 0x02, }, - { 16 * 463.25 /*MHz*/, 0x04, }, - { 16 * 999.99 , 0x01, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */ - .name = "Philips PAL_I (FI1246 and compatibles)", - .count = 3, - .ranges = { - { 16 * 140.25 /*MHz*/, 0xa0, }, - { 16 * 463.25 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */ - .name = "Philips NTSC (FI1236,FM1236 and compatibles)", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0xa0, }, - { 16 * 451.25 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */ - .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)", - .count = 3, - .ranges = { - { 16 * 168.25 /*MHz*/, 0xa7, }, - { 16 * 447.25 /*MHz*/, 0x97, }, - { 16 * 999.99 , 0x37, }, - }, - .config = 0x8e, - }, - [TUNER_ABSENT] = { /* Tuner Absent */ - .name = "NoTuner", - .count = 1, - .ranges = { - { 0, 0x00, }, - }, - .config = 0x00, - }, - [TUNER_PHILIPS_PAL] = { /* Philips PAL */ - .name = "Philips PAL_BG (FI1216 and compatibles)", - .count = 3, - .ranges = { - { 16 * 168.25 /*MHz*/, 0xa0, }, - { 16 * 447.25 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */ - .name = "Temic NTSC (4032 FY5)", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0x02, }, - { 16 * 463.25 /*MHz*/, 0x04, }, - { 16 * 999.99 , 0x01, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */ - .name = "Temic PAL_I (4062 FY5)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0x02, }, - { 16 * 450.00 /*MHz*/, 0x04, }, - { 16 * 999.99 , 0x01, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */ - .name = "Temic NTSC (4036 FY5)", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0xa0, }, - { 16 * 463.25 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */ - .name = "Alps HSBH1", - .count = 3, - .ranges = { - { 16 * 137.25 /*MHz*/, 0x01, }, - { 16 * 385.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - - /* 10-19 */ - [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */ - .name = "Alps TSBE1", - .count = 3, - .ranges = { - { 16 * 137.25 /*MHz*/, 0x01, }, - { 16 * 385.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */ - .name = "Alps TSBB5", - .count = 3, - .ranges = { - { 16 * 133.25 /*MHz*/, 0x01, }, - { 16 * 351.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */ - .name = "Alps TSBE5", - .count = 3, - .ranges = { - { 16 * 133.25 /*MHz*/, 0x01, }, - { 16 * 351.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */ - .name = "Alps TSBC5", - .count = 3, - .ranges = { - { 16 * 133.25 /*MHz*/, 0x01, }, - { 16 * 351.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */ - .name = "Temic PAL_BG (4006FH5)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */ - .name = "Alps TSCH6", - .count = 3, - .ranges = { - { 16 * 137.25 /*MHz*/, 0x14, }, - { 16 * 385.25 /*MHz*/, 0x12, }, - { 16 * 999.99 , 0x11, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */ - .name = "Temic PAL_DK (4016 FY5)", - .count = 3, - .ranges = { - { 16 * 168.25 /*MHz*/, 0xa0, }, - { 16 * 456.25 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */ - .name = "Philips NTSC_M (MK2)", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0xa0, }, - { 16 * 454.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */ - .name = "Temic PAL_I (4066 FY5)", - .count = 3, - .ranges = { - { 16 * 169.00 /*MHz*/, 0xa0, }, - { 16 * 454.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */ - .name = "Temic PAL* auto (4006 FN5)", - .count = 3, - .ranges = { - { 16 * 169.00 /*MHz*/, 0xa0, }, - { 16 * 454.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - - /* 20-29 */ - [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */ - .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", - .count = 3, - .ranges = { - { 16 * 141.00 /*MHz*/, 0xa0, }, - { 16 * 464.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */ - .name = "Temic NTSC (4039 FR5)", - .count = 3, - .ranges = { - { 16 * 158.00 /*MHz*/, 0xa0, }, - { 16 * 453.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */ - .name = "Temic PAL/SECAM multi (4046 FM5)", - .count = 3, - .ranges = { - { 16 * 169.00 /*MHz*/, 0xa0, }, - { 16 * 454.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */ - .name = "Philips PAL_DK (FI1256 and compatibles)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */ - .name = "Philips PAL/SECAM multi (FQ1216ME)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */ - .name = "LG PAL_I+FM (TAPC-I001D)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */ - .name = "LG PAL_I (TAPC-I701D)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */ - .name = "LG NTSC+FM (TPI8NSR01F)", - .count = 3, - .ranges = { - { 16 * 210.00 /*MHz*/, 0xa0, }, - { 16 * 497.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */ - .name = "LG PAL_BG+FM (TPI8PSB01D)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_LG_PAL] = { /* LGINNOTEK PAL */ - .name = "LG PAL_BG (TPI8PSB11D)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0xa0, }, - { 16 * 450.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - - /* 30-39 */ - [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */ - .name = "Temic PAL* auto + FM (4009 FN5)", - .count = 3, - .ranges = { - { 16 * 141.00 /*MHz*/, 0xa0, }, - { 16 * 464.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */ - .name = "SHARP NTSC_JP (2U5JF5540)", - .count = 3, - .ranges = { - { 16 * 137.25 /*MHz*/, 0x01, }, - { 16 * 317.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */ - .name = "Samsung PAL TCPM9091PD27", - .count = 3, - .ranges = { - { 16 * 169 /*MHz*/, 0xa0, }, - { 16 * 464 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_MT2032] = { /* Microtune PAL|NTSC */ - .name = "MT20xx universal", - /* see mt20xx.c for details */ }, - [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */ - .name = "Temic PAL_BG (4106 FH5)", - .count = 3, - .ranges = { - { 16 * 141.00 /*MHz*/, 0xa0, }, - { 16 * 464.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */ - .name = "Temic PAL_DK/SECAM_L (4012 FY5)", - .count = 3, - .ranges = { - { 16 * 140.25 /*MHz*/, 0x02, }, - { 16 * 463.25 /*MHz*/, 0x04, }, - { 16 * 999.99 , 0x01, }, - }, - .config = 0x8e, - }, - [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */ - .name = "Temic NTSC (4136 FY5)", - .count = 3, - .ranges = { - { 16 * 158.00 /*MHz*/, 0xa0, }, - { 16 * 453.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */ - .name = "LG PAL (newer TAPC series)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0x01, }, - { 16 * 450.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */ - .name = "Philips PAL/SECAM multi (FM1216ME MK3)", - .count = 3, - .ranges = { - { 16 * 158.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */ - .name = "LG NTSC (newer TAPC series)", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0x01, }, - { 16 * 450.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - - /* 40-49 */ - [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */ - .name = "HITACHI V7-J180AT", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0x01, }, - { 16 * 450.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */ - .name = "Philips PAL_MK (FI1216 MK)", - .count = 3, - .ranges = { - { 16 * 140.25 /*MHz*/, 0x01, }, - { 16 * 463.25 /*MHz*/, 0xc2, }, - { 16 * 999.99 , 0xcf, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */ - .name = "Philips 1236D ATSC/NTSC dual in", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0xa0, }, - { 16 * 454.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */ - .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */ - .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */ - .name = "Microtune 4049 FM5", - .count = 3, - .ranges = { - { 16 * 141.00 /*MHz*/, 0xa0, }, - { 16 * 464.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */ - .name = "Panasonic VP27s/ENGE4324D", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 454.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0xce, - }, - [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */ - .name = "LG NTSC (TAPE series)", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_TNF_8831BGFF] = { /* Philips PAL */ - .name = "Tenna TNF 8831 BGFF)", - .count = 3, - .ranges = { - { 16 * 161.25 /*MHz*/, 0xa0, }, - { 16 * 463.25 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */ - .name = "Microtune 4042 FI5 ATSC/NTSC dual in", - .count = 3, - .ranges = { - { 16 * 162.00 /*MHz*/, 0xa2, }, - { 16 * 457.00 /*MHz*/, 0x94, }, - { 16 * 999.99 , 0x31, }, - }, - .config = 0x8e, - }, - - /* 50-59 */ - [TUNER_TCL_2002N] = { /* TCL NTSC */ - .name = "TCL 2002N", - .count = 3, - .ranges = { - { 16 * 172.00 /*MHz*/, 0x01, }, - { 16 * 448.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */ - .name = "Philips PAL/SECAM_D (FM 1256 I-H3)", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */ - .name = "Thomson DTT 7610 (ATSC/NTSC)", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0x39, }, - { 16 * 454.00 /*MHz*/, 0x3a, }, - { 16 * 999.99 , 0x3c, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */ - .name = "Philips FQ1286", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x41, }, - { 16 * 454.00 /*MHz*/, 0x42, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */ - .name = "tda8290+75", - /* see tda8290.c for details */ }, - [TUNER_TCL_2002MB] = { /* TCL PAL */ - .name = "TCL 2002MB", - .count = 3, - .ranges = { - { 16 * 170.00 /*MHz*/, 0x01, }, - { 16 * 450.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0xce, - }, - [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */ - .name = "Philips PAL/SECAM multi (FQ1216AME MK4)", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0xce, - }, - [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */ - .name = "Philips FQ1236A MK4", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 442.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */ - .name = "Ymec TVision TVF-8531MF/8831MF/8731MF", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0xa0, }, - { 16 * 454.00 /*MHz*/, 0x90, }, - { 16 * 999.99 , 0x30, }, - }, - .config = 0x8e, - }, - [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */ - .name = "Ymec TVision TVF-5533MF", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01, }, - { 16 * 454.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - - /* 60-69 */ - [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */ - /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */ - .name = "Thomson DTT 761X (ATSC/NTSC)", - .count = 3, - .ranges = { - { 16 * 145.25 /*MHz*/, 0x39, }, - { 16 * 415.25 /*MHz*/, 0x3a, }, - { 16 * 999.99 , 0x3c, }, - }, - .config = 0x8e, - }, - [TUNER_TENA_9533_DI] = { /* Philips PAL */ - .name = "Tena TNF9533-D/IF/TNF9533-B/DF", - .count = 3, - .ranges = { - { 16 * 160.25 /*MHz*/, 0x01, }, - { 16 * 464.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, - [TUNER_TEA5767] = { /* Philips RADIO */ - .name = "Philips TEA5767HN FM Radio", - /* see tea5767.c for details */}, - [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */ - .name = "Philips FMD1216ME MK3 Hybrid Tuner", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x51, }, - { 16 * 442.00 /*MHz*/, 0x52, }, - { 16 * 999.99 , 0x54, }, - }, - .config = 0x86, - }, - [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */ - .name = "LG TDVS-H062F/TUA6034", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0x01 }, - { 16 * 455.00 /*MHz*/, 0x02 }, - { 16 * 999.99 , 0x04 }, - }, - .config = 0x8e, - }, - [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */ - .name = "Ymec TVF66T5-B/DFF", - .count = 3, - .ranges = { - { 16 * 160.25 /*MHz*/, 0x01, }, - { 16 * 464.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */ - .name = "LG NTSC (TALN mini series)", - .count = 3, - .ranges = { - { 16 * 137.25 /*MHz*/, 0x01, }, - { 16 * 373.25 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x08, }, - }, - .config = 0x8e, - }, - [TUNER_PHILIPS_TD1316] = { /* Philips PAL */ - .name = "Philips TD1316 Hybrid Tuner", - .count = 3, - .ranges = { - { 16 * 160.00 /*MHz*/, 0xa1, }, - { 16 * 442.00 /*MHz*/, 0xa2, }, - { 16 * 999.99 , 0xa4, }, - }, - .config = 0xc8, - }, - [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */ - .name = "Philips TUV1236D ATSC/NTSC dual in", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0x01, }, - { 16 * 454.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0xce, - }, - [TUNER_TNF_5335MF] = { /* Philips NTSC */ - .name = "Tena TNF 5335 MF", - .count = 3, - .ranges = { - { 16 * 157.25 /*MHz*/, 0x01, }, - { 16 * 454.00 /*MHz*/, 0x02, }, - { 16 * 999.99 , 0x04, }, - }, - .config = 0x8e, - }, -}; - -unsigned const int tuner_count = ARRAY_SIZE(tuners); /* ---------------------------------------------------------------------- */ @@ -842,16 +136,23 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) u8 config, tuneraddr; u16 div; struct tunertype *tun; - unsigned char buffer[4]; - int rc, IFPCoff, i; + u8 buffer[4]; + int rc, IFPCoff, i, j; tun = &tuners[t->type]; - for (i = 0; i < tun->count; i++) { - if (freq > tun->ranges[i].thresh) + j = TUNER_PARAM_ANALOG; + + for (i = 0; i < tun->params[j].count; i++) { + if (freq > tun->params[j].ranges[i].limit) continue; break; } - config = tun->ranges[i].cb; + if (i == tun->params[j].count) { + tuner_dbg("TV frequency out of range (%d > %d)", + freq, tun->params[j].ranges[i - 1].limit); + freq = tun->params[j].ranges[--i].limit; + } + config = tun->params[j].ranges[i].cb; /* i == 0 -> VHF_LO */ /* i == 1 -> VHF_HI */ /* i == 2 -> UHF */ @@ -914,7 +215,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) case TUNER_MICROTUNE_4042FI5: /* Set the charge pump for fast tuning */ - tun->config |= TUNER_CHARGE_PUMP; + tun->params[j].config |= TUNER_CHARGE_PUMP; break; case TUNER_PHILIPS_TUV1236D: @@ -943,20 +244,6 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) break; } - /* - * Philips FI1216MK2 remark from specification : - * for channel selection involving band switching, and to ensure - * smooth tuning to the desired channel without causing - * unnecessary charge pump action, it is recommended to consider - * the difference between wanted channel frequency and the - * current channel frequency. Unnecessary charge pump action - * will result in very low tuning voltage which may drive the - * oscillator to extreme conditions. - * - * Progfou: specification says to send config data before - * frequency in case (wanted frequency < current frequency). - */ - /* IFPCoff = Video Intermediate Frequency - Vif: 940 =16*58.75 NTSC/J (Japan) 732 =16*45.75 M/N STD @@ -988,17 +275,18 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) offset / 16, offset % 16 * 100 / 16, div); - if (t->type == TUNER_PHILIPS_SECAM && freq < t->freq) { - buffer[0] = tun->config; + if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { + buffer[0] = tun->params[j].config; buffer[1] = config; buffer[2] = (div>>8) & 0x7f; buffer[3] = div & 0xff; } else { buffer[0] = (div>>8) & 0x7f; buffer[1] = div & 0xff; - buffer[2] = tun->config; + buffer[2] = tun->params[j].config; buffer[3] = config; } + t->last_div = div; tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", buffer[0],buffer[1],buffer[2],buffer[3]); @@ -1024,10 +312,10 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) } /* Set the charge pump for optimized phase noise figure */ - tun->config &= ~TUNER_CHARGE_PUMP; + tun->params[j].config &= ~TUNER_CHARGE_PUMP; buffer[0] = (div>>8) & 0x7f; buffer[1] = div & 0xff; - buffer[2] = tun->config; + buffer[2] = tun->params[j].config; buffer[3] = config; tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", buffer[0],buffer[1],buffer[2],buffer[3]); @@ -1041,13 +329,15 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) { struct tunertype *tun; struct tuner *t = i2c_get_clientdata(c); - unsigned char buffer[4]; - unsigned div; - int rc; + u8 buffer[4]; + u16 div; + int rc, j; tun = &tuners[t->type]; + j = TUNER_PARAM_ANALOG; + div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ - buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ + buffer[2] = (tun->params[j].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ switch (t->type) { case TUNER_TENA_9533_DI: @@ -1076,9 +366,19 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) } buffer[0] = (div>>8) & 0x7f; buffer[1] = div & 0xff; + if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { + buffer[0] = buffer[2]; + buffer[1] = buffer[3]; + buffer[2] = (div>>8) & 0x7f; + buffer[3] = div & 0xff; + } else { + buffer[0] = (div>>8) & 0x7f; + buffer[1] = div & 0xff; + } tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", buffer[0],buffer[1],buffer[2],buffer[3]); + t->last_div = div; if (4 != (rc = i2c_master_send(c,buffer,4))) tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); @@ -1092,10 +392,10 @@ int default_tuner_init(struct i2c_client *c) t->type, tuners[t->type].name); strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); - t->tv_freq = default_set_tv_freq; - t->radio_freq = default_set_radio_freq; + t->set_tv_freq = default_set_tv_freq; + t->set_radio_freq = default_set_radio_freq; t->has_signal = tuner_signal; - t->is_stereo = tuner_stereo; + t->is_stereo = tuner_stereo; t->standby = NULL; return 0; diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c new file mode 100644 index 00000000000..6fe781798d8 --- /dev/null +++ b/drivers/media/video/tuner-types.c @@ -0,0 +1,1406 @@ +/* + * + * i2c tv tuner chip device type database. + * + */ + +#include <linux/i2c.h> +#include <media/tuner.h> +#include <media/tuner-types.h> + +/* ---------------------------------------------------------------------- */ + +/* + * The floats in the tuner struct are computed at compile time + * by gcc and cast back to integers. Thus we don't violate the + * "no float in kernel" rule. + * + * A tuner_range may be referenced by multiple tuner_params structs. + * There are many duplicates in here. Reusing tuner_range structs, + * rather than defining new ones for each tuner, will cut down on + * memory usage, and is preferred when possible. + * + * Each tuner_params array may contain one or more elements, one + * for each video standard. + * + * FIXME: Some tuner_range definitions are duplicated, and + * should be eliminated. + * + * FIXME: tunertype struct contains an element, has_tda988x. + * We must set this for all tunertypes that contain a tda988x + * chip, and then we can remove this setting from the various + * card structs. + */ + +/* 0-9 */ +/* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */ + +static struct tuner_range tuner_temic_pal_ranges[] = { + { 16 * 140.25 /*MHz*/, 0x02, }, + { 16 * 463.25 /*MHz*/, 0x04, }, + { 16 * 999.99 , 0x01, }, +}; + +static struct tuner_params tuner_temic_pal_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_PAL_I - Philips PAL_I ------------ */ + +static struct tuner_range tuner_philips_pal_i_ranges[] = { + { 16 * 140.25 /*MHz*/, 0xa0, }, + { 16 * 463.25 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_philips_pal_i_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_pal_i_ranges, + .count = ARRAY_SIZE(tuner_philips_pal_i_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_NTSC - Philips NTSC ------------ */ + +static struct tuner_range tuner_philips_ntsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0xa0, }, + { 16 * 451.25 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_philips_ntsc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_philips_ntsc_ranges, + .count = ARRAY_SIZE(tuner_philips_ntsc_ranges), + .config = 0x8e, + .cb_first_if_lower_freq = 1, + }, +}; + +/* ------------ TUNER_PHILIPS_SECAM - Philips SECAM ------------ */ + +static struct tuner_range tuner_philips_secam_ranges[] = { + { 16 * 168.25 /*MHz*/, 0xa7, }, + { 16 * 447.25 /*MHz*/, 0x97, }, + { 16 * 999.99 , 0x37, }, +}; + +static struct tuner_params tuner_philips_secam_params[] = { + { + .type = TUNER_PARAM_TYPE_SECAM, + .ranges = tuner_philips_secam_ranges, + .count = ARRAY_SIZE(tuner_philips_secam_ranges), + .config = 0x8e, + .cb_first_if_lower_freq = 1, + }, +}; + +/* ------------ TUNER_PHILIPS_PAL - Philips PAL ------------ */ + +static struct tuner_range tuner_philips_pal_ranges[] = { + { 16 * 168.25 /*MHz*/, 0xa0, }, + { 16 * 447.25 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_philips_pal_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_pal_ranges, + .count = ARRAY_SIZE(tuner_philips_pal_ranges), + .config = 0x8e, + .cb_first_if_lower_freq = 1, + }, +}; + +/* ------------ TUNER_TEMIC_NTSC - TEMIC NTSC ------------ */ + +static struct tuner_range tuner_temic_ntsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0x02, }, + { 16 * 463.25 /*MHz*/, 0x04, }, + { 16 * 999.99 , 0x01, }, +}; + +static struct tuner_params tuner_temic_ntsc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_temic_ntsc_ranges, + .count = ARRAY_SIZE(tuner_temic_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_PAL_I - TEMIC PAL_I ------------ */ + +static struct tuner_range tuner_temic_pal_i_ranges[] = { + { 16 * 170.00 /*MHz*/, 0x02, }, + { 16 * 450.00 /*MHz*/, 0x04, }, + { 16 * 999.99 , 0x01, }, +}; + +static struct tuner_params tuner_temic_pal_i_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_pal_i_ranges, + .count = ARRAY_SIZE(tuner_temic_pal_i_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4036FY5_NTSC - TEMIC NTSC ------------ */ + +static struct tuner_range tuner_temic_4036fy5_ntsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0xa0, }, + { 16 * 463.25 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4036fy5_ntsc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_temic_4036fy5_ntsc_ranges, + .count = ARRAY_SIZE(tuner_temic_4036fy5_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_ALPS_TSBH1_NTSC - TEMIC NTSC ------------ */ + +static struct tuner_range tuner_alps_tsb_1_ranges[] = { + { 16 * 137.25 /*MHz*/, 0x01, }, + { 16 * 385.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_alps_tsbh1_ntsc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_alps_tsb_1_ranges, + .count = ARRAY_SIZE(tuner_alps_tsb_1_ranges), + .config = 0x8e, + }, +}; + +/* 10-19 */ +/* ------------ TUNER_ALPS_TSBE1_PAL - TEMIC PAL ------------ */ + +static struct tuner_params tuner_alps_tsb_1_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_alps_tsb_1_ranges, + .count = ARRAY_SIZE(tuner_alps_tsb_1_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_ALPS_TSBB5_PAL_I - Alps PAL_I ------------ */ + +static struct tuner_range tuner_alps_tsb_5_pal_ranges[] = { + { 16 * 133.25 /*MHz*/, 0x01, }, + { 16 * 351.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_alps_tsbb5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_alps_tsb_5_pal_ranges, + .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_ALPS_TSBE5_PAL - Alps PAL ------------ */ + +static struct tuner_params tuner_alps_tsbe5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_alps_tsb_5_pal_ranges, + .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_ALPS_TSBC5_PAL - Alps PAL ------------ */ + +static struct tuner_params tuner_alps_tsbc5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_alps_tsb_5_pal_ranges, + .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4006FH5_PAL - TEMIC PAL ------------ */ + +static struct tuner_range tuner_temic_4006fh5_pal_ranges[] = { + { 16 * 170.00 /*MHz*/, 0xa0, }, + { 16 * 450.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4006fh5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4006fh5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4006fh5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_ALPS_TSHC6_NTSC - Alps NTSC ------------ */ + +static struct tuner_range tuner_alps_tshc6_ntsc_ranges[] = { + { 16 * 137.25 /*MHz*/, 0x14, }, + { 16 * 385.25 /*MHz*/, 0x12, }, + { 16 * 999.99 , 0x11, }, +}; + +static struct tuner_params tuner_alps_tshc6_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_alps_tshc6_ntsc_ranges, + .count = ARRAY_SIZE(tuner_alps_tshc6_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_PAL_DK - TEMIC PAL ------------ */ + +static struct tuner_range tuner_temic_pal_dk_ranges[] = { + { 16 * 168.25 /*MHz*/, 0xa0, }, + { 16 * 456.25 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_pal_dk_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_pal_dk_ranges, + .count = ARRAY_SIZE(tuner_temic_pal_dk_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_NTSC_M - Philips NTSC ------------ */ + +static struct tuner_range tuner_philips_ntsc_m_ranges[] = { + { 16 * 160.00 /*MHz*/, 0xa0, }, + { 16 * 454.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_philips_ntsc_m_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_philips_ntsc_m_ranges, + .count = ARRAY_SIZE(tuner_philips_ntsc_m_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4066FY5_PAL_I - TEMIC PAL_I ------------ */ + +static struct tuner_range tuner_temic_40x6f_5_pal_ranges[] = { + { 16 * 169.00 /*MHz*/, 0xa0, }, + { 16 * 454.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4066fy5_pal_i_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_40x6f_5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_40x6f_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4006FN5_MULTI_PAL - TEMIC PAL ------------ */ + +static struct tuner_params tuner_temic_4006fn5_multi_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_40x6f_5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_40x6f_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* 20-29 */ +/* ------------ TUNER_TEMIC_4009FR5_PAL - TEMIC PAL ------------ */ + +static struct tuner_range tuner_temic_4009f_5_pal_ranges[] = { + { 16 * 141.00 /*MHz*/, 0xa0, }, + { 16 * 464.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4009f_5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4009f_5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4039FR5_NTSC - TEMIC NTSC ------------ */ + +static struct tuner_range tuner_temic_4039fr5_ntsc_ranges[] = { + { 16 * 158.00 /*MHz*/, 0xa0, }, + { 16 * 453.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4039fr5_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_temic_4039fr5_ntsc_ranges, + .count = ARRAY_SIZE(tuner_temic_4039fr5_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4046FM5 - TEMIC PAL ------------ */ + +static struct tuner_range tuner_temic_4046fm5_pal_ranges[] = { + { 16 * 169.00 /*MHz*/, 0xa0, }, + { 16 * 454.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4046fm5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4046fm5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4046fm5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_PAL_DK - Philips PAL ------------ */ + +static struct tuner_range tuner_lg_pal_ranges[] = { + { 16 * 170.00 /*MHz*/, 0xa0, }, + { 16 * 450.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_philips_pal_dk_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_pal_ranges, + .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_FQ1216ME - Philips PAL ------------ */ + +static struct tuner_params tuner_philips_fq1216me_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_pal_ranges, + .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_PAL_I_FM - LGINNOTEK PAL_I ------------ */ + +static struct tuner_params tuner_lg_pal_i_fm_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_pal_ranges, + .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_PAL_I - LGINNOTEK PAL_I ------------ */ + +static struct tuner_params tuner_lg_pal_i_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_pal_ranges, + .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_NTSC_FM - LGINNOTEK NTSC ------------ */ + +static struct tuner_range tuner_lg_ntsc_fm_ranges[] = { + { 16 * 210.00 /*MHz*/, 0xa0, }, + { 16 * 497.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_lg_ntsc_fm_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_lg_ntsc_fm_ranges, + .count = ARRAY_SIZE(tuner_lg_ntsc_fm_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_PAL_FM - LGINNOTEK PAL ------------ */ + +static struct tuner_params tuner_lg_pal_fm_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_pal_ranges, + .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_PAL - LGINNOTEK PAL ------------ */ + +static struct tuner_params tuner_lg_pal_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_pal_ranges, + .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .config = 0x8e, + }, +}; + +/* 30-39 */ +/* ------------ TUNER_TEMIC_4009FN5_MULTI_PAL_FM - TEMIC PAL ------------ */ + +static struct tuner_params tuner_temic_4009_fn5_multi_pal_fm_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4009f_5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_SHARP_2U5JF5540_NTSC - SHARP NTSC ------------ */ + +static struct tuner_range tuner_sharp_2u5jf5540_ntsc_ranges[] = { + { 16 * 137.25 /*MHz*/, 0x01, }, + { 16 * 317.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_sharp_2u5jf5540_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_sharp_2u5jf5540_ntsc_ranges, + .count = ARRAY_SIZE(tuner_sharp_2u5jf5540_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_Samsung_PAL_TCPM9091PD27 - Samsung PAL ------------ */ + +static struct tuner_range tuner_samsung_pal_tcpm9091pd27_ranges[] = { + { 16 * 169 /*MHz*/, 0xa0, }, + { 16 * 464 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_samsung_pal_tcpm9091pd27_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_samsung_pal_tcpm9091pd27_ranges, + .count = ARRAY_SIZE(tuner_samsung_pal_tcpm9091pd27_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4106FH5 - TEMIC PAL ------------ */ + +static struct tuner_params tuner_temic_4106fh5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4009f_5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4012FY5 - TEMIC PAL ------------ */ + +static struct tuner_range tuner_temic_4012fy5_pal_ranges[] = { + { 16 * 140.25 /*MHz*/, 0x02, }, + { 16 * 463.25 /*MHz*/, 0x04, }, + { 16 * 999.99 , 0x01, }, +}; + +static struct tuner_params tuner_temic_4012fy5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4012fy5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4012fy5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TEMIC_4136FY5 - TEMIC NTSC ------------ */ + +static struct tuner_range tuner_temic_4136_fy5_ntsc_ranges[] = { + { 16 * 158.00 /*MHz*/, 0xa0, }, + { 16 * 453.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_temic_4136_fy5_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_temic_4136_fy5_ntsc_ranges, + .count = ARRAY_SIZE(tuner_temic_4136_fy5_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_PAL_NEW_TAPC - LGINNOTEK PAL ------------ */ + +static struct tuner_range tuner_lg_new_tapc_ranges[] = { + { 16 * 170.00 /*MHz*/, 0x01, }, + { 16 * 450.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_lg_pal_new_tapc_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_lg_new_tapc_ranges, + .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_FM1216ME_MK3 - Philips PAL ------------ */ + +static struct tuner_range tuner_fm1216me_mk3_pal_ranges[] = { + { 16 * 158.00 /*MHz*/, 0x01, }, + { 16 * 442.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_fm1216me_mk3_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_fm1216me_mk3_pal_ranges, + .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges), + .config = 0x8e, + .cb_first_if_lower_freq = 1, + }, +}; + +/* ------------ TUNER_LG_NTSC_NEW_TAPC - LGINNOTEK NTSC ------------ */ + +static struct tuner_params tuner_lg_ntsc_new_tapc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_lg_new_tapc_ranges, + .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges), + .config = 0x8e, + }, +}; + +/* 40-49 */ +/* ------------ TUNER_HITACHI_NTSC - HITACHI NTSC ------------ */ + +static struct tuner_params tuner_hitachi_ntsc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_lg_new_tapc_ranges, + .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_PAL_MK - Philips PAL ------------ */ + +static struct tuner_range tuner_philips_pal_mk_pal_ranges[] = { + { 16 * 140.25 /*MHz*/, 0x01, }, + { 16 * 463.25 /*MHz*/, 0xc2, }, + { 16 * 999.99 , 0xcf, }, +}; + +static struct tuner_params tuner_philips_pal_mk_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_pal_mk_pal_ranges, + .count = ARRAY_SIZE(tuner_philips_pal_mk_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_ATSC - Philips ATSC ------------ */ + +static struct tuner_range tuner_philips_atsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0xa0, }, + { 16 * 454.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_philips_atsc_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_philips_atsc_ranges, + .count = ARRAY_SIZE(tuner_philips_atsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_FM1236_MK3 - Philips NTSC ------------ */ + +static struct tuner_range tuner_fm1236_mk3_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 442.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_fm1236_mk3_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_fm1236_mk3_ntsc_ranges, + .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), + .config = 0x8e, + .cb_first_if_lower_freq = 1, + }, +}; + +/* ------------ TUNER_PHILIPS_4IN1 - Philips NTSC ------------ */ + +static struct tuner_range tuner_philips_4in1_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 442.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_philips_4in1_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_philips_4in1_ntsc_ranges, + .count = ARRAY_SIZE(tuner_philips_4in1_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_MICROTUNE_4049FM5 - Microtune PAL ------------ */ + +static struct tuner_params tuner_microtune_4049_fm5_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_temic_4009f_5_pal_ranges, + .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PANASONIC_VP27 - Panasonic NTSC ------------ */ + +static struct tuner_range tuner_panasonic_vp27_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 454.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_panasonic_vp27_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_panasonic_vp27_ntsc_ranges, + .count = ARRAY_SIZE(tuner_panasonic_vp27_ntsc_ranges), + .config = 0xce, + }, +}; + +/* ------------ TUNER_LG_NTSC_TAPE - LGINNOTEK NTSC ------------ */ + +static struct tuner_range tuner_lg_ntsc_tape_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 442.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_lg_ntsc_tape_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_lg_ntsc_tape_ranges, + .count = ARRAY_SIZE(tuner_lg_ntsc_tape_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TNF_8831BGFF - Philips PAL ------------ */ + +static struct tuner_range tuner_tnf_8831bgff_pal_ranges[] = { + { 16 * 161.25 /*MHz*/, 0xa0, }, + { 16 * 463.25 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_tnf_8831bgff_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_tnf_8831bgff_pal_ranges, + .count = ARRAY_SIZE(tuner_tnf_8831bgff_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_MICROTUNE_4042FI5 - Microtune NTSC ------------ */ + +static struct tuner_range tuner_microtune_4042fi5_ntsc_ranges[] = { + { 16 * 162.00 /*MHz*/, 0xa2, }, + { 16 * 457.00 /*MHz*/, 0x94, }, + { 16 * 999.99 , 0x31, }, +}; + +static struct tuner_params tuner_microtune_4042fi5_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_microtune_4042fi5_ntsc_ranges, + .count = ARRAY_SIZE(tuner_microtune_4042fi5_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* 50-59 */ +/* ------------ TUNER_TCL_2002N - TCL NTSC ------------ */ + +static struct tuner_range tuner_tcl_2002n_ntsc_ranges[] = { + { 16 * 172.00 /*MHz*/, 0x01, }, + { 16 * 448.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_tcl_2002n_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_tcl_2002n_ntsc_ranges, + .count = ARRAY_SIZE(tuner_tcl_2002n_ntsc_ranges), + .config = 0x8e, + .cb_first_if_lower_freq = 1, + }, +}; + +/* ------------ TUNER_PHILIPS_FM1256_IH3 - Philips PAL ------------ */ + +static struct tuner_range tuner_philips_fm1256_ih3_pal_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 442.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_philips_fm1256_ih3_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_fm1256_ih3_pal_ranges, + .count = ARRAY_SIZE(tuner_philips_fm1256_ih3_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_THOMSON_DTT7610 - THOMSON ATSC ------------ */ + +static struct tuner_range tuner_thomson_dtt7610_ntsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0x39, }, + { 16 * 454.00 /*MHz*/, 0x3a, }, + { 16 * 999.99 , 0x3c, }, +}; + +static struct tuner_params tuner_thomson_dtt7610_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_thomson_dtt7610_ntsc_ranges, + .count = ARRAY_SIZE(tuner_thomson_dtt7610_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_FQ1286 - Philips NTSC ------------ */ + +static struct tuner_range tuner_philips_fq1286_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x41, }, + { 16 * 454.00 /*MHz*/, 0x42, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_philips_fq1286_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_philips_fq1286_ntsc_ranges, + .count = ARRAY_SIZE(tuner_philips_fq1286_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TCL_2002MB - TCL PAL ------------ */ + +static struct tuner_range tuner_tcl_2002mb_pal_ranges[] = { + { 16 * 170.00 /*MHz*/, 0x01, }, + { 16 * 450.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_tcl_2002mb_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_tcl_2002mb_pal_ranges, + .count = ARRAY_SIZE(tuner_tcl_2002mb_pal_ranges), + .config = 0xce, + }, +}; + +/* ------------ TUNER_PHILIPS_FQ1216AME_MK4 - Philips PAL ------------ */ + +static struct tuner_range tuner_philips_fq12_6a___mk4_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 442.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_philips_fq1216ame_mk4_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_fq12_6a___mk4_ranges, + .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_ranges), + .config = 0xce, + }, +}; + +/* ------------ TUNER_PHILIPS_FQ1236A_MK4 - Philips NTSC ------------ */ + +static struct tuner_params tuner_philips_fq1236a_mk4_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_philips_fq12_6a___mk4_ranges, + .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_YMEC_TVF_8531MF - Philips NTSC ------------ */ + +static struct tuner_range tuner_ymec_tvf_8531mf_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0xa0, }, + { 16 * 454.00 /*MHz*/, 0x90, }, + { 16 * 999.99 , 0x30, }, +}; + +static struct tuner_params tuner_ymec_tvf_8531mf_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_ymec_tvf_8531mf_ntsc_ranges, + .count = ARRAY_SIZE(tuner_ymec_tvf_8531mf_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_YMEC_TVF_5533MF - Philips NTSC ------------ */ + +static struct tuner_range tuner_ymec_tvf_5533mf_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01, }, + { 16 * 454.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_ymec_tvf_5533mf_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_ymec_tvf_5533mf_ntsc_ranges, + .count = ARRAY_SIZE(tuner_ymec_tvf_5533mf_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* 60-69 */ +/* ------------ TUNER_THOMSON_DTT761X - THOMSON ATSC ------------ */ +/* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */ + +static struct tuner_range tuner_thomson_dtt761x_ntsc_ranges[] = { + { 16 * 145.25 /*MHz*/, 0x39, }, + { 16 * 415.25 /*MHz*/, 0x3a, }, + { 16 * 999.99 , 0x3c, }, +}; + + +static struct tuner_params tuner_thomson_dtt761x_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_thomson_dtt761x_ntsc_ranges, + .count = ARRAY_SIZE(tuner_thomson_dtt761x_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_TENA_9533_DI - Philips PAL ------------ */ + +static struct tuner_range tuner_tuner_tena_9533_di_pal_ranges[] = { + { 16 * 160.25 /*MHz*/, 0x01, }, + { 16 * 464.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_tena_9533_di_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_tuner_tena_9533_di_pal_ranges, + .count = ARRAY_SIZE(tuner_tuner_tena_9533_di_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_FMD1216ME_MK3 - Philips PAL ------------ */ + +static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x51, }, + { 16 * 442.00 /*MHz*/, 0x52, }, + { 16 * 999.99 , 0x54, }, +}; + + +static struct tuner_params tuner_tuner_philips_fmd1216me_mk3_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_fmd1216me_mk3_pal_ranges, + .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges), + .config = 0x86, + }, +}; + + +/* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */ + +static struct tuner_range tuner_tua6034_ntsc_ranges[] = { + { 16 * 160.00 /*MHz*/, 0x01 }, + { 16 * 455.00 /*MHz*/, 0x02 }, + { 16 * 999.99 , 0x04 }, +}; + + +static struct tuner_params tuner_tua6034_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_tua6034_ntsc_ranges, + .count = ARRAY_SIZE(tuner_tua6034_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_YMEC_TVF66T5_B_DFF - Philips PAL ------------ */ + +static struct tuner_range tuner_ymec_tvf66t5_b_dff_pal_ranges[] = { + { 16 * 160.25 /*MHz*/, 0x01, }, + { 16 * 464.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_ymec_tvf66t5_b_dff_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_ymec_tvf66t5_b_dff_pal_ranges, + .count = ARRAY_SIZE(tuner_ymec_tvf66t5_b_dff_pal_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_LG_NTSC_TALN_MINI - LGINNOTEK NTSC ------------ */ + +static struct tuner_range tuner_lg_taln_mini_ntsc_ranges[] = { + { 16 * 137.25 /*MHz*/, 0x01, }, + { 16 * 373.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_lg_taln_mini_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_lg_taln_mini_ntsc_ranges, + .count = ARRAY_SIZE(tuner_lg_taln_mini_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* ------------ TUNER_PHILIPS_TD1316 - Philips PAL ------------ */ + +static struct tuner_range tuner_philips_td1316_pal_ranges[] = { + { 16 * 160.00 /*MHz*/, 0xa1, }, + { 16 * 442.00 /*MHz*/, 0xa2, }, + { 16 * 999.99 , 0xa4, }, +}; + +static struct tuner_params tuner_philips_td1316_params[] = { + { + .type = TUNER_PARAM_TYPE_PAL, + .ranges = tuner_philips_td1316_pal_ranges, + .count = ARRAY_SIZE(tuner_philips_td1316_pal_ranges), + .config = 0xc8, + }, +}; + +/* ------------ TUNER_PHILIPS_TUV1236D - Philips ATSC ------------ */ + +static struct tuner_range tuner_tuv1236d_ntsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0x01, }, + { 16 * 454.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + + +static struct tuner_params tuner_tuner_tuv1236d_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_tuv1236d_ntsc_ranges, + .count = ARRAY_SIZE(tuner_tuv1236d_ntsc_ranges), + .config = 0xce, + }, +}; + +/* ------------ TUNER_TNF_5335MF - Philips NTSC ------------ */ + +static struct tuner_range tuner_tnf_5335mf_ntsc_ranges[] = { + { 16 * 157.25 /*MHz*/, 0x01, }, + { 16 * 454.00 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x04, }, +}; + +static struct tuner_params tuner_tnf_5335mf_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_tnf_5335mf_ntsc_ranges, + .count = ARRAY_SIZE(tuner_tnf_5335mf_ntsc_ranges), + .config = 0x8e, + }, +}; + +/* 70-79 */ +/* ------------ TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC ------------ */ + +static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[] = { + { 16 * 175.75 /*MHz*/, 0x01, }, + { 16 * 410.25 /*MHz*/, 0x02, }, + { 16 * 999.99 , 0x08, }, +}; + +static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = { + { + .type = TUNER_PARAM_TYPE_NTSC, + .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges, + .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges), + .config = 0xce, + }, +}; + +/* --------------------------------------------------------------------- */ + +struct tunertype tuners[] = { + /* 0-9 */ + [TUNER_TEMIC_PAL] = { /* TEMIC PAL */ + .name = "Temic PAL (4002 FH5)", + .params = tuner_temic_pal_params, + }, + [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */ + .name = "Philips PAL_I (FI1246 and compatibles)", + .params = tuner_philips_pal_i_params, + }, + [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */ + .name = "Philips NTSC (FI1236,FM1236 and compatibles)", + .params = tuner_philips_ntsc_params, + }, + [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */ + .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)", + .params = tuner_philips_secam_params, + }, + [TUNER_ABSENT] = { /* Tuner Absent */ + .name = "NoTuner", + }, + [TUNER_PHILIPS_PAL] = { /* Philips PAL */ + .name = "Philips PAL_BG (FI1216 and compatibles)", + .params = tuner_philips_pal_params, + }, + [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */ + .name = "Temic NTSC (4032 FY5)", + .params = tuner_temic_ntsc_params, + }, + [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */ + .name = "Temic PAL_I (4062 FY5)", + .params = tuner_temic_pal_i_params, + }, + [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */ + .name = "Temic NTSC (4036 FY5)", + .params = tuner_temic_4036fy5_ntsc_params, + }, + [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */ + .name = "Alps HSBH1", + .params = tuner_alps_tsbh1_ntsc_params, + }, + + /* 10-19 */ + [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */ + .name = "Alps TSBE1", + .params = tuner_alps_tsb_1_params, + }, + [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */ + .name = "Alps TSBB5", + .params = tuner_alps_tsbb5_params, + }, + [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */ + .name = "Alps TSBE5", + .params = tuner_alps_tsbe5_params, + }, + [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */ + .name = "Alps TSBC5", + .params = tuner_alps_tsbc5_params, + }, + [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */ + .name = "Temic PAL_BG (4006FH5)", + .params = tuner_temic_4006fh5_params, + }, + [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */ + .name = "Alps TSCH6", + .params = tuner_alps_tshc6_params, + }, + [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */ + .name = "Temic PAL_DK (4016 FY5)", + .params = tuner_temic_pal_dk_params, + }, + [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */ + .name = "Philips NTSC_M (MK2)", + .params = tuner_philips_ntsc_m_params, + }, + [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */ + .name = "Temic PAL_I (4066 FY5)", + .params = tuner_temic_4066fy5_pal_i_params, + }, + [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */ + .name = "Temic PAL* auto (4006 FN5)", + .params = tuner_temic_4006fn5_multi_params, + }, + + /* 20-29 */ + [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */ + .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", + .params = tuner_temic_4009f_5_params, + }, + [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */ + .name = "Temic NTSC (4039 FR5)", + .params = tuner_temic_4039fr5_params, + }, + [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */ + .name = "Temic PAL/SECAM multi (4046 FM5)", + .params = tuner_temic_4046fm5_params, + }, + [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */ + .name = "Philips PAL_DK (FI1256 and compatibles)", + .params = tuner_philips_pal_dk_params, + }, + [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */ + .name = "Philips PAL/SECAM multi (FQ1216ME)", + .params = tuner_philips_fq1216me_params, + }, + [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */ + .name = "LG PAL_I+FM (TAPC-I001D)", + .params = tuner_lg_pal_i_fm_params, + }, + [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */ + .name = "LG PAL_I (TAPC-I701D)", + .params = tuner_lg_pal_i_params, + }, + [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */ + .name = "LG NTSC+FM (TPI8NSR01F)", + .params = tuner_lg_ntsc_fm_params, + }, + [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */ + .name = "LG PAL_BG+FM (TPI8PSB01D)", + .params = tuner_lg_pal_fm_params, + }, + [TUNER_LG_PAL] = { /* LGINNOTEK PAL */ + .name = "LG PAL_BG (TPI8PSB11D)", + .params = tuner_lg_pal_params, + }, + + /* 30-39 */ + [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */ + .name = "Temic PAL* auto + FM (4009 FN5)", + .params = tuner_temic_4009_fn5_multi_pal_fm_params, + }, + [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */ + .name = "SHARP NTSC_JP (2U5JF5540)", + .params = tuner_sharp_2u5jf5540_params, + }, + [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */ + .name = "Samsung PAL TCPM9091PD27", + .params = tuner_samsung_pal_tcpm9091pd27_params, + }, + [TUNER_MT2032] = { /* Microtune PAL|NTSC */ + .name = "MT20xx universal", + /* see mt20xx.c for details */ }, + [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */ + .name = "Temic PAL_BG (4106 FH5)", + .params = tuner_temic_4106fh5_params, + }, + [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */ + .name = "Temic PAL_DK/SECAM_L (4012 FY5)", + .params = tuner_temic_4012fy5_params, + }, + [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */ + .name = "Temic NTSC (4136 FY5)", + .params = tuner_temic_4136_fy5_params, + }, + [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */ + .name = "LG PAL (newer TAPC series)", + .params = tuner_lg_pal_new_tapc_params, + }, + [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */ + .name = "Philips PAL/SECAM multi (FM1216ME MK3)", + .params = tuner_fm1216me_mk3_params, + }, + [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */ + .name = "LG NTSC (newer TAPC series)", + .params = tuner_lg_ntsc_new_tapc_params, + }, + + /* 40-49 */ + [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */ + .name = "HITACHI V7-J180AT", + .params = tuner_hitachi_ntsc_params, + }, + [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */ + .name = "Philips PAL_MK (FI1216 MK)", + .params = tuner_philips_pal_mk_params, + }, + [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */ + .name = "Philips 1236D ATSC/NTSC dual in", + .params = tuner_philips_atsc_params, + }, + [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */ + .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", + .params = tuner_fm1236_mk3_params, + }, + [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */ + .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", + .params = tuner_philips_4in1_params, + }, + [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */ + .name = "Microtune 4049 FM5", + .params = tuner_microtune_4049_fm5_params, + }, + [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */ + .name = "Panasonic VP27s/ENGE4324D", + .params = tuner_panasonic_vp27_params, + }, + [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */ + .name = "LG NTSC (TAPE series)", + .params = tuner_lg_ntsc_tape_params, + }, + [TUNER_TNF_8831BGFF] = { /* Philips PAL */ + .name = "Tenna TNF 8831 BGFF)", + .params = tuner_tnf_8831bgff_params, + }, + [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */ + .name = "Microtune 4042 FI5 ATSC/NTSC dual in", + .params = tuner_microtune_4042fi5_params, + }, + + /* 50-59 */ + [TUNER_TCL_2002N] = { /* TCL NTSC */ + .name = "TCL 2002N", + .params = tuner_tcl_2002n_params, + }, + [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */ + .name = "Philips PAL/SECAM_D (FM 1256 I-H3)", + .params = tuner_philips_fm1256_ih3_params, + }, + [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */ + .name = "Thomson DTT 7610 (ATSC/NTSC)", + .params = tuner_thomson_dtt7610_params, + }, + [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */ + .name = "Philips FQ1286", + .params = tuner_philips_fq1286_params, + }, + [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */ + .name = "tda8290+75", + /* see tda8290.c for details */ }, + [TUNER_TCL_2002MB] = { /* TCL PAL */ + .name = "TCL 2002MB", + .params = tuner_tcl_2002mb_params, + }, + [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */ + .name = "Philips PAL/SECAM multi (FQ1216AME MK4)", + .params = tuner_philips_fq1216ame_mk4_params, + }, + [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */ + .name = "Philips FQ1236A MK4", + .params = tuner_philips_fq1236a_mk4_params, + }, + [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */ + .name = "Ymec TVision TVF-8531MF/8831MF/8731MF", + .params = tuner_ymec_tvf_8531mf_params, + }, + [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */ + .name = "Ymec TVision TVF-5533MF", + .params = tuner_ymec_tvf_5533mf_params, + }, + + /* 60-69 */ + [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */ + /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */ + .name = "Thomson DTT 761X (ATSC/NTSC)", + .params = tuner_thomson_dtt761x_params, + }, + [TUNER_TENA_9533_DI] = { /* Philips PAL */ + .name = "Tena TNF9533-D/IF/TNF9533-B/DF", + .params = tuner_tena_9533_di_params, + }, + [TUNER_TEA5767] = { /* Philips RADIO */ + .name = "Philips TEA5767HN FM Radio", + /* see tea5767.c for details */ + }, + [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */ + .name = "Philips FMD1216ME MK3 Hybrid Tuner", + .params = tuner_tuner_philips_fmd1216me_mk3_params, + }, + [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */ + .name = "LG TDVS-H062F/TUA6034", + .params = tuner_tua6034_params, + }, + [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */ + .name = "Ymec TVF66T5-B/DFF", + .params = tuner_ymec_tvf66t5_b_dff_params, + }, + [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */ + .name = "LG NTSC (TALN mini series)", + .params = tuner_lg_taln_mini_params, + }, + [TUNER_PHILIPS_TD1316] = { /* Philips PAL */ + .name = "Philips TD1316 Hybrid Tuner", + .params = tuner_philips_td1316_params, + }, + [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */ + .name = "Philips TUV1236D ATSC/NTSC dual in", + .params = tuner_tuner_tuv1236d_params, + }, + [TUNER_TNF_5335MF] = { /* Philips NTSC */ + .name = "Tena TNF 5335 MF", + .params = tuner_tnf_5335mf_params, + }, + + /* 70-79 */ + [TUNER_SAMSUNG_TCPN_2121P30A] = { /* Samsung NTSC */ + .name = "Samsung TCPN 2121P30A", + .params = tuner_samsung_tcpn_2121p30a_params, + }, +}; + +unsigned const int tuner_count = ARRAY_SIZE(tuners); diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 5e71a354e87..582551b0969 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -190,7 +190,7 @@ hauppauge_tuner[] = { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"}, { TUNER_TCL_2002N, "TCL 2002N 6A"}, { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"}, - { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, + { TUNER_SAMSUNG_TCPN_2121P30A, "Samsung TCPN 2121P30A"}, { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, /* 90-99 */ diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 9094fa9f2ec..fad9ea0ae4f 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -634,7 +634,7 @@ struct i2c_vbi_ram_value { unsigned char values[26]; }; -struct i2c_vbi_ram_value vbi_ram_default[] = +static struct i2c_vbi_ram_value vbi_ram_default[] = { {0x010, /* WST SECAM 6 */ { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 } diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 5dbd7c1b362..cd2c4475525 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -306,6 +306,7 @@ static const char *v4l2_int_ioctls[] = { #endif [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", + [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX", [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index d5be2598714..078880e4c8c 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -29,7 +29,6 @@ #include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include <asm/system.h> -#include <asm/semaphore.h> #include <linux/videodev.h> @@ -83,7 +82,7 @@ static struct class video_class = { */ static struct video_device *video_device[VIDEO_NUM_DEVICES]; -static DECLARE_MUTEX(videodev_lock); +static DEFINE_MUTEX(videodev_lock); struct video_device* video_devdata(struct file *file) { @@ -102,15 +101,15 @@ static int video_open(struct inode *inode, struct file *file) if(minor>=VIDEO_NUM_DEVICES) return -ENODEV; - down(&videodev_lock); + mutex_lock(&videodev_lock); vfl=video_device[minor]; if(vfl==NULL) { - up(&videodev_lock); + mutex_unlock(&videodev_lock); request_module("char-major-%d-%d", VIDEO_MAJOR, minor); - down(&videodev_lock); + mutex_lock(&videodev_lock); vfl=video_device[minor]; if (vfl==NULL) { - up(&videodev_lock); + mutex_unlock(&videodev_lock); return -ENODEV; } } @@ -123,7 +122,7 @@ static int video_open(struct inode *inode, struct file *file) file->f_op = fops_get(old_fops); } fops_put(old_fops); - up(&videodev_lock); + mutex_unlock(&videodev_lock); return err; } @@ -304,12 +303,12 @@ int video_register_device(struct video_device *vfd, int type, int nr) } /* pick a minor number */ - down(&videodev_lock); + mutex_lock(&videodev_lock); if (nr >= 0 && nr < end-base) { /* use the one the driver asked for */ i = base+nr; if (NULL != video_device[i]) { - up(&videodev_lock); + mutex_unlock(&videodev_lock); return -ENFILE; } } else { @@ -318,13 +317,13 @@ int video_register_device(struct video_device *vfd, int type, int nr) if (NULL == video_device[i]) break; if (i == end) { - up(&videodev_lock); + mutex_unlock(&videodev_lock); return -ENFILE; } } video_device[i]=vfd; vfd->minor=i; - up(&videodev_lock); + mutex_unlock(&videodev_lock); sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base); devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor), @@ -362,14 +361,14 @@ int video_register_device(struct video_device *vfd, int type, int nr) void video_unregister_device(struct video_device *vfd) { - down(&videodev_lock); + mutex_lock(&videodev_lock); if(video_device[vfd->minor]!=vfd) panic("videodev: bad unregister"); devfs_remove(vfd->devfs_name); video_device[vfd->minor]=NULL; class_device_unregister(&vfd->class_dev); - up(&videodev_lock); + mutex_unlock(&videodev_lock); } diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig index eafa23f5cbd..effa0d7a73a 100644 --- a/drivers/mtd/chips/Kconfig +++ b/drivers/mtd/chips/Kconfig @@ -31,6 +31,7 @@ config MTD_JEDECPROBE config MTD_GEN_PROBE tristate + select OBSOLETE_INTERMODULE config MTD_CFI_ADV_OPTIONS bool "Flash chip driver advanced configuration options" @@ -259,7 +260,7 @@ config MTD_ABSENT with this driver will return -ENODEV upon access. config MTD_OBSOLETE_CHIPS - depends on MTD && BROKEN + depends on MTD bool "Older (theoretically obsoleted now) drivers for non-CFI chips" help This option does not enable any code directly, but will allow you to @@ -272,7 +273,7 @@ config MTD_OBSOLETE_CHIPS config MTD_AMDSTD tristate "AMD compatible flash chip support (non-CFI)" - depends on MTD && MTD_OBSOLETE_CHIPS + depends on MTD && MTD_OBSOLETE_CHIPS && BROKEN help This option enables support for flash chips using AMD-compatible commands, including some which are not CFI-compatible and hence @@ -290,7 +291,7 @@ config MTD_SHARP config MTD_JEDEC tristate "JEDEC device support" - depends on MTD && MTD_OBSOLETE_CHIPS + depends on MTD && MTD_OBSOLETE_CHIPS && BROKEN help Enable older older JEDEC flash interface devices for self programming flash. It is commonly used in older AMD chips. It is diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index 5038e90ceb1..dd628cb51e3 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig @@ -218,6 +218,7 @@ config MTD_DOC2001PLUS config MTD_DOCPROBE tristate select MTD_DOCECC + select OBSOLETE_INTERMODULE config MTD_DOCECC tristate diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index fab6586d87e..ef54ebeb29b 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -93,6 +93,9 @@ Deepak Saxena : dsaxena@plexity.net : Intel IXDP2351 platform support + Dmitry Pervushin : dpervushin@ru.mvista.com + : PNX010X platform support + */ /* Always include 'config.h' first in case the user wants to turn on diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c index 3a74a63dd4f..55e6e2d60d3 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/sbuslib.c @@ -216,10 +216,10 @@ static int fbiogetputcmap(struct file *file, struct fb_info *info, ret |= put_user(compat_ptr(addr), &p->blue); if (ret) return -EFAULT; - return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, + return info->fbops->fb_ioctl(info, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, - (unsigned long)p, info); + (unsigned long)p); } struct fbcursor32 { @@ -260,12 +260,11 @@ static int fbiogscursor(struct file *file, struct fb_info *info, ret |= put_user(compat_ptr(addr), &p->image); if (ret) return -EFAULT; - return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, - FBIOSCURSOR, (unsigned long)p, info); + return info->fbops->fb_ioctl(info, FBIOSCURSOR, (unsigned long)p); } -long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg, struct fb_info *info) +long sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg) { switch (cmd) { case FBIOGTYPE: @@ -278,14 +277,13 @@ long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, case FBIOSCURPOS: case FBIOGCURPOS: case FBIOGCURMAX: - return info->fbops->fb_ioctl(file->f_dentry->d_inode, - file, cmd, arg, info); + return info->fbops->fb_ioctl(info, cmd, arg); case FBIOPUTCMAP32: - return fbiogetputcmap(file, info, cmd, arg); + return fbiogetputcmap(info, cmd, arg); case FBIOGETCMAP32: - return fbiogetputcmap(file, info, cmd, arg); + return fbiogetputcmap(info, cmd, arg); case FBIOSCURSOR32: - return fbiogscursor(file, info, arg); + return fbiogscursor(info, arg); default: return -ENOIOCTLCMD; } diff --git a/drivers/video/sbuslib.h b/drivers/video/sbuslib.h index b470e52ce9e..f753939013e 100644 --- a/drivers/video/sbuslib.h +++ b/drivers/video/sbuslib.h @@ -20,7 +20,7 @@ extern int sbusfb_mmap_helper(struct sbus_mmap_map *map, int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, struct fb_info *info, int type, int fb_depth, unsigned long fb_size); -long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg, struct fb_info *info); +long sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, + unsigned long arg); #endif /* _SBUSLIB_H */ |