aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/ps2esdi.c1
-rw-r--r--drivers/char/esp.c2
-rw-r--r--drivers/char/rio/brates.h106
-rw-r--r--drivers/char/rio/chan.h33
-rw-r--r--drivers/char/rio/cmd.h83
-rw-r--r--drivers/char/rio/data.h40
-rw-r--r--drivers/char/rio/debug.h39
-rw-r--r--drivers/char/rio/eisa.h104
-rw-r--r--drivers/char/rio/enable.h48
-rw-r--r--drivers/char/rio/formpkt.h153
-rw-r--r--drivers/char/rio/hosthw.h55
-rw-r--r--drivers/char/rio/lrt.h52
-rw-r--r--drivers/char/rio/ltt.h52
-rw-r--r--drivers/char/rio/lttwake.h50
-rw-r--r--drivers/char/rio/mca.h73
-rw-r--r--drivers/char/rio/mesg.h41
-rw-r--r--drivers/char/rio/poll.h73
-rw-r--r--drivers/char/rio/proto.h244
-rw-r--r--drivers/char/rio/rio_linux.c60
-rw-r--r--drivers/char/rio/rioboot.c61
-rw-r--r--drivers/char/rio/riocmd.c30
-rw-r--r--drivers/char/rio/rioctrl.c111
-rw-r--r--drivers/char/rio/rioinit.c1152
-rw-r--r--drivers/char/rio/riolocks.h43
-rw-r--r--drivers/char/rio/rioparam.c43
-rw-r--r--drivers/char/rio/rioroute.c24
-rw-r--r--drivers/char/rio/riotable.c8
-rw-r--r--drivers/char/rio/riotime.h63
-rw-r--r--drivers/char/rio/riotty.c583
-rw-r--r--drivers/char/rio/riowinif.h1329
-rw-r--r--drivers/char/rio/riscos.h63
-rw-r--r--drivers/char/rio/rtahw.h75
-rw-r--r--drivers/char/rio/rupstat.h50
-rw-r--r--drivers/char/rio/selftest.h73
-rw-r--r--drivers/char/rio/sysmap.h62
-rw-r--r--drivers/char/rio/timeouts.h50
-rw-r--r--drivers/ieee1394/amdtp.c1297
-rw-r--r--drivers/ieee1394/amdtp.h84
-rw-r--r--drivers/ieee1394/cmp.c311
-rw-r--r--drivers/ieee1394/cmp.h31
-rw-r--r--drivers/input/touchscreen/Kconfig2
-rw-r--r--drivers/md/md.c1
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c2
-rw-r--r--drivers/media/dvb/bt8xx/dvb-bt8xx.c4
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c22
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c2
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c2
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c40
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.h12
-rw-r--r--drivers/media/video/Makefile3
-rw-r--r--drivers/media/video/arv.c6
-rw-r--r--drivers/media/video/bt832.c2
-rw-r--r--drivers/media/video/btcx-risc.c2
-rw-r--r--drivers/media/video/bttv-cards.c6
-rw-r--r--drivers/media/video/bttv-driver.c87
-rw-r--r--drivers/media/video/bttv-i2c.c6
-rw-r--r--drivers/media/video/bttvp.h5
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c2
-rw-r--r--drivers/media/video/cx88/Kconfig3
-rw-r--r--drivers/media/video/cx88/Makefile1
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c9
-rw-r--r--drivers/media/video/cx88/cx88-core.c15
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c8
-rw-r--r--drivers/media/video/cx88/cx88-vp3054-i2c.c4
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c77
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c7
-rw-r--r--drivers/media/video/msp3400-driver.c14
-rw-r--r--drivers/media/video/msp3400.h8
-rw-r--r--drivers/media/video/mt20xx.c12
-rw-r--r--drivers/media/video/planb.c4
-rw-r--r--drivers/media/video/saa6588.c10
-rw-r--r--drivers/media/video/saa711x.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c21
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c11
-rw-r--r--drivers/media/video/tda8290.c4
-rw-r--r--drivers/media/video/tea5767.c18
-rw-r--r--drivers/media/video/tuner-core.c85
-rw-r--r--drivers/media/video/tuner-simple.c794
-rw-r--r--drivers/media/video/tuner-types.c1406
-rw-r--r--drivers/media/video/tveeprom.c2
-rw-r--r--drivers/media/video/tvp5150.c2
-rw-r--r--drivers/media/video/v4l2-common.c1
-rw-r--r--drivers/media/video/videodev.c25
-rw-r--r--drivers/mtd/chips/Kconfig7
-rw-r--r--drivers/mtd/devices/Kconfig1
-rw-r--r--drivers/net/cs89x0.c3
-rw-r--r--drivers/video/sbuslib.c20
-rw-r--r--drivers/video/sbuslib.h4
90 files changed, 1811 insertions, 7835 deletions
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index 43415f69839f..bea75f2cb211 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -43,6 +43,7 @@
43#include <linux/init.h> 43#include <linux/init.h>
44#include <linux/ioport.h> 44#include <linux/ioport.h>
45#include <linux/module.h> 45#include <linux/module.h>
46#include <linux/hdreg.h>
46 47
47#include <asm/system.h> 48#include <asm/system.h>
48#include <asm/io.h> 49#include <asm/io.h>
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index dd5dc8fa490d..3f3ac039f4d9 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2492,6 +2492,7 @@ static int __init espserial_init(void)
2492 } 2492 }
2493 2493
2494 memset((void *)info, 0, sizeof(struct esp_struct)); 2494 memset((void *)info, 0, sizeof(struct esp_struct));
2495 spin_lock_init(&info->lock);
2495 /* rx_trigger, tx_trigger are needed by autoconfig */ 2496 /* rx_trigger, tx_trigger are needed by autoconfig */
2496 info->config.rx_trigger = rx_trigger; 2497 info->config.rx_trigger = rx_trigger;
2497 info->config.tx_trigger = tx_trigger; 2498 info->config.tx_trigger = tx_trigger;
@@ -2528,7 +2529,6 @@ static int __init espserial_init(void)
2528 init_waitqueue_head(&info->close_wait); 2529 init_waitqueue_head(&info->close_wait);
2529 init_waitqueue_head(&info->delta_msr_wait); 2530 init_waitqueue_head(&info->delta_msr_wait);
2530 init_waitqueue_head(&info->break_wait); 2531 init_waitqueue_head(&info->break_wait);
2531 spin_lock_init(&info->lock);
2532 ports = info; 2532 ports = info;
2533 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", 2533 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
2534 info->line, info->port, info->irq); 2534 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 dd686d58fd66..000000000000
--- a/drivers/char/rio/brates.h
+++ /dev/null
@@ -1,106 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* BRATES.H *******
4 ******* *******
5 ****************************************************************************
6
7 Author : Jeremy Rolls
8 Date : 1 Nov 1990
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef _brates_h
38#ifndef lint
39/* static char * _brates_h_sccs = "@(#)brates.h 1.4"; */
40#endif
41#define _brates_h 1
42/* List of baud rate defines. Most are borrowed from /usr/include/sys/termio.h
43*/
44#ifndef INKERNEL
45
46#define B0 0x00
47#define B50 0x01
48#define B75 0x02
49#define B110 0x03
50#define B134 0x04
51#define B150 0x05
52#define B200 0x06
53#define B300 0x07
54#define B600 0x08
55#define B1200 0x09
56#define B1800 0x0a
57#define B2400 0x0b
58#define B4800 0x0c
59#define B9600 0x0d
60#define B19200 0x0e
61#define B38400 0x0f
62
63#endif
64
65/*
66** The following baudrates may or may not be defined
67** on various UNIX systems.
68** If they are not then we define them.
69** If they are then we do not define them ;-)
70**
71** This is appalling that we use same definitions as UNIX
72** for our own download code as there is no garuntee that
73** B57600 will be defined as 0x11 by a UNIX system....
74** Arghhhhh!!!!!!!!!!!!!!
75*/
76#if !defined(B56000)
77#define B56000 0x10
78#endif
79
80#if !defined(B57600)
81#define B57600 0x11
82#endif
83
84#if !defined(B64000)
85#define B64000 0x12
86#endif
87
88#if !defined(B115200)
89#define B115200 0x13
90#endif
91
92
93#if !defined(B2000)
94#define B2000 0x14
95#endif
96
97
98#define MAX_RATE B2000
99
100struct baud_rate { /* Tag for baud rates */
101 /* short host_rate, *//* As passed by the driver */
102 short divisor, /* The divisor */
103 prescaler; /* The pre-scaler */
104};
105
106#endif
diff --git a/drivers/char/rio/chan.h b/drivers/char/rio/chan.h
deleted file mode 100644
index af14311f9b66..000000000000
--- a/drivers/char/rio/chan.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 *
3 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/
19#ifndef _chan_h
20#define _chan_h
21
22#ifndef lint
23#ifdef SCCS
24static char *_rio_chan_h_sccs = "@(#)chan.h 1.1";
25#endif
26#endif
27
28#define Link0 0
29#define Link1 1
30#define Link2 2
31#define Link3 3
32
33#endif
diff --git a/drivers/char/rio/cmd.h b/drivers/char/rio/cmd.h
deleted file mode 100644
index 797b62400c91..000000000000
--- a/drivers/char/rio/cmd.h
+++ /dev/null
@@ -1,83 +0,0 @@
1
2
3/****************************************************************************
4 ******* *******
5 ******* C O M M A N D P A C K E T H E A D E R S
6 ******* *******
7 ****************************************************************************
8
9 Author : Ian Nandhra
10 Date :
11
12 *
13 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
29 Version : 0.01
30
31
32 Mods
33 ----------------------------------------------------------------------------
34 Date By Description
35 ----------------------------------------------------------------------------
36
37 ***************************************************************************/
38
39
40#ifndef _cmd_h
41#define _cmd_h
42
43#ifndef lint
44#ifdef SCCS
45static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1";
46#endif
47#endif
48
49
50#define PRE_EMPTIVE_CMD 0x80
51#define INLINE_CMD ~PRE_EMPTIVE_CMD
52
53#define CMD_IGNORE_PKT ( (ushort) 0)
54#define CMD_STATUS_REQ ( (ushort) 1)
55#define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */
56#define CMD_CONF_PORT ( (ushort) 3)
57#define CMD_CONF_UNIT ( (ushort) 4)
58#define CMD_ROUTE_MAP_REQ ( (ushort) 5)
59#define CMD_FLUSH_TX ( (ushort) 6)
60#define CMD_FLUSH_RX ( (ushort) 7)
61#define CMD_PARTION_PORT ( (ushort) 8)
62#define CMD_RESET_PORT ( (ushort) 0x0a)
63#define CMD_BOOT_UNIT ( (ushort) 0x0b)
64#define CMD_FOUND_UNIT ( (ushort) 0x0c)
65#define CMD_ATTACHED_RTA_2 ( (ushort) 0x0d)
66#define CMD_PROVIDE_BOOT ( (ushort) 0x0e)
67#define CMD_CIRRUS ( (ushort) 0x0f)
68
69#define FORM_STATUS_PKT ( (ushort) 1 )
70#define FORM_POLL_PKT ( (ushort) 2 )
71#define FORM_LINK_STATUS_PKT ( (ushort) 3 )
72
73
74#define CMD_DATA_PORT ( (ushort) 1 )
75#define CMD_DATA ( (ushort) 2 )
76
77#define CMD_TX_PART ( (ushort) 2 )
78#define CMD_RX_PART ( (ushort) 3 )
79#define CMD_RX_LIMIT ( (ushort) 4 )
80
81#endif
82
83/*********** end of file ***********/
diff --git a/drivers/char/rio/data.h b/drivers/char/rio/data.h
deleted file mode 100644
index dabc2d1fa40f..000000000000
--- a/drivers/char/rio/data.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : data.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:09
26** Retrieved : 11/6/98 11:34:21
27**
28** ident @(#)data.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_datadex__
34#define __rio_datadex__
35
36#ifndef lint
37static char *_data_h_sccs_ = "@(#)data.h 1.2";
38#endif
39
40#endif
diff --git a/drivers/char/rio/debug.h b/drivers/char/rio/debug.h
deleted file mode 100644
index 6ae95c00db4a..000000000000
--- a/drivers/char/rio/debug.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2** File: debug.h
3**
4** Author: David Dix
5**
6** Created: 12th March 1993
7**
8** Last modified: 93/04/27
9**
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27
28#ifndef _debug_h_
29#define _debug_h_
30
31
32#if defined(DCIRRUS)
33#define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn))
34#else
35#define DBPACKET(pkt, opt, str, c)
36#endif /* DCIRRUS */
37
38
39#endif /* _debug_h_ */
diff --git a/drivers/char/rio/eisa.h b/drivers/char/rio/eisa.h
deleted file mode 100644
index c2abaf0eab04..000000000000
--- a/drivers/char/rio/eisa.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6
7 *
8 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23**
24** Module : eisa.h
25** SID : 1.2
26** Last Modified : 11/6/98 11:34:10
27** Retrieved : 11/6/98 11:34:21
28**
29** ident @(#)eisa.h 1.2
30**
31** -----------------------------------------------------------------------------
32*/
33
34#ifndef __rio_eisa_h__
35#define __rio_eisa_h__
36
37#ifdef SCCS_LABELS
38#ifndef lint
39static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2";
40#endif
41#endif
42
43/*
44** things to do with the EISA bus
45*/
46
47#define RIO_EISA_STRING_ADDRESS 0xfffd9 /* where EISA is stored */
48
49#define RIO_MAX_EISA_SLOTS 16 /* how many EISA slots? */
50
51#define RIO_EISA_IDENT 0x984D /* Specialix */
52#define RIO_EISA_PRODUCT_CODE 0x14 /* Code 14 */
53#define RIO_EISA_ENABLE_BIT 0x01 /* To enable card */
54
55#define EISA_MEMORY_BASE_LO 0xC00 /* A16-A23 */
56#define EISA_MEMORY_BASE_HI 0xC01 /* A24-A31 */
57#define EISA_INTERRUPT_VEC 0xC02 /* see below */
58#define EISA_CONTROL_PORT 0xC02 /* see below */
59#define EISA_INTERRUPT_RESET 0xC03 /* read to clear IRQ */
60
61#define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */
62#define EISA_PRODUCT_IDENT_HI 0xC81
63#define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */
64#define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */
65#define EISA_ENABLE 0xC84 /* set LSB to enable card */
66#define EISA_UNIQUE_NUM_0 0xC88 /* vomit */
67#define EISA_UNIQUE_NUM_1 0xC8A
68#define EISA_UNIQUE_NUM_2 0xC90 /* bit strangely arranged */
69#define EISA_UNIQUE_NUM_3 0xC92
70#define EISA_MANUF_YEAR 0xC98 /* when */
71#define EISA_MANUF_WEEK 0xC9A /* more when */
72
73#define EISA_TP_BOOT_FROM_RAM 0x01
74#define EISA_TP_BOOT_FROM_LINK 0x00
75#define EISA_TP_FAST_LINKS 0x02
76#define EISA_TP_SLOW_LINKS 0x00
77#define EISA_TP_BUS_ENABLE 0x04
78#define EISA_TP_BUS_DISABLE 0x00
79#define EISA_TP_RUN 0x08
80#define EISA_TP_RESET 0x00
81#define EISA_POLLED 0x00
82#define EISA_IRQ_3 0x30
83#define EISA_IRQ_4 0x40
84#define EISA_IRQ_5 0x50
85#define EISA_IRQ_6 0x60
86#define EISA_IRQ_7 0x70
87#define EISA_IRQ_9 0x90
88#define EISA_IRQ_10 0xA0
89#define EISA_IRQ_11 0xB0
90#define EISA_IRQ_12 0xC0
91#define EISA_IRQ_14 0xE0
92#define EISA_IRQ_15 0xF0
93
94#define EISA_INTERRUPT_MASK 0xF0
95#define EISA_CONTROL_MASK 0x0F
96
97#define RIO_EISA_DEFAULT_MODE EISA_TP_SLOW_LINKS
98
99#define RIOEisaToIvec(X) (uchar )((uchar)((X) & EISA_INTERRUPT_MASK)>>4)
100
101#define INBZ(z,x) inb(((z)<<12) | (x))
102#define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y)
103
104#endif /* __rio_eisa_h__ */
diff --git a/drivers/char/rio/enable.h b/drivers/char/rio/enable.h
deleted file mode 100644
index e06673fa48cf..000000000000
--- a/drivers/char/rio/enable.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* E N A B L E H E A D E R S
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef lint
38#ifdef SCCS
39static char *_rio_enable_h_sccs = "@(#)enable.h 1.1";
40#endif
41#endif
42
43
44#define ENABLE_LTT TRUE
45#define ENABLE_LRT TRUE
46
47
48/*********** end of file ***********/
diff --git a/drivers/char/rio/formpkt.h b/drivers/char/rio/formpkt.h
deleted file mode 100644
index 3c7c91ace3ee..000000000000
--- a/drivers/char/rio/formpkt.h
+++ /dev/null
@@ -1,153 +0,0 @@
1
2
3/****************************************************************************
4 ******* *******
5 ******* F O R M P A C K E T H E A D E R F I L E
6 ******* *******
7 ****************************************************************************
8
9 Author : Ian Nandhra
10 Date :
11
12 *
13 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
29 Version : 0.01
30
31
32 Mods
33 ----------------------------------------------------------------------------
34 Date By Description
35 ----------------------------------------------------------------------------
36
37 ***************************************************************************/
38
39#ifndef _formpkt_h
40#define _formpkt_h 1
41
42#ifndef lint
43#ifdef SCCS
44static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1";
45#endif
46#endif
47
48typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1;
49struct FORM_BOOT_PKT_1 {
50 ushort pkt_number;
51 ushort pkt_total;
52 ushort boot_top;
53};
54
55typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2;
56struct FORM_BOOT_PKT_2 {
57 ushort pkt_number;
58 char boot_data[10];
59};
60
61
62typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA;
63struct FORM_ATTACH_RTA {
64 char cmd_code;
65 char booter_serial[4];
66 char booter_link;
67 char bootee_serial[4];
68 char bootee_link;
69};
70
71
72typedef struct FORM_BOOT_ID FORM_BOOT_ID;
73struct FORM_BOOT_ID {
74 char cmd_code;
75 char bootee_serial[4];
76 char bootee_prod_id;
77 char bootee_link;
78};
79
80
81
82typedef struct FORM_ROUTE_1 FORM_ROUTE_1;
83struct FORM_ROUTE_1 {
84 char cmd_code;
85 char pkt_number;
86 char total_in_sequence;
87 char unit_id;
88 char host_unit_id;
89};
90
91typedef struct FORM_ROUTE_2 FORM_ROUTE_2;
92struct FORM_ROUTE_2 {
93 char cmd_code;
94 char pkt_number;
95 char total_in_sequence;
96 char route_data[9];
97};
98
99typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ;
100struct FORM_ROUTE_REQ {
101 char cmd_code;
102 char pkt_number;
103 char total_in_sequence;
104 char route_data[10];
105};
106
107
108typedef struct FORM_ERROR FORM_ERROR;
109struct FORM_ERROR {
110 char cmd_code;
111 char error_code;
112
113};
114
115typedef struct FORM_STATUS FORM_STATUS;
116struct FORM_STATUS {
117 char cmd_code;
118 char status_code;
119 char last_packet_valid;
120 char tx_buffer;
121 char rx_buffer;
122 char port_status;
123 char phb_status;
124};
125
126
127typedef struct FORM_LINK_STATUS FORM_LINK_STATUS;
128struct FORM_LINK_STATUS {
129 char cmd_code;
130 char status_code;
131 char link_number;
132 ushort rx_errors;
133 ushort tx_errors;
134 ushort csum_errors;
135 ushort disconnects;
136};
137
138
139
140typedef struct FORM_PARTITION FORM_PARTITION;
141struct FORM_PARTITION {
142 char cmd_code;
143 char status_code;
144 char port_number;
145 char tx_max;
146 char rx_max;
147 char rx_limit;
148};
149
150
151#endif
152
153/*********** end of file ***********/
diff --git a/drivers/char/rio/hosthw.h b/drivers/char/rio/hosthw.h
deleted file mode 100644
index 6281fe47f4e9..000000000000
--- a/drivers/char/rio/hosthw.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* H O S T H A R D W A R E
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2";
41#endif
42#endif
43
44#define SET_OTHER_INTERRUPT ( (volatile u_short *) 0x7c80 )
45#define SET_EISA_INTERRUPT ( (volatile u_short *) 0x7ef0 )
46
47#define EISA_HOST 0x30
48#define AT_HOST 0xa0
49#define MCA_HOST 0xb0
50#define PCI_HOST 0xd0
51
52#define PRODUCT_MASK 0xf0
53
54
55/*********** end of file ***********/
diff --git a/drivers/char/rio/lrt.h b/drivers/char/rio/lrt.h
deleted file mode 100644
index b41764d7a22a..000000000000
--- a/drivers/char/rio/lrt.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* L R T
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef lint
38#ifdef SCCS_LABELS
39static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1";
40#endif
41#endif
42
43
44#ifdef DCIRRUS
45#define LRT_STACK (unsigned short) 600
46#else
47#define LRT_STACK (ushort) 200
48#endif
49
50
51
52/*********** end of file ***********/
diff --git a/drivers/char/rio/ltt.h b/drivers/char/rio/ltt.h
deleted file mode 100644
index ab04004d4048..000000000000
--- a/drivers/char/rio/ltt.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* L T T
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef lint
38#ifdef SCCS_LABELS
39static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1";
40#endif
41#endif
42
43#ifdef DCIRRUS
44#define LTT_STACK (unsigned short) 600
45#else
46#define LTT_STACK (ushort) 200
47#endif
48
49
50
51
52/*********** end of file ***********/
diff --git a/drivers/char/rio/lttwake.h b/drivers/char/rio/lttwake.h
deleted file mode 100644
index fdf0c1f250ab..000000000000
--- a/drivers/char/rio/lttwake.h
+++ /dev/null
@@ -1,50 +0,0 @@
1
2
3
4/****************************************************************************
5 ******* *******
6 ******* L T T W A K E U P H E A D E R
7 ******* *******
8 ****************************************************************************
9
10 Author : Ian Nandhra
11 Date :
12
13 *
14 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
30 Version : 0.01
31
32
33 Mods
34 ----------------------------------------------------------------------------
35 Date By Description
36 ----------------------------------------------------------------------------
37
38 ***************************************************************************/
39
40#ifndef lint
41#ifdef SCCS_LABELS
42static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1";
43#endif
44#endif
45
46#define LTT_WAKEUP_STACK 500
47#define LTT_WAKEUP_INTERVAL (int) (500 * MILLISECOND)
48
49
50/*********** end of file ***********/
diff --git a/drivers/char/rio/mca.h b/drivers/char/rio/mca.h
deleted file mode 100644
index d01e76be7a17..000000000000
--- a/drivers/char/rio/mca.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : mca.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:11
26** Retrieved : 11/6/98 11:34:21
27**
28** ident @(#)mca.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_mca_h__
34#define __rio_mca_h__
35
36#ifdef SCCS_LABELS
37static char *_mca_h_sccs_ = "@(#)mca.h 1.2";
38#endif
39
40/*
41** Micro Channel stuff
42*/
43
44#define McaMaxSlots 8
45#define McaSlotSelect 0x96
46#define McaSlotEnable 0x08
47#define McaIdLow 0x100
48#define McaIdHigh 0x101
49#define McaIrqEnable 0x102
50#define McaMemory 0x103
51#define McaRIOId 0x6a5c
52#define McaIrq9 0x00
53#define McaIrq3 0x02
54#define McaIrq4 0x04
55#define McaIrq7 0x06
56#define McaIrq10 0x08
57#define McaIrq11 0x0A
58#define McaIrq12 0x0C
59#define McaIrq15 0x0E
60#define McaIrqMask 0x0E
61#define McaCardEnable 0x01
62#define McaAddress(X) (((X)&0xFF)<<16)
63
64#define McaTpFastLinks 0x40
65#define McaTpSlowLinks 0x00
66#define McaTpBootFromRam 0x01
67#define McaTpBootFromLink 0x00
68#define McaTpBusEnable 0x02
69#define McaTpBusDisable 0x00
70
71#define RIO_MCA_DEFAULT_MODE SLOW_LINKS
72
73#endif /* __rio_mca_h__ */
diff --git a/drivers/char/rio/mesg.h b/drivers/char/rio/mesg.h
deleted file mode 100644
index dd9be586ec6f..000000000000
--- a/drivers/char/rio/mesg.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : mesg.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:12
26** Retrieved : 11/6/98 11:34:21
27**
28** ident @(#)mesg.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_mesg_h__
34#define __rio_mesg_h__
35
36#ifdef SCCS_LABELS
37static char *_mesg_h_sccs_ = "@(#)mesg.h 1.2";
38#endif
39
40
41#endif /* __rio_mesg_h__ */
diff --git a/drivers/char/rio/poll.h b/drivers/char/rio/poll.h
deleted file mode 100644
index 9616ee4c6cd5..000000000000
--- a/drivers/char/rio/poll.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* P O L L
4 ******* *******
5 ****************************************************************************
6
7 Author : Ian Nandhra / Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef _poll_h
38#define _poll_h
39
40#ifndef lint
41#ifdef SCCS_LABELS
42static char *_rio_poll_h_sccs = "@(#)poll.h 1.2";
43#endif
44#endif
45
46
47#ifdef HOST
48#define POLL_STACK 100
49#endif
50#ifdef RTA
51#define POLL_STACK 200
52#endif
53
54#define POLL_PERIOD (int) SECOND
55
56/* The various poll commands */
57#define POLL_POLL 0 /* We are connected and happy.. */
58#define POLL_INTRO 1 /* Introduction packet */
59#define POLL_TOPOLOGY 2 /* Topology update */
60#define POLL_ASSIGN 3 /* ID assign */
61#define POLL_FOAD 4 /* F*** Off And Die */
62#define POLL_LMD 5 /* Let Me Die */
63#define POLL_DYB 6 /* Die You Ba***** */
64
65/* The way data fields are split up for POLL packets */
66#define POLL_HOST_SERIAL 2 /* Host who booted me */
67#define POLL_MY_SERIAL 6 /* My serial number */
68#define POLL_YOUR_ID 1 /* Your ID number */
69#define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */
70
71#endif
72
73/*********** end of file ***********/
diff --git a/drivers/char/rio/proto.h b/drivers/char/rio/proto.h
deleted file mode 100644
index f9a3376333e5..000000000000
--- a/drivers/char/rio/proto.h
+++ /dev/null
@@ -1,244 +0,0 @@
1/*
2 *
3 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19#ifndef _prototypes_h
20#define _prototypes_h
21
22
23/*
24** boot.c
25*/
26void init_boot(char *p, short stage);
27
28/*
29** disconct.c
30*/
31void kill_boot(LPB * link);
32void disconnected(LPB * link);
33short boot_3(LPB * link, PKT * pkt);
34short send_3_pkt(LPB * link, PKT * pkt);
35
36/*
37** error.c
38*/
39void du_error(void);
40
41/*
42** formpkt.c
43*/
44ushort sum_it(PKT * pkt);
45void form_rup_pkt(RUP * form_rup, PKT * pkt);
46void form_poll_pkt(int type, LPB * link, int node);
47void form_route_pkt(int type, PKT * pkt, LPB * link);
48
49/*
50** idle.c
51*/
52void idle(Process * idle_p);
53
54/*
55** init.c
56*/
57void general_init(void);
58void mem_halt(int error);
59
60/*
61** linkinit.c
62*/
63void initlink(u_short number, LPB * link);
64void runlink(LPB * link);
65
66/*
67** list.c
68*/
69PKT *get_free_start(void);
70void put_free_start(PKT * pkt);
71
72#ifdef HOST
73int can_remove_transmit(PKT ** pkt, PKT * pointer);
74#endif
75
76#ifdef RTA
77int spl7(void);
78int spl0(void);
79Q_BUF *get_free_q(void);
80PKT *get_free_end(void);
81int add_end(PKT * pkt, PHB * phb, int type);
82unsigned short free_packets(PHB * phb, int type);
83int can_remove_start(PKT ** pkt, PHB * phb, int type);
84int can_add_start(PHB * phb, int type);
85int can_add_end(PHB * phb, int type);
86void put_free_end(PKT * pkt);
87int remove_start(PKT ** pkt, PHB * phb, int type);
88#endif
89
90/*
91** Lrt.c
92*/
93void lrt(Process * lrt_p, LPB * link);
94
95#ifdef RTA
96void set_led_red(LPB * link);
97#endif
98
99/*
100** ltt.c
101*/
102void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]);
103void send_poll(LPB * link);
104void request_id(LPB * link);
105void send_topology_update(LPB * link);
106void send_topology(LPB * link);
107void supply_id(LPB * link);
108
109#ifdef RTA
110void redirect_queue(LPB * link, ushort flush);
111int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link);
112#endif
113
114#ifdef TESTING_PERF
115int consume_cpu(void);
116#endif
117
118/*
119** lttwake.c
120*/
121#ifdef HOST
122void ltt_wakeup(Process * ltt_wakeup_p);
123#endif
124
125/*
126** mapgen.c
127*/
128void generate_id_map(short mapping, ROUTE_STR route[]);
129void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
130void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
131void init_sys_map(void);
132
133/*
134** mmu.c
135*/
136char *rio_malloc(unsigned int amount);
137char *rio_calloc(unsigned int num, unsigned int size);
138ERROR rio_mmu_init(uint total_mem);
139
140/*
141** partn.c
142*/
143void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit);
144
145/*
146** poll.c
147*/
148void tx_poll(Process * tx_poll_p);
149
150/*
151** process.c
152*/
153int get_proc_space(Process ** pd, int **pws, int wssize);
154
155/*
156** readrom.c
157*/
158void read_serial_number(char *buf);
159
160/*
161** rio.c
162*/
163int main(void);
164
165/*
166** route.c
167*/
168void route_update(PKT * pkt, LPB * link);
169
170/*
171** rtainit.c
172*/
173#if defined(RTA)
174void rta_init(ushort RtaType);
175#endif /* defined(RTA) */
176
177/*
178** rupboot.c
179*/
180void rup_boot(PKT * pkt, RUP * this_rup, LPB * link);
181
182#ifdef RTA
183void kill_your_neighbour(int link_to_kill);
184#endif
185
186/*
187** rupcmd.c
188*/
189void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link);
190
191/*
192** ruperr.c
193*/
194void rup_error(PKT * pkt, RUP * this_rup, LPB * link);
195void illegal_cmd(PKT * src_pkt);
196
197/*
198** ruppoll.c
199*/
200void rup_poll(PKT * pkt, RUP * this_rup, LPB * link);
201
202/*
203** ruppower.c
204*/
205void rup_power(PKT * pkt, RUP * this_rup, LPB * link);
206
207/*
208** ruprm.c
209*/
210void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link);
211
212/*
213** rupstat.c
214*/
215void rup_status(PKT * pkt, RUP * this_rup, LPB * link);
216
217/*
218** rupsync.c
219*/
220void rup_sync(PKT * pkt);
221
222/*
223** rxpkt.c
224*/
225ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link);
226
227/*
228** sendsts.c
229*/
230void send_status(PKT * requesting_pkt, RUP * this_rup);
231
232/*
233** serial.c
234*/
235void assign_serial(char *ser_in, char *ser_out);
236int cmp_serial(char *ser_1, char *ser_2);
237
238/*
239** txpkt.c
240*/
241ERROR tx_pkt(PKT * pkt, LPB * link);
242short send_sync(LPB * link);
243
244#endif /* _prototypes_h */
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 8825bd61b7d0..c9af283a811d 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -132,16 +132,6 @@ more than 512 ports.... */
132*/ 132*/
133#define IRQ_RATE_LIMIT 200 133#define IRQ_RATE_LIMIT 200
134 134
135#if 0
136/* Not implemented */
137/*
138 * The following defines are mostly for testing purposes. But if you need
139 * some nice reporting in your syslog, you can define them also.
140 */
141#define RIO_REPORT_FIFO
142#define RIO_REPORT_OVERRUN
143#endif
144
145 135
146/* These constants are derived from SCO Source */ 136/* These constants are derived from SCO Source */
147static struct Conf 137static struct Conf
@@ -573,21 +563,6 @@ static void rio_shutdown_port(void *ptr)
573 563
574 PortP = (struct Port *) ptr; 564 PortP = (struct Port *) ptr;
575 PortP->gs.tty = NULL; 565 PortP->gs.tty = NULL;
576#if 0
577 port->gs.flags &= ~GS_ACTIVE;
578 if (!port->gs.tty) {
579 rio_dprintk(RIO_DBUG_TTY, "No tty.\n");
580 return;
581 }
582 if (!port->gs.tty->termios) {
583 rio_dprintk(RIO_DEBUG_TTY, "No termios.\n");
584 return;
585 }
586 if (port->gs.tty->termios->c_cflag & HUPCL) {
587 rio_setsignals(port, 0, 0);
588 }
589#endif
590
591 func_exit(); 566 func_exit();
592} 567}
593 568
@@ -663,11 +638,6 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd
663 638
664 rc = 0; 639 rc = 0;
665 switch (cmd) { 640 switch (cmd) {
666#if 0
667 case TIOCGSOFTCAR:
668 rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg);
669 break;
670#endif
671 case TIOCSSOFTCAR: 641 case TIOCSSOFTCAR:
672 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { 642 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
673 tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); 643 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
709 if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) 679 if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct)))
710 rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); 680 rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
711 break; 681 break;
712#if 0
713 /*
714 * note: these IOCTLs no longer reach here. Use
715 * tiocmset/tiocmget driver methods instead. The
716 * #if 0 disablement predates this comment.
717 */
718 case TIOCMGET:
719 rc = -EFAULT;
720 if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) {
721 rc = 0;
722 ival = rio_getsignals(port);
723 put_user(ival, (unsigned int *) arg);
724 }
725 break;
726 case TIOCMBIS:
727 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
728 rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1));
729 }
730 break;
731 case TIOCMBIC:
732 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
733 rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1));
734 }
735 break;
736 case TIOCMSET:
737 if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
738 rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0));
739 }
740 break;
741#endif
742 default: 682 default:
743 rc = -ENOIOCTLCMD; 683 rc = -ENOIOCTLCMD;
744 break; 684 break;
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index 34cbb13aad4b..92df43552f15 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -665,13 +665,6 @@ struct PKT *PacketP;
665 struct CmdBlk *CmdBlkP; 665 struct CmdBlk *CmdBlkP;
666 uint sequence; 666 uint sequence;
667 667
668#ifdef CHECK
669 CheckHost(Host);
670 CheckRup(Rup);
671 CheckHostP(HostP);
672 CheckPacketP(PacketP);
673#endif
674
675 /* 668 /*
676 ** If we haven't been told what to boot, we can't boot it. 669 ** If we haven't been told what to boot, we can't boot it.
677 */ 670 */
@@ -956,11 +949,6 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
956 MyType = "RTA"; 949 MyType = "RTA";
957 MyName = HostP->Mapping[Rup].Name; 950 MyName = HostP->Mapping[Rup].Name;
958 } 951 }
959#ifdef CHECK
960 CheckString(MyType);
961 CheckString(MyName);
962#endif
963
964 MyLink = RBYTE(PktCmdP->LinkNum); 952 MyLink = RBYTE(PktCmdP->LinkNum);
965 953
966 /* 954 /*
@@ -1309,52 +1297,3 @@ struct Host *HostP;
1309 } 1297 }
1310} 1298}
1311 1299
1312#if 0
1313/*
1314 Function: This function is to disable the disk interrupt
1315 Returns : Nothing
1316*/
1317void
1318disable_interrupt(vector)
1319int vector;
1320{
1321 int ps;
1322 int val;
1323
1324 disable(ps);
1325 if (vector > 40) {
1326 val = 1 << (vector - 40);
1327 __outb(S8259+1, __inb(S8259+1) | val);
1328 }
1329 else {
1330 val = 1 << (vector - 32);
1331 __outb(M8259+1, __inb(M8259+1) | val);
1332 }
1333 restore(ps);
1334}
1335
1336/*
1337 Function: This function is to enable the disk interrupt
1338 Returns : Nothing
1339*/
1340void
1341enable_interrupt(vector)
1342int vector;
1343{
1344 int ps;
1345 int val;
1346
1347 disable(ps);
1348 if (vector > 40) {
1349 val = 1 << (vector - 40);
1350 val = ~val;
1351 __outb(S8259+1, __inb(S8259+1) & val);
1352 }
1353 else {
1354 val = 1 << (vector - 32);
1355 val = ~val;
1356 __outb(M8259+1, __inb(M8259+1) & val);
1357 }
1358 restore(ps);
1359}
1360#endif
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index b97dd9fdb6ba..694bfb9d9378 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 *
387 387
388 func_enter(); 388 func_enter();
389 389
390#ifdef CHECK
391 CheckHost(Host);
392 CheckHostP(HostP);
393 CheckPacketP(PacketP);
394#endif
395
396 /* 390 /*
397 ** 16 port RTA note: 391 ** 16 port RTA note:
398 ** Command rup packets coming from the RTA will have pkt->data[1] (which 392 ** 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 *
406 SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); 400 SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA);
407 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); 401 rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
408 402
409#ifdef CHECK
410 CheckRup(rup);
411 CheckUnixRupP(UnixRupP);
412#endif
413 if (UnixRupP->BaseSysPort == NO_PORT) { 403 if (UnixRupP->BaseSysPort == NO_PORT) {
414 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); 404 rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
415 rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); 405 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 *
429 rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); 419 rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
430 return TRUE; 420 return TRUE;
431 } 421 }
432#ifdef CHECK
433 CheckSysPort(SysPort);
434#endif
435 PortP = p->RIOPortp[SysPort]; 422 PortP = p->RIOPortp[SysPort];
436 rio_spin_lock_irqsave(&PortP->portSem, flags); 423 rio_spin_lock_irqsave(&PortP->portSem, flags);
437 switch (RBYTE(PktCmdP->Command)) { 424 switch (RBYTE(PktCmdP->Command)) {
@@ -604,11 +591,6 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
604 struct UnixRup *UnixRupP; 591 struct UnixRup *UnixRupP;
605 unsigned long flags; 592 unsigned long flags;
606 593
607#ifdef CHECK
608 CheckHostP(HostP);
609 CheckRup(Rup);
610 CheckCmdBlkP(CmdBlkP);
611#endif
612 if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { 594 if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) {
613 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); 595 rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
614 RIOFreeCmdBlk(CmdBlkP); 596 RIOFreeCmdBlk(CmdBlkP);
@@ -806,9 +788,6 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
806 ** If it returns RIO_FAIL then don't 788 ** If it returns RIO_FAIL then don't
807 ** send this command yet! 789 ** send this command yet!
808 */ 790 */
809#ifdef CHECK
810 CheckCmdBlkP(CmdBlkP);
811#endif
812 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { 791 if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
813 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); 792 rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP);
814 } else { 793 } else {
@@ -816,9 +795,6 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
816 /* 795 /*
817 ** Whammy! blat that pack! 796 ** Whammy! blat that pack!
818 */ 797 */
819#ifdef CHECK
820 CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
821#endif
822 HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); 798 HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
823 799
824 /* 800 /*
@@ -852,9 +828,6 @@ int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
852 unsigned long flags; 828 unsigned long flags;
853 829
854 rio_spin_lock_irqsave(&PortP->portSem, flags); 830 rio_spin_lock_irqsave(&PortP->portSem, flags);
855#ifdef CHECK
856 CheckPortP(PortP);
857#endif
858 PortP->WflushFlag++; 831 PortP->WflushFlag++;
859 PortP->MagicFlags |= MAGIC_FLUSH; 832 PortP->MagicFlags |= MAGIC_FLUSH;
860 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 833 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@@ -894,9 +867,6 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
894 867
895 rio_spin_lock_irqsave(&PortP->portSem, flags); 868 rio_spin_lock_irqsave(&PortP->portSem, flags);
896 869
897#ifdef CHECK
898 CheckPortP(PortP);
899#endif
900 rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n"); 870 rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
901 871
902 if (PortP->InUse) { 872 if (PortP->InUse) {
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index 0b7700d2f049..fcf18a061228 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -308,12 +308,7 @@ int su;
308 } 308 }
309 309
310 case RIO_DEBUG_MEM: 310 case RIO_DEBUG_MEM:
311#ifdef DEBUG_MEM_SUPPORT 311 return -EPERM;
312 RIO_DEBUG_CTRL, if (su)
313 return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg);
314 else
315#endif
316 return -EPERM;
317 312
318 case RIO_ALL_MODEM: 313 case RIO_ALL_MODEM:
319 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); 314 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
@@ -591,12 +586,7 @@ int su;
591 586
592 case RIO_GET_LOG: 587 case RIO_GET_LOG:
593 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); 588 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
594#ifdef LOGGING
595 RIOGetLog(arg);
596 return 0;
597#else
598 return -EINVAL; 589 return -EINVAL;
599#endif
600 590
601 case RIO_GET_MODTYPE: 591 case RIO_GET_MODTYPE:
602 if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { 592 if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) {
@@ -684,52 +674,6 @@ int su;
684 rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); 674 rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
685 for (loop = PortSetup.From; loop <= PortSetup.To; loop++) { 675 for (loop = PortSetup.From; loop <= PortSetup.To; loop++) {
686 rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); 676 rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
687#if 0
688 PortP = p->RIOPortp[loop];
689 if (!PortP->TtyP)
690 PortP->TtyP = &p->channel[loop];
691
692 rio_spin_lock_irqsave(&PortP->portSem, flags);
693 if (PortSetup.IxAny)
694 PortP->Config |= RIO_IXANY;
695 else
696 PortP->Config &= ~RIO_IXANY;
697 if (PortSetup.IxOn)
698 PortP->Config |= RIO_IXON;
699 else
700 PortP->Config &= ~RIO_IXON;
701
702 /*
703 ** If the port needs to wait for all a processes output
704 ** to drain before closing then this flag will be set.
705 */
706 if (PortSetup.Drain) {
707 PortP->Config |= RIO_WAITDRAIN;
708 } else {
709 PortP->Config &= ~RIO_WAITDRAIN;
710 }
711 /*
712 ** Store settings if locking or unlocking port or if the
713 ** port is not locked, when setting the store option.
714 */
715 if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) {
716 PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag;
717 PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag;
718 PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag;
719 PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag;
720 PortP->StoredTty.line = PortP->TtyP->tm.c_line;
721 bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5);
722 }
723 PortP->Lock = PortSetup.Lock;
724 PortP->Store = PortSetup.Store;
725 PortP->Xprint.XpCps = PortSetup.XpCps;
726 bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN);
727 bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN);
728 PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
729 PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
730 PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff);
731 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
732#endif
733 } 677 }
734 rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); 678 rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
735 rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval); 679 rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval);
@@ -801,12 +745,6 @@ int su;
801 745
802 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); 746 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
803 PortP = (p->RIOPortp[PortTty.port]); 747 PortP = (p->RIOPortp[PortTty.port]);
804#if 0
805 PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag;
806 PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag;
807 PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag;
808 PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag;
809#endif
810 if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { 748 if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) {
811 p->RIOError.Error = COPYOUT_FAILED; 749 p->RIOError.Error = COPYOUT_FAILED;
812 return -EFAULT; 750 return -EFAULT;
@@ -824,15 +762,6 @@ int su;
824 return -ENXIO; 762 return -ENXIO;
825 } 763 }
826 PortP = (p->RIOPortp[PortTty.port]); 764 PortP = (p->RIOPortp[PortTty.port]);
827#if 0
828 rio_spin_lock_irqsave(&PortP->portSem, flags);
829 PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag;
830 PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag;
831 PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag;
832 PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag;
833 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
834#endif
835
836 RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); 765 RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
837 return retval; 766 return retval;
838 767
@@ -909,23 +838,6 @@ int su;
909 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 838 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
910 return retval; 839 return retval;
911 840
912#ifdef DEBUG_SUPPORTED
913 case RIO_READ_LEVELS:
914 {
915 int num;
916 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n");
917 for (num = 0; RIODbInf[num].Flag; num++);
918 rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num);
919 if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) {
920 rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
921 p->RIOError.Error = COPYOUT_FAILED;
922 return -EFAULT;
923 }
924 rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num);
925 return retval;
926 }
927#endif
928
929 case RIO_READ_CONFIG: 841 case RIO_READ_CONFIG:
930 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); 842 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
931 if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { 843 if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) {
@@ -1084,30 +996,13 @@ int su;
1084 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); 996 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
1085 bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); 997 bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags));
1086 p->RIOHosts[Host].Flags = RC_WAITING; 998 p->RIOHosts[Host].Flags = RC_WAITING;
1087#if 0
1088 RIOSetupDataStructs(p);
1089#endif
1090 } 999 }
1091 RIOFoadWakeup(p); 1000 RIOFoadWakeup(p);
1092 p->RIONumBootPkts = 0; 1001 p->RIONumBootPkts = 0;
1093 p->RIOBooting = 0; 1002 p->RIOBooting = 0;
1094
1095#ifdef RINGBUFFER_SUPPORT
1096 for (loop = 0; loop < RIO_PORTS; loop++)
1097 if (p->RIOPortp[loop]->TxRingBuffer)
1098 sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize);
1099#endif
1100#if 0
1101 bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port));
1102#else
1103 printk("HEEEEELP!\n"); 1003 printk("HEEEEELP!\n");
1104#endif
1105 1004
1106 for (loop = 0; loop < RIO_PORTS; loop++) { 1005 for (loop = 0; loop < RIO_PORTS; loop++) {
1107#if 0
1108 p->RIOPortp[loop]->TtyP = &p->channel[loop];
1109#endif
1110
1111 spin_lock_init(&p->RIOPortp[loop]->portSem); 1006 spin_lock_init(&p->RIOPortp[loop]->portSem);
1112 p->RIOPortp[loop]->InUse = NOT_INUSE; 1007 p->RIOPortp[loop]->InUse = NOT_INUSE;
1113 } 1008 }
@@ -1653,10 +1548,6 @@ uchar Cmd;
1653 ushort rup; 1548 ushort rup;
1654 int port; 1549 int port;
1655 1550
1656#ifdef CHECK
1657 CheckPortP(PortP);
1658#endif
1659
1660 if (PortP->State & RIO_DELETED) { 1551 if (PortP->State & RIO_DELETED) {
1661 rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); 1552 rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
1662 return RIO_FAIL; 1553 return RIO_FAIL;
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index 898a126ae3e6..0d44ef464e6b 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";
87 87
88int RIOPCIinit(struct rio_info *p, int Mode); 88int RIOPCIinit(struct rio_info *p, int Mode);
89 89
90#if 0
91static void RIOAllocateInterrupts(struct rio_info *);
92static int RIOReport(struct rio_info *);
93static void RIOStopInterrupts(struct rio_info *, int, int);
94#endif
95
96static int RIOScrub(int, BYTE *, int); 90static int RIOScrub(int, BYTE *, int);
97 91
98#if 0
99extern int rio_intr();
100
101/*
102** Init time code.
103*/
104void
105rioinit( p, info )
106struct rio_info * p;
107struct RioHostInfo * info;
108{
109 /*
110 ** Multi-Host card support - taking the easy way out - sorry !
111 ** We allocate and set up the Host and Port structs when the
112 ** driver is called to 'install' the first host.
113 ** We check for this first 'call' by testing the RIOPortp pointer.
114 */
115 if ( !p->RIOPortp )
116 {
117 rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n");
118
119 RIOAllocDataStructs(p); /* allocate host/port structs */
120 RIOSetupDataStructs(p); /* setup topology structs */
121 }
122
123 RIOInitHosts( p, info ); /* hunt down the hardware */
124
125 RIOAllocateInterrupts(p); /* allocate interrupts */
126 RIOReport(p); /* show what we found */
127}
128
129/*
130** Initialise the Cards
131*/
132void
133RIOInitHosts(p, info)
134struct rio_info * p;
135struct RioHostInfo * info;
136{
137/*
138** 15.10.1998 ARG - ESIL 0762 part fix
139** If there is no ISA card definition - we always look for PCI cards.
140** As we currently only support one host card this lets an ISA card
141** definition take precedence over PLUG and PLAY.
142** No ISA card - we are PLUG and PLAY with PCI.
143*/
144
145 /*
146 ** Note - for PCI both these will be zero, that's okay because
147 ** RIOPCIInit() fills them in if a card is found.
148 */
149 p->RIOHosts[p->RIONumHosts].Ivec = info->vector;
150 p->RIOHosts[p->RIONumHosts].PaddrP = info->location;
151
152 /*
153 ** Check that we are able to accommodate another host
154 */
155 if ( p->RIONumHosts >= RIO_HOSTS )
156 {
157 p->RIOFailed++;
158 return;
159 }
160
161 if ( info->bus & ISA_BUS )
162 {
163 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts);
164 RIOISAinit(p, p->mode);
165 }
166 else
167 {
168 rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts);
169 RIOPCIinit(p, RIO_PCI_DEFAULT_MODE);
170 }
171
172 rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts);
173
174
175#ifdef FUTURE_RELEASE
176 if (p->bus & EISA_BUS)
177 /* EISA card */
178 RIOEISAinit(p, RIO_EISA_DEFAULT_MODE);
179
180 if (p->bus & MCA_BUS)
181 /* MCA card */
182 RIOMCAinit(p, RIO_MCA_DEFAULT_MODE);
183#endif
184}
185
186/*
187** go through memory for an AT host that we pass in the device info
188** structure and initialise
189*/
190void
191RIOISAinit(p, mode)
192struct rio_info * p;
193int mode;
194{
195
196 /* XXX Need to implement this. */
197#if 0
198 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
199 (int (*)())rio_intr, (char*)p->RIONumHosts);
200
201 rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid );
202
203 if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) {
204 return;
205 }
206 else {
207 rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n");
208 p->RIOFailed++;
209 }
210#endif
211
212}
213
214/*
215** RIODoAT :
216**
217** Map in a boards physical address, check that the board is there,
218** test the board and if everything is okay assign the board an entry
219** in the Rio Hosts structure.
220*/
221int
222RIODoAT(p, Base, mode)
223struct rio_info * p;
224int Base;
225int mode;
226{
227#define FOUND 1
228#define NOT_FOUND 0
229
230 caddr_t cardAddr;
231
232 /*
233 ** Check to see if we actually have a board at this physical address.
234 */
235 if ((cardAddr = RIOCheckForATCard(Base)) != 0) {
236 /*
237 ** Now test the board to see if it is working.
238 */
239 if (RIOBoardTest(Base, cardAddr, RIO_AT, 0) == RIO_SUCCESS) {
240 /*
241 ** Fill out a slot in the Rio host structure.
242 */
243 if (RIOAssignAT(p, Base, cardAddr, mode)) {
244 return(FOUND);
245 }
246 }
247 RIOMapout(Base, RIO_AT_MEM_SIZE, cardAddr);
248 }
249 return(NOT_FOUND);
250}
251
252caddr_t
253RIOCheckForATCard(Base)
254int Base;
255{
256 int off;
257 struct DpRam *cardp; /* (Points at the host) */
258 caddr_t virtAddr;
259 unsigned char RIOSigTab[24];
260/*
261** Table of values to search for as prom signature of a host card
262*/
263 strcpy(RIOSigTab, "JBJGPGGHINSMJPJR");
264
265 /*
266 ** Hey! Yes, You reading this code! Yo, grab a load a this:
267 **
268 ** IF the card is using WORD MODE rather than BYTE MODE
269 ** then it will occupy 128K of PHYSICAL memory area. So,
270 ** you might think that the following Mapin is wrong. Well,
271 ** it isn't, because the SECOND 64K of occupied space is an
272 ** EXACT COPY of the FIRST 64K. (good?), so, we need only
273 ** map it in in one 64K block.
274 */
275 if (RIOMapin(Base, RIO_AT_MEM_SIZE, &virtAddr) == -1) {
276 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't map the board in!\n");
277 return((caddr_t)0);
278 }
279
280 /*
281 ** virtAddr points to the DP ram of the system.
282 ** We now cast this to a pointer to a RIO Host,
283 ** and have a rummage about in the PROM.
284 */
285 cardp = (struct DpRam *)virtAddr;
286
287 for (off=0; RIOSigTab[off]; off++) {
288 if ((RBYTE(cardp->DpSignature[off]) & 0xFF) != RIOSigTab[off]) {
289 /*
290 ** Signature mismatch - card not at this address
291 */
292 RIOMapout(Base, RIO_AT_MEM_SIZE, virtAddr);
293 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't match the signature 0x%x 0x%x!\n",
294 (int)cardp, off);
295 return((caddr_t)0);
296 }
297 }
298
299 /*
300 ** If we get here then we must have found a valid board so return
301 ** its virtual address.
302 */
303 return(virtAddr);
304}
305#endif
306 92
307/** 93/**
308** RIOAssignAT : 94** RIOAssignAT :
@@ -367,667 +153,6 @@ int mode;
367 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); 153 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base);
368 return(1); 154 return(1);
369} 155}
370#if 0
371#ifdef FUTURE_RELEASE
372int RIOMCAinit(int Mode)
373{
374 uchar SlotNumber;
375 caddr_t Caddr;
376 uint Paddr;
377 uint Ivec;
378 int Handle;
379 int ret = 0;
380
381 /*
382 ** Valid mode information for MCA cards
383 ** is only FAST LINKS
384 */
385 Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks;
386 rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode);
387
388
389 /*
390 ** Check out each of the slots
391 */
392 for (SlotNumber = 0; SlotNumber < McaMaxSlots; SlotNumber++) {
393 /*
394 ** Enable the slot we want to talk to
395 */
396 outb( McaSlotSelect, SlotNumber | McaSlotEnable );
397
398 /*
399 ** Read the ID word from the slot
400 */
401 if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId)
402 {
403 rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber);
404
405 /*
406 ** Card appears to be a RIO MCA card!
407 */
408 RIOMachineType |= (1<<RIO_MCA);
409
410 /*
411 ** Just check we haven't found too many wonderful objects
412 */
413 if ( RIONumHosts >= RIO_HOSTS )
414 {
415 Rprintf(RIOMesgTooManyCards);
416 return(ret);
417 }
418
419 /*
420 ** McaIrqEnable contains the interrupt vector, and a card
421 ** enable bit.
422 */
423 Ivec = inb(McaIrqEnable);
424
425 rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec);
426
427 switch ( Ivec & McaIrqMask )
428 {
429 case McaIrq9:
430 rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n");
431 break;
432 case McaIrq3:
433 rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n");
434 break;
435 case McaIrq4:
436 rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n");
437 break;
438 case McaIrq7:
439 rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n");
440 break;
441 case McaIrq10:
442 rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n");
443 break;
444 case McaIrq11:
445 rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n");
446 break;
447 case McaIrq12:
448 rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n");
449 break;
450 case McaIrq15:
451 rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n");
452 break;
453 }
454
455 /*
456 ** If the card enable bit isn't set, then set it!
457 */
458 if ((Ivec & McaCardEnable) != McaCardEnable) {
459 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n");
460 outb(McaIrqEnable,Ivec|McaCardEnable);
461 } else
462 rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n");
463
464 /*
465 ** Convert the IRQ enable mask into something useful
466 */
467 Ivec = RIOMcaToIvec[Ivec & McaIrqMask];
468
469 /*
470 ** Find the physical address
471 */
472 rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory));
473 Paddr = McaAddress(inb(McaMemory));
474
475 rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr);
476
477 if ( Paddr != 0 )
478 {
479
480 /*
481 ** Tell the memory mapper that we want to talk to it
482 */
483 Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr );
484
485 if ( Handle == -1 ) {
486 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr;
487 continue;
488 }
489
490 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
491
492 /*
493 ** And check that it is actually there!
494 */
495 if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS )
496 {
497 rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
498 rio_dprintk (RIO_DEBUG_INIT, "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
499 SlotNumber, RIO_MCA, Paddr, Caddr, Mode);
500
501 /*
502 ** Board has passed its scrub test. Fill in all the
503 ** transient stuff.
504 */
505 p->RIOHosts[RIONumHosts].Slot = SlotNumber;
506 p->RIOHosts[RIONumHosts].Ivec = Ivec;
507 p->RIOHosts[RIONumHosts].Type = RIO_MCA;
508 p->RIOHosts[RIONumHosts].Copy = bcopy;
509 p->RIOHosts[RIONumHosts].PaddrP = Paddr;
510 p->RIOHosts[RIONumHosts].Caddr = Caddr;
511 p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr;
512 p->RIOHosts[RIONumHosts].Mode = Mode;
513 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt , 0xff);
514 p->RIOHosts[RIONumHosts].UniqueNum =
515 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)|
516 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)|
517 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)|
518 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24);
519 RIONumHosts++;
520 ret++;
521 }
522 else
523 {
524 /*
525 ** It failed the test, so ignore it.
526 */
527 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
528 RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr );
529 }
530 }
531 else
532 {
533 rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber);
534 }
535 }
536 else
537 {
538 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
539 }
540 }
541 /*
542 ** Now we have checked all the slots, turn off the MCA slot selector
543 */
544 outb(McaSlotSelect,0);
545 rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber);
546 return ret;
547}
548
549int RIOEISAinit( int Mode )
550{
551 static int EISADone = 0;
552 uint Paddr;
553 int PollIntMixMsgDone = 0;
554 caddr_t Caddr;
555 ushort Ident;
556 uchar EisaSlot;
557 uchar Ivec;
558 int ret = 0;
559
560 /*
561 ** The only valid mode information for EISA hosts is fast or slow
562 ** links.
563 */
564 Mode = (Mode & FAST_LINKS) ? EISA_TP_FAST_LINKS : EISA_TP_SLOW_LINKS;
565
566 if ( EISADone )
567 {
568 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n");
569 return(0);
570 }
571
572 EISADone++;
573
574 rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n");
575
576
577 /*
578 ** First check all cards to see if ANY are set for polled mode operation.
579 ** If so, set ALL to polled.
580 */
581
582 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
583 {
584 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
585 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
586
587 if ( Ident == RIO_EISA_IDENT )
588 {
589 rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n");
590
591 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
592 {
593 rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n",
594 INBZ(EisaSlot, EISA_PRODUCT_NUMBER));
595 continue; /* next slot */
596 }
597 /*
598 ** Its a Specialix RIO!
599 */
600 rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n",
601 INBZ(EisaSlot, EISA_REVISION_NUMBER));
602
603 RIOMachineType |= (1<<RIO_EISA);
604
605 /*
606 ** Just check we haven't found too many wonderful objects
607 */
608 if ( RIONumHosts >= RIO_HOSTS )
609 {
610 Rprintf(RIOMesgTooManyCards);
611 return 0;
612 }
613
614 /*
615 ** Ensure that the enable bit is set!
616 */
617 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
618
619 /*
620 ** EISA_INTERRUPT_VEC contains the interrupt vector.
621 */
622 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
623
624#ifdef RIODEBUG
625 switch ( Ivec & EISA_INTERRUPT_MASK )
626 {
627 case EISA_IRQ_3:
628 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n");
629 break;
630 case EISA_IRQ_4:
631 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n");
632 break;
633 case EISA_IRQ_5:
634 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n");
635 break;
636 case EISA_IRQ_6:
637 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n");
638 break;
639 case EISA_IRQ_7:
640 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n");
641 break;
642 case EISA_IRQ_9:
643 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n");
644 break;
645 case EISA_IRQ_10:
646 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n");
647 break;
648 case EISA_IRQ_11:
649 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n");
650 break;
651 case EISA_IRQ_12:
652 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n");
653 break;
654 case EISA_IRQ_14:
655 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n");
656 break;
657 case EISA_IRQ_15:
658 rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n");
659 break;
660 case EISA_POLLED:
661 rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n");
662 break;
663 default:
664 rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n");
665 Ivec &= EISA_CONTROL_MASK;
666 }
667#endif
668
669 if ( (Ivec & EISA_INTERRUPT_MASK) ==
670 EISA_POLLED )
671 {
672 RIOWillPoll = 1;
673 break; /* From EisaSlot loop */
674 }
675 }
676 }
677
678 /*
679 ** Do it all again now we know whether to change all cards to polled
680 ** mode or not
681 */
682
683 for ( EisaSlot=1; EisaSlot<=RIO_MAX_EISA_SLOTS; EisaSlot++ )
684 {
685 Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) |
686 INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO);
687
688 if ( Ident == RIO_EISA_IDENT )
689 {
690 if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE )
691 continue; /* next slot */
692
693 /*
694 ** Its a Specialix RIO!
695 */
696
697 /*
698 ** Ensure that the enable bit is set!
699 */
700 OUTBZ( EisaSlot, EISA_ENABLE, RIO_EISA_ENABLE_BIT );
701
702 /*
703 ** EISA_INTERRUPT_VEC contains the interrupt vector.
704 */
705 Ivec = INBZ(EisaSlot,EISA_INTERRUPT_VEC);
706
707 if ( RIOWillPoll )
708 {
709 /*
710 ** If we are going to operate in polled mode, but this
711 ** board is configured to be interrupt driven, display
712 ** the message explaining the situation to the punter,
713 ** assuming we haven't already done so.
714 */
715
716 if ( !PollIntMixMsgDone &&
717 (Ivec & EISA_INTERRUPT_MASK) != EISA_POLLED )
718 {
719 Rprintf(RIOMesgAllPolled);
720 PollIntMixMsgDone = 1;
721 }
722
723 /*
724 ** Ungraciously ignore whatever the board reports as its
725 ** interrupt vector...
726 */
727
728 Ivec &= ~EISA_INTERRUPT_MASK;
729
730 /*
731 ** ...and force it to dance to the poll tune.
732 */
733
734 Ivec |= EISA_POLLED;
735 }
736
737 /*
738 ** Convert the IRQ enable mask into something useful (0-15)
739 */
740 Ivec = RIOEisaToIvec(Ivec);
741
742 rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n",
743 EisaSlot, Ivec);
744
745 /*
746 ** Find the physical address
747 */
748 Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) |
749 (INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16);
750
751 rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr);
752
753 if ( Paddr == 0 )
754 {
755 rio_dprintk (RIO_DEBUG_INIT,
756 "Board in slot %d configured for address zero!\n", EisaSlot);
757 continue;
758 }
759
760 /*
761 ** Tell the memory mapper that we want to talk to it
762 */
763 rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n");
764
765 if (RIOMapin( Paddr, RIO_EISA_MEM_SIZE, &Caddr) == -1) {
766 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n",
767 RIO_EISA_MEM_SIZE,Paddr);
768 continue;
769 }
770
771 rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr);
772
773 /*
774 ** And check that it is actually there!
775 */
776 if ( RIOBoardTest( Paddr,Caddr,RIO_EISA,EisaSlot) == RIO_SUCCESS )
777 {
778 rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
779 rio_dprintk (RIO_DEBUG_INIT,
780 "Slot %d. Ivec %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
781 EisaSlot,Ivec,RIO_EISA,Paddr,Caddr,Mode);
782
783 /*
784 ** Board has passed its scrub test. Fill in all the
785 ** transient stuff.
786 */
787 p->RIOHosts[RIONumHosts].Slot = EisaSlot;
788 p->RIOHosts[RIONumHosts].Ivec = Ivec;
789 p->RIOHosts[RIONumHosts].Type = RIO_EISA;
790 p->RIOHosts[RIONumHosts].Copy = bcopy;
791 p->RIOHosts[RIONumHosts].PaddrP = Paddr;
792 p->RIOHosts[RIONumHosts].Caddr = Caddr;
793 p->RIOHosts[RIONumHosts].CardP = (struct DpRam *)Caddr;
794 p->RIOHosts[RIONumHosts].Mode = Mode;
795 /*
796 ** because the EISA prom is mapped into IO space, we
797 ** need to copy the unqiue number into the memory area
798 ** that it would have occupied, so that the download
799 ** code can determine its ID and card type.
800 */
801 WBYTE(p->RIOHosts[RIONumHosts].Unique[0],INBZ(EisaSlot,EISA_UNIQUE_NUM_0));
802 WBYTE(p->RIOHosts[RIONumHosts].Unique[1],INBZ(EisaSlot,EISA_UNIQUE_NUM_1));
803 WBYTE(p->RIOHosts[RIONumHosts].Unique[2],INBZ(EisaSlot,EISA_UNIQUE_NUM_2));
804 WBYTE(p->RIOHosts[RIONumHosts].Unique[3],INBZ(EisaSlot,EISA_UNIQUE_NUM_3));
805 p->RIOHosts[RIONumHosts].UniqueNum =
806 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[0])&0xFF)<<0)|
807 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[1])&0xFF)<<8)|
808 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[2])&0xFF)<<16)|
809 ((RBYTE(p->RIOHosts[RIONumHosts].Unique[3])&0xFF)<<24);
810 INBZ(EisaSlot,EISA_INTERRUPT_RESET);
811 RIONumHosts++;
812 ret++;
813 }
814 else
815 {
816 /*
817 ** It failed the test, so ignore it.
818 */
819 rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n");
820
821 RIOMapout(Paddr, RIO_EISA_MEM_SIZE, Caddr );
822 }
823 }
824 }
825 if (RIOMachineType & RIO_EISA)
826 return ret+1;
827 return ret;
828}
829#endif
830
831
832#ifndef linux
833
834#define CONFIG_ADDRESS 0xcf8
835#define CONFIG_DATA 0xcfc
836#define FORWARD_REG 0xcfa
837
838
839static int
840read_config(int bus_number, int device_num, int r_number)
841{
842 unsigned int cav;
843 unsigned int val;
844
845/*
846 Build config_address_value:
847
848 31 24 23 16 15 11 10 8 7 0
849 ------------------------------------------------------
850 |1| 0000000 | bus_number | device # | 000 | register |
851 ------------------------------------------------------
852*/
853
854 cav = r_number & 0xff;
855 cav |= ((device_num & 0x1f) << 11);
856 cav |= ((bus_number & 0xff) << 16);
857 cav |= 0x80000000; /* Enable bit */
858 outpd(CONFIG_ADDRESS,cav);
859 val = inpd(CONFIG_DATA);
860 outpd(CONFIG_ADDRESS,0);
861 return val;
862}
863
864static
865write_config(bus_number,device_num,r_number,val)
866{
867 unsigned int cav;
868
869/*
870 Build config_address_value:
871
872 31 24 23 16 15 11 10 8 7 0
873 ------------------------------------------------------
874 |1| 0000000 | bus_number | device # | 000 | register |
875 ------------------------------------------------------
876*/
877
878 cav = r_number & 0xff;
879 cav |= ((device_num & 0x1f) << 11);
880 cav |= ((bus_number & 0xff) << 16);
881 cav |= 0x80000000; /* Enable bit */
882 outpd(CONFIG_ADDRESS, cav);
883 outpd(CONFIG_DATA, val);
884 outpd(CONFIG_ADDRESS, 0);
885 return val;
886}
887#else
888/* XXX Implement these... */
889static int
890read_config(int bus_number, int device_num, int r_number)
891{
892 return 0;
893}
894
895static int
896write_config(int bus_number, int device_num, int r_number)
897{
898 return 0;
899}
900
901#endif
902
903int
904RIOPCIinit(p, Mode)
905struct rio_info *p;
906int Mode;
907{
908 #define MAX_PCI_SLOT 32
909 #define RIO_PCI_JET_CARD 0x200011CB
910
911 static int slot; /* count of machine's PCI slots searched so far */
912 caddr_t Caddr; /* Virtual address of the current PCI host card. */
913 unsigned char Ivec; /* interrupt vector for the current PCI host */
914 unsigned long Paddr; /* Physical address for the current PCI host */
915 int Handle; /* Handle to Virtual memory allocated for current PCI host */
916
917
918 rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot);
919
920 /*
921 ** Initialise the search status
922 */
923 p->RIOLastPCISearch = RIO_FAIL;
924
925 while ( (slot < MAX_PCI_SLOT) & (p->RIOLastPCISearch != RIO_SUCCESS) )
926 {
927 rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot);
928
929 if (read_config(0,slot,0) == RIO_PCI_JET_CARD) {
930 p->RIOHosts[p->RIONumHosts].Ivec = 0;
931 Paddr = read_config(0,slot,0x18);
932 Paddr = Paddr - (Paddr & 0x1); /* Mask off the io bit */
933
934 if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) {
935 rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */
936 slot++;
937 continue;
938 }
939
940 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
941 Ivec = (read_config(0,slot,0x3c) & 0xff);
942
943 rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec);
944
945 Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr );
946 if (Handle == -1) {
947 rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr);
948 slot++;
949 continue;
950 }
951 p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32;
952 p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec,
953 (int (*)())rio_intr, (char *)p->RIONumHosts);
954 if (RIOBoardTest( Paddr, Caddr, RIO_PCI, 0 ) == RIO_SUCCESS) {
955 rio_dprintk (RIO_DEBUG_INIT, ("Board has passed test\n");
956 rio_dprintk (RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, Mode);
957
958 /*
959 ** Board has passed its scrub test. Fill in all the
960 ** transient stuff.
961 */
962 p->RIOHosts[p->RIONumHosts].Slot = 0;
963 p->RIOHosts[p->RIONumHosts].Ivec = Ivec + 32;
964 p->RIOHosts[p->RIONumHosts].Type = RIO_PCI;
965 p->RIOHosts[p->RIONumHosts].Copy = rio_pcicopy;
966 p->RIOHosts[p->RIONumHosts].PaddrP = Paddr;
967 p->RIOHosts[p->RIONumHosts].Caddr = Caddr;
968 p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)Caddr;
969 p->RIOHosts[p->RIONumHosts].Mode = Mode;
970
971#if 0
972 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
973 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
974 p->RIOHosts[p->RIONumHosts].Mode |
975 INTERRUPT_DISABLE );
976 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
977 WBYTE(p->RIOHosts[p->RIONumHosts].Control,
978 BOOT_FROM_RAM | EXTERNAL_BUS_OFF |
979 p->RIOHosts[p->RIONumHosts].Mode |
980 INTERRUPT_DISABLE );
981 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff);
982#else
983 WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
984#endif
985 p->RIOHosts[p->RIONumHosts].UniqueNum =
986 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)|
987 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)|
988 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)|
989 ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24);
990
991 rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n",
992 p->RIOHosts[p->RIONumHosts].UniqueNum);
993
994 p->RIOLastPCISearch = RIO_SUCCESS;
995 p->RIONumHosts++;
996 }
997 }
998 slot++;
999 }
1000
1001 if ( slot >= MAX_PCI_SLOT ) {
1002 rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n",
1003 MAX_PCI_SLOT);
1004 }
1005
1006
1007 /*
1008 ** I don't think we want to do this anymore
1009 **
1010
1011 if (!p->RIOLastPCISearch == RIO_FAIL ) {
1012 p->RIOFailed++;
1013 }
1014
1015 **
1016 */
1017}
1018
1019#ifdef FUTURE_RELEASE
1020void riohalt( void )
1021{
1022 int host;
1023 for ( host=0; host<p->RIONumHosts; host++ )
1024 {
1025 rio_dprintk (RIO_DEBUG_INIT, "Stop host %d\n", host);
1026 (void)RIOBoardTest( p->RIOHosts[host].PaddrP, p->RIOHosts[host].Caddr, p->RIOHosts[host].Type,p->RIOHosts[host].Slot );
1027 }
1028}
1029#endif
1030#endif
1031 156
1032static uchar val[] = { 157static uchar val[] = {
1033#ifdef VERY_LONG_TEST 158#ifdef VERY_LONG_TEST
@@ -1262,200 +387,6 @@ int size;
1262 return RIO_SUCCESS; 387 return RIO_SUCCESS;
1263} 388}
1264 389
1265/*
1266** try to ensure that every host is either in polled mode
1267** or is in interrupt mode. Only allow interrupt mode if
1268** all hosts can interrupt (why?)
1269** and force into polled mode if told to. Patch up the
1270** interrupt vector & salute The Queen when you've done.
1271*/
1272#if 0
1273static void
1274RIOAllocateInterrupts(p)
1275struct rio_info * p;
1276{
1277 int Host;
1278
1279 /*
1280 ** Easy case - if we have been told to poll, then we poll.
1281 */
1282 if (p->mode & POLLED_MODE) {
1283 RIOStopInterrupts(p, 0, 0);
1284 return;
1285 }
1286
1287 /*
1288 ** check - if any host has been set to polled mode, then all must be.
1289 */
1290 for (Host=0; Host<p->RIONumHosts; Host++) {
1291 if ( (p->RIOHosts[Host].Type != RIO_AT) &&
1292 (p->RIOHosts[Host].Ivec == POLLED) ) {
1293 RIOStopInterrupts(p, 1, Host );
1294 return;
1295 }
1296 }
1297 for (Host=0; Host<p->RIONumHosts; Host++) {
1298 if (p->RIOHosts[Host].Type == RIO_AT) {
1299 if ( (p->RIOHosts[Host].Ivec - 32) == 0) {
1300 RIOStopInterrupts(p, 2, Host );
1301 return;
1302 }
1303 }
1304 }
1305}
1306
1307/*
1308** something has decided that we can't be doing with these
1309** new-fangled interrupt thingies. Set everything up to just
1310** poll.
1311*/
1312static void
1313RIOStopInterrupts(p, Reason, Host)
1314struct rio_info * p;
1315int Reason;
1316int Host;
1317{
1318#ifdef FUTURE_RELEASE
1319 switch (Reason) {
1320 case 0: /* forced into polling by rio_polled */
1321 break;
1322 case 1: /* SCU has set 'Host' into polled mode */
1323 break;
1324 case 2: /* there aren't enough interrupt vectors for 'Host' */
1325 break;
1326 }
1327#endif
1328
1329 for (Host=0; Host<p->RIONumHosts; Host++ ) {
1330 struct Host *HostP = &p->RIOHosts[Host];
1331
1332 switch (HostP->Type) {
1333 case RIO_AT:
1334 /*
1335 ** The AT host has it's interrupts disabled by clearing the
1336 ** int_enable bit.
1337 */
1338 HostP->Mode &= ~INTERRUPT_ENABLE;
1339 HostP->Ivec = POLLED;
1340 break;
1341#ifdef FUTURE_RELEASE
1342 case RIO_EISA:
1343 /*
1344 ** The EISA host has it's interrupts disabled by setting the
1345 ** Ivec to zero
1346 */
1347 HostP->Ivec = POLLED;
1348 break;
1349#endif
1350 case RIO_PCI:
1351 /*
1352 ** The PCI host has it's interrupts disabled by clearing the
1353 ** int_enable bit, like a regular host card.
1354 */
1355 HostP->Mode &= ~RIO_PCI_INT_ENABLE;
1356 HostP->Ivec = POLLED;
1357 break;
1358#ifdef FUTURE_RELEASE
1359 case RIO_MCA:
1360 /*
1361 ** There's always one, isn't there?
1362 ** The MCA host card cannot have it's interrupts disabled.
1363 */
1364 RIOPatchVec(HostP);
1365 break;
1366#endif
1367 }
1368 }
1369}
1370
1371/*
1372** This function is called at init time to setup the data structures.
1373*/
1374void
1375RIOAllocDataStructs(p)
1376struct rio_info * p;
1377{
1378 int port,
1379 host,
1380 tm;
1381
1382 p->RIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port));
1383 if (!p->RIOPortp) {
1384 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n");
1385 p->RIOFailed++;
1386 return;
1387 }
1388 bzero( p->RIOPortp, sizeof(struct Port) * RIO_PORTS );
1389 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for port structs\n");
1390 rio_dprintk (RIO_DEBUG_INIT, "First RIO port struct @0x%x, size=0x%x bytes\n",
1391 (int)p->RIOPortp, sizeof(struct Port));
1392
1393 for( port=0; port<RIO_PORTS; port++ ) {
1394 p->RIOPortp[port].PortNum = port;
1395 p->RIOPortp[port].TtyP = &p->channel[port];
1396 sreset (p->RIOPortp[port].InUse); /* Let the first guy uses it */
1397 p->RIOPortp[port].portSem = -1; /* Let the first guy takes it */
1398 p->RIOPortp[port].ParamSem = -1; /* Let the first guy takes it */
1399 p->RIOPortp[port].timeout_id = 0; /* Let the first guy takes it */
1400 }
1401
1402 p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host));
1403 if (!p->RIOHosts) {
1404 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n");
1405 p->RIOFailed++;
1406 return;
1407 }
1408 bzero(p->RIOHosts, sizeof(struct Host)*RIO_HOSTS);
1409 rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for host structs\n");
1410 rio_dprintk (RIO_DEBUG_INIT, "First RIO host struct @0x%x, size=0x%x bytes\n",
1411 (int)p->RIOHosts, sizeof(struct Host));
1412
1413 for( host=0; host<RIO_HOSTS; host++ ) {
1414 spin_lock_init (&p->RIOHosts[host].HostLock);
1415 p->RIOHosts[host].timeout_id = 0; /* Let the first guy takes it */
1416 }
1417 /*
1418 ** check that the buffer size is valid, round down to the next power of
1419 ** two if necessary; if the result is zero, then, hey, no double buffers.
1420 */
1421 for ( tm = 1; tm && tm <= p->RIOConf.BufferSize; tm <<= 1 )
1422 ;
1423 tm >>= 1;
1424 p->RIOBufferSize = tm;
1425 p->RIOBufferMask = tm ? tm - 1 : 0;
1426}
1427
1428/*
1429** this function gets called whenever the data structures need to be
1430** re-setup, for example, after a riohalt (why did I ever invent it?)
1431*/
1432void
1433RIOSetupDataStructs(p)
1434struct rio_info * p;
1435{
1436 int host, entry, rup;
1437
1438 for ( host=0; host<RIO_HOSTS; host++ ) {
1439 struct Host *HostP = &p->RIOHosts[host];
1440 for ( entry=0; entry<LINKS_PER_UNIT; entry++ ) {
1441 HostP->Topology[entry].Unit = ROUTE_DISCONNECT;
1442 HostP->Topology[entry].Link = NO_LINK;
1443 }
1444 bcopy("HOST X", HostP->Name, 7);
1445 HostP->Name[5] = '1'+host;
1446 for (rup=0; rup<(MAX_RUP + LINKS_PER_UNIT); rup++) {
1447 if (rup < MAX_RUP) {
1448 for (entry=0; entry<LINKS_PER_UNIT; entry++ ) {
1449 HostP->Mapping[rup].Topology[entry].Unit = ROUTE_DISCONNECT;
1450 HostP->Mapping[rup].Topology[entry].Link = NO_LINK;
1451 }
1452 RIODefaultName(p, HostP, rup);
1453 }
1454 spin_lock_init(&HostP->UnixRups[rup].RupLock);
1455 }
1456 }
1457}
1458#endif
1459 390
1460int 391int
1461RIODefaultName(p, HostP, UnitId) 392RIODefaultName(p, HostP, UnitId)
@@ -1463,10 +394,6 @@ struct rio_info * p;
1463struct Host * HostP; 394struct Host * HostP;
1464uint UnitId; 395uint UnitId;
1465{ 396{
1466#ifdef CHECK
1467 CheckHost( Host );
1468 CheckUnitId( UnitId );
1469#endif
1470 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); 397 bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17);
1471 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); 398 HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts);
1472 if ((UnitId+1) > 9) { 399 if ((UnitId+1) > 9) {
@@ -1483,33 +410,6 @@ uint UnitId;
1483#define RIO_RELEASE "Linux" 410#define RIO_RELEASE "Linux"
1484#define RELEASE_ID "1.0" 411#define RELEASE_ID "1.0"
1485 412
1486#if 0
1487static int
1488RIOReport(p)
1489struct rio_info * p;
1490{
1491 char * RIORelease = RIO_RELEASE;
1492 char * RIORelID = RELEASE_ID;
1493 int host;
1494
1495 rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID);
1496
1497 if ( p->RIONumHosts==0 ) {
1498 rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n");
1499 return(0);
1500 }
1501
1502 for ( host=0; host < p->RIONumHosts; host++ ) {
1503 struct Host *HostP = &p->RIOHosts[host];
1504 switch ( HostP->Type ) {
1505 case RIO_AT:
1506 rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP);
1507 }
1508 }
1509 return 0;
1510}
1511#endif
1512
1513static struct rioVersion stVersion; 413static struct rioVersion stVersion;
1514 414
1515struct rioVersion * 415struct rioVersion *
@@ -1523,27 +423,6 @@ RIOVersid(void)
1523 return &stVersion; 423 return &stVersion;
1524} 424}
1525 425
1526#if 0
1527int
1528RIOMapin(paddr, size, vaddr)
1529paddr_t paddr;
1530int size;
1531caddr_t * vaddr;
1532{
1533 *vaddr = (caddr_t)permap( (long)paddr, size);
1534 return ((int)*vaddr);
1535}
1536
1537void
1538RIOMapout(paddr, size, vaddr)
1539paddr_t paddr;
1540long size;
1541caddr_t vaddr;
1542{
1543}
1544#endif
1545
1546
1547void 426void
1548RIOHostReset(Type, DpRamP, Slot) 427RIOHostReset(Type, DpRamP, Slot)
1549uint Type; 428uint Type;
@@ -1570,31 +449,6 @@ uint Slot;
1570 WBYTE(DpRamP->DpResetTpu, 0xFF); 449 WBYTE(DpRamP->DpResetTpu, 0xFF);
1571 udelay(3); 450 udelay(3);
1572 break; 451 break;
1573#ifdef FUTURE_RELEASE
1574 case RIO_EISA:
1575 /*
1576 ** Bet this doesn't work!
1577 */
1578 OUTBZ( Slot, EISA_CONTROL_PORT,
1579 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1580 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1581 OUTBZ( Slot, EISA_CONTROL_PORT,
1582 EISA_TP_RESET | EISA_TP_BUS_DISABLE |
1583 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1584 suspend( 3 );
1585 OUTBZ( Slot, EISA_CONTROL_PORT,
1586 EISA_TP_RUN | EISA_TP_BUS_DISABLE |
1587 EISA_TP_SLOW_LINKS | EISA_TP_BOOT_FROM_RAM );
1588 break;
1589 case RIO_MCA:
1590 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1591 WBYTE(DpRamP->DpResetTpu , 0xFF );
1592 suspend( 3 );
1593 WBYTE(DpRamP->DpControl , McaTpBootFromRam | McaTpBusDisable );
1594 WBYTE(DpRamP->DpResetTpu , 0xFF );
1595 suspend( 3 );
1596 break;
1597#endif
1598 case RIO_PCI: 452 case RIO_PCI:
1599 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); 453 rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n");
1600 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; 454 DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM;
@@ -1604,12 +458,6 @@ uint Slot;
1604 /* for (i=0; i<6000; i++); */ 458 /* for (i=0; i<6000; i++); */
1605 /* suspend( 3 ); */ 459 /* suspend( 3 ); */
1606 break; 460 break;
1607#ifdef FUTURE_RELEASE
1608 default:
1609 Rprintf(RIOMesgNoSupport,Type,DpRamP,Slot);
1610 return;
1611#endif
1612
1613 default: 461 default:
1614 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); 462 rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");
1615 break; 463 break;
diff --git a/drivers/char/rio/riolocks.h b/drivers/char/rio/riolocks.h
deleted file mode 100644
index 0e0cdacebe0b..000000000000
--- a/drivers/char/rio/riolocks.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : riolocks.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:13
26** Retrieved : 11/6/98 11:34:22
27**
28** ident @(#)riolocks.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_riolocks_h__
34#define __rio_riolocks_h__
35
36#ifdef SCCS_LABELS
37static char *_riolocks_h_sccs_ = "@(#)riolocks.h 1.2";
38#endif
39
40#define LOCKB(lk) lockb(lk);
41#define UNLOCKB(lk, oldspl) unlockb(lk, oldspl);
42
43#endif
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
index 4cc7f4942bfc..c622f46d6d77 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/char/rio/rioparam.c
@@ -195,27 +195,6 @@ int SleepFlag;
195 ** paramed with OPEN, we want to restore the saved port termio, but 195 ** paramed with OPEN, we want to restore the saved port termio, but
196 ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. 196 ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot.
197 */ 197 */
198#if 0
199 if (PortP->FirstOpen) {
200 PortP->StoredTty.iflag = TtyP->tm.c_iflag;
201 PortP->StoredTty.oflag = TtyP->tm.c_oflag;
202 PortP->StoredTty.cflag = TtyP->tm.c_cflag;
203 PortP->StoredTty.lflag = TtyP->tm.c_lflag;
204 PortP->StoredTty.line = TtyP->tm.c_line;
205 for (i = 0; i < NCC + 5; i++)
206 PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i];
207 PortP->FirstOpen = 0;
208 } else if (PortP->Store || PortP->Lock) {
209 rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n");
210 TtyP->tm.c_iflag = PortP->StoredTty.iflag;
211 TtyP->tm.c_oflag = PortP->StoredTty.oflag;
212 TtyP->tm.c_cflag = PortP->StoredTty.cflag;
213 TtyP->tm.c_lflag = PortP->StoredTty.lflag;
214 TtyP->tm.c_line = PortP->StoredTty.line;
215 for (i = 0; i < NCC + 5; i++)
216 TtyP->tm.c_cc[i] = PortP->StoredTty.cc[i];
217 }
218#endif
219 } 198 }
220 199
221 /* 200 /*
@@ -273,16 +252,6 @@ int SleepFlag;
273 phb_param_ptr = (struct phb_param *) PacketP->data; 252 phb_param_ptr = (struct phb_param *) PacketP->data;
274 253
275 254
276#if 0
277 /*
278 ** COR 1
279 */
280 if (TtyP->tm.c_iflag & INPCK) {
281 rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n");
282 Cor1 |= COR1_INPCK;
283 }
284#endif
285
286 switch (TtyP->termios->c_cflag & CSIZE) { 255 switch (TtyP->termios->c_cflag & CSIZE) {
287 case CS5: 256 case CS5:
288 { 257 {
@@ -524,10 +493,6 @@ int SleepFlag;
524 if (TtyP->termios->c_cflag & XMT1EN) 493 if (TtyP->termios->c_cflag & XMT1EN)
525 rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n"); 494 rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n");
526#endif 495#endif
527#if 0
528 if (TtyP->termios->c_cflag & LOBLK)
529 rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n");
530#endif
531 if (TtyP->termios->c_lflag & ISIG) 496 if (TtyP->termios->c_lflag & ISIG)
532 rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); 497 rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n");
533 if (TtyP->termios->c_lflag & ICANON) 498 if (TtyP->termios->c_lflag & ICANON)
@@ -572,14 +537,6 @@ int SleepFlag;
572 rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n"); 537 rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n");
573 if (TtyP->termios->c_oflag & TABDLY) 538 if (TtyP->termios->c_oflag & TABDLY)
574 rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n"); 539 rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n");
575#if 0
576 if (TtyP->termios->c_oflag & BSDLY)
577 rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n");
578 if (TtyP->termios->c_oflag & VTDLY)
579 rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n");
580 if (TtyP->termios->c_oflag & FFDLY)
581 rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n");
582#endif
583 /* 540 /*
584 ** These things are kind of useful in a later life! 541 ** These things are kind of useful in a later life!
585 */ 542 */
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index 0f4cd33ba641..f98888f52659 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)
112 int Lies; 112 int Lies;
113 unsigned long flags; 113 unsigned long flags;
114 114
115#ifdef STACK
116 RIOStackCheck("RIORouteRup");
117#endif
118#ifdef CHECK
119 CheckPacketP(PacketP);
120 CheckHostP(HostP);
121 CheckRup(Rup);
122 CheckHost(Host);
123#endif
124 /* 115 /*
125 ** Is this unit telling us it's current link topology? 116 ** Is this unit telling us it's current link topology?
126 */ 117 */
@@ -540,9 +531,6 @@ uint unit;
540 531
541 for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { 532 for (port = 0; port < PORTS_PER_RTA; port++, PortN++) {
542 ushort dest_port = port + 8; 533 ushort dest_port = port + 8;
543#if 0
544 uint PktInt;
545#endif
546 WORD *TxPktP; 534 WORD *TxPktP;
547 PKT *Pkt; 535 PKT *Pkt;
548 536
@@ -623,10 +611,6 @@ uint UnitId;
623 unsigned long flags; 611 unsigned long flags;
624 rio_spin_lock_irqsave(&HostP->HostLock, flags); 612 rio_spin_lock_irqsave(&HostP->HostLock, flags);
625 613
626#ifdef CHECK
627 CheckHostP(HostP);
628 CheckUnitId(UnitId);
629#endif
630 if (RIOCheck(HostP, UnitId)) { 614 if (RIOCheck(HostP, UnitId)) {
631 rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); 615 rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId);
632 rio_spin_unlock_irqrestore(&HostP->HostLock, flags); 616 rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
@@ -651,10 +635,6 @@ uint UnitId;
651{ 635{
652 uint link, unit; 636 uint link, unit;
653 637
654#ifdef CHECK
655 CheckHostP(HostP);
656 CheckUnitId(UnitId);
657#endif
658 UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ 638 UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */
659 639
660 if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */ 640 if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */
@@ -684,10 +664,6 @@ uint UnitId;
684{ 664{
685 unsigned char link; 665 unsigned char link;
686 666
687#ifdef CHECK
688 CheckHostP(HostP);
689 CheckUnitId(UnitId);
690#endif
691/* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ 667/* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */
692 rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); 668 rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId);
693 669
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 42c3dffcbbb2..a86b216ab653 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -754,11 +754,6 @@ struct Map *HostMapP;
754 ushort RtaType; 754 ushort RtaType;
755 unsigned long flags; 755 unsigned long flags;
756 756
757#ifdef CHECK
758 CheckHostP(HostP);
759 CheckHostMapP(HostMapP);
760#endif
761
762 rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); 757 rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID);
763 758
764 /* 759 /*
@@ -784,9 +779,6 @@ struct Map *HostMapP;
784 779
785 rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); 780 rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp);
786 PortP = p->RIOPortp[SysPort]; 781 PortP = p->RIOPortp[SysPort];
787#if 0
788 PortP->TtyP = &p->channel[SysPort];
789#endif
790 rio_dprintk(RIO_DEBUG_TABLE, "Map port\n"); 782 rio_dprintk(RIO_DEBUG_TABLE, "Map port\n");
791 783
792 /* 784 /*
diff --git a/drivers/char/rio/riotime.h b/drivers/char/rio/riotime.h
deleted file mode 100644
index 35e01cd103d0..000000000000
--- a/drivers/char/rio/riotime.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* T I M E
4 ******* *******
5 ****************************************************************************
6
7 Author : Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef _riotime_h
39#define _riotime_h 1
40
41#ifndef lint
42#ifdef SCCS
43static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1";
44#endif
45#endif
46
47#define TWO_POWER_FIFTEEN (ushort)32768
48#define RioTime() riotime
49#define RioTimeAfter(time1,time2) ((ushort)time1 - (ushort)time2) < TWO_POWER_FIFTEEN
50#define RioTimePlus(time1,time2) ((ushort)time1 + (ushort)time2)
51
52/**************************************
53 * Convert a RIO tick (1/10th second)
54 * into transputer low priority ticks
55 *************************************/
56#define RioTimeToLow(time) (time*(100000 / 64))
57#define RioLowToTime(time) ((time*64)/100000)
58
59#define RIOTENTHSECOND (ushort)1
60#define RIOSECOND (ushort)(RIOTENTHSECOND * 10)
61#endif
62
63/*********** end of file ***********/
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index 5894a25b0113..6379816ed173 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";
89#include "list.h" 89#include "list.h"
90#include "sam.h" 90#include "sam.h"
91 91
92#if 0
93static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int);
94#endif
95
96static void RIOClearUp(struct Port *PortP); 92static void RIOClearUp(struct Port *PortP);
97int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); 93int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
98 94
99#if 0
100static int RIOCookMode(struct ttystatics *);
101#endif
102 95
103extern int conv_vb[]; /* now defined in ttymgr.c */ 96extern int conv_vb[]; /* now defined in ttymgr.c */
104extern int conv_bv[]; /* now defined in ttymgr.c */ 97extern int conv_bv[]; /* now defined in ttymgr.c */
@@ -226,33 +219,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
226 ** until the RTA is present then we must spin here waiting for 219 ** until the RTA is present then we must spin here waiting for
227 ** the RTA to boot. 220 ** the RTA to boot.
228 */ 221 */
229#if 0
230 if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
231 if (PortP->WaitUntilBooted) {
232 rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n");
233 do {
234 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
235 rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
236 func_exit();
237 return -EINTR;
238 }
239 if (repeat_this-- <= 0) {
240 rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
241 RIOPreemptiveCmd(p, PortP, FCLOSE);
242 pseterr(EINTR);
243 func_exit();
244 return -EIO;
245 }
246 } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED));
247 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
248 } else {
249 rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
250 pseterr(ENXIO);
251 func_exit();
252 return 0;
253 }
254 }
255#else
256 /* I find the above code a bit hairy. I find the below code 222 /* I find the above code a bit hairy. I find the below code
257 easier to read and shorter. Now, if it works too that would 223 easier to read and shorter. Now, if it works too that would
258 be great... -- REW 224 be great... -- REW
@@ -281,21 +247,10 @@ int riotopen(struct tty_struct *tty, struct file *filp)
281 } 247 }
282 } 248 }
283 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); 249 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
284#endif
285#if 0
286 tp = PortP->TtyP; /* get tty struct */
287#endif
288 rio_spin_lock_irqsave(&PortP->portSem, flags); 250 rio_spin_lock_irqsave(&PortP->portSem, flags);
289 if (p->RIOHalted) { 251 if (p->RIOHalted) {
290 goto bombout; 252 goto bombout;
291 } 253 }
292#if 0
293 retval = gs_init_port(&PortP->gs);
294 if (retval) {
295 func_exit();
296 return retval;
297 }
298#endif
299 254
300 /* 255 /*
301 ** If the port is in the final throws of being closed, 256 ** If the port is in the final throws of being closed,
@@ -363,11 +318,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
363 command piggybacks the parameters immediately. 318 command piggybacks the parameters immediately.
364 -- REW */ 319 -- REW */
365 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ 320 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */
366#if 0
367 /* This delay of 1 second was annoying. I removed it. -- REW */
368 RIODelay(PortP, HUNDRED_MS * 10);
369 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */
370#endif
371 rio_spin_lock_irqsave(&PortP->portSem, flags); 321 rio_spin_lock_irqsave(&PortP->portSem, flags);
372 322
373 /* 323 /*
@@ -439,9 +389,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
439 PortP->State |= RIO_WOPEN; 389 PortP->State |= RIO_WOPEN;
440 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 390 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
441 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) 391 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL)
442#if 0
443 if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH))
444#endif
445 { 392 {
446 /* 393 /*
447 ** ACTION: verify that this is a good thing 394 ** ACTION: verify that this is a good thing
@@ -505,10 +452,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
505*/ 452*/
506int riotclose(void *ptr) 453int riotclose(void *ptr)
507{ 454{
508#if 0
509 register uint SysPort = dev;
510 struct ttystatics *tp; /* pointer to our ttystruct */
511#endif
512 struct Port *PortP = ptr; /* pointer to the port structure */ 455 struct Port *PortP = ptr; /* pointer to the port structure */
513 int deleted = 0; 456 int deleted = 0;
514 int try = -1; /* Disable the timeouts by setting them to -1 */ 457 int try = -1; /* Disable the timeouts by setting them to -1 */
@@ -534,13 +477,6 @@ int riotclose(void *ptr)
534 end_time = jiffies + MAX_SCHEDULE_TIMEOUT; 477 end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
535 478
536 Modem = rio_ismodem(tty); 479 Modem = rio_ismodem(tty);
537#if 0
538 /* What F.CKING cache? Even then, a higly idle multiprocessor,
539 system with large caches this won't work . Better find out when
540 this doesn't work asap, and fix the cause. -- REW */
541
542 RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */
543#endif
544 rio_spin_lock_irqsave(&PortP->portSem, flags); 480 rio_spin_lock_irqsave(&PortP->portSem, flags);
545 481
546 /* 482 /*
@@ -703,45 +639,6 @@ int riotclose(void *ptr)
703} 639}
704 640
705 641
706/*
707** decide if we need to use the line discipline.
708** This routine can return one of three values:
709** COOK_RAW if no processing has to be done by the line discipline or the card
710** COOK_WELL if the line discipline must be used to do the processing
711** COOK_MEDIUM if the card can do all the processing necessary.
712*/
713#if 0
714static int RIOCookMode(struct ttystatics *tp)
715{
716 /*
717 ** We can't handle tm.c_mstate != 0 on SCO
718 ** We can't handle mapping
719 ** We can't handle non-ttwrite line disc.
720 ** We can't handle lflag XCASE
721 ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3)
722 */
723
724#ifdef CHECK
725 CheckTtyP(tp);
726#endif
727 if (!(tp->tm.c_oflag & OPOST)) /* No post processing */
728 return COOK_RAW; /* Raw mode o/p */
729
730 if (tp->tm.c_lflag & XCASE)
731 return COOK_WELL; /* Use line disc */
732
733 if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3))
734 return COOK_WELL; /* Use line disc for strange modes */
735
736 if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */
737 return COOK_RAW;
738
739 /*
740 ** So, we need to output process!
741 */
742 return COOK_MEDIUM;
743}
744#endif
745 642
746static void RIOClearUp(PortP) 643static void RIOClearUp(PortP)
747struct Port *PortP; 644struct Port *PortP;
@@ -776,11 +673,6 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len
776 unsigned long flags; 673 unsigned long flags;
777 674
778 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); 675 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n");
779#ifdef CHECK
780 CheckPortP(PortP);
781 if (len < 1 || len > 2)
782 cprintf(("STUPID LENGTH %d\n", len));
783#endif
784 676
785 if (PortP->State & RIO_DELETED) { 677 if (PortP->State & RIO_DELETED) {
786 rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); 678 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
852} 744}
853 745
854 746
855#if 0
856/*
857** This is an ioctl interface. This is the twentieth century. You know what
858** its all about.
859*/
860int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
861{
862 register struct Port *PortP;
863 register struct ttystatics *tp;
864 int current;
865 int ParamSemIncremented = 0;
866 int old_oflag, old_cflag, old_iflag, changed, oldcook;
867 int i;
868 unsigned char sio_regs[5]; /* Here be magic */
869 short vpix_cflag;
870 short divisor;
871 int baud;
872 uint SysPort = rio_minor(tty);
873 int Modem = rio_ismodem(tty);
874 int ioctl_processed;
875
876 rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty");
877
878 if (SysPort >= RIO_PORTS) {
879 rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
880 return -ENXIO;
881 }
882
883 PortP = p->RIOPortp[SysPort];
884 tp = PortP->TtyP;
885
886 rio_spin_lock_irqsave(&PortP->portSem, flags);
887
888#ifdef STATS
889 PortP->Stat.IoctlCnt++;
890#endif
891
892 if (PortP->State & RIO_DELETED) {
893 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
894 return -EIO;
895 }
896
897
898 if (p->RIOHalted) {
899 RIOClearUp(PortP);
900 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
901 return -EIO;
902 }
903
904 /*
905 ** Count ioctls for port statistics reporting
906 */
907 if (PortP->statsGather)
908 PortP->ioctls++;
909
910 /*
911 ** Specialix RIO Ioctl calls
912 */
913 switch (cmd) {
914
915 case TCRIOTRIAD:
916 if (arg)
917 PortP->State |= RIO_TRIAD_MODE;
918 else
919 PortP->State &= ~RIO_TRIAD_MODE;
920 /*
921 ** Normally, when istrip is set on a port, a config is
922 ** sent to the RTA instructing the CD1400 to do the
923 ** stripping. In TRIAD mode, the interrupt receive routine
924 ** must do the stripping instead, since it has to detect
925 ** an 8 bit function key sequence. If istrip is set with
926 ** TRIAD mode on(off), and 8 bit data is being read by
927 ** the port, the user then turns TRIAD mode off(on), the RTA
928 ** must be reconfigured (not) to do the stripping.
929 ** Hence we call RIOParam here.
930 */
931 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
932 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
933 return 0;
934
935 case TCRIOTSTATE:
936 rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis");
937 /* MonitorTstate = 0 ; */
938 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
939 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
940 return 0;
941
942 case TCRIOSTATE: /* current state of Modem input pins */
943 rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n");
944 if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL)
945 rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
946 PortP->State |= RIO_BUSY;
947 current = PortP->ModemState;
948 if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) {
949 rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n");
950 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
951 pseterr(EFAULT);
952 }
953 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
954 return 0;
955
956 case TCRIOMBIS: /* Set modem lines */
957 case TCRIOMBIC: /* Clear modem lines */
958 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n");
959 if (cmd == TCRIOMBIS) {
960 uint state;
961 state = (uint) arg;
962 PortP->ModemState |= (ushort) state;
963 PortP->ModemLines = (ulong) arg;
964 if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
965 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n");
966 } else {
967 uint state;
968
969 state = (uint) arg;
970 PortP->ModemState &= ~(ushort) state;
971 PortP->ModemLines = (ulong) arg;
972 if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL)
973 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n");
974 }
975 PortP->State |= RIO_BUSY;
976 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
977 return 0;
978
979 case TCRIOXPON: /* set Xprint ON string */
980 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n");
981 if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) {
982 rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
983 PortP->Xprint.XpOn[0] = '\0';
984 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
985 pseterr(EFAULT);
986 }
987 PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
988 PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
989 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
990 return 0;
991
992 case TCRIOXPOFF: /* set Xprint OFF string */
993 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n");
994 if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) {
995 rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
996 PortP->Xprint.XpOff[0] = '\0';
997 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
998 pseterr(EFAULT);
999 }
1000 PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
1001 PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
1002 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1003 return 0;
1004
1005 case TCRIOXPCPS: /* set Xprint CPS string */
1006 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n");
1007 if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) {
1008 rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg);
1009 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1010 pseterr(EINVAL);
1011 return 0;
1012 }
1013 PortP->Xprint.XpCps = (uint) arg;
1014 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1015 return 0;
1016
1017 case TCRIOXPRINT:
1018 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n");
1019 if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) {
1020 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1021 pseterr(EFAULT);
1022 }
1023 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1024 return 0;
1025
1026 case TCRIOIXANYON:
1027 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n");
1028 PortP->Config |= RIO_IXANY;
1029 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1030 return 0;
1031
1032 case TCRIOIXANYOFF:
1033 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n");
1034 PortP->Config &= ~RIO_IXANY;
1035 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1036 return 0;
1037
1038 case TCRIOIXONON:
1039 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n");
1040 PortP->Config |= RIO_IXON;
1041 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1042 return 0;
1043
1044 case TCRIOIXONOFF:
1045 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n");
1046 PortP->Config &= ~RIO_IXON;
1047 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1048 return 0;
1049
1050/*
1051** 15.10.1998 ARG - ESIL 0761 part fix
1052** Added support for CTS and RTS flow control ioctls :
1053*/
1054 case TCRIOCTSFLOWEN:
1055 rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n");
1056 PortP->Config |= RIO_CTSFLOW;
1057 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1058 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1059 return 0;
1060
1061 case TCRIOCTSFLOWDIS:
1062 rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n");
1063 PortP->Config &= ~RIO_CTSFLOW;
1064 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1065 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1066 return 0;
1067
1068 case TCRIORTSFLOWEN:
1069 rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n");
1070 PortP->Config |= RIO_RTSFLOW;
1071 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1072 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1073 return 0;
1074
1075 case TCRIORTSFLOWDIS:
1076 rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n");
1077 PortP->Config &= ~RIO_RTSFLOW;
1078 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1079 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1080 return 0;
1081
1082/* end ESIL 0761 part fix */
1083
1084 }
1085
1086
1087 /* Lynx IOCTLS */
1088 switch (cmd) {
1089 case TIOCSETP:
1090 case TIOCSETN:
1091 case OTIOCSETP:
1092 case OTIOCSETN:
1093 ioctl_processed++;
1094 ttyseth(PortP, tp, (struct old_sgttyb *) arg);
1095 break;
1096 case TCSETA:
1097 case TCSETAW:
1098 case TCSETAF:
1099 ioctl_processed++;
1100 rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n");
1101 ttyseth_pv(PortP, tp, (struct termios *) arg, 0);
1102 break;
1103 case TCSETAP: /* posix tcsetattr() */
1104 case TCSETAWP: /* posix tcsetattr() */
1105 case TCSETAFP: /* posix tcsetattr() */
1106 rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n");
1107 ttyseth_pv(PortP, tp, (struct termios *) arg, 1);
1108 ioctl_processed++;
1109 break;
1110 }
1111
1112 /*
1113 ** If its any of the commands that require the port to be in the
1114 ** non-busy state wait until all output has drained
1115 */
1116 if (!ioctl_processed)
1117 switch (cmd) {
1118 case TCSETAW:
1119 case TCSETAF:
1120 case TCSETA:
1121 case TCSBRK:
1122#define OLD_POSIX ('x' << 8)
1123#define OLD_POSIX_SETA (OLD_POSIX | 2)
1124#define OLD_POSIX_SETAW (OLD_POSIX | 3)
1125#define OLD_POSIX_SETAF (OLD_POSIX | 4)
1126#define NEW_POSIX (('i' << 24) | ('X' << 16))
1127#define NEW_POSIX_SETA (NEW_POSIX | 2)
1128#define NEW_POSIX_SETAW (NEW_POSIX | 3)
1129#define NEW_POSIX_SETAF (NEW_POSIX | 4)
1130 case OLD_POSIX_SETA:
1131 case OLD_POSIX_SETAW:
1132 case OLD_POSIX_SETAF:
1133 case NEW_POSIX_SETA:
1134 case NEW_POSIX_SETAW:
1135 case NEW_POSIX_SETAF:
1136#ifdef TIOCSETP
1137 case TIOCSETP:
1138#endif
1139 case TIOCSETD:
1140 case TIOCSETN:
1141 rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n");
1142 /*
1143 ** Wait for drain here, at least as far as the double buffer
1144 ** being empty.
1145 */
1146 /* XXX Does the above comment mean that this has
1147 still to be implemented? -- REW */
1148 /* XXX Is the locking OK together with locking
1149 in txenable? (Deadlock?) -- REW */
1150
1151 RIOTxEnable((char *) PortP);
1152 break;
1153 default:
1154 break;
1155 }
1156
1157 old_cflag = tp->tm.c_cflag;
1158 old_iflag = tp->tm.c_iflag;
1159 old_oflag = tp->tm.c_oflag;
1160 oldcook = PortP->CookMode;
1161
1162 if (p->RIOHalted) {
1163 RIOClearUp(PortP);
1164 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1165 pseterr(EIO);
1166 return 0;
1167 }
1168
1169 PortP->FlushCmdBodge = 0;
1170
1171 /*
1172 ** If the port is locked, and it is reconfigured, we want
1173 ** to restore the state of the tty structure so the change is NOT
1174 ** made.
1175 */
1176 if (PortP->Lock) {
1177 tp->tm.c_iflag = PortP->StoredTty.iflag;
1178 tp->tm.c_oflag = PortP->StoredTty.oflag;
1179 tp->tm.c_cflag = PortP->StoredTty.cflag;
1180 tp->tm.c_lflag = PortP->StoredTty.lflag;
1181 tp->tm.c_line = PortP->StoredTty.line;
1182 for (i = 0; i < NCC + 1; i++)
1183 tp->tm.c_cc[i] = PortP->StoredTty.cc[i];
1184 } else {
1185 /*
1186 ** If the port is set to store the parameters, and it is
1187 ** reconfigured, we want to save the current tty struct so it
1188 ** may be restored on the next open.
1189 */
1190 if (PortP->Store) {
1191 PortP->StoredTty.iflag = tp->tm.c_iflag;
1192 PortP->StoredTty.oflag = tp->tm.c_oflag;
1193 PortP->StoredTty.cflag = tp->tm.c_cflag;
1194 PortP->StoredTty.lflag = tp->tm.c_lflag;
1195 PortP->StoredTty.line = tp->tm.c_line;
1196 for (i = 0; i < NCC + 1; i++)
1197 PortP->StoredTty.cc[i] = tp->tm.c_cc[i];
1198 }
1199 }
1200
1201 changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag);
1202
1203 PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */
1204
1205 rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook);
1206
1207#ifdef MODEM_SUPPORT
1208 /*
1209 ** kludge to force CARR_ON if CLOCAL set
1210 */
1211 if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
1212 tp->tm.c_state |= CARR_ON;
1213 wakeup((caddr_t) & tp->tm.c_canq);
1214 }
1215#endif
1216
1217 if (p->RIOHalted) {
1218 RIOClearUp(PortP);
1219 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1220 pseterr(EIO);
1221 return 0;
1222 }
1223 /*
1224 ** Re-configure if modes or cooking have changed
1225 */
1226 if (changed || oldcook != PortP->CookMode || (ioctl_processed)) {
1227 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1228 rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n");
1229 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1230 rio_spin_lock_irqsave(&PortP->portSem, flags);
1231 }
1232
1233 if (p->RIOHalted) {
1234 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1235 RIOClearUp(PortP);
1236 pseterr(EIO);
1237 return 0;
1238 }
1239 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1240 return 0;
1241}
1242
1243/*
1244 ttyseth -- set hardware dependent tty settings
1245*/
1246void ttyseth(PortP, s, sg)
1247struct Port *PortP;
1248struct ttystatics *s;
1249struct old_sgttyb *sg;
1250{
1251 struct old_sgttyb *tsg;
1252 struct termios *tp = &s->tm;
1253
1254 tsg = &s->sg;
1255
1256 if (sg->sg_flags & (EVENP | ODDP)) {
1257 tp->c_cflag &= PARENB;
1258 if (sg->sg_flags & EVENP) {
1259 if (sg->sg_flags & ODDP) {
1260 tp->c_cflag &= V_CS7;
1261 tp->c_cflag &= ~PARENB;
1262 } else {
1263 tp->c_cflag &= V_CS7;
1264 tp->c_cflag &= PARENB;
1265 tp->c_cflag &= PARODD;
1266 }
1267 } else if (sg->sg_flags & ODDP) {
1268 tp->c_cflag &= V_CS7;
1269 tp->c_cflag &= PARENB;
1270 tp->c_cflag &= PARODD;
1271 } else {
1272 tp->c_cflag &= V_CS7;
1273 tp->c_cflag &= PARENB;
1274 }
1275 }
1276/*
1277 * Use ispeed as the desired speed. Most implementations don't handle
1278 * separate input and output speeds very well. If the RIO handles this,
1279 * I will have to use separate sets of flags to store them in the
1280 * Port structure.
1281 */
1282 if (!sg->sg_ospeed)
1283 sg->sg_ospeed = sg->sg_ispeed;
1284 else
1285 sg->sg_ispeed = sg->sg_ospeed;
1286 if (sg->sg_ispeed > V_EXTB)
1287 sg->sg_ispeed = V_EXTB;
1288 if (sg->sg_ispeed < V_B0)
1289 sg->sg_ispeed = V_B0;
1290 *tsg = *sg;
1291 tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed];
1292}
1293
1294/*
1295 ttyseth_pv -- set hardware dependent tty settings using either the
1296 POSIX termios structure or the System V termio structure.
1297 sysv = 0 => (POSIX): struct termios *sg
1298 sysv != 0 => (System V): struct termio *sg
1299*/
1300static void ttyseth_pv(PortP, s, sg, sysv)
1301struct Port *PortP;
1302struct ttystatics *s;
1303struct termios *sg;
1304int sysv;
1305{
1306 int speed;
1307 unsigned char csize;
1308 unsigned char cread;
1309 unsigned int lcr_flags;
1310 int ps;
1311
1312 if (sysv) {
1313 /* sg points to a System V termio structure */
1314 csize = ((struct termio *) sg)->c_cflag & CSIZE;
1315 cread = ((struct termio *) sg)->c_cflag & CREAD;
1316 speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD];
1317 } else {
1318 /* sg points to a POSIX termios structure */
1319 csize = sg->c_cflag & CSIZE;
1320 cread = sg->c_cflag & CREAD;
1321 speed = conv_vb[sg->c_cflag & V_CBAUD];
1322 }
1323 if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
1324 s->sg.sg_ispeed = speed;
1325 s->sg.sg_ospeed = speed;
1326 s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed];
1327 }
1328}
1329#endif
diff --git a/drivers/char/rio/riowinif.h b/drivers/char/rio/riowinif.h
deleted file mode 100644
index f802d7593b80..000000000000
--- a/drivers/char/rio/riowinif.h
+++ /dev/null
@@ -1,1329 +0,0 @@
1/************************************************************************/
2/* */
3/* Title : RIO Shared Memory Window Inteface */
4/* */
5/* Author : N.P.Vassallo */
6/* */
7/* Creation : 7th June 1999 */
8/* */
9/* Version : 1.0.0 */
10/* */
11/* Copyright : (c) Specialix International Ltd. 1999 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * */
26/* Description : Prototypes, structures and definitions */
27/* describing RIO host card shared memory */
28/* window interface structures: */
29/* PARMMAP */
30/* RUP */
31/* PHB */
32/* LPB */
33/* PKT */
34/* */
35/************************************************************************/
36
37/* History...
38
391.0.0 07/06/99 NPV Creation. (based on PARMMAP.H)
40
41*/
42
43#ifndef _riowinif_h /* If RIOWINDIF.H not already defined */
44#define _riowinif_h 1
45
46/*****************************************************************************
47******************************** *********************************
48******************************** General *********************************
49******************************** *********************************
50*****************************************************************************/
51
52#define TPNULL ((_u16)(0x8000))
53
54/*****************************************************************************
55******************************** ********************************
56******************************** PARM_MAP ********************************
57******************************** ********************************
58*****************************************************************************/
59
60/* The PARM_MAP structure defines global values relating to the Host Card / RTA
61 and is the main structure from which all other structures are referenced. */
62
63typedef struct _PARM_MAP {
64 _u16 phb_ptr; /* 0x00 Pointer to the PHB array */
65 _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */
66 _u16 free_list; /* 0x04 Free List pointer */
67 _u16 free_list_end; /* 0x06 Free List End pointer */
68 _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */
69 _u16 unit_id_ptr; /* 0x0A Unit Id */
70 _u16 link_str_ptr; /* 0x0C Link Structure Array */
71 _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */
72 _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */
73 _u16 port_route_map_ptr; /* 0x12 Port Route Map */
74 _u16 route_ptr; /* 0x14 Route Map */
75 _u16 map_present; /* 0x16 Route Map present */
76 _u16 pkt_num; /* 0x18 Total number of packets */
77 _u16 q_num; /* 0x1A Total number of Q packets */
78 _u16 buffers_per_port; /* 0x1C Number of buffers per port */
79 _u16 heap_size; /* 0x1E Initial size of heap */
80 _u16 heap_left; /* 0x20 Current Heap left */
81 _u16 error; /* 0x22 Error code */
82 _u16 tx_max; /* 0x24 Max number of tx pkts per phb */
83 _u16 rx_max; /* 0x26 Max number of rx pkts per phb */
84 _u16 rx_limit; /* 0x28 For high / low watermarks */
85 _u16 links; /* 0x2A Links to use */
86 _u16 timer; /* 0x2C Interrupts per second */
87 _u16 rups; /* 0x2E Pointer to the RUPs */
88 _u16 max_phb; /* 0x30 Mostly for debugging */
89 _u16 living; /* 0x32 Just increments!! */
90 _u16 init_done; /* 0x34 Initialisation over */
91 _u16 booting_link; /* 0x36 */
92 _u16 idle_count; /* 0x38 Idle time counter */
93 _u16 busy_count; /* 0x3A Busy counter */
94 _u16 idle_control; /* 0x3C Control Idle Process */
95 _u16 tx_intr; /* 0x3E TX interrupt pending */
96 _u16 rx_intr; /* 0x40 RX interrupt pending */
97 _u16 rup_intr; /* 0x42 RUP interrupt pending */
98
99} PARM_MAP;
100
101/* Same thing again, but defined as offsets... */
102
103#define PM_phb_ptr 0x00 /* 0x00 Pointer to the PHB array */
104#define PM_phb_num_ptr 0x02 /* 0x02 Ptr to Number of PHB's */
105#define PM_free_list 0x04 /* 0x04 Free List pointer */
106#define PM_free_list_end 0x06 /* 0x06 Free List End pointer */
107#define PM_q_free_list_ptr 0x08 /* 0x08 Ptr to Q_BUF variable */
108#define PM_unit_id_ptr 0x0A /* 0x0A Unit Id */
109#define PM_link_str_ptr 0x0C /* 0x0C Link Structure Array */
110#define PM_bootloader_1 0x0E /* 0x0E 1st Stage Boot Loader */
111#define PM_bootloader_2 0x10 /* 0x10 2nd Stage Boot Loader */
112#define PM_port_route_map_ptr 0x12 /* 0x12 Port Route Map */
113#define PM_route_ptr 0x14 /* 0x14 Route Map */
114#define PM_map_present 0x16 /* 0x16 Route Map present */
115#define PM_pkt_num 0x18 /* 0x18 Total number of packets */
116#define PM_q_num 0x1A /* 0x1A Total number of Q packets */
117#define PM_buffers_per_port 0x1C /* 0x1C Number of buffers per port */
118#define PM_heap_size 0x1E /* 0x1E Initial size of heap */
119#define PM_heap_left 0x20 /* 0x20 Current Heap left */
120#define PM_error 0x22 /* 0x22 Error code */
121#define PM_tx_max 0x24 /* 0x24 Max number of tx pkts per phb */
122#define PM_rx_max 0x26 /* 0x26 Max number of rx pkts per phb */
123#define PM_rx_limit 0x28 /* 0x28 For high / low watermarks */
124#define PM_links 0x2A /* 0x2A Links to use */
125#define PM_timer 0x2C /* 0x2C Interrupts per second */
126#define PM_rups 0x2E /* 0x2E Pointer to the RUPs */
127#define PM_max_phb 0x30 /* 0x30 Mostly for debugging */
128#define PM_living 0x32 /* 0x32 Just increments!! */
129#define PM_init_done 0x34 /* 0x34 Initialisation over */
130#define PM_booting_link 0x36 /* 0x36 */
131#define PM_idle_count 0x38 /* 0x38 Idle time counter */
132#define PM_busy_count 0x3A /* 0x3A Busy counter */
133#define PM_idle_control 0x3C /* 0x3C Control Idle Process */
134#define PM_tx_intr 0x3E /* 0x4E TX interrupt pending */
135#define PM_rx_intr 0x40 /* 0x40 RX interrupt pending */
136#define PM_rup_intr 0x42 /* 0x42 RUP interrupt pending */
137#define sizeof_PARM_MAP 0x44 /* structure size = 0x44 */
138
139/* PARM_MAP.error definitions... */
140#define E_NO_ERROR 0x00
141#define E_PROCESS_NOT_INIT 0x01
142#define E_LINK_TIMEOUT 0x02
143#define E_NO_ROUTE 0x03
144#define E_CONFUSED 0x04
145#define E_HOME 0x05
146#define E_CSUM_FAIL 0x06
147#define E_DISCONNECTED 0x07
148#define E_BAD_RUP 0x08
149#define E_NO_VIRGIN 0x09
150#define E_BOOT_RUP_BUSY 0x10
151#define E_CHANALLOC 0x80
152#define E_POLL_ALLOC 0x81
153#define E_LTTWAKE 0x82
154#define E_LTT_ALLOC 0x83
155#define E_LRT_ALLOC 0x84
156#define E_CIRRUS 0x85
157#define E_MONITOR 0x86
158#define E_PHB_ALLOC 0x87
159#define E_ARRAY_ALLOC 0x88
160#define E_QBUF_ALLOC 0x89
161#define E_PKT_ALLOC 0x8a
162#define E_GET_TX_Q_BUF 0x8b
163#define E_GET_RX_Q_BUF 0x8c
164#define E_MEM_OUT 0x8d
165#define E_MMU_INIT 0x8e
166#define E_LTT_INIT 0x8f
167#define E_LRT_INIT 0x90
168#define E_LINK_RUN 0x91
169#define E_MONITOR_ALLOC 0x92
170#define E_MONITOR_INIT 0x93
171#define E_POLL_INIT 0x94
172
173/* PARM_MAP.links definitions... */
174#define RIO_LINK_ENABLE 0x80FF
175
176/*****************************************************************************
177********************************** ***********************************
178********************************** RUP ***********************************
179********************************** ***********************************
180*****************************************************************************/
181
182/* The RUP (Remote Unit Port) structure relates to the Remote Terminal Adapters
183 attached to the system and there is normally an array of MAX_RUPS (=16) structures
184 in a host card, defined by PARM_MAP->rup. */
185
186typedef struct _RUP {
187 _u16 txpkt; /* 0x00 Outgoing packet */
188 _u16 rxpkt; /* 0x02 ncoming packet */
189 _u16 link; /* 0x04 Which link to send packet down ? */
190 _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */
191 _u16 handshake; /* 0x08 Handshaking */
192 _u16 timeout; /* 0x0A Timeout */
193 _u16 status; /* 0x0C Status */
194 _u16 txcontrol; /* 0x0E Transmit control */
195 _u16 rxcontrol; /* 0x10 Receive control */
196
197} RUP;
198
199/* Same thing again, but defined as offsets... */
200
201#define RUP_txpkt 0x00 /* 0x00 Outgoing packet */
202#define RUP_rxpkt 0x02 /* 0x02 Incoming packet */
203#define RUP_link 0x04 /* 0x04 Which link to send packet down ? */
204#define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */
205#define RUP_handshake 0x08 /* 0x08 Handshaking */
206#define RUP_timeout 0x0A /* 0x0A Timeout */
207#define RUP_status 0x0C /* 0x0C Status */
208#define RUP_txcontrol 0x0E /* 0x0E Transmit control */
209#define RUP_rxcontrol 0x10 /* 0x10 Receive control */
210#define sizeof_RUP 0x12 /* structure size = 0x12 */
211
212#define MAX_RUP 16
213
214/* RUP.txcontrol definitions... */
215#define TX_RUP_INACTIVE 0 /* Nothing to transmit */
216#define TX_PACKET_READY 1 /* Transmit packet ready */
217#define TX_LOCK_RUP 2 /* Transmit side locked */
218
219/* RUP.txcontrol definitions... */
220#define RX_RUP_INACTIVE 0 /* Nothing received */
221#define RX_PACKET_READY 1 /* Packet received */
222
223#define RUP_NO_OWNER 0xFF /* RUP not owned by any process */
224
225/*****************************************************************************
226********************************** ***********************************
227********************************** PHB ***********************************
228********************************** ***********************************
229*****************************************************************************/
230
231/* The PHB (Port Header Block) structure relates to the serial ports attached
232 to the system and there is normally an array of MAX_PHBS (=128) structures
233 in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */
234
235typedef struct _PHB {
236 _u16 source; /* 0x00 Location of the PHB in the host card */
237 _u16 handshake; /* 0x02 Used to manage receive packet flow control */
238 _u16 status; /* 0x04 Internal port transmit/receive status */
239 _u16 timeout; /* 0x06 Time period to wait for an ACK */
240 _u16 link; /* 0x08 The host link associated with the PHB */
241 _u16 destination; /* 0x0A Location of the remote port on the network */
242
243 _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */
244 _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */
245 _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */
246 _u16 tx_remove; /* 0x12 current position in the packet pointer array */
247
248 _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */
249 _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */
250 _u16 rx_add; /* 0x18 position in the packet array for new receive packets */
251 _u16 rx_remove; /* 0x1A current position in the packet pointer array */
252
253} PHB;
254
255/* Same thing again, but defined as offsets... */
256
257#define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */
258#define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */
259#define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */
260#define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */
261#define PHB_link 0x08 /* 0x08 The host link associated with the PHB */
262#define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */
263#define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */
264#define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */
265#define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */
266#define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */
267#define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */
268#define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */
269#define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */
270#define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */
271#define sizeof_PHB 0x1C /* structure size = 0x1C */
272
273/* PHB.handshake definitions... */
274#define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */
275#define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */
276#define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET)
277 /* Reset by ltt */
278
279#define MAX_PHB 128 /* range 0-127 */
280
281/*****************************************************************************
282********************************** ***********************************
283********************************** LPB ***********************************
284********************************** ***********************************
285*****************************************************************************/
286
287/* The LPB (Link Parameter Block) structure relates to a RIO Network Link
288 and there is normally an array of MAX_LINKS (=4) structures in a host card,
289 defined by PARM_MAP->link_str_ptr. */
290
291typedef struct _LPB {
292 _u16 link_number; /* 0x00 Link Number */
293 _u16 in_ch; /* 0x02 Link In Channel */
294 _u16 out_ch; /* 0x04 Link Out Channel */
295 _u8 attached_serial[4]; /* 0x06 Attached serial number */
296 _u8 attached_host_serial[4]; /* 0x0A Serial number of Host who booted other end */
297 _u16 descheduled; /* 0x0E Currently Descheduled */
298 _u16 state; /* 0x10 Current state */
299 _u16 send_poll; /* 0x12 Send a Poll Packet */
300 _u16 ltt_p; /* 0x14 Process Descriptor */
301 _u16 lrt_p; /* 0x16 Process Descriptor */
302 _u16 lrt_status; /* 0x18 Current lrt status */
303 _u16 ltt_status; /* 0x1A Current ltt status */
304 _u16 timeout; /* 0x1C Timeout value */
305 _u16 topology; /* 0x1E Topology bits */
306 _u16 mon_ltt; /* 0x20 */
307 _u16 mon_lrt; /* 0x22 */
308 _u16 num_pkts; /* 0x24 */
309 _u16 add_packet_list; /* 0x26 Add packets to here */
310 _u16 remove_packet_list; /* 0x28 Send packets from here */
311
312 _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */
313 _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */
314
315 RUP rup; /* 0x2E RUP structure for HOST to driver comms */
316 RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */
317 _u16 attached_link; /* 0x52 Number of attached link */
318 _u16 csum_errors; /* 0x54 csum errors */
319 _u16 num_disconnects; /* 0x56 number of disconnects */
320 _u16 num_sync_rcvd; /* 0x58 # sync's received */
321 _u16 num_sync_rqst; /* 0x5A # sync requests */
322 _u16 num_tx; /* 0x5C Num pkts sent */
323 _u16 num_rx; /* 0x5E Num pkts received */
324 _u16 module_attached; /* 0x60 Module tpyes of attached */
325 _u16 led_timeout; /* 0x62 LED timeout */
326 _u16 first_port; /* 0x64 First port to service */
327 _u16 last_port; /* 0x66 Last port to service */
328
329} LPB;
330
331/* Same thing again, but defined as offsets... */
332
333#define LPB_link_number 0x00 /* 0x00 Link Number */
334#define LPB_in_ch 0x02 /* 0x02 Link In Channel */
335#define LPB_out_ch 0x04 /* 0x04 Link Out Channel */
336#define LPB_attached_serial 0x06 /* 0x06 Attached serial number */
337#define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */
338#define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */
339#define LPB_state 0x10 /* 0x10 Current state */
340#define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */
341#define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */
342#define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */
343#define LPB_lrt_status 0x18 /* 0x18 Current lrt status */
344#define LPB_ltt_status 0x1A /* 0x1A Current ltt status */
345#define LPB_timeout 0x1C /* 0x1C Timeout value */
346#define LPB_topology 0x1E /* 0x1E Topology bits */
347#define LPB_mon_ltt 0x20 /* 0x20 */
348#define LPB_mon_lrt 0x22 /* 0x22 */
349#define LPB_num_pkts 0x24 /* 0x24 */
350#define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */
351#define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */
352#define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */
353#define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */
354#define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */
355#define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */
356#define LPB_attached_link 0x52 /* 0x52 Number of attached link */
357#define LPB_csum_errors 0x54 /* 0x54 csum errors */
358#define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */
359#define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */
360#define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */
361#define LPB_num_tx 0x5C /* 0x5C Num pkts sent */
362#define LPB_num_rx 0x5E /* 0x5E Num pkts received */
363#define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */
364#define LPB_led_timeout 0x62 /* 0x62 LED timeout */
365#define LPB_first_port 0x64 /* 0x64 First port to service */
366#define LPB_last_port 0x66 /* 0x66 Last port to service */
367#define sizeof_LPB 0x68 /* structure size = 0x68 */
368
369#define LINKS_PER_UNIT 4 /* number of links from a host */
370
371/*****************************************************************************
372******************************** *******************************
373******************************** FREE_LIST *******************************
374******************************** *******************************
375*****************************************************************************/
376
377/* Used to overlay packet headers when allocating/freeing packets from the free list */
378
379typedef struct _FREE_LIST {
380 _u16 next; /* 0x00 offset of next list item */
381 _u16 prev; /* 0x02 offset of previous list item */
382
383} FREE_LIST;
384
385/* Same thing again, but defined as offsets... */
386
387#define FL_next 0x00 /* 0x00 offset of next list item */
388#define FL_prev 0x02 /* 0x02 offset of previous list item */
389
390/*****************************************************************************
391********************************** ***********************************
392********************************** PKT ***********************************
393********************************** ***********************************
394*****************************************************************************/
395
396/* The PKT is the main unit of communication between Host Cards and RTAs across
397 the RIO network. */
398
399#define PKT_MAX_DATA_LEN 72 /* Size of packet data */
400
401typedef struct _PKT {
402 _u8 dest_unit; /* 0x00 Destination Unit Id */
403 _u8 dest_port; /* 0x01 Destination Port */
404 _u8 src_unit; /* 0x02 Source Unit Id */
405 _u8 src_port; /* 0x03 Source Port */
406 _u8 len; /* 0x04 Length (in bytes) of data field */
407 _u8 control; /* 0x05 */
408 _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */
409 _u16 csum; /* 0x4E C-SUM */
410
411} PKT;
412
413/* Same thing again, but defined as offsets... */
414
415#define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */
416#define PKT_dest_port 0x01 /* 0x01 Destination Port */
417#define PKT_src_unit 0x02 /* 0x02 Source Unit Id */
418#define PKT_src_port 0x03 /* 0x03 Source Port */
419#define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */
420#define PKT_control 0x05 /* 0x05 */
421#define PKT_data 0x06 /* 0x06 Actual data */
422#define PKT_csum 0x4E /* 0x4E C-SUM */
423#define sizeof_PKT 0x50 /* structure size = 0x50 */
424
425/* PKT.len definitions... */
426#define PKT_CMD_BIT 0x80
427#define PKT_CMD_DATA 0x80
428#define PKT_LEN_MASK 0x7F
429
430/* PKT.control definitions... */
431#define PKT_ACK 0x40
432#define PKT_TGL 0x20
433#define DATA_WNDW 0x10
434#define PKT_TTL_MASK 0x0F
435#define MAX_TTL 0x0F
436
437/*****************************************************************************
438***************************** ****************************
439***************************** Control Packets ****************************
440***************************** ****************************
441*****************************************************************************/
442
443/* The following definitions and structures define the control packets sent
444 between the driver and RIO Ports, RTAs and Host Cards. */
445
446#define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */
447
448/* "in-band" and "pre-emptive" port commands... */
449#define OPEN 0x00 /* Driver->RIO Open a port */
450#define CONFIG 0x01 /* Driver->RIO Configure a port */
451#define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */
452#define CLOSE 0x03 /* Driver->RIO Close a port */
453#define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */
454#define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */
455#define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */
456#define SBREAK 0x07 /* Driver->RIO Start break */
457#define EBREAK 0x08 /* Driver->RIO End break */
458#define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */
459#define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */
460#define XPRINT 0x0B /* Driver->RIO Xprint packet */
461#define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */
462#define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */
463#define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */
464#define PCLOSE 0x0F /* Driver->RIO Pseudo close */
465#define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */
466#define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */
467#define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */
468
469/* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */
470#define SYNC_RUP 0xFF /* Download internal */
471#define COMMAND_RUP 0xFE /* Command ack/status */
472#define ERROR_RUP 0xFD /* Download internal */
473#define POLL_RUP 0xFC /* Download internal */
474#define BOOT_RUP 0xFB /* Used to boot RTAs */
475#define ROUTE_RUP 0xFA /* Used to specify routing/topology */
476#define STATUS_RUP 0xF9 /* Not used */
477#define POWER_RUP 0xF8 /* Download internal */
478
479/* COMMAND_RUP definitions... */
480#define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */
481#define BREAK_RECEIVED (0x21|PRE_EMPTIVE) /* RIO->Driver Break received */
482#define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */
483
484/* BOOT_RUP definitions... */
485#define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */
486#define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */
487#define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */
488#define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */
489#define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */
490#define IDENTIFY 0x30 /* Driver->RIO Identify RTA */
491#define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */
492#define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */
493#define IWAIT 0x33 /* Driver->RIO Pause booting process */
494
495/* ROUTE_RUP definitions... */
496#define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */
497#define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */
498#define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */
499#define ROUTE_USED 0x03 /* Driver->RIO Not used */
500#define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */
501#define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */
502#define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */
503
504/*****************************************************************************
505********************************** **********************************
506********************************** OPEN **********************************
507********************************** **********************************
508*****************************************************************************/
509
510/* (Driver->RIO,in-band)
511
512 Sent to open a port.
513 Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */
514
515#define PKT_Cmd (PKT_Data+0) /* Command code */
516#define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */
517#define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */
518#define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */
519#define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */
520#define PKT_TxXon (PKT_Data+5) /* Transmit XON character */
521#define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */
522#define PKT_RxXon (PKT_Data+7) /* Receive XON character */
523#define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */
524#define PKT_Lnext (PKT_Data+9) /* Lnext character */
525#define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */
526#define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */
527
528/* COR1 definitions... */
529#define COR1_PARITY 0xE0 /* Parity mask */
530#define COR1_NONE 0x00 /* No parity */
531#define COR1_SPACE 0x20 /* Space parity */
532#define COR1_EVEN 0x40 /* Even parity */
533#define COR1_MARK 0xA0 /* Mark parity */
534#define COR1_ODD 0xC0 /* Odd parity */
535
536#define COR1_STOPBITS 0x0C /* Stop bits mask */
537#define COR1_STOP1 0x00 /* 1 stop bit */
538#define COR1_STOP1_5 0x04 /* 1.5 stop bits */
539#define COR1_STOP2 0x08 /* 2 stop bits */
540
541#define COR1_DATABITS 0x03 /* Data bits mask */
542#define COR1_DATA5 0x00 /* 5 data bits */
543#define COR1_DATA6 0x01 /* 6 data bits */
544#define COR1_DATA7 0x02 /* 7 data bits */
545#define COR1_DATA8 0x03 /* 8 data bits */
546
547/* COR2 definitions... */
548#define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */
549#define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */
550#define COR2_HUPCL 0x20 /* Hang Up On Close */
551#define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */
552#define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */
553#define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */
554#define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */
555
556/* COR4 definition... */
557#define COR4_IGNCR 0x80 /* Discard received CR */
558#define COR4_ICRNL 0x40 /* Map received CR -> NL */
559#define COR4_INLCR 0x20 /* Map received NL -> CR */
560#define COR4_IGNBRK 0x10 /* Ignore Received Break */
561#define COR4_NBRKINT 0x08 /* No interrupt on rx Break */
562#define COR4_IGNPAR 0x04 /* ignore rx parity error chars */
563#define COR4_PARMRK 0x02 /* Mark rx parity error chars */
564#define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */
565
566/* COR5 definitions... */
567#define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */
568#define COR5_LNE 0x40 /* Enable LNEXT processing */
569#define COR5_CMOE 0x20 /* Match good & error characters */
570#define COR5_TAB3 0x10 /* TAB3 mode */
571#define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */
572#define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */
573#define COR5_ONLCR 0x02 /* NL -> CR NL on output */
574#define COR5_OCRNL 0x01 /* CR -> NL on output */
575
576/* RxBaud and TxBaud definitions... */
577#define RIO_B0 0x00 /* RTS / DTR signals dropped */
578#define RIO_B50 0x01 /* 50 baud */
579#define RIO_B75 0x02 /* 75 baud */
580#define RIO_B110 0x03 /* 110 baud */
581#define RIO_B134 0x04 /* 134.5 baud */
582#define RIO_B150 0x05 /* 150 baud */
583#define RIO_B200 0x06 /* 200 baud */
584#define RIO_B300 0x07 /* 300 baud */
585#define RIO_B600 0x08 /* 600 baud */
586#define RIO_B1200 0x09 /* 1200 baud */
587#define RIO_B1800 0x0A /* 1800 baud */
588#define RIO_B2400 0x0B /* 2400 baud */
589#define RIO_B4800 0x0C /* 4800 baud */
590#define RIO_B9600 0x0D /* 9600 baud */
591#define RIO_B19200 0x0E /* 19200 baud */
592#define RIO_B38400 0x0F /* 38400 baud */
593#define RIO_B56000 0x10 /* 56000 baud */
594#define RIO_B57600 0x11 /* 57600 baud */
595#define RIO_B64000 0x12 /* 64000 baud */
596#define RIO_B115200 0x13 /* 115200 baud */
597#define RIO_B2000 0x14 /* 2000 baud */
598
599/*****************************************************************************
600********************************* *********************************
601********************************* CONFIG *********************************
602********************************* *********************************
603*****************************************************************************/
604
605/* (Driver->RIO,in-band)
606
607 CONFIG is sent from the driver to configure an already opened port.
608 Packet structure is same as OPEN. */
609
610/*****************************************************************************
611********************************* **********************************
612********************************* MOPEN **********************************
613********************************* **********************************
614*****************************************************************************/
615
616/* (Driver->RIO,in-band)
617
618 MOPEN is sent from the driver to open a port attached to a modem. (in-band)
619 Packet structure is same as OPEN. */
620
621/*****************************************************************************
622********************************* **********************************
623********************************* CLOSE **********************************
624********************************* **********************************
625*****************************************************************************/
626
627/* (Driver->RIO,in-band)
628
629 CLOSE is sent from the driver to close a previously opened port.
630 No parameters.
631 */
632#if 0
633#define PKT_Cmd (PKT_Data+0) /* Command code */
634#endif
635/*****************************************************************************
636********************************* *********************************
637********************************* WFLUSH *********************************
638********************************* *********************************
639*****************************************************************************/
640
641/* (Driver->RIO,pre-emptive)
642
643 WFLUSH is sent pre-emptively from the driver to flush the write buffers and
644 packets of a port. (pre-emptive)
645
646 WFLUSH is also sent in-band from the driver to a port as a marker to end
647 write flushing previously started by a pre-emptive WFLUSH packet. (in-band)
648 */
649#if 0
650#define PKT_Cmd (PKT_Data+0) /* Command code */
651#endif
652#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
653
654/*****************************************************************************
655********************************* *********************************
656********************************* RFLUSH *********************************
657********************************* *********************************
658*****************************************************************************/
659
660/* (Driver->RIO,pre-emptive)
661
662 RFLUSH is sent pre-emptively from the driver to flush the read buffers and
663 packets of a port.
664 */
665#if 0
666#define PKT_Cmd (PKT_Data+0) /* Command code */
667#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
668#endif
669
670/*****************************************************************************
671********************************* *********************************
672********************************* RESUME *********************************
673********************************* *********************************
674*****************************************************************************/
675
676/* (Driver->RIO,pre-emptive)
677
678 RESUME is sent pre-emptively from the driver to cause a port to resume
679 transmission of data if blocked by XOFF. (as if XON had been received)
680 */
681#if 0
682#define PKT_Cmd (PKT_Data+0) /* Command code */
683#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
684#endif
685
686/*****************************************************************************
687********************************* *********************************
688********************************* SBREAK *********************************
689********************************* *********************************
690*****************************************************************************/
691
692/* (Driver->RIO,in-band)
693
694 SBREAK is sent in-band from the driver to a port to suspend data and start
695 break signal transmission.
696
697 If the break delay is 0, the break signal will be acknowledged with a
698 RUP_COMMAND, COMPLETE packet and continue until an EBREAK packet is received.
699
700 Otherwise, there is no acknowledgement and the break signal will last for the
701 specified number of mS.
702 */
703#if 0
704#define PKT_Cmd (PKT_Data+0) /* Command code */
705#endif
706#define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */
707
708/*****************************************************************************
709********************************* *********************************
710********************************* EBREAK *********************************
711********************************* *********************************
712*****************************************************************************/
713
714/* (Driver->RIO,in-band)
715
716 EBREAK is sent in-band from the driver to a port to stop transmission of a
717 break signal.
718
719 No parameters. */
720
721/*****************************************************************************
722********************************* ********************************
723********************************* SUSPEND ********************************
724********************************* ********************************
725*****************************************************************************/
726
727/* (Driver->RIO,pre-emptive)
728
729 SUSPEND is sent pre-emptively from the driver to cause a port to suspend
730 transmission of data. (as if XOFF had been received)
731 */
732#if 0
733#define PKT_Cmd (PKT_Data+0) /* Command code */
734#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
735#endif
736
737/*****************************************************************************
738********************************* *********************************
739********************************* FCLOSE *********************************
740********************************* *********************************
741*****************************************************************************/
742
743/* (Driver->RIO,pre-emptive)
744
745 FCLOSE is sent pre-emptively from the driver to force close a port.
746 A force close flushes receive and transmit queues, and also lowers all output
747 modem signals if the COR5_HUPCL (Hang Up On Close) flag is set.
748 */
749#if 0
750#define PKT_Cmd (PKT_Data+0) /* Command code */
751#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
752#endif
753
754/*****************************************************************************
755********************************* *********************************
756********************************* XPRINT *********************************
757********************************* *********************************
758*****************************************************************************/
759
760/* (Driver->RIO,in-band)
761
762 XPRINT is sent as a normal I/O data packet except that the PKT_CMD_BIT of
763 the "len" field is set, and the first "data" byte is XPRINT.
764
765 The I/O data in the XPRINT packet will contain the following:
766 - Transparent Print Start Sequence
767 - Transparent Print Data
768 - Transparent Print Stop Sequence.
769 */
770#if 0
771#define PKT_Cmd (PKT_Data+0) /* Command code */
772#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
773#endif
774
775/*****************************************************************************
776********************************** **********************************
777********************************** MBIS **********************************
778********************************** **********************************
779*****************************************************************************/
780
781/* (Driver->RIO,pre-emptive)
782
783 MBIS is sent pre-emptively from the driver to set a port's modem signals.
784 */
785#if 0
786#define PKT_Cmd (PKT_Data+0) /* Command code */
787#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
788#endif
789#define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */
790
791/* ModemSet definitions... */
792#define MBIS_RTS 0x01 /* RTS modem signal */
793#define MBIS_DTR 0x02 /* DTR modem signal */
794
795/*****************************************************************************
796********************************** **********************************
797********************************** MBIC **********************************
798********************************** **********************************
799*****************************************************************************/
800
801/* (Driver->RIO,pre-emptive)
802
803 MBIC is sent pre-emptively from the driver to clear a port's modem signals.
804 */
805#if 0
806#define PKT_Cmd (PKT_Data+0) /* Command code */
807#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
808#endif
809
810#define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */
811
812/* ModemClear definitions... */
813#define MBIC_RTS 0x01 /* RTS modem signal */
814#define MBIC_DTR 0x02 /* DTR modem signal */
815
816/*****************************************************************************
817********************************** **********************************
818********************************** MSET **********************************
819********************************** **********************************
820*****************************************************************************/
821
822/* (Driver->RIO,pre-emptive)
823
824 MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */
825#if 0
826#define PKT_Cmd (PKT_Data+0) /* Command code */
827#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
828#endif
829
830#define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */
831
832/* ModemSet definitions... */
833#define MSET_RTS 0x01 /* RTS modem signal */
834#define MSET_DTR 0x02 /* DTR modem signal */
835
836/*****************************************************************************
837********************************* *********************************
838********************************* PCLOSE *********************************
839********************************* *********************************
840*****************************************************************************/
841
842/* (Driver->RIO,in-band)
843
844 PCLOSE is sent from the driver to pseudo close a previously opened port.
845
846 The port will close when all data has been sent/received, however, the
847 port's transmit / receive and modem signals will be left enabled and the
848 port marked internally as Pseudo Closed. */
849
850#define PKT_Cmd (PKT_Data+0) /* Command code */
851
852/*****************************************************************************
853********************************** **********************************
854********************************** MGET **********************************
855********************************** **********************************
856*****************************************************************************/
857
858/* (Driver->RIO,pre-emptive)
859
860 MGET is sent pre-emptively from the driver to request the port's current modem signals. */
861
862#define PKT_Cmd (PKT_Data+0) /* Command code */
863#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
864
865/*****************************************************************************
866********************************* ********************************
867********************************* MEMDUMP ********************************
868********************************* ********************************
869*****************************************************************************/
870
871/* (Driver->RIO,pre-emptive)
872
873 MEMDUMP is sent pre-emptively from the driver to request a dump of 32 bytes
874 of the specified port's RTA address space.
875 */
876#if 0
877#define PKT_Cmd (PKT_Data+0) /* Command code */
878#endif
879#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
880#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
881#define PKT_Address (PKT_Data+6) /* Requested address */
882
883/*****************************************************************************
884****************************** *****************************
885****************************** READ_REGISTER *****************************
886****************************** *****************************
887*****************************************************************************/
888
889/* (Driver->RIO,pre-emptive)
890
891 READ_REGISTER is sent pre-emptively from the driver to request the contents
892 of the CD1400 register specified in address.
893 */
894#if 0
895#define PKT_Cmd (PKT_Data+0) /* Command code */
896#endif
897#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
898#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
899#define PKT_Address (PKT_Data+6) /* Requested address */
900
901/*****************************************************************************
902************************ **************************
903************************ COMMAND_RUP - COMPLETE **************************
904************************ **************************
905*****************************************************************************/
906
907/* (RIO->Driver,pre-emptive)
908
909 COMMAND_RUP - COMPLETE is sent in response to all port I/O control command
910 packets, except MEMDUMP and READ_REGISTER.
911 */
912#if 0
913#define PKT_Cmd (PKT_Data+0) /* Command code */
914#endif
915#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
916#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
917#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
918#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
919#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
920
921/* ModemStatus definitions... */
922#define MODEM_DSR 0x80 /* Data Set Ready modem state */
923#define MODEM_CTS 0x40 /* Clear To Send modem state */
924#define MODEM_RI 0x20 /* Ring Indicate modem state */
925#define MODEM_CD 0x10 /* Carrier Detect modem state */
926#define MODEM_TSTOP 0x08 /* Transmit Stopped state */
927#define MODEM_TEMPTY 0x04 /* Transmit Empty state */
928#define MODEM_DTR 0x02 /* DTR modem output state */
929#define MODEM_RTS 0x01 /* RTS modem output state */
930
931/* PortStatus definitions... */
932#define PORT_ISOPEN 0x01 /* Port open ? */
933#define PORT_HUPCL 0x02 /* Hangup on close? */
934#define PORT_MOPENPEND 0x04 /* Modem open pending */
935#define PORT_ISPARALLEL 0x08 /* Parallel port */
936#define PORT_BREAK 0x10 /* Port on break */
937#define PORT_STATUSPEND 0020 /* Status packet pending */
938#define PORT_BREAKPEND 0x40 /* Break packet pending */
939#define PORT_MODEMPEND 0x80 /* Modem status packet pending */
940
941/*****************************************************************************
942************************ **************************
943************************ COMMAND_RUP - COMPLETE **************************
944************************ **************************
945*****************************************************************************/
946
947/* (RIO->Driver,pre-emptive)
948
949 COMMAND_RUP - COMPLETE is sent in response to all port I/O control command
950 packets, except MEMDUMP and READ_REGISTER.
951 */
952#if 0
953#define PKT_Cmd (PKT_Data+0) /* Command code */
954#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
955#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
956#endif
957#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
958#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
959#if 0
960#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
961#endif
962
963/* ModemStatus definitions... */
964#define MODEM_DSR 0x80 /* Data Set Ready modem state */
965#define MODEM_CTS 0x40 /* Clear To Send modem state */
966#define MODEM_RI 0x20 /* Ring Indicate modem state */
967#define MODEM_CD 0x10 /* Carrier Detect modem state */
968#define MODEM_TSTOP 0x08 /* Transmit Stopped state */
969#define MODEM_TEMPTY 0x04 /* Transmit Empty state */
970#define MODEM_DTR 0x02 /* DTR modem output state */
971#define MODEM_RTS 0x01 /* RTS modem output state */
972
973/* PortStatus definitions... */
974#define PORT_ISOPEN 0x01 /* Port open ? */
975#define PORT_HUPCL 0x02 /* Hangup on close? */
976#define PORT_MOPENPEND 0x04 /* Modem open pending */
977#define PORT_ISPARALLEL 0x08 /* Parallel port */
978#define PORT_BREAK 0x10 /* Port on break */
979#define PORT_STATUSPEND 0020 /* Status packet pending */
980#define PORT_BREAKPEND 0x40 /* Break packet pending */
981#define PORT_MODEMPEND 0x80 /* Modem status packet pending */
982
983/*****************************************************************************
984******************** ********************
985******************** COMMAND_RUP - COMPLETE - MEMDUMP ********************
986******************** ********************
987*****************************************************************************/
988
989/* (RIO->Driver,pre-emptive)
990
991 COMMAND_RUP - COMPLETE - MEMDUMP is sent as an acknowledgement for a MEMDUMP
992 port I/O control command packet.
993 */
994#if 0
995#define PKT_Cmd (PKT_Data+0) /* Command code */
996#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
997#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
998#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
999#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
1000#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
1001#define PKT_Address (PKT_Data+6) /* Requested address */
1002#endif
1003#define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */
1004
1005/*****************************************************************************
1006***************** *****************
1007***************** COMMAND_RUP - COMPLETE - READ_REGISTER *****************
1008***************** *****************
1009*****************************************************************************/
1010
1011/* (RIO->Driver,pre-emptive)
1012
1013 COMMAND_RUP - COMPLETE - READ_REGISTER is sent as an acknowledgement for a
1014 READ_REGISTER port I/O control command packet.
1015 */
1016#if 0
1017#define PKT_Cmd (PKT_Data+0) /*Command code */
1018#define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */
1019#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
1020#endif
1021#define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */
1022#if 0
1023#define PKT_PortStatus (PKT_Data+4) /* Port signal status */
1024#define PKT_SubCmd (PKT_Data+5) /* Sub Command */
1025#endif
1026
1027/*****************************************************************************
1028********************* ***********************
1029********************* COMMAND_RUP - BREAK_RECEIVED ***********************
1030********************* ***********************
1031*****************************************************************************/
1032
1033/* (RIO->Driver,pre-emptive)
1034
1035 COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal.
1036 */
1037#if 0
1038#define PKT_Cmd (PKT_Data+0) /* Command code */
1039#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
1040#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
1041#endif
1042
1043/*****************************************************************************
1044********************* *************************
1045********************* COMMAND_RUP - MODEM_STATUS *************************
1046********************* *************************
1047*****************************************************************************/
1048
1049/* (RIO->Driver,pre-emptive)
1050
1051 COMMAND_RUP - MODEM_STATUS packets are sent whenever the port detects a
1052 change in the input modem signal states.
1053
1054 */
1055#if 0
1056#define PKT_Cmd (PKT_Data+0) /* Command code */
1057#define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */
1058#define PKT_Cmd2 (PKT_Data+2) /* Command code copy */
1059#define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */
1060#endif
1061
1062/*****************************************************************************
1063************************ *************************
1064************************ BOOT_RUP - BOOT_REQUEST *************************
1065************************ *************************
1066*****************************************************************************/
1067
1068/* (RIO->Driver,pre-emptive)
1069
1070 BOOT_RUP - BOOT_REQUEST packets are sent to the Driver from RIO to request
1071 firmware code to load onto attached RTAs.
1072 */
1073#if 0
1074#define PKT_Cmd (PKT_Data+0) /* Command code */
1075#endif
1076
1077/*****************************************************************************
1078************************ ************************
1079************************ BOOT_RUP - BOOT_SEQUENCE ************************
1080************************ ************************
1081*****************************************************************************/
1082
1083/* (Driver->RIO,pre-emptive)
1084
1085 BOOT_RUP - BOOT_SEQUENCE packets are sent from the Driver to RIO in response
1086 to a BOOT_RUP - BOOT_REQUEST packet.
1087 */
1088#if 0
1089#define PKT_Cmd (PKT_Data+0) /* Command code */
1090#endif
1091#define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */
1092#define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */
1093#define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */
1094#define PKT_CmdString (PKT_Data+8) /* Command string */
1095
1096/*****************************************************************************
1097************************ ***********************
1098************************ BOOT_RUP - BOOT_COMPLETED ***********************
1099************************ ***********************
1100*****************************************************************************/
1101
1102/* (RIO->Driver,pre-emptive)
1103
1104 BOOT_RUP - BOOT_COMPLETE is sent to the Driver from RIO when downloading of
1105 RTA firmware has completed.
1106 */
1107#if 0
1108#define PKT_Cmd (PKT_Data+0) /* Command code */
1109#endif
1110#define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */
1111#define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */
1112
1113/*****************************************************************************
1114************************ ***********************
1115************************ BOOT_RUP - Packet Request ***********************
1116************************ ***********************
1117*****************************************************************************/
1118
1119/* (RIO->Driver,pre-emptive)
1120
1121 BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent
1122 from RIO to the Driver as a request for a firmware boot packet. */
1123
1124#define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */
1125
1126/*****************************************************************************
1127*********************** ***********************
1128*********************** BOOT_RUP - Packet Response ***********************
1129*********************** ***********************
1130*****************************************************************************/
1131
1132/* (Driver->RIO,pre-emptive)
1133
1134 In response to a BOOT_RUP boot packet request, the driver fills out the response
1135 packet with the 70 bytes of the requested sequence.
1136 */
1137#if 0
1138#define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */
1139#endif
1140#define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */
1141
1142/*****************************************************************************
1143**************************** ****************************
1144**************************** BOOT_RUP - IFOAD ****************************
1145**************************** ****************************
1146*****************************************************************************/
1147
1148/* (Driver->RIO,pre-emptive)
1149
1150 BOOT_RUP - IFOAD packets are sent from the Driver to an RTA to cause the
1151 RTA to shut down and reboot.
1152 */
1153#if 0
1154#define PKT_Cmd (PKT_Data+0) /* Command code */
1155#endif
1156#define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */
1157#define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */
1158
1159#define IFOADID1 0xAD
1160#define IFOADID2 0xF0
1161
1162/*****************************************************************************
1163************************** ***************************
1164************************** BOOT_RUP - IDENTIFY ***************************
1165************************** ***************************
1166*****************************************************************************/
1167
1168/* (Driver->RIO,pre-emptive)
1169
1170 BOOT_RUP - IDENTIFY packets are sent from the Driver to an RTA to cause the
1171 RTA to flash its LEDs for a period of time.
1172 */
1173#if 0
1174#define PKT_Cmd (PKT_Data+0) /* Command code */
1175#endif
1176#define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */
1177
1178/*****************************************************************************
1179**************************** ***************************
1180**************************** BOOT_RUP - ZOMBIE ***************************
1181**************************** ***************************
1182*****************************************************************************/
1183
1184/* (Driver->RIO,pre-emptive)
1185
1186 BOOT_RUP - ZOMBIE packets are sent from the Driver to an RTA to cause the
1187 RTA to shut down and flash it's LEDs.
1188 */
1189#if 0
1190#define PKT_Cmd (PKT_Data+0) /* Command code */
1191#endif
1192#define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */
1193#define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */
1194
1195#define ZOMBIEID1 0x52
1196#define ZOMBIEID2 0x21
1197
1198/*****************************************************************************
1199**************************** ****************************
1200**************************** BOOT_RUP - UFOAD ****************************
1201**************************** ****************************
1202*****************************************************************************/
1203
1204/* (Driver->RIO,pre-emptive)
1205
1206 BOOT_RUP - UFOAD packets are sent from the Driver to an RTA to cause the RTA
1207 to ask it's neighbouring RTA to shut down and reboot.
1208 */
1209#if 0
1210#define PKT_Cmd (PKT_Data+0) /* Command code */
1211#define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */
1212#endif
1213#define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */
1214#define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */
1215
1216#define UFOADID1 0x1E
1217#define UFOADID2 0x0D
1218
1219/*****************************************************************************
1220**************************** ****************************
1221**************************** BOOT_RUP - IWAIT ****************************
1222**************************** ****************************
1223*****************************************************************************/
1224
1225/* (Driver->RIO,pre-emptive)
1226
1227 BOOT_RUP - IWAIT packets are sent from the Driver to an RTA to cause the RTA
1228 to pause booting on the specified link for 30 seconds.
1229 */
1230#if 0
1231#define PKT_Cmd (PKT_Data+0) /* Command code */
1232#define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */
1233#endif
1234#define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */
1235#define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */
1236
1237#define IWAITID1 0xDE
1238#define IWAITID2 0xB1
1239
1240/*****************************************************************************
1241************************ ***********************
1242************************ ROUTE_RUP - ROUTE_REQUEST ***********************
1243************************ ***********************
1244*****************************************************************************/
1245
1246/* (RIO->Driver,pre-emptive)
1247
1248 ROUTE_RUP - ROUTE_REQUEST packets are sent from a newly booted or connected
1249 RTA to a Driver to request an ID (RUP or unit number).
1250 */
1251#if 0
1252#define PKT_Cmd (PKT_Data+0) /* Command code */
1253#endif
1254#define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */
1255#define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */
1256
1257/* ModuleTypes definitions... */
1258#define MOD_BLANK 0x0F /* Blank plate attached */
1259#define MOD_RS232DB25 0x00 /* RS232 DB25 connector */
1260#define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */
1261#define MOD_RS422DB25 0x02 /* RS422 DB25 connector */
1262#define MOD_RS485DB25 0x03 /* RS485 DB25 connector */
1263#define MOD_PARALLEL 0x04 /* Centronics parallel */
1264
1265#define MOD2 0x08 /* Set to indicate Rev2 module */
1266
1267/*****************************************************************************
1268************************* *************************
1269************************* ROUTE_RUP - ROUTE_FOAD *************************
1270************************* *************************
1271*****************************************************************************/
1272
1273/* (Driver->RIO,pre-emptive)
1274
1275 ROUTE_RUP - ROUTE_FOAD packet is sent as a response to a ROUTE_RUP - ROUTE_REQUEST
1276 packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot.
1277 */
1278#if 0
1279#define PKT_Cmd (PKT_Data+0) /* Command code */
1280#endif
1281#define PKT_RouteCmdString (PKT_Data+2) /* Command string */
1282
1283/*****************************************************************************
1284*********************** ***********************
1285*********************** ROUTE_RUP - ROUTE_ALLOCATE ***********************
1286*********************** ***********************
1287*****************************************************************************/
1288
1289/* (Driver->RIO,pre-emptive)
1290
1291 ROUTE_RUP - ROUTE_ALLOCATE packet is sent as a response to a ROUTE_RUP - ROUTE_REQUEST
1292 packet to allocate the RTA's Id number (RUP number 1..16)
1293 */
1294#if 0
1295#define PKT_Cmd (PKT_Data+0) /* Command code */
1296#endif
1297#define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */
1298#if 0
1299#define PKT_RouteCmdString (PKT_Data+2) /* Command string */
1300#endif
1301#define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */
1302
1303/*****************************************************************************
1304*********************** ***********************
1305*********************** ROUTE_RUP - ROUTE_TOPOLOGY ***********************
1306*********************** ***********************
1307*****************************************************************************/
1308
1309/* (RIO->Driver,pre-emptive)
1310
1311 ROUTE_RUP - ROUTE_TOPOLOGY packet is sent to inform the driver of an RTA's
1312 current link status.
1313 */
1314#if 0
1315#define PKT_Cmd (PKT_Data+0) /* Command code */
1316#endif
1317#define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */
1318#define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */
1319#define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */
1320#define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */
1321#define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */
1322#define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */
1323#define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */
1324#define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */
1325#define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */
1326
1327#endif /* _sxwinif_h */
1328
1329/* End of RIOWINIF.H */
diff --git a/drivers/char/rio/riscos.h b/drivers/char/rio/riscos.h
deleted file mode 100644
index 60d66d0056ae..000000000000
--- a/drivers/char/rio/riscos.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2** -----------------------------------------------------------------------------
3**
4** Perle Specialix driver for Linux
5** Ported from existing RIO Driver for SCO sources.
6 *
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22**
23** Module : riscos.h
24** SID : 1.2
25** Last Modified : 11/6/98 11:34:19
26** Retrieved : 11/6/98 11:34:22
27**
28** ident @(#)riscos.h 1.2
29**
30** -----------------------------------------------------------------------------
31*/
32
33#ifndef __rio_riscos_h__
34#define __rio_riscos_h__
35
36#ifdef SCCS_LABELS
37static char *_riscos_h_sccs_ = "@(#)riscos.h 1.2";
38#endif
39
40/*
41** This module used to define all those little itsy bits required for RISC/OS
42** now it's full of null macros.
43*/
44
45/*
46** RBYTE reads a byte from a location.
47** RWORD reads a word from a location.
48** WBYTE writes a byte to a location.
49** WWORD writes a word to a location.
50** RINDW reads a word through a pointer.
51** WINDW writes a word through a pointer.
52** RIOSWAB swaps the two bytes of a word, if needed.
53*/
54
55#define RIOSWAB(N) (N)
56#define WBYTE(A,V) (A)=(uchar)(V)
57#define WWORD(A,V) (A)=(ushort)(V)
58#define RBYTE(A) (uchar)(A)
59#define RWORD(A) (ushort)(A)
60#define RINDW(A) (*(ushort *)(A))
61#define WINDW(A,V) (*(ushort *)(A)=(ushort)(V))
62
63#endif /* __rio_riscos_h__ */
diff --git a/drivers/char/rio/rtahw.h b/drivers/char/rio/rtahw.h
deleted file mode 100644
index e6c2cdfd3a1f..000000000000
--- a/drivers/char/rio/rtahw.h
+++ /dev/null
@@ -1,75 +0,0 @@
1
2/****************************************************************************
3 ******* *******
4 ******* R T A H A R D W A R E
5 ******* *******
6 ****************************************************************************
7
8 Author : Ian Nandhra
9 Date :
10
11 *
12 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5";
41#endif
42#endif
43
44#define WATCHDOG_ADDR ((unsigned short *)0x7a00)
45#define RTA_LED_ADDR ((unsigned short *)0x7c00)
46#define SERIALNUM_ADDR ((unsigned char *)0x7809)
47#define LATCH_ADDR ((unsigned char *)0x7800)
48
49/*
50** Here we define where the cd1400 chips are in memory.
51*/
52#define CD1400_ONE_ADDR (0x7300)
53#define CD1400_TWO_ADDR (0x7200)
54#define CD1400_THREE_ADDR (0x7100)
55#define CD1400_FOUR_ADDR (0x7000)
56
57/*
58** Define the different types of modules we can have
59*/
60enum module {
61 MOD_BLANK = 0x0f, /* Blank plate attached */
62 MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */
63 MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */
64 MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */
65 MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */
66 MOD_PARALLEL = 0x04 /* Centronics parallel */
67};
68
69#define TYPE_HOST 0
70#define TYPE_RTA8 1
71#define TYPE_RTA16 2
72
73#define WATCH_DOG WATCHDOG_ADDR
74
75/*********** end of file ***********/
diff --git a/drivers/char/rio/rupstat.h b/drivers/char/rio/rupstat.h
deleted file mode 100644
index 56d828c63d28..000000000000
--- a/drivers/char/rio/rupstat.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/****************************************************************************
2 ******* *******
3 ******* RUPSTAT
4 ******* *******
5 ****************************************************************************
6
7 Author : Jeremy Rolls
8 Date :
9
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 Version : 0.01
28
29
30 Mods
31 ----------------------------------------------------------------------------
32 Date By Description
33 ----------------------------------------------------------------------------
34
35 ***************************************************************************/
36
37#ifndef _rupstat_h
38#define _rupstat_h
39
40#ifndef lint
41#ifdef SCCS_LABELS
42static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1";
43#endif
44#endif
45
46#define STATUS_SYNC 0
47#define STATUS_REQ_TOP 1
48#define STATUS_TOPOLOGY 2
49
50#endif
diff --git a/drivers/char/rio/selftest.h b/drivers/char/rio/selftest.h
deleted file mode 100644
index 7a3dba352323..000000000000
--- a/drivers/char/rio/selftest.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2** File: selftest.h
3**
4** Author: David Dix
5**
6** Created: 15th March 1993
7**
8** Last modified: 94/06/14
9**
10 *
11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27
28#ifndef _selftests_h_
29#define _selftests_h_
30
31/*
32** Selftest identifier...
33*/
34#define SELFTEST_MAGIC 0x5a5a
35
36/*
37** This is the structure of the packet that is sent back after each
38** selftest on a booting RTA.
39*/
40typedef struct {
41 short magic; /* Identifies packet type */
42 int test; /* Test number, see below */
43 unsigned int result; /* Result value */
44 unsigned int dataIn;
45 unsigned int dataOut;
46} selftestStruct;
47
48/*
49** The different tests are identified by the following data values.
50*/
51enum test {
52 TESTS_COMPLETE = 0x00,
53 MEMTEST_ADDR = 0x01,
54 MEMTEST_BIT = 0x02,
55 MEMTEST_FILL = 0x03,
56 MEMTEST_DATABUS = 0x04,
57 MEMTEST_ADDRBUS = 0x05,
58 CD1400_INIT = 0x10,
59 CD1400_LOOP = 0x11,
60 CD1400_INTERRUPT = 0x12
61};
62
63enum result {
64 E_PORT = 0x10,
65 E_TX = 0x11,
66 E_RX = 0x12,
67 E_EXCEPT = 0x13,
68 E_COMPARE = 0x14,
69 E_MODEM = 0x15,
70 E_TIMEOUT = 0x16,
71 E_INTERRUPT = 0x17
72};
73#endif /* _selftests_h_ */
diff --git a/drivers/char/rio/sysmap.h b/drivers/char/rio/sysmap.h
deleted file mode 100644
index e1c6f1160dff..000000000000
--- a/drivers/char/rio/sysmap.h
+++ /dev/null
@@ -1,62 +0,0 @@
1
2/****************************************************************************
3 ******* *******
4 ******* S Y S T E M M A P H E A D E R
5 ******* *******
6 ****************************************************************************
7
8 Author : Ian Nandhra
9 Date :
10
11 *
12 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1";
41#endif
42#endif
43
44#define SYSTEM_MAP_LEN 64 /* Len of System Map array */
45
46
47typedef struct SYS_MAP SYS_MAP;
48typedef struct SYS_MAP_LINK SYS_MAP_LINK;
49
50struct SYS_MAP_LINK {
51 short id; /* Unit Id */
52 short link; /* Id's Link */
53 short been_here; /* Used by map_gen */
54};
55
56struct SYS_MAP {
57 char serial_num[4];
58 SYS_MAP_LINK link[4];
59};
60
61
62/*********** end of file ***********/
diff --git a/drivers/char/rio/timeouts.h b/drivers/char/rio/timeouts.h
deleted file mode 100644
index a8b5be3ca9bf..000000000000
--- a/drivers/char/rio/timeouts.h
+++ /dev/null
@@ -1,50 +0,0 @@
1
2/****************************************************************************
3 ******* *******
4 ******* T I M E O U T S
5 ******* *******
6 ****************************************************************************
7
8 Author : Ian Nandhra
9 Date :
10
11 *
12 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 Version : 0.01
29
30
31 Mods
32 ----------------------------------------------------------------------------
33 Date By Description
34 ----------------------------------------------------------------------------
35
36 ***************************************************************************/
37
38#ifndef lint
39#ifdef SCCS_LABELS
40static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3";
41#endif
42#endif
43
44#define MILLISECOND (int) (1000/64) /* 15.625 low ticks */
45#define SECOND (int) 15625 /* Low priority ticks */
46
47#define TX_TIMEOUT (int) (200 * MILLISECOND)
48
49
50/*********** end of file ***********/
diff --git a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c
deleted file mode 100644
index 17390d762cf7..000000000000
--- a/drivers/ieee1394/amdtp.c
+++ /dev/null
@@ -1,1297 +0,0 @@
1/* -*- c-basic-offset: 8 -*-
2 *
3 * amdtp.c - Audio and Music Data Transmission Protocol Driver
4 * Copyright (C) 2001 Kristian Høgsberg
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21/* OVERVIEW
22 * --------
23 *
24 * The AMDTP driver is designed to expose the IEEE1394 bus as a
25 * regular OSS soundcard, i.e. you can link /dev/dsp to /dev/amdtp and
26 * then your favourite MP3 player, game or whatever sound program will
27 * output to an IEEE1394 isochronous channel. The signal destination
28 * could be a set of IEEE1394 loudspeakers (if and when such things
29 * become available) or an amplifier with IEEE1394 input (like the
30 * Sony STR-LSA1). The driver only handles the actual streaming, some
31 * connection management is also required for this to actually work.
32 * That is outside the scope of this driver, and furthermore it is not
33 * really standardized yet.
34 *
35 * The Audio and Music Data Tranmission Protocol is available at
36 *
37 * http://www.1394ta.org/Download/Technology/Specifications/2001/AM20Final-jf2.pdf
38 *
39 *
40 * TODO
41 * ----
42 *
43 * - We should be able to change input sample format between LE/BE, as
44 * we already shift the bytes around when we construct the iso
45 * packets.
46 *
47 * - Fix DMA stop after bus reset!
48 *
49 * - Clean up iso context handling in ohci1394.
50 *
51 *
52 * MAYBE TODO
53 * ----------
54 *
55 * - Receive data for local playback or recording. Playback requires
56 * soft syncing with the sound card.
57 *
58 * - Signal processing, i.e. receive packets, do some processing, and
59 * transmit them again using the same packet structure and timestamps
60 * offset by processing time.
61 *
62 * - Maybe make an ALSA interface, that is, create a file_ops
63 * implementation that recognizes ALSA ioctls and uses defaults for
64 * things that can't be controlled through ALSA (iso channel).
65 *
66 * Changes:
67 *
68 * - Audit copy_from_user in amdtp_write.
69 * Daniele Bellucci <bellucda@tiscali.it>
70 *
71 */
72
73#include <linux/module.h>
74#include <linux/list.h>
75#include <linux/sched.h>
76#include <linux/types.h>
77#include <linux/fs.h>
78#include <linux/ioctl.h>
79#include <linux/wait.h>
80#include <linux/pci.h>
81#include <linux/interrupt.h>
82#include <linux/poll.h>
83#include <linux/compat.h>
84#include <linux/cdev.h>
85#include <asm/uaccess.h>
86#include <asm/atomic.h>
87
88#include "hosts.h"
89#include "highlevel.h"
90#include "ieee1394.h"
91#include "ieee1394_core.h"
92#include "ohci1394.h"
93
94#include "amdtp.h"
95#include "cmp.h"
96
97#define FMT_AMDTP 0x10
98#define FDF_AM824 0x00
99#define FDF_SFC_32KHZ 0x00
100#define FDF_SFC_44K1HZ 0x01
101#define FDF_SFC_48KHZ 0x02
102#define FDF_SFC_88K2HZ 0x03
103#define FDF_SFC_96KHZ 0x04
104#define FDF_SFC_176K4HZ 0x05
105#define FDF_SFC_192KHZ 0x06
106
107struct descriptor_block {
108 struct output_more_immediate {
109 u32 control;
110 u32 pad0;
111 u32 skip;
112 u32 pad1;
113 u32 header[4];
114 } header_desc;
115
116 struct output_last {
117 u32 control;
118 u32 data_address;
119 u32 branch;
120 u32 status;
121 } payload_desc;
122};
123
124struct packet {
125 struct descriptor_block *db;
126 dma_addr_t db_bus;
127 struct iso_packet *payload;
128 dma_addr_t payload_bus;
129};
130
131#include <asm/byteorder.h>
132
133#if defined __BIG_ENDIAN_BITFIELD
134
135struct iso_packet {
136 /* First quadlet */
137 unsigned int dbs : 8;
138 unsigned int eoh0 : 2;
139 unsigned int sid : 6;
140
141 unsigned int dbc : 8;
142 unsigned int fn : 2;
143 unsigned int qpc : 3;
144 unsigned int sph : 1;
145 unsigned int reserved : 2;
146
147 /* Second quadlet */
148 unsigned int fdf : 8;
149 unsigned int eoh1 : 2;
150 unsigned int fmt : 6;
151
152 unsigned int syt : 16;
153
154 quadlet_t data[0];
155};
156
157#elif defined __LITTLE_ENDIAN_BITFIELD
158
159struct iso_packet {
160 /* First quadlet */
161 unsigned int sid : 6;
162 unsigned int eoh0 : 2;
163 unsigned int dbs : 8;
164
165 unsigned int reserved : 2;
166 unsigned int sph : 1;
167 unsigned int qpc : 3;
168 unsigned int fn : 2;
169 unsigned int dbc : 8;
170
171 /* Second quadlet */
172 unsigned int fmt : 6;
173 unsigned int eoh1 : 2;
174 unsigned int fdf : 8;
175
176 unsigned int syt : 16;
177
178 quadlet_t data[0];
179};
180
181#else
182
183#error Unknown bitfield type
184
185#endif
186
187struct fraction {
188 int integer;
189 int numerator;
190 int denominator;
191};
192
193#define PACKET_LIST_SIZE 256
194#define MAX_PACKET_LISTS 4
195
196struct packet_list {
197 struct list_head link;
198 int last_cycle_count;
199 struct packet packets[PACKET_LIST_SIZE];
200};
201
202#define BUFFER_SIZE 128
203
204/* This implements a circular buffer for incoming samples. */
205
206struct buffer {
207 size_t head, tail, length, size;
208 unsigned char data[0];
209};
210
211struct stream {
212 int iso_channel;
213 int format;
214 int rate;
215 int dimension;
216 int fdf;
217 int mode;
218 int sample_format;
219 struct cmp_pcr *opcr;
220
221 /* Input samples are copied here. */
222 struct buffer *input;
223
224 /* ISO Packer state */
225 unsigned char dbc;
226 struct packet_list *current_packet_list;
227 int current_packet;
228 struct fraction ready_samples, samples_per_cycle;
229
230 /* We use these to generate control bits when we are packing
231 * iec958 data.
232 */
233 int iec958_frame_count;
234 int iec958_rate_code;
235
236 /* The cycle_count and cycle_offset fields are used for the
237 * synchronization timestamps (syt) in the cip header. They
238 * are incremented by at least a cycle every time we put a
239 * time stamp in a packet. As we don't time stamp all
240 * packages, cycle_count isn't updated in every cycle, and
241 * sometimes it's incremented by 2. Thus, we have
242 * cycle_count2, which is simply incremented by one with each
243 * packet, so we can compare it to the transmission time
244 * written back in the dma programs.
245 */
246 atomic_t cycle_count, cycle_count2;
247 struct fraction cycle_offset, ticks_per_syt_offset;
248 int syt_interval;
249 int stale_count;
250
251 /* Theses fields control the sample output to the DMA engine.
252 * The dma_packet_lists list holds packet lists currently
253 * queued for dma; the head of the list is currently being
254 * processed. The last program in a packet list generates an
255 * interrupt, which removes the head from dma_packet_lists and
256 * puts it back on the free list.
257 */
258 struct list_head dma_packet_lists;
259 struct list_head free_packet_lists;
260 wait_queue_head_t packet_list_wait;
261 spinlock_t packet_list_lock;
262 struct ohci1394_iso_tasklet iso_tasklet;
263 struct pci_pool *descriptor_pool, *packet_pool;
264
265 /* Streams at a host controller are chained through this field. */
266 struct list_head link;
267 struct amdtp_host *host;
268};
269
270struct amdtp_host {
271 struct hpsb_host *host;
272 struct ti_ohci *ohci;
273 struct list_head stream_list;
274 spinlock_t stream_list_lock;
275};
276
277static struct hpsb_highlevel amdtp_highlevel;
278
279
280/* FIXME: This doesn't belong here... */
281
282#define OHCI1394_CONTEXT_CYCLE_MATCH 0x80000000
283#define OHCI1394_CONTEXT_RUN 0x00008000
284#define OHCI1394_CONTEXT_WAKE 0x00001000
285#define OHCI1394_CONTEXT_DEAD 0x00000800
286#define OHCI1394_CONTEXT_ACTIVE 0x00000400
287
288static void ohci1394_start_it_ctx(struct ti_ohci *ohci, int ctx,
289 dma_addr_t first_cmd, int z, int cycle_match)
290{
291 reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1 << ctx);
292 reg_write(ohci, OHCI1394_IsoXmitCommandPtr + ctx * 16, first_cmd | z);
293 reg_write(ohci, OHCI1394_IsoXmitContextControlClear + ctx * 16, ~0);
294 wmb();
295 reg_write(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16,
296 OHCI1394_CONTEXT_CYCLE_MATCH | (cycle_match << 16) |
297 OHCI1394_CONTEXT_RUN);
298}
299
300static void ohci1394_wake_it_ctx(struct ti_ohci *ohci, int ctx)
301{
302 reg_write(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16,
303 OHCI1394_CONTEXT_WAKE);
304}
305
306static void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous)
307{
308 u32 control;
309 int wait;
310
311 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 1 << ctx);
312 reg_write(ohci, OHCI1394_IsoXmitContextControlClear + ctx * 16,
313 OHCI1394_CONTEXT_RUN);
314 wmb();
315
316 if (synchronous) {
317 for (wait = 0; wait < 5; wait++) {
318 control = reg_read(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16);
319 if ((control & OHCI1394_CONTEXT_ACTIVE) == 0)
320 break;
321
322 schedule_timeout_interruptible(1);
323 }
324 }
325}
326
327/* Note: we can test if free_packet_lists is empty without aquiring
328 * the packet_list_lock. The interrupt handler only adds to the free
329 * list, there is no race condition between testing the list non-empty
330 * and acquiring the lock.
331 */
332
333static struct packet_list *stream_get_free_packet_list(struct stream *s)
334{
335 struct packet_list *pl;
336 unsigned long flags;
337
338 if (list_empty(&s->free_packet_lists))
339 return NULL;
340
341 spin_lock_irqsave(&s->packet_list_lock, flags);
342 pl = list_entry(s->free_packet_lists.next, struct packet_list, link);
343 list_del(&pl->link);
344 spin_unlock_irqrestore(&s->packet_list_lock, flags);
345
346 return pl;
347}
348
349static void stream_start_dma(struct stream *s, struct packet_list *pl)
350{
351 u32 syt_cycle, cycle_count, start_cycle;
352
353 cycle_count = reg_read(s->host->ohci,
354 OHCI1394_IsochronousCycleTimer) >> 12;
355 syt_cycle = (pl->last_cycle_count - PACKET_LIST_SIZE + 1) & 0x0f;
356
357 /* We program the DMA controller to start transmission at
358 * least 17 cycles from now - this happens when the lower four
359 * bits of cycle_count is 0x0f and syt_cycle is 0, in this
360 * case the start cycle is cycle_count - 15 + 32. */
361 start_cycle = (cycle_count & ~0x0f) + 32 + syt_cycle;
362 if ((start_cycle & 0x1fff) >= 8000)
363 start_cycle = start_cycle - 8000 + 0x2000;
364
365 ohci1394_start_it_ctx(s->host->ohci, s->iso_tasklet.context,
366 pl->packets[0].db_bus, 3,
367 start_cycle & 0x7fff);
368}
369
370static void stream_put_dma_packet_list(struct stream *s,
371 struct packet_list *pl)
372{
373 unsigned long flags;
374 struct packet_list *prev;
375
376 /* Remember the cycle_count used for timestamping the last packet. */
377 pl->last_cycle_count = atomic_read(&s->cycle_count2) - 1;
378 pl->packets[PACKET_LIST_SIZE - 1].db->payload_desc.branch = 0;
379
380 spin_lock_irqsave(&s->packet_list_lock, flags);
381 list_add_tail(&pl->link, &s->dma_packet_lists);
382 spin_unlock_irqrestore(&s->packet_list_lock, flags);
383
384 prev = list_entry(pl->link.prev, struct packet_list, link);
385 if (pl->link.prev != &s->dma_packet_lists) {
386 struct packet *last = &prev->packets[PACKET_LIST_SIZE - 1];
387 last->db->payload_desc.branch = pl->packets[0].db_bus | 3;
388 last->db->header_desc.skip = pl->packets[0].db_bus | 3;
389 ohci1394_wake_it_ctx(s->host->ohci, s->iso_tasklet.context);
390 }
391 else
392 stream_start_dma(s, pl);
393}
394
395static void stream_shift_packet_lists(unsigned long l)
396{
397 struct stream *s = (struct stream *) l;
398 struct packet_list *pl;
399 struct packet *last;
400 int diff;
401
402 if (list_empty(&s->dma_packet_lists)) {
403 HPSB_ERR("empty dma_packet_lists in %s", __FUNCTION__);
404 return;
405 }
406
407 /* Now that we know the list is non-empty, we can get the head
408 * of the list without locking, because the process context
409 * only adds to the tail.
410 */
411 pl = list_entry(s->dma_packet_lists.next, struct packet_list, link);
412 last = &pl->packets[PACKET_LIST_SIZE - 1];
413
414 /* This is weird... if we stop dma processing in the middle of
415 * a packet list, the dma context immediately generates an
416 * interrupt if we enable it again later. This only happens
417 * when amdtp_release is interrupted while waiting for dma to
418 * complete, though. Anyway, we detect this by seeing that
419 * the status of the dma descriptor that we expected an
420 * interrupt from is still 0.
421 */
422 if (last->db->payload_desc.status == 0) {
423 HPSB_INFO("weird interrupt...");
424 return;
425 }
426
427 /* If the last descriptor block does not specify a branch
428 * address, we have a sample underflow.
429 */
430 if (last->db->payload_desc.branch == 0)
431 HPSB_INFO("FIXME: sample underflow...");
432
433 /* Here we check when (which cycle) the last packet was sent
434 * and compare it to what the iso packer was using at the
435 * time. If there is a mismatch, we adjust the cycle count in
436 * the iso packer. However, there are still up to
437 * MAX_PACKET_LISTS packet lists queued with bad time stamps,
438 * so we disable time stamp monitoring for the next
439 * MAX_PACKET_LISTS packet lists.
440 */
441 diff = (last->db->payload_desc.status - pl->last_cycle_count) & 0xf;
442 if (diff > 0 && s->stale_count == 0) {
443 atomic_add(diff, &s->cycle_count);
444 atomic_add(diff, &s->cycle_count2);
445 s->stale_count = MAX_PACKET_LISTS;
446 }
447
448 if (s->stale_count > 0)
449 s->stale_count--;
450
451 /* Finally, we move the packet list that was just processed
452 * back to the free list, and notify any waiters.
453 */
454 spin_lock(&s->packet_list_lock);
455 list_del(&pl->link);
456 list_add_tail(&pl->link, &s->free_packet_lists);
457 spin_unlock(&s->packet_list_lock);
458
459 wake_up_interruptible(&s->packet_list_wait);
460}
461
462static struct packet *stream_current_packet(struct stream *s)
463{
464 if (s->current_packet_list == NULL &&
465 (s->current_packet_list = stream_get_free_packet_list(s)) == NULL)
466 return NULL;
467
468 return &s->current_packet_list->packets[s->current_packet];
469}
470
471static void stream_queue_packet(struct stream *s)
472{
473 s->current_packet++;
474 if (s->current_packet == PACKET_LIST_SIZE) {
475 stream_put_dma_packet_list(s, s->current_packet_list);
476 s->current_packet_list = NULL;
477 s->current_packet = 0;
478 }
479}
480
481/* Integer fractional math. When we transmit a 44k1Hz signal we must
482 * send 5 41/80 samples per isochronous cycle, as these occur 8000
483 * times a second. Of course, we must send an integral number of
484 * samples in a packet, so we use the integer math to alternate
485 * between sending 5 and 6 samples per packet.
486 */
487
488static void fraction_init(struct fraction *f, int numerator, int denominator)
489{
490 f->integer = numerator / denominator;
491 f->numerator = numerator % denominator;
492 f->denominator = denominator;
493}
494
495static __inline__ void fraction_add(struct fraction *dst,
496 struct fraction *src1,
497 struct fraction *src2)
498{
499 /* assert: src1->denominator == src2->denominator */
500
501 int sum, denom;
502
503 /* We use these two local variables to allow gcc to optimize
504 * the division and the modulo into only one division. */
505
506 sum = src1->numerator + src2->numerator;
507 denom = src1->denominator;
508 dst->integer = src1->integer + src2->integer + sum / denom;
509 dst->numerator = sum % denom;
510 dst->denominator = denom;
511}
512
513static __inline__ void fraction_sub_int(struct fraction *dst,
514 struct fraction *src, int integer)
515{
516 dst->integer = src->integer - integer;
517 dst->numerator = src->numerator;
518 dst->denominator = src->denominator;
519}
520
521static __inline__ int fraction_floor(struct fraction *frac)
522{
523 return frac->integer;
524}
525
526static __inline__ int fraction_ceil(struct fraction *frac)
527{
528 return frac->integer + (frac->numerator > 0 ? 1 : 0);
529}
530
531static void packet_initialize(struct packet *p, struct packet *next)
532{
533 /* Here we initialize the dma descriptor block for
534 * transferring one iso packet. We use two descriptors per
535 * packet: an OUTPUT_MORE_IMMMEDIATE descriptor for the
536 * IEEE1394 iso packet header and an OUTPUT_LAST descriptor
537 * for the payload.
538 */
539
540 p->db->header_desc.control =
541 DMA_CTL_OUTPUT_MORE | DMA_CTL_IMMEDIATE | 8;
542
543 if (next) {
544 p->db->payload_desc.control =
545 DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH;
546 p->db->payload_desc.branch = next->db_bus | 3;
547 p->db->header_desc.skip = next->db_bus | 3;
548 }
549 else {
550 p->db->payload_desc.control =
551 DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH |
552 DMA_CTL_UPDATE | DMA_CTL_IRQ;
553 p->db->payload_desc.branch = 0;
554 p->db->header_desc.skip = 0;
555 }
556 p->db->payload_desc.data_address = p->payload_bus;
557 p->db->payload_desc.status = 0;
558}
559
560static struct packet_list *packet_list_alloc(struct stream *s)
561{
562 int i;
563 struct packet_list *pl;
564 struct packet *next;
565
566 pl = kmalloc(sizeof *pl, SLAB_KERNEL);
567 if (pl == NULL)
568 return NULL;
569
570 for (i = 0; i < PACKET_LIST_SIZE; i++) {
571 struct packet *p = &pl->packets[i];
572 p->db = pci_pool_alloc(s->descriptor_pool, SLAB_KERNEL,
573 &p->db_bus);
574 p->payload = pci_pool_alloc(s->packet_pool, SLAB_KERNEL,
575 &p->payload_bus);
576 }
577
578 for (i = 0; i < PACKET_LIST_SIZE; i++) {
579 if (i < PACKET_LIST_SIZE - 1)
580 next = &pl->packets[i + 1];
581 else
582 next = NULL;
583 packet_initialize(&pl->packets[i], next);
584 }
585
586 return pl;
587}
588
589static void packet_list_free(struct packet_list *pl, struct stream *s)
590{
591 int i;
592
593 for (i = 0; i < PACKET_LIST_SIZE; i++) {
594 struct packet *p = &pl->packets[i];
595 pci_pool_free(s->descriptor_pool, p->db, p->db_bus);
596 pci_pool_free(s->packet_pool, p->payload, p->payload_bus);
597 }
598 kfree(pl);
599}
600
601static struct buffer *buffer_alloc(int size)
602{
603 struct buffer *b;
604
605 b = kmalloc(sizeof *b + size, SLAB_KERNEL);
606 if (b == NULL)
607 return NULL;
608 b->head = 0;
609 b->tail = 0;
610 b->length = 0;
611 b->size = size;
612
613 return b;
614}
615
616static unsigned char *buffer_get_bytes(struct buffer *buffer, int size)
617{
618 unsigned char *p;
619
620 if (buffer->head + size > buffer->size)
621 BUG();
622
623 p = &buffer->data[buffer->head];
624 buffer->head += size;
625 if (buffer->head == buffer->size)
626 buffer->head = 0;
627 buffer->length -= size;
628
629 return p;
630}
631
632static unsigned char *buffer_put_bytes(struct buffer *buffer,
633 size_t max, size_t *actual)
634{
635 size_t length;
636 unsigned char *p;
637
638 p = &buffer->data[buffer->tail];
639 length = min(buffer->size - buffer->length, max);
640 if (buffer->tail + length < buffer->size) {
641 *actual = length;
642 buffer->tail += length;
643 }
644 else {
645 *actual = buffer->size - buffer->tail;
646 buffer->tail = 0;
647 }
648
649 buffer->length += *actual;
650 return p;
651}
652
653static u32 get_iec958_header_bits(struct stream *s, int sub_frame, u32 sample)
654{
655 int csi, parity, shift;
656 int block_start;
657 u32 bits;
658
659 switch (s->iec958_frame_count) {
660 case 1:
661 csi = s->format == AMDTP_FORMAT_IEC958_AC3;
662 break;
663 case 2:
664 case 9:
665 csi = 1;
666 break;
667 case 24 ... 27:
668 csi = (s->iec958_rate_code >> (27 - s->iec958_frame_count)) & 0x01;
669 break;
670 default:
671 csi = 0;
672 break;
673 }
674
675 block_start = (s->iec958_frame_count == 0 && sub_frame == 0);
676
677 /* The parity bit is the xor of the sample bits and the
678 * channel status info bit. */
679 for (shift = 16, parity = sample ^ csi; shift > 0; shift >>= 1)
680 parity ^= (parity >> shift);
681
682 bits = (block_start << 5) | /* Block start bit */
683 ((sub_frame == 0) << 4) | /* Subframe bit */
684 ((parity & 1) << 3) | /* Parity bit */
685 (csi << 2); /* Channel status info bit */
686
687 return bits;
688}
689
690static u32 get_header_bits(struct stream *s, int sub_frame, u32 sample)
691{
692 switch (s->format) {
693 case AMDTP_FORMAT_IEC958_PCM:
694 case AMDTP_FORMAT_IEC958_AC3:
695 return get_iec958_header_bits(s, sub_frame, sample);
696
697 case AMDTP_FORMAT_RAW:
698 return 0x40;
699
700 default:
701 return 0;
702 }
703}
704
705static void fill_payload_le16(struct stream *s, quadlet_t *data, int nevents)
706{
707 quadlet_t *event, sample, bits;
708 unsigned char *p;
709 int i, j;
710
711 for (i = 0, event = data; i < nevents; i++) {
712
713 for (j = 0; j < s->dimension; j++) {
714 p = buffer_get_bytes(s->input, 2);
715 sample = (p[1] << 16) | (p[0] << 8);
716 bits = get_header_bits(s, j, sample);
717 event[j] = cpu_to_be32((bits << 24) | sample);
718 }
719
720 event += s->dimension;
721 if (++s->iec958_frame_count == 192)
722 s->iec958_frame_count = 0;
723 }
724}
725
726static void fill_packet(struct stream *s, struct packet *packet, int nevents)
727{
728 int syt_index, syt, size;
729 u32 control;
730
731 size = (nevents * s->dimension + 2) * sizeof(quadlet_t);
732
733 /* Update DMA descriptors */
734 packet->db->payload_desc.status = 0;
735 control = packet->db->payload_desc.control & 0xffff0000;
736 packet->db->payload_desc.control = control | size;
737
738 /* Fill IEEE1394 headers */
739 packet->db->header_desc.header[0] =
740 (IEEE1394_SPEED_100 << 16) | (0x01 << 14) |
741 (s->iso_channel << 8) | (TCODE_ISO_DATA << 4);
742 packet->db->header_desc.header[1] = size << 16;
743
744 /* Calculate synchronization timestamp (syt). First we
745 * determine syt_index, that is, the index in the packet of
746 * the sample for which the timestamp is valid. */
747 syt_index = (s->syt_interval - s->dbc) & (s->syt_interval - 1);
748 if (syt_index < nevents) {
749 syt = ((atomic_read(&s->cycle_count) << 12) |
750 s->cycle_offset.integer) & 0xffff;
751 fraction_add(&s->cycle_offset,
752 &s->cycle_offset, &s->ticks_per_syt_offset);
753
754 /* This next addition should be modulo 8000 (0x1f40),
755 * but we only use the lower 4 bits of cycle_count, so
756 * we don't need the modulo. */
757 atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count);
758 s->cycle_offset.integer %= 3072;
759 }
760 else
761 syt = 0xffff;
762
763 atomic_inc(&s->cycle_count2);
764
765 /* Fill cip header */
766 packet->payload->eoh0 = 0;
767 packet->payload->sid = s->host->host->node_id & 0x3f;
768 packet->payload->dbs = s->dimension;
769 packet->payload->fn = 0;
770 packet->payload->qpc = 0;
771 packet->payload->sph = 0;
772 packet->payload->reserved = 0;
773 packet->payload->dbc = s->dbc;
774 packet->payload->eoh1 = 2;
775 packet->payload->fmt = FMT_AMDTP;
776 packet->payload->fdf = s->fdf;
777 packet->payload->syt = cpu_to_be16(syt);
778
779 switch (s->sample_format) {
780 case AMDTP_INPUT_LE16:
781 fill_payload_le16(s, packet->payload->data, nevents);
782 break;
783 }
784
785 s->dbc += nevents;
786}
787
788static void stream_flush(struct stream *s)
789{
790 struct packet *p;
791 int nevents;
792 struct fraction next;
793
794 /* The AMDTP specifies two transmission modes: blocking and
795 * non-blocking. In blocking mode you always transfer
796 * syt_interval or zero samples, whereas in non-blocking mode
797 * you send as many samples as you have available at transfer
798 * time.
799 *
800 * The fraction samples_per_cycle specifies the number of
801 * samples that become available per cycle. We add this to
802 * the fraction ready_samples, which specifies the number of
803 * leftover samples from the previous transmission. The sum,
804 * stored in the fraction next, specifies the number of
805 * samples available for transmission, and from this we
806 * determine the number of samples to actually transmit.
807 */
808
809 while (1) {
810 fraction_add(&next, &s->ready_samples, &s->samples_per_cycle);
811 if (s->mode == AMDTP_MODE_BLOCKING) {
812 if (fraction_floor(&next) >= s->syt_interval)
813 nevents = s->syt_interval;
814 else
815 nevents = 0;
816 }
817 else
818 nevents = fraction_floor(&next);
819
820 p = stream_current_packet(s);
821 if (s->input->length < nevents * s->dimension * 2 || p == NULL)
822 break;
823
824 fill_packet(s, p, nevents);
825 stream_queue_packet(s);
826
827 /* Now that we have successfully queued the packet for
828 * transmission, we update the fraction ready_samples. */
829 fraction_sub_int(&s->ready_samples, &next, nevents);
830 }
831}
832
833static int stream_alloc_packet_lists(struct stream *s)
834{
835 int max_nevents, max_packet_size, i;
836
837 if (s->mode == AMDTP_MODE_BLOCKING)
838 max_nevents = s->syt_interval;
839 else
840 max_nevents = fraction_ceil(&s->samples_per_cycle);
841
842 max_packet_size = max_nevents * s->dimension * 4 + 8;
843 s->packet_pool = pci_pool_create("packet pool", s->host->ohci->dev,
844 max_packet_size, 0, 0);
845
846 if (s->packet_pool == NULL)
847 return -1;
848
849 INIT_LIST_HEAD(&s->free_packet_lists);
850 INIT_LIST_HEAD(&s->dma_packet_lists);
851 for (i = 0; i < MAX_PACKET_LISTS; i++) {
852 struct packet_list *pl = packet_list_alloc(s);
853 if (pl == NULL)
854 break;
855 list_add_tail(&pl->link, &s->free_packet_lists);
856 }
857
858 return i < MAX_PACKET_LISTS ? -1 : 0;
859}
860
861static void stream_free_packet_lists(struct stream *s)
862{
863 struct packet_list *packet_l, *packet_l_next;
864
865 if (s->current_packet_list != NULL)
866 packet_list_free(s->current_packet_list, s);
867 list_for_each_entry_safe(packet_l, packet_l_next, &s->dma_packet_lists, link)
868 packet_list_free(packet_l, s);
869 list_for_each_entry_safe(packet_l, packet_l_next, &s->free_packet_lists, link)
870 packet_list_free(packet_l, s);
871 if (s->packet_pool != NULL)
872 pci_pool_destroy(s->packet_pool);
873
874 s->current_packet_list = NULL;
875 INIT_LIST_HEAD(&s->free_packet_lists);
876 INIT_LIST_HEAD(&s->dma_packet_lists);
877 s->packet_pool = NULL;
878}
879
880static void plug_update(struct cmp_pcr *plug, void *data)
881{
882 struct stream *s = data;
883
884 HPSB_INFO("plug update: p2p_count=%d, channel=%d",
885 plug->p2p_count, plug->channel);
886 s->iso_channel = plug->channel;
887 if (plug->p2p_count > 0) {
888 struct packet_list *pl;
889
890 pl = list_entry(s->dma_packet_lists.next, struct packet_list, link);
891 stream_start_dma(s, pl);
892 }
893 else {
894 ohci1394_stop_it_ctx(s->host->ohci, s->iso_tasklet.context, 0);
895 }
896}
897
898static int stream_configure(struct stream *s, int cmd, struct amdtp_ioctl *cfg)
899{
900 const int transfer_delay = 9000;
901
902 if (cfg->format <= AMDTP_FORMAT_IEC958_AC3)
903 s->format = cfg->format;
904 else
905 return -EINVAL;
906
907 switch (cfg->rate) {
908 case 32000:
909 s->syt_interval = 8;
910 s->fdf = FDF_SFC_32KHZ;
911 s->iec958_rate_code = 0x0c;
912 break;
913 case 44100:
914 s->syt_interval = 8;
915 s->fdf = FDF_SFC_44K1HZ;
916 s->iec958_rate_code = 0x00;
917 break;
918 case 48000:
919 s->syt_interval = 8;
920 s->fdf = FDF_SFC_48KHZ;
921 s->iec958_rate_code = 0x04;
922 break;
923 case 88200:
924 s->syt_interval = 16;
925 s->fdf = FDF_SFC_88K2HZ;
926 s->iec958_rate_code = 0x00;
927 break;
928 case 96000:
929 s->syt_interval = 16;
930 s->fdf = FDF_SFC_96KHZ;
931 s->iec958_rate_code = 0x00;
932 break;
933 case 176400:
934 s->syt_interval = 32;
935 s->fdf = FDF_SFC_176K4HZ;
936 s->iec958_rate_code = 0x00;
937 break;
938 case 192000:
939 s->syt_interval = 32;
940 s->fdf = FDF_SFC_192KHZ;
941 s->iec958_rate_code = 0x00;
942 break;
943
944 default:
945 return -EINVAL;
946 }
947
948 s->rate = cfg->rate;
949 fraction_init(&s->samples_per_cycle, s->rate, 8000);
950 fraction_init(&s->ready_samples, 0, 8000);
951
952 /* The ticks_per_syt_offset is initialized to the number of
953 * ticks between syt_interval events. The number of ticks per
954 * second is 24.576e6, so the number of ticks between
955 * syt_interval events is 24.576e6 * syt_interval / rate.
956 */
957 fraction_init(&s->ticks_per_syt_offset,
958 24576000 * s->syt_interval, s->rate);
959 fraction_init(&s->cycle_offset, (transfer_delay % 3072) * s->rate, s->rate);
960 atomic_set(&s->cycle_count, transfer_delay / 3072);
961 atomic_set(&s->cycle_count2, 0);
962
963 s->mode = cfg->mode;
964 s->sample_format = AMDTP_INPUT_LE16;
965
966 /* When using the AM824 raw subformat we can stream signals of
967 * any dimension. The IEC958 subformat, however, only
968 * supports 2 channels.
969 */
970 if (s->format == AMDTP_FORMAT_RAW || cfg->dimension == 2)
971 s->dimension = cfg->dimension;
972 else
973 return -EINVAL;
974
975 if (s->opcr != NULL) {
976 cmp_unregister_opcr(s->host->host, s->opcr);
977 s->opcr = NULL;
978 }
979
980 switch(cmd) {
981 case AMDTP_IOC_PLUG:
982 s->opcr = cmp_register_opcr(s->host->host, cfg->u.plug,
983 /*payload*/ 12, plug_update, s);
984 if (s->opcr == NULL)
985 return -EINVAL;
986 s->iso_channel = s->opcr->channel;
987 break;
988
989 case AMDTP_IOC_CHANNEL:
990 if (cfg->u.channel >= 0 && cfg->u.channel < 64)
991 s->iso_channel = cfg->u.channel;
992 else
993 return -EINVAL;
994 break;
995 }
996
997 /* The ioctl settings were all valid, so we realloc the packet
998 * lists to make sure the packet size is big enough.
999 */
1000 if (s->packet_pool != NULL)
1001 stream_free_packet_lists(s);
1002
1003 if (stream_alloc_packet_lists(s) < 0) {
1004 stream_free_packet_lists(s);
1005 return -ENOMEM;
1006 }
1007
1008 return 0;
1009}
1010
1011static struct stream *stream_alloc(struct amdtp_host *host)
1012{
1013 struct stream *s;
1014 unsigned long flags;
1015
1016 s = kmalloc(sizeof(struct stream), SLAB_KERNEL);
1017 if (s == NULL)
1018 return NULL;
1019
1020 memset(s, 0, sizeof(struct stream));
1021 s->host = host;
1022
1023 s->input = buffer_alloc(BUFFER_SIZE);
1024 if (s->input == NULL) {
1025 kfree(s);
1026 return NULL;
1027 }
1028
1029 s->descriptor_pool = pci_pool_create("descriptor pool", host->ohci->dev,
1030 sizeof(struct descriptor_block),
1031 16, 0);
1032
1033 if (s->descriptor_pool == NULL) {
1034 kfree(s->input);
1035 kfree(s);
1036 return NULL;
1037 }
1038
1039 INIT_LIST_HEAD(&s->free_packet_lists);
1040 INIT_LIST_HEAD(&s->dma_packet_lists);
1041
1042 init_waitqueue_head(&s->packet_list_wait);
1043 spin_lock_init(&s->packet_list_lock);
1044
1045 ohci1394_init_iso_tasklet(&s->iso_tasklet, OHCI_ISO_TRANSMIT,
1046 stream_shift_packet_lists,
1047 (unsigned long) s);
1048
1049 if (ohci1394_register_iso_tasklet(host->ohci, &s->iso_tasklet) < 0) {
1050 pci_pool_destroy(s->descriptor_pool);
1051 kfree(s->input);
1052 kfree(s);
1053 return NULL;
1054 }
1055
1056 spin_lock_irqsave(&host->stream_list_lock, flags);
1057 list_add_tail(&s->link, &host->stream_list);
1058 spin_unlock_irqrestore(&host->stream_list_lock, flags);
1059
1060 return s;
1061}
1062
1063static void stream_free(struct stream *s)
1064{
1065 unsigned long flags;
1066
1067 /* Stop the DMA. We wait for the dma packet list to become
1068 * empty and let the dma controller run out of programs. This
1069 * seems to be more reliable than stopping it directly, since
1070 * that sometimes generates an it transmit interrupt if we
1071 * later re-enable the context.
1072 */
1073 wait_event_interruptible(s->packet_list_wait,
1074 list_empty(&s->dma_packet_lists));
1075
1076 ohci1394_stop_it_ctx(s->host->ohci, s->iso_tasklet.context, 1);
1077 ohci1394_unregister_iso_tasklet(s->host->ohci, &s->iso_tasklet);
1078
1079 if (s->opcr != NULL)
1080 cmp_unregister_opcr(s->host->host, s->opcr);
1081
1082 spin_lock_irqsave(&s->host->stream_list_lock, flags);
1083 list_del(&s->link);
1084 spin_unlock_irqrestore(&s->host->stream_list_lock, flags);
1085
1086 kfree(s->input);
1087
1088 stream_free_packet_lists(s);
1089 pci_pool_destroy(s->descriptor_pool);
1090
1091 kfree(s);
1092}
1093
1094/* File operations */
1095
1096static ssize_t amdtp_write(struct file *file, const char __user *buffer, size_t count,
1097 loff_t *offset_is_ignored)
1098{
1099 struct stream *s = file->private_data;
1100 unsigned char *p;
1101 int i;
1102 size_t length;
1103
1104 if (s->packet_pool == NULL)
1105 return -EBADFD;
1106
1107 /* Fill the circular buffer from the input buffer and call the
1108 * iso packer when the buffer is full. The iso packer may
1109 * leave bytes in the buffer for two reasons: either the
1110 * remaining bytes wasn't enough to build a new packet, or
1111 * there were no free packet lists. In the first case we
1112 * re-fill the buffer and call the iso packer again or return
1113 * if we used all the data from userspace. In the second
1114 * case, the wait_event_interruptible will block until the irq
1115 * handler frees a packet list.
1116 */
1117
1118 for (i = 0; i < count; i += length) {
1119 p = buffer_put_bytes(s->input, count - i, &length);
1120 if (copy_from_user(p, buffer + i, length))
1121 return -EFAULT;
1122 if (s->input->length < s->input->size)
1123 continue;
1124
1125 stream_flush(s);
1126
1127 if (s->current_packet_list != NULL)
1128 continue;
1129
1130 if (file->f_flags & O_NONBLOCK)
1131 return i + length > 0 ? i + length : -EAGAIN;
1132
1133 if (wait_event_interruptible(s->packet_list_wait,
1134 !list_empty(&s->free_packet_lists)))
1135 return -EINTR;
1136 }
1137
1138 return count;
1139}
1140
1141static long amdtp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1142{
1143 struct stream *s = file->private_data;
1144 struct amdtp_ioctl cfg;
1145 int err;
1146 lock_kernel();
1147 switch(cmd)
1148 {
1149 case AMDTP_IOC_PLUG:
1150 case AMDTP_IOC_CHANNEL:
1151 if (copy_from_user(&cfg, (struct amdtp_ioctl __user *) arg, sizeof cfg))
1152 err = -EFAULT;
1153 else
1154 err = stream_configure(s, cmd, &cfg);
1155 break;
1156
1157 default:
1158 err = -EINVAL;
1159 break;
1160 }
1161 unlock_kernel();
1162 return err;
1163}
1164
1165static unsigned int amdtp_poll(struct file *file, poll_table *pt)
1166{
1167 struct stream *s = file->private_data;
1168
1169 poll_wait(file, &s->packet_list_wait, pt);
1170
1171 if (!list_empty(&s->free_packet_lists))
1172 return POLLOUT | POLLWRNORM;
1173 else
1174 return 0;
1175}
1176
1177static int amdtp_open(struct inode *inode, struct file *file)
1178{
1179 struct amdtp_host *host;
1180 int i = ieee1394_file_to_instance(file);
1181
1182 host = hpsb_get_hostinfo_bykey(&amdtp_highlevel, i);
1183 if (host == NULL)
1184 return -ENODEV;
1185
1186 file->private_data = stream_alloc(host);
1187 if (file->private_data == NULL)
1188 return -ENOMEM;
1189
1190 return 0;
1191}
1192
1193static int amdtp_release(struct inode *inode, struct file *file)
1194{
1195 struct stream *s = file->private_data;
1196
1197 stream_free(s);
1198
1199 return 0;
1200}
1201
1202static struct cdev amdtp_cdev;
1203static struct file_operations amdtp_fops =
1204{
1205 .owner = THIS_MODULE,
1206 .write = amdtp_write,
1207 .poll = amdtp_poll,
1208 .unlocked_ioctl = amdtp_ioctl,
1209 .compat_ioctl = amdtp_ioctl, /* All amdtp ioctls are compatible */
1210 .open = amdtp_open,
1211 .release = amdtp_release
1212};
1213
1214/* IEEE1394 Subsystem functions */
1215
1216static void amdtp_add_host(struct hpsb_host *host)
1217{
1218 struct amdtp_host *ah;
1219 int minor;
1220
1221 if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME) != 0)
1222 return;
1223
1224 ah = hpsb_create_hostinfo(&amdtp_highlevel, host, sizeof(*ah));
1225 if (!ah) {
1226 HPSB_ERR("amdtp: Unable able to alloc hostinfo");
1227 return;
1228 }
1229
1230 ah->host = host;
1231 ah->ohci = host->hostdata;
1232
1233 hpsb_set_hostinfo_key(&amdtp_highlevel, host, ah->host->id);
1234
1235 minor = IEEE1394_MINOR_BLOCK_AMDTP * 16 + ah->host->id;
1236
1237 INIT_LIST_HEAD(&ah->stream_list);
1238 spin_lock_init(&ah->stream_list_lock);
1239
1240 devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor),
1241 S_IFCHR|S_IRUSR|S_IWUSR, "amdtp/%d", ah->host->id);
1242}
1243
1244static void amdtp_remove_host(struct hpsb_host *host)
1245{
1246 struct amdtp_host *ah = hpsb_get_hostinfo(&amdtp_highlevel, host);
1247
1248 if (ah)
1249 devfs_remove("amdtp/%d", ah->host->id);
1250
1251 return;
1252}
1253
1254static struct hpsb_highlevel amdtp_highlevel = {
1255 .name = "amdtp",
1256 .add_host = amdtp_add_host,
1257 .remove_host = amdtp_remove_host,
1258};
1259
1260/* Module interface */
1261
1262MODULE_AUTHOR("Kristian Hogsberg <hogsberg@users.sf.net>");
1263MODULE_DESCRIPTION("Driver for Audio & Music Data Transmission Protocol "
1264 "on OHCI boards.");
1265MODULE_SUPPORTED_DEVICE("amdtp");
1266MODULE_LICENSE("GPL");
1267
1268static int __init amdtp_init_module (void)
1269{
1270 cdev_init(&amdtp_cdev, &amdtp_fops);
1271 amdtp_cdev.owner = THIS_MODULE;
1272 kobject_set_name(&amdtp_cdev.kobj, "amdtp");
1273 if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) {
1274 HPSB_ERR("amdtp: unable to add char device");
1275 return -EIO;
1276 }
1277
1278 devfs_mk_dir("amdtp");
1279
1280 hpsb_register_highlevel(&amdtp_highlevel);
1281
1282 HPSB_INFO("Loaded AMDTP driver");
1283
1284 return 0;
1285}
1286
1287static void __exit amdtp_exit_module (void)
1288{
1289 hpsb_unregister_highlevel(&amdtp_highlevel);
1290 devfs_remove("amdtp");
1291 cdev_del(&amdtp_cdev);
1292
1293 HPSB_INFO("Unloaded AMDTP driver");
1294}
1295
1296module_init(amdtp_init_module);
1297module_exit(amdtp_exit_module);
diff --git a/drivers/ieee1394/amdtp.h b/drivers/ieee1394/amdtp.h
deleted file mode 100644
index 531f28e3ab50..000000000000
--- a/drivers/ieee1394/amdtp.h
+++ /dev/null
@@ -1,84 +0,0 @@
1/* -*- c-basic-offset: 8 -*- */
2
3#ifndef __AMDTP_H
4#define __AMDTP_H
5
6#include <asm/types.h>
7#include "ieee1394-ioctl.h"
8
9/* The userspace interface for the Audio & Music Data Transmission
10 * Protocol driver is really simple. First, open /dev/amdtp, use the
11 * ioctl to configure format, rate, dimension and either plug or
12 * channel, then start writing samples.
13 *
14 * The formats supported by the driver are listed below.
15 * AMDTP_FORMAT_RAW corresponds to the AM824 raw format, which can
16 * carry any number of channels, so use this if you're streaming
17 * multichannel audio. The AMDTP_FORMAT_IEC958_PCM corresponds to the
18 * AM824 IEC958 encapsulation without the IEC958 data bit set, using
19 * AMDTP_FORMAT_IEC958_AC3 will transmit the samples with the data bit
20 * set, suitable for transmitting compressed AC-3 audio.
21 *
22 * The rate field specifies the transmission rate; supported values
23 * are 32000, 44100, 48000, 88200, 96000, 176400 and 192000.
24 *
25 * The dimension field specifies the dimension of the signal, that is,
26 * the number of audio channels. Only AMDTP_FORMAT_RAW supports
27 * settings greater than 2.
28 *
29 * The mode field specifies which transmission mode to use. The AMDTP
30 * specifies two different transmission modes: blocking and
31 * non-blocking. The blocking transmission mode always send a fixed
32 * number of samples, typically 8, 16 or 32. To exactly match the
33 * transmission rate, the driver alternates between sending empty and
34 * non-empty packets. In non-blocking mode, the driver transmits as
35 * small packets as possible. For example, for a transmission rate of
36 * 44100Hz, the driver should send 5 41/80 samples in every cycle, but
37 * this is not possible so instead the driver alternates between
38 * sending 5 and 6 samples.
39 *
40 * The last thing to specify is either the isochronous channel to use
41 * or the output plug to connect to. If you know what channel the
42 * destination device will listen on, you can specify the channel
43 * directly and use the AMDTP_IOC_CHANNEL ioctl. However, if the
44 * destination device chooses the channel and uses the IEC61883-1 plug
45 * mechanism, you can specify an output plug to connect to. The
46 * driver will pick up the channel number from the plug once the
47 * destination device locks the output plug control register. In this
48 * case set the plug field and use the AMDTP_IOC_PLUG ioctl.
49 *
50 * Having configured the interface, the driver now accepts writes of
51 * regular 16 bit signed little endian samples, with the channels
52 * interleaved. For example, 4 channels would look like:
53 *
54 * | sample 0 | sample 1 ...
55 * | ch. 0 | ch. 1 | ch. 2 | ch. 3 | ch. 0 | ...
56 * | lsb | msb | lsb | msb | lsb | msb | lsb | msb | lsb | msb | ...
57 *
58 */
59
60enum {
61 AMDTP_FORMAT_RAW,
62 AMDTP_FORMAT_IEC958_PCM,
63 AMDTP_FORMAT_IEC958_AC3
64};
65
66enum {
67 AMDTP_MODE_BLOCKING,
68 AMDTP_MODE_NON_BLOCKING,
69};
70
71enum {
72 AMDTP_INPUT_LE16,
73 AMDTP_INPUT_BE16,
74};
75
76struct amdtp_ioctl {
77 __u32 format;
78 __u32 rate;
79 __u32 dimension;
80 __u32 mode;
81 union { __u32 channel; __u32 plug; } u;
82};
83
84#endif /* __AMDTP_H */
diff --git a/drivers/ieee1394/cmp.c b/drivers/ieee1394/cmp.c
deleted file mode 100644
index 69aed26e83a1..000000000000
--- a/drivers/ieee1394/cmp.c
+++ /dev/null
@@ -1,311 +0,0 @@
1/* -*- c-basic-offset: 8 -*-
2 *
3 * cmp.c - Connection Management Procedures
4 * Copyright (C) 2001 Kristian Høgsberg
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21/* TODO
22 * ----
23 *
24 * - Implement IEC61883-1 output plugs and connection management.
25 * This should probably be part of the general subsystem, as it could
26 * be shared with dv1394.
27 *
28 * - Add IEC61883 unit directory when loading this module. This
29 * requires a run-time changeable config rom.
30 */
31
32#include <linux/module.h>
33#include <linux/list.h>
34#include <linux/sched.h>
35#include <linux/types.h>
36#include <linux/wait.h>
37#include <linux/interrupt.h>
38
39#include "hosts.h"
40#include "highlevel.h"
41#include "ieee1394.h"
42#include "ieee1394_core.h"
43#include "cmp.h"
44
45struct plug {
46 union {
47 struct cmp_pcr pcr;
48 quadlet_t quadlet;
49 } u;
50 void (*update)(struct cmp_pcr *plug, void *data);
51 void *data;
52};
53
54struct cmp_host {
55 struct hpsb_host *host;
56
57 union {
58 struct cmp_mpr ompr;
59 quadlet_t ompr_quadlet;
60 } u;
61 struct plug opcr[2];
62
63 union {
64 struct cmp_mpr impr;
65 quadlet_t impr_quadlet;
66 } v;
67 struct plug ipcr[2];
68};
69
70enum {
71 CMP_P2P_CONNECTION,
72 CMP_BC_CONNECTION
73};
74
75#define CSR_PCR_MAP 0x900
76#define CSR_PCR_MAP_END 0x9fc
77
78static struct hpsb_highlevel cmp_highlevel;
79
80static void cmp_add_host(struct hpsb_host *host);
81static void cmp_host_reset(struct hpsb_host *host);
82static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf,
83 u64 addr, size_t length, u16 flags);
84static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
85 u64 addr, quadlet_t data, quadlet_t arg, int extcode, u16 flags);
86
87static struct hpsb_highlevel cmp_highlevel = {
88 .name = "cmp",
89 .add_host = cmp_add_host,
90 .host_reset = cmp_host_reset,
91};
92
93static struct hpsb_address_ops pcr_ops = {
94 .read = pcr_read,
95 .lock = pcr_lock,
96};
97
98
99struct cmp_pcr *
100cmp_register_opcr(struct hpsb_host *host, int opcr_number, int payload,
101 void (*update)(struct cmp_pcr *pcr, void *data),
102 void *data)
103{
104 struct cmp_host *ch;
105 struct plug *plug;
106
107 ch = hpsb_get_hostinfo(&cmp_highlevel, host);
108
109 if (opcr_number >= ch->u.ompr.nplugs ||
110 ch->opcr[opcr_number].update != NULL)
111 return NULL;
112
113 plug = &ch->opcr[opcr_number];
114 plug->u.pcr.online = 1;
115 plug->u.pcr.bcast_count = 0;
116 plug->u.pcr.p2p_count = 0;
117 plug->u.pcr.overhead = 0;
118 plug->u.pcr.payload = payload;
119 plug->update = update;
120 plug->data = data;
121
122 return &plug->u.pcr;
123}
124
125void cmp_unregister_opcr(struct hpsb_host *host, struct cmp_pcr *opcr)
126{
127 struct cmp_host *ch;
128 struct plug *plug;
129
130 ch = hpsb_get_hostinfo(&cmp_highlevel, host);
131 plug = (struct plug *)opcr;
132 if (plug - ch->opcr >= ch->u.ompr.nplugs) BUG();
133
134 plug->u.pcr.online = 0;
135 plug->update = NULL;
136}
137
138static void reset_plugs(struct cmp_host *ch)
139{
140 int i;
141
142 ch->u.ompr.non_persistent_ext = 0xff;
143 for (i = 0; i < ch->u.ompr.nplugs; i++) {
144 ch->opcr[i].u.pcr.bcast_count = 0;
145 ch->opcr[i].u.pcr.p2p_count = 0;
146 ch->opcr[i].u.pcr.overhead = 0;
147 }
148}
149
150static void cmp_add_host(struct hpsb_host *host)
151{
152 struct cmp_host *ch = hpsb_create_hostinfo(&cmp_highlevel, host, sizeof (*ch));
153
154 if (ch == NULL) {
155 HPSB_ERR("Failed to allocate cmp_host");
156 return;
157 }
158
159 hpsb_register_addrspace(&cmp_highlevel, host, &pcr_ops,
160 CSR_REGISTER_BASE + CSR_PCR_MAP,
161 CSR_REGISTER_BASE + CSR_PCR_MAP_END);
162
163 ch->host = host;
164 ch->u.ompr.rate = IEEE1394_SPEED_100;
165 ch->u.ompr.bcast_channel_base = 63;
166 ch->u.ompr.nplugs = 2;
167
168 reset_plugs(ch);
169}
170
171static void cmp_host_reset(struct hpsb_host *host)
172{
173 struct cmp_host *ch;
174
175 ch = hpsb_get_hostinfo(&cmp_highlevel, host);
176 if (ch == NULL) {
177 HPSB_ERR("cmp: Tried to reset unknown host");
178 return;
179 }
180
181 reset_plugs(ch);
182}
183
184static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf,
185 u64 addr, size_t length, u16 flags)
186{
187 int csraddr = addr - CSR_REGISTER_BASE;
188 int plug;
189 struct cmp_host *ch;
190
191 if (length != 4)
192 return RCODE_TYPE_ERROR;
193
194 ch = hpsb_get_hostinfo(&cmp_highlevel, host);
195 if (csraddr == 0x900) {
196 *buf = cpu_to_be32(ch->u.ompr_quadlet);
197 return RCODE_COMPLETE;
198 }
199 else if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) {
200 plug = (csraddr - 0x904) / 4;
201 *buf = cpu_to_be32(ch->opcr[plug].u.quadlet);
202 return RCODE_COMPLETE;
203 }
204 else if (csraddr < 0x980) {
205 return RCODE_ADDRESS_ERROR;
206 }
207 else if (csraddr == 0x980) {
208 *buf = cpu_to_be32(ch->v.impr_quadlet);
209 return RCODE_COMPLETE;
210 }
211 else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) {
212 plug = (csraddr - 0x984) / 4;
213 *buf = cpu_to_be32(ch->ipcr[plug].u.quadlet);
214 return RCODE_COMPLETE;
215 }
216 else
217 return RCODE_ADDRESS_ERROR;
218}
219
220static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
221 u64 addr, quadlet_t data, quadlet_t arg, int extcode, u16 flags)
222{
223 int csraddr = addr - CSR_REGISTER_BASE;
224 int plug;
225 struct cmp_host *ch;
226
227 ch = hpsb_get_hostinfo(&cmp_highlevel, host);
228
229 if (extcode != EXTCODE_COMPARE_SWAP)
230 return RCODE_TYPE_ERROR;
231
232 if (csraddr == 0x900) {
233 /* FIXME: Ignore writes to bits 30-31 and 0-7 */
234 *store = cpu_to_be32(ch->u.ompr_quadlet);
235 if (arg == cpu_to_be32(ch->u.ompr_quadlet))
236 ch->u.ompr_quadlet = be32_to_cpu(data);
237
238 return RCODE_COMPLETE;
239 }
240 if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) {
241 plug = (csraddr - 0x904) / 4;
242 *store = cpu_to_be32(ch->opcr[plug].u.quadlet);
243
244 if (arg == *store)
245 ch->opcr[plug].u.quadlet = be32_to_cpu(data);
246
247 if (be32_to_cpu(*store) != ch->opcr[plug].u.quadlet &&
248 ch->opcr[plug].update != NULL)
249 ch->opcr[plug].update(&ch->opcr[plug].u.pcr,
250 ch->opcr[plug].data);
251
252 return RCODE_COMPLETE;
253 }
254 else if (csraddr < 0x980) {
255 return RCODE_ADDRESS_ERROR;
256 }
257 else if (csraddr == 0x980) {
258 /* FIXME: Ignore writes to bits 24-31 and 0-7 */
259 *store = cpu_to_be32(ch->u.ompr_quadlet);
260 if (arg == cpu_to_be32(ch->u.ompr_quadlet))
261 ch->u.ompr_quadlet = be32_to_cpu(data);
262
263 return RCODE_COMPLETE;
264 }
265 else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) {
266 plug = (csraddr - 0x984) / 4;
267 *store = cpu_to_be32(ch->ipcr[plug].u.quadlet);
268
269 if (arg == *store)
270 ch->ipcr[plug].u.quadlet = be32_to_cpu(data);
271
272 if (be32_to_cpu(*store) != ch->ipcr[plug].u.quadlet &&
273 ch->ipcr[plug].update != NULL)
274 ch->ipcr[plug].update(&ch->ipcr[plug].u.pcr,
275 ch->ipcr[plug].data);
276
277 return RCODE_COMPLETE;
278 }
279 else
280 return RCODE_ADDRESS_ERROR;
281}
282
283
284/* Module interface */
285
286MODULE_AUTHOR("Kristian Hogsberg <hogsberg@users.sf.net>");
287MODULE_DESCRIPTION("Connection Management Procedures (CMP)");
288MODULE_SUPPORTED_DEVICE("cmp");
289MODULE_LICENSE("GPL");
290
291EXPORT_SYMBOL(cmp_register_opcr);
292EXPORT_SYMBOL(cmp_unregister_opcr);
293
294static int __init cmp_init_module (void)
295{
296 hpsb_register_highlevel (&cmp_highlevel);
297
298 HPSB_INFO("Loaded CMP driver");
299
300 return 0;
301}
302
303static void __exit cmp_exit_module (void)
304{
305 hpsb_unregister_highlevel(&cmp_highlevel);
306
307 HPSB_INFO("Unloaded CMP driver");
308}
309
310module_init(cmp_init_module);
311module_exit(cmp_exit_module);
diff --git a/drivers/ieee1394/cmp.h b/drivers/ieee1394/cmp.h
deleted file mode 100644
index f9288bfcd494..000000000000
--- a/drivers/ieee1394/cmp.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef __CMP_H
2#define __CMP_H
3
4struct cmp_mpr {
5 u32 nplugs:5;
6 u32 reserved:3;
7 u32 persistent_ext:8;
8 u32 non_persistent_ext:8;
9 u32 bcast_channel_base:6;
10 u32 rate:2;
11} __attribute__((packed));
12
13struct cmp_pcr {
14 u32 payload:10;
15 u32 overhead:4;
16 u32 speed:2;
17 u32 channel:6;
18 u32 reserved:2;
19 u32 p2p_count:6;
20 u32 bcast_count:1;
21 u32 online:1;
22} __attribute__((packed));
23
24struct cmp_pcr *cmp_register_opcr(struct hpsb_host *host, int plug,
25 int payload,
26 void (*update)(struct cmp_pcr *plug,
27 void *data),
28 void *data);
29void cmp_unregister_opcr(struct hpsb_host *host, struct cmp_pcr *plug);
30
31#endif /* __CMP_H */
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 2c674023a6ac..b1b14f8d4dd6 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -98,7 +98,7 @@ config TOUCHSCREEN_MK712
98 98
99config TOUCHSCREEN_HP600 99config TOUCHSCREEN_HP600
100 tristate "HP Jornada 680/690 touchscreen" 100 tristate "HP Jornada 680/690 touchscreen"
101 depends on SH_HP600 && SH_ADC 101 depends on SH_HP6XX && SH_ADC
102 help 102 help
103 Say Y here if you have a HP Jornada 680 or 690 and want to 103 Say Y here if you have a HP Jornada 680 or 690 and want to
104 support the built-in touchscreen. 104 support the built-in touchscreen.
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1778104e106c..7145cd150f7b 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)
3395 mddev->ctime = get_seconds(); 3395 mddev->ctime = get_seconds();
3396 3396
3397 mddev->level = info->level; 3397 mddev->level = info->level;
3398 mddev->clevel[0] = 0;
3398 mddev->size = info->size; 3399 mddev->size = info->size;
3399 mddev->raid_disks = info->raid_disks; 3400 mddev->raid_disks = info->raid_disks;
3400 /* don't set md_minor, it is determined by which /dev/md* was 3401 /* 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 f29571450038..a04bb61f21f4 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 = {
542 .remove = bt878_remove, 542 .remove = bt878_remove,
543}; 543};
544 544
545static int bt878_pci_driver_registered = 0; 545static int bt878_pci_driver_registered;
546 546
547/*******************************/ 547/*******************************/
548/* Module management functions */ 548/* Module management functions */
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index 44fcbe77c8f9..ea27b15007e9 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)
893 return 0; 893 return 0;
894} 894}
895 895
896static int dvb_bt8xx_remove(struct bttv_sub_device *sub) 896static void dvb_bt8xx_remove(struct bttv_sub_device *sub)
897{ 897{
898 struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev); 898 struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev);
899 899
@@ -911,8 +911,6 @@ static int dvb_bt8xx_remove(struct bttv_sub_device *sub)
911 dvb_unregister_adapter(&card->dvb_adapter); 911 dvb_unregister_adapter(&card->dvb_adapter);
912 912
913 kfree(card); 913 kfree(card);
914
915 return 0;
916} 914}
917 915
918static struct bttv_sub_driver driver = { 916static struct bttv_sub_driver driver = {
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 06b696e9acbd..54f8b95717b0 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -33,7 +33,7 @@
33#include <linux/device.h> 33#include <linux/device.h>
34#include <linux/fs.h> 34#include <linux/fs.h>
35#include <linux/cdev.h> 35#include <linux/cdev.h>
36 36#include <linux/mutex.h>
37#include "dvbdev.h" 37#include "dvbdev.h"
38 38
39static int dvbdev_debug; 39static int dvbdev_debug;
@@ -44,7 +44,7 @@ MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off).");
44#define dprintk if (dvbdev_debug) printk 44#define dprintk if (dvbdev_debug) printk
45 45
46static LIST_HEAD(dvb_adapter_list); 46static LIST_HEAD(dvb_adapter_list);
47static DECLARE_MUTEX(dvbdev_register_lock); 47static DEFINE_MUTEX(dvbdev_register_lock);
48 48
49static const char * const dnames[] = { 49static const char * const dnames[] = {
50 "video", "audio", "sec", "frontend", "demux", "dvr", "ca", 50 "video", "audio", "sec", "frontend", "demux", "dvr", "ca",
@@ -202,11 +202,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
202 struct dvb_device *dvbdev; 202 struct dvb_device *dvbdev;
203 int id; 203 int id;
204 204
205 if (down_interruptible (&dvbdev_register_lock)) 205 if (mutex_lock_interruptible(&dvbdev_register_lock))
206 return -ERESTARTSYS; 206 return -ERESTARTSYS;
207 207
208 if ((id = dvbdev_get_free_id (adap, type)) < 0) { 208 if ((id = dvbdev_get_free_id (adap, type)) < 0) {
209 up (&dvbdev_register_lock); 209 mutex_unlock(&dvbdev_register_lock);
210 *pdvbdev = NULL; 210 *pdvbdev = NULL;
211 printk ("%s: could get find free device id...\n", __FUNCTION__); 211 printk ("%s: could get find free device id...\n", __FUNCTION__);
212 return -ENFILE; 212 return -ENFILE;
@@ -215,11 +215,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
215 *pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL); 215 *pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL);
216 216
217 if (!dvbdev) { 217 if (!dvbdev) {
218 up(&dvbdev_register_lock); 218 mutex_unlock(&dvbdev_register_lock);
219 return -ENOMEM; 219 return -ENOMEM;
220 } 220 }
221 221
222 up (&dvbdev_register_lock); 222 mutex_unlock(&dvbdev_register_lock);
223 223
224 memcpy(dvbdev, template, sizeof(struct dvb_device)); 224 memcpy(dvbdev, template, sizeof(struct dvb_device));
225 dvbdev->type = type; 225 dvbdev->type = type;
@@ -289,11 +289,11 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
289{ 289{
290 int num; 290 int num;
291 291
292 if (down_interruptible (&dvbdev_register_lock)) 292 if (mutex_lock_interruptible(&dvbdev_register_lock))
293 return -ERESTARTSYS; 293 return -ERESTARTSYS;
294 294
295 if ((num = dvbdev_get_free_adapter_num ()) < 0) { 295 if ((num = dvbdev_get_free_adapter_num ()) < 0) {
296 up (&dvbdev_register_lock); 296 mutex_unlock(&dvbdev_register_lock);
297 return -ENFILE; 297 return -ENFILE;
298 } 298 }
299 299
@@ -309,7 +309,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
309 309
310 list_add_tail (&adap->list_head, &dvb_adapter_list); 310 list_add_tail (&adap->list_head, &dvb_adapter_list);
311 311
312 up (&dvbdev_register_lock); 312 mutex_unlock(&dvbdev_register_lock);
313 313
314 return num; 314 return num;
315} 315}
@@ -320,10 +320,10 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
320{ 320{
321 devfs_remove("dvb/adapter%d", adap->num); 321 devfs_remove("dvb/adapter%d", adap->num);
322 322
323 if (down_interruptible (&dvbdev_register_lock)) 323 if (mutex_lock_interruptible(&dvbdev_register_lock))
324 return -ERESTARTSYS; 324 return -ERESTARTSYS;
325 list_del (&adap->list_head); 325 list_del (&adap->list_head);
326 up (&dvbdev_register_lock); 326 mutex_unlock(&dvbdev_register_lock);
327 return 0; 327 return 0;
328} 328}
329EXPORT_SYMBOL(dvb_unregister_adapter); 329EXPORT_SYMBOL(dvb_unregister_adapter);
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 18d169836c9c..a7fb06f4cd34 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);
691module_exit (cxusb_module_exit); 691module_exit (cxusb_module_exit);
692 692
693MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 693MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
694MODULE_AUTHOR("Michael Krufky <mkrufky@m1k.net>");
695MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
694MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); 696MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
695MODULE_VERSION("1.0-alpha"); 697MODULE_VERSION("1.0-alpha");
696MODULE_LICENSE("GPL"); 698MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 757075f007c1..1b9934ea5b06 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 = {
333 .name = "Samsung TBMV30111IN", 333 .name = "Samsung TBMV30111IN",
334 .min = 54000000, 334 .min = 54000000,
335 .max = 860000000, 335 .max = 860000000,
336 .count = 4, 336 .count = 6,
337 .entries = { 337 .entries = {
338 { 172000000, 44000000, 166666, 0xb4, 0x01 }, 338 { 172000000, 44000000, 166666, 0xb4, 0x01 },
339 { 214000000, 44000000, 166666, 0xb4, 0x02 }, 339 { 214000000, 44000000, 166666, 0xb4, 0x02 },
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 327a8089193b..27494901975f 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;
81static int hw_sections; 81static int hw_sections;
82static int rgb_on; 82static int rgb_on;
83static int volume = 255; 83static int volume = 255;
84static int budgetpatch = 0; 84static int budgetpatch;
85 85
86module_param_named(debug, av7110_debug, int, 0644); 86module_param_named(debug, av7110_debug, int, 0644);
87MODULE_PARM_DESC(debug, "debug level (bitmask, default 0)"); 87MODULE_PARM_DESC(debug, "debug level (bitmask, default 0)");
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(budgetpatch, "use budget-patch hardware modification: default 0
103 103
104static void restart_feeds(struct av7110 *av7110); 104static void restart_feeds(struct av7110 *av7110);
105 105
106static int av7110_num = 0; 106static int av7110_num;
107 107
108#define FE_FUNC_OVERRIDE(fe_func, av7110_copy, av7110_func) \ 108#define FE_FUNC_OVERRIDE(fe_func, av7110_copy, av7110_func) \
109{\ 109{\
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index cb377452b57d..b2e63e9fc053 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)
146{ 146{
147 int i; 147 int i;
148 int blocks, rest; 148 int blocks, rest;
149 u32 base, bootblock = BOOT_BLOCK; 149 u32 base, bootblock = AV7110_BOOT_BLOCK;
150 150
151 dprintk(4, "%p\n", av7110); 151 dprintk(4, "%p\n", av7110);
152 152
153 blocks = len / BOOT_MAX_SIZE; 153 blocks = len / AV7110_BOOT_MAX_SIZE;
154 rest = len % BOOT_MAX_SIZE; 154 rest = len % AV7110_BOOT_MAX_SIZE;
155 base = DRAM_START_CODE; 155 base = DRAM_START_CODE;
156 156
157 for (i = 0; i < blocks; i++) { 157 for (i = 0; i < blocks; i++) {
158 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { 158 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) {
159 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i); 159 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i);
160 return -ETIMEDOUT; 160 return -ETIMEDOUT;
161 } 161 }
162 dprintk(4, "writing DRAM block %d\n", i); 162 dprintk(4, "writing DRAM block %d\n", i);
163 mwdebi(av7110, DEBISWAB, bootblock, 163 mwdebi(av7110, DEBISWAB, bootblock,
164 ((char*)data) + i * BOOT_MAX_SIZE, BOOT_MAX_SIZE); 164 ((char*)data) + i * AV7110_BOOT_MAX_SIZE, AV7110_BOOT_MAX_SIZE);
165 bootblock ^= 0x1400; 165 bootblock ^= 0x1400;
166 iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4); 166 iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4);
167 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, BOOT_MAX_SIZE, 2); 167 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, AV7110_BOOT_MAX_SIZE, 2);
168 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 168 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
169 base += BOOT_MAX_SIZE; 169 base += AV7110_BOOT_MAX_SIZE;
170 } 170 }
171 171
172 if (rest > 0) { 172 if (rest > 0) {
173 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { 173 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) {
174 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n"); 174 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n");
175 return -ETIMEDOUT; 175 return -ETIMEDOUT;
176 } 176 }
177 if (rest > 4) 177 if (rest > 4)
178 mwdebi(av7110, DEBISWAB, bootblock, 178 mwdebi(av7110, DEBISWAB, bootblock,
179 ((char*)data) + i * BOOT_MAX_SIZE, rest); 179 ((char*)data) + i * AV7110_BOOT_MAX_SIZE, rest);
180 else 180 else
181 mwdebi(av7110, DEBISWAB, bootblock, 181 mwdebi(av7110, DEBISWAB, bootblock,
182 ((char*)data) + i * BOOT_MAX_SIZE - 4, rest + 4); 182 ((char*)data) + i * AV7110_BOOT_MAX_SIZE - 4, rest + 4);
183 183
184 iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4); 184 iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4);
185 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, rest, 2); 185 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, rest, 2);
186 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 186 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
187 } 187 }
188 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { 188 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) {
189 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n"); 189 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n");
190 return -ETIMEDOUT; 190 return -ETIMEDOUT;
191 } 191 }
192 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, 0, 2); 192 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, 0, 2);
193 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 193 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
194 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BOOT_COMPLETE) < 0) { 194 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_AV7110_BOOT_COMPLETE) < 0) {
195 printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n"); 195 printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n");
196 return -ETIMEDOUT; 196 return -ETIMEDOUT;
197 } 197 }
@@ -262,7 +262,7 @@ int av7110_bootarm(struct av7110 *av7110)
262 //saa7146_setgpio(dev, 3, SAA7146_GPIO_INPUT); 262 //saa7146_setgpio(dev, 3, SAA7146_GPIO_INPUT);
263 263
264 mwdebi(av7110, DEBISWAB, DPRAM_BASE, bootcode, sizeof(bootcode)); 264 mwdebi(av7110, DEBISWAB, DPRAM_BASE, bootcode, sizeof(bootcode));
265 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 265 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
266 266
267 if (saa7146_wait_for_debi_done(av7110->dev, 1)) { 267 if (saa7146_wait_for_debi_done(av7110->dev, 1)) {
268 printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " 268 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 84b83299b8be..4e173c67fbb2 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.h
+++ b/drivers/media/dvb/ttpci/av7110_hw.h
@@ -18,7 +18,7 @@ enum av7110_bootstate
18{ 18{
19 BOOTSTATE_BUFFER_EMPTY = 0, 19 BOOTSTATE_BUFFER_EMPTY = 0,
20 BOOTSTATE_BUFFER_FULL = 1, 20 BOOTSTATE_BUFFER_FULL = 1,
21 BOOTSTATE_BOOT_COMPLETE = 2 21 BOOTSTATE_AV7110_BOOT_COMPLETE = 2
22}; 22};
23 23
24enum av7110_type_rec_play_format 24enum av7110_type_rec_play_format
@@ -295,11 +295,11 @@ enum av7110_command_type {
295#define DPRAM_BASE 0x4000 295#define DPRAM_BASE 0x4000
296 296
297/* boot protocol area */ 297/* boot protocol area */
298#define BOOT_STATE (DPRAM_BASE + 0x3F8) 298#define AV7110_BOOT_STATE (DPRAM_BASE + 0x3F8)
299#define BOOT_SIZE (DPRAM_BASE + 0x3FA) 299#define AV7110_BOOT_SIZE (DPRAM_BASE + 0x3FA)
300#define BOOT_BASE (DPRAM_BASE + 0x3FC) 300#define AV7110_BOOT_BASE (DPRAM_BASE + 0x3FC)
301#define BOOT_BLOCK (DPRAM_BASE + 0x400) 301#define AV7110_BOOT_BLOCK (DPRAM_BASE + 0x400)
302#define BOOT_MAX_SIZE 0xc00 302#define AV7110_BOOT_MAX_SIZE 0xc00
303 303
304/* firmware command protocol area */ 304/* firmware command protocol area */
305#define IRQ_STATE (DPRAM_BASE + 0x0F4) 305#define IRQ_STATE (DPRAM_BASE + 0x0F4)
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index dd24896906fe..faf728366c4e 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 \
8zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o 8zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o
9zr36067-objs := zoran_procfs.o zoran_device.o \ 9zr36067-objs := zoran_procfs.o zoran_device.o \
10 zoran_driver.o zoran_card.o 10 zoran_driver.o zoran_card.o
11tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o 11tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \
12 mt20xx.o tda8290.o tea5767.o
12 13
13msp3400-objs := msp3400-driver.o msp3400-kthreads.o 14msp3400-objs := msp3400-driver.o msp3400-kthreads.o
14 15
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 7d5a068353f2..994b75fe165a 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];
129static int freq = DEFAULT_FREQ; /* BCLK: available 50 or 70 (MHz) */ 129static int freq = DEFAULT_FREQ; /* BCLK: available 50 or 70 (MHz) */
130static int vga = 0; /* default mode(0:QVGA mode, other:VGA mode) */ 130static int vga = 0; /* default mode(0:QVGA mode, other:VGA mode) */
131static int vga_interlace = 0; /* 0 is normal mode for, else interlace mode */ 131static int vga_interlace = 0; /* 0 is normal mode for, else interlace mode */
132MODULE_PARM(freq, "i"); 132module_param(freq, int, 0);
133MODULE_PARM(vga, "i"); 133module_param(vga, int, 0);
134MODULE_PARM(vga_interlace, "i"); 134module_param(vga_interlace, int, 0);
135 135
136static int ar_initialize(struct video_device *dev); 136static int ar_initialize(struct video_device *dev);
137 137
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
index 07c78f1f7a44..cc54b62f4601 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,
43 I2C_CLIENT_END }; 43 I2C_CLIENT_END };
44I2C_CLIENT_INSMOD; 44I2C_CLIENT_INSMOD;
45 45
46int debug = 0; /* debug output */ 46int debug; /* debug output */
47module_param(debug, int, 0644); 47module_param(debug, int, 0644);
48 48
49/* ---------------------------------------------------------------------- */ 49/* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c
index a48de3c0e3f0..b4aca7249276 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");
37MODULE_AUTHOR("Gerd Knorr"); 37MODULE_AUTHOR("Gerd Knorr");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40static unsigned int debug = 0; 40static unsigned int debug;
41module_param(debug, int, 0644); 41module_param(debug, int, 0644);
42MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)"); 42MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)");
43 43
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 65323e78d5fd..9749d6ed6231 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,
92static int __devinit pvr_boot(struct bttv *btv); 92static int __devinit pvr_boot(struct bttv *btv);
93 93
94/* config variables */ 94/* config variables */
95static unsigned int triton1=0; 95static unsigned int triton1;
96static unsigned int vsfx=0; 96static unsigned int vsfx;
97static unsigned int latency = UNSET; 97static unsigned int latency = UNSET;
98int no_overlay=-1; 98int no_overlay=-1;
99 99
@@ -106,7 +106,7 @@ static struct bttv *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
106#ifdef MODULE 106#ifdef MODULE
107static unsigned int autoload = 1; 107static unsigned int autoload = 1;
108#else 108#else
109static unsigned int autoload = 0; 109static unsigned int autoload;
110#endif 110#endif
111static unsigned int gpiomask = UNSET; 111static unsigned int gpiomask = UNSET;
112static unsigned int audioall = UNSET; 112static unsigned int audioall = UNSET;
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 0e6970346788..aa4c4c521880 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -48,47 +48,46 @@
48unsigned int bttv_num; /* number of Bt848s in use */ 48unsigned int bttv_num; /* number of Bt848s in use */
49struct bttv bttvs[BTTV_MAX]; 49struct bttv bttvs[BTTV_MAX];
50 50
51unsigned int bttv_debug = 0; 51unsigned int bttv_debug;
52unsigned int bttv_verbose = 1; 52unsigned int bttv_verbose = 1;
53unsigned int bttv_gpio = 0; 53unsigned int bttv_gpio;
54 54
55/* config variables */ 55/* config variables */
56#ifdef __BIG_ENDIAN 56#ifdef __BIG_ENDIAN
57static unsigned int bigendian=1; 57static unsigned int bigendian=1;
58#else 58#else
59static unsigned int bigendian=0; 59static unsigned int bigendian;
60#endif 60#endif
61static unsigned int radio[BTTV_MAX]; 61static unsigned int radio[BTTV_MAX];
62static unsigned int irq_debug = 0; 62static unsigned int irq_debug;
63static unsigned int gbuffers = 8; 63static unsigned int gbuffers = 8;
64static unsigned int gbufsize = 0x208000; 64static unsigned int gbufsize = 0x208000;
65 65
66static int video_nr = -1; 66static int video_nr = -1;
67static int radio_nr = -1; 67static int radio_nr = -1;
68static int vbi_nr = -1; 68static int vbi_nr = -1;
69static int debug_latency = 0; 69static int debug_latency;
70 70
71static unsigned int fdsr = 0; 71static unsigned int fdsr;
72 72
73/* options */ 73/* options */
74static unsigned int combfilter = 0; 74static unsigned int combfilter;
75static unsigned int lumafilter = 0; 75static unsigned int lumafilter;
76static unsigned int automute = 1; 76static unsigned int automute = 1;
77static unsigned int chroma_agc = 0; 77static unsigned int chroma_agc;
78static unsigned int adc_crush = 1; 78static unsigned int adc_crush = 1;
79static unsigned int whitecrush_upper = 0xCF; 79static unsigned int whitecrush_upper = 0xCF;
80static unsigned int whitecrush_lower = 0x7F; 80static unsigned int whitecrush_lower = 0x7F;
81static unsigned int vcr_hack = 0; 81static unsigned int vcr_hack;
82static unsigned int irq_iswitch = 0; 82static unsigned int irq_iswitch;
83static unsigned int uv_ratio = 50; 83static unsigned int uv_ratio = 50;
84static unsigned int full_luma_range = 0; 84static unsigned int full_luma_range;
85static unsigned int coring = 0; 85static unsigned int coring;
86extern int no_overlay; 86extern int no_overlay;
87 87
88/* API features (turn on/off stuff for testing) */ 88/* API features (turn on/off stuff for testing) */
89static unsigned int v4l2 = 1; 89static unsigned int v4l2 = 1;
90 90
91
92/* insmod args */ 91/* insmod args */
93module_param(bttv_verbose, int, 0644); 92module_param(bttv_verbose, int, 0644);
94module_param(bttv_gpio, int, 0644); 93module_param(bttv_gpio, int, 0644);
@@ -685,16 +684,16 @@ int check_alloc_btres(struct bttv *btv, struct bttv_fh *fh, int bit)
685 return 1; 684 return 1;
686 685
687 /* is it free? */ 686 /* is it free? */
688 down(&btv->reslock); 687 mutex_lock(&btv->reslock);
689 if (btv->resources & bit) { 688 if (btv->resources & bit) {
690 /* no, someone else uses it */ 689 /* no, someone else uses it */
691 up(&btv->reslock); 690 mutex_unlock(&btv->reslock);
692 return 0; 691 return 0;
693 } 692 }
694 /* it's free, grab it */ 693 /* it's free, grab it */
695 fh->resources |= bit; 694 fh->resources |= bit;
696 btv->resources |= bit; 695 btv->resources |= bit;
697 up(&btv->reslock); 696 mutex_unlock(&btv->reslock);
698 return 1; 697 return 1;
699} 698}
700 699
@@ -717,10 +716,10 @@ void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
717 /* trying to free ressources not allocated by us ... */ 716 /* trying to free ressources not allocated by us ... */
718 printk("bttv: BUG! (btres)\n"); 717 printk("bttv: BUG! (btres)\n");
719 } 718 }
720 down(&btv->reslock); 719 mutex_lock(&btv->reslock);
721 fh->resources &= ~bits; 720 fh->resources &= ~bits;
722 btv->resources &= ~bits; 721 btv->resources &= ~bits;
723 up(&btv->reslock); 722 mutex_unlock(&btv->reslock);
724} 723}
725 724
726/* ----------------------------------------------------------------------- */ 725/* ----------------------------------------------------------------------- */
@@ -1537,12 +1536,12 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1537 case VIDIOCSFREQ: 1536 case VIDIOCSFREQ:
1538 { 1537 {
1539 unsigned long *freq = arg; 1538 unsigned long *freq = arg;
1540 down(&btv->lock); 1539 mutex_lock(&btv->lock);
1541 btv->freq=*freq; 1540 btv->freq=*freq;
1542 bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq); 1541 bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq);
1543 if (btv->has_matchbox && btv->radio_user) 1542 if (btv->has_matchbox && btv->radio_user)
1544 tea5757_set_freq(btv,*freq); 1543 tea5757_set_freq(btv,*freq);
1545 up(&btv->lock); 1544 mutex_unlock(&btv->lock);
1546 return 0; 1545 return 0;
1547 } 1546 }
1548 1547
@@ -1572,10 +1571,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1572 if (v->mode >= BTTV_TVNORMS) 1571 if (v->mode >= BTTV_TVNORMS)
1573 return -EINVAL; 1572 return -EINVAL;
1574 1573
1575 down(&btv->lock); 1574 mutex_lock(&btv->lock);
1576 set_tvnorm(btv,v->mode); 1575 set_tvnorm(btv,v->mode);
1577 bttv_call_i2c_clients(btv,cmd,v); 1576 bttv_call_i2c_clients(btv,cmd,v);
1578 up(&btv->lock); 1577 mutex_unlock(&btv->lock);
1579 return 0; 1578 return 0;
1580 } 1579 }
1581 1580
@@ -1612,17 +1611,17 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1612 if (v->norm >= BTTV_TVNORMS) 1611 if (v->norm >= BTTV_TVNORMS)
1613 return -EINVAL; 1612 return -EINVAL;
1614 1613
1615 down(&btv->lock); 1614 mutex_lock(&btv->lock);
1616 if (channel == btv->input && 1615 if (channel == btv->input &&
1617 v->norm == btv->tvnorm) { 1616 v->norm == btv->tvnorm) {
1618 /* nothing to do */ 1617 /* nothing to do */
1619 up(&btv->lock); 1618 mutex_unlock(&btv->lock);
1620 return 0; 1619 return 0;
1621 } 1620 }
1622 1621
1623 btv->tvnorm = v->norm; 1622 btv->tvnorm = v->norm;
1624 set_input(btv,v->channel); 1623 set_input(btv,v->channel);
1625 up(&btv->lock); 1624 mutex_unlock(&btv->lock);
1626 return 0; 1625 return 0;
1627 } 1626 }
1628 1627
@@ -1635,14 +1634,14 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1635 v->flags |= VIDEO_AUDIO_MUTABLE; 1634 v->flags |= VIDEO_AUDIO_MUTABLE;
1636 v->mode = VIDEO_SOUND_MONO; 1635 v->mode = VIDEO_SOUND_MONO;
1637 1636
1638 down(&btv->lock); 1637 mutex_lock(&btv->lock);
1639 bttv_call_i2c_clients(btv,cmd,v); 1638 bttv_call_i2c_clients(btv,cmd,v);
1640 1639
1641 /* card specific hooks */ 1640 /* card specific hooks */
1642 if (btv->audio_hook) 1641 if (btv->audio_hook)
1643 btv->audio_hook(btv,v,0); 1642 btv->audio_hook(btv,v,0);
1644 1643
1645 up(&btv->lock); 1644 mutex_unlock(&btv->lock);
1646 return 0; 1645 return 0;
1647 } 1646 }
1648 case VIDIOCSAUDIO: 1647 case VIDIOCSAUDIO:
@@ -1653,7 +1652,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1653 if (audio >= bttv_tvcards[btv->c.type].audio_inputs) 1652 if (audio >= bttv_tvcards[btv->c.type].audio_inputs)
1654 return -EINVAL; 1653 return -EINVAL;
1655 1654
1656 down(&btv->lock); 1655 mutex_lock(&btv->lock);
1657 audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE); 1656 audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE);
1658 bttv_call_i2c_clients(btv,cmd,v); 1657 bttv_call_i2c_clients(btv,cmd,v);
1659 1658
@@ -1661,7 +1660,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1661 if (btv->audio_hook) 1660 if (btv->audio_hook)
1662 btv->audio_hook(btv,v,1); 1661 btv->audio_hook(btv,v,1);
1663 1662
1664 up(&btv->lock); 1663 mutex_unlock(&btv->lock);
1665 return 0; 1664 return 0;
1666 } 1665 }
1667 1666
@@ -1695,10 +1694,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1695 if (i == BTTV_TVNORMS) 1694 if (i == BTTV_TVNORMS)
1696 return -EINVAL; 1695 return -EINVAL;
1697 1696
1698 down(&btv->lock); 1697 mutex_lock(&btv->lock);
1699 set_tvnorm(btv,i); 1698 set_tvnorm(btv,i);
1700 i2c_vidiocschan(btv); 1699 i2c_vidiocschan(btv);
1701 up(&btv->lock); 1700 mutex_unlock(&btv->lock);
1702 return 0; 1701 return 0;
1703 } 1702 }
1704 case VIDIOC_QUERYSTD: 1703 case VIDIOC_QUERYSTD:
@@ -1756,9 +1755,9 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1756 1755
1757 if (*i > bttv_tvcards[btv->c.type].video_inputs) 1756 if (*i > bttv_tvcards[btv->c.type].video_inputs)
1758 return -EINVAL; 1757 return -EINVAL;
1759 down(&btv->lock); 1758 mutex_lock(&btv->lock);
1760 set_input(btv,*i); 1759 set_input(btv,*i);
1761 up(&btv->lock); 1760 mutex_unlock(&btv->lock);
1762 return 0; 1761 return 0;
1763 } 1762 }
1764 1763
@@ -1770,7 +1769,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1770 return -EINVAL; 1769 return -EINVAL;
1771 if (0 != t->index) 1770 if (0 != t->index)
1772 return -EINVAL; 1771 return -EINVAL;
1773 down(&btv->lock); 1772 mutex_lock(&btv->lock);
1774 memset(t,0,sizeof(*t)); 1773 memset(t,0,sizeof(*t));
1775 strcpy(t->name, "Television"); 1774 strcpy(t->name, "Television");
1776 t->type = V4L2_TUNER_ANALOG_TV; 1775 t->type = V4L2_TUNER_ANALOG_TV;
@@ -1805,7 +1804,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1805 } 1804 }
1806 } 1805 }
1807 /* FIXME: fill capability+audmode */ 1806 /* FIXME: fill capability+audmode */
1808 up(&btv->lock); 1807 mutex_unlock(&btv->lock);
1809 return 0; 1808 return 0;
1810 } 1809 }
1811 case VIDIOC_S_TUNER: 1810 case VIDIOC_S_TUNER:
@@ -1816,7 +1815,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1816 return -EINVAL; 1815 return -EINVAL;
1817 if (0 != t->index) 1816 if (0 != t->index)
1818 return -EINVAL; 1817 return -EINVAL;
1819 down(&btv->lock); 1818 mutex_lock(&btv->lock);
1820 { 1819 {
1821 struct video_audio va; 1820 struct video_audio va;
1822 memset(&va, 0, sizeof(struct video_audio)); 1821 memset(&va, 0, sizeof(struct video_audio));
@@ -1833,7 +1832,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1833 if (btv->audio_hook) 1832 if (btv->audio_hook)
1834 btv->audio_hook(btv,&va,1); 1833 btv->audio_hook(btv,&va,1);
1835 } 1834 }
1836 up(&btv->lock); 1835 mutex_unlock(&btv->lock);
1837 return 0; 1836 return 0;
1838 } 1837 }
1839 1838
@@ -1854,12 +1853,12 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1854 return -EINVAL; 1853 return -EINVAL;
1855 if (unlikely (f->type != V4L2_TUNER_ANALOG_TV)) 1854 if (unlikely (f->type != V4L2_TUNER_ANALOG_TV))
1856 return -EINVAL; 1855 return -EINVAL;
1857 down(&btv->lock); 1856 mutex_lock(&btv->lock);
1858 btv->freq = f->frequency; 1857 btv->freq = f->frequency;
1859 bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq); 1858 bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq);
1860 if (btv->has_matchbox && btv->radio_user) 1859 if (btv->has_matchbox && btv->radio_user)
1861 tea5757_set_freq(btv,btv->freq); 1860 tea5757_set_freq(btv,btv->freq);
1862 up(&btv->lock); 1861 mutex_unlock(&btv->lock);
1863 return 0; 1862 return 0;
1864 } 1863 }
1865 case VIDIOC_LOG_STATUS: 1864 case VIDIOC_LOG_STATUS:
@@ -3157,7 +3156,7 @@ static int radio_open(struct inode *inode, struct file *file)
3157 return -ENODEV; 3156 return -ENODEV;
3158 3157
3159 dprintk("bttv%d: open called (radio)\n",btv->c.nr); 3158 dprintk("bttv%d: open called (radio)\n",btv->c.nr);
3160 down(&btv->lock); 3159 mutex_lock(&btv->lock);
3161 3160
3162 btv->radio_user++; 3161 btv->radio_user++;
3163 3162
@@ -3166,7 +3165,7 @@ static int radio_open(struct inode *inode, struct file *file)
3166 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); 3165 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
3167 audio_mux(btv,AUDIO_RADIO); 3166 audio_mux(btv,AUDIO_RADIO);
3168 3167
3169 up(&btv->lock); 3168 mutex_unlock(&btv->lock);
3170 return 0; 3169 return 0;
3171} 3170}
3172 3171
@@ -3921,8 +3920,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3921 sprintf(btv->c.name,"bttv%d",btv->c.nr); 3920 sprintf(btv->c.name,"bttv%d",btv->c.nr);
3922 3921
3923 /* initialize structs / fill in defaults */ 3922 /* initialize structs / fill in defaults */
3924 init_MUTEX(&btv->lock); 3923 mutex_init(&btv->lock);
3925 init_MUTEX(&btv->reslock); 3924 mutex_init(&btv->reslock);
3926 spin_lock_init(&btv->s_lock); 3925 spin_lock_init(&btv->s_lock);
3927 spin_lock_init(&btv->gpio_lock); 3926 spin_lock_init(&btv->gpio_lock);
3928 init_waitqueue_head(&btv->gpioq); 3927 init_waitqueue_head(&btv->gpioq);
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index 748d630c7fe4..614c12018557 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;
41 41
42static int attach_inform(struct i2c_client *client); 42static int attach_inform(struct i2c_client *client);
43 43
44static int i2c_debug = 0; 44static int i2c_debug;
45static int i2c_hw = 0; 45static int i2c_hw;
46static int i2c_scan = 0; 46static int i2c_scan;
47module_param(i2c_debug, int, 0644); 47module_param(i2c_debug, int, 0644);
48module_param(i2c_hw, int, 0444); 48module_param(i2c_hw, int, 0444);
49module_param(i2c_scan, int, 0444); 49module_param(i2c_scan, int, 0444);
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h
index dd00c20ab95e..9cb72f176f7d 100644
--- a/drivers/media/video/bttvp.h
+++ b/drivers/media/video/bttvp.h
@@ -35,6 +35,7 @@
35#include <linux/videodev.h> 35#include <linux/videodev.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/mutex.h>
38#include <asm/scatterlist.h> 39#include <asm/scatterlist.h>
39#include <asm/io.h> 40#include <asm/io.h>
40 41
@@ -309,9 +310,9 @@ struct bttv {
309 310
310 /* locking */ 311 /* locking */
311 spinlock_t s_lock; 312 spinlock_t s_lock;
312 struct semaphore lock; 313 struct mutex lock;
313 int resources; 314 int resources;
314 struct semaphore reslock; 315 struct mutex reslock;
315#ifdef VIDIOC_G_PRIORITY 316#ifdef VIDIOC_G_PRIORITY
316 struct v4l2_prio_state prio; 317 struct v4l2_prio_state prio;
317#endif 318#endif
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 1d75a42629d1..c66c2c1f4809 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -43,7 +43,7 @@ MODULE_LICENSE("GPL");
43static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; 43static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
44 44
45 45
46int cx25840_debug = 0; 46static int cx25840_debug;
47 47
48module_param_named(debug,cx25840_debug, int, 0644); 48module_param_named(debug,cx25840_debug, int, 0644);
49 49
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 76fcb4e995c9..53308911ae6e 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -31,8 +31,7 @@ config VIDEO_CX88_DVB
31 31
32config VIDEO_CX88_ALSA 32config VIDEO_CX88_ALSA
33 tristate "ALSA DMA audio support" 33 tristate "ALSA DMA audio support"
34 depends on VIDEO_CX88 && SND 34 depends on VIDEO_CX88 && SND && EXPERIMENTAL
35 select SND_PCM_OSS
36 ---help--- 35 ---help---
37 This is a video4linux driver for direct (DMA) audio on 36 This is a video4linux driver for direct (DMA) audio on
38 Conexant 2388x based TV cards. 37 Conexant 2388x based TV cards.
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index e4b2134fe567..6e5eaa22619e 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -5,6 +5,7 @@ cx8802-objs := cx88-mpeg.o
5 5
6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o 6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o
7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o 7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o
8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
8 9
9EXTRA_CFLAGS += -I$(src)/.. 10EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 11EXTRA_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 7695b521eb35..a2e36a1e5f59 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -116,7 +116,7 @@ MODULE_LICENSE("GPL");
116MODULE_SUPPORTED_DEVICE("{{Conexant,23881}," 116MODULE_SUPPORTED_DEVICE("{{Conexant,23881},"
117 "{{Conexant,23882}," 117 "{{Conexant,23882},"
118 "{{Conexant,23883}"); 118 "{{Conexant,23883}");
119static unsigned int debug = 0; 119static unsigned int debug;
120module_param(debug,int,0644); 120module_param(debug,int,0644);
121MODULE_PARM_DESC(debug,"enable debug messages"); 121MODULE_PARM_DESC(debug,"enable debug messages");
122 122
@@ -333,10 +333,10 @@ static snd_pcm_hardware_t snd_cx88_digital_hw = {
333 .channels_min = 1, 333 .channels_min = 1,
334 .channels_max = 2, 334 .channels_max = 2,
335 .buffer_bytes_max = (2*2048), 335 .buffer_bytes_max = (2*2048),
336 .period_bytes_min = 256, 336 .period_bytes_min = 2048,
337 .period_bytes_max = 2048, 337 .period_bytes_max = 2048,
338 .periods_min = 2, 338 .periods_min = 2,
339 .periods_max = 16, 339 .periods_max = 2,
340}; 340};
341 341
342/* 342/*
@@ -653,7 +653,7 @@ static void snd_cx88_dev_free(snd_card_t * card)
653 * Alsa Constructor - Component probe 653 * Alsa Constructor - Component probe
654 */ 654 */
655 655
656static int devno=0; 656static int devno;
657static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci, 657static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci,
658 snd_cx88_card_t **rchip) 658 snd_cx88_card_t **rchip)
659{ 659{
@@ -805,7 +805,6 @@ static struct pci_driver cx88_audio_pci_driver = {
805 .id_table = cx88_audio_pci_tbl, 805 .id_table = cx88_audio_pci_tbl,
806 .probe = cx88_audio_initdev, 806 .probe = cx88_audio_initdev,
807 .remove = cx88_audio_finidev, 807 .remove = cx88_audio_finidev,
808 SND_PCI_PM_CALLBACKS
809}; 808};
810 809
811/**************************************************************************** 810/****************************************************************************
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 194446f28c55..8d6d6a6cf785 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -32,6 +32,7 @@
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/videodev2.h> 34#include <linux/videodev2.h>
35#include <linux/mutex.h>
35 36
36#include "cx88.h" 37#include "cx88.h"
37#include <media/v4l2-common.h> 38#include <media/v4l2-common.h>
@@ -75,7 +76,7 @@ MODULE_PARM_DESC(nocomb,"disable comb filter");
75 76
76static unsigned int cx88_devcount; 77static unsigned int cx88_devcount;
77static LIST_HEAD(cx88_devlist); 78static LIST_HEAD(cx88_devlist);
78static DECLARE_MUTEX(devlist); 79static DEFINE_MUTEX(devlist);
79 80
80#define NO_SYNC_LINE (-1U) 81#define NO_SYNC_LINE (-1U)
81 82
@@ -1036,7 +1037,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1036 struct list_head *item; 1037 struct list_head *item;
1037 int i; 1038 int i;
1038 1039
1039 down(&devlist); 1040 mutex_lock(&devlist);
1040 list_for_each(item,&cx88_devlist) { 1041 list_for_each(item,&cx88_devlist) {
1041 core = list_entry(item, struct cx88_core, devlist); 1042 core = list_entry(item, struct cx88_core, devlist);
1042 if (pci->bus->number != core->pci_bus) 1043 if (pci->bus->number != core->pci_bus)
@@ -1047,7 +1048,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1047 if (0 != get_ressources(core,pci)) 1048 if (0 != get_ressources(core,pci))
1048 goto fail_unlock; 1049 goto fail_unlock;
1049 atomic_inc(&core->refcount); 1050 atomic_inc(&core->refcount);
1050 up(&devlist); 1051 mutex_unlock(&devlist);
1051 return core; 1052 return core;
1052 } 1053 }
1053 core = kzalloc(sizeof(*core),GFP_KERNEL); 1054 core = kzalloc(sizeof(*core),GFP_KERNEL);
@@ -1122,13 +1123,13 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1122 cx88_card_setup(core); 1123 cx88_card_setup(core);
1123 cx88_ir_init(core,pci); 1124 cx88_ir_init(core,pci);
1124 1125
1125 up(&devlist); 1126 mutex_unlock(&devlist);
1126 return core; 1127 return core;
1127 1128
1128fail_free: 1129fail_free:
1129 kfree(core); 1130 kfree(core);
1130fail_unlock: 1131fail_unlock:
1131 up(&devlist); 1132 mutex_unlock(&devlist);
1132 return NULL; 1133 return NULL;
1133} 1134}
1134 1135
@@ -1140,14 +1141,14 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
1140 if (!atomic_dec_and_test(&core->refcount)) 1141 if (!atomic_dec_and_test(&core->refcount))
1141 return; 1142 return;
1142 1143
1143 down(&devlist); 1144 mutex_lock(&devlist);
1144 cx88_ir_fini(core); 1145 cx88_ir_fini(core);
1145 if (0 == core->i2c_rc) 1146 if (0 == core->i2c_rc)
1146 i2c_bit_del_bus(&core->i2c_adap); 1147 i2c_bit_del_bus(&core->i2c_adap);
1147 list_del(&core->devlist); 1148 list_del(&core->devlist);
1148 iounmap(core->lmmio); 1149 iounmap(core->lmmio);
1149 cx88_devcount--; 1150 cx88_devcount--;
1150 up(&devlist); 1151 mutex_unlock(&devlist);
1151 kfree(core); 1152 kfree(core);
1152} 1153}
1153 1154
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 24118e43e73a..da8d97ce0c4b 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;
60module_param(audio_debug, int, 0644); 60module_param(audio_debug, int, 0644);
61MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); 61MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]");
62 62
63static unsigned int always_analog = 0;
64module_param(always_analog,int,0644);
65MODULE_PARM_DESC(always_analog,"force analog audio out");
66
67
63#define dprintk(fmt, arg...) if (audio_debug) \ 68#define dprintk(fmt, arg...) if (audio_debug) \
64 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) 69 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
65 70
@@ -155,7 +160,8 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
155 cx_write(AUD_I2SOUTPUTCNTL, 1); 160 cx_write(AUD_I2SOUTPUTCNTL, 1);
156 cx_write(AUD_I2SCNTL, 0); 161 cx_write(AUD_I2SCNTL, 0);
157 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */ 162 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
158 } else { 163 }
164 if ((always_analog) || (!cx88_boards[core->board].blackbird)) {
159 ctl |= EN_DAC_ENABLE; 165 ctl |= EN_DAC_ENABLE;
160 cx_write(AUD_CTL, ctl); 166 cx_write(AUD_CTL, ctl);
161 } 167 }
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c
index 372cd29cedbd..751a754a45e9 100644
--- a/drivers/media/video/cx88/cx88-vp3054-i2c.c
+++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c
@@ -32,6 +32,10 @@
32#include "cx88-vp3054-i2c.h" 32#include "cx88-vp3054-i2c.h"
33 33
34 34
35MODULE_DESCRIPTION("driver for cx2388x VP3054 design");
36MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
37MODULE_LICENSE("GPL");
38
35/* ----------------------------------------------------------------------- */ 39/* ----------------------------------------------------------------------- */
36 40
37static void vp3054_bit_setscl(void *data, int state) 41static 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 9b94f77d6fd7..30dfa5370c73 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] = {
76 [ 0x40 ] = KEY_ZOOM, 76 [ 0x40 ] = KEY_ZOOM,
77}; 77};
78 78
79static IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE] = {
80 [ 0x3a ] = KEY_KP0,
81 [ 0x31 ] = KEY_KP1,
82 [ 0x32 ] = KEY_KP2,
83 [ 0x33 ] = KEY_KP3,
84 [ 0x34 ] = KEY_KP4,
85 [ 0x35 ] = KEY_KP5,
86 [ 0x36 ] = KEY_KP6,
87 [ 0x37 ] = KEY_KP7,
88 [ 0x38 ] = KEY_KP8,
89 [ 0x39 ] = KEY_KP9,
90
91 [ 0x2f ] = KEY_POWER,
92
93 [ 0x2e ] = KEY_P,
94 [ 0x1f ] = KEY_L,
95 [ 0x2b ] = KEY_I,
96
97 [ 0x2d ] = KEY_ZOOM,
98 [ 0x1e ] = KEY_ZOOM,
99 [ 0x1b ] = KEY_VOLUMEUP,
100 [ 0x0f ] = KEY_VOLUMEDOWN,
101 [ 0x17 ] = KEY_CHANNELUP,
102 [ 0x1c ] = KEY_CHANNELDOWN,
103 [ 0x25 ] = KEY_INFO,
104
105 [ 0x3c ] = KEY_MUTE,
106
107 [ 0x3d ] = KEY_LEFT,
108 [ 0x3b ] = KEY_RIGHT,
109
110 [ 0x3f ] = KEY_UP,
111 [ 0x3e ] = KEY_DOWN,
112 [ 0x1a ] = KEY_PAUSE,
113
114 [ 0x1d ] = KEY_MENU,
115 [ 0x19 ] = KEY_PLAY,
116 [ 0x16 ] = KEY_REWIND,
117 [ 0x13 ] = KEY_FORWARD,
118 [ 0x15 ] = KEY_PAUSE,
119 [ 0x0e ] = KEY_REWIND,
120 [ 0x0d ] = KEY_PLAY,
121 [ 0x0b ] = KEY_STOP,
122 [ 0x07 ] = KEY_FORWARD,
123 [ 0x27 ] = KEY_RECORD,
124 [ 0x26 ] = KEY_TUNER,
125 [ 0x29 ] = KEY_TEXT,
126 [ 0x2a ] = KEY_MEDIA,
127 [ 0x18 ] = KEY_EPG,
128 [ 0x27 ] = KEY_RECORD,
129};
130
79/* ----------------------------------------------------------------------- */ 131/* ----------------------------------------------------------------------- */
80 132
81static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 133static 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)
138 return 1; 190 return 1;
139} 191}
140 192
193static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
194{
195 unsigned char buf[3];
196
197 /* poll IR chip */
198
199 if (3 != i2c_master_recv(&ir->c,buf,3)) {
200 dprintk("read error\n");
201 return -EIO;
202 }
203
204 dprintk("key %02x\n", buf[2]&0x3f);
205 if (buf[0]!=0x00){
206 return 0;
207 }
208
209 *ir_key = buf[2]&0x3f;
210 *ir_raw = buf[2]&0x3f;
211
212 return 1;
213}
214
141/* ----------------------------------------------------------------------- */ 215/* ----------------------------------------------------------------------- */
142void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) 216void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
143{ 217{
@@ -159,6 +233,9 @@ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
159 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); 233 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)");
160 break; 234 break;
161 case (EM2820_BOARD_PINNACLE_USB_2): 235 case (EM2820_BOARD_PINNACLE_USB_2):
236 ir->ir_codes = ir_codes_em_pinnacle_usb;
237 ir->get_key = get_key_pinnacle_usb;
238 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)");
162 break; 239 break;
163 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): 240 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
164 ir->ir_codes = ir_codes_hauppauge_new; 241 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 3323dffe26a4..eea304f75176 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -29,6 +29,7 @@
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30#include <linux/version.h> 30#include <linux/version.h>
31#include <linux/video_decoder.h> 31#include <linux/video_decoder.h>
32#include <linux/mutex.h>
32 33
33#include "em28xx.h" 34#include "em28xx.h"
34#include <media/tuner.h> 35#include <media/tuner.h>
@@ -191,7 +192,7 @@ static struct v4l2_queryctrl saa711x_qctrl[] = {
191 192
192static struct usb_driver em28xx_usb_driver; 193static struct usb_driver em28xx_usb_driver;
193 194
194static DECLARE_MUTEX(em28xx_sysfs_lock); 195static DEFINE_MUTEX(em28xx_sysfs_lock);
195static DECLARE_RWSEM(em28xx_disconnect); 196static DECLARE_RWSEM(em28xx_disconnect);
196 197
197/********************* v4l2 interface ******************************************/ 198/********************* v4l2 interface ******************************************/
@@ -394,7 +395,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
394*/ 395*/
395static void em28xx_release_resources(struct em28xx *dev) 396static void em28xx_release_resources(struct em28xx *dev)
396{ 397{
397 down(&em28xx_sysfs_lock); 398 mutex_lock(&em28xx_sysfs_lock);
398 399
399 em28xx_info("V4L2 device /dev/video%d deregistered\n", 400 em28xx_info("V4L2 device /dev/video%d deregistered\n",
400 dev->vdev->minor); 401 dev->vdev->minor);
@@ -403,7 +404,7 @@ static void em28xx_release_resources(struct em28xx *dev)
403/* video_unregister_device(dev->vbi_dev); */ 404/* video_unregister_device(dev->vbi_dev); */
404 em28xx_i2c_unregister(dev); 405 em28xx_i2c_unregister(dev);
405 usb_put_dev(dev->udev); 406 usb_put_dev(dev->udev);
406 up(&em28xx_sysfs_lock); 407 mutex_unlock(&em28xx_sysfs_lock);
407} 408}
408 409
409/* 410/*
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 9b05a0ab776d..69ed369c2f48 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -66,12 +66,12 @@ MODULE_LICENSE("GPL");
66 66
67/* module parameters */ 67/* module parameters */
68static int opmode = OPMODE_AUTO; 68static int opmode = OPMODE_AUTO;
69int msp_debug = 0; /* msp_debug output */ 69int msp_debug; /* msp_debug output */
70int msp_once = 0; /* no continous stereo monitoring */ 70int msp_once; /* no continous stereo monitoring */
71int msp_amsound = 0; /* hard-wire AM sound at 6.5 Hz (france), 71int msp_amsound; /* hard-wire AM sound at 6.5 Hz (france),
72 the autoscan seems work well only with FM... */ 72 the autoscan seems work well only with FM... */
73int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */ 73int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */
74int msp_dolby = 0; 74int msp_dolby;
75 75
76int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual 76int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual
77 (msp34xxg only) 0x00a0-0x03c0 */ 77 (msp34xxg only) 0x00a0-0x03c0 */
@@ -1031,8 +1031,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
1031 } 1031 }
1032 1032
1033 default: 1033 default:
1034 /* nothing */ 1034 /* unknown */
1035 break; 1035 return -EINVAL;
1036 } 1036 }
1037 return 0; 1037 return 0;
1038} 1038}
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h
index 70a5ef8ba017..a9ac57d0700b 100644
--- a/drivers/media/video/msp3400.h
+++ b/drivers/media/video/msp3400.h
@@ -6,14 +6,6 @@
6 6
7/* ---------------------------------------------------------------------- */ 7/* ---------------------------------------------------------------------- */
8 8
9struct msp_matrix {
10 int input;
11 int output;
12};
13
14/* ioctl for MSP_SET_MATRIX will have to be registered */
15#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)
16
17/* This macro is allowed for *constants* only, gcc must calculate it 9/* This macro is allowed for *constants* only, gcc must calculate it
18 at compile time. Remember -- no floats in kernel mode */ 10 at compile time. Remember -- no floats in kernel mode */
19#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24))) 11#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 0bf1caac5887..c7c9f3f8715c 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)
353 } while (xok != 1 ); 353 } while (xok != 1 );
354 t->xogc=xogc; 354 t->xogc=xogc;
355 355
356 t->tv_freq = mt2032_set_tv_freq; 356 t->set_tv_freq = mt2032_set_tv_freq;
357 t->radio_freq = mt2032_set_radio_freq; 357 t->set_radio_freq = mt2032_set_radio_freq;
358 return(1); 358 return(1);
359} 359}
360 360
@@ -481,8 +481,8 @@ static int mt2050_init(struct i2c_client *c)
481 i2c_master_recv(c,buf,1); 481 i2c_master_recv(c,buf,1);
482 482
483 tuner_dbg("mt2050: sro is %x\n",buf[0]); 483 tuner_dbg("mt2050: sro is %x\n",buf[0]);
484 t->tv_freq = mt2050_set_tv_freq; 484 t->set_tv_freq = mt2050_set_tv_freq;
485 t->radio_freq = mt2050_set_radio_freq; 485 t->set_radio_freq = mt2050_set_radio_freq;
486 return 0; 486 return 0;
487} 487}
488 488
@@ -494,8 +494,8 @@ int microtune_init(struct i2c_client *c)
494 int company_code; 494 int company_code;
495 495
496 memset(buf,0,sizeof(buf)); 496 memset(buf,0,sizeof(buf));
497 t->tv_freq = NULL; 497 t->set_tv_freq = NULL;
498 t->radio_freq = NULL; 498 t->set_radio_freq = NULL;
499 t->standby = NULL; 499 t->standby = NULL;
500 if (t->std & V4L2_STD_525_60) { 500 if (t->std & V4L2_STD_525_60) {
501 tuner_dbg("pinnacle ntsc\n"); 501 tuner_dbg("pinnacle ntsc\n");
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
index b19c33434eaf..f3fc361bec97 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -76,9 +76,9 @@ static volatile struct planb_registers *planb_regs;
76static int def_norm = PLANB_DEF_NORM; /* default norm */ 76static int def_norm = PLANB_DEF_NORM; /* default norm */
77static int video_nr = -1; 77static int video_nr = -1;
78 78
79MODULE_PARM(def_norm, "i"); 79module_param(def_norm, int, 0);
80MODULE_PARM_DESC(def_norm, "Default startup norm (0=PAL, 1=NTSC, 2=SECAM)"); 80MODULE_PARM_DESC(def_norm, "Default startup norm (0=PAL, 1=NTSC, 2=SECAM)");
81MODULE_PARM(video_nr,"i"); 81module_param(video_nr, int, 0);
82MODULE_LICENSE("GPL"); 82MODULE_LICENSE("GPL");
83 83
84 84
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c
index e70b17ef36e9..d17395c4f55c 100644
--- a/drivers/media/video/saa6588.c
+++ b/drivers/media/video/saa6588.c
@@ -50,15 +50,15 @@ static unsigned int rbds = 0;
50static unsigned int plvl = 0; 50static unsigned int plvl = 0;
51static unsigned int bufblocks = 100; 51static unsigned int bufblocks = 100;
52 52
53MODULE_PARM(debug, "i"); 53module_param(debug, int, 0644);
54MODULE_PARM_DESC(debug, "enable debug messages"); 54MODULE_PARM_DESC(debug, "enable debug messages");
55MODULE_PARM(xtal, "i"); 55module_param(xtal, int, 0);
56MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0"); 56MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0");
57MODULE_PARM(rbds, "i"); 57module_param(rbds, int, 0);
58MODULE_PARM_DESC(rbds, "select mode, 0=RDS, 1=RBDS, default 0"); 58MODULE_PARM_DESC(rbds, "select mode, 0=RDS, 1=RBDS, default 0");
59MODULE_PARM(plvl, "i"); 59module_param(plvl, int, 0);
60MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0"); 60MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0");
61MODULE_PARM(bufblocks, "i"); 61module_param(bufblocks, int, 0);
62MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100"); 62MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100");
63 63
64MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder"); 64MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder");
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c
index ae53063875f9..6c161f2f5e2c 100644
--- a/drivers/media/video/saa711x.c
+++ b/drivers/media/video/saa711x.c
@@ -52,7 +52,7 @@ MODULE_LICENSE("GPL");
52#include <linux/video_decoder.h> 52#include <linux/video_decoder.h>
53 53
54static int debug = 0; 54static int debug = 0;
55MODULE_PARM(debug, "i"); 55module_param(debug, int, 0644);
56MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)"); 56MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)");
57 57
58 58
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 275d06af69d2..c64718aec9cb 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[] = {
2515 .tuner_addr = ADDR_UNSET, 2515 .tuner_addr = ADDR_UNSET,
2516 .radio_addr = ADDR_UNSET, 2516 .radio_addr = ADDR_UNSET,
2517 .mpeg = SAA7134_MPEG_DVB, 2517 .mpeg = SAA7134_MPEG_DVB,
2518 .gpiomask = 1 << 21,
2518 .inputs = {{ 2519 .inputs = {{
2519 .name = name_tv, 2520 .name = name_tv,
2520 .vmux = 1, 2521 .vmux = 1,
@@ -2529,6 +2530,11 @@ struct saa7134_board saa7134_boards[] = {
2529 .vmux = 8, 2530 .vmux = 8,
2530 .amux = LINE1, 2531 .amux = LINE1,
2531 }}, 2532 }},
2533 .radio = {
2534 .name = name_radio,
2535 .amux = TV,
2536 .gpio = 0x0200000,
2537 },
2532 }, 2538 },
2533 [SAA7134_BOARD_MSI_TVATANYWHERE_PLUS] = { 2539 [SAA7134_BOARD_MSI_TVATANYWHERE_PLUS] = {
2534 .name = "MSI TV@Anywhere plus", 2540 .name = "MSI TV@Anywhere plus",
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 3983a6524cac..028904bd94a2 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -31,6 +31,7 @@
31#include <linux/sound.h> 31#include <linux/sound.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/mutex.h>
34 35
35#include "saa7134-reg.h" 36#include "saa7134-reg.h"
36#include "saa7134.h" 37#include "saa7134.h"
@@ -84,7 +85,7 @@ MODULE_PARM_DESC(radio_nr, "radio device number");
84MODULE_PARM_DESC(tuner, "tuner type"); 85MODULE_PARM_DESC(tuner, "tuner type");
85MODULE_PARM_DESC(card, "card type"); 86MODULE_PARM_DESC(card, "card type");
86 87
87static DECLARE_MUTEX(devlist_lock); 88static DEFINE_MUTEX(devlist_lock);
88LIST_HEAD(saa7134_devlist); 89LIST_HEAD(saa7134_devlist);
89static LIST_HEAD(mops_list); 90static LIST_HEAD(mops_list);
90static unsigned int saa7134_devcount; 91static unsigned int saa7134_devcount;
@@ -140,7 +141,7 @@ static int pending_call(struct notifier_block *self, unsigned long state,
140 return NOTIFY_DONE; 141 return NOTIFY_DONE;
141} 142}
142 143
143static int pending_registered=0; 144static int pending_registered;
144static struct notifier_block pending_notifier = { 145static struct notifier_block pending_notifier = {
145 .notifier_call = pending_call, 146 .notifier_call = pending_call,
146}; 147};
@@ -969,13 +970,13 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
969 pci_set_drvdata(pci_dev,dev); 970 pci_set_drvdata(pci_dev,dev);
970 saa7134_devcount++; 971 saa7134_devcount++;
971 972
972 down(&devlist_lock); 973 mutex_lock(&devlist_lock);
973 list_for_each(item,&mops_list) { 974 list_for_each(item,&mops_list) {
974 mops = list_entry(item, struct saa7134_mpeg_ops, next); 975 mops = list_entry(item, struct saa7134_mpeg_ops, next);
975 mpeg_ops_attach(mops, dev); 976 mpeg_ops_attach(mops, dev);
976 } 977 }
977 list_add_tail(&dev->devlist,&saa7134_devlist); 978 list_add_tail(&dev->devlist,&saa7134_devlist);
978 up(&devlist_lock); 979 mutex_unlock(&devlist_lock);
979 980
980 /* check for signal */ 981 /* check for signal */
981 saa7134_irq_video_intl(dev); 982 saa7134_irq_video_intl(dev);
@@ -1031,13 +1032,13 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1031 saa7134_hwfini(dev); 1032 saa7134_hwfini(dev);
1032 1033
1033 /* unregister */ 1034 /* unregister */
1034 down(&devlist_lock); 1035 mutex_lock(&devlist_lock);
1035 list_del(&dev->devlist); 1036 list_del(&dev->devlist);
1036 list_for_each(item,&mops_list) { 1037 list_for_each(item,&mops_list) {
1037 mops = list_entry(item, struct saa7134_mpeg_ops, next); 1038 mops = list_entry(item, struct saa7134_mpeg_ops, next);
1038 mpeg_ops_detach(mops, dev); 1039 mpeg_ops_detach(mops, dev);
1039 } 1040 }
1040 up(&devlist_lock); 1041 mutex_unlock(&devlist_lock);
1041 saa7134_devcount--; 1042 saa7134_devcount--;
1042 1043
1043 saa7134_i2c_unregister(dev); 1044 saa7134_i2c_unregister(dev);
@@ -1071,13 +1072,13 @@ int saa7134_ts_register(struct saa7134_mpeg_ops *ops)
1071 struct list_head *item; 1072 struct list_head *item;
1072 struct saa7134_dev *dev; 1073 struct saa7134_dev *dev;
1073 1074
1074 down(&devlist_lock); 1075 mutex_lock(&devlist_lock);
1075 list_for_each(item,&saa7134_devlist) { 1076 list_for_each(item,&saa7134_devlist) {
1076 dev = list_entry(item, struct saa7134_dev, devlist); 1077 dev = list_entry(item, struct saa7134_dev, devlist);
1077 mpeg_ops_attach(ops, dev); 1078 mpeg_ops_attach(ops, dev);
1078 } 1079 }
1079 list_add_tail(&ops->next,&mops_list); 1080 list_add_tail(&ops->next,&mops_list);
1080 up(&devlist_lock); 1081 mutex_unlock(&devlist_lock);
1081 return 0; 1082 return 0;
1082} 1083}
1083 1084
@@ -1086,13 +1087,13 @@ void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops)
1086 struct list_head *item; 1087 struct list_head *item;
1087 struct saa7134_dev *dev; 1088 struct saa7134_dev *dev;
1088 1089
1089 down(&devlist_lock); 1090 mutex_lock(&devlist_lock);
1090 list_del(&ops->next); 1091 list_del(&ops->next);
1091 list_for_each(item,&saa7134_devlist) { 1092 list_for_each(item,&saa7134_devlist) {
1092 dev = list_entry(item, struct saa7134_dev, devlist); 1093 dev = list_entry(item, struct saa7134_dev, devlist);
1093 mpeg_ops_detach(ops, dev); 1094 mpeg_ops_detach(ops, dev);
1094 } 1095 }
1095 up(&devlist_lock); 1096 mutex_unlock(&devlist_lock);
1096} 1097}
1097 1098
1098EXPORT_SYMBOL(saa7134_ts_register); 1099EXPORT_SYMBOL(saa7134_ts_register);
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 93268427750d..afa4dcb3f96d 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)
180 saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); 180 saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff);
181 saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); 181 saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff);
182 saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); 182 saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff);
183 // frame locked audio was reported not to be reliable 183 /* frame locked audio is mandatory for NICAM */
184 saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x02); 184 saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01);
185 185
186 saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); 186 saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14);
187 saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); 187 saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50);
@@ -809,7 +809,12 @@ static int tvaudio_thread_ddep(void *data)
809 dprintk("ddep override: %s\n",stdres[audio_ddep]); 809 dprintk("ddep override: %s\n",stdres[audio_ddep]);
810 } else if (&card(dev).radio == dev->input) { 810 } else if (&card(dev).radio == dev->input) {
811 dprintk("FM Radio\n"); 811 dprintk("FM Radio\n");
812 norms = (0x0f << 2) | 0x01; 812 if (dev->tuner_type == TUNER_PHILIPS_TDA8290) {
813 norms = (0x11 << 2) | 0x01;
814 saa_dsp_writel(dev, 0x42c >> 2, 0x729555);
815 } else {
816 norms = (0x0f << 2) | 0x01;
817 }
813 } else { 818 } else {
814 /* (let chip) scan for sound carrier */ 819 /* (let chip) scan for sound carrier */
815 norms = 0; 820 norms = 0;
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 2498b76df429..7b4fb282ac82 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -567,8 +567,8 @@ int tda8290_init(struct i2c_client *c)
567 } 567 }
568 tuner_info("tuner: type set to %s\n", c->name); 568 tuner_info("tuner: type set to %s\n", c->name);
569 569
570 t->tv_freq = set_tv_freq; 570 t->set_tv_freq = set_tv_freq;
571 t->radio_freq = set_radio_freq; 571 t->set_radio_freq = set_radio_freq;
572 t->has_signal = has_signal; 572 t->has_signal = has_signal;
573 t->standby = standby; 573 t->standby = standby;
574 t->tda827x_lpsel = 0; 574 t->tda827x_lpsel = 0;
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index 921fe72f23d5..c2b98f81c192 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -62,7 +62,7 @@ extern int tuner_debug;
62 62
63#define TEA5767_PORT1_HIGH 0x01 63#define TEA5767_PORT1_HIGH 0x01
64 64
65/* Forth register */ 65/* Fourth register */
66#define TEA5767_PORT2_HIGH 0x80 66#define TEA5767_PORT2_HIGH 0x80
67/* Chips stops working. Only I2C bus remains on */ 67/* Chips stops working. Only I2C bus remains on */
68#define TEA5767_STDBY 0x40 68#define TEA5767_STDBY 0x40
@@ -85,7 +85,7 @@ extern int tuner_debug;
85/* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ 85/* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */
86#define TEA5767_SRCH_IND 0x01 86#define TEA5767_SRCH_IND 0x01
87 87
88/* Fiveth register */ 88/* Fifth register */
89 89
90/* By activating, it will use Xtal at 13 MHz as reference for divider */ 90/* By activating, it will use Xtal at 13 MHz as reference for divider */
91#define TEA5767_PLLREF_ENABLE 0x80 91#define TEA5767_PLLREF_ENABLE 0x80
@@ -109,13 +109,13 @@ extern int tuner_debug;
109#define TEA5767_STEREO_MASK 0x80 109#define TEA5767_STEREO_MASK 0x80
110#define TEA5767_IF_CNTR_MASK 0x7f 110#define TEA5767_IF_CNTR_MASK 0x7f
111 111
112/* Four register */ 112/* Fourth register */
113#define TEA5767_ADC_LEVEL_MASK 0xf0 113#define TEA5767_ADC_LEVEL_MASK 0xf0
114 114
115/* should be 0 */ 115/* should be 0 */
116#define TEA5767_CHIP_ID_MASK 0x0f 116#define TEA5767_CHIP_ID_MASK 0x0f
117 117
118/* Fiveth register */ 118/* Fifth register */
119/* Reserved for future extensions */ 119/* Reserved for future extensions */
120#define TEA5767_RESERVED_MASK 0xff 120#define TEA5767_RESERVED_MASK 0xff
121 121
@@ -220,19 +220,19 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
220 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); 220 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
221 buffer[2] |= TEA5767_HIGH_LO_INJECT; 221 buffer[2] |= TEA5767_HIGH_LO_INJECT;
222 buffer[4] |= TEA5767_PLLREF_ENABLE; 222 buffer[4] |= TEA5767_PLLREF_ENABLE;
223 div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000; 223 div = (frq * (4000 / 16) + 700000 + 225000 + 25000) / 50000;
224 break; 224 break;
225 case TEA5767_LOW_LO_13MHz: 225 case TEA5767_LOW_LO_13MHz:
226 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); 226 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
227 227
228 buffer[4] |= TEA5767_PLLREF_ENABLE; 228 buffer[4] |= TEA5767_PLLREF_ENABLE;
229 div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000; 229 div = (frq * (4000 / 16) - 700000 - 225000 + 25000) / 50000;
230 break; 230 break;
231 case TEA5767_LOW_LO_32768: 231 case TEA5767_LOW_LO_32768:
232 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); 232 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
233 buffer[3] |= TEA5767_XTAL_32768; 233 buffer[3] |= TEA5767_XTAL_32768;
234 /* const 700=4000*175 Khz - to adjust freq to right value */ 234 /* const 700=4000*175 Khz - to adjust freq to right value */
235 div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15; 235 div = ((frq * (4000 / 16) - 700000 - 225000) + 16384) >> 15;
236 break; 236 break;
237 case TEA5767_HIGH_LO_32768: 237 case TEA5767_HIGH_LO_32768:
238 default: 238 default:
@@ -350,8 +350,8 @@ int tea5767_tuner_init(struct i2c_client *c)
350 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); 350 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
351 strlcpy(c->name, "tea5767", sizeof(c->name)); 351 strlcpy(c->name, "tea5767", sizeof(c->name));
352 352
353 t->tv_freq = set_tv_freq; 353 t->set_tv_freq = set_tv_freq;
354 t->radio_freq = set_radio_freq; 354 t->set_radio_freq = set_radio_freq;
355 t->has_signal = tea5767_signal; 355 t->has_signal = tea5767_signal;
356 t->is_stereo = tea5767_stereo; 356 t->is_stereo = tea5767_stereo;
357 t->standby = tea5767_standby; 357 t->standby = tea5767_standby;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index f30ef79d795e..2995b22acb43 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)
82 tuner_warn ("tuner type not set\n"); 82 tuner_warn ("tuner type not set\n");
83 return; 83 return;
84 } 84 }
85 if (NULL == t->tv_freq) { 85 if (NULL == t->set_tv_freq) {
86 tuner_warn ("Tuner has no way to set tv freq\n"); 86 tuner_warn ("Tuner has no way to set tv freq\n");
87 return; 87 return;
88 } 88 }
@@ -90,8 +90,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
90 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", 90 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n",
91 freq / 16, freq % 16 * 100 / 16, tv_range[0], 91 freq / 16, freq % 16 * 100 / 16, tv_range[0],
92 tv_range[1]); 92 tv_range[1]);
93 /* V4L2 spec: if the freq is not possible then the closest
94 possible value should be selected */
95 if (freq < tv_range[0] * 16)
96 freq = tv_range[0] * 16;
97 else
98 freq = tv_range[1] * 16;
93 } 99 }
94 t->tv_freq(c, freq); 100 t->set_tv_freq(c, freq);
95} 101}
96 102
97static void set_radio_freq(struct i2c_client *c, unsigned int freq) 103static 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)
102 tuner_warn ("tuner type not set\n"); 108 tuner_warn ("tuner type not set\n");
103 return; 109 return;
104 } 110 }
105 if (NULL == t->radio_freq) { 111 if (NULL == t->set_radio_freq) {
106 tuner_warn ("tuner has no way to set radio frequency\n"); 112 tuner_warn ("tuner has no way to set radio frequency\n");
107 return; 113 return;
108 } 114 }
109 if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) { 115 if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) {
110 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", 116 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n",
111 freq / 16000, freq % 16000 * 100 / 16000, 117 freq / 16000, freq % 16000 * 100 / 16000,
112 radio_range[0], radio_range[1]); 118 radio_range[0], radio_range[1]);
119 /* V4L2 spec: if the freq is not possible then the closest
120 possible value should be selected */
121 if (freq < radio_range[0] * 16000)
122 freq = radio_range[0] * 16000;
123 else
124 freq = radio_range[1] * 16000;
113 } 125 }
114 126
115 t->radio_freq(c, freq); 127 t->set_radio_freq(c, freq);
116 return;
117} 128}
118 129
119static void set_freq(struct i2c_client *c, unsigned long freq) 130static 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)
125 tuner_dbg("radio freq set to %lu.%02lu\n", 136 tuner_dbg("radio freq set to %lu.%02lu\n",
126 freq / 16000, freq % 16000 * 100 / 16000); 137 freq / 16000, freq % 16000 * 100 / 16000);
127 set_radio_freq(c, freq); 138 set_radio_freq(c, freq);
139 t->radio_freq = freq;
128 break; 140 break;
129 case V4L2_TUNER_ANALOG_TV: 141 case V4L2_TUNER_ANALOG_TV:
130 case V4L2_TUNER_DIGITAL_TV: 142 case V4L2_TUNER_DIGITAL_TV:
131 tuner_dbg("tv freq set to %lu.%02lu\n", 143 tuner_dbg("tv freq set to %lu.%02lu\n",
132 freq / 16, freq % 16 * 100 / 16); 144 freq / 16, freq % 16 * 100 / 16);
133 set_tv_freq(c, freq); 145 set_tv_freq(c, freq);
146 t->tv_freq = freq;
134 break; 147 break;
135 } 148 }
136 t->freq = freq;
137} 149}
138 150
139static void set_type(struct i2c_client *c, unsigned int type, 151static 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,
212 if (t->mode_mask == T_UNINITIALIZED) 224 if (t->mode_mask == T_UNINITIALIZED)
213 t->mode_mask = new_mode_mask; 225 t->mode_mask = new_mode_mask;
214 226
215 set_freq(c, t->freq); 227 set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq);
216 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", 228 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
217 c->adapter->name, c->driver->driver.name, c->addr << 1, type, 229 c->adapter->name, c->driver->driver.name, c->addr << 1, type,
218 t->mode_mask); 230 t->mode_mask);
@@ -377,11 +389,11 @@ static void tuner_status(struct i2c_client *client)
377 default: p = "undefined"; break; 389 default: p = "undefined"; break;
378 } 390 }
379 if (t->mode == V4L2_TUNER_RADIO) { 391 if (t->mode == V4L2_TUNER_RADIO) {
380 freq = t->freq / 16000; 392 freq = t->radio_freq / 16000;
381 freq_fraction = (t->freq % 16000) * 100 / 16000; 393 freq_fraction = (t->radio_freq % 16000) * 100 / 16000;
382 } else { 394 } else {
383 freq = t->freq / 16; 395 freq = t->tv_freq / 16;
384 freq_fraction = (t->freq % 16) * 100 / 16; 396 freq_fraction = (t->tv_freq % 16) * 100 / 16;
385 } 397 }
386 tuner_info("Tuner mode: %s\n", p); 398 tuner_info("Tuner mode: %s\n", p);
387 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); 399 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)
456 t->type = TUNER_TEA5767; 468 t->type = TUNER_TEA5767;
457 t->mode_mask = T_RADIO; 469 t->mode_mask = T_RADIO;
458 t->mode = T_STANDBY; 470 t->mode = T_STANDBY;
459 t->freq = 87.5 * 16; /* Sets freq to FM range */ 471 t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */
460 default_mode_mask &= ~T_RADIO; 472 default_mode_mask &= ~T_RADIO;
461 473
462 goto register_client; 474 goto register_client;
@@ -469,7 +481,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
469 if (default_mode_mask != T_UNINITIALIZED) { 481 if (default_mode_mask != T_UNINITIALIZED) {
470 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); 482 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask);
471 t->mode_mask = default_mode_mask; 483 t->mode_mask = default_mode_mask;
472 t->freq = 400 * 16; /* Sets freq to VHF High */ 484 t->tv_freq = 400 * 16; /* Sets freq to VHF High */
485 t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */
473 default_mode_mask = T_UNINITIALIZED; 486 default_mode_mask = T_UNINITIALIZED;
474 } 487 }
475 488
@@ -565,16 +578,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
565 set_addr(client, (struct tuner_setup *)arg); 578 set_addr(client, (struct tuner_setup *)arg);
566 break; 579 break;
567 case AUDC_SET_RADIO: 580 case AUDC_SET_RADIO:
568 set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); 581 if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO")
582 == EINVAL)
583 return 0;
584 if (t->radio_freq)
585 set_freq(client, t->radio_freq);
569 break; 586 break;
570 case TUNER_SET_STANDBY: 587 case TUNER_SET_STANDBY:
571 { 588 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
572 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) 589 return 0;
573 return 0; 590 if (t->standby)
574 if (t->standby) 591 t->standby (client);
575 t->standby (client); 592 break;
576 break;
577 }
578 case VIDIOCSAUDIO: 593 case VIDIOCSAUDIO:
579 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) 594 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
580 return 0; 595 return 0;
@@ -583,7 +598,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
583 598
584 /* Should be implemented, since bttv calls it */ 599 /* Should be implemented, since bttv calls it */
585 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 600 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
586
587 break; 601 break;
588 /* --- v4l ioctls --- */ 602 /* --- v4l ioctls --- */
589 /* take care: bttv does userspace copying, we'll get a 603 /* 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)
609 if (vc->norm < ARRAY_SIZE(map)) 623 if (vc->norm < ARRAY_SIZE(map))
610 t->std = map[vc->norm]; 624 t->std = map[vc->norm];
611 tuner_fixup_std(t); 625 tuner_fixup_std(t);
612 if (t->freq) 626 if (t->tv_freq)
613 set_tv_freq(client, t->freq); 627 set_tv_freq(client, t->tv_freq);
614 return 0; 628 return 0;
615 } 629 }
616 case VIDIOCSFREQ: 630 case VIDIOCSFREQ:
@@ -684,15 +698,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
684 698
685 t->std = *id; 699 t->std = *id;
686 tuner_fixup_std(t); 700 tuner_fixup_std(t);
687 if (t->freq) 701 if (t->tv_freq)
688 set_freq(client, t->freq); 702 set_freq(client, t->tv_freq);
689 break; 703 break;
690 } 704 }
691 case VIDIOC_S_FREQUENCY: 705 case VIDIOC_S_FREQUENCY:
692 { 706 {
693 struct v4l2_frequency *f = arg; 707 struct v4l2_frequency *f = arg;
694 708
695 t->freq = f->frequency;
696 switch_v4l2(); 709 switch_v4l2();
697 if (V4L2_TUNER_RADIO == f->type && 710 if (V4L2_TUNER_RADIO == f->type &&
698 V4L2_TUNER_RADIO != t->mode) { 711 V4L2_TUNER_RADIO != t->mode) {
@@ -700,7 +713,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
700 == EINVAL) 713 == EINVAL)
701 return 0; 714 return 0;
702 } 715 }
703 set_freq(client,t->freq); 716 set_freq(client,f->frequency);
704 717
705 break; 718 break;
706 } 719 }
@@ -712,7 +725,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
712 return 0; 725 return 0;
713 switch_v4l2(); 726 switch_v4l2();
714 f->type = t->mode; 727 f->type = t->mode;
715 f->frequency = t->freq; 728 f->frequency = (V4L2_TUNER_RADIO == t->mode) ?
729 t->radio_freq : t->tv_freq;
716 break; 730 break;
717 } 731 }
718 case VIDIOC_G_TUNER: 732 case VIDIOC_G_TUNER:
@@ -763,7 +777,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
763 777
764 if (V4L2_TUNER_RADIO == t->mode) { 778 if (V4L2_TUNER_RADIO == t->mode) {
765 t->audmode = tuner->audmode; 779 t->audmode = tuner->audmode;
766 set_radio_freq(client, t->freq); 780 set_radio_freq(client, t->radio_freq);
767 } 781 }
768 break; 782 break;
769 } 783 }
@@ -791,8 +805,13 @@ static int tuner_resume(struct device *dev)
791 struct tuner *t = i2c_get_clientdata (c); 805 struct tuner *t = i2c_get_clientdata (c);
792 806
793 tuner_dbg ("resume\n"); 807 tuner_dbg ("resume\n");
794 if (t->freq) 808 if (V4L2_TUNER_RADIO == t->mode) {
795 set_freq(c, t->freq); 809 if (t->radio_freq)
810 set_freq(c, t->radio_freq);
811 } else {
812 if (t->tv_freq)
813 set_freq(c, t->tv_freq);
814 }
796 return 0; 815 return 0;
797} 816}
798 817
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index e5fb74365836..37977ff49780 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");
79#define TUNER_PLL_LOCKED 0x40 79#define TUNER_PLL_LOCKED 0x40
80#define TUNER_STEREO_MK3 0x04 80#define TUNER_STEREO_MK3 0x04
81 81
82#define TUNER_MAX_RANGES 3 82#define TUNER_PARAM_ANALOG 0 /* to be removed */
83 83/* FIXME:
84/* ---------------------------------------------------------------------- */ 84 * Right now, all tuners are using the first tuner_params[] array element
85 85 * for analog mode. In the future, we will be merging similar tuner
86struct tunertype 86 * definitions together, such that each tuner definition will have a
87{ 87 * tuner_params struct for each available video standard. At that point,
88 char *name; 88 * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array
89 89 * element will be chosen based on the video standard in use.
90 int count; 90 *
91 struct {
92 unsigned short thresh;
93 unsigned char cb;
94 } ranges[TUNER_MAX_RANGES];
95 unsigned char config;
96};
97
98/*
99 * The floats in the tuner struct are computed at compile time
100 * by gcc and cast back to integers. Thus we don't violate the
101 * "no float in kernel" rule.
102 */ 91 */
103static struct tunertype tuners[] = {
104 /* 0-9 */
105 [TUNER_TEMIC_PAL] = { /* TEMIC PAL */
106 .name = "Temic PAL (4002 FH5)",
107 .count = 3,
108 .ranges = {
109 { 16 * 140.25 /*MHz*/, 0x02, },
110 { 16 * 463.25 /*MHz*/, 0x04, },
111 { 16 * 999.99 , 0x01, },
112 },
113 .config = 0x8e,
114 },
115 [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */
116 .name = "Philips PAL_I (FI1246 and compatibles)",
117 .count = 3,
118 .ranges = {
119 { 16 * 140.25 /*MHz*/, 0xa0, },
120 { 16 * 463.25 /*MHz*/, 0x90, },
121 { 16 * 999.99 , 0x30, },
122 },
123 .config = 0x8e,
124 },
125 [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */
126 .name = "Philips NTSC (FI1236,FM1236 and compatibles)",
127 .count = 3,
128 .ranges = {
129 { 16 * 157.25 /*MHz*/, 0xa0, },
130 { 16 * 451.25 /*MHz*/, 0x90, },
131 { 16 * 999.99 , 0x30, },
132 },
133 .config = 0x8e,
134 },
135 [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */
136 .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
137 .count = 3,
138 .ranges = {
139 { 16 * 168.25 /*MHz*/, 0xa7, },
140 { 16 * 447.25 /*MHz*/, 0x97, },
141 { 16 * 999.99 , 0x37, },
142 },
143 .config = 0x8e,
144 },
145 [TUNER_ABSENT] = { /* Tuner Absent */
146 .name = "NoTuner",
147 .count = 1,
148 .ranges = {
149 { 0, 0x00, },
150 },
151 .config = 0x00,
152 },
153 [TUNER_PHILIPS_PAL] = { /* Philips PAL */
154 .name = "Philips PAL_BG (FI1216 and compatibles)",
155 .count = 3,
156 .ranges = {
157 { 16 * 168.25 /*MHz*/, 0xa0, },
158 { 16 * 447.25 /*MHz*/, 0x90, },
159 { 16 * 999.99 , 0x30, },
160 },
161 .config = 0x8e,
162 },
163 [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */
164 .name = "Temic NTSC (4032 FY5)",
165 .count = 3,
166 .ranges = {
167 { 16 * 157.25 /*MHz*/, 0x02, },
168 { 16 * 463.25 /*MHz*/, 0x04, },
169 { 16 * 999.99 , 0x01, },
170 },
171 .config = 0x8e,
172 },
173 [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */
174 .name = "Temic PAL_I (4062 FY5)",
175 .count = 3,
176 .ranges = {
177 { 16 * 170.00 /*MHz*/, 0x02, },
178 { 16 * 450.00 /*MHz*/, 0x04, },
179 { 16 * 999.99 , 0x01, },
180 },
181 .config = 0x8e,
182 },
183 [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */
184 .name = "Temic NTSC (4036 FY5)",
185 .count = 3,
186 .ranges = {
187 { 16 * 157.25 /*MHz*/, 0xa0, },
188 { 16 * 463.25 /*MHz*/, 0x90, },
189 { 16 * 999.99 , 0x30, },
190 },
191 .config = 0x8e,
192 },
193 [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */
194 .name = "Alps HSBH1",
195 .count = 3,
196 .ranges = {
197 { 16 * 137.25 /*MHz*/, 0x01, },
198 { 16 * 385.25 /*MHz*/, 0x02, },
199 { 16 * 999.99 , 0x08, },
200 },
201 .config = 0x8e,
202 },
203
204 /* 10-19 */
205 [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */
206 .name = "Alps TSBE1",
207 .count = 3,
208 .ranges = {
209 { 16 * 137.25 /*MHz*/, 0x01, },
210 { 16 * 385.25 /*MHz*/, 0x02, },
211 { 16 * 999.99 , 0x08, },
212 },
213 .config = 0x8e,
214 },
215 [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */
216 .name = "Alps TSBB5",
217 .count = 3,
218 .ranges = {
219 { 16 * 133.25 /*MHz*/, 0x01, },
220 { 16 * 351.25 /*MHz*/, 0x02, },
221 { 16 * 999.99 , 0x08, },
222 },
223 .config = 0x8e,
224 },
225 [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */
226 .name = "Alps TSBE5",
227 .count = 3,
228 .ranges = {
229 { 16 * 133.25 /*MHz*/, 0x01, },
230 { 16 * 351.25 /*MHz*/, 0x02, },
231 { 16 * 999.99 , 0x08, },
232 },
233 .config = 0x8e,
234 },
235 [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */
236 .name = "Alps TSBC5",
237 .count = 3,
238 .ranges = {
239 { 16 * 133.25 /*MHz*/, 0x01, },
240 { 16 * 351.25 /*MHz*/, 0x02, },
241 { 16 * 999.99 , 0x08, },
242 },
243 .config = 0x8e,
244 },
245 [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */
246 .name = "Temic PAL_BG (4006FH5)",
247 .count = 3,
248 .ranges = {
249 { 16 * 170.00 /*MHz*/, 0xa0, },
250 { 16 * 450.00 /*MHz*/, 0x90, },
251 { 16 * 999.99 , 0x30, },
252 },
253 .config = 0x8e,
254 },
255 [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */
256 .name = "Alps TSCH6",
257 .count = 3,
258 .ranges = {
259 { 16 * 137.25 /*MHz*/, 0x14, },
260 { 16 * 385.25 /*MHz*/, 0x12, },
261 { 16 * 999.99 , 0x11, },
262 },
263 .config = 0x8e,
264 },
265 [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */
266 .name = "Temic PAL_DK (4016 FY5)",
267 .count = 3,
268 .ranges = {
269 { 16 * 168.25 /*MHz*/, 0xa0, },
270 { 16 * 456.25 /*MHz*/, 0x90, },
271 { 16 * 999.99 , 0x30, },
272 },
273 .config = 0x8e,
274 },
275 [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */
276 .name = "Philips NTSC_M (MK2)",
277 .count = 3,
278 .ranges = {
279 { 16 * 160.00 /*MHz*/, 0xa0, },
280 { 16 * 454.00 /*MHz*/, 0x90, },
281 { 16 * 999.99 , 0x30, },
282 },
283 .config = 0x8e,
284 },
285 [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */
286 .name = "Temic PAL_I (4066 FY5)",
287 .count = 3,
288 .ranges = {
289 { 16 * 169.00 /*MHz*/, 0xa0, },
290 { 16 * 454.00 /*MHz*/, 0x90, },
291 { 16 * 999.99 , 0x30, },
292 },
293 .config = 0x8e,
294 },
295 [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */
296 .name = "Temic PAL* auto (4006 FN5)",
297 .count = 3,
298 .ranges = {
299 { 16 * 169.00 /*MHz*/, 0xa0, },
300 { 16 * 454.00 /*MHz*/, 0x90, },
301 { 16 * 999.99 , 0x30, },
302 },
303 .config = 0x8e,
304 },
305
306 /* 20-29 */
307 [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */
308 .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
309 .count = 3,
310 .ranges = {
311 { 16 * 141.00 /*MHz*/, 0xa0, },
312 { 16 * 464.00 /*MHz*/, 0x90, },
313 { 16 * 999.99 , 0x30, },
314 },
315 .config = 0x8e,
316 },
317 [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */
318 .name = "Temic NTSC (4039 FR5)",
319 .count = 3,
320 .ranges = {
321 { 16 * 158.00 /*MHz*/, 0xa0, },
322 { 16 * 453.00 /*MHz*/, 0x90, },
323 { 16 * 999.99 , 0x30, },
324 },
325 .config = 0x8e,
326 },
327 [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */
328 .name = "Temic PAL/SECAM multi (4046 FM5)",
329 .count = 3,
330 .ranges = {
331 { 16 * 169.00 /*MHz*/, 0xa0, },
332 { 16 * 454.00 /*MHz*/, 0x90, },
333 { 16 * 999.99 , 0x30, },
334 },
335 .config = 0x8e,
336 },
337 [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */
338 .name = "Philips PAL_DK (FI1256 and compatibles)",
339 .count = 3,
340 .ranges = {
341 { 16 * 170.00 /*MHz*/, 0xa0, },
342 { 16 * 450.00 /*MHz*/, 0x90, },
343 { 16 * 999.99 , 0x30, },
344 },
345 .config = 0x8e,
346 },
347 [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */
348 .name = "Philips PAL/SECAM multi (FQ1216ME)",
349 .count = 3,
350 .ranges = {
351 { 16 * 170.00 /*MHz*/, 0xa0, },
352 { 16 * 450.00 /*MHz*/, 0x90, },
353 { 16 * 999.99 , 0x30, },
354 },
355 .config = 0x8e,
356 },
357 [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */
358 .name = "LG PAL_I+FM (TAPC-I001D)",
359 .count = 3,
360 .ranges = {
361 { 16 * 170.00 /*MHz*/, 0xa0, },
362 { 16 * 450.00 /*MHz*/, 0x90, },
363 { 16 * 999.99 , 0x30, },
364 },
365 .config = 0x8e,
366 },
367 [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */
368 .name = "LG PAL_I (TAPC-I701D)",
369 .count = 3,
370 .ranges = {
371 { 16 * 170.00 /*MHz*/, 0xa0, },
372 { 16 * 450.00 /*MHz*/, 0x90, },
373 { 16 * 999.99 , 0x30, },
374 },
375 .config = 0x8e,
376 },
377 [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */
378 .name = "LG NTSC+FM (TPI8NSR01F)",
379 .count = 3,
380 .ranges = {
381 { 16 * 210.00 /*MHz*/, 0xa0, },
382 { 16 * 497.00 /*MHz*/, 0x90, },
383 { 16 * 999.99 , 0x30, },
384 },
385 .config = 0x8e,
386 },
387 [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */
388 .name = "LG PAL_BG+FM (TPI8PSB01D)",
389 .count = 3,
390 .ranges = {
391 { 16 * 170.00 /*MHz*/, 0xa0, },
392 { 16 * 450.00 /*MHz*/, 0x90, },
393 { 16 * 999.99 , 0x30, },
394 },
395 .config = 0x8e,
396 },
397 [TUNER_LG_PAL] = { /* LGINNOTEK PAL */
398 .name = "LG PAL_BG (TPI8PSB11D)",
399 .count = 3,
400 .ranges = {
401 { 16 * 170.00 /*MHz*/, 0xa0, },
402 { 16 * 450.00 /*MHz*/, 0x90, },
403 { 16 * 999.99 , 0x30, },
404 },
405 .config = 0x8e,
406 },
407
408 /* 30-39 */
409 [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */
410 .name = "Temic PAL* auto + FM (4009 FN5)",
411 .count = 3,
412 .ranges = {
413 { 16 * 141.00 /*MHz*/, 0xa0, },
414 { 16 * 464.00 /*MHz*/, 0x90, },
415 { 16 * 999.99 , 0x30, },
416 },
417 .config = 0x8e,
418 },
419 [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */
420 .name = "SHARP NTSC_JP (2U5JF5540)",
421 .count = 3,
422 .ranges = {
423 { 16 * 137.25 /*MHz*/, 0x01, },
424 { 16 * 317.25 /*MHz*/, 0x02, },
425 { 16 * 999.99 , 0x08, },
426 },
427 .config = 0x8e,
428 },
429 [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */
430 .name = "Samsung PAL TCPM9091PD27",
431 .count = 3,
432 .ranges = {
433 { 16 * 169 /*MHz*/, 0xa0, },
434 { 16 * 464 /*MHz*/, 0x90, },
435 { 16 * 999.99 , 0x30, },
436 },
437 .config = 0x8e,
438 },
439 [TUNER_MT2032] = { /* Microtune PAL|NTSC */
440 .name = "MT20xx universal",
441 /* see mt20xx.c for details */ },
442 [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */
443 .name = "Temic PAL_BG (4106 FH5)",
444 .count = 3,
445 .ranges = {
446 { 16 * 141.00 /*MHz*/, 0xa0, },
447 { 16 * 464.00 /*MHz*/, 0x90, },
448 { 16 * 999.99 , 0x30, },
449 },
450 .config = 0x8e,
451 },
452 [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */
453 .name = "Temic PAL_DK/SECAM_L (4012 FY5)",
454 .count = 3,
455 .ranges = {
456 { 16 * 140.25 /*MHz*/, 0x02, },
457 { 16 * 463.25 /*MHz*/, 0x04, },
458 { 16 * 999.99 , 0x01, },
459 },
460 .config = 0x8e,
461 },
462 [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */
463 .name = "Temic NTSC (4136 FY5)",
464 .count = 3,
465 .ranges = {
466 { 16 * 158.00 /*MHz*/, 0xa0, },
467 { 16 * 453.00 /*MHz*/, 0x90, },
468 { 16 * 999.99 , 0x30, },
469 },
470 .config = 0x8e,
471 },
472 [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */
473 .name = "LG PAL (newer TAPC series)",
474 .count = 3,
475 .ranges = {
476 { 16 * 170.00 /*MHz*/, 0x01, },
477 { 16 * 450.00 /*MHz*/, 0x02, },
478 { 16 * 999.99 , 0x08, },
479 },
480 .config = 0x8e,
481 },
482 [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */
483 .name = "Philips PAL/SECAM multi (FM1216ME MK3)",
484 .count = 3,
485 .ranges = {
486 { 16 * 158.00 /*MHz*/, 0x01, },
487 { 16 * 442.00 /*MHz*/, 0x02, },
488 { 16 * 999.99 , 0x04, },
489 },
490 .config = 0x8e,
491 },
492 [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */
493 .name = "LG NTSC (newer TAPC series)",
494 .count = 3,
495 .ranges = {
496 { 16 * 170.00 /*MHz*/, 0x01, },
497 { 16 * 450.00 /*MHz*/, 0x02, },
498 { 16 * 999.99 , 0x08, },
499 },
500 .config = 0x8e,
501 },
502
503 /* 40-49 */
504 [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */
505 .name = "HITACHI V7-J180AT",
506 .count = 3,
507 .ranges = {
508 { 16 * 170.00 /*MHz*/, 0x01, },
509 { 16 * 450.00 /*MHz*/, 0x02, },
510 { 16 * 999.99 , 0x08, },
511 },
512 .config = 0x8e,
513 },
514 [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */
515 .name = "Philips PAL_MK (FI1216 MK)",
516 .count = 3,
517 .ranges = {
518 { 16 * 140.25 /*MHz*/, 0x01, },
519 { 16 * 463.25 /*MHz*/, 0xc2, },
520 { 16 * 999.99 , 0xcf, },
521 },
522 .config = 0x8e,
523 },
524 [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */
525 .name = "Philips 1236D ATSC/NTSC dual in",
526 .count = 3,
527 .ranges = {
528 { 16 * 157.25 /*MHz*/, 0xa0, },
529 { 16 * 454.00 /*MHz*/, 0x90, },
530 { 16 * 999.99 , 0x30, },
531 },
532 .config = 0x8e,
533 },
534 [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */
535 .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)",
536 .count = 3,
537 .ranges = {
538 { 16 * 160.00 /*MHz*/, 0x01, },
539 { 16 * 442.00 /*MHz*/, 0x02, },
540 { 16 * 999.99 , 0x04, },
541 },
542 .config = 0x8e,
543 },
544 [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */
545 .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)",
546 .count = 3,
547 .ranges = {
548 { 16 * 160.00 /*MHz*/, 0x01, },
549 { 16 * 442.00 /*MHz*/, 0x02, },
550 { 16 * 999.99 , 0x04, },
551 },
552 .config = 0x8e,
553 },
554 [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */
555 .name = "Microtune 4049 FM5",
556 .count = 3,
557 .ranges = {
558 { 16 * 141.00 /*MHz*/, 0xa0, },
559 { 16 * 464.00 /*MHz*/, 0x90, },
560 { 16 * 999.99 , 0x30, },
561 },
562 .config = 0x8e,
563 },
564 [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */
565 .name = "Panasonic VP27s/ENGE4324D",
566 .count = 3,
567 .ranges = {
568 { 16 * 160.00 /*MHz*/, 0x01, },
569 { 16 * 454.00 /*MHz*/, 0x02, },
570 { 16 * 999.99 , 0x08, },
571 },
572 .config = 0xce,
573 },
574 [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */
575 .name = "LG NTSC (TAPE series)",
576 .count = 3,
577 .ranges = {
578 { 16 * 160.00 /*MHz*/, 0x01, },
579 { 16 * 442.00 /*MHz*/, 0x02, },
580 { 16 * 999.99 , 0x04, },
581 },
582 .config = 0x8e,
583 },
584 [TUNER_TNF_8831BGFF] = { /* Philips PAL */
585 .name = "Tenna TNF 8831 BGFF)",
586 .count = 3,
587 .ranges = {
588 { 16 * 161.25 /*MHz*/, 0xa0, },
589 { 16 * 463.25 /*MHz*/, 0x90, },
590 { 16 * 999.99 , 0x30, },
591 },
592 .config = 0x8e,
593 },
594 [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */
595 .name = "Microtune 4042 FI5 ATSC/NTSC dual in",
596 .count = 3,
597 .ranges = {
598 { 16 * 162.00 /*MHz*/, 0xa2, },
599 { 16 * 457.00 /*MHz*/, 0x94, },
600 { 16 * 999.99 , 0x31, },
601 },
602 .config = 0x8e,
603 },
604
605 /* 50-59 */
606 [TUNER_TCL_2002N] = { /* TCL NTSC */
607 .name = "TCL 2002N",
608 .count = 3,
609 .ranges = {
610 { 16 * 172.00 /*MHz*/, 0x01, },
611 { 16 * 448.00 /*MHz*/, 0x02, },
612 { 16 * 999.99 , 0x08, },
613 },
614 .config = 0x8e,
615 },
616 [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */
617 .name = "Philips PAL/SECAM_D (FM 1256 I-H3)",
618 .count = 3,
619 .ranges = {
620 { 16 * 160.00 /*MHz*/, 0x01, },
621 { 16 * 442.00 /*MHz*/, 0x02, },
622 { 16 * 999.99 , 0x04, },
623 },
624 .config = 0x8e,
625 },
626 [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */
627 .name = "Thomson DTT 7610 (ATSC/NTSC)",
628 .count = 3,
629 .ranges = {
630 { 16 * 157.25 /*MHz*/, 0x39, },
631 { 16 * 454.00 /*MHz*/, 0x3a, },
632 { 16 * 999.99 , 0x3c, },
633 },
634 .config = 0x8e,
635 },
636 [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */
637 .name = "Philips FQ1286",
638 .count = 3,
639 .ranges = {
640 { 16 * 160.00 /*MHz*/, 0x41, },
641 { 16 * 454.00 /*MHz*/, 0x42, },
642 { 16 * 999.99 , 0x04, },
643 },
644 .config = 0x8e,
645 },
646 [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */
647 .name = "tda8290+75",
648 /* see tda8290.c for details */ },
649 [TUNER_TCL_2002MB] = { /* TCL PAL */
650 .name = "TCL 2002MB",
651 .count = 3,
652 .ranges = {
653 { 16 * 170.00 /*MHz*/, 0x01, },
654 { 16 * 450.00 /*MHz*/, 0x02, },
655 { 16 * 999.99 , 0x08, },
656 },
657 .config = 0xce,
658 },
659 [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */
660 .name = "Philips PAL/SECAM multi (FQ1216AME MK4)",
661 .count = 3,
662 .ranges = {
663 { 16 * 160.00 /*MHz*/, 0x01, },
664 { 16 * 442.00 /*MHz*/, 0x02, },
665 { 16 * 999.99 , 0x04, },
666 },
667 .config = 0xce,
668 },
669 [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */
670 .name = "Philips FQ1236A MK4",
671 .count = 3,
672 .ranges = {
673 { 16 * 160.00 /*MHz*/, 0x01, },
674 { 16 * 442.00 /*MHz*/, 0x02, },
675 { 16 * 999.99 , 0x04, },
676 },
677 .config = 0x8e,
678 },
679 [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */
680 .name = "Ymec TVision TVF-8531MF/8831MF/8731MF",
681 .count = 3,
682 .ranges = {
683 { 16 * 160.00 /*MHz*/, 0xa0, },
684 { 16 * 454.00 /*MHz*/, 0x90, },
685 { 16 * 999.99 , 0x30, },
686 },
687 .config = 0x8e,
688 },
689 [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */
690 .name = "Ymec TVision TVF-5533MF",
691 .count = 3,
692 .ranges = {
693 { 16 * 160.00 /*MHz*/, 0x01, },
694 { 16 * 454.00 /*MHz*/, 0x02, },
695 { 16 * 999.99 , 0x04, },
696 },
697 .config = 0x8e,
698 },
699
700 /* 60-69 */
701 [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */
702 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
703 .name = "Thomson DTT 761X (ATSC/NTSC)",
704 .count = 3,
705 .ranges = {
706 { 16 * 145.25 /*MHz*/, 0x39, },
707 { 16 * 415.25 /*MHz*/, 0x3a, },
708 { 16 * 999.99 , 0x3c, },
709 },
710 .config = 0x8e,
711 },
712 [TUNER_TENA_9533_DI] = { /* Philips PAL */
713 .name = "Tena TNF9533-D/IF/TNF9533-B/DF",
714 .count = 3,
715 .ranges = {
716 { 16 * 160.25 /*MHz*/, 0x01, },
717 { 16 * 464.25 /*MHz*/, 0x02, },
718 { 16 * 999.99 , 0x04, },
719 },
720 .config = 0x8e,
721 },
722 [TUNER_TEA5767] = { /* Philips RADIO */
723 .name = "Philips TEA5767HN FM Radio",
724 /* see tea5767.c for details */},
725 [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */
726 .name = "Philips FMD1216ME MK3 Hybrid Tuner",
727 .count = 3,
728 .ranges = {
729 { 16 * 160.00 /*MHz*/, 0x51, },
730 { 16 * 442.00 /*MHz*/, 0x52, },
731 { 16 * 999.99 , 0x54, },
732 },
733 .config = 0x86,
734 },
735 [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */
736 .name = "LG TDVS-H062F/TUA6034",
737 .count = 3,
738 .ranges = {
739 { 16 * 160.00 /*MHz*/, 0x01 },
740 { 16 * 455.00 /*MHz*/, 0x02 },
741 { 16 * 999.99 , 0x04 },
742 },
743 .config = 0x8e,
744 },
745 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
746 .name = "Ymec TVF66T5-B/DFF",
747 .count = 3,
748 .ranges = {
749 { 16 * 160.25 /*MHz*/, 0x01, },
750 { 16 * 464.25 /*MHz*/, 0x02, },
751 { 16 * 999.99 , 0x08, },
752 },
753 .config = 0x8e,
754 },
755 [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */
756 .name = "LG NTSC (TALN mini series)",
757 .count = 3,
758 .ranges = {
759 { 16 * 137.25 /*MHz*/, 0x01, },
760 { 16 * 373.25 /*MHz*/, 0x02, },
761 { 16 * 999.99 , 0x08, },
762 },
763 .config = 0x8e,
764 },
765 [TUNER_PHILIPS_TD1316] = { /* Philips PAL */
766 .name = "Philips TD1316 Hybrid Tuner",
767 .count = 3,
768 .ranges = {
769 { 16 * 160.00 /*MHz*/, 0xa1, },
770 { 16 * 442.00 /*MHz*/, 0xa2, },
771 { 16 * 999.99 , 0xa4, },
772 },
773 .config = 0xc8,
774 },
775 [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */
776 .name = "Philips TUV1236D ATSC/NTSC dual in",
777 .count = 3,
778 .ranges = {
779 { 16 * 157.25 /*MHz*/, 0x01, },
780 { 16 * 454.00 /*MHz*/, 0x02, },
781 { 16 * 999.99 , 0x04, },
782 },
783 .config = 0xce,
784 },
785 [TUNER_TNF_5335MF] = { /* Philips NTSC */
786 .name = "Tena TNF 5335 MF",
787 .count = 3,
788 .ranges = {
789 { 16 * 157.25 /*MHz*/, 0x01, },
790 { 16 * 454.00 /*MHz*/, 0x02, },
791 { 16 * 999.99 , 0x04, },
792 },
793 .config = 0x8e,
794 },
795};
796
797unsigned const int tuner_count = ARRAY_SIZE(tuners);
798 92
799/* ---------------------------------------------------------------------- */ 93/* ---------------------------------------------------------------------- */
800 94
@@ -842,16 +136,23 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
842 u8 config, tuneraddr; 136 u8 config, tuneraddr;
843 u16 div; 137 u16 div;
844 struct tunertype *tun; 138 struct tunertype *tun;
845 unsigned char buffer[4]; 139 u8 buffer[4];
846 int rc, IFPCoff, i; 140 int rc, IFPCoff, i, j;
847 141
848 tun = &tuners[t->type]; 142 tun = &tuners[t->type];
849 for (i = 0; i < tun->count; i++) { 143 j = TUNER_PARAM_ANALOG;
850 if (freq > tun->ranges[i].thresh) 144
145 for (i = 0; i < tun->params[j].count; i++) {
146 if (freq > tun->params[j].ranges[i].limit)
851 continue; 147 continue;
852 break; 148 break;
853 } 149 }
854 config = tun->ranges[i].cb; 150 if (i == tun->params[j].count) {
151 tuner_dbg("TV frequency out of range (%d > %d)",
152 freq, tun->params[j].ranges[i - 1].limit);
153 freq = tun->params[j].ranges[--i].limit;
154 }
155 config = tun->params[j].ranges[i].cb;
855 /* i == 0 -> VHF_LO */ 156 /* i == 0 -> VHF_LO */
856 /* i == 1 -> VHF_HI */ 157 /* i == 1 -> VHF_HI */
857 /* i == 2 -> UHF */ 158 /* i == 2 -> UHF */
@@ -914,7 +215,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
914 215
915 case TUNER_MICROTUNE_4042FI5: 216 case TUNER_MICROTUNE_4042FI5:
916 /* Set the charge pump for fast tuning */ 217 /* Set the charge pump for fast tuning */
917 tun->config |= TUNER_CHARGE_PUMP; 218 tun->params[j].config |= TUNER_CHARGE_PUMP;
918 break; 219 break;
919 220
920 case TUNER_PHILIPS_TUV1236D: 221 case TUNER_PHILIPS_TUV1236D:
@@ -943,20 +244,6 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
943 break; 244 break;
944 } 245 }
945 246
946 /*
947 * Philips FI1216MK2 remark from specification :
948 * for channel selection involving band switching, and to ensure
949 * smooth tuning to the desired channel without causing
950 * unnecessary charge pump action, it is recommended to consider
951 * the difference between wanted channel frequency and the
952 * current channel frequency. Unnecessary charge pump action
953 * will result in very low tuning voltage which may drive the
954 * oscillator to extreme conditions.
955 *
956 * Progfou: specification says to send config data before
957 * frequency in case (wanted frequency < current frequency).
958 */
959
960 /* IFPCoff = Video Intermediate Frequency - Vif: 247 /* IFPCoff = Video Intermediate Frequency - Vif:
961 940 =16*58.75 NTSC/J (Japan) 248 940 =16*58.75 NTSC/J (Japan)
962 732 =16*45.75 M/N STD 249 732 =16*45.75 M/N STD
@@ -988,17 +275,18 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
988 offset / 16, offset % 16 * 100 / 16, 275 offset / 16, offset % 16 * 100 / 16,
989 div); 276 div);
990 277
991 if (t->type == TUNER_PHILIPS_SECAM && freq < t->freq) { 278 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
992 buffer[0] = tun->config; 279 buffer[0] = tun->params[j].config;
993 buffer[1] = config; 280 buffer[1] = config;
994 buffer[2] = (div>>8) & 0x7f; 281 buffer[2] = (div>>8) & 0x7f;
995 buffer[3] = div & 0xff; 282 buffer[3] = div & 0xff;
996 } else { 283 } else {
997 buffer[0] = (div>>8) & 0x7f; 284 buffer[0] = (div>>8) & 0x7f;
998 buffer[1] = div & 0xff; 285 buffer[1] = div & 0xff;
999 buffer[2] = tun->config; 286 buffer[2] = tun->params[j].config;
1000 buffer[3] = config; 287 buffer[3] = config;
1001 } 288 }
289 t->last_div = div;
1002 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 290 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
1003 buffer[0],buffer[1],buffer[2],buffer[3]); 291 buffer[0],buffer[1],buffer[2],buffer[3]);
1004 292
@@ -1024,10 +312,10 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
1024 } 312 }
1025 313
1026 /* Set the charge pump for optimized phase noise figure */ 314 /* Set the charge pump for optimized phase noise figure */
1027 tun->config &= ~TUNER_CHARGE_PUMP; 315 tun->params[j].config &= ~TUNER_CHARGE_PUMP;
1028 buffer[0] = (div>>8) & 0x7f; 316 buffer[0] = (div>>8) & 0x7f;
1029 buffer[1] = div & 0xff; 317 buffer[1] = div & 0xff;
1030 buffer[2] = tun->config; 318 buffer[2] = tun->params[j].config;
1031 buffer[3] = config; 319 buffer[3] = config;
1032 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 320 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
1033 buffer[0],buffer[1],buffer[2],buffer[3]); 321 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)
1041{ 329{
1042 struct tunertype *tun; 330 struct tunertype *tun;
1043 struct tuner *t = i2c_get_clientdata(c); 331 struct tuner *t = i2c_get_clientdata(c);
1044 unsigned char buffer[4]; 332 u8 buffer[4];
1045 unsigned div; 333 u16 div;
1046 int rc; 334 int rc, j;
1047 335
1048 tun = &tuners[t->type]; 336 tun = &tuners[t->type];
337 j = TUNER_PARAM_ANALOG;
338
1049 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ 339 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
1050 buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ 340 buffer[2] = (tun->params[j].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
1051 341
1052 switch (t->type) { 342 switch (t->type) {
1053 case TUNER_TENA_9533_DI: 343 case TUNER_TENA_9533_DI:
@@ -1076,9 +366,19 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
1076 } 366 }
1077 buffer[0] = (div>>8) & 0x7f; 367 buffer[0] = (div>>8) & 0x7f;
1078 buffer[1] = div & 0xff; 368 buffer[1] = div & 0xff;
369 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
370 buffer[0] = buffer[2];
371 buffer[1] = buffer[3];
372 buffer[2] = (div>>8) & 0x7f;
373 buffer[3] = div & 0xff;
374 } else {
375 buffer[0] = (div>>8) & 0x7f;
376 buffer[1] = div & 0xff;
377 }
1079 378
1080 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", 379 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n",
1081 buffer[0],buffer[1],buffer[2],buffer[3]); 380 buffer[0],buffer[1],buffer[2],buffer[3]);
381 t->last_div = div;
1082 382
1083 if (4 != (rc = i2c_master_send(c,buffer,4))) 383 if (4 != (rc = i2c_master_send(c,buffer,4)))
1084 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 384 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)
1092 t->type, tuners[t->type].name); 392 t->type, tuners[t->type].name);
1093 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 393 strlcpy(c->name, tuners[t->type].name, sizeof(c->name));
1094 394
1095 t->tv_freq = default_set_tv_freq; 395 t->set_tv_freq = default_set_tv_freq;
1096 t->radio_freq = default_set_radio_freq; 396 t->set_radio_freq = default_set_radio_freq;
1097 t->has_signal = tuner_signal; 397 t->has_signal = tuner_signal;
1098 t->is_stereo = tuner_stereo; 398 t->is_stereo = tuner_stereo;
1099 t->standby = NULL; 399 t->standby = NULL;
1100 400
1101 return 0; 401 return 0;
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
new file mode 100644
index 000000000000..6fe781798d89
--- /dev/null
+++ b/drivers/media/video/tuner-types.c
@@ -0,0 +1,1406 @@
1/*
2 *
3 * i2c tv tuner chip device type database.
4 *
5 */
6
7#include <linux/i2c.h>
8#include <media/tuner.h>
9#include <media/tuner-types.h>
10
11/* ---------------------------------------------------------------------- */
12
13/*
14 * The floats in the tuner struct are computed at compile time
15 * by gcc and cast back to integers. Thus we don't violate the
16 * "no float in kernel" rule.
17 *
18 * A tuner_range may be referenced by multiple tuner_params structs.
19 * There are many duplicates in here. Reusing tuner_range structs,
20 * rather than defining new ones for each tuner, will cut down on
21 * memory usage, and is preferred when possible.
22 *
23 * Each tuner_params array may contain one or more elements, one
24 * for each video standard.
25 *
26 * FIXME: Some tuner_range definitions are duplicated, and
27 * should be eliminated.
28 *
29 * FIXME: tunertype struct contains an element, has_tda988x.
30 * We must set this for all tunertypes that contain a tda988x
31 * chip, and then we can remove this setting from the various
32 * card structs.
33 */
34
35/* 0-9 */
36/* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */
37
38static struct tuner_range tuner_temic_pal_ranges[] = {
39 { 16 * 140.25 /*MHz*/, 0x02, },
40 { 16 * 463.25 /*MHz*/, 0x04, },
41 { 16 * 999.99 , 0x01, },
42};
43
44static struct tuner_params tuner_temic_pal_params[] = {
45 {
46 .type = TUNER_PARAM_TYPE_PAL,
47 .ranges = tuner_temic_pal_ranges,
48 .count = ARRAY_SIZE(tuner_temic_pal_ranges),
49 .config = 0x8e,
50 },
51};
52
53/* ------------ TUNER_PHILIPS_PAL_I - Philips PAL_I ------------ */
54
55static struct tuner_range tuner_philips_pal_i_ranges[] = {
56 { 16 * 140.25 /*MHz*/, 0xa0, },
57 { 16 * 463.25 /*MHz*/, 0x90, },
58 { 16 * 999.99 , 0x30, },
59};
60
61static struct tuner_params tuner_philips_pal_i_params[] = {
62 {
63 .type = TUNER_PARAM_TYPE_PAL,
64 .ranges = tuner_philips_pal_i_ranges,
65 .count = ARRAY_SIZE(tuner_philips_pal_i_ranges),
66 .config = 0x8e,
67 },
68};
69
70/* ------------ TUNER_PHILIPS_NTSC - Philips NTSC ------------ */
71
72static struct tuner_range tuner_philips_ntsc_ranges[] = {
73 { 16 * 157.25 /*MHz*/, 0xa0, },
74 { 16 * 451.25 /*MHz*/, 0x90, },
75 { 16 * 999.99 , 0x30, },
76};
77
78static struct tuner_params tuner_philips_ntsc_params[] = {
79 {
80 .type = TUNER_PARAM_TYPE_NTSC,
81 .ranges = tuner_philips_ntsc_ranges,
82 .count = ARRAY_SIZE(tuner_philips_ntsc_ranges),
83 .config = 0x8e,
84 .cb_first_if_lower_freq = 1,
85 },
86};
87
88/* ------------ TUNER_PHILIPS_SECAM - Philips SECAM ------------ */
89
90static struct tuner_range tuner_philips_secam_ranges[] = {
91 { 16 * 168.25 /*MHz*/, 0xa7, },
92 { 16 * 447.25 /*MHz*/, 0x97, },
93 { 16 * 999.99 , 0x37, },
94};
95
96static struct tuner_params tuner_philips_secam_params[] = {
97 {
98 .type = TUNER_PARAM_TYPE_SECAM,
99 .ranges = tuner_philips_secam_ranges,
100 .count = ARRAY_SIZE(tuner_philips_secam_ranges),
101 .config = 0x8e,
102 .cb_first_if_lower_freq = 1,
103 },
104};
105
106/* ------------ TUNER_PHILIPS_PAL - Philips PAL ------------ */
107
108static struct tuner_range tuner_philips_pal_ranges[] = {
109 { 16 * 168.25 /*MHz*/, 0xa0, },
110 { 16 * 447.25 /*MHz*/, 0x90, },
111 { 16 * 999.99 , 0x30, },
112};
113
114static struct tuner_params tuner_philips_pal_params[] = {
115 {
116 .type = TUNER_PARAM_TYPE_PAL,
117 .ranges = tuner_philips_pal_ranges,
118 .count = ARRAY_SIZE(tuner_philips_pal_ranges),
119 .config = 0x8e,
120 .cb_first_if_lower_freq = 1,
121 },
122};
123
124/* ------------ TUNER_TEMIC_NTSC - TEMIC NTSC ------------ */
125
126static struct tuner_range tuner_temic_ntsc_ranges[] = {
127 { 16 * 157.25 /*MHz*/, 0x02, },
128 { 16 * 463.25 /*MHz*/, 0x04, },
129 { 16 * 999.99 , 0x01, },
130};
131
132static struct tuner_params tuner_temic_ntsc_params[] = {
133 {
134 .type = TUNER_PARAM_TYPE_NTSC,
135 .ranges = tuner_temic_ntsc_ranges,
136 .count = ARRAY_SIZE(tuner_temic_ntsc_ranges),
137 .config = 0x8e,
138 },
139};
140
141/* ------------ TUNER_TEMIC_PAL_I - TEMIC PAL_I ------------ */
142
143static struct tuner_range tuner_temic_pal_i_ranges[] = {
144 { 16 * 170.00 /*MHz*/, 0x02, },
145 { 16 * 450.00 /*MHz*/, 0x04, },
146 { 16 * 999.99 , 0x01, },
147};
148
149static struct tuner_params tuner_temic_pal_i_params[] = {
150 {
151 .type = TUNER_PARAM_TYPE_PAL,
152 .ranges = tuner_temic_pal_i_ranges,
153 .count = ARRAY_SIZE(tuner_temic_pal_i_ranges),
154 .config = 0x8e,
155 },
156};
157
158/* ------------ TUNER_TEMIC_4036FY5_NTSC - TEMIC NTSC ------------ */
159
160static struct tuner_range tuner_temic_4036fy5_ntsc_ranges[] = {
161 { 16 * 157.25 /*MHz*/, 0xa0, },
162 { 16 * 463.25 /*MHz*/, 0x90, },
163 { 16 * 999.99 , 0x30, },
164};
165
166static struct tuner_params tuner_temic_4036fy5_ntsc_params[] = {
167 {
168 .type = TUNER_PARAM_TYPE_NTSC,
169 .ranges = tuner_temic_4036fy5_ntsc_ranges,
170 .count = ARRAY_SIZE(tuner_temic_4036fy5_ntsc_ranges),
171 .config = 0x8e,
172 },
173};
174
175/* ------------ TUNER_ALPS_TSBH1_NTSC - TEMIC NTSC ------------ */
176
177static struct tuner_range tuner_alps_tsb_1_ranges[] = {
178 { 16 * 137.25 /*MHz*/, 0x01, },
179 { 16 * 385.25 /*MHz*/, 0x02, },
180 { 16 * 999.99 , 0x08, },
181};
182
183static struct tuner_params tuner_alps_tsbh1_ntsc_params[] = {
184 {
185 .type = TUNER_PARAM_TYPE_NTSC,
186 .ranges = tuner_alps_tsb_1_ranges,
187 .count = ARRAY_SIZE(tuner_alps_tsb_1_ranges),
188 .config = 0x8e,
189 },
190};
191
192/* 10-19 */
193/* ------------ TUNER_ALPS_TSBE1_PAL - TEMIC PAL ------------ */
194
195static struct tuner_params tuner_alps_tsb_1_params[] = {
196 {
197 .type = TUNER_PARAM_TYPE_PAL,
198 .ranges = tuner_alps_tsb_1_ranges,
199 .count = ARRAY_SIZE(tuner_alps_tsb_1_ranges),
200 .config = 0x8e,
201 },
202};
203
204/* ------------ TUNER_ALPS_TSBB5_PAL_I - Alps PAL_I ------------ */
205
206static struct tuner_range tuner_alps_tsb_5_pal_ranges[] = {
207 { 16 * 133.25 /*MHz*/, 0x01, },
208 { 16 * 351.25 /*MHz*/, 0x02, },
209 { 16 * 999.99 , 0x08, },
210};
211
212static struct tuner_params tuner_alps_tsbb5_params[] = {
213 {
214 .type = TUNER_PARAM_TYPE_PAL,
215 .ranges = tuner_alps_tsb_5_pal_ranges,
216 .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges),
217 .config = 0x8e,
218 },
219};
220
221/* ------------ TUNER_ALPS_TSBE5_PAL - Alps PAL ------------ */
222
223static struct tuner_params tuner_alps_tsbe5_params[] = {
224 {
225 .type = TUNER_PARAM_TYPE_PAL,
226 .ranges = tuner_alps_tsb_5_pal_ranges,
227 .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges),
228 .config = 0x8e,
229 },
230};
231
232/* ------------ TUNER_ALPS_TSBC5_PAL - Alps PAL ------------ */
233
234static struct tuner_params tuner_alps_tsbc5_params[] = {
235 {
236 .type = TUNER_PARAM_TYPE_PAL,
237 .ranges = tuner_alps_tsb_5_pal_ranges,
238 .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges),
239 .config = 0x8e,
240 },
241};
242
243/* ------------ TUNER_TEMIC_4006FH5_PAL - TEMIC PAL ------------ */
244
245static struct tuner_range tuner_temic_4006fh5_pal_ranges[] = {
246 { 16 * 170.00 /*MHz*/, 0xa0, },
247 { 16 * 450.00 /*MHz*/, 0x90, },
248 { 16 * 999.99 , 0x30, },
249};
250
251static struct tuner_params tuner_temic_4006fh5_params[] = {
252 {
253 .type = TUNER_PARAM_TYPE_PAL,
254 .ranges = tuner_temic_4006fh5_pal_ranges,
255 .count = ARRAY_SIZE(tuner_temic_4006fh5_pal_ranges),
256 .config = 0x8e,
257 },
258};
259
260/* ------------ TUNER_ALPS_TSHC6_NTSC - Alps NTSC ------------ */
261
262static struct tuner_range tuner_alps_tshc6_ntsc_ranges[] = {
263 { 16 * 137.25 /*MHz*/, 0x14, },
264 { 16 * 385.25 /*MHz*/, 0x12, },
265 { 16 * 999.99 , 0x11, },
266};
267
268static struct tuner_params tuner_alps_tshc6_params[] = {
269 {
270 .type = TUNER_PARAM_TYPE_NTSC,
271 .ranges = tuner_alps_tshc6_ntsc_ranges,
272 .count = ARRAY_SIZE(tuner_alps_tshc6_ntsc_ranges),
273 .config = 0x8e,
274 },
275};
276
277/* ------------ TUNER_TEMIC_PAL_DK - TEMIC PAL ------------ */
278
279static struct tuner_range tuner_temic_pal_dk_ranges[] = {
280 { 16 * 168.25 /*MHz*/, 0xa0, },
281 { 16 * 456.25 /*MHz*/, 0x90, },
282 { 16 * 999.99 , 0x30, },
283};
284
285static struct tuner_params tuner_temic_pal_dk_params[] = {
286 {
287 .type = TUNER_PARAM_TYPE_PAL,
288 .ranges = tuner_temic_pal_dk_ranges,
289 .count = ARRAY_SIZE(tuner_temic_pal_dk_ranges),
290 .config = 0x8e,
291 },
292};
293
294/* ------------ TUNER_PHILIPS_NTSC_M - Philips NTSC ------------ */
295
296static struct tuner_range tuner_philips_ntsc_m_ranges[] = {
297 { 16 * 160.00 /*MHz*/, 0xa0, },
298 { 16 * 454.00 /*MHz*/, 0x90, },
299 { 16 * 999.99 , 0x30, },
300};
301
302static struct tuner_params tuner_philips_ntsc_m_params[] = {
303 {
304 .type = TUNER_PARAM_TYPE_NTSC,
305 .ranges = tuner_philips_ntsc_m_ranges,
306 .count = ARRAY_SIZE(tuner_philips_ntsc_m_ranges),
307 .config = 0x8e,
308 },
309};
310
311/* ------------ TUNER_TEMIC_4066FY5_PAL_I - TEMIC PAL_I ------------ */
312
313static struct tuner_range tuner_temic_40x6f_5_pal_ranges[] = {
314 { 16 * 169.00 /*MHz*/, 0xa0, },
315 { 16 * 454.00 /*MHz*/, 0x90, },
316 { 16 * 999.99 , 0x30, },
317};
318
319static struct tuner_params tuner_temic_4066fy5_pal_i_params[] = {
320 {
321 .type = TUNER_PARAM_TYPE_PAL,
322 .ranges = tuner_temic_40x6f_5_pal_ranges,
323 .count = ARRAY_SIZE(tuner_temic_40x6f_5_pal_ranges),
324 .config = 0x8e,
325 },
326};
327
328/* ------------ TUNER_TEMIC_4006FN5_MULTI_PAL - TEMIC PAL ------------ */
329
330static struct tuner_params tuner_temic_4006fn5_multi_params[] = {
331 {
332 .type = TUNER_PARAM_TYPE_PAL,
333 .ranges = tuner_temic_40x6f_5_pal_ranges,
334 .count = ARRAY_SIZE(tuner_temic_40x6f_5_pal_ranges),
335 .config = 0x8e,
336 },
337};
338
339/* 20-29 */
340/* ------------ TUNER_TEMIC_4009FR5_PAL - TEMIC PAL ------------ */
341
342static struct tuner_range tuner_temic_4009f_5_pal_ranges[] = {
343 { 16 * 141.00 /*MHz*/, 0xa0, },
344 { 16 * 464.00 /*MHz*/, 0x90, },
345 { 16 * 999.99 , 0x30, },
346};
347
348static struct tuner_params tuner_temic_4009f_5_params[] = {
349 {
350 .type = TUNER_PARAM_TYPE_PAL,
351 .ranges = tuner_temic_4009f_5_pal_ranges,
352 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
353 .config = 0x8e,
354 },
355};
356
357/* ------------ TUNER_TEMIC_4039FR5_NTSC - TEMIC NTSC ------------ */
358
359static struct tuner_range tuner_temic_4039fr5_ntsc_ranges[] = {
360 { 16 * 158.00 /*MHz*/, 0xa0, },
361 { 16 * 453.00 /*MHz*/, 0x90, },
362 { 16 * 999.99 , 0x30, },
363};
364
365static struct tuner_params tuner_temic_4039fr5_params[] = {
366 {
367 .type = TUNER_PARAM_TYPE_NTSC,
368 .ranges = tuner_temic_4039fr5_ntsc_ranges,
369 .count = ARRAY_SIZE(tuner_temic_4039fr5_ntsc_ranges),
370 .config = 0x8e,
371 },
372};
373
374/* ------------ TUNER_TEMIC_4046FM5 - TEMIC PAL ------------ */
375
376static struct tuner_range tuner_temic_4046fm5_pal_ranges[] = {
377 { 16 * 169.00 /*MHz*/, 0xa0, },
378 { 16 * 454.00 /*MHz*/, 0x90, },
379 { 16 * 999.99 , 0x30, },
380};
381
382static struct tuner_params tuner_temic_4046fm5_params[] = {
383 {
384 .type = TUNER_PARAM_TYPE_PAL,
385 .ranges = tuner_temic_4046fm5_pal_ranges,
386 .count = ARRAY_SIZE(tuner_temic_4046fm5_pal_ranges),
387 .config = 0x8e,
388 },
389};
390
391/* ------------ TUNER_PHILIPS_PAL_DK - Philips PAL ------------ */
392
393static struct tuner_range tuner_lg_pal_ranges[] = {
394 { 16 * 170.00 /*MHz*/, 0xa0, },
395 { 16 * 450.00 /*MHz*/, 0x90, },
396 { 16 * 999.99 , 0x30, },
397};
398
399static struct tuner_params tuner_philips_pal_dk_params[] = {
400 {
401 .type = TUNER_PARAM_TYPE_PAL,
402 .ranges = tuner_lg_pal_ranges,
403 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
404 .config = 0x8e,
405 },
406};
407
408/* ------------ TUNER_PHILIPS_FQ1216ME - Philips PAL ------------ */
409
410static struct tuner_params tuner_philips_fq1216me_params[] = {
411 {
412 .type = TUNER_PARAM_TYPE_PAL,
413 .ranges = tuner_lg_pal_ranges,
414 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
415 .config = 0x8e,
416 },
417};
418
419/* ------------ TUNER_LG_PAL_I_FM - LGINNOTEK PAL_I ------------ */
420
421static struct tuner_params tuner_lg_pal_i_fm_params[] = {
422 {
423 .type = TUNER_PARAM_TYPE_PAL,
424 .ranges = tuner_lg_pal_ranges,
425 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
426 .config = 0x8e,
427 },
428};
429
430/* ------------ TUNER_LG_PAL_I - LGINNOTEK PAL_I ------------ */
431
432static struct tuner_params tuner_lg_pal_i_params[] = {
433 {
434 .type = TUNER_PARAM_TYPE_PAL,
435 .ranges = tuner_lg_pal_ranges,
436 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
437 .config = 0x8e,
438 },
439};
440
441/* ------------ TUNER_LG_NTSC_FM - LGINNOTEK NTSC ------------ */
442
443static struct tuner_range tuner_lg_ntsc_fm_ranges[] = {
444 { 16 * 210.00 /*MHz*/, 0xa0, },
445 { 16 * 497.00 /*MHz*/, 0x90, },
446 { 16 * 999.99 , 0x30, },
447};
448
449static struct tuner_params tuner_lg_ntsc_fm_params[] = {
450 {
451 .type = TUNER_PARAM_TYPE_NTSC,
452 .ranges = tuner_lg_ntsc_fm_ranges,
453 .count = ARRAY_SIZE(tuner_lg_ntsc_fm_ranges),
454 .config = 0x8e,
455 },
456};
457
458/* ------------ TUNER_LG_PAL_FM - LGINNOTEK PAL ------------ */
459
460static struct tuner_params tuner_lg_pal_fm_params[] = {
461 {
462 .type = TUNER_PARAM_TYPE_PAL,
463 .ranges = tuner_lg_pal_ranges,
464 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
465 .config = 0x8e,
466 },
467};
468
469/* ------------ TUNER_LG_PAL - LGINNOTEK PAL ------------ */
470
471static struct tuner_params tuner_lg_pal_params[] = {
472 {
473 .type = TUNER_PARAM_TYPE_PAL,
474 .ranges = tuner_lg_pal_ranges,
475 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
476 .config = 0x8e,
477 },
478};
479
480/* 30-39 */
481/* ------------ TUNER_TEMIC_4009FN5_MULTI_PAL_FM - TEMIC PAL ------------ */
482
483static struct tuner_params tuner_temic_4009_fn5_multi_pal_fm_params[] = {
484 {
485 .type = TUNER_PARAM_TYPE_PAL,
486 .ranges = tuner_temic_4009f_5_pal_ranges,
487 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
488 .config = 0x8e,
489 },
490};
491
492/* ------------ TUNER_SHARP_2U5JF5540_NTSC - SHARP NTSC ------------ */
493
494static struct tuner_range tuner_sharp_2u5jf5540_ntsc_ranges[] = {
495 { 16 * 137.25 /*MHz*/, 0x01, },
496 { 16 * 317.25 /*MHz*/, 0x02, },
497 { 16 * 999.99 , 0x08, },
498};
499
500static struct tuner_params tuner_sharp_2u5jf5540_params[] = {
501 {
502 .type = TUNER_PARAM_TYPE_NTSC,
503 .ranges = tuner_sharp_2u5jf5540_ntsc_ranges,
504 .count = ARRAY_SIZE(tuner_sharp_2u5jf5540_ntsc_ranges),
505 .config = 0x8e,
506 },
507};
508
509/* ------------ TUNER_Samsung_PAL_TCPM9091PD27 - Samsung PAL ------------ */
510
511static struct tuner_range tuner_samsung_pal_tcpm9091pd27_ranges[] = {
512 { 16 * 169 /*MHz*/, 0xa0, },
513 { 16 * 464 /*MHz*/, 0x90, },
514 { 16 * 999.99 , 0x30, },
515};
516
517static struct tuner_params tuner_samsung_pal_tcpm9091pd27_params[] = {
518 {
519 .type = TUNER_PARAM_TYPE_PAL,
520 .ranges = tuner_samsung_pal_tcpm9091pd27_ranges,
521 .count = ARRAY_SIZE(tuner_samsung_pal_tcpm9091pd27_ranges),
522 .config = 0x8e,
523 },
524};
525
526/* ------------ TUNER_TEMIC_4106FH5 - TEMIC PAL ------------ */
527
528static struct tuner_params tuner_temic_4106fh5_params[] = {
529 {
530 .type = TUNER_PARAM_TYPE_PAL,
531 .ranges = tuner_temic_4009f_5_pal_ranges,
532 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
533 .config = 0x8e,
534 },
535};
536
537/* ------------ TUNER_TEMIC_4012FY5 - TEMIC PAL ------------ */
538
539static struct tuner_range tuner_temic_4012fy5_pal_ranges[] = {
540 { 16 * 140.25 /*MHz*/, 0x02, },
541 { 16 * 463.25 /*MHz*/, 0x04, },
542 { 16 * 999.99 , 0x01, },
543};
544
545static struct tuner_params tuner_temic_4012fy5_params[] = {
546 {
547 .type = TUNER_PARAM_TYPE_PAL,
548 .ranges = tuner_temic_4012fy5_pal_ranges,
549 .count = ARRAY_SIZE(tuner_temic_4012fy5_pal_ranges),
550 .config = 0x8e,
551 },
552};
553
554/* ------------ TUNER_TEMIC_4136FY5 - TEMIC NTSC ------------ */
555
556static struct tuner_range tuner_temic_4136_fy5_ntsc_ranges[] = {
557 { 16 * 158.00 /*MHz*/, 0xa0, },
558 { 16 * 453.00 /*MHz*/, 0x90, },
559 { 16 * 999.99 , 0x30, },
560};
561
562static struct tuner_params tuner_temic_4136_fy5_params[] = {
563 {
564 .type = TUNER_PARAM_TYPE_NTSC,
565 .ranges = tuner_temic_4136_fy5_ntsc_ranges,
566 .count = ARRAY_SIZE(tuner_temic_4136_fy5_ntsc_ranges),
567 .config = 0x8e,
568 },
569};
570
571/* ------------ TUNER_LG_PAL_NEW_TAPC - LGINNOTEK PAL ------------ */
572
573static struct tuner_range tuner_lg_new_tapc_ranges[] = {
574 { 16 * 170.00 /*MHz*/, 0x01, },
575 { 16 * 450.00 /*MHz*/, 0x02, },
576 { 16 * 999.99 , 0x08, },
577};
578
579static struct tuner_params tuner_lg_pal_new_tapc_params[] = {
580 {
581 .type = TUNER_PARAM_TYPE_PAL,
582 .ranges = tuner_lg_new_tapc_ranges,
583 .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges),
584 .config = 0x8e,
585 },
586};
587
588/* ------------ TUNER_PHILIPS_FM1216ME_MK3 - Philips PAL ------------ */
589
590static struct tuner_range tuner_fm1216me_mk3_pal_ranges[] = {
591 { 16 * 158.00 /*MHz*/, 0x01, },
592 { 16 * 442.00 /*MHz*/, 0x02, },
593 { 16 * 999.99 , 0x04, },
594};
595
596static struct tuner_params tuner_fm1216me_mk3_params[] = {
597 {
598 .type = TUNER_PARAM_TYPE_PAL,
599 .ranges = tuner_fm1216me_mk3_pal_ranges,
600 .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges),
601 .config = 0x8e,
602 .cb_first_if_lower_freq = 1,
603 },
604};
605
606/* ------------ TUNER_LG_NTSC_NEW_TAPC - LGINNOTEK NTSC ------------ */
607
608static struct tuner_params tuner_lg_ntsc_new_tapc_params[] = {
609 {
610 .type = TUNER_PARAM_TYPE_NTSC,
611 .ranges = tuner_lg_new_tapc_ranges,
612 .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges),
613 .config = 0x8e,
614 },
615};
616
617/* 40-49 */
618/* ------------ TUNER_HITACHI_NTSC - HITACHI NTSC ------------ */
619
620static struct tuner_params tuner_hitachi_ntsc_params[] = {
621 {
622 .type = TUNER_PARAM_TYPE_NTSC,
623 .ranges = tuner_lg_new_tapc_ranges,
624 .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges),
625 .config = 0x8e,
626 },
627};
628
629/* ------------ TUNER_PHILIPS_PAL_MK - Philips PAL ------------ */
630
631static struct tuner_range tuner_philips_pal_mk_pal_ranges[] = {
632 { 16 * 140.25 /*MHz*/, 0x01, },
633 { 16 * 463.25 /*MHz*/, 0xc2, },
634 { 16 * 999.99 , 0xcf, },
635};
636
637static struct tuner_params tuner_philips_pal_mk_params[] = {
638 {
639 .type = TUNER_PARAM_TYPE_PAL,
640 .ranges = tuner_philips_pal_mk_pal_ranges,
641 .count = ARRAY_SIZE(tuner_philips_pal_mk_pal_ranges),
642 .config = 0x8e,
643 },
644};
645
646/* ------------ TUNER_PHILIPS_ATSC - Philips ATSC ------------ */
647
648static struct tuner_range tuner_philips_atsc_ranges[] = {
649 { 16 * 157.25 /*MHz*/, 0xa0, },
650 { 16 * 454.00 /*MHz*/, 0x90, },
651 { 16 * 999.99 , 0x30, },
652};
653
654static struct tuner_params tuner_philips_atsc_params[] = {
655 {
656 .type = TUNER_PARAM_TYPE_NTSC,
657 .ranges = tuner_philips_atsc_ranges,
658 .count = ARRAY_SIZE(tuner_philips_atsc_ranges),
659 .config = 0x8e,
660 },
661};
662
663/* ------------ TUNER_PHILIPS_FM1236_MK3 - Philips NTSC ------------ */
664
665static struct tuner_range tuner_fm1236_mk3_ntsc_ranges[] = {
666 { 16 * 160.00 /*MHz*/, 0x01, },
667 { 16 * 442.00 /*MHz*/, 0x02, },
668 { 16 * 999.99 , 0x04, },
669};
670
671static struct tuner_params tuner_fm1236_mk3_params[] = {
672 {
673 .type = TUNER_PARAM_TYPE_NTSC,
674 .ranges = tuner_fm1236_mk3_ntsc_ranges,
675 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges),
676 .config = 0x8e,
677 .cb_first_if_lower_freq = 1,
678 },
679};
680
681/* ------------ TUNER_PHILIPS_4IN1 - Philips NTSC ------------ */
682
683static struct tuner_range tuner_philips_4in1_ntsc_ranges[] = {
684 { 16 * 160.00 /*MHz*/, 0x01, },
685 { 16 * 442.00 /*MHz*/, 0x02, },
686 { 16 * 999.99 , 0x04, },
687};
688
689static struct tuner_params tuner_philips_4in1_params[] = {
690 {
691 .type = TUNER_PARAM_TYPE_NTSC,
692 .ranges = tuner_philips_4in1_ntsc_ranges,
693 .count = ARRAY_SIZE(tuner_philips_4in1_ntsc_ranges),
694 .config = 0x8e,
695 },
696};
697
698/* ------------ TUNER_MICROTUNE_4049FM5 - Microtune PAL ------------ */
699
700static struct tuner_params tuner_microtune_4049_fm5_params[] = {
701 {
702 .type = TUNER_PARAM_TYPE_PAL,
703 .ranges = tuner_temic_4009f_5_pal_ranges,
704 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
705 .config = 0x8e,
706 },
707};
708
709/* ------------ TUNER_PANASONIC_VP27 - Panasonic NTSC ------------ */
710
711static struct tuner_range tuner_panasonic_vp27_ntsc_ranges[] = {
712 { 16 * 160.00 /*MHz*/, 0x01, },
713 { 16 * 454.00 /*MHz*/, 0x02, },
714 { 16 * 999.99 , 0x08, },
715};
716
717static struct tuner_params tuner_panasonic_vp27_params[] = {
718 {
719 .type = TUNER_PARAM_TYPE_NTSC,
720 .ranges = tuner_panasonic_vp27_ntsc_ranges,
721 .count = ARRAY_SIZE(tuner_panasonic_vp27_ntsc_ranges),
722 .config = 0xce,
723 },
724};
725
726/* ------------ TUNER_LG_NTSC_TAPE - LGINNOTEK NTSC ------------ */
727
728static struct tuner_range tuner_lg_ntsc_tape_ranges[] = {
729 { 16 * 160.00 /*MHz*/, 0x01, },
730 { 16 * 442.00 /*MHz*/, 0x02, },
731 { 16 * 999.99 , 0x04, },
732};
733
734static struct tuner_params tuner_lg_ntsc_tape_params[] = {
735 {
736 .type = TUNER_PARAM_TYPE_NTSC,
737 .ranges = tuner_lg_ntsc_tape_ranges,
738 .count = ARRAY_SIZE(tuner_lg_ntsc_tape_ranges),
739 .config = 0x8e,
740 },
741};
742
743/* ------------ TUNER_TNF_8831BGFF - Philips PAL ------------ */
744
745static struct tuner_range tuner_tnf_8831bgff_pal_ranges[] = {
746 { 16 * 161.25 /*MHz*/, 0xa0, },
747 { 16 * 463.25 /*MHz*/, 0x90, },
748 { 16 * 999.99 , 0x30, },
749};
750
751static struct tuner_params tuner_tnf_8831bgff_params[] = {
752 {
753 .type = TUNER_PARAM_TYPE_PAL,
754 .ranges = tuner_tnf_8831bgff_pal_ranges,
755 .count = ARRAY_SIZE(tuner_tnf_8831bgff_pal_ranges),
756 .config = 0x8e,
757 },
758};
759
760/* ------------ TUNER_MICROTUNE_4042FI5 - Microtune NTSC ------------ */
761
762static struct tuner_range tuner_microtune_4042fi5_ntsc_ranges[] = {
763 { 16 * 162.00 /*MHz*/, 0xa2, },
764 { 16 * 457.00 /*MHz*/, 0x94, },
765 { 16 * 999.99 , 0x31, },
766};
767
768static struct tuner_params tuner_microtune_4042fi5_params[] = {
769 {
770 .type = TUNER_PARAM_TYPE_NTSC,
771 .ranges = tuner_microtune_4042fi5_ntsc_ranges,
772 .count = ARRAY_SIZE(tuner_microtune_4042fi5_ntsc_ranges),
773 .config = 0x8e,
774 },
775};
776
777/* 50-59 */
778/* ------------ TUNER_TCL_2002N - TCL NTSC ------------ */
779
780static struct tuner_range tuner_tcl_2002n_ntsc_ranges[] = {
781 { 16 * 172.00 /*MHz*/, 0x01, },
782 { 16 * 448.00 /*MHz*/, 0x02, },
783 { 16 * 999.99 , 0x08, },
784};
785
786static struct tuner_params tuner_tcl_2002n_params[] = {
787 {
788 .type = TUNER_PARAM_TYPE_NTSC,
789 .ranges = tuner_tcl_2002n_ntsc_ranges,
790 .count = ARRAY_SIZE(tuner_tcl_2002n_ntsc_ranges),
791 .config = 0x8e,
792 .cb_first_if_lower_freq = 1,
793 },
794};
795
796/* ------------ TUNER_PHILIPS_FM1256_IH3 - Philips PAL ------------ */
797
798static struct tuner_range tuner_philips_fm1256_ih3_pal_ranges[] = {
799 { 16 * 160.00 /*MHz*/, 0x01, },
800 { 16 * 442.00 /*MHz*/, 0x02, },
801 { 16 * 999.99 , 0x04, },
802};
803
804static struct tuner_params tuner_philips_fm1256_ih3_params[] = {
805 {
806 .type = TUNER_PARAM_TYPE_PAL,
807 .ranges = tuner_philips_fm1256_ih3_pal_ranges,
808 .count = ARRAY_SIZE(tuner_philips_fm1256_ih3_pal_ranges),
809 .config = 0x8e,
810 },
811};
812
813/* ------------ TUNER_THOMSON_DTT7610 - THOMSON ATSC ------------ */
814
815static struct tuner_range tuner_thomson_dtt7610_ntsc_ranges[] = {
816 { 16 * 157.25 /*MHz*/, 0x39, },
817 { 16 * 454.00 /*MHz*/, 0x3a, },
818 { 16 * 999.99 , 0x3c, },
819};
820
821static struct tuner_params tuner_thomson_dtt7610_params[] = {
822 {
823 .type = TUNER_PARAM_TYPE_NTSC,
824 .ranges = tuner_thomson_dtt7610_ntsc_ranges,
825 .count = ARRAY_SIZE(tuner_thomson_dtt7610_ntsc_ranges),
826 .config = 0x8e,
827 },
828};
829
830/* ------------ TUNER_PHILIPS_FQ1286 - Philips NTSC ------------ */
831
832static struct tuner_range tuner_philips_fq1286_ntsc_ranges[] = {
833 { 16 * 160.00 /*MHz*/, 0x41, },
834 { 16 * 454.00 /*MHz*/, 0x42, },
835 { 16 * 999.99 , 0x04, },
836};
837
838static struct tuner_params tuner_philips_fq1286_params[] = {
839 {
840 .type = TUNER_PARAM_TYPE_NTSC,
841 .ranges = tuner_philips_fq1286_ntsc_ranges,
842 .count = ARRAY_SIZE(tuner_philips_fq1286_ntsc_ranges),
843 .config = 0x8e,
844 },
845};
846
847/* ------------ TUNER_TCL_2002MB - TCL PAL ------------ */
848
849static struct tuner_range tuner_tcl_2002mb_pal_ranges[] = {
850 { 16 * 170.00 /*MHz*/, 0x01, },
851 { 16 * 450.00 /*MHz*/, 0x02, },
852 { 16 * 999.99 , 0x08, },
853};
854
855static struct tuner_params tuner_tcl_2002mb_params[] = {
856 {
857 .type = TUNER_PARAM_TYPE_PAL,
858 .ranges = tuner_tcl_2002mb_pal_ranges,
859 .count = ARRAY_SIZE(tuner_tcl_2002mb_pal_ranges),
860 .config = 0xce,
861 },
862};
863
864/* ------------ TUNER_PHILIPS_FQ1216AME_MK4 - Philips PAL ------------ */
865
866static struct tuner_range tuner_philips_fq12_6a___mk4_ranges[] = {
867 { 16 * 160.00 /*MHz*/, 0x01, },
868 { 16 * 442.00 /*MHz*/, 0x02, },
869 { 16 * 999.99 , 0x04, },
870};
871
872static struct tuner_params tuner_philips_fq1216ame_mk4_params[] = {
873 {
874 .type = TUNER_PARAM_TYPE_PAL,
875 .ranges = tuner_philips_fq12_6a___mk4_ranges,
876 .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_ranges),
877 .config = 0xce,
878 },
879};
880
881/* ------------ TUNER_PHILIPS_FQ1236A_MK4 - Philips NTSC ------------ */
882
883static struct tuner_params tuner_philips_fq1236a_mk4_params[] = {
884 {
885 .type = TUNER_PARAM_TYPE_NTSC,
886 .ranges = tuner_philips_fq12_6a___mk4_ranges,
887 .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_ranges),
888 .config = 0x8e,
889 },
890};
891
892/* ------------ TUNER_YMEC_TVF_8531MF - Philips NTSC ------------ */
893
894static struct tuner_range tuner_ymec_tvf_8531mf_ntsc_ranges[] = {
895 { 16 * 160.00 /*MHz*/, 0xa0, },
896 { 16 * 454.00 /*MHz*/, 0x90, },
897 { 16 * 999.99 , 0x30, },
898};
899
900static struct tuner_params tuner_ymec_tvf_8531mf_params[] = {
901 {
902 .type = TUNER_PARAM_TYPE_NTSC,
903 .ranges = tuner_ymec_tvf_8531mf_ntsc_ranges,
904 .count = ARRAY_SIZE(tuner_ymec_tvf_8531mf_ntsc_ranges),
905 .config = 0x8e,
906 },
907};
908
909/* ------------ TUNER_YMEC_TVF_5533MF - Philips NTSC ------------ */
910
911static struct tuner_range tuner_ymec_tvf_5533mf_ntsc_ranges[] = {
912 { 16 * 160.00 /*MHz*/, 0x01, },
913 { 16 * 454.00 /*MHz*/, 0x02, },
914 { 16 * 999.99 , 0x04, },
915};
916
917static struct tuner_params tuner_ymec_tvf_5533mf_params[] = {
918 {
919 .type = TUNER_PARAM_TYPE_NTSC,
920 .ranges = tuner_ymec_tvf_5533mf_ntsc_ranges,
921 .count = ARRAY_SIZE(tuner_ymec_tvf_5533mf_ntsc_ranges),
922 .config = 0x8e,
923 },
924};
925
926/* 60-69 */
927/* ------------ TUNER_THOMSON_DTT761X - THOMSON ATSC ------------ */
928/* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
929
930static struct tuner_range tuner_thomson_dtt761x_ntsc_ranges[] = {
931 { 16 * 145.25 /*MHz*/, 0x39, },
932 { 16 * 415.25 /*MHz*/, 0x3a, },
933 { 16 * 999.99 , 0x3c, },
934};
935
936
937static struct tuner_params tuner_thomson_dtt761x_params[] = {
938 {
939 .type = TUNER_PARAM_TYPE_NTSC,
940 .ranges = tuner_thomson_dtt761x_ntsc_ranges,
941 .count = ARRAY_SIZE(tuner_thomson_dtt761x_ntsc_ranges),
942 .config = 0x8e,
943 },
944};
945
946/* ------------ TUNER_TENA_9533_DI - Philips PAL ------------ */
947
948static struct tuner_range tuner_tuner_tena_9533_di_pal_ranges[] = {
949 { 16 * 160.25 /*MHz*/, 0x01, },
950 { 16 * 464.25 /*MHz*/, 0x02, },
951 { 16 * 999.99 , 0x04, },
952};
953
954static struct tuner_params tuner_tena_9533_di_params[] = {
955 {
956 .type = TUNER_PARAM_TYPE_PAL,
957 .ranges = tuner_tuner_tena_9533_di_pal_ranges,
958 .count = ARRAY_SIZE(tuner_tuner_tena_9533_di_pal_ranges),
959 .config = 0x8e,
960 },
961};
962
963/* ------------ TUNER_PHILIPS_FMD1216ME_MK3 - Philips PAL ------------ */
964
965static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = {
966 { 16 * 160.00 /*MHz*/, 0x51, },
967 { 16 * 442.00 /*MHz*/, 0x52, },
968 { 16 * 999.99 , 0x54, },
969};
970
971
972static struct tuner_params tuner_tuner_philips_fmd1216me_mk3_params[] = {
973 {
974 .type = TUNER_PARAM_TYPE_PAL,
975 .ranges = tuner_philips_fmd1216me_mk3_pal_ranges,
976 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges),
977 .config = 0x86,
978 },
979};
980
981
982/* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */
983
984static struct tuner_range tuner_tua6034_ntsc_ranges[] = {
985 { 16 * 160.00 /*MHz*/, 0x01 },
986 { 16 * 455.00 /*MHz*/, 0x02 },
987 { 16 * 999.99 , 0x04 },
988};
989
990
991static struct tuner_params tuner_tua6034_params[] = {
992 {
993 .type = TUNER_PARAM_TYPE_NTSC,
994 .ranges = tuner_tua6034_ntsc_ranges,
995 .count = ARRAY_SIZE(tuner_tua6034_ntsc_ranges),
996 .config = 0x8e,
997 },
998};
999
1000/* ------------ TUNER_YMEC_TVF66T5_B_DFF - Philips PAL ------------ */
1001
1002static struct tuner_range tuner_ymec_tvf66t5_b_dff_pal_ranges[] = {
1003 { 16 * 160.25 /*MHz*/, 0x01, },
1004 { 16 * 464.25 /*MHz*/, 0x02, },
1005 { 16 * 999.99 , 0x08, },
1006};
1007
1008static struct tuner_params tuner_ymec_tvf66t5_b_dff_params[] = {
1009 {
1010 .type = TUNER_PARAM_TYPE_PAL,
1011 .ranges = tuner_ymec_tvf66t5_b_dff_pal_ranges,
1012 .count = ARRAY_SIZE(tuner_ymec_tvf66t5_b_dff_pal_ranges),
1013 .config = 0x8e,
1014 },
1015};
1016
1017/* ------------ TUNER_LG_NTSC_TALN_MINI - LGINNOTEK NTSC ------------ */
1018
1019static struct tuner_range tuner_lg_taln_mini_ntsc_ranges[] = {
1020 { 16 * 137.25 /*MHz*/, 0x01, },
1021 { 16 * 373.25 /*MHz*/, 0x02, },
1022 { 16 * 999.99 , 0x08, },
1023};
1024
1025static struct tuner_params tuner_lg_taln_mini_params[] = {
1026 {
1027 .type = TUNER_PARAM_TYPE_NTSC,
1028 .ranges = tuner_lg_taln_mini_ntsc_ranges,
1029 .count = ARRAY_SIZE(tuner_lg_taln_mini_ntsc_ranges),
1030 .config = 0x8e,
1031 },
1032};
1033
1034/* ------------ TUNER_PHILIPS_TD1316 - Philips PAL ------------ */
1035
1036static struct tuner_range tuner_philips_td1316_pal_ranges[] = {
1037 { 16 * 160.00 /*MHz*/, 0xa1, },
1038 { 16 * 442.00 /*MHz*/, 0xa2, },
1039 { 16 * 999.99 , 0xa4, },
1040};
1041
1042static struct tuner_params tuner_philips_td1316_params[] = {
1043 {
1044 .type = TUNER_PARAM_TYPE_PAL,
1045 .ranges = tuner_philips_td1316_pal_ranges,
1046 .count = ARRAY_SIZE(tuner_philips_td1316_pal_ranges),
1047 .config = 0xc8,
1048 },
1049};
1050
1051/* ------------ TUNER_PHILIPS_TUV1236D - Philips ATSC ------------ */
1052
1053static struct tuner_range tuner_tuv1236d_ntsc_ranges[] = {
1054 { 16 * 157.25 /*MHz*/, 0x01, },
1055 { 16 * 454.00 /*MHz*/, 0x02, },
1056 { 16 * 999.99 , 0x04, },
1057};
1058
1059
1060static struct tuner_params tuner_tuner_tuv1236d_params[] = {
1061 {
1062 .type = TUNER_PARAM_TYPE_NTSC,
1063 .ranges = tuner_tuv1236d_ntsc_ranges,
1064 .count = ARRAY_SIZE(tuner_tuv1236d_ntsc_ranges),
1065 .config = 0xce,
1066 },
1067};
1068
1069/* ------------ TUNER_TNF_5335MF - Philips NTSC ------------ */
1070
1071static struct tuner_range tuner_tnf_5335mf_ntsc_ranges[] = {
1072 { 16 * 157.25 /*MHz*/, 0x01, },
1073 { 16 * 454.00 /*MHz*/, 0x02, },
1074 { 16 * 999.99 , 0x04, },
1075};
1076
1077static struct tuner_params tuner_tnf_5335mf_params[] = {
1078 {
1079 .type = TUNER_PARAM_TYPE_NTSC,
1080 .ranges = tuner_tnf_5335mf_ntsc_ranges,
1081 .count = ARRAY_SIZE(tuner_tnf_5335mf_ntsc_ranges),
1082 .config = 0x8e,
1083 },
1084};
1085
1086/* 70-79 */
1087/* ------------ TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC ------------ */
1088
1089static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[] = {
1090 { 16 * 175.75 /*MHz*/, 0x01, },
1091 { 16 * 410.25 /*MHz*/, 0x02, },
1092 { 16 * 999.99 , 0x08, },
1093};
1094
1095static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = {
1096 {
1097 .type = TUNER_PARAM_TYPE_NTSC,
1098 .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges,
1099 .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges),
1100 .config = 0xce,
1101 },
1102};
1103
1104/* --------------------------------------------------------------------- */
1105
1106struct tunertype tuners[] = {
1107 /* 0-9 */
1108 [TUNER_TEMIC_PAL] = { /* TEMIC PAL */
1109 .name = "Temic PAL (4002 FH5)",
1110 .params = tuner_temic_pal_params,
1111 },
1112 [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */
1113 .name = "Philips PAL_I (FI1246 and compatibles)",
1114 .params = tuner_philips_pal_i_params,
1115 },
1116 [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */
1117 .name = "Philips NTSC (FI1236,FM1236 and compatibles)",
1118 .params = tuner_philips_ntsc_params,
1119 },
1120 [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */
1121 .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
1122 .params = tuner_philips_secam_params,
1123 },
1124 [TUNER_ABSENT] = { /* Tuner Absent */
1125 .name = "NoTuner",
1126 },
1127 [TUNER_PHILIPS_PAL] = { /* Philips PAL */
1128 .name = "Philips PAL_BG (FI1216 and compatibles)",
1129 .params = tuner_philips_pal_params,
1130 },
1131 [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */
1132 .name = "Temic NTSC (4032 FY5)",
1133 .params = tuner_temic_ntsc_params,
1134 },
1135 [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */
1136 .name = "Temic PAL_I (4062 FY5)",
1137 .params = tuner_temic_pal_i_params,
1138 },
1139 [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */
1140 .name = "Temic NTSC (4036 FY5)",
1141 .params = tuner_temic_4036fy5_ntsc_params,
1142 },
1143 [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */
1144 .name = "Alps HSBH1",
1145 .params = tuner_alps_tsbh1_ntsc_params,
1146 },
1147
1148 /* 10-19 */
1149 [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */
1150 .name = "Alps TSBE1",
1151 .params = tuner_alps_tsb_1_params,
1152 },
1153 [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */
1154 .name = "Alps TSBB5",
1155 .params = tuner_alps_tsbb5_params,
1156 },
1157 [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */
1158 .name = "Alps TSBE5",
1159 .params = tuner_alps_tsbe5_params,
1160 },
1161 [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */
1162 .name = "Alps TSBC5",
1163 .params = tuner_alps_tsbc5_params,
1164 },
1165 [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */
1166 .name = "Temic PAL_BG (4006FH5)",
1167 .params = tuner_temic_4006fh5_params,
1168 },
1169 [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */
1170 .name = "Alps TSCH6",
1171 .params = tuner_alps_tshc6_params,
1172 },
1173 [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */
1174 .name = "Temic PAL_DK (4016 FY5)",
1175 .params = tuner_temic_pal_dk_params,
1176 },
1177 [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */
1178 .name = "Philips NTSC_M (MK2)",
1179 .params = tuner_philips_ntsc_m_params,
1180 },
1181 [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */
1182 .name = "Temic PAL_I (4066 FY5)",
1183 .params = tuner_temic_4066fy5_pal_i_params,
1184 },
1185 [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */
1186 .name = "Temic PAL* auto (4006 FN5)",
1187 .params = tuner_temic_4006fn5_multi_params,
1188 },
1189
1190 /* 20-29 */
1191 [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */
1192 .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
1193 .params = tuner_temic_4009f_5_params,
1194 },
1195 [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */
1196 .name = "Temic NTSC (4039 FR5)",
1197 .params = tuner_temic_4039fr5_params,
1198 },
1199 [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */
1200 .name = "Temic PAL/SECAM multi (4046 FM5)",
1201 .params = tuner_temic_4046fm5_params,
1202 },
1203 [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */
1204 .name = "Philips PAL_DK (FI1256 and compatibles)",
1205 .params = tuner_philips_pal_dk_params,
1206 },
1207 [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */
1208 .name = "Philips PAL/SECAM multi (FQ1216ME)",
1209 .params = tuner_philips_fq1216me_params,
1210 },
1211 [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */
1212 .name = "LG PAL_I+FM (TAPC-I001D)",
1213 .params = tuner_lg_pal_i_fm_params,
1214 },
1215 [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */
1216 .name = "LG PAL_I (TAPC-I701D)",
1217 .params = tuner_lg_pal_i_params,
1218 },
1219 [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */
1220 .name = "LG NTSC+FM (TPI8NSR01F)",
1221 .params = tuner_lg_ntsc_fm_params,
1222 },
1223 [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */
1224 .name = "LG PAL_BG+FM (TPI8PSB01D)",
1225 .params = tuner_lg_pal_fm_params,
1226 },
1227 [TUNER_LG_PAL] = { /* LGINNOTEK PAL */
1228 .name = "LG PAL_BG (TPI8PSB11D)",
1229 .params = tuner_lg_pal_params,
1230 },
1231
1232 /* 30-39 */
1233 [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */
1234 .name = "Temic PAL* auto + FM (4009 FN5)",
1235 .params = tuner_temic_4009_fn5_multi_pal_fm_params,
1236 },
1237 [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */
1238 .name = "SHARP NTSC_JP (2U5JF5540)",
1239 .params = tuner_sharp_2u5jf5540_params,
1240 },
1241 [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */
1242 .name = "Samsung PAL TCPM9091PD27",
1243 .params = tuner_samsung_pal_tcpm9091pd27_params,
1244 },
1245 [TUNER_MT2032] = { /* Microtune PAL|NTSC */
1246 .name = "MT20xx universal",
1247 /* see mt20xx.c for details */ },
1248 [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */
1249 .name = "Temic PAL_BG (4106 FH5)",
1250 .params = tuner_temic_4106fh5_params,
1251 },
1252 [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */
1253 .name = "Temic PAL_DK/SECAM_L (4012 FY5)",
1254 .params = tuner_temic_4012fy5_params,
1255 },
1256 [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */
1257 .name = "Temic NTSC (4136 FY5)",
1258 .params = tuner_temic_4136_fy5_params,
1259 },
1260 [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */
1261 .name = "LG PAL (newer TAPC series)",
1262 .params = tuner_lg_pal_new_tapc_params,
1263 },
1264 [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */
1265 .name = "Philips PAL/SECAM multi (FM1216ME MK3)",
1266 .params = tuner_fm1216me_mk3_params,
1267 },
1268 [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */
1269 .name = "LG NTSC (newer TAPC series)",
1270 .params = tuner_lg_ntsc_new_tapc_params,
1271 },
1272
1273 /* 40-49 */
1274 [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */
1275 .name = "HITACHI V7-J180AT",
1276 .params = tuner_hitachi_ntsc_params,
1277 },
1278 [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */
1279 .name = "Philips PAL_MK (FI1216 MK)",
1280 .params = tuner_philips_pal_mk_params,
1281 },
1282 [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */
1283 .name = "Philips 1236D ATSC/NTSC dual in",
1284 .params = tuner_philips_atsc_params,
1285 },
1286 [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */
1287 .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)",
1288 .params = tuner_fm1236_mk3_params,
1289 },
1290 [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */
1291 .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)",
1292 .params = tuner_philips_4in1_params,
1293 },
1294 [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */
1295 .name = "Microtune 4049 FM5",
1296 .params = tuner_microtune_4049_fm5_params,
1297 },
1298 [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */
1299 .name = "Panasonic VP27s/ENGE4324D",
1300 .params = tuner_panasonic_vp27_params,
1301 },
1302 [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */
1303 .name = "LG NTSC (TAPE series)",
1304 .params = tuner_lg_ntsc_tape_params,
1305 },
1306 [TUNER_TNF_8831BGFF] = { /* Philips PAL */
1307 .name = "Tenna TNF 8831 BGFF)",
1308 .params = tuner_tnf_8831bgff_params,
1309 },
1310 [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */
1311 .name = "Microtune 4042 FI5 ATSC/NTSC dual in",
1312 .params = tuner_microtune_4042fi5_params,
1313 },
1314
1315 /* 50-59 */
1316 [TUNER_TCL_2002N] = { /* TCL NTSC */
1317 .name = "TCL 2002N",
1318 .params = tuner_tcl_2002n_params,
1319 },
1320 [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */
1321 .name = "Philips PAL/SECAM_D (FM 1256 I-H3)",
1322 .params = tuner_philips_fm1256_ih3_params,
1323 },
1324 [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */
1325 .name = "Thomson DTT 7610 (ATSC/NTSC)",
1326 .params = tuner_thomson_dtt7610_params,
1327 },
1328 [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */
1329 .name = "Philips FQ1286",
1330 .params = tuner_philips_fq1286_params,
1331 },
1332 [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */
1333 .name = "tda8290+75",
1334 /* see tda8290.c for details */ },
1335 [TUNER_TCL_2002MB] = { /* TCL PAL */
1336 .name = "TCL 2002MB",
1337 .params = tuner_tcl_2002mb_params,
1338 },
1339 [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */
1340 .name = "Philips PAL/SECAM multi (FQ1216AME MK4)",
1341 .params = tuner_philips_fq1216ame_mk4_params,
1342 },
1343 [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */
1344 .name = "Philips FQ1236A MK4",
1345 .params = tuner_philips_fq1236a_mk4_params,
1346 },
1347 [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */
1348 .name = "Ymec TVision TVF-8531MF/8831MF/8731MF",
1349 .params = tuner_ymec_tvf_8531mf_params,
1350 },
1351 [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */
1352 .name = "Ymec TVision TVF-5533MF",
1353 .params = tuner_ymec_tvf_5533mf_params,
1354 },
1355
1356 /* 60-69 */
1357 [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */
1358 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
1359 .name = "Thomson DTT 761X (ATSC/NTSC)",
1360 .params = tuner_thomson_dtt761x_params,
1361 },
1362 [TUNER_TENA_9533_DI] = { /* Philips PAL */
1363 .name = "Tena TNF9533-D/IF/TNF9533-B/DF",
1364 .params = tuner_tena_9533_di_params,
1365 },
1366 [TUNER_TEA5767] = { /* Philips RADIO */
1367 .name = "Philips TEA5767HN FM Radio",
1368 /* see tea5767.c for details */
1369 },
1370 [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */
1371 .name = "Philips FMD1216ME MK3 Hybrid Tuner",
1372 .params = tuner_tuner_philips_fmd1216me_mk3_params,
1373 },
1374 [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */
1375 .name = "LG TDVS-H062F/TUA6034",
1376 .params = tuner_tua6034_params,
1377 },
1378 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
1379 .name = "Ymec TVF66T5-B/DFF",
1380 .params = tuner_ymec_tvf66t5_b_dff_params,
1381 },
1382 [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */
1383 .name = "LG NTSC (TALN mini series)",
1384 .params = tuner_lg_taln_mini_params,
1385 },
1386 [TUNER_PHILIPS_TD1316] = { /* Philips PAL */
1387 .name = "Philips TD1316 Hybrid Tuner",
1388 .params = tuner_philips_td1316_params,
1389 },
1390 [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */
1391 .name = "Philips TUV1236D ATSC/NTSC dual in",
1392 .params = tuner_tuner_tuv1236d_params,
1393 },
1394 [TUNER_TNF_5335MF] = { /* Philips NTSC */
1395 .name = "Tena TNF 5335 MF",
1396 .params = tuner_tnf_5335mf_params,
1397 },
1398
1399 /* 70-79 */
1400 [TUNER_SAMSUNG_TCPN_2121P30A] = { /* Samsung NTSC */
1401 .name = "Samsung TCPN 2121P30A",
1402 .params = tuner_samsung_tcpn_2121p30a_params,
1403 },
1404};
1405
1406unsigned const int tuner_count = ARRAY_SIZE(tuners);
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 5e71a354e879..582551b0969b 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -190,7 +190,7 @@ hauppauge_tuner[] =
190 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"}, 190 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"},
191 { TUNER_TCL_2002N, "TCL 2002N 6A"}, 191 { TUNER_TCL_2002N, "TCL 2002N 6A"},
192 { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"}, 192 { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"},
193 { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, 193 { TUNER_SAMSUNG_TCPN_2121P30A, "Samsung TCPN 2121P30A"},
194 { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, 194 { TUNER_ABSENT, "Samsung TCPE 4121P30A"},
195 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, 195 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"},
196 /* 90-99 */ 196 /* 90-99 */
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 9094fa9f2ecb..fad9ea0ae4f2 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -634,7 +634,7 @@ struct i2c_vbi_ram_value {
634 unsigned char values[26]; 634 unsigned char values[26];
635}; 635};
636 636
637struct i2c_vbi_ram_value vbi_ram_default[] = 637static struct i2c_vbi_ram_value vbi_ram_default[] =
638{ 638{
639 {0x010, /* WST SECAM 6 */ 639 {0x010, /* WST SECAM 6 */
640 { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 } 640 { 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 5dbd7c1b362a..cd2c4475525e 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[] = {
306#endif 306#endif
307 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", 307 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
308 [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", 308 [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT",
309 [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX",
309 310
310 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", 311 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
311 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", 312 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index d5be25987142..078880e4c8c0 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -29,7 +29,6 @@
29#include <linux/devfs_fs_kernel.h> 29#include <linux/devfs_fs_kernel.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/semaphore.h>
33 32
34#include <linux/videodev.h> 33#include <linux/videodev.h>
35 34
@@ -83,7 +82,7 @@ static struct class video_class = {
83 */ 82 */
84 83
85static struct video_device *video_device[VIDEO_NUM_DEVICES]; 84static struct video_device *video_device[VIDEO_NUM_DEVICES];
86static DECLARE_MUTEX(videodev_lock); 85static DEFINE_MUTEX(videodev_lock);
87 86
88struct video_device* video_devdata(struct file *file) 87struct video_device* video_devdata(struct file *file)
89{ 88{
@@ -102,15 +101,15 @@ static int video_open(struct inode *inode, struct file *file)
102 101
103 if(minor>=VIDEO_NUM_DEVICES) 102 if(minor>=VIDEO_NUM_DEVICES)
104 return -ENODEV; 103 return -ENODEV;
105 down(&videodev_lock); 104 mutex_lock(&videodev_lock);
106 vfl=video_device[minor]; 105 vfl=video_device[minor];
107 if(vfl==NULL) { 106 if(vfl==NULL) {
108 up(&videodev_lock); 107 mutex_unlock(&videodev_lock);
109 request_module("char-major-%d-%d", VIDEO_MAJOR, minor); 108 request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
110 down(&videodev_lock); 109 mutex_lock(&videodev_lock);
111 vfl=video_device[minor]; 110 vfl=video_device[minor];
112 if (vfl==NULL) { 111 if (vfl==NULL) {
113 up(&videodev_lock); 112 mutex_unlock(&videodev_lock);
114 return -ENODEV; 113 return -ENODEV;
115 } 114 }
116 } 115 }
@@ -123,7 +122,7 @@ static int video_open(struct inode *inode, struct file *file)
123 file->f_op = fops_get(old_fops); 122 file->f_op = fops_get(old_fops);
124 } 123 }
125 fops_put(old_fops); 124 fops_put(old_fops);
126 up(&videodev_lock); 125 mutex_unlock(&videodev_lock);
127 return err; 126 return err;
128} 127}
129 128
@@ -304,12 +303,12 @@ int video_register_device(struct video_device *vfd, int type, int nr)
304 } 303 }
305 304
306 /* pick a minor number */ 305 /* pick a minor number */
307 down(&videodev_lock); 306 mutex_lock(&videodev_lock);
308 if (nr >= 0 && nr < end-base) { 307 if (nr >= 0 && nr < end-base) {
309 /* use the one the driver asked for */ 308 /* use the one the driver asked for */
310 i = base+nr; 309 i = base+nr;
311 if (NULL != video_device[i]) { 310 if (NULL != video_device[i]) {
312 up(&videodev_lock); 311 mutex_unlock(&videodev_lock);
313 return -ENFILE; 312 return -ENFILE;
314 } 313 }
315 } else { 314 } else {
@@ -318,13 +317,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
318 if (NULL == video_device[i]) 317 if (NULL == video_device[i])
319 break; 318 break;
320 if (i == end) { 319 if (i == end) {
321 up(&videodev_lock); 320 mutex_unlock(&videodev_lock);
322 return -ENFILE; 321 return -ENFILE;
323 } 322 }
324 } 323 }
325 video_device[i]=vfd; 324 video_device[i]=vfd;
326 vfd->minor=i; 325 vfd->minor=i;
327 up(&videodev_lock); 326 mutex_unlock(&videodev_lock);
328 327
329 sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base); 328 sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base);
330 devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor), 329 devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor),
@@ -362,14 +361,14 @@ int video_register_device(struct video_device *vfd, int type, int nr)
362 361
363void video_unregister_device(struct video_device *vfd) 362void video_unregister_device(struct video_device *vfd)
364{ 363{
365 down(&videodev_lock); 364 mutex_lock(&videodev_lock);
366 if(video_device[vfd->minor]!=vfd) 365 if(video_device[vfd->minor]!=vfd)
367 panic("videodev: bad unregister"); 366 panic("videodev: bad unregister");
368 367
369 devfs_remove(vfd->devfs_name); 368 devfs_remove(vfd->devfs_name);
370 video_device[vfd->minor]=NULL; 369 video_device[vfd->minor]=NULL;
371 class_device_unregister(&vfd->class_dev); 370 class_device_unregister(&vfd->class_dev);
372 up(&videodev_lock); 371 mutex_unlock(&videodev_lock);
373} 372}
374 373
375 374
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index eafa23f5cbd6..effa0d7a73ac 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -31,6 +31,7 @@ config MTD_JEDECPROBE
31 31
32config MTD_GEN_PROBE 32config MTD_GEN_PROBE
33 tristate 33 tristate
34 select OBSOLETE_INTERMODULE
34 35
35config MTD_CFI_ADV_OPTIONS 36config MTD_CFI_ADV_OPTIONS
36 bool "Flash chip driver advanced configuration options" 37 bool "Flash chip driver advanced configuration options"
@@ -259,7 +260,7 @@ config MTD_ABSENT
259 with this driver will return -ENODEV upon access. 260 with this driver will return -ENODEV upon access.
260 261
261config MTD_OBSOLETE_CHIPS 262config MTD_OBSOLETE_CHIPS
262 depends on MTD && BROKEN 263 depends on MTD
263 bool "Older (theoretically obsoleted now) drivers for non-CFI chips" 264 bool "Older (theoretically obsoleted now) drivers for non-CFI chips"
264 help 265 help
265 This option does not enable any code directly, but will allow you to 266 This option does not enable any code directly, but will allow you to
@@ -272,7 +273,7 @@ config MTD_OBSOLETE_CHIPS
272 273
273config MTD_AMDSTD 274config MTD_AMDSTD
274 tristate "AMD compatible flash chip support (non-CFI)" 275 tristate "AMD compatible flash chip support (non-CFI)"
275 depends on MTD && MTD_OBSOLETE_CHIPS 276 depends on MTD && MTD_OBSOLETE_CHIPS && BROKEN
276 help 277 help
277 This option enables support for flash chips using AMD-compatible 278 This option enables support for flash chips using AMD-compatible
278 commands, including some which are not CFI-compatible and hence 279 commands, including some which are not CFI-compatible and hence
@@ -290,7 +291,7 @@ config MTD_SHARP
290 291
291config MTD_JEDEC 292config MTD_JEDEC
292 tristate "JEDEC device support" 293 tristate "JEDEC device support"
293 depends on MTD && MTD_OBSOLETE_CHIPS 294 depends on MTD && MTD_OBSOLETE_CHIPS && BROKEN
294 help 295 help
295 Enable older older JEDEC flash interface devices for self 296 Enable older older JEDEC flash interface devices for self
296 programming flash. It is commonly used in older AMD chips. It is 297 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 5038e90ceb12..dd628cb51e31 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -218,6 +218,7 @@ config MTD_DOC2001PLUS
218config MTD_DOCPROBE 218config MTD_DOCPROBE
219 tristate 219 tristate
220 select MTD_DOCECC 220 select MTD_DOCECC
221 select OBSOLETE_INTERMODULE
221 222
222config MTD_DOCECC 223config MTD_DOCECC
223 tristate 224 tristate
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index fab6586d87e9..ef54ebeb29b8 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -93,6 +93,9 @@
93 Deepak Saxena : dsaxena@plexity.net 93 Deepak Saxena : dsaxena@plexity.net
94 : Intel IXDP2351 platform support 94 : Intel IXDP2351 platform support
95 95
96 Dmitry Pervushin : dpervushin@ru.mvista.com
97 : PNX010X platform support
98
96*/ 99*/
97 100
98/* Always include 'config.h' first in case the user wants to turn on 101/* 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 3a74a63dd4f2..55e6e2d60d3a 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,
216 ret |= put_user(compat_ptr(addr), &p->blue); 216 ret |= put_user(compat_ptr(addr), &p->blue);
217 if (ret) 217 if (ret)
218 return -EFAULT; 218 return -EFAULT;
219 return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, 219 return info->fbops->fb_ioctl(info,
220 (cmd == FBIOPUTCMAP32) ? 220 (cmd == FBIOPUTCMAP32) ?
221 FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, 221 FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC,
222 (unsigned long)p, info); 222 (unsigned long)p);
223} 223}
224 224
225struct fbcursor32 { 225struct fbcursor32 {
@@ -260,12 +260,11 @@ static int fbiogscursor(struct file *file, struct fb_info *info,
260 ret |= put_user(compat_ptr(addr), &p->image); 260 ret |= put_user(compat_ptr(addr), &p->image);
261 if (ret) 261 if (ret)
262 return -EFAULT; 262 return -EFAULT;
263 return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, 263 return info->fbops->fb_ioctl(info, FBIOSCURSOR, (unsigned long)p);
264 FBIOSCURSOR, (unsigned long)p, info);
265} 264}
266 265
267long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, 266long sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd,
268 unsigned long arg, struct fb_info *info) 267 unsigned long arg)
269{ 268{
270 switch (cmd) { 269 switch (cmd) {
271 case FBIOGTYPE: 270 case FBIOGTYPE:
@@ -278,14 +277,13 @@ long sbusfb_compat_ioctl(struct file *file, unsigned int cmd,
278 case FBIOSCURPOS: 277 case FBIOSCURPOS:
279 case FBIOGCURPOS: 278 case FBIOGCURPOS:
280 case FBIOGCURMAX: 279 case FBIOGCURMAX:
281 return info->fbops->fb_ioctl(file->f_dentry->d_inode, 280 return info->fbops->fb_ioctl(info, cmd, arg);
282 file, cmd, arg, info);
283 case FBIOPUTCMAP32: 281 case FBIOPUTCMAP32:
284 return fbiogetputcmap(file, info, cmd, arg); 282 return fbiogetputcmap(info, cmd, arg);
285 case FBIOGETCMAP32: 283 case FBIOGETCMAP32:
286 return fbiogetputcmap(file, info, cmd, arg); 284 return fbiogetputcmap(info, cmd, arg);
287 case FBIOSCURSOR32: 285 case FBIOSCURSOR32:
288 return fbiogscursor(file, info, arg); 286 return fbiogscursor(info, arg);
289 default: 287 default:
290 return -ENOIOCTLCMD; 288 return -ENOIOCTLCMD;
291 } 289 }
diff --git a/drivers/video/sbuslib.h b/drivers/video/sbuslib.h
index b470e52ce9e2..f753939013ed 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,
20int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, 20int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
21 struct fb_info *info, 21 struct fb_info *info,
22 int type, int fb_depth, unsigned long fb_size); 22 int type, int fb_depth, unsigned long fb_size);
23long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, 23long sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd,
24 unsigned long arg, struct fb_info *info); 24 unsigned long arg);
25 25
26#endif /* _SBUSLIB_H */ 26#endif /* _SBUSLIB_H */