summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-21 22:00:56 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-21 22:00:56 +0000
commit168660f24dfc46c2702acbe4701a446f42a59578 (patch)
treef431368afbf6b1b71809cf3fd904d800ea126f4d /drivers
parent6420f767924fa73b0ea267864d96820815f4ba5a (diff)
Merge with Linux 2.4.0-test5-pre3.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acorn/block/fd1772.c4
-rw-r--r--drivers/acorn/char/Makefile1
-rw-r--r--drivers/atm/zatm.c4
-rw-r--r--drivers/block/elevator.c170
-rw-r--r--drivers/block/floppy.c7
-rw-r--r--drivers/block/ll_rw_blk.c23
-rw-r--r--drivers/block/md.c116
-rw-r--r--drivers/block/raid1.c8
-rw-r--r--drivers/block/raid5.c8
-rw-r--r--drivers/cdrom/cdu31a.c50
-rw-r--r--drivers/cdrom/cm206.c51
-rw-r--r--drivers/cdrom/gscd.c3
-rw-r--r--drivers/cdrom/mcd.c40
-rw-r--r--drivers/cdrom/mcdx.c41
-rw-r--r--drivers/cdrom/sbpcd.c47
-rw-r--r--drivers/cdrom/sonycd535.c8
-rw-r--r--drivers/char/Makefile15
-rw-r--r--drivers/char/amiserial.c4
-rw-r--r--drivers/char/bt848.h2
-rw-r--r--drivers/char/bttv-cards.c834
-rw-r--r--drivers/char/bttv-driver.c (renamed from drivers/char/bttv.c)1342
-rw-r--r--drivers/char/bttv-if.c337
-rw-r--r--drivers/char/bttv.h200
-rw-r--r--drivers/char/console.c12
-rw-r--r--drivers/char/drm/ffb_drv.c2
-rw-r--r--drivers/char/drm/memory.c2
-rw-r--r--drivers/char/epca.c2
-rw-r--r--drivers/char/ftape/lowlevel/ftape-tracing.h2
-rw-r--r--drivers/char/ftape/lowlevel/ftape_syms.c4
-rw-r--r--drivers/char/ftape/zftape/zftape_syms.c4
-rw-r--r--drivers/char/istallion.c8
-rw-r--r--drivers/char/lp.c2
-rw-r--r--drivers/char/msp3400.c208
-rw-r--r--drivers/char/random.c4
-rw-r--r--drivers/char/serial.c4
-rw-r--r--drivers/char/stallion.c14
-rw-r--r--drivers/char/synclink.c12
-rw-r--r--drivers/char/tty_io.c24
-rw-r--r--drivers/char/tuner.c3
-rw-r--r--drivers/char/tvmixer.c10
-rw-r--r--drivers/char/videodev.c6
-rw-r--r--drivers/char/vt.c4
-rw-r--r--drivers/ide/ide-cd.c97
-rw-r--r--drivers/isdn/avmb1/avm_cs.c4
-rw-r--r--drivers/isdn/isdn_tty.c2
-rw-r--r--drivers/mtd/mtdram.c1
-rw-r--r--drivers/net/3c523.c2
-rw-r--r--drivers/net/3c527.c2
-rw-r--r--drivers/net/aironet4500_card.c16
-rw-r--r--drivers/net/appletalk/cops.c2
-rw-r--r--drivers/net/appletalk/ipddp.c2
-rw-r--r--drivers/net/defxx.c1
-rw-r--r--drivers/net/depca.c2
-rw-r--r--drivers/net/eepro.c2
-rw-r--r--drivers/net/fc/iph5526.c2
-rw-r--r--drivers/net/hamradio/dmascc.c4
-rw-r--r--drivers/net/hamradio/soundmodem/sm_sbc.c4
-rw-r--r--drivers/net/hamradio/soundmodem/sm_wss.c4
-rw-r--r--drivers/net/hp100.c8
-rw-r--r--drivers/net/ibmlana.c2
-rw-r--r--drivers/net/pcmcia/aironet4500_cs.c8
-rw-r--r--drivers/net/pcmcia/com20020_cs.c4
-rw-r--r--drivers/net/pcmcia/ray_cs.c6
-rw-r--r--drivers/net/sb1000.c2
-rw-r--r--drivers/net/sk_mca.c2
-rw-r--r--drivers/net/skeleton.c2
-rw-r--r--drivers/net/smc9194.c2
-rw-r--r--drivers/net/tokenring/ibmtr.c14
-rw-r--r--drivers/net/tokenring/lanstreamer.c12
-rw-r--r--drivers/net/tokenring/olympic.c6
-rw-r--r--drivers/net/tokenring/smctr.c9
-rw-r--r--drivers/net/wavelan.c6
-rw-r--r--drivers/s390/char/con3215.c2
-rw-r--r--drivers/sbus/audio/audio.c2
-rw-r--r--drivers/sbus/char/flash.c2
-rw-r--r--drivers/sbus/char/openprom.c2
-rw-r--r--drivers/sbus/char/pcikbd.c2
-rw-r--r--drivers/sbus/char/rtc.c2
-rw-r--r--drivers/sbus/char/vfc_dev.c10
-rw-r--r--drivers/scsi/scsi_scan.c4
-rw-r--r--drivers/scsi/sr.c40
-rw-r--r--drivers/sound/cmpci.c4
-rw-r--r--drivers/sound/es1370.c4
-rw-r--r--drivers/sound/es1371.c4
-rw-r--r--drivers/sound/esssolo1.c4
-rw-r--r--drivers/sound/maestro.c1
-rw-r--r--drivers/sound/nm256_audio.c12
-rw-r--r--drivers/sound/sonicvibes.c4
-rw-r--r--drivers/usb/Config.in8
-rw-r--r--drivers/usb/microtek.c10
-rw-r--r--drivers/usb/ov511.c63
-rw-r--r--drivers/usb/serial/keyspan.c727
-rw-r--r--drivers/usb/serial/keyspan.h326
-rw-r--r--drivers/usb/serial/keyspan_usa28msg.h4
-rw-r--r--drivers/usb/usb.c2
-rw-r--r--drivers/video/aty128fb.c332
-rw-r--r--drivers/video/cyber2000fb.c39
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/matrox/matroxfb_base.c4
-rw-r--r--drivers/video/pm2fb.c13
-rw-r--r--drivers/video/sa1100fb.c33
-rw-r--r--drivers/video/sisfb.c8
-rw-r--r--drivers/video/vesafb.c16
103 files changed, 3140 insertions, 2420 deletions
diff --git a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
index 980add976..5e90e6ba4 100644
--- a/drivers/acorn/block/fd1772.c
+++ b/drivers/acorn/block/fd1772.c
@@ -1566,6 +1566,7 @@ static void floppy_release(struct inode *inode, struct file *filp)
static struct block_device_operations floppy_fops =
{
+ owner: THIS_MODULE,
open: floppy_open,
release: floppy_release,
ioctl: fd_ioctl,
@@ -1578,6 +1579,9 @@ int fd1772_init(void)
{
int i;
+ if (!machine_is_arc())
+ return 0;
+
if (register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
printk("Unable to get major %d for floppy\n", MAJOR_NR);
return 1;
diff --git a/drivers/acorn/char/Makefile b/drivers/acorn/char/Makefile
index d4658724a..d102cc876 100644
--- a/drivers/acorn/char/Makefile
+++ b/drivers/acorn/char/Makefile
@@ -27,7 +27,6 @@ obj- :=
export-objs := mouse_rpc.o
obj-arc := keyb_arc.o
-obj-a5k := keyb_arc.o
obj-rpc := keyb_ps2.o
obj-$(CONFIG_RPCMOUSE) += mouse_rpc.o
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index a2b9ff169..a9af39741 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -441,8 +441,8 @@ static void zatm_clock_sync(unsigned long dummy)
"shldl $" SX(TIMER_SHIFT) ",%1,%%edx\n\t"
"shl $" SX(TIMER_SHIFT) ",%1\n\t"
"divl %%ebx\n\t"
- : "=eax" (zatm_dev->factor)
- : "eax" (interval-diff),"g" (ticks),
+ : "=a" (zatm_dev->factor)
+ : "0" (interval-diff),"g" (ticks),
"g" (zatm_dev->last_clk)
: "ebx","edx","cc");
#undef S
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c
index 7720c43c4..200fb446a 100644
--- a/drivers/block/elevator.c
+++ b/drivers/block/elevator.c
@@ -22,111 +22,6 @@
#include <linux/blk.h>
#include <asm/uaccess.h>
-void elevator_default(struct request *req, elevator_t * elevator,
- struct list_head * real_head,
- struct list_head * head, int orig_latency)
-{
- struct list_head * entry = real_head, * point = NULL;
- struct request * tmp;
- int sequence = elevator->sequence;
- int latency = orig_latency -= elevator->nr_segments, pass = 0;
- int point_latency = 0xbeefbeef;
-
- if (list_empty(real_head)) {
- req->elevator_sequence = elevator_sequence(elevator, orig_latency);
- list_add(&req->queue, real_head);
- return;
- }
-
- while ((entry = entry->prev) != head) {
- if (!point && latency >= 0) {
- point = entry;
- point_latency = latency;
- }
- tmp = blkdev_entry_to_request(entry);
- if (elevator_sequence_before(tmp->elevator_sequence, sequence) || !tmp->q)
- break;
- if (latency >= 0) {
- if (IN_ORDER(tmp, req) ||
- (pass && !IN_ORDER(tmp, blkdev_next_request(tmp))))
- goto link;
- }
- latency += tmp->nr_segments;
- pass = 1;
- }
-
- if (point) {
- entry = point;
- latency = point_latency;
- }
-
- link:
- list_add(&req->queue, entry);
- req->elevator_sequence = elevator_sequence(elevator, latency);
-}
-
-int elevator_default_merge(request_queue_t *q, struct request **req,
- struct buffer_head *bh, int rw,
- int *max_sectors, int *max_segments)
-{
- struct list_head *entry, *head = &q->queue_head;
- unsigned int count = bh->b_size >> 9;
- elevator_t *elevator = &q->elevator;
- int orig_latency, latency, sequence, action, starving = 0;
-
- /*
- * Avoid write-bombs as not to hurt interactiveness of reads
- */
- if (rw == WRITE)
- *max_segments = elevator->max_bomb_segments;
-
- latency = orig_latency = elevator_request_latency(elevator, rw);
- sequence = elevator->sequence;
-
- entry = head;
- if (q->head_active && !q->plugged)
- head = head->next;
-
- while ((entry = entry->prev) != head && !starving) {
- struct request *__rq = *req = blkdev_entry_to_request(entry);
- latency += __rq->nr_segments;
- if (elevator_sequence_before(__rq->elevator_sequence, sequence))
- starving = 1;
- if (latency < 0)
- continue;
- if (__rq->sem)
- continue;
- if (__rq->cmd != rw)
- continue;
- if (__rq->nr_sectors + count > *max_sectors)
- continue;
- if (__rq->rq_dev != bh->b_rdev)
- continue;
- if (__rq->sector + __rq->nr_sectors == bh->b_rsector) {
- if (latency - __rq->nr_segments < 0)
- break;
- action = ELEVATOR_BACK_MERGE;
- } else if (__rq->sector - count == bh->b_rsector) {
- if (starving)
- break;
- action = ELEVATOR_FRONT_MERGE;
- } else {
- continue;
- }
- q->elevator.sequence++;
- return action;
- }
- return ELEVATOR_NO_MERGE;
-}
-
-inline void elevator_default_dequeue(struct request *req)
-{
- if (req->cmd == READ)
- req->e->read_pendings--;
-
- req->e->nr_segments -= req->nr_segments;
-}
-
/*
* Order ascending, but only allow a request to be skipped a certain
* number of times
@@ -140,17 +35,12 @@ void elevator_linus(struct request *req, elevator_t *elevator,
req->elevator_sequence = orig_latency;
- if (list_empty(real_head)) {
- list_add(&req->queue, real_head);
- return;
- }
-
while ((entry = entry->prev) != head) {
tmp = blkdev_entry_to_request(entry);
- if (!tmp->elevator_sequence)
- break;
if (IN_ORDER(tmp, req))
break;
+ if (!tmp->elevator_sequence)
+ break;
tmp->elevator_sequence--;
}
list_add(&req->queue, entry);
@@ -169,8 +59,6 @@ int elevator_linus_merge(request_queue_t *q, struct request **req,
while ((entry = entry->prev) != head) {
struct request *__rq = *req = blkdev_entry_to_request(entry);
- if (!__rq->elevator_sequence)
- break;
if (__rq->sem)
continue;
if (__rq->cmd != rw)
@@ -183,7 +71,10 @@ int elevator_linus_merge(request_queue_t *q, struct request **req,
ret = ELEVATOR_BACK_MERGE;
break;
}
+ if (!__rq->elevator_sequence)
+ break;
if (__rq->sector - count == bh->b_rsector) {
+ __rq->elevator_sequence--;
ret = ELEVATOR_FRONT_MERGE;
break;
}
@@ -249,57 +140,6 @@ int elevator_noop_merge(request_queue_t *q, struct request **req,
*/
void elevator_noop_dequeue(struct request *req) {}
-#ifdef ELEVATOR_DEBUG
-void elevator_default_debug(request_queue_t * q, kdev_t dev)
-{
- int read_pendings = 0, nr_segments = 0;
- elevator_t * elevator = &q->elevator;
- struct list_head * entry = &q->queue_head;
- static int counter;
-
- if (elevator->elevator_fn != elevator_default)
- return;
-
- if (counter++ % 100)
- return;
-
- while ((entry = entry->prev) != &q->queue_head) {
- struct request * req;
-
- req = blkdev_entry_to_request(entry);
- if (req->cmd != READ && req->cmd != WRITE && (req->q || req->nr_segments))
- printk(KERN_WARNING
- "%s: elevator req->cmd %d req->nr_segments %u req->q %p\n",
- kdevname(dev), req->cmd, req->nr_segments, req->q);
- if (!req->q) {
- if (req->nr_segments)
- printk(KERN_WARNING
- "%s: elevator req->q NULL req->nr_segments %u\n",
- kdevname(dev), req->nr_segments);
- continue;
- }
- if (req->cmd == READ)
- read_pendings++;
- nr_segments += req->nr_segments;
- }
-
- if (read_pendings != elevator->read_pendings) {
- printk(KERN_WARNING
- "%s: elevator read_pendings %d should be %d\n",
- kdevname(dev), elevator->read_pendings,
- read_pendings);
- elevator->read_pendings = read_pendings;
- }
- if (nr_segments != elevator->nr_segments) {
- printk(KERN_WARNING
- "%s: elevator nr_segments %d should be %d\n",
- kdevname(dev), elevator->nr_segments,
- nr_segments);
- elevator->nr_segments = nr_segments;
- }
-}
-#endif
-
int blkelvget_ioctl(elevator_t * elevator, blkelv_ioctl_arg_t * arg)
{
blkelv_ioctl_arg_t output;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 60e6ac44f..e83509c8e 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2339,6 +2339,13 @@ static void rw_interrupt(void)
{
int nr_sectors, ssize, eoc, heads;
+ if (R_HEAD >= 2) {
+ /* some Toshiba floppy controllers occasionnally seem to
+ * return bogus interrupts after read/write operations, which
+ * can be recognized by a bad head number (>= 2) */
+ return;
+ }
+
if (!DRS->first_read_date)
DRS->first_read_date = jiffies;
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
index 6e094e4d8..ee9de09ec 100644
--- a/drivers/block/ll_rw_blk.c
+++ b/drivers/block/ll_rw_blk.c
@@ -150,7 +150,7 @@ request_queue_t *blk_get_queue(kdev_t dev)
return ret;
}
-static int __block_cleanup_queue(struct list_head *head)
+static int __blk_cleanup_queue(struct list_head *head)
{
struct list_head *entry;
struct request *rq;
@@ -172,15 +172,15 @@ static int __block_cleanup_queue(struct list_head *head)
}
/*
- * Hopefully the low level driver has finished any out standing requests
+ * Hopefully the low level driver has finished any outstanding requests
* first...
*/
void blk_cleanup_queue(request_queue_t * q)
{
int count = QUEUE_NR_REQUESTS;
- count -= __block_cleanup_queue(&q->request_freelist[READ]);
- count -= __block_cleanup_queue(&q->request_freelist[WRITE]);
+ count -= __blk_cleanup_queue(&q->request_freelist[READ]);
+ count -= __blk_cleanup_queue(&q->request_freelist[WRITE]);
if (count)
printk("blk_cleanup_queue: leaked requests (%d)\n", count);
@@ -482,7 +482,7 @@ static inline void add_request(request_queue_t * q, struct request * req,
int major;
drive_stat_acct(req->rq_dev, req->cmd, req->nr_sectors, 1);
- elevator_account_request(req);
+
/*
* let selected elevator insert the request
*/
@@ -543,7 +543,6 @@ static void attempt_merge(request_queue_t * q,
if(!(q->merge_requests_fn)(q, req, next, max_segments))
return;
- elevator_merge_requests(req, next);
req->bhtail->b_reqnext = next->bh;
req->bhtail = next->bhtail;
req->nr_sectors = req->hard_nr_sectors += next->hard_nr_sectors;
@@ -582,7 +581,7 @@ static inline void __make_request(request_queue_t * q, int rw,
int max_segments = MAX_SEGMENTS;
struct request * req = NULL;
int rw_ahead, max_sectors, el_ret;
- struct list_head *head;
+ struct list_head *head = &q->queue_head;
int latency;
elevator_t *elevator = &q->elevator;
@@ -643,12 +642,10 @@ static inline void __make_request(request_queue_t * q, int rw,
* not to schedule or do something nonatomic
*/
spin_lock_irq(&io_request_lock);
- elevator_default_debug(q, bh->b_rdev);
/*
* skip first entry, for devices with active queue head
*/
- head = &q->queue_head;
if (q->head_active && !q->plugged)
head = head->next;
@@ -710,9 +707,11 @@ get_rq:
req = __get_request_wait(q, rw);
spin_lock_irq(&io_request_lock);
- head = &q->queue_head;
- if (q->head_active && !q->plugged)
- head = head->next;
+ if (q->head_active) {
+ head = &q->queue_head;
+ if (!q->plugged)
+ head = head->next;
+ }
}
/* fill up the request-info, and add it to the queue */
diff --git a/drivers/block/md.c b/drivers/block/md.c
index 087b5aee1..de977bdf0 100644
--- a/drivers/block/md.c
+++ b/drivers/block/md.c
@@ -2080,10 +2080,10 @@ void md_setup_drive(void) md__init;
*/
#ifdef CONFIG_AUTODETECT_RAID
static int detected_devices[128] md__initdata;
-static int dev_cnt md__initdata=0;
-void md__init md_autodetect_dev(kdev_t dev)
+static int dev_cnt=0;
+void md_autodetect_dev(kdev_t dev)
{
- if (dev_cnt < 127)
+ if (dev_cnt >= 0 && dev_cnt < 127)
detected_devices[dev_cnt++] = dev;
}
#endif
@@ -2094,36 +2094,39 @@ void md__init md_run_setup(void)
mdk_rdev_t *rdev;
int i;
- if (raid_setup_args.noautodetect) {
+ if (raid_setup_args.noautodetect)
printk(KERN_INFO "skipping autodetection of RAID arrays\n");
- return;
- }
- printk(KERN_INFO "autodetecting RAID arrays\n");
+ else {
- for (i=0; i<dev_cnt; i++) {
- kdev_t dev = detected_devices[i];
+ printk(KERN_INFO "autodetecting RAID arrays\n");
- if (md_import_device(dev,1)) {
- printk(KERN_ALERT "could not import %s!\n",
- partition_name(dev));
- continue;
- }
- /*
- * Sanity checks:
- */
- rdev = find_rdev_all(dev);
- if (!rdev) {
- MD_BUG();
- continue;
- }
- if (rdev->faulty) {
- MD_BUG();
- continue;
+ for (i=0; i<dev_cnt; i++) {
+ kdev_t dev = detected_devices[i];
+
+ if (md_import_device(dev,1)) {
+ printk(KERN_ALERT "could not import %s!\n",
+ partition_name(dev));
+ continue;
+ }
+ /*
+ * Sanity checks:
+ */
+ rdev = find_rdev_all(dev);
+ if (!rdev) {
+ MD_BUG();
+ continue;
+ }
+ if (rdev->faulty) {
+ MD_BUG();
+ continue;
+ }
+ md_list_add(&rdev->pending, &pending_raid_disks);
}
- md_list_add(&rdev->pending, &pending_raid_disks);
+
+ autorun_devices();
}
- autorun_devices();
+ dev_cnt = -1; /* make sure further calls to md_autodetect_dev are ignored */
#endif
#ifdef CONFIG_MD_BOOT
md_setup_drive();
@@ -2731,11 +2734,9 @@ static int md_ioctl (struct inode *inode, struct file *file,
goto done_unlock;
case STOP_ARRAY:
- err = do_md_stop (mddev, 0);
- if (err)
- goto done_unlock;
- else
- goto done;
+ if (!(err = do_md_stop (mddev, 0)))
+ mddev = NULL;
+ goto done_unlock;
case STOP_ARRAY_RO:
err = do_md_stop (mddev, 1);
@@ -2837,7 +2838,8 @@ static int md_ioctl (struct inode *inode, struct file *file,
*/
if (err) {
mddev->sb_dirty = 0;
- do_md_stop (mddev, 0);
+ if (!do_md_stop (mddev, 0))
+ mddev = NULL;
}
goto done_unlock;
}
@@ -2852,8 +2854,6 @@ done_unlock:
abort_unlock:
if (mddev)
unlock_mddev(mddev);
- else
- printk("huh11?\n");
return err;
done:
@@ -3248,6 +3248,19 @@ static mdp_disk_t *get_spare(mddev_t *mddev)
return NULL;
}
+static unsigned int sync_io[DK_MAX_MAJOR][DK_MAX_DISK];
+void md_sync_acct(kdev_t dev, unsigned long nr_sectors)
+{
+ unsigned int major = MAJOR(dev);
+ unsigned int index;
+
+ index = disk_index(dev);
+ if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
+ return;
+
+ sync_io[major][index] += nr_sectors;
+}
+
static int is_mddev_idle (mddev_t *mddev)
{
mdk_rdev_t * rdev;
@@ -3260,8 +3273,12 @@ static int is_mddev_idle (mddev_t *mddev)
int major = MAJOR(rdev->dev);
int idx = disk_index(rdev->dev);
+ if ((idx >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
+ continue;
+
curr_events = kstat.dk_drive_rblk[major][idx] +
kstat.dk_drive_wblk[major][idx] ;
+ curr_events -= sync_io[major][idx];
// printk("events(major: %d, idx: %d): %ld\n", major, idx, curr_events);
if (curr_events != rdev->last_events) {
// printk("!I(%ld)", curr_events - rdev->last_events);
@@ -3561,32 +3578,28 @@ struct notifier_block md_notifier = {
0
};
-void md__init raid_setup(char *str, int *ints)
+void md__init raid_setup(char *str)
{
- char tmpline[100];
- int len, pos, nr, i;
+ int len, pos;
len = strlen(str) + 1;
- nr = 0;
pos = 0;
- for (i = 0; i < len; i++) {
- char c = str[i];
+ while (pos < len) {
+ char *comma = strchr(str+pos, ',');
+ int wlen;
+ if (comma)
+ wlen = (comma-str)-pos;
+ else wlen = (len-1)-pos;
- if (c == ',' || !c) {
- tmpline[pos] = 0;
- if (!strcmp(tmpline,"noautodetect"))
- raid_setup_args.noautodetect = 1;
- nr++;
- pos = 0;
- continue;
- }
- tmpline[pos] = c;
- pos++;
+ if (strncmp(str, "noautodetect", wlen) == 0)
+ raid_setup_args.noautodetect = 1;
+ pos += wlen+1;
}
raid_setup_args.set = 1;
return;
}
+__setup("raid=", raid_setup);
static void md_geninit (void)
{
@@ -3842,6 +3855,7 @@ MD_EXPORT_SYMBOL(unregister_md_personality);
MD_EXPORT_SYMBOL(partition_name);
MD_EXPORT_SYMBOL(md_error);
MD_EXPORT_SYMBOL(md_do_sync);
+MD_EXPORT_SYMBOL(md_sync_acct);
MD_EXPORT_SYMBOL(md_done_sync);
MD_EXPORT_SYMBOL(md_recover_arrays);
MD_EXPORT_SYMBOL(md_register_thread);
diff --git a/drivers/block/raid1.c b/drivers/block/raid1.c
index 6748c8016..608bc4c43 100644
--- a/drivers/block/raid1.c
+++ b/drivers/block/raid1.c
@@ -75,7 +75,7 @@ static struct buffer_head *raid1_alloc_bh(raid1_conf_t *conf, int cnt)
md_spin_unlock_irq(&conf->device_lock);
if (cnt == 0)
break;
- t = (struct buffer_head *)kmalloc(sizeof(struct buffer_head), GFP_KERNEL);
+ t = (struct buffer_head *)kmalloc(sizeof(struct buffer_head), GFP_BUFFER);
if (t) {
memset(t, 0, sizeof(*t));
t->b_next = bh;
@@ -165,7 +165,7 @@ static struct raid1_bh *raid1_alloc_r1bh(raid1_conf_t *conf)
if (r1_bh)
return r1_bh;
r1_bh = (struct raid1_bh *) kmalloc(sizeof(struct raid1_bh),
- GFP_KERNEL);
+ GFP_BUFFER);
if (r1_bh) {
memset(r1_bh, 0, sizeof(*r1_bh));
return r1_bh;
@@ -1207,7 +1207,7 @@ static void raid1d (void *data)
mbh = mbh->b_next;
q = blk_get_queue(bh1->b_rdev);
generic_make_request(q, WRITE, bh1);
- drive_stat_acct(bh1->b_rdev, WRITE, -bh1->b_size/512, 0);
+ md_sync_acct(bh1->b_rdev, bh1->b_size/512);
}
} else {
dev = bh->b_dev;
@@ -1436,7 +1436,7 @@ static int raid1_sync_request (mddev_t *mddev, unsigned long block_nr)
q = blk_get_queue(bh->b_rdev);
generic_make_request(q, READ, bh);
- drive_stat_acct(bh->b_rdev, READ, -bh->b_size/512, 0);
+ md_sync_acct(bh->b_rdev, bh->b_size/512);
return (bsize >> 10);
diff --git a/drivers/block/raid5.c b/drivers/block/raid5.c
index 116be21a1..e7e73c689 100644
--- a/drivers/block/raid5.c
+++ b/drivers/block/raid5.c
@@ -264,7 +264,7 @@ static int grow_raid5_buffers(struct stripe_head *sh, int num, int b_size, int p
}
bh->b_size = b_size;
atomic_set(&bh->b_count, 0);
- set_bh_page(bh, page, 0);
+ bh->b_page = page;
put_free_buffer(sh, bh);
}
return 0;
@@ -1263,7 +1263,7 @@ static void handle_stripe_sync (mddev_t *mddev , raid5_conf_t *conf,
bh->b_dev = bh->b_rdev = conf->disks[i].dev;
q = blk_get_queue(bh->b_rdev);
generic_make_request(q, READ, bh);
- drive_stat_acct(bh->b_rdev, READ, -bh->b_size/512, 0);
+ md_sync_acct(bh->b_rdev, bh->b_size/512);
atomic_dec(&sh->bh_old[i]->b_count);
}
PRINTK("handle_stripe_sync() %lu, phase READ_OLD, pending %d buffers\n", sh->sector, md_atomic_read(&sh->nr_pending));
@@ -1293,7 +1293,7 @@ static void handle_stripe_sync (mddev_t *mddev , raid5_conf_t *conf,
bh->b_dev = bh->b_rdev = conf->spare->dev;
q = blk_get_queue(bh->b_rdev);
generic_make_request(q, WRITERAW, bh);
- drive_stat_acct(bh->b_rdev, WRITE, -bh->b_size/512, 0);
+ md_sync_acct(bh->b_rdev, bh->b_size/512);
atomic_dec(&bh->b_count);
PRINTK("handle_stripe_sync() %lu, phase WRITE, pending %d buffers\n", sh->sector, md_atomic_read(&sh->nr_pending));
}
@@ -1320,7 +1320,7 @@ static void handle_stripe_sync (mddev_t *mddev , raid5_conf_t *conf,
bh->b_dev = bh->b_rdev = conf->disks[pd_idx].dev;
q = blk_get_queue(bh->b_rdev);
generic_make_request(q, WRITERAW, bh);
- drive_stat_acct(bh->b_rdev, WRITE, -bh->b_size/512, 0);
+ md_sync_acct(bh->b_rdev, bh->b_size/512);
atomic_dec(&bh->b_count);
PRINTK("handle_stripe_sync() %lu phase WRITE, pending %d buffers\n",
sh->sector, md_atomic_read(&sh->nr_pending));
diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c
index 27405b3c3..8b969818b 100644
--- a/drivers/cdrom/cdu31a.c
+++ b/drivers/cdrom/cdu31a.c
@@ -3222,37 +3222,31 @@ scd_release(struct cdrom_device_info *cdi)
}
static struct cdrom_device_ops scd_dops = {
- scd_open, /* open */
- scd_release, /* release */
- scd_drive_status, /* drive status */
- scd_media_changed, /* media changed */
- scd_tray_move, /* tray move */
- scd_lock_door, /* lock door */
- scd_select_speed, /* select speed */
- NULL, /* select disc */
- scd_get_last_session, /* get last session */
- scd_get_mcn, /* get universal product code */
- scd_reset, /* hard reset */
- scd_audio_ioctl, /* audio ioctl */
- scd_dev_ioctl, /* device-specific ioctl */
- CDC_OPEN_TRAY | CDC_CLOSE_TRAY | CDC_LOCK | CDC_SELECT_SPEED | CDC_MULTI_SESSION |
- CDC_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
- CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS, /* capability */
- 1, /* number of minor devices */
+ open: scd_open,
+ release: scd_release,
+ drive_status: scd_drive_status,
+ media_changed: scd_media_changed,
+ tray_move: scd_tray_move,
+ lock_door: scd_lock_door,
+ select_speed: scd_select_speed,
+ get_last_session: scd_get_last_session,
+ get_mcn: scd_get_mcn,
+ reset: scd_reset,
+ audio_ioctl: scd_audio_ioctl,
+ dev_ioctl: scd_dev_ioctl,
+ capability: CDC_OPEN_TRAY | CDC_CLOSE_TRAY | CDC_LOCK |
+ CDC_SELECT_SPEED | CDC_MULTI_SESSION |
+ CDC_MULTI_SESSION | CDC_MCN |
+ CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
+ CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS,
+ n_minors: 1,
};
static struct cdrom_device_info scd_info = {
- &scd_dops, /* device operations */
- NULL, /* link */
- NULL, /* handle */
- 0, /* devfs */
- 0, /* dev */
- 0, /* mask */
- 2, /* maximum speed */
- 1, /* number of discs */
- 0, /* options, not owned */
- 0, /* mc_flags, not owned */
- 0 /* use count, not owned */
+ ops: &scd_dops,
+ speed: 2,
+ capacity: 1,
+ name: "cdu31a"
};
/* The different types of disc loading mechanisms supported */
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c
index facf6223d..5f09347cf 100644
--- a/drivers/cdrom/cm206.c
+++ b/drivers/cdrom/cm206.c
@@ -1235,40 +1235,31 @@ int cm206_select_speed(struct cdrom_device_info * cdi, int speed)
}
static struct cdrom_device_ops cm206_dops = {
- cm206_open, /* open */
- cm206_release, /* release */
- cm206_drive_status, /* drive status */
- cm206_media_changed, /* media changed */
- cm206_tray_move, /* tray move */
- cm206_lock_door, /* lock door */
- cm206_select_speed, /* select speed */
- NULL, /* select disc */
- cm206_get_last_session, /* get last session */
- cm206_get_upc, /* get universal product code */
- cm206_reset, /* hard reset */
- cm206_audio_ioctl, /* audio ioctl */
- cm206_ioctl, /* device-specific ioctl */
- CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_MULTI_SESSION |
- CDC_MEDIA_CHANGED | CDC_MCN | CDC_PLAY_AUDIO | CDC_SELECT_SPEED |
- CDC_IOCTLS | CDC_DRIVE_STATUS,
- /* capability */
- 1, /* number of minor devices */
+ open: cm206_open,
+ release: cm206_release,
+ drive_status: cm206_drive_status,
+ media_changed: cm206_media_changed,
+ tray_move: cm206_tray_move,
+ lock_door: cm206_lock_door,
+ select_speed: cm206_select_speed,
+ get_last_session: cm206_get_last_session,
+ get_mcn: cm206_get_upc,
+ reset: cm206_reset,
+ audio_ioctl: cm206_audio_ioctl,
+ dev_ioctl: cm206_ioctl,
+ capability: CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |
+ CDC_MULTI_SESSION | CDC_MEDIA_CHANGED |
+ CDC_MCN | CDC_PLAY_AUDIO | CDC_SELECT_SPEED |
+ CDC_IOCTLS | CDC_DRIVE_STATUS,
+ n_minors: 1,
};
static struct cdrom_device_info cm206_info = {
- &cm206_dops, /* device operations */
- NULL, /* link */
- NULL, /* handle (not used by cm206) */
- 0, /* devfs handle */
- 0, /* dev */
- 0, /* mask */
- 2, /* maximum speed */
- 1, /* number of discs */
- 0, /* options, not owned */
- 0, /* mc_flags, not owned */
- 0, /* use count, not owned */
- "cm206" /* name of the device type */
+ ops: &cm206_dops,
+ speed: 2,
+ capacity: 1,
+ name: "cm206",
};
/* This routine gets called during initialization if things go wrong,
diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c
index dc8870491..0e8940117 100644
--- a/drivers/cdrom/gscd.c
+++ b/drivers/cdrom/gscd.c
@@ -995,8 +995,7 @@ long err;
void __exit exit_gscd(void)
{
-
- del_timer_async(&gscd_timer);
+ CLEAR_TIMER;
devfs_unregister(devfs_find_handle(NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK,
0));
diff --git a/drivers/cdrom/mcd.c b/drivers/cdrom/mcd.c
index 0f59831b7..12c85365d 100644
--- a/drivers/cdrom/mcd.c
+++ b/drivers/cdrom/mcd.c
@@ -206,37 +206,21 @@ int mcd_drive_status(struct cdrom_device_info * cdi, int slot_nr);
static struct timer_list mcd_timer;
static struct cdrom_device_ops mcd_dops = {
- mcd_open, /* open */
- mcd_release, /* release */
- mcd_drive_status, /* drive status */
- //NULL, /* drive status */
- mcd_media_changed, /* media changed */
- mcd_tray_move, /* tray move */
- NULL, /* lock door */
- NULL, /* select speed */
- NULL, /* select disc */
- NULL, /* get last session */
- NULL, /* get universal product code */
- NULL, /* hard reset */
- mcd_audio_ioctl, /* audio ioctl */
- NULL, /* device-specific ioctl */
- CDC_OPEN_TRAY | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO
- | CDC_DRIVE_STATUS, /* capability */
- 0, /* number of minor devices */
+ open: mcd_open,
+ release: mcd_release,
+ drive_status: mcd_drive_status,
+ media_changed: mcd_media_changed,
+ tray_move: mcd_tray_move,
+ audio_ioctl: mcd_audio_ioctl,
+ capability: CDC_OPEN_TRAY | CDC_MEDIA_CHANGED |
+ CDC_PLAY_AUDIO | CDC_DRIVE_STATUS,
};
static struct cdrom_device_info mcd_info = {
- &mcd_dops, /* device operations */
- NULL, /* link */
- NULL, /* handle */
- 0, /* dev */
- 0, /* mask */
- 2, /* maximum speed */
- 1, /* number of discs */
- 0, /* options, not owned */
- 0, /* mc_flags, not owned */
- 0, /* use count, not owned */
- "mcd", /* name of the device type */
+ ops: &mcd_dops,
+ speed: 2,
+ capacity: 1,
+ name: "mcd",
};
#ifndef MODULE
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index ac667047b..160261406 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -275,41 +275,24 @@ static struct s_drive_stuff* mcdx_irq_map[16] =
MODULE_PARM(mcdx, "1-4i");
static struct cdrom_device_ops mcdx_dops = {
- mcdx_open, /* open */
- mcdx_close, /* release */
- NULL, /* drive status */
- mcdx_media_changed, /* media changed */
- mcdx_tray_move, /* tray move */
- mcdx_lockdoor, /* lock door */
- NULL, /* select speed */
- NULL, /* select disc */
- NULL, /* get last session */
- NULL, /* get universal product code */
- NULL, /* hard reset */
- mcdx_audio_ioctl, /* audio ioctl */
- NULL, /* device-specific ioctl */
- CDC_OPEN_TRAY | CDC_LOCK | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO
- | CDC_DRIVE_STATUS, /* capability */
- 0, /* number of minor devices */
+ open: mcdx_open,
+ release: mcdx_close,
+ media_changed: mcdx_media_changed,
+ tray_move: mcdx_tray_move,
+ lock_door: mcdx_lockdoor,
+ audio_ioctl: mcdx_audio_ioctl,
+ capability: CDC_OPEN_TRAY | CDC_LOCK | CDC_MEDIA_CHANGED |
+ CDC_PLAY_AUDIO | CDC_DRIVE_STATUS,
};
static struct cdrom_device_info mcdx_info = {
- &mcdx_dops, /* device operations */
- NULL, /* link */
- NULL, /* handle */
- 0, /* de, devfs */
- 0, /* dev */
- 0, /* mask */
- 2, /* maximum speed */
- 1, /* number of discs */
- 0, /* options, not owned */
- 0, /* mc_flags, not owned */
- 0, /* use count, not owned */
- "mcdx", /* name of the device type */
+ ops: &mcdx_dops,
+ speed: 2,
+ capacity: 1,
+ name: "mcdx",
};
-
/* KERNEL INTERFACE FUNCTIONS **************************************/
diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c
index 2f65bb525..df2174a8c 100644
--- a/drivers/cdrom/sbpcd.c
+++ b/drivers/cdrom/sbpcd.c
@@ -5409,36 +5409,31 @@ static void sbpcd_release(struct cdrom_device_info * cdi)
*/
static int sbpcd_media_changed( struct cdrom_device_info *cdi, int disc_nr);
static struct cdrom_device_ops sbpcd_dops = {
- sbpcd_open, /* open */
- sbpcd_release, /* release */
- sbpcd_drive_status, /* drive status */
- sbpcd_media_changed, /* media changed */
- sbpcd_tray_move, /* tray move */
- sbpcd_lock_door, /* lock door */
- sbpcd_select_speed, /* select speed */
- NULL, /* select disc */
- sbpcd_get_last_session, /* get last session */
- sbpcd_get_mcn, /* get universal product code */
- sbpcd_reset, /* hard reset */
- sbpcd_audio_ioctl, /* audio ioctl */
- sbpcd_dev_ioctl, /* device-specific ioctl */
- CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_MULTI_SESSION |
- CDC_MEDIA_CHANGED | CDC_MCN | CDC_PLAY_AUDIO | CDC_IOCTLS, /* capability */
- 1, /* number of minor devices */
+ open: sbpcd_open,
+ release: sbpcd_release,
+ drive_status: sbpcd_drive_status,
+ media_changed: sbpcd_media_changed,
+ tray_move: sbpcd_tray_move,
+ lock_door: sbpcd_lock_door,
+ select_speed: sbpcd_select_speed,
+ get_last_session: sbpcd_get_last_session,
+ get_mcn: sbpcd_get_mcn,
+ reset: sbpcd_reset,
+ audio_ioctl: sbpcd_audio_ioctl,
+ dev_ioctl: sbpcd_dev_ioctl,
+ capability: CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |
+ CDC_MULTI_SESSION | CDC_MEDIA_CHANGED |
+ CDC_MCN | CDC_PLAY_AUDIO | CDC_IOCTLS,
+ n_minors: 1,
};
static struct cdrom_device_info sbpcd_info = {
- &sbpcd_dops, /* device operations */
- NULL, /* link */
- NULL, /* handle */
- 0, /* dev */
- 0, /* mask */
- 2, /* maximum speed */
- 1, /* number of discs */
- 0, /* options, not owned */
- 0, /* mc_flags, not owned */
- 0 /* use count, not owned */
+ ops: &sbpcd_dops,
+ speed: 2,
+ capacity: 1,
+ name: "sbpcd",
};
+
/*==========================================================================*/
/*
* accept "kernel command line" parameters
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index 945facb97..8349e5928 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -1691,10 +1691,10 @@ sony535_exit(void)
release_region(sony535_cd_base_io, 4);
for (i = 0; i < sony_buffer_sectors; i++)
- kfree_s(sony_buffer[i], CDU535_BLOCK_SIZE);
- kfree_s(sony_buffer, 4 * sony_buffer_sectors);
- kfree_s(last_sony_subcode, sizeof *last_sony_subcode);
- kfree_s(sony_toc, sizeof *sony_toc);
+ kfree(sony_buffer[i]);
+ kfree(sony_buffer);
+ kfree(last_sony_subcode);
+ kfree(sony_toc);
devfs_unregister(devfs_find_handle(NULL, CDU535_HANDLE, 0, 0,
DEVFS_SPECIAL_BLK, 0));
if (devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE) == -EINVAL)
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 30e649ac0..9bba10cf4 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -38,7 +38,10 @@ obj-y += tty_io.o n_tty.o tty_ioctl.o mem.o raw.o pty.o misc.o random.o
export-objs := busmouse.o console.o i2c-old.o keyboard.o sysrq.o \
misc.o pty.o random.o selection.o serial.o videodev.o \
- tty_io.o bttv.o cpia.o
+ tty_io.o bttv-if.o cpia.o
+
+list-multi := bttv.o
+bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o
KEYMAP =defkeymap.o
KEYBD =pc_keyb.o
@@ -62,9 +65,11 @@ ifeq ($(ARCH),m68k)
endif
ifeq ($(ARCH),arm)
+# we actually need to be able to select various different keymaps
+# and keyboards dependent on which actual machine we're going to
+# run on.
KEYMAP =
KEYBD =
- CONSOLE =
endif
ifeq ($(ARCH),sh)
@@ -371,6 +376,8 @@ O_OBJS := $(filter-out $(export-objs), $(obj-y))
OX_OBJS := $(filter $(export-objs), $(obj-y))
M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
+MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m)))
+MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
include $(TOPDIR)/Rules.make
@@ -389,3 +396,7 @@ defkeymap.c: defkeymap.map
zoran.o: zr36120.o zr36120_i2c.o zr36120_mem.o
$(LD) $(LD_RFLAG) -r -o $@ zr36120.o zr36120_i2c.o zr36120_mem.o
+
+bttv.o: $(bttv-objs)
+ $(LD) $(LD_RFLAG) -r -o $@ $(bttv-objs)
+
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 29614cfd9..2c39b55fa 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -1876,7 +1876,7 @@ static int get_async_struct(int line, struct async_struct **ret_info)
info->tqueue.data = info;
info->state = sstate;
if (sstate->info) {
- kfree_s(info, sizeof(struct async_struct));
+ kfree(info);
*ret_info = sstate->info;
return 0;
}
@@ -2254,7 +2254,7 @@ void cleanup_module(void)
info = rs_table[0].info;
if (info) {
rs_table[0].info = NULL;
- kfree_s(info, sizeof(struct async_struct));
+ kfree(info);
}
if (tmp_buf) {
diff --git a/drivers/char/bt848.h b/drivers/char/bt848.h
index 5227ef712..340accf31 100644
--- a/drivers/char/bt848.h
+++ b/drivers/char/bt848.h
@@ -336,7 +336,7 @@
-/* Bt848A and Bt849 only !! */
+/* Bt848A and higher only !! */
#define BT848_TGLB 0x080
#define BT848_TGCTRL 0x084
#define BT848_FCAP 0x0E8
diff --git a/drivers/char/bttv-cards.c b/drivers/char/bttv-cards.c
new file mode 100644
index 000000000..e4e26c92c
--- /dev/null
+++ b/drivers/char/bttv-cards.c
@@ -0,0 +1,834 @@
+/*
+ bttv-cards.c -- this file has card-specific stuff
+
+
+ bttv - Bt848 frame grabber driver
+
+ Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
+ & Marcus Metzler (mocm@thp.uni-koeln.de)
+ (c) 1999,2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#define __NO_VERSION__ 1
+
+#include <linux/version.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/kmod.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+
+#include "bttv.h"
+#include "tuner.h"
+
+/* fwd decl */
+static void hauppauge_eeprom(struct bttv *btv);
+static void hauppauge_boot_msp34xx(struct bttv *btv);
+static void init_PXC200(struct bttv *btv);
+static void init_tea5757(struct bttv *btv);
+
+MODULE_PARM(card,"1-4i");
+MODULE_PARM(pll,"1-4i");
+MODULE_PARM(autoload,"i");
+
+static unsigned int card[4] = { -1, -1, -1, -1 };
+static unsigned int pll[4] = { -1, -1, -1, -1 };
+#ifdef MODULE
+static unsigned int autoload = 1;
+#else
+static unsigned int autoload = 0;
+#endif
+
+/* ----------------------------------------------------------------------- */
+/* list of card IDs for bt878+ cards */
+
+static struct CARD {
+ unsigned id;
+ int cardnr;
+ char *name;
+} cards[] __devinitdata = {
+ { 0x00011002, BTTV_HAUPPAUGE878, "ATI TV Wonder" },
+ { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
+ { 0x00021461, BTTV_AVERMEDIA98, "Avermedia TVCapture 98" },
+ { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
+ { 0x00041461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
+ { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
+ { 0x1118153b, BTTV_TERRATVALUE, "Terratec TV Value" },
+ { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV/Radio+" },
+ { 0x1200bd11, BTTV_PINNACLERAVE, "Pinnacle PCTV Rave" },
+ { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
+#if 0 /* probably wrong */
+ { 0x14610002, BTTV_AVERMEDIA98, "Avermedia TVCapture 98" },
+#endif
+ { 0x18501851, BTTV_CHRONOS_VS2, "Chronos Video Shuttle II" },
+ { 0x18521852, BTTV_TYPHOON_TVIEW, "Typhoon TView TV/FM Tuner" },
+ { 0x263610b4, BTTV_STB2, "STB TV PCI FM, P/N 6000704" },
+ { 0x3000144f, BTTV_MAGICTVIEW063, "TView 99 (CPH063)" },
+ { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
+ { 0x3002144f, BTTV_MAGICTVIEW061, "Askey Magic TView" },
+ { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master" },
+ { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
+ { 0x402010fc, 0 /* no tvcards entry yet */, "I-O Data Co. GV-BCV3/PCI" },
+ { 0x6606217d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
+ { 0, -1, NULL }
+};
+
+/* ----------------------------------------------------------------------- */
+/* array with description for bt848 / bt878 tv/grabber cards */
+
+struct tvcard bttv_tvcards[] =
+{
+ /* 0x00 */
+ { " *** UNKNOWN *** ",
+ 3, 1, 0, 2, 0, { 2, 3, 1, 1}, { 0, 0, 0, 0, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "MIRO PCTV",
+ 4, 1, 0, 2,15, { 2, 3, 1, 1}, { 2, 0, 0, 0,10},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Hauppauge old",
+ 4, 1, 0, 2, 7, { 2, 3, 1, 1}, { 0, 1, 2, 3, 4},0,
+ 1,1,0,1,0,0,0,1, PLL_NONE, -1 },
+ { "STB",
+ 3, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 0, 2, 3, 1},0,
+ 0,1,1,1,1,0,0,1, PLL_NONE, -1 },
+
+ { "Intel",
+ 3, 1, 0, -1, 7, { 2, 3, 1, 1}, { 0, 1, 2, 3, 4},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Diamond DTV2000",
+ 3, 1, 0, 2, 3, { 2, 3, 1, 1}, { 0, 1, 0, 1, 3},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "AVerMedia TVPhone",
+ 3, 1, 0, 3,15, { 2, 3, 1, 1}, {12, 4,11,11, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "MATRIX-Vision MV-Delta",
+ 5, 1, -1, 3, 0, { 2, 3, 1, 0, 0},{0 }, 0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+
+ /* 0x08 */
+ { "Fly Video II",
+ 3, 1, 0, 2, 0xc00, { 2, 3, 1, 1},
+ { 0, 0xc00, 0x800, 0x400, 0xc00, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "TurboTV",
+ 3, 1, 0, 2, 3, { 2, 3, 1, 1}, { 1, 1, 2, 3, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Hauppauge new (bt878)",
+ 4, 1, 0, 2, 7, { 2, 0, 1, 1}, { 0, 1, 2, 3, 4},0,
+ 1,1,0,1,0,0,0,1, PLL_28, -1 },
+ { "MIRO PCTV pro",
+ 3, 1, 0, 2, 65551, { 2, 3, 1, 1}, {1,65537, 0, 0,10},0,
+ /* 3, 1, 0, 2, 0x3004F, { 2, 3, 1, 1}, {1, 0x10011, 5, 0,10}, 0x3004F, */
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+
+ { "ADS Technologies Channel Surfer TV",
+ 3, 1, 2, 2, 15, { 2, 3, 1, 1}, { 13, 14, 11, 7, 0, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "AVerMedia TVCapture 98",
+ 3, 4, 0, 2, 15, { 2, 3, 1, 1}, { 13, 14, 11, 7, 0, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+ { "Aimslab VHX",
+ 3, 1, 0, 2, 7, { 2, 3, 1, 1}, { 0, 1, 2, 3, 4},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Zoltrix TV-Max",
+ 3, 1, 0, 2,15, { 2, 3, 1, 1}, {0 , 0, 1 , 0, 10},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+
+ /* 0x10 */
+ { "Pixelview PlayTV (bt878)",
+ 3, 1, 0, 2, 0x01fe00, { 2, 3, 1, 1},
+ { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+ { "Leadtek WinView 601",
+ 3, 1, 0, 2, 0x8300f8, { 2, 3, 1, 1,0},
+ { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "AVEC Intercapture",
+ 3, 2, 0, 2, 0, {2, 3, 1, 1}, {1, 0, 0, 0, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "LifeView FlyKit w/o Tuner",
+ 3, 1, -1, -1, 0x8dff00, { 2, 3, 1, 1}, { 0 },0,
+ 0,0,0,0,0,0,0,1, PLL_NONE, -1 },
+
+ { "CEI Raffles Card",
+ 3, 3, 0, 2, 0, {2, 3, 1, 1}, {0, 0, 0, 0 ,0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Lucky Star Image World ConferenceTV",
+ 3, 1, 0, 2, 0x00fffe07, { 2, 3, 1, 1}, { 131072, 1, 1638400, 3, 4},0,
+ 1,1,1,1,0,0,0,1, PLL_28, TUNER_PHILIPS_PAL_I },
+ { "Phoebe Tv Master + FM",
+ 3, 1, 0, 2, 0xc00, { 2, 3, 1, 1},{0, 1, 0x800, 0x400, 0xc00, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Modular Technology MM205 PCTV, bt878",
+ 2, 1, 0, -1, 7, { 2, 3 }, { 0, 0, 0, 0, 0 },0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+
+ /* 0x18 */
+ { "Askey/Typhoon/Anubis Magic TView CPH051/061 (bt878)",
+ 3, 1, 0, 2, 0xe00, { 2, 3, 1, 1}, {0x400, 0x400, 0x400, 0x400, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+ { "Terratec/Vobis TV-Boostar",
+ 3, 1, 0, 2, 16777215 , { 2, 3, 1, 1}, { 131072, 1, 1638400, 3,4},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Newer Hauppauge WinCam (bt878)",
+ 4, 1, 0, 3, 7, { 2, 0, 1, 1}, { 0, 1, 2, 3, 4},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "MAXI TV Video PCI2",
+ 3, 1, 0, 2, 0xffff, { 2, 3, 1, 1}, { 0, 1, 2, 3, 0xc00},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, TUNER_PHILIPS_SECAM },
+
+ { "Terratec TerraTV+",
+ 3, 1, 0, 2, 0x70000, { 2, 3, 1, 1},
+ { 0x20000, 0x30000, 0x00000, 0x10000, 0x40000},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Imagenation PXC200",
+ 5, 1, -1, 4, 0, { 2, 3, 1, 0, 0}, { 0 }, 0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "FlyVideo 98",
+ 3, 1, 0, 2, 0x8dff00, {2, 3, 1, 1},
+ { 0, 0x8dff00, 0x8df700, 0x8de700, 0x8dff00, 0 },0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "iProTV",
+ 3, 1, 0, 2, 1, { 2, 3, 1, 1}, { 1, 0, 0, 0, 0 },0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+
+ /* 0x20 */
+ { "Intel Create and Share PCI",
+ 4, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 4, 4, 4, 4},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Terratec TerraTValue",
+ 3, 1, 0, 2, 0xffff00, { 2, 3, 1, 1},
+ { 0x500, 0, 0x300, 0x900, 0x900},0,
+ 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
+ { "Leadtek WinFast 2000",
+ 3, 1, 0, 2, 0xfff000, { 2, 3, 1, 1,0},
+ { 0x621000,0x620100,0x621100,0x620000,0xE210000,0x620000},0,
+ 1,1,1,1,1,0,0,1, PLL_28, -1 },
+ { "Chronos Video Shuttle II",
+ 3, 3, 0, 2, 0x1800, { 2, 3, 1, 1}, { 0, 0, 0x1000, 0x1000, 0x0800},0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+
+ { "Typhoon TView TV/FM Tuner",
+ 3, 3, 0, 2, 0x1800, { 2, 3, 1, 1}, { 0, 0x800, 0, 0, 0x1800, 0 },0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+ { "PixelView PlayTV pro",
+ 3, 1, 0, 2, 0xff, { 2, 3, 1, 1 },
+ { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, 0,
+ 0,0,0,0,0,0,0,1, PLL_28, -1 },
+ { "TView99 CPH063",
+ 3, 1, 0, 2, 0x551e00, { 2, 3, 1, 1},
+ { 0x551400, 0x551200, 0, 0, 0, 0x551200 }, 0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+ { "Pinnacle PCTV Rave",
+ 3, 1, 0, 2, 0x03000F, { 2, 3, 1, 1}, { 2, 0, 0, 0, 1},0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+
+ /* 0x28 */
+ { "STB2",
+ 3, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 0, 2, 3, 1},0,
+ 0,1,1,1,0,1,1,1, PLL_NONE, -1 },
+ { "AVerMedia TVPhone 98",
+ 3, 4, 0, 2, 4, { 2, 3, 1, 1}, { 13, 14, 11, 7, 0, 0},0,
+ 1,1,1,1,0,0,0,1, PLL_28, 5 },
+ { "ProVideo PV951", /* pic16c54 */
+ 3, 1, 0, 2, 0, { 2, 3, 1, 1}, { 0, 0, 0, 0, 0},0,
+ 0,0,0,0,0,0,0,0, PLL_28, 1 },
+ { "Little OnAir TV",
+ 3, 1, 0, 2, 0xe00b, {2, 3, 1, 1},
+ {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},0,
+ 0,0,0,0,0,0,0,0, PLL_NONE, -1 },
+
+ { "Sigma TVII-FM",
+ 2, 1, 0, -1, 3, {2, 3, 1, 1}, {1, 1, 0, 2, 3},0,
+ 0,0,0,0,0,0,0,0, PLL_NONE, -1 },
+ { "MATRIX-Vision MV-Delta 2",
+ 5, 1, -1, 3, 0, { 2, 3, 1, 0, 0},{0 }, 0,
+ 0,0,0,0,0,0,0,0, PLL_28, -1 },
+ { "Zoltrix Genie TV",
+ 3, 1, 0, 2, 0xbcf03f, { 2, 3, 1, 1},
+ { 0xbc803f, 0, 0xbcb03f, 0, 0xbcb03f}, 0,
+ 0,0,0,0,0,0,0,0, PLL_28, 5 },
+ { "Terratec TV/Radio+", /* Radio ?? */
+ 3, 1, 0, 2, 0x1f0000, { 2, 3, 1, 1},
+ { 0xe2ffff, 0, 0, 0, 0xe0ffff, 0xe2ffff },0,
+ 0,0,0,0,0,0,0,0, PLL_35, 1 },
+
+ /* 0x30 */
+ { "Dynalink Magic TView ",
+ 3, 1, 0, 2, 15, { 2, 3, 1, 1}, {2,0,0,0,1},0,
+ 1,1,1,1,0,0,0,1, PLL_28, -1 },
+};
+const int bttv_num_tvcards = (sizeof(bttv_tvcards)/sizeof(struct tvcard));
+
+/* ----------------------------------------------------------------------- */
+
+static unsigned char eeprom_data[256];
+
+static void __devinit bttv_dump_eeprom(struct bttv *btv,int addr)
+{
+ int i;
+
+ if (bttv_verbose < 2)
+ return;
+ /* for debugging: dump eeprom to syslog */
+ printk(KERN_DEBUG "bttv%d: dump eeprom @ 0x%02x\n",btv->nr,addr);
+ for (i = 0; i < 256;) {
+ printk(KERN_DEBUG " %02x:",i);
+ do {
+ printk(" %02x",eeprom_data[i++]);
+ } while (i % 16);
+ printk("\n");
+ }
+}
+
+static int __devinit bttv_idcard_eeprom(struct bttv *btv)
+{
+ unsigned id;
+ int i,n;
+
+ id = (eeprom_data[252] << 24) |
+ (eeprom_data[253] << 16) |
+ (eeprom_data[254] << 8) |
+ (eeprom_data[255]);
+ if (id == 0 || id == 0xffffffff)
+ return -1;
+
+ /* look for the card */
+ btv->cardid = id;
+ for (n = -1, i = 0; cards[i].id != 0; i++)
+ if (cards[i].id == id)
+ n = i;
+
+ if (n != -1) {
+ /* found it */
+ printk(KERN_INFO "bttv%d: card id: %s (0x%08x) => card=%d\n",
+ btv->nr,cards[n].name,id,cards[n].cardnr);
+ return cards[n].cardnr;
+ } else {
+ /* 404 */
+ printk(KERN_INFO "bttv%d: id: unknown (0x%08x)\n",
+ btv->nr, id);
+ printk(KERN_INFO "please mail id, board name and "
+ "the correct card= insmod option to "
+ "kraxel@goldbach.in-berlin.de\n");
+ return -1;
+ }
+}
+
+#ifndef HAVE_TVAUDIO
+/* can tda9855.c handle this too maybe? */
+static void __devinit init_tda9840(struct bttv *btv)
+{
+ /* Horrible Hack */
+ bttv_I2CWrite(btv, I2C_TDA9840, TDA9840_SW, 0x2a, 1); /* sound mode switching */
+ /* 00 - mute
+ 10 - mono / averaged stereo
+ 2a - stereo
+ 12 - dual A
+ 1a - dual AB
+ 16 - dual BA
+ 1e - dual B
+ 7a - external */
+}
+#endif
+
+void __devinit bttv_idcard(struct bttv *btv)
+{
+ int type,eeprom = 0;
+
+ btwrite(0, BT848_GPIO_OUT_EN);
+
+ /* try to autodetect the card */
+ /* many bt878 cards have a eeprom @ 0xa0 => read ID
+ and try to identify it */
+ if (bttv_I2CRead(btv, I2C_HAUPEE, "eeprom") >= 0) {
+ eeprom = 0xa0;
+ bttv_readee(btv,eeprom_data,0xa0);
+ bttv_dump_eeprom(btv,0xa0); /* DEBUG */
+ type = bttv_idcard_eeprom(btv);
+ if (-1 != type) {
+ btv->type = type;
+ } else if (btv->id <= 849) {
+ /* for unknown bt848, assume old Hauppauge */
+ btv->type=BTTV_HAUPPAUGE;
+ }
+
+ /* STB cards have a eeprom @ 0xae (old bt848) */
+ } else if (bttv_I2CRead(btv, I2C_STBEE, "eeprom")>=0) {
+ btv->type=BTTV_STB;
+ }
+
+ /* let the user override the autodetected type */
+ if (card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards)
+ btv->type=card[btv->nr];
+
+ /* print which card config we are using */
+ sprintf(btv->video_dev.name,"BT%d%s(%.23s)",
+ btv->id,
+ (btv->id==848 && btv->revision==0x12) ? "A" : "",
+ bttv_tvcards[btv->type].name);
+ printk(KERN_INFO "bttv%d: model: %s [%s]\n",btv->nr,btv->video_dev.name,
+ (card[btv->nr] >= 0 && card[btv->nr] < bttv_num_tvcards) ?
+ "insmod option" : "autodetected");
+
+ /* board specific initialisations */
+ if (btv->type == BTTV_MIRO || btv->type == BTTV_MIROPRO) {
+ /* auto detect tuner for MIRO cards */
+ btv->tuner_type=((btread(BT848_GPIO_DATA)>>10)-1)&7;
+#if 0
+ if (btv->type == BTTV_MIROPRO) {
+ if (bttv_verbose)
+ printk(KERN_INFO "Initializing TEA5757...\n");
+ init_tea5757(btv);
+ }
+#endif
+ }
+ if (btv->type == BTTV_HAUPPAUGE || btv->type == BTTV_HAUPPAUGE878) {
+ /* pick up some config infos from the eeprom */
+ if (0xa0 != eeprom) {
+ eeprom = 0xa0;
+ bttv_readee(btv,eeprom_data,0xa0);
+ }
+ hauppauge_eeprom(btv);
+ hauppauge_boot_msp34xx(btv);
+ }
+ if (btv->type == BTTV_PXC200)
+ init_PXC200(btv);
+
+ /* pll configuration */
+ if (!(btv->id==848 && btv->revision==0x11)) {
+ /* defaults from card list */
+ if (PLL_28 == bttv_tvcards[btv->type].pll) {
+ btv->pll.pll_ifreq=28636363;
+ btv->pll.pll_crystal=BT848_IFORM_XT0;
+ }
+ /* insmod options can override */
+ switch (pll[btv->nr]) {
+ case 0: /* none */
+ btv->pll.pll_crystal = 0;
+ btv->pll.pll_ifreq = 0;
+ btv->pll.pll_ofreq = 0;
+ break;
+ case 1: /* 28 MHz */
+ btv->pll.pll_ifreq = 28636363;
+ btv->pll.pll_ofreq = 0;
+ btv->pll.pll_crystal=BT848_IFORM_XT0;
+ break;
+ case 2: /* 35 MHz */
+ btv->pll.pll_ifreq = 35468950;
+ btv->pll.pll_ofreq = 0;
+ btv->pll.pll_crystal=BT848_IFORM_XT1;
+ break;
+ }
+ }
+
+
+ /* tuner configuration */
+ if (-1 != bttv_tvcards[btv->type].tuner_type)
+ btv->tuner_type = bttv_tvcards[btv->type].tuner_type;
+ if (btv->tuner_type != -1)
+ bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
+
+ /* try to detect audio/fader chips */
+ if (bttv_tvcards[btv->type].msp34xx &&
+ bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
+ if (autoload)
+ request_module("msp3400");
+ }
+
+#ifndef HAVE_TVAUDIO
+ if (bttv_tvcards[btv->type].tda8425 &&
+ bttv_I2CRead(btv, I2C_TDA8425, "TDA8425") >=0) {
+ if (autoload)
+ request_module("tda8425");
+ }
+
+ if (bttv_tvcards[btv->type].tda9840 &&
+ bttv_I2CRead(btv, I2C_TDA9840, "TDA9840") >=0) {
+ init_tda9840(btv);
+ btv->audio_chip = TDA9840;
+ /* move this to a module too? */
+ init_tda9840(btv);
+ }
+
+ if (bttv_tvcards[btv->type].tda985x &&
+ bttv_I2CRead(btv, I2C_TDA9850, "TDA985x") >=0) {
+ if (autoload)
+ request_module("tda985x");
+ }
+ if (bttv_tvcards[btv->type].tea63xx) {
+ if (autoload)
+ request_module("tea6300");
+ }
+#else
+ if (bttv_tvcards[btv->type].tda8425 ||
+ bttv_tvcards[btv->type].tda9840 ||
+ bttv_tvcards[btv->type].tda985x ||
+ bttv_tvcards[btv->type].tea63xx) {
+ if (autoload)
+ request_module("tvaudio");
+ }
+#endif
+
+ if (bttv_tvcards[btv->type].tda9875 &&
+ bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
+ if (autoload)
+ request_module("tda9875");
+ }
+
+ if (bttv_tvcards[btv->type].tda7432 &&
+ bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
+ if (autoload)
+ request_module("tda7432");
+ }
+
+
+ if (bttv_tvcards[btv->type].tea64xx) {
+ if (autoload)
+ request_module("tea6420");
+ }
+
+ if (bttv_tvcards[btv->type].tuner != -1) {
+ if (autoload)
+ request_module("tuner");
+ }
+}
+
+
+/* ----------------------------------------------------------------------- */
+/* some hauppauge specific stuff */
+
+static struct HAUPPAUGE_TUNER
+{
+ int id;
+ char *name;
+}
+hauppauge_tuner[] __devinitdata =
+{
+ { TUNER_ABSENT, "" },
+ { TUNER_ABSENT, "External" },
+ { TUNER_ABSENT, "Unspecified" },
+ { TUNER_ABSENT, "Philips FI1216" },
+ { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
+ { TUNER_PHILIPS_NTSC, "Philips FI1236" },
+ { TUNER_ABSENT, "Philips FI1246" },
+ { TUNER_ABSENT, "Philips FI1256" },
+ { TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
+ { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
+ { TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
+ { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
+ { TUNER_ABSENT, "Philips FI1256 MK2" },
+ { TUNER_ABSENT, "Temic 4032FY5" },
+ { TUNER_TEMIC_PAL, "Temic 4002FH5" },
+ { TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
+ { TUNER_ABSENT, "Philips FR1216 MK2" },
+ { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
+ { TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
+ { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
+ { TUNER_ABSENT, "Philips FR1256 MK2" },
+ { TUNER_PHILIPS_PAL, "Philips FM1216" },
+ { TUNER_ABSENT, "Philips FM1216MF" },
+ { TUNER_PHILIPS_NTSC, "Philips FM1236" },
+ { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
+ { TUNER_ABSENT, "Philips FM1256" },
+ { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
+ { TUNER_ABSENT, "Samsung TCPN9082D" },
+ { TUNER_ABSENT, "Samsung TCPM9092P" },
+ { TUNER_TEMIC_PAL, "Temic 4006FH5" },
+ { TUNER_ABSENT, "Samsung TCPN9085D" },
+ { TUNER_ABSENT, "Samsung TCPB9085P" },
+ { TUNER_ABSENT, "Samsung TCPL9091P" },
+ { TUNER_ABSENT, "Temic 4039FR5" },
+ { TUNER_ABSENT, "Philips FQ1216 ME" },
+ { TUNER_TEMIC_PAL_I, "Temic 4066FY5" },
+ { TUNER_ABSENT, "Philips TD1536" },
+ { TUNER_ABSENT, "Philips TD1536D" },
+ { TUNER_ABSENT, "Philips FMR1236" },
+ { TUNER_ABSENT, "Philips FI1256MP" },
+ { TUNER_ABSENT, "Samsung TCPQ9091P" },
+ { TUNER_ABSENT, "Temic 4006FN5" },
+ { TUNER_ABSENT, "Temic 4009FR5" },
+ { TUNER_ABSENT, "Temic 4046FM5" },
+};
+
+static void __devinit hauppauge_eeprom(struct bttv *btv)
+{
+ if (eeprom_data[9] < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER))
+ {
+ btv->tuner_type = hauppauge_tuner[eeprom_data[9]].id;
+ if (bttv_verbose)
+ printk("bttv%d: Hauppauge eeprom: tuner=%s (%d)\n",btv->nr,
+ hauppauge_tuner[eeprom_data[9]].name,btv->tuner_type);
+ }
+}
+
+static void __devinit hauppauge_boot_msp34xx(struct bttv *btv)
+{
+ int i;
+
+ /* reset/enable the MSP on some Hauppauge cards */
+ /* Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)! */
+ btaor(32, ~32, BT848_GPIO_OUT_EN);
+ btaor(0, ~32, BT848_GPIO_DATA);
+ udelay(2500);
+ btaor(32, ~32, BT848_GPIO_DATA);
+
+ if (bttv_verbose)
+ printk("bttv%d: Hauppauge msp34xx: reset line init\n",btv->nr);
+
+ /* look if the msp3400 driver is already registered */
+ for (i = 0; i < I2C_CLIENTS_MAX; i++) {
+ if (btv->i2c_clients[i] != NULL &&
+ btv->i2c_clients[i]->driver->id == I2C_DRIVERID_MSP3400) {
+ return;
+ }
+ }
+
+ /* if not: look for the chip ... */
+ if (bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx")) {
+ /* ... if found re-register to trigger a i2c bus rescan, */
+ /* this time with the msp34xx chip activated */
+ i2c_bit_del_bus(&btv->i2c_adap);
+ i2c_bit_add_bus(&btv->i2c_adap);
+ }
+}
+
+
+/* ----------------------------------------------------------------------- */
+/* Imagenation L-Model PXC200 Framegrabber */
+/* This is basically the same procedure as
+ * used by Alessandro Rubini in his pxc200
+ * driver, but using BTTV functions */
+
+static void __devinit init_PXC200(struct bttv *btv)
+{
+ static const int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+ 0x00 };
+ int i,tmp;
+
+ /* Initialise GPIO-connevted stuff */
+ btwrite(1<<13,BT848_GPIO_OUT_EN); /* Reset pin only */
+ btwrite(0,BT848_GPIO_DATA);
+ udelay(3);
+ btwrite(1<<13,BT848_GPIO_DATA);
+ /* GPIO inputs are pulled up, so no need to drive
+ * reset pin any longer */
+ btwrite(0,BT848_GPIO_OUT_EN);
+
+ /* we could/should try and reset/control the AD pots? but
+ right now we simply turned off the crushing. Without
+ this the AGC drifts drifts
+ remember the EN is reverse logic -->
+ setting BT848_ADC_AGC_EN disable the AGC
+ tboult@eecs.lehigh.edu
+ */
+ btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
+
+ /* Initialise MAX517 DAC */
+ printk(KERN_INFO "Setting DAC reference voltage level ...\n");
+ bttv_I2CWrite(btv,0x5E,0,0x80,1);
+
+ /* Initialise 12C508 PIC */
+ /* The I2CWrite and I2CRead commmands are actually to the
+ * same chips - but the R/W bit is included in the address
+ * argument so the numbers are different */
+
+ printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
+
+ for (i = 0; i < sizeof(vals)/sizeof(int); i++) {
+ tmp=bttv_I2CWrite(btv,0x1E,vals[i],0,1);
+ printk(KERN_INFO "I2C Write(0x08) = %i\nI2C Read () = %x\n\n",
+ tmp,bttv_I2CRead(btv,0x1F,NULL));
+ }
+ printk(KERN_INFO "PXC200 Initialised.\n");
+}
+
+/* ----------------------------------------------------------------------- */
+/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */
+/*
+ * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
+ * This code is placed under the terms of the GNU General Public License
+ *
+ * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
+ */
+
+/* bus bits on the GPIO port */
+#define TEA_WE 6
+#define TEA_DATA 9
+#define TEA_CLK 8
+#define TEA_MOST 7
+
+#define BUS_LOW(bit) btand(~(1<<TEA_##bit), BT848_GPIO_DATA)
+#define BUS_HIGH(bit) btor((1<<TEA_##bit), BT848_GPIO_DATA)
+#define BUS_IN(bit) ((btread(BT848_GPIO_DATA) >> TEA_##bit) & 1)
+
+/* TEA5757 register bits */
+#define TEA_FREQ 0:14
+#define TEA_BUFFER 15:15
+
+#define TEA_SIGNAL_STRENGTH 16:17
+
+#define TEA_PORT1 18:18
+#define TEA_PORT0 19:19
+
+#define TEA_BAND 20:21
+#define TEA_BAND_FM 0
+#define TEA_BAND_MW 1
+#define TEA_BAND_LW 2
+#define TEA_BAND_SW 3
+
+#define TEA_MONO 22:22
+#define TEA_ALLOW_STEREO 0
+#define TEA_FORCE_MONO 1
+
+#define TEA_SEARCH_DIRECTION 23:23
+#define TEA_SEARCH_DOWN 0
+#define TEA_SEARCH_UP 1
+
+#define TEA_STATUS 24:24
+#define TEA_STATUS_TUNED 0
+#define TEA_STATUS_SEARCHING 1
+
+/* Low-level stuff */
+static int tea_read(struct bttv *btv)
+{
+ int value = 0;
+ long timeout;
+ int i;
+
+ /* better safe than sorry */
+ btaor((1<<TEA_CLK) | (1<<TEA_WE), ~((1<<TEA_CLK) | (1<<TEA_DATA) | (1<<TEA_WE) | (1<<TEA_MOST)), BT848_GPIO_OUT_EN);
+
+ BUS_LOW(WE);
+ BUS_LOW(CLK);
+
+ udelay(10);
+ for(timeout = jiffies + 10 * HZ;
+ BUS_IN(DATA) == 1 && time_before(jiffies, timeout);
+ schedule()); /* 10 s */
+ if (BUS_IN(DATA) == 1) {
+ printk("tea5757: read timeout\n");
+ return -1;
+ }
+ for(timeout = jiffies + HZ/5;
+ BUS_IN(MOST) == 1 && time_before(jiffies, timeout);
+ schedule()); /* 0.2 s */
+ if (bttv_debug) printk("tea5757:");
+ for(i = 0; i < 24; i++)
+ {
+ udelay(10);
+ BUS_HIGH(CLK);
+ udelay(10);
+ if (bttv_debug) printk("%c", (BUS_IN(MOST) == 0)?'T':'-');
+ BUS_LOW(CLK);
+ value <<= 1;
+ value |= (BUS_IN(DATA) == 0)?0:1; /* MSB first */
+ if (bttv_debug) printk("%c", (BUS_IN(MOST) == 0)?'S':'M');
+ }
+ if (bttv_debug) printk("\ntea5757: read 0x%X\n", value);
+ return value;
+}
+
+static int tea_write(struct bttv *btv, int value)
+{
+ int i;
+ int reg = value;
+
+ btaor((1<<TEA_CLK) | (1<<TEA_WE) | (1<<TEA_DATA), ~((1<<TEA_CLK) | (1<<TEA_DATA) | (1<<TEA_WE) | (1<<TEA_MOST)), BT848_GPIO_OUT_EN);
+ if (bttv_debug) printk("tea5757: write 0x%X\n", value);
+ BUS_LOW(CLK);
+ BUS_HIGH(WE);
+ for(i = 0; i < 25; i++)
+ {
+ if (reg & 0x1000000)
+ BUS_HIGH(DATA);
+ else
+ BUS_LOW(DATA);
+ reg <<= 1;
+ BUS_HIGH(CLK);
+ udelay(10);
+ BUS_LOW(CLK);
+ udelay(10);
+ }
+ BUS_LOW(WE); /* unmute !!! */
+ return 0;
+}
+
+void tea5757_set_freq(struct bttv *btv, unsigned short freq)
+{
+ tea_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
+ if (bttv_debug) tea_read(btv);
+}
+
+void init_tea5757(struct bttv *btv)
+{
+ BUS_LOW(CLK);
+ BUS_LOW(WE); /* just to be on the safe side... */
+
+ /* software CLK (unused) */
+ btaor(0, BT848_GPIO_DMA_CTL_GPCLKMODE, BT848_GPIO_DMA_CTL);
+ /* normal mode for GPIO */
+ btaor(0, BT848_GPIO_DMA_CTL_GPIOMODE, BT848_GPIO_DMA_CTL);
+}
+
+/* ----------------------------------------------------------------------- */
+/* winview */
+
+void winview_setvol(struct bttv *btv, struct video_audio *v)
+{
+ /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
+ int bits_out, loops, vol, data;
+
+ /* 32 levels logarithmic */
+ vol = 32 - ((v->volume>>11));
+ /* units */
+ bits_out = (PT2254_DBS_IN_2>>(vol%5));
+ /* tens */
+ bits_out |= (PT2254_DBS_IN_10>>(vol/5));
+ bits_out |= PT2254_L_CHANEL | PT2254_R_CHANEL;
+ data = btread(BT848_GPIO_DATA);
+ data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
+ WINVIEW_PT2254_STROBE);
+ for (loops = 17; loops >= 0 ; loops--) {
+ if (bits_out & (1<<loops))
+ data |= WINVIEW_PT2254_DATA;
+ else
+ data &= ~WINVIEW_PT2254_DATA;
+ btwrite(data, BT848_GPIO_DATA);
+ udelay(5);
+ data |= WINVIEW_PT2254_CLK;
+ btwrite(data, BT848_GPIO_DATA);
+ udelay(5);
+ data &= ~WINVIEW_PT2254_CLK;
+ btwrite(data, BT848_GPIO_DATA);
+ }
+ data |= WINVIEW_PT2254_STROBE;
+ data &= ~WINVIEW_PT2254_DATA;
+ btwrite(data, BT848_GPIO_DATA);
+ udelay(10);
+ data &= ~WINVIEW_PT2254_STROBE;
+ btwrite(data, BT848_GPIO_DATA);
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/drivers/char/bttv.c b/drivers/char/bttv-driver.c
index e1cc54e3b..e635755a2 100644
--- a/drivers/char/bttv.c
+++ b/drivers/char/bttv-driver.c
@@ -44,6 +44,9 @@
#include <linux/kmod.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
+#ifdef HACKING
+# include <linux/iobuf.h>
+#endif
#include "bttv.h"
#include "tuner.h"
@@ -54,34 +57,22 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
-/* Anybody who uses more than four? */
-#define BTTV_MAX 4
static void bt848_set_risc_jmps(struct bttv *btv, int state);
-static int bttv_num; /* number of Bt848s in use */
-static struct bttv bttvs[BTTV_MAX];
+int bttv_num; /* number of Bt848s in use */
+struct bttv bttvs[BTTV_MAX];
/* insmod args */
MODULE_PARM(triton1,"i");
MODULE_PARM(radio,"1-4i");
-MODULE_PARM(card,"1-4i");
-MODULE_PARM(pll,"1-4i");
MODULE_PARM(bigendian,"i");
MODULE_PARM(fieldnr,"i");
-MODULE_PARM(verbose,"i");
-MODULE_PARM(debug,"i");
-MODULE_PARM(autoload,"i");
+MODULE_PARM(bttv_verbose,"i");
+MODULE_PARM(bttv_debug,"i");
MODULE_PARM(gbuffers,"i");
MODULE_PARM(gbufsize,"i");
-EXPORT_SYMBOL(bttv_get_cardinfo);
-EXPORT_SYMBOL(bttv_get_id);
-EXPORT_SYMBOL(bttv_gpio_enable);
-EXPORT_SYMBOL(bttv_read_gpio);
-EXPORT_SYMBOL(bttv_write_gpio);
-EXPORT_SYMBOL(bttv_get_gpio_queue);
-
MODULE_DESCRIPTION("bttv - v4l driver module for bt848/878 based cards");
MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
@@ -92,19 +83,11 @@ static unsigned int bigendian=0;
#endif
static int triton1=0;
static unsigned int radio[BTTV_MAX];
-static unsigned int card[BTTV_MAX] = { 0, 0, 0, 0 };
-static unsigned int pll[BTTV_MAX] = { -1, -1, -1, -1};
static unsigned int fieldnr = 0;
-static unsigned int verbose = 1;
-static unsigned int debug = 0;
static unsigned int gbuffers = 2;
static unsigned int gbufsize = BTTV_MAX_FBUF;
-#ifdef MODULE
-static unsigned int autoload = 1;
-#else
-static unsigned int autoload = 0;
-#endif
-
+unsigned int bttv_debug = 0;
+unsigned int bttv_verbose = 1;
#define I2C_TIMING (0x7<<4)
#define I2C_DELAY 10
@@ -117,94 +100,6 @@ static unsigned int autoload = 0;
#define BTTV_ERRORS 5
-/* ----------------------------------------------------------------------- */
-/* Exported functions - for other modules which want to access the */
-/* gpio ports (IR for example) */
-/* see bttv.h for comments */
-
-int bttv_get_cardinfo(unsigned int card, int *type, int *cardid)
-{
- if (card >= bttv_num) {
- return -1;
- }
- *type = bttvs[card].type;
- *cardid = bttvs[card].cardid;
- return 0;
-}
-
-int bttv_get_id(unsigned int card)
-{
- printk("bttv_get_id is obsolete, use bttv_get_cardinfo instead\n");
- if (card >= bttv_num) {
- return -1;
- }
- return bttvs[card].type;
-}
-
-int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
-{
- struct bttv *btv;
-
- if (card >= bttv_num) {
- return -EINVAL;
- }
-
- btv = &bttvs[card];
- btaor(data, ~mask, BT848_GPIO_OUT_EN);
- return 0;
-}
-
-int bttv_read_gpio(unsigned int card, unsigned long *data)
-{
- struct bttv *btv;
-
- if (card >= bttv_num) {
- return -EINVAL;
- }
-
- btv = &bttvs[card];
-
- if(btv->shutdown) {
- return -ENODEV;
- }
-
-/* prior setting BT848_GPIO_REG_INP is (probably) not needed
- because we set direct input on init */
- *data = btread(BT848_GPIO_DATA);
- return 0;
-}
-
-int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
-{
- struct bttv *btv;
-
- if (card >= bttv_num) {
- return -EINVAL;
- }
-
- btv = &bttvs[card];
-
-/* prior setting BT848_GPIO_REG_INP is (probably) not needed
- because direct input is set on init */
- btaor(data & mask, ~mask, BT848_GPIO_DATA);
- return 0;
-}
-
-wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
-{
- struct bttv *btv;
-
- if (card >= bttv_num) {
- return NULL;
- }
-
- btv = &bttvs[card];
- if (bttvs[card].shutdown) {
- return NULL;
- }
- return &btv->gpioq;
-}
-
/*******************************/
/* Memory management functions */
/*******************************/
@@ -342,147 +237,12 @@ static int fbuffer_alloc(struct bttv *btv)
}
-/* ----------------------------------------------------------------------- */
-/* I2C functions */
-
-static void bttv_bit_setscl(void *data, int state)
-{
- struct bttv *btv = (struct bttv*)data;
-
- if (state)
- btv->i2c_state |= 0x02;
- else
- btv->i2c_state &= ~0x02;
- btwrite(btv->i2c_state, BT848_I2C);
- btread(BT848_I2C);
-}
-
-static void bttv_bit_setsda(void *data, int state)
-{
- struct bttv *btv = (struct bttv*)data;
-
- if (state)
- btv->i2c_state |= 0x01;
- else
- btv->i2c_state &= ~0x01;
- btwrite(btv->i2c_state, BT848_I2C);
- btread(BT848_I2C);
-}
-
-static int bttv_bit_getscl(void *data)
-{
- struct bttv *btv = (struct bttv*)data;
- int state;
-
- state = btread(BT848_I2C) & 0x02 ? 1 : 0;
- return state;
-}
-
-static int bttv_bit_getsda(void *data)
-{
- struct bttv *btv = (struct bttv*)data;
- int state;
-
- state = btread(BT848_I2C) & 0x01;
- return state;
-}
-
-static void bttv_inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void bttv_dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-
-static void call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg)
-{
- int i;
-
- for (i = 0; i < I2C_CLIENTS_MAX; i++) {
- if (NULL == btv->i2c_clients[i])
- continue;
- if (NULL == btv->i2c_clients[i]->driver->command)
- continue;
- btv->i2c_clients[i]->driver->command(
- btv->i2c_clients[i],cmd,arg);
- }
-}
-
-static int attach_inform(struct i2c_client *client)
-{
- struct bttv *btv = (struct bttv*)client->adapter->data;
- int i;
-
- for (i = 0; i < I2C_CLIENTS_MAX; i++) {
- if (btv->i2c_clients[i] == NULL ||
- btv->i2c_clients[i]->driver->id == client->driver->id) {
- btv->i2c_clients[i] = client;
- break;
- }
- }
- if (btv->tuner_type != -1)
- call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
- if (verbose)
- printk("bttv%d: i2c attach [%s]\n",btv->nr,client->name);
- return 0;
-}
-
-static int detach_inform(struct i2c_client *client)
-{
- struct bttv *btv = (struct bttv*)client->adapter->data;
- int i;
-
- if (verbose)
- printk("bttv%d: i2c detach [%s]\n",btv->nr,client->name);
- for (i = 0; i < I2C_CLIENTS_MAX; i++) {
- if (NULL != btv->i2c_clients[i] &&
- btv->i2c_clients[i]->driver->id == client->driver->id) {
- btv->i2c_clients[i] = NULL;
- break;
- }
- }
- return 0;
-}
-
-static struct i2c_algo_bit_data i2c_algo_template = {
- NULL,
- bttv_bit_setsda,
- bttv_bit_setscl,
- bttv_bit_getsda,
- bttv_bit_getscl,
- 10, 10, 100,
-};
-
-static struct i2c_adapter i2c_adap_template = {
- "bt848",
- I2C_HW_B_BT848,
- NULL,
- NULL,
- bttv_inc_use,
- bttv_dec_use,
- attach_inform,
- detach_inform,
- NULL,
-};
-
-static struct i2c_client i2c_client_template = {
- "bttv internal",
- -1,
- 0,
- 0,
- NULL,
- NULL
-};
-
static int __devinit init_bttv_i2c(struct bttv *btv)
{
/* i2c bit_adapter */
- memcpy(&btv->i2c_adap, &i2c_adap_template, sizeof(struct i2c_adapter));
- memcpy(&btv->i2c_algo, &i2c_algo_template, sizeof(struct i2c_algo_bit_data));
- memcpy(&btv->i2c_client, &i2c_client_template, sizeof(struct i2c_client));
+ memcpy(&btv->i2c_adap, &bttv_i2c_adap_template, sizeof(struct i2c_adapter));
+ memcpy(&btv->i2c_algo, &bttv_i2c_algo_template, sizeof(struct i2c_algo_bit_data));
+ memcpy(&btv->i2c_client, &bttv_i2c_client_template, sizeof(struct i2c_client));
sprintf(btv->i2c_adap.name+strlen(btv->i2c_adap.name),
" #%d", btv->nr);
@@ -498,497 +258,12 @@ static int __devinit init_bttv_i2c(struct bttv *btv)
return btv->i2c_ok;
}
-/* read I2C */
-static int I2CRead(struct bttv *btv, unsigned char addr, char *probe_for)
-{
- unsigned char buffer = 0;
-
- if (0 != btv->i2c_ok)
- return -1;
- if (verbose && NULL != probe_for)
- printk(KERN_INFO "bttv%d: i2c: checking for %s @ 0x%02x... ",
- btv->nr,probe_for,addr);
- btv->i2c_client.addr = addr >> 1;
- if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) {
- if (NULL != probe_for) {
- if (verbose)
- printk("not found\n");
- } else
- printk(KERN_WARNING "bttv%d: i2c read 0x%x: error\n",
- btv->nr,addr);
- return -1;
- }
- if (verbose && NULL != probe_for)
- printk("found\n");
- return buffer;
-}
-
-/* write I2C */
-static int I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
- unsigned char b2, int both)
-{
- unsigned char buffer[2];
- int bytes = both ? 2 : 1;
-
- if (0 != btv->i2c_ok)
- return -1;
- btv->i2c_client.addr = addr >> 1;
- buffer[0] = b1;
- buffer[1] = b2;
- if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes))
- return -1;
- return 0;
-}
-
-/* read EEPROM */
-static void __devinit readee(struct bttv *btv, unsigned char *eedata, int addr)
-{
- int i;
-
- if (I2CWrite(btv, addr, 0, -1, 0)<0) {
- printk(KERN_WARNING "bttv: readee error\n");
- return;
- }
- btv->i2c_client.addr = addr >> 1;
- for (i=0; i<256; i+=16) {
- if (16 != i2c_master_recv(&btv->i2c_client,eedata+i,16)) {
- printk(KERN_WARNING "bttv: readee error\n");
- break;
- }
- }
-}
-
-
-/* ----------------------------------------------------------------------- */
-/* some hauppauge specific stuff */
-
-static unsigned char eeprom_data[256];
-static struct HAUPPAUGE_TUNER
-{
- int id;
- char *name;
-}
-hauppauge_tuner[] __devinitdata =
-{
- { TUNER_ABSENT, "" },
- { TUNER_ABSENT, "External" },
- { TUNER_ABSENT, "Unspecified" },
- { TUNER_ABSENT, "Philips FI1216" },
- { TUNER_PHILIPS_SECAM, "Philips FI1216MF" },
- { TUNER_PHILIPS_NTSC, "Philips FI1236" },
- { TUNER_ABSENT, "Philips FI1246" },
- { TUNER_ABSENT, "Philips FI1256" },
- { TUNER_PHILIPS_PAL, "Philips FI1216 MK2" },
- { TUNER_PHILIPS_SECAM, "Philips FI1216MF MK2" },
- { TUNER_PHILIPS_NTSC, "Philips FI1236 MK2" },
- { TUNER_PHILIPS_PAL_I, "Philips FI1246 MK2" },
- { TUNER_ABSENT, "Philips FI1256 MK2" },
- { TUNER_ABSENT, "Temic 4032FY5" },
- { TUNER_TEMIC_PAL, "Temic 4002FH5" },
- { TUNER_TEMIC_PAL_I, "Temic 4062FY5" },
- { TUNER_ABSENT, "Philips FR1216 MK2" },
- { TUNER_PHILIPS_SECAM, "Philips FR1216MF MK2" },
- { TUNER_PHILIPS_NTSC, "Philips FR1236 MK2" },
- { TUNER_PHILIPS_PAL_I, "Philips FR1246 MK2" },
- { TUNER_ABSENT, "Philips FR1256 MK2" },
- { TUNER_PHILIPS_PAL, "Philips FM1216" },
- { TUNER_ABSENT, "Philips FM1216MF" },
- { TUNER_PHILIPS_NTSC, "Philips FM1236" },
- { TUNER_PHILIPS_PAL_I, "Philips FM1246" },
- { TUNER_ABSENT, "Philips FM1256" },
- { TUNER_TEMIC_4036FY5_NTSC, "Temic 4036FY5" },
- { TUNER_ABSENT, "Samsung TCPN9082D" },
- { TUNER_ABSENT, "Samsung TCPM9092P" },
- { TUNER_TEMIC_PAL, "Temic 4006FH5" },
- { TUNER_ABSENT, "Samsung TCPN9085D" },
- { TUNER_ABSENT, "Samsung TCPB9085P" },
- { TUNER_ABSENT, "Samsung TCPL9091P" },
- { TUNER_ABSENT, "Temic 4039FR5" },
- { TUNER_ABSENT, "Philips FQ1216 ME" },
- { TUNER_TEMIC_PAL_I, "Temic 4066FY5" },
- { TUNER_ABSENT, "Philips TD1536" },
- { TUNER_ABSENT, "Philips TD1536D" },
- { TUNER_ABSENT, "Philips FMR1236" },
- { TUNER_ABSENT, "Philips FI1256MP" },
- { TUNER_ABSENT, "Samsung TCPQ9091P" },
- { TUNER_ABSENT, "Temic 4006FN5" },
- { TUNER_ABSENT, "Temic 4009FR5" },
- { TUNER_ABSENT, "Temic 4046FM5" },
-};
-
-static void __devinit hauppauge_eeprom(struct bttv *btv)
-{
- if (eeprom_data[9] < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER))
- {
- btv->tuner_type = hauppauge_tuner[eeprom_data[9]].id;
- if (verbose)
- printk("bttv%d: Hauppauge eeprom: tuner=%s (%d)\n",btv->nr,
- hauppauge_tuner[eeprom_data[9]].name,btv->tuner_type);
- }
-}
-
-static void __devinit hauppauge_boot_msp34xx(struct bttv *btv)
-{
- int i;
-
- /* reset/enable the MSP on some Hauppauge cards */
- /* Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)! */
- btaor(32, ~32, BT848_GPIO_OUT_EN);
- btaor(0, ~32, BT848_GPIO_DATA);
- udelay(2500);
- btaor(32, ~32, BT848_GPIO_DATA);
-
- if (verbose)
- printk("bttv%d: Hauppauge msp34xx: reset line init\n",btv->nr);
-
- /* look if the msp3400 driver is already registered */
- for (i = 0; i < I2C_CLIENTS_MAX; i++) {
- if (btv->i2c_clients[i] != NULL &&
- btv->i2c_clients[i]->driver->id == I2C_DRIVERID_MSP3400) {
- return;
- }
- }
-
- /* if not: look for the chip ... */
- if (I2CRead(btv, I2C_MSP3400, "MSP34xx")) {
- /* ... if found re-register to trigger a i2c bus rescan, */
- /* this time with the msp34xx chip activated */
- i2c_bit_del_bus(&btv->i2c_adap);
- i2c_bit_add_bus(&btv->i2c_adap);
- }
-}
-
-
-/* Imagenation L-Model PXC200 Framegrabber */
-/* This is basically the same procedure as
- * used by Alessandro Rubini in his pxc200
- * driver, but using BTTV functions */
-static void __devinit init_PXC200(struct bttv *btv)
-{
- static const int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
- 0x00 };
- int i,tmp;
-
- /* Initialise GPIO-connevted stuff */
- btwrite(1<<13,BT848_GPIO_OUT_EN); /* Reset pin only */
- btwrite(0,BT848_GPIO_DATA);
- udelay(3);
- btwrite(1<<13,BT848_GPIO_DATA);
- /* GPIO inputs are pulled up, so no need to drive
- * reset pin any longer */
- btwrite(0,BT848_GPIO_OUT_EN);
-
- /* we could/should try and reset/control the AD pots? but
- right now we simply turned off the crushing. Without
- this the AGC drifts drifts
- remember the EN is reverse logic -->
- setting BT848_ADC_AGC_EN disable the AGC
- tboult@eecs.lehigh.edu
- */
- btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
-
- /* Initialise MAX517 DAC */
- printk(KERN_INFO "Setting DAC reference voltage level ...\n");
- I2CWrite(btv,0x5E,0,0x80,1);
-
- /* Initialise 12C508 PIC */
- /* The I2CWrite and I2CRead commmands are actually to the
- * same chips - but the R/W bit is included in the address
- * argument so the numbers are different */
-
- printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
-
- for (i = 0; i < sizeof(vals)/sizeof(int); i++) {
- tmp=I2CWrite(btv,0x1E,vals[i],0,1);
- printk(KERN_INFO "I2C Write(0x08) = %i\nI2C Read () = %x\n\n",
- tmp,I2CRead(btv,0x1F,NULL));
- }
- printk(KERN_INFO "PXC200 Initialised.\n");
-}
-
-/* ----------------------------------------------------------------------- */
-
-static struct CARD {
- unsigned id;
- int cardnr;
- char *name;
-} cards[] __devinitdata = {
- { 0x00011002, BTTV_HAUPPAUGE878, "ATI TV Wonder" },
- { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
- { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
- { 0x00041461, BTTV_AVPHONE98, "AVerMedia TVPhone98" },
- { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" },
- { 0x1118153b, BTTV_TERRATVALUE, "Terratec TV Value" },
- { 0x1200bd11, BTTV_PINNACLERAVE, "Pinnacle PCTV Rave" },
- { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" },
- { 0x14610002, BTTV_AVERMEDIA98, "Avermedia TVCapture 98" },
- { 0x18501851, BTTV_CHRONOS_VS2, "Chronos Video Shuttle II" },
- { 0x18521852, BTTV_TYPHOON_TVIEW, "Typhoon TView TV/FM Tuner" },
- { 0x263610b4, BTTV_STB2, "STB TV PCI FM, P/N 6000704" },
- { 0x3000144f, BTTV_MAGICTVIEW063, "TView 99 (CPH063)" },
- { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" },
- { 0x3002144f, BTTV_MAGICTVIEW061, "Askey Magic TView" },
- { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master" },
- { 0x402010fc, 0 /* no tvcards entry yet */, "I-O Data Co. GV-BCV3/PCI" },
- { 0x6606217d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" },
- { 0, -1, NULL }
-};
-
-struct tvcard
-{
- char *name;
- int video_inputs;
- int audio_inputs;
- int tuner;
- int svhs;
- u32 gpiomask;
- u32 muxsel[8];
- u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */
- u32 gpiomask2; /* GPIO MUX mask */
-
- /* look for these i2c audio chips */
- int msp34xx:1;
- int tda8425:1;
- int tda9840:1;
- int tda985x:1;
- int tea63xx:1;
- int tea64xx:1;
- int tda7432:1;
- int tda9875:1;
-
- /* other settings */
- int pll;
- int tuner_type;
-};
-
-static struct tvcard tvcards[] =
-{
- /* 0x00 */
- { " *** UNKNOWN *** ",
- 3, 1, 0, 2, 0, { 2, 3, 1, 1}, { 0, 0, 0, 0, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "MIRO PCTV",
- 4, 1, 0, 2,15, { 2, 3, 1, 1}, { 2, 0, 0, 0,10},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Hauppauge old",
- 4, 1, 0, 2, 7, { 2, 3, 1, 1}, { 0, 1, 2, 3, 4},0,
- 1,1,0,1,0,0,0,1, PLL_NONE, -1 },
- { "STB",
- 3, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 0, 2, 3, 1},0,
- 0,1,1,1,1,0,0,1, PLL_NONE, -1 },
-
- { "Intel",
- 3, 1, 0, -1, 7, { 2, 3, 1, 1}, { 0, 1, 2, 3, 4},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Diamond DTV2000",
- 3, 1, 0, 2, 3, { 2, 3, 1, 1}, { 0, 1, 0, 1, 3},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "AVerMedia TVPhone",
- 3, 1, 0, 3,15, { 2, 3, 1, 1}, {12, 4,11,11, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "MATRIX-Vision MV-Delta",
- 5, 1, -1, 3, 0, { 2, 3, 1, 0, 0},{0 }, 0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
-
- /* 0x08 */
- { "Fly Video II",
- 3, 1, 0, 2, 0xc00, { 2, 3, 1, 1},
- { 0, 0xc00, 0x800, 0x400, 0xc00, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "TurboTV",
- 3, 1, 0, 2, 3, { 2, 3, 1, 1}, { 1, 1, 2, 3, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Hauppauge new (bt878)",
- 4, 1, 0, 2, 7, { 2, 0, 1, 1}, { 0, 1, 2, 3, 4},0,
- 1,1,0,1,0,0,0,1, PLL_28, -1 },
- { "MIRO PCTV pro",
- 3, 1, 0, 2, 65551, { 2, 3, 1, 1}, {1,65537, 0, 0,10},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
-
- { "ADS Technologies Channel Surfer TV",
- 3, 1, 2, 2, 15, { 2, 3, 1, 1}, { 13, 14, 11, 7, 0, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "AVerMedia TVCapture 98",
- 3, 4, 0, 2, 15, { 2, 3, 1, 1}, { 13, 14, 11, 7, 0, 0},0,
- 1,1,1,1,0,0,0,1, PLL_28, -1 },
- { "Aimslab VHX",
- 3, 1, 0, 2, 7, { 2, 3, 1, 1}, { 0, 1, 2, 3, 4},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Zoltrix TV-Max",
- 3, 1, 0, 2,15, { 2, 3, 1, 1}, {0 , 0, 1 , 0, 10},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
-
- /* 0x10 */
- { "Pixelview PlayTV (bt878)",
- 3, 1, 0, 2, 0x01fe00, { 2, 3, 1, 1},
- { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },0,
- 1,1,1,1,0,0,0,1, PLL_28, -1 },
- { "Leadtek WinView 601",
- 3, 1, 0, 2, 0x8300f8, { 2, 3, 1, 1,0},
- { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "AVEC Intercapture",
- 3, 2, 0, 2, 0, {2, 3, 1, 1}, {1, 0, 0, 0, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "LifeView FlyKit w/o Tuner",
- 3, 1, -1, -1, 0x8dff00, { 2, 3, 1, 1}, { 0 },0,
- 0,0,0,0,0,0,0,1, PLL_NONE, -1 },
-
- { "CEI Raffles Card",
- 3, 3, 0, 2, 0, {2, 3, 1, 1}, {0, 0, 0, 0 ,0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Lucky Star Image World ConferenceTV",
- 3, 1, 0, 2, 0x00fffe07, { 2, 3, 1, 1}, { 131072, 1, 1638400, 3, 4},0,
- 1,1,1,1,0,0,0,1, PLL_28, TUNER_PHILIPS_PAL_I },
- { "Phoebe Tv Master + FM",
- 3, 1, 0, 2, 0xc00, { 2, 3, 1, 1},{0, 1, 0x800, 0x400, 0xc00, 0},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Modular Technology MM205 PCTV, bt878",
- 2, 1, 0, -1, 7, { 2, 3 }, { 0, 0, 0, 0, 0 },0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
-
- /* 0x18 */
- { "Askey/Typhoon/Anubis Magic TView CPH051/061 (bt878)",
- 3, 1, 0, 2, 0xe00, { 2, 3, 1, 1}, {0x400, 0x400, 0x400, 0x400, 0},0,
- 1,1,1,1,0,0,0,1, PLL_28, -1 },
- { "Terratec/Vobis TV-Boostar",
- 3, 1, 0, 2, 16777215 , { 2, 3, 1, 1}, { 131072, 1, 1638400, 3,4},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Newer Hauppauge WinCam (bt878)",
- 4, 1, 0, 3, 7, { 2, 0, 1, 1}, { 0, 1, 2, 3, 4},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "MAXI TV Video PCI2",
- 3, 1, 0, 2, 0xffff, { 2, 3, 1, 1}, { 0, 1, 2, 3, 0xc00},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, TUNER_PHILIPS_SECAM },
-
- { "Terratec TerraTV+",
- 3, 1, 0, 2, 0x70000, { 2, 3, 1, 1},
- { 0x20000, 0x30000, 0x00000, 0x10000, 0x40000},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Imagenation PXC200",
- 5, 1, -1, 4, 0, { 2, 3, 1, 0, 0}, { 0 }, 0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "FlyVideo 98",
- 3, 1, 0, 2, 0x8dff00, {2, 3, 1, 1},
- { 0, 0x8dff00, 0x8df700, 0x8de700, 0x8dff00, 0 },0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "iProTV",
- 3, 1, 0, 2, 1, { 2, 3, 1, 1}, { 1, 0, 0, 0, 0 },0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
-
- /* 0x20 */
- { "Intel Create and Share PCI",
- 4, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 4, 4, 4, 4},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Terratec TerraTValue",
- 3, 1, 0, 2, 0xffff00, { 2, 3, 1, 1},
- { 0x500, 0, 0x300, 0x900, 0x900},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
- { "Leadtek WinFast 2000",
- 3, 1, 0, 2, 0xfff000, { 2, 3, 1, 1,0},
- { 0x621000,0x620100,0x621100,0x620000,0xE210000,0x620000},0,
- 1,1,1,1,1,0,0,1, PLL_28, -1 },
- { "Chronos Video Shuttle II",
- 3, 3, 0, 2, 0x1800, { 2, 3, 1, 1}, { 0, 0, 0x1000, 0x1000, 0x0800},0,
- 1,1,1,1,0,0,0,1, PLL_28, -1 },
-
- { "Typhoon TView TV/FM Tuner",
- 3, 3, 0, 2, 0x1800, { 2, 3, 1, 1}, { 0, 0x800, 0, 0, 0x1800, 0 },0,
- 1,1,1,1,0,0,0,1, PLL_28, -1 },
- { "PixelView PlayTV pro",
- 3, 1, 0, 2, 0xff, { 2, 3, 1, 1 },
- { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, 0,
- 0,0,0,0,0,0,0,1, PLL_28, -1 },
- { "TView99 CPH063",
- 3, 1, 0, 2, 0x551e00, { 2, 3, 1, 1},
- { 0x551400, 0x551200, 0, 0, 0, 0x551200 }, 0,
- 1,1,1,1,0,0,0,1, PLL_28, -1 },
- { "Pinnacle PCTV Rave",
- 3, 1, 0, 2, 0x03000F, { 2, 3, 1, 1}, { 2, 0, 0, 0, 1},0,
- 1,1,1,1,0,0,0,1, PLL_NONE, -1 },
-
- /* 0x28 */
- { "STB2",
- 3, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 0, 2, 3, 1},0,
- 0,1,1,1,0,1,1,1, PLL_NONE, -1 },
- { "AVerMedia TVPhone 98",
- 3, 4, 0, 2, 4, { 2, 3, 1, 1}, { 13, 14, 11, 7, 0, 0},0,
- 1,1,1,1,0,0,0,1, PLL_28, 5 },
- { "ProVideo PV951", /* pic16c54 */
- 3, 1, 0, 2, 0, { 2, 3, 1, 1}, { 0, 0, 0, 0, 0},0,
- 0,0,0,0,0,0,0,0, PLL_28, 1 },
- { "Little OnAir TV",
- 3, 1, 0, 2, 0xe00b, {2, 3, 1, 1},
- {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},0,
- 0,0,0,0,0,0,0,0, PLL_NONE, -1 },
-
- { "Sigma TVII-FM",
- 2, 1, 0, -1, 3, {2, 3, 1, 1}, {1, 1, 0, 2, 3},0,
- 0,0,0,0,0,0,0,0, PLL_NONE, -1 },
-};
-#define TVCARDS (sizeof(tvcards)/sizeof(struct tvcard))
-
-static void __devinit dump_eeprom(struct bttv *btv,int addr)
-{
- int i;
-
- if (verbose < 2)
- return;
- /* for debugging: dump eeprom to syslog */
- printk(KERN_DEBUG "bttv%d: dump eeprom @ 0x%02x\n",btv->nr,addr);
- for (i = 0; i < 256;) {
- printk(KERN_DEBUG " %02x:",i);
- do {
- printk(" %02x",eeprom_data[i++]);
- } while (i % 16);
- printk("\n");
- }
-}
-
-static int __devinit idcard_eeprom(struct bttv *btv)
-{
- unsigned id;
- int i,n;
-
- id = (eeprom_data[252] << 24) |
- (eeprom_data[253] << 16) |
- (eeprom_data[254] << 8) |
- (eeprom_data[255]);
- if (id == 0 || id == 0xffffffff)
- return -1;
-
- /* look for the card */
- btv->cardid = id;
- for (n = -1, i = 0; cards[i].id != 0; i++)
- if (cards[i].id == id)
- n = i;
-
- if (n != -1) {
- /* found it */
- printk(KERN_INFO "bttv%d: id: %s (0x%08x)\n",
- btv->nr,cards[n].name,id);
- if (verbose)
- printk(KERN_INFO "bttv%d: => card=%d (%s)\n",
- btv->nr,cards[n].cardnr,
- tvcards[cards[n].cardnr].name);
- return cards[n].cardnr;
- } else {
- /* 404 */
- printk(KERN_INFO "bttv%d: id: unknown (0x%08x)\n",
- btv->nr, id);
- printk(KERN_INFO "please mail id, board name and "
- "the correct card= insmod option to "
- "kraxel@goldbach.in-berlin.de\n");
- return -1;
- }
-}
/* ----------------------------------------------------------------------- */
static void audio(struct bttv *btv, int mode, int no_irq_context)
{
- btaor(tvcards[btv->type].gpiomask, ~tvcards[btv->type].gpiomask,
+ btaor(bttv_tvcards[btv->type].gpiomask, ~bttv_tvcards[btv->type].gpiomask,
BT848_GPIO_OUT_EN);
switch (mode)
@@ -1016,10 +291,10 @@ static void audio(struct bttv *btv, int mode, int no_irq_context)
mode=AUDIO_OFF;
if ((mode == AUDIO_TUNER) && (btv->radio))
mode = AUDIO_RADIO;
- btaor(tvcards[btv->type].audiomux[mode],
- ~tvcards[btv->type].gpiomask, BT848_GPIO_DATA);
+ btaor(bttv_tvcards[btv->type].audiomux[mode],
+ ~bttv_tvcards[btv->type].gpiomask, BT848_GPIO_DATA);
if (no_irq_context)
- call_i2c_clients(btv,AUDC_SET_INPUT,&(mode));
+ bttv_call_i2c_clients(btv,AUDC_SET_INPUT,&(mode));
}
@@ -1093,7 +368,7 @@ static int set_pll(struct bttv *btv)
return 1;
}
- if (verbose)
+ if (bttv_verbose)
printk("bttv%d: PLL: %d => %d ... ",btv->nr,
btv->pll.pll_ifreq, btv->pll.pll_ofreq);
@@ -1115,21 +390,21 @@ static int set_pll(struct bttv *btv)
{
btwrite(0x08,BT848_TGCTRL);
btv->pll.pll_current = btv->pll.pll_ofreq;
- if (verbose)
+ if (bttv_verbose)
printk("ok\n");
return 1;
}
mdelay(10);
}
btv->pll.pll_current = 0;
- if (verbose)
+ if (bttv_verbose)
printk("oops\n");
return -1;
}
static void bt848_muxsel(struct bttv *btv, unsigned int input)
{
- btaor(tvcards[btv->type].gpiomask2,~tvcards[btv->type].gpiomask2,
+ btaor(bttv_tvcards[btv->type].gpiomask2,~bttv_tvcards[btv->type].gpiomask2,
BT848_GPIO_OUT_EN);
/* This seems to get rid of some synchronization problems */
@@ -1137,8 +412,8 @@ static void bt848_muxsel(struct bttv *btv, unsigned int input)
mdelay(10);
- input %= tvcards[btv->type].video_inputs;
- if (input==tvcards[btv->type].svhs)
+ input %= bttv_tvcards[btv->type].video_inputs;
+ if (input==bttv_tvcards[btv->type].svhs)
{
btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
@@ -1148,11 +423,11 @@ static void bt848_muxsel(struct bttv *btv, unsigned int input)
btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
}
- btaor((tvcards[btv->type].muxsel[input&7]&3)<<5, ~(3<<5), BT848_IFORM);
- audio(btv, (input!=tvcards[btv->type].tuner) ?
+ btaor((bttv_tvcards[btv->type].muxsel[input&7]&3)<<5, ~(3<<5), BT848_IFORM);
+ audio(btv, (input!=bttv_tvcards[btv->type].tuner) ?
AUDIO_EXTERN : AUDIO_TUNER, 1);
- btaor(tvcards[btv->type].muxsel[input]>>4,
- ~tvcards[btv->type].gpiomask2, BT848_GPIO_DATA);
+ btaor(bttv_tvcards[btv->type].muxsel[input]>>4,
+ ~bttv_tvcards[btv->type].gpiomask2, BT848_GPIO_DATA);
}
@@ -1220,7 +495,7 @@ static void make_vbitab(struct bttv *btv)
unsigned int *po=(unsigned int *) btv->vbi_odd;
unsigned int *pe=(unsigned int *) btv->vbi_even;
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: vbi1: po=%08lx pe=%08lx\n",
btv->nr,virt_to_bus(po), virt_to_bus(pe));
@@ -1242,7 +517,7 @@ static void make_vbitab(struct bttv *btv)
*(pe++)=cpu_to_le32(BT848_RISC_JUMP|BT848_RISC_IRQ|(0x01<<16));
*(pe++)=cpu_to_le32(virt_to_bus(btv->risc_jmp+10));
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: vbi2: po=%08lx pe=%08lx\n",
btv->nr,virt_to_bus(po), virt_to_bus(pe));
}
@@ -1319,7 +594,7 @@ static int make_prisctab(struct bttv *btv, unsigned int *ro,
unsigned long vadr=(unsigned long) vbuf;
int shift, csize;
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: prisc1: ro=%08lx re=%08lx\n",
btv->nr,virt_to_bus(ro), virt_to_bus(re));
@@ -1416,7 +691,7 @@ static int make_prisctab(struct bttv *btv, unsigned int *ro,
*(re++)=cpu_to_le32(BT848_RISC_JUMP|BT848_RISC_IRQ|(2<<16));
*(re++)=cpu_to_le32(btv->bus_vbi_odd);
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: prisc2: ro=%08lx re=%08lx\n",
btv->nr,virt_to_bus(ro), virt_to_bus(re));
@@ -1441,7 +716,7 @@ static int make_vrisctab(struct bttv *btv, unsigned int *ro,
if (palette>=VIDEO_PALETTE_PLANAR)
return make_prisctab(btv, ro, re, vbuf, width, height, palette);
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: vrisc1: ro=%08lx re=%08lx\n",
btv->nr,virt_to_bus(ro), virt_to_bus(re));
@@ -1493,7 +768,7 @@ static int make_vrisctab(struct bttv *btv, unsigned int *ro,
*(re++)=cpu_to_le32(BT848_RISC_JUMP|BT848_RISC_IRQ|(2<<16));
*(re++)=cpu_to_le32(btv->bus_vbi_odd);
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: vrisc2: ro=%08lx re=%08lx\n",
btv->nr,virt_to_bus(ro), virt_to_bus(re));
@@ -1511,7 +786,7 @@ static void clip_draw_rectangle(unsigned char *clipmap, int x, int y, int w, int
int W, l, r;
int i;
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv clip: %dx%d+%d+%d\n",w,h,x,y);
/* bitmap is fixed width, 128 bytes (1024 pixels represented) */
@@ -1576,7 +851,7 @@ static void make_clip_tab(struct bttv *btv, struct video_clip *cr, int ncr)
inter=(btv->win.interlace&1)^1;
width=btv->win.width;
height=btv->win.height;
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: clip1: pal=%d size=%dx%d, bpl=%d bpp=%d\n",
btv->nr,btv->picture.palette,width,height,bpl,bpp);
if(width > 1023)
@@ -1586,11 +861,11 @@ static void make_clip_tab(struct bttv *btv, struct video_clip *cr, int ncr)
ro=btv->risc_scr_odd;
re=btv->risc_scr_even;
- if (debug)
+ if (bttv_debug)
printk("bttv%d: clip: ro=%08lx re=%08lx\n",
btv->nr,virt_to_bus(ro), virt_to_bus(re));
- if ((clipmap=vmalloc_32(VIDEO_CLIPMAP_SIZE))==NULL) {
+ if ((clipmap=vmalloc(VIDEO_CLIPMAP_SIZE))==NULL) {
/* can't clip, don't generate any risc code */
*(ro++)=cpu_to_le32(BT848_RISC_JUMP);
*(ro++)=cpu_to_le32(btv->bus_vbi_even);
@@ -1685,7 +960,7 @@ static void make_clip_tab(struct bttv *btv, struct video_clip *cr, int ncr)
*(re++)=cpu_to_le32(BT848_RISC_JUMP);
*(re++)=cpu_to_le32(btv->bus_vbi_odd);
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: clip2: pal=%d size=%dx%d, bpl=%d bpp=%d\n",
btv->nr,btv->picture.palette,width,height,bpl,bpp);
}
@@ -1856,6 +1131,130 @@ static void bt848_set_winsize(struct bttv *btv)
bt848_set_geo(btv,1);
}
+#ifdef HACKING
+/* playing with kiobufs and dma-to-userspace. 2.4.x only
+ Yes, I know: cut+paste programming is ugly.
+ will fix later, this is proof-of-concept right now. */
+static int make_vrisctab_kiobuf(struct bttv *btv, unsigned int *ro,
+ unsigned int *re, struct kiobuf *iobuf,
+ unsigned short width, unsigned short height,
+ unsigned short palette)
+{
+ unsigned long bpl; /* bytes per line */
+ unsigned long bl;
+ unsigned long todo;
+ unsigned long pageaddr;
+ unsigned int **rp;
+ unsigned long line,inter,offset,page;
+
+ inter = (height>tvnorms[btv->win.norm].sheight/2) ? 1 : 0;
+ bpl=width*fmtbppx2[palette2fmt[palette]&0xf]/2;
+
+ *(ro++)=cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1);
+ *(ro++)=cpu_to_le32(0);
+ *(re++)=cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1);
+ *(re++)=cpu_to_le32(0);
+
+ offset = iobuf->offset;
+ page = 0;
+ pageaddr = virt_to_bus((void*)page_address(iobuf->maplist[page]));
+ for (line=0; line < (height<<(1^inter)); line++)
+ {
+ if (inter)
+ rp= (line&1) ? &re : &ro;
+ else
+ rp= (line>=height) ? &ro : &re;
+
+ bl = PAGE_SIZE - offset;
+ if (bpl <= bl) {
+ *((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|
+ BT848_RISC_EOL|bpl);
+ *((*rp)++)=cpu_to_le32(pageaddr+offset);
+ offset+=bpl;
+ } else {
+ todo = bpl;
+ *((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|bl);
+ *((*rp)++)=cpu_to_le32(pageaddr+offset);
+ todo -= bl;
+ offset = 0;
+ page++;
+ pageaddr = virt_to_bus((void*)page_address(iobuf->maplist[page]));
+ while (todo>PAGE_SIZE)
+ {
+ *((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|PAGE_SIZE);
+ *((*rp)++)=cpu_to_le32(pageaddr);
+ page++;
+ pageaddr = virt_to_bus((void*)page_address(iobuf->maplist[page]));
+ }
+ *((*rp)++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL|todo);
+ *((*rp)++)=cpu_to_le32(pageaddr);
+ offset += todo;
+ }
+ }
+
+ *(ro++)=cpu_to_le32(BT848_RISC_JUMP);
+ *(ro++)=cpu_to_le32(btv->bus_vbi_even);
+ *(re++)=cpu_to_le32(BT848_RISC_JUMP|BT848_RISC_IRQ|(2<<16));
+ *(re++)=cpu_to_le32(btv->bus_vbi_odd);
+
+ return 0;
+}
+
+static int vgrab_kiobuf(struct bttv *btv, struct bttv_just_hacking *mp,
+ struct kiobuf *iobuf)
+{
+ unsigned int *ro, *re;
+ unsigned long flags;
+
+ if(btv->gbuf[0].stat != GBUFFER_UNUSED)
+ return -EBUSY;
+
+ if(mp->height < 32 || mp->width < 32)
+ return -EINVAL;
+ if (mp->format >= 12 /* more is'nt yet ... PALETTEFMT_MAX */)
+ return -EINVAL;
+
+ if(-1 == palette2fmt[mp->format])
+ return -EINVAL;
+
+ /*
+ * Ok load up the BT848
+ */
+
+ ro=btv->gbuf[0].risc;
+ re=ro+2048;
+ make_vrisctab_kiobuf(btv, ro, re, iobuf, mp->width, mp->height, mp->format);
+
+ if (bttv_debug)
+ printk("bttv%d: cap vgrab_kiobuf: queue %d (%d:%dx%d)\n",
+ btv->nr,0,mp->format,mp->width,mp->height);
+ spin_lock_irqsave(&btv->s_lock, flags);
+ btv->gbuf[0].stat = GBUFFER_GRABBING;
+ btv->gbuf[0].fmt = palette2fmt[mp->format];
+ btv->gbuf[0].width = mp->width;
+ btv->gbuf[0].height = mp->height;
+ btv->gbuf[0].ro = virt_to_bus(ro);
+ btv->gbuf[0].re = virt_to_bus(re);
+
+#if 1
+ if (mp->height <= tvnorms[btv->win.norm].sheight/2 &&
+ mp->format != VIDEO_PALETTE_RAW)
+ btv->gbuf[0].ro = 0;
+#endif
+
+ if (-1 == btv->gq_grab && btv->gq_in == btv->gq_out) {
+ btv->gq_start = 1;
+ btv->risc_jmp[12]=cpu_to_le32(BT848_RISC_JUMP|(0x8<<16)|BT848_RISC_IRQ);
+ }
+ btv->gqueue[btv->gq_in++] = 0;
+ btv->gq_in = btv->gq_in % MAX_GBUFFERS;
+
+ btor(3, BT848_CAP_CTL);
+ btor(3, BT848_GPIO_DMA_CTL);
+ spin_unlock_irqrestore(&btv->s_lock, flags);
+ return 0;
+}
+#endif
/*
* Grab into virtual memory.
@@ -1898,7 +1297,7 @@ static int vgrab(struct bttv *btv, struct video_mmap *mp)
re=ro+2048;
make_vrisctab(btv, ro, re, vbuf, mp->width, mp->height, mp->format);
- if (debug)
+ if (bttv_debug)
printk("bttv%d: cap vgrab: queue %d (%d:%dx%d)\n",
btv->nr,mp->frame,mp->format,mp->width,mp->height);
spin_lock_irqsave(&btv->s_lock, flags);
@@ -1928,7 +1327,6 @@ static int vgrab(struct bttv *btv, struct video_mmap *mp)
return 0;
}
-
static long bttv_write(struct video_device *v, const char *buf, unsigned long count, int nonblock)
{
return -EINVAL;
@@ -1997,7 +1395,7 @@ static void bt848_restart(struct bttv *btv)
{
unsigned long irq_flags;
- if (verbose)
+ if (bttv_verbose)
printk("bttv%d: resetting chip\n",btv->nr);
btwrite(0xfffffUL, BT848_INT_STAT);
btand(~15, BT848_GPIO_DMA_CTL);
@@ -2009,9 +1407,9 @@ static void bt848_restart(struct bttv *btv)
btv->pll.pll_current = 0;
set_pll(btv);
+ spin_lock_irqsave(&btv->s_lock, irq_flags);
btv->errors = 0;
btv->needs_restart = 0;
- spin_lock_irqsave(&btv->s_lock, irq_flags);
bt848_set_geo(btv,0);
bt848_set_risc_jmps(btv,-1);
spin_unlock_irqrestore(&btv->s_lock, irq_flags);
@@ -2020,7 +1418,7 @@ static void bt848_restart(struct bttv *btv)
/*
* Open a bttv card. Right now the flags stuff is just playing
*/
-
+
static int bttv_open(struct video_device *dev, int flags)
{
struct bttv *btv = (struct bttv *)dev;
@@ -2158,7 +1556,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
unsigned long irq_flags;
int i,ret = 0;
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: ioctl 0x%x\n",btv->nr,cmd);
switch (cmd) {
@@ -2167,13 +1565,13 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
struct video_capability b;
strcpy(b.name,btv->video_dev.name);
b.type = VID_TYPE_CAPTURE|
- ((tvcards[btv->type].tuner != -1) ? VID_TYPE_TUNER : 0) |
+ ((bttv_tvcards[btv->type].tuner != -1) ? VID_TYPE_TUNER : 0) |
VID_TYPE_OVERLAY|
VID_TYPE_CLIPPING|
VID_TYPE_FRAMERAM|
VID_TYPE_SCALES;
- b.channels = tvcards[btv->type].video_inputs;
- b.audios = tvcards[btv->type].audio_inputs;
+ b.channels = bttv_tvcards[btv->type].video_inputs;
+ b.audios = bttv_tvcards[btv->type].audio_inputs;
b.maxwidth = tvnorms[btv->win.norm].swidth;
b.maxheight = tvnorms[btv->win.norm].sheight;
b.minwidth = 32;
@@ -2191,16 +1589,16 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
v.tuners=0;
v.type=VIDEO_TYPE_CAMERA;
v.norm = btv->win.norm;
- if (v.channel>=tvcards[btv->type].video_inputs)
+ if (v.channel>=bttv_tvcards[btv->type].video_inputs)
return -EINVAL;
- if(v.channel==tvcards[btv->type].tuner)
+ if(v.channel==bttv_tvcards[btv->type].tuner)
{
strcpy(v.name,"Television");
v.flags|=VIDEO_VC_TUNER;
v.type=VIDEO_TYPE_TV;
v.tuners=1;
}
- else if(v.channel==tvcards[btv->type].svhs)
+ else if(v.channel==bttv_tvcards[btv->type].svhs)
strcpy(v.name,"S-Video");
else
sprintf(v.name,"Composite%d",v.channel);
@@ -2218,12 +1616,12 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
if(copy_from_user(&v, arg,sizeof(v)))
return -EFAULT;
- if (v.channel>tvcards[btv->type].video_inputs)
+ if (v.channel>bttv_tvcards[btv->type].video_inputs)
return -EINVAL;
if (v.norm > (sizeof(tvnorms)/sizeof(*tvnorms)))
return -EOPNOTSUPP;
- call_i2c_clients(btv,cmd,&v);
+ bttv_call_i2c_clients(btv,cmd,&v);
down(&btv->lock);
bt848_muxsel(btv, v.channel);
btv->channel=v.channel;
@@ -2250,7 +1648,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
v.flags=VIDEO_TUNER_PAL|VIDEO_TUNER_NTSC|VIDEO_TUNER_SECAM;
v.mode = btv->win.norm;
v.signal = (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) ? 0xFFFF : 0;
- call_i2c_clients(btv,cmd,&v);
+ bttv_call_i2c_clients(btv,cmd,&v);
if(copy_to_user(arg,&v,sizeof(v)))
return -EFAULT;
return 0;
@@ -2262,13 +1660,13 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
if(copy_from_user(&v, arg, sizeof(v)))
return -EFAULT;
/* Only one channel has a tuner */
- if(v.tuner!=tvcards[btv->type].tuner)
+ if(v.tuner!=bttv_tvcards[btv->type].tuner)
return -EINVAL;
if(v.mode!=VIDEO_MODE_PAL&&v.mode!=VIDEO_MODE_NTSC
&&v.mode!=VIDEO_MODE_SECAM)
return -EOPNOTSUPP;
- call_i2c_clients(btv,cmd,&v);
+ bttv_call_i2c_clients(btv,cmd,&v);
if (btv->win.norm != v.mode) {
btv->win.norm = v.mode;
down(&btv->lock);
@@ -2451,10 +1849,12 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
case 32: btv->picture.palette = VIDEO_PALETTE_RGB32; break;
}
- if (debug)
+ if (bttv_debug)
printk("Display at %p is %d by %d, bytedepth %d, bpl %d\n",
v.base, v.width,v.height, btv->win.bpp, btv->win.bpl);
+ spin_lock_irqsave(&btv->s_lock, irq_flags);
bt848_set_winsize(btv);
+ spin_unlock_irqrestore(&btv->s_lock, irq_flags);
up(&btv->lock);
return 0;
}
@@ -2476,7 +1876,11 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
if(copy_from_user(&v, arg, sizeof(v)))
return -EFAULT;
btv->win.freq=v;
- call_i2c_clients(btv,cmd,&v);
+ bttv_call_i2c_clients(btv,cmd,&v);
+#if 0
+ if (btv->type == BTTV_MIROPRO && btv->radio)
+ tea5757_set_freq(btv,v);
+#endif
return 0;
}
@@ -2490,14 +1894,14 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
strcpy(v.name,"TV");
v.mode = VIDEO_SOUND_MONO;
- call_i2c_clients(btv,cmd,&v);
+ bttv_call_i2c_clients(btv,cmd,&v);
if (btv->type == BTTV_TERRATV) {
- v.mode = VIDEO_SOUND_MONO;
- v.mode |= VIDEO_SOUND_STEREO;
- v.mode |= VIDEO_SOUND_LANG1|VIDEO_SOUND_LANG2;
-
- } else if (btv->audio_chip == TDA9840) {
+ v.mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
+ VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
+ }
+#ifndef HAVE_TVAUDIO
+ else if (btv->audio_chip == TDA9840) {
/* begin of Horrible Hack <grin@tolna.net> */
v.flags|=VIDEO_AUDIO_VOLUME;
v.mode = VIDEO_SOUND_MONO;
@@ -2506,6 +1910,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
v.volume = 32768; /* fixme */
v.step = 4096;
}
+#endif
if(copy_to_user(arg,&v,sizeof(v)))
return -EFAULT;
@@ -2521,7 +1926,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
if(v.flags&VIDEO_AUDIO_MUTE)
audio(btv, AUDIO_MUTE, 1);
/* One audio source per tuner -- huh? <GA> */
- if(v.audio<0 || v.audio >= tvcards[btv->type].audio_inputs) {
+ if(v.audio<0 || v.audio >= bttv_tvcards[btv->type].audio_inputs) {
up(&btv->lock);
return -EINVAL;
}
@@ -2529,7 +1934,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
if(!(v.flags&VIDEO_AUDIO_MUTE))
audio(btv, AUDIO_UNMUTE, 1);
- call_i2c_clients(btv,cmd,&v);
+ bttv_call_i2c_clients(btv,cmd,&v);
if (btv->type == BTTV_TERRATV) {
unsigned int con = 0;
@@ -2540,40 +1945,8 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
con = 0x180000;
btaor(con, ~0x180000, BT848_GPIO_DATA);
- } else if (btv->type == BTTV_WINVIEW_601) {
- /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
- int bits_out, loops, vol, data;
-
- /* 32 levels logarithmic */
- vol = 32 - ((v.volume>>11));
- /* units */
- bits_out = (PT2254_DBS_IN_2>>(vol%5));
- /* tens */
- bits_out |= (PT2254_DBS_IN_10>>(vol/5));
- bits_out |= PT2254_L_CHANEL | PT2254_R_CHANEL;
- data = btread(BT848_GPIO_DATA);
- data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
- WINVIEW_PT2254_STROBE);
- for (loops = 17; loops >= 0 ; loops--) {
- if (bits_out & (1<<loops))
- data |= WINVIEW_PT2254_DATA;
- else
- data &= ~WINVIEW_PT2254_DATA;
- btwrite(data, BT848_GPIO_DATA);
- udelay(5);
- data |= WINVIEW_PT2254_CLK;
- btwrite(data, BT848_GPIO_DATA);
- udelay(5);
- data &= ~WINVIEW_PT2254_CLK;
- btwrite(data, BT848_GPIO_DATA);
- }
- data |= WINVIEW_PT2254_STROBE;
- data &= ~WINVIEW_PT2254_DATA;
- btwrite(data, BT848_GPIO_DATA);
- udelay(10);
- data &= ~WINVIEW_PT2254_STROBE;
- btwrite(data, BT848_GPIO_DATA);
- }
+ } else if (btv->type == BTTV_WINVIEW_601)
+ winview_setvol(btv,&v);
btv->audio_dev=v;
up(&btv->lock);
@@ -2596,7 +1969,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
add_wait_queue(&btv->capq, &wait);
current->state = TASK_INTERRUPTIBLE;
while(btv->gbuf[i].stat==GBUFFER_GRABBING) {
- if (debug)
+ if (bttv_debug)
printk("bttv%d: cap sync: sleep on %d\n",btv->nr,i);
schedule();
if(signal_pending(current)) {
@@ -2611,7 +1984,7 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
case GBUFFER_DONE:
case GBUFFER_ERROR:
ret = (btv->gbuf[i].stat == GBUFFER_ERROR) ? -EIO : 0;
- if (debug)
+ if (bttv_debug)
printk("bttv%d: cap sync: buffer %d, retval %d\n",btv->nr,i,ret);
btv->gbuf[i].stat = GBUFFER_UNUSED;
}
@@ -2706,7 +2079,80 @@ static int bttv_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
/* return picture;*/
return 0;
}
-
+
+#ifdef HACKING
+ /* playing with kiobufs and dma-to-userspace */
+ case BTTV_JUST_HACKING:
+ {
+ DECLARE_WAITQUEUE(wait, current);
+ struct bttv_just_hacking hack;
+ struct kiobuf *iobuf;
+ int err;
+
+ if(copy_from_user((void *) &hack, (void *) arg, sizeof(hack)))
+ return -EFAULT;
+ printk("bttv%d: hack: userland args: %dx%d, fmt=%d, buf=%lx, len=%d\n",
+ btv->nr,hack.width,hack.height,hack.format,
+ hack.buf,hack.len);
+
+ /* pin down */
+ err = alloc_kiovec(1,&iobuf);
+ if (err)
+ goto hack_oops;
+ err = map_user_kiobuf(READ, iobuf, hack.buf, hack.len);
+ if (err)
+ goto hack_oops;
+ err = lock_kiovec(1,&iobuf,1);
+ if (err)
+ goto hack_oops;
+
+ /* have a look */
+ printk("bttv%d: hack: kiobuf: nr_pages=%d, offset=%d, length=%d, locked=%d\n",
+ btv->nr,iobuf->nr_pages,iobuf->offset,iobuf->length,
+ iobuf->locked);
+ printk("bttv%d: hack: pages (bus addr):",btv->nr);
+ for (i = 0; i < iobuf->nr_pages; i++) {
+ printk(" %lx", virt_to_bus((void*)page_address(iobuf->maplist[i])));
+ }
+ printk("\n");
+
+ /* start capture */
+ err = -EINVAL;
+ if (hack.height * hack.width * 2 * /* fixme: *2 */
+ fmtbppx2[palette2fmt[hack.format]&0x0f]/2 > hack.len)
+ goto hack_oops;
+ err = vgrab_kiobuf(btv,&hack,iobuf);
+ if (err)
+ goto hack_oops;
+ printk("bttv%d: hack: capture started\n",btv->nr);
+
+ /* wait */
+ add_wait_queue(&btv->capq, &wait);
+ current->state = TASK_INTERRUPTIBLE;
+ while(btv->gbuf[0].stat==GBUFFER_GRABBING) {
+ if (bttv_debug)
+ printk("bttv%d: hack: cap sync: sleep on %d\n",btv->nr,0);
+ schedule();
+#if 0
+ if(signal_pending(current)) {
+ remove_wait_queue(&btv->capq, &wait);
+ current->state = TASK_RUNNING;
+ return -EINTR;
+ }
+#endif
+ }
+ remove_wait_queue(&btv->capq, &wait);
+ current->state = TASK_RUNNING;
+ printk("bttv%d: hack: capture done\n",btv->nr);
+
+ /* release */
+ err = 0;
+ hack_oops:
+ free_kiovec(1,&iobuf);
+ return 0;
+ }
+#endif
+
default:
return -ENOIOCTLCMD;
}
@@ -2891,7 +2337,7 @@ static int vbi_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
{
struct video_capability b;
strcpy(b.name,btv->vbi_dev.name);
- b.type = ((tvcards[btv->type].tuner != -1) ? VID_TYPE_TUNER : 0) |
+ b.type = ((bttv_tvcards[btv->type].tuner != -1) ? VID_TYPE_TUNER : 0) |
VID_TYPE_TELETEXT;
b.channels = 0;
b.audios = 0;
@@ -2946,8 +2392,8 @@ static int radio_open(struct video_device *dev, int flags)
btv->radio = 1;
v = 400*16;
- call_i2c_clients(btv,VIDIOCSFREQ,&v);
- call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
+ bttv_call_i2c_clients(btv,VIDIOCSFREQ,&v);
+ bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
bt848_muxsel(btv,0);
up(&btv->lock);
@@ -3092,181 +2538,6 @@ static void __devinit handle_chipset(void)
}
-/* can tda9855.c handle this too maybe? */
-static void __devinit init_tda9840(struct bttv *btv)
-{
- /* Horrible Hack */
- I2CWrite(btv, I2C_TDA9840, TDA9840_SW, 0x2a, 1); /* sound mode switching */
- /* 00 - mute
- 10 - mono / averaged stereo
- 2a - stereo
- 12 - dual A
- 1a - dual AB
- 16 - dual BA
- 1e - dual B
- 7a - external */
-}
-
-/* Figure out card and tuner type */
-
-static void __devinit idcard(struct bttv *btv)
-{
- int type,eeprom = 0;
-
- btwrite(0, BT848_GPIO_OUT_EN);
-
- /* Default the card to the user-selected one. */
- if (card[btv->nr] >= 0 && card[btv->nr] < TVCARDS)
- btv->type=card[btv->nr];
-
- /* If we were asked to auto-detect, then do so! */
- if (btv->type == BTTV_UNKNOWN) {
-
- /* many bt878 cards have a eeprom @ 0xa0 => read ID
- and try to identify it */
- if (I2CRead(btv, I2C_HAUPEE, "eeprom") >= 0) {
- eeprom = 0xa0;
- readee(btv,eeprom_data,0xa0);
- dump_eeprom(btv,0xa0); /* DEBUG */
- type = idcard_eeprom(btv);
- if (-1 != type) {
- btv->type = type;
- } else if (btv->id <= 849) {
- /* for unknown bt848, assume old Hauppauge */
- btv->type=BTTV_HAUPPAUGE;
- }
-
- /* STB cards have a eeprom @ 0xae (old bt848) */
- } else if (I2CRead(btv, I2C_STBEE, "eeprom")>=0) {
- btv->type=BTTV_STB;
- }
-
-#if 0
- /* check for msp34xx */
- if (I2CRead(btv, 0x80, "msp3400")>=0)
- btv->type = BTTV_MIROPRO;
- else
- btv->type = BTTV_MIRO;
-#endif
- }
-
- /* print which board we have found */
- sprintf(btv->video_dev.name,"BT%d%s(%.22s)",
- btv->id,
- (btv->id==848 && btv->revision==0x12) ? "A" : "",
- tvcards[btv->type].name);
- printk(KERN_INFO "bttv%d: model: %s\n",btv->nr,btv->video_dev.name);
-
- /* board specific initialisations */
- if (btv->type == BTTV_MIRO || btv->type == BTTV_MIROPRO) {
- /* auto detect tuner for MIRO cards */
- btv->tuner_type=((btread(BT848_GPIO_DATA)>>10)-1)&7;
- }
- if (btv->type == BTTV_HAUPPAUGE || btv->type == BTTV_HAUPPAUGE878) {
- /* pick up some config infos from the eeprom */
- if (0xa0 != eeprom) {
- eeprom = 0xa0;
- readee(btv,eeprom_data,0xa0);
- }
- hauppauge_eeprom(btv);
- hauppauge_boot_msp34xx(btv);
- }
- if (btv->type == BTTV_PXC200)
- init_PXC200(btv);
-
-
- /* pll configuration */
- if (!(btv->id==848 && btv->revision==0x11)) {
- /* defaults from card list */
- if (PLL_28 == tvcards[btv->type].pll) {
- btv->pll.pll_ifreq=28636363;
- btv->pll.pll_crystal=BT848_IFORM_XT0;
- }
- /* insmod options can override */
- switch (pll[btv->nr]) {
- case 0: /* none */
- btv->pll.pll_crystal = 0;
- btv->pll.pll_ifreq = 0;
- btv->pll.pll_ofreq = 0;
- break;
- case 1: /* 28 MHz */
- btv->pll.pll_ifreq = 28636363;
- btv->pll.pll_ofreq = 0;
- btv->pll.pll_crystal=BT848_IFORM_XT0;
- break;
- case 2: /* 35 MHz */
- btv->pll.pll_ifreq = 35468950;
- btv->pll.pll_ofreq = 0;
- btv->pll.pll_crystal=BT848_IFORM_XT1;
- break;
- }
- }
-
-
- /* tuner configuration */
- if (-1 != tvcards[btv->type].tuner_type)
- btv->tuner_type = tvcards[btv->type].tuner_type;
- if (btv->tuner_type != -1)
- call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
-
- /* try to detect audio/fader chips */
- if (tvcards[btv->type].msp34xx &&
- I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) {
- if (autoload)
- request_module("msp3400");
- }
-
- if (tvcards[btv->type].tda8425 &&
- I2CRead(btv, I2C_TDA8425, "TDA8425") >=0) {
- if (autoload)
- request_module("tda8425");
- }
-
- if (tvcards[btv->type].tda9840 &&
- I2CRead(btv, I2C_TDA9840, "TDA9840") >=0) {
- init_tda9840(btv);
- btv->audio_chip = TDA9840;
- /* move this to a module too? */
- init_tda9840(btv);
- }
-
- if (tvcards[btv->type].tda985x &&
- I2CRead(btv, I2C_TDA9850, "TDA985x") >=0) {
- if (autoload)
- request_module("tda985x");
- }
-
- if (tvcards[btv->type].tda9875 &&
- I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) {
- if (autoload)
- request_module("tda9875");
- }
-
- if (tvcards[btv->type].tda7432 &&
- I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) {
- if (autoload)
- request_module("tda7432");
- }
-
- if (tvcards[btv->type].tea63xx) {
- if (autoload)
- request_module("tea6300");
- }
-
- if (tvcards[btv->type].tea64xx) {
- if (autoload)
- request_module("tea6420");
- }
-
- if (tvcards[btv->type].tuner != -1) {
- if (autoload)
- request_module("tuner");
- }
-
- audio(btv, AUDIO_MUTE, 1);
-}
-
-
static void bt848_set_risc_jmps(struct bttv *btv, int flags)
{
if (-1 == flags) {
@@ -3278,7 +2549,7 @@ static void bt848_set_risc_jmps(struct bttv *btv, int flags)
flags |= 0x0c;
}
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: set_risc_jmp %08lx:",
btv->nr,virt_to_bus(btv->risc_jmp));
@@ -3290,11 +2561,11 @@ static void bt848_set_risc_jmps(struct bttv *btv, int flags)
/* Jump to odd vbi sub */
btv->risc_jmp[2]=cpu_to_le32(BT848_RISC_JUMP|(0xd<<20));
if (flags&8) {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" ev=%08lx",virt_to_bus(btv->vbi_odd));
btv->risc_jmp[3]=cpu_to_le32(virt_to_bus(btv->vbi_odd));
} else {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" -----------");
btv->risc_jmp[3]=cpu_to_le32(virt_to_bus(btv->risc_jmp+4));
}
@@ -3302,16 +2573,16 @@ static void bt848_set_risc_jmps(struct bttv *btv, int flags)
/* Jump to odd sub */
btv->risc_jmp[4]=cpu_to_le32(BT848_RISC_JUMP|(0xe<<20));
if (0 != btv->risc_cap_odd) {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" e%d=%08x",btv->gq_grab,btv->risc_cap_odd);
flags |= 3;
btv->risc_jmp[5]=cpu_to_le32(btv->risc_cap_odd);
} else if (flags&2) {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" eo=%08lx",virt_to_bus(btv->risc_scr_odd));
btv->risc_jmp[5]=cpu_to_le32(virt_to_bus(btv->risc_scr_odd));
} else {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" -----------");
btv->risc_jmp[5]=cpu_to_le32(virt_to_bus(btv->risc_jmp+6));
}
@@ -3325,11 +2596,11 @@ static void bt848_set_risc_jmps(struct bttv *btv, int flags)
/* Jump to even vbi sub */
btv->risc_jmp[8]=cpu_to_le32(BT848_RISC_JUMP);
if (flags&4) {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" ov=%08lx",virt_to_bus(btv->vbi_even));
btv->risc_jmp[9]=cpu_to_le32(virt_to_bus(btv->vbi_even));
} else {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" -----------");
btv->risc_jmp[9]=cpu_to_le32(virt_to_bus(btv->risc_jmp+10));
}
@@ -3337,16 +2608,16 @@ static void bt848_set_risc_jmps(struct bttv *btv, int flags)
/* Jump to even sub */
btv->risc_jmp[10]=cpu_to_le32(BT848_RISC_JUMP|(8<<20));
if (0 != btv->risc_cap_even) {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" o%d=%08x",btv->gq_grab,btv->risc_cap_even);
flags |= 3;
btv->risc_jmp[11]=cpu_to_le32(btv->risc_cap_even);
} else if (flags&1) {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" oo=%08lx",virt_to_bus(btv->risc_scr_even));
btv->risc_jmp[11]=cpu_to_le32(virt_to_bus(btv->risc_scr_even));
} else {
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" -----------");
btv->risc_jmp[11]=cpu_to_le32(virt_to_bus(btv->risc_jmp+12));
}
@@ -3359,7 +2630,7 @@ static void bt848_set_risc_jmps(struct bttv *btv, int flags)
btv->risc_jmp[13]=cpu_to_le32(virt_to_bus(btv->risc_jmp));
/* enable cpaturing and DMA */
- if (debug > 1)
+ if (bttv_debug > 1)
printk(" flags=0x%x dma=%s\n",
flags,(flags&0x0f) ? "on" : "off");
btaor(flags, ~0x0f, BT848_CAP_CTL);
@@ -3375,7 +2646,8 @@ static int __devinit init_video_dev(struct bttv *btv)
memcpy(&btv->vbi_dev,&vbi_template, sizeof(vbi_template));
memcpy(&btv->radio_dev,&radio_template,sizeof(radio_template));
- idcard(btv);
+ bttv_idcard(btv);
+ audio(btv, AUDIO_MUTE, 1);
if(video_register_device(&btv->video_dev,VFL_TYPE_GRABBER)<0)
return -1;
@@ -3406,7 +2678,7 @@ static int __devinit init_bt848(struct bttv *btv)
/* dump current state of the gpio registers before changing them,
* might help to make a new card work */
- if (verbose >= 2)
+ if (bttv_verbose >= 2)
printk("bttv%d: gpio: out_enable=0x%x, data=0x%x, in=0x%x\n",
btv->nr,
btread(BT848_GPIO_OUT_EN),
@@ -3554,7 +2826,6 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
u32 dstat;
int count,i;
struct bttv *btv;
- unsigned long irq_flags;
btv=(struct bttv *)dev_id;
count=0;
@@ -3593,7 +2864,7 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
btv->field++;
}
if (astat&(BT848_INT_SCERR|BT848_INT_OCERR)) {
- if (verbose)
+ if (bttv_verbose)
printk("bttv%d: irq:%s%s risc_count=%08x\n",
btv->nr,
(astat&BT848_INT_SCERR) ? " SCERR" : "",
@@ -3601,18 +2872,18 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
btread(BT848_RISC_COUNT));
btv->errors++;
if (btv->errors < BTTV_ERRORS) {
- spin_lock_irqsave(&btv->s_lock, irq_flags);
+ spin_lock(&btv->s_lock);
btand(~15, BT848_GPIO_DMA_CTL);
btwrite(virt_to_bus(btv->risc_jmp+2),
BT848_RISC_STRT_ADD);
bt848_set_geo(btv,0);
bt848_set_risc_jmps(btv,-1);
- spin_unlock_irqrestore(&btv->s_lock, irq_flags);
+ spin_unlock(&btv->s_lock);
} else {
- if (verbose)
+ if (bttv_verbose)
printk("bttv%d: aiee: error loops\n",btv->nr);
/* cancel all outstanding grab requests */
- spin_lock_irqsave(&btv->s_lock, irq_flags);
+ spin_lock(&btv->s_lock);
btv->gq_in = 0;
btv->gq_out = 0;
btv->gq_grab = -1;
@@ -3624,7 +2895,7 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
btv->risc_cap_even = 0;
bt848_set_risc_jmps(btv,0);
btv->needs_restart = 1;
- spin_unlock_irqrestore(&btv->s_lock, irq_flags);
+ spin_unlock(&btv->s_lock);
wake_up_interruptible(&btv->vbiq);
wake_up_interruptible(&btv->capq);
@@ -3632,7 +2903,7 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
}
if (astat&BT848_INT_RISCI)
{
- if (debug > 1)
+ if (bttv_debug > 1)
printk("bttv%d: IRQ_RISCI\n",btv->nr);
/* captured VBI frame */
@@ -3648,17 +2919,17 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
if (stat&(2<<28) && btv->gq_grab != -1)
{
btv->last_field=btv->field;
- if (debug)
+ if (bttv_debug)
printk("bttv%d: cap irq: done %d\n",btv->nr,btv->gq_grab);
do_gettimeofday(&btv->gbuf[btv->gq_grab].tv);
- spin_lock_irqsave(&btv->s_lock, irq_flags);
+ spin_lock(&btv->s_lock);
btv->gbuf[btv->gq_grab].stat = GBUFFER_DONE;
btv->gq_grab = -1;
if (btv->gq_in != btv->gq_out)
{
btv->gq_grab = btv->gqueue[btv->gq_out++];
btv->gq_out = btv->gq_out % MAX_GBUFFERS;
- if (debug)
+ if (bttv_debug)
printk("bttv%d: cap irq: capture %d\n",btv->nr,btv->gq_grab);
btv->risc_cap_odd = btv->gbuf[btv->gq_grab].ro;
btv->risc_cap_even = btv->gbuf[btv->gq_grab].re;
@@ -3674,17 +2945,17 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
btwrite(btv->fb_color_ctl | BT848_COLOR_CTL_GAMMA,
BT848_COLOR_CTL);
}
- spin_unlock_irqrestore(&btv->s_lock, irq_flags);
+ spin_unlock(&btv->s_lock);
wake_up_interruptible(&btv->capq);
break;
}
if (stat&(8<<28))
{
- spin_lock_irqsave(&btv->s_lock, irq_flags);
+ spin_lock(&btv->s_lock);
btv->gq_start = 0;
btv->gq_grab = btv->gqueue[btv->gq_out++];
btv->gq_out = btv->gq_out % MAX_GBUFFERS;
- if (debug)
+ if (bttv_debug)
printk("bttv%d: cap irq: capture %d [start]\n",btv->nr,btv->gq_grab);
btv->risc_cap_odd = btv->gbuf[btv->gq_grab].ro;
btv->risc_cap_even = btv->gbuf[btv->gq_grab].re;
@@ -3692,7 +2963,7 @@ static void bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
bt848_set_geo(btv,0);
btwrite(BT848_COLOR_CTL_GAMMA,
BT848_COLOR_CTL);
- spin_unlock_irqrestore(&btv->s_lock, irq_flags);
+ spin_unlock(&btv->s_lock);
}
}
if (astat&BT848_INT_OCERR)
@@ -3761,7 +3032,8 @@ static void __devinit bttv_remove(struct pci_dev *pci_dev)
struct bttv *btv = PCI_GET_DRIVER_DATA(pci_dev);
/* unregister i2c_bus */
- i2c_bit_del_bus(&btv->i2c_adap);
+ if (btv->i2c_ok)
+ i2c_bit_del_bus(&btv->i2c_adap);
/* turn off all capturing, DMA and IRQs */
btand(~15, BT848_GPIO_DMA_CTL);
@@ -3973,7 +3245,7 @@ int bttv_init_module(void)
gbuffers = 2;
if (gbufsize < 0 || gbufsize > BTTV_MAX_FBUF)
gbufsize = BTTV_MAX_FBUF;
- if (verbose)
+ if (bttv_verbose)
printk(KERN_INFO "bttv: using %d buffers with %dk (%dk total) for capture\n",
gbuffers,gbufsize/1024,gbuffers*gbufsize/1024);
diff --git a/drivers/char/bttv-if.c b/drivers/char/bttv-if.c
new file mode 100644
index 000000000..a58e441db
--- /dev/null
+++ b/drivers/char/bttv-if.c
@@ -0,0 +1,337 @@
+/*
+ bttv-if.c -- interfaces to other kernel modules
+ all the i2c code is here
+ also the gpio interface exported by bttv (used by lirc)
+
+
+ bttv - Bt848 frame grabber driver
+
+ Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
+ & Marcus Metzler (mocm@thp.uni-koeln.de)
+ (c) 1999,2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#define __NO_VERSION__ 1
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+
+#include "bttv.h"
+#include "tuner.h"
+
+
+EXPORT_SYMBOL(bttv_get_cardinfo);
+EXPORT_SYMBOL(bttv_get_id);
+EXPORT_SYMBOL(bttv_gpio_enable);
+EXPORT_SYMBOL(bttv_read_gpio);
+EXPORT_SYMBOL(bttv_write_gpio);
+EXPORT_SYMBOL(bttv_get_gpio_queue);
+
+/* ----------------------------------------------------------------------- */
+/* Exported functions - for other modules which want to access the */
+/* gpio ports (IR for example) */
+/* see bttv.h for comments */
+
+int bttv_get_cardinfo(unsigned int card, int *type, int *cardid)
+{
+ if (card >= bttv_num) {
+ return -1;
+ }
+ *type = bttvs[card].type;
+ *cardid = bttvs[card].cardid;
+ return 0;
+}
+
+int bttv_get_id(unsigned int card)
+{
+ printk("bttv_get_id is obsolete, use bttv_get_cardinfo instead\n");
+ if (card >= bttv_num) {
+ return -1;
+ }
+ return bttvs[card].type;
+}
+
+int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
+{
+ struct bttv *btv;
+
+ if (card >= bttv_num) {
+ return -EINVAL;
+ }
+
+ btv = &bttvs[card];
+ btaor(data, ~mask, BT848_GPIO_OUT_EN);
+ return 0;
+}
+
+int bttv_read_gpio(unsigned int card, unsigned long *data)
+{
+ struct bttv *btv;
+
+ if (card >= bttv_num) {
+ return -EINVAL;
+ }
+
+ btv = &bttvs[card];
+
+ if(btv->shutdown) {
+ return -ENODEV;
+ }
+
+/* prior setting BT848_GPIO_REG_INP is (probably) not needed
+ because we set direct input on init */
+ *data = btread(BT848_GPIO_DATA);
+ return 0;
+}
+
+int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
+{
+ struct bttv *btv;
+
+ if (card >= bttv_num) {
+ return -EINVAL;
+ }
+
+ btv = &bttvs[card];
+
+/* prior setting BT848_GPIO_REG_INP is (probably) not needed
+ because direct input is set on init */
+ btaor(data & mask, ~mask, BT848_GPIO_DATA);
+ return 0;
+}
+
+wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
+{
+ struct bttv *btv;
+
+ if (card >= bttv_num) {
+ return NULL;
+ }
+
+ btv = &bttvs[card];
+ if (bttvs[card].shutdown) {
+ return NULL;
+ }
+ return &btv->gpioq;
+}
+
+
+/* ----------------------------------------------------------------------- */
+/* I2C functions */
+
+void bttv_bit_setscl(void *data, int state)
+{
+ struct bttv *btv = (struct bttv*)data;
+
+ if (state)
+ btv->i2c_state |= 0x02;
+ else
+ btv->i2c_state &= ~0x02;
+ btwrite(btv->i2c_state, BT848_I2C);
+ btread(BT848_I2C);
+}
+
+void bttv_bit_setsda(void *data, int state)
+{
+ struct bttv *btv = (struct bttv*)data;
+
+ if (state)
+ btv->i2c_state |= 0x01;
+ else
+ btv->i2c_state &= ~0x01;
+ btwrite(btv->i2c_state, BT848_I2C);
+ btread(BT848_I2C);
+}
+
+static int bttv_bit_getscl(void *data)
+{
+ struct bttv *btv = (struct bttv*)data;
+ int state;
+
+ state = btread(BT848_I2C) & 0x02 ? 1 : 0;
+ return state;
+}
+
+static int bttv_bit_getsda(void *data)
+{
+ struct bttv *btv = (struct bttv*)data;
+ int state;
+
+ state = btread(BT848_I2C) & 0x01;
+ return state;
+}
+
+static void bttv_inc_use(struct i2c_adapter *adap)
+{
+ MOD_INC_USE_COUNT;
+}
+
+static void bttv_dec_use(struct i2c_adapter *adap)
+{
+ MOD_DEC_USE_COUNT;
+}
+
+static int attach_inform(struct i2c_client *client)
+{
+ struct bttv *btv = (struct bttv*)client->adapter->data;
+ int i;
+
+ for (i = 0; i < I2C_CLIENTS_MAX; i++) {
+ if (btv->i2c_clients[i] == NULL ||
+ btv->i2c_clients[i]->driver->id == client->driver->id) {
+ btv->i2c_clients[i] = client;
+ break;
+ }
+ }
+ if (btv->tuner_type != -1)
+ bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
+ if (bttv_verbose)
+ printk("bttv%d: i2c attach [%s]\n",btv->nr,client->name);
+ return 0;
+}
+
+static int detach_inform(struct i2c_client *client)
+{
+ struct bttv *btv = (struct bttv*)client->adapter->data;
+ int i;
+
+ if (bttv_verbose)
+ printk("bttv%d: i2c detach [%s]\n",btv->nr,client->name);
+ for (i = 0; i < I2C_CLIENTS_MAX; i++) {
+ if (NULL != btv->i2c_clients[i] &&
+ btv->i2c_clients[i]->driver->id == client->driver->id) {
+ btv->i2c_clients[i] = NULL;
+ break;
+ }
+ }
+ return 0;
+}
+
+void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg)
+{
+ int i;
+
+ for (i = 0; i < I2C_CLIENTS_MAX; i++) {
+ if (NULL == btv->i2c_clients[i])
+ continue;
+ if (NULL == btv->i2c_clients[i]->driver->command)
+ continue;
+ btv->i2c_clients[i]->driver->command(
+ btv->i2c_clients[i],cmd,arg);
+ }
+}
+
+struct i2c_algo_bit_data bttv_i2c_algo_template = {
+ NULL,
+ bttv_bit_setsda,
+ bttv_bit_setscl,
+ bttv_bit_getsda,
+ bttv_bit_getscl,
+ 10, 10, 100,
+};
+
+struct i2c_adapter bttv_i2c_adap_template = {
+ "bt848",
+ I2C_HW_B_BT848,
+ NULL,
+ NULL,
+ bttv_inc_use,
+ bttv_dec_use,
+ attach_inform,
+ detach_inform,
+ NULL,
+};
+
+struct i2c_client bttv_i2c_client_template = {
+ "bttv internal",
+ -1,
+ 0,
+ 0,
+ NULL,
+ NULL
+};
+
+
+/* read I2C */
+int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for)
+{
+ unsigned char buffer = 0;
+
+ if (0 != btv->i2c_ok)
+ return -1;
+ if (bttv_verbose && NULL != probe_for)
+ printk(KERN_INFO "bttv%d: i2c: checking for %s @ 0x%02x... ",
+ btv->nr,probe_for,addr);
+ btv->i2c_client.addr = addr >> 1;
+ if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) {
+ if (NULL != probe_for) {
+ if (bttv_verbose)
+ printk("not found\n");
+ } else
+ printk(KERN_WARNING "bttv%d: i2c read 0x%x: error\n",
+ btv->nr,addr);
+ return -1;
+ }
+ if (bttv_verbose && NULL != probe_for)
+ printk("found\n");
+ return buffer;
+}
+
+/* write I2C */
+int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
+ unsigned char b2, int both)
+{
+ unsigned char buffer[2];
+ int bytes = both ? 2 : 1;
+
+ if (0 != btv->i2c_ok)
+ return -1;
+ btv->i2c_client.addr = addr >> 1;
+ buffer[0] = b1;
+ buffer[1] = b2;
+ if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes))
+ return -1;
+ return 0;
+}
+
+/* read EEPROM content */
+void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr)
+{
+ int i;
+
+ if (bttv_I2CWrite(btv, addr, 0, -1, 0)<0) {
+ printk(KERN_WARNING "bttv: readee error\n");
+ return;
+ }
+ btv->i2c_client.addr = addr >> 1;
+ for (i=0; i<256; i+=16) {
+ if (16 != i2c_master_recv(&btv->i2c_client,eedata+i,16)) {
+ printk(KERN_WARNING "bttv: readee error\n");
+ break;
+ }
+ }
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/drivers/char/bttv.h b/drivers/char/bttv.h
index 9189bfa77..c3d3abcbe 100644
--- a/drivers/char/bttv.h
+++ b/drivers/char/bttv.h
@@ -21,7 +21,7 @@
#ifndef _BTTV_H_
#define _BTTV_H_
-#define BTTV_VERSION_CODE KERNEL_VERSION(0,7,31)
+#define BTTV_VERSION_CODE KERNEL_VERSION(0,7,37)
#ifndef PCI_GET_DRIVER_DATA
# define PCI_GET_DRIVER_DATA(pdev) ((pdev)->driver_data)
@@ -37,6 +37,110 @@
#include "audiochip.h"
#include "bt848.h"
+#ifdef __KERNEL__
+
+/* fwd decl */
+struct bttv;
+
+
+/* ---------------------------------------------------------- */
+/* exported by bttv-cards.c */
+
+#define BTTV_UNKNOWN 0x00
+#define BTTV_MIRO 0x01
+#define BTTV_HAUPPAUGE 0x02
+#define BTTV_STB 0x03
+#define BTTV_INTEL 0x04
+#define BTTV_DIAMOND 0x05
+#define BTTV_AVERMEDIA 0x06
+#define BTTV_MATRIX_VISION 0x07
+#define BTTV_FLYVIDEO 0x08
+#define BTTV_TURBOTV 0x09
+#define BTTV_HAUPPAUGE878 0x0a
+#define BTTV_MIROPRO 0x0b
+#define BTTV_ADSTECH_TV 0x0c
+#define BTTV_AVERMEDIA98 0x0d
+#define BTTV_VHX 0x0e
+#define BTTV_ZOLTRIX 0x0f
+#define BTTV_PIXVIEWPLAYTV 0x10
+#define BTTV_WINVIEW_601 0x11
+#define BTTV_AVEC_INTERCAP 0x12
+#define BTTV_LIFE_FLYKIT 0x13
+#define BTTV_CEI_RAFFLES 0x14
+#define BTTV_CONFERENCETV 0x15
+#define BTTV_PHOEBE_TVMAS 0x16
+#define BTTV_MODTEC_205 0x17
+#define BTTV_MAGICTVIEW061 0x18
+#define BTTV_VOBIS_BOOSTAR 0x19
+#define BTTV_HAUPPAUG_WCAM 0x1a
+#define BTTV_MAXI 0x1b
+#define BTTV_TERRATV 0x1c
+#define BTTV_PXC200 0x1d
+#define BTTV_FLYVIDEO_98 0x1e
+#define BTTV_IPROTV 0x1f
+#define BTTV_INTEL_C_S_PCI 0x20
+#define BTTV_TERRATVALUE 0x21
+#define BTTV_WINFAST2000 0x22
+#define BTTV_CHRONOS_VS2 0x23
+#define BTTV_TYPHOON_TVIEW 0x24
+#define BTTV_PXELVWPLTVPRO 0x25
+#define BTTV_MAGICTVIEW063 0x26
+#define BTTV_PINNACLERAVE 0x27
+#define BTTV_STB2 0x28
+#define BTTV_AVPHONE98 0x29
+#define BTTV_PV951 0x2a
+#define BTTV_ONAIR_TV 0x2b
+#define BTTV_SIGMA_TVII_FM 0x2c
+#define BTTV_MATRIX_VISION2 0x2d
+#define BTTV_ZOLTRIX_GENIE 0x2e
+#define BTTV_TERRATVRADIO 0x2f
+#define BTTV_DYNALINK 0x30
+
+struct tvcard
+{
+ char *name;
+ int video_inputs;
+ int audio_inputs;
+ int tuner;
+ int svhs;
+ u32 gpiomask;
+ u32 muxsel[8];
+ u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */
+ u32 gpiomask2; /* GPIO MUX mask */
+
+ /* look for these i2c audio chips */
+ int msp34xx:1;
+ int tda8425:1;
+ int tda9840:1;
+ int tda985x:1;
+ int tea63xx:1;
+ int tea64xx:1;
+ int tda7432:1;
+ int tda9875:1;
+
+ /* other settings */
+ int pll;
+#define PLL_NONE 0
+#define PLL_28 1
+#define PLL_35 2
+
+ int tuner_type;
+};
+
+extern struct tvcard bttv_tvcards[];
+extern const int bttv_num_tvcards;
+
+/* identification / initialization of the card */
+extern void bttv_idcard(struct bttv *btv);
+
+/* card-specific funtions */
+extern void tea5757_set_freq(struct bttv *btv, unsigned short freq);
+extern void winview_setvol(struct bttv *btv, struct video_audio *v);
+
+/* ---------------------------------------------------------- */
+/* exported by bttv-if.c */
+/* interface for gpio access by other modules */
+
/* returns card type + card ID (for bt878-based ones)
for possible values see lines below beginning with #define BTTV_UNKNOWN
returns negative value if error ocurred
@@ -62,8 +166,8 @@ extern int bttv_read_gpio(unsigned int card, unsigned long *data);
(data & mask) | (current_GPDATA_value & ~mask)
returns negative value if error ocurred
*/
-extern int bttv_write_gpio(unsigned int card,
- unsigned long mask, unsigned long data);
+extern int bttv_write_gpio(unsigned int card,
+ unsigned long mask, unsigned long data);
/* returns pointer to task queue which can be used as parameter to
interruptible_sleep_on
@@ -76,6 +180,31 @@ extern int bttv_write_gpio(unsigned int card,
*/
extern wait_queue_head_t* bttv_get_gpio_queue(unsigned int card);
+/* i2c */
+struct i2c_algo_bit_data bttv_i2c_algo_template;
+struct i2c_adapter bttv_i2c_adap_template;
+struct i2c_client bttv_i2c_client_template;
+void bttv_bit_setscl(void *data, int state);
+void bttv_bit_setsda(void *data, int state);
+void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg);
+int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for);
+int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
+ unsigned char b2, int both);
+void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr);
+
+
+/* ---------------------------------------------------------- */
+/* bttv-driver.c */
+
+/* insmod options */
+extern unsigned int bttv_verbose;
+extern unsigned int bttv_debug;
+
+/* Anybody who uses more than four? */
+#define BTTV_MAX 4
+extern int bttv_num; /* number of Bt848s in use */
+extern struct bttv bttvs[BTTV_MAX];
+
#ifndef O_NONCAP
#define O_NONCAP O_TRUNC
@@ -89,8 +218,6 @@ extern wait_queue_head_t* bttv_get_gpio_queue(unsigned int card);
#define BTTV_MAX_FBUF 0x208000
#define I2C_CLIENTS_MAX 8
-#ifdef __KERNEL__
-
struct bttv_window
{
int x, y;
@@ -238,56 +365,6 @@ extern __inline__ void io_st_le32(volatile unsigned *addr, unsigned val)
#define BTTV_PICNR _IOR('v' , BASE_VIDIOCPRIVATE+7, int)
#define BTTV_VBISIZE _IOR('v' , BASE_VIDIOCPRIVATE+8, int)
-#define BTTV_UNKNOWN 0x00
-#define BTTV_MIRO 0x01
-#define BTTV_HAUPPAUGE 0x02
-#define BTTV_STB 0x03
-#define BTTV_INTEL 0x04
-#define BTTV_DIAMOND 0x05
-#define BTTV_AVERMEDIA 0x06
-#define BTTV_MATRIX_VISION 0x07
-#define BTTV_FLYVIDEO 0x08
-#define BTTV_TURBOTV 0x09
-#define BTTV_HAUPPAUGE878 0x0a
-#define BTTV_MIROPRO 0x0b
-#define BTTV_ADSTECH_TV 0x0c
-#define BTTV_AVERMEDIA98 0x0d
-#define BTTV_VHX 0x0e
-#define BTTV_ZOLTRIX 0x0f
-#define BTTV_PIXVIEWPLAYTV 0x10
-#define BTTV_WINVIEW_601 0x11
-#define BTTV_AVEC_INTERCAP 0x12
-#define BTTV_LIFE_FLYKIT 0x13
-#define BTTV_CEI_RAFFLES 0x14
-#define BTTV_CONFERENCETV 0x15
-#define BTTV_PHOEBE_TVMAS 0x16
-#define BTTV_MODTEC_205 0x17
-#define BTTV_MAGICTVIEW061 0x18
-#define BTTV_VOBIS_BOOSTAR 0x19
-#define BTTV_HAUPPAUG_WCAM 0x1a
-#define BTTV_MAXI 0x1b
-#define BTTV_TERRATV 0x1c
-#define BTTV_PXC200 0x1d
-#define BTTV_FLYVIDEO_98 0x1e
-#define BTTV_IPROTV 0x1f
-#define BTTV_INTEL_C_S_PCI 0x20
-#define BTTV_TERRATVALUE 0x21
-#define BTTV_WINFAST2000 0x22
-#define BTTV_CHRONOS_VS2 0x23
-#define BTTV_TYPHOON_TVIEW 0x24
-#define BTTV_PXELVWPLTVPRO 0x25
-#define BTTV_MAGICTVIEW063 0x26
-#define BTTV_PINNACLERAVE 0x27
-#define BTTV_STB2 0x28
-#define BTTV_AVPHONE98 0x29
-#define BTTV_PV951 0x2a
-#define BTTV_ONAIR_TV 0x2b
-#define BTTV_SIGMA_TVII_FM 0x2c
-
-#define PLL_NONE 0
-#define PLL_28 1
-#define PLL_35 2
-
#define AUDIO_TUNER 0x00
#define AUDIO_RADIO 0x01
#define AUDIO_EXTERN 0x02
@@ -306,7 +383,7 @@ extern __inline__ void io_st_le32(volatile unsigned *addr, unsigned val)
#define I2C_TDA7432 0x8a
#define I2C_TDA8425 0x82
#define I2C_TDA9840 0x84
-#define I2C_TDA9850 0xb6
+#define I2C_TDA9850 0xb6 /* also used by 9855,9873 */
#define I2C_TDA9875 0xb0
#define I2C_HAUPEE 0xa0
#define I2C_STBEE 0xae
@@ -315,10 +392,12 @@ extern __inline__ void io_st_le32(volatile unsigned *addr, unsigned val)
#define I2C_TEA6300 0x80
#define I2C_DPL3518 0x84
+#ifndef HAVE_TVAUDIO
#define TDA9840_SW 0x00
#define TDA9840_LVADJ 0x02
#define TDA9840_STADJ 0x03
#define TDA9840_TEST 0x04
+#endif
#define PT2254_L_CHANEL 0x10
#define PT2254_R_CHANEL 0x08
@@ -328,6 +407,15 @@ extern __inline__ void io_st_le32(volatile unsigned *addr, unsigned val)
#define WINVIEW_PT2254_DATA 0x20
#define WINVIEW_PT2254_STROBE 0x80
+struct bttv_just_hacking {
+ int height,width; /* size */
+ unsigned int format; /* should be VIDEO_PALETTE_* */
+ long buf;
+ int len;
+};
+
+#define BTTV_JUST_HACKING _IOR('v' , BASE_VIDIOCPRIVATE+31,struct bttv_just_hacking)
+
#endif
/*
diff --git a/drivers/char/console.c b/drivers/char/console.c
index e0c5b9064..0ed2b17ca 100644
--- a/drivers/char/console.c
+++ b/drivers/char/console.c
@@ -659,7 +659,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
con_set_default_unimap(currcons);
q = (long)kmalloc(screenbuf_size, GFP_KERNEL);
if (!q) {
- kfree_s((char *) p, structsize);
+ kfree((char *) p);
vc_cons[currcons].d = NULL;
vt_cons[currcons] = NULL;
return -ENOMEM;
@@ -703,7 +703,7 @@ int vc_resize(unsigned int lines, unsigned int cols,
if (!p) {
for (i = first; i < currcons; i++)
if (newscreens[i])
- kfree_s(newscreens[i], ss);
+ kfree(newscreens[i]);
return -ENOMEM;
}
newscreens[currcons] = p;
@@ -749,7 +749,7 @@ int vc_resize(unsigned int lines, unsigned int cols,
if (nlend > nl)
scr_memsetw((void *) nl, video_erase_char, nlend - nl);
if (kmalloced)
- kfree_s(screenbuf, oss);
+ kfree(screenbuf);
screenbuf = newscreens[currcons];
kmalloced = 1;
screenbuf_size = ss;
@@ -785,9 +785,9 @@ void vc_disallocate(unsigned int currcons)
if (vc_cons_allocated(currcons)) {
sw->con_deinit(vc_cons[currcons].d);
if (kmalloced)
- kfree_s(screenbuf, screenbuf_size);
+ kfree(screenbuf);
if (currcons >= MIN_NR_CONSOLES)
- kfree_s(vc_cons[currcons].d, structsize);
+ kfree(vc_cons[currcons].d);
vc_cons[currcons].d = NULL;
}
}
@@ -2860,7 +2860,7 @@ int con_font_op(int currcons, struct console_font_op *op)
rc = -EFAULT;
}
quit: if (temp)
- kfree_s(temp, size);
+ kfree(temp);
return rc;
}
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
index 5ad4885bf..10594dd2e 100644
--- a/drivers/char/drm/ffb_drv.c
+++ b/drivers/char/drm/ffb_drv.c
@@ -1,4 +1,4 @@
-/* $Id: ffb_drv.c,v 1.3 2000/06/01 04:24:39 davem Exp $
+/* $Id: ffb_drv.c,v 1.4 2000/07/13 08:06:39 davem Exp $
* ffb_drv.c: Creator/Creator3D direct rendering driver.
*
* Copyright (C) 2000 David S. Miller (davem@redhat.com)
diff --git a/drivers/char/drm/memory.c b/drivers/char/drm/memory.c
index a778a1539..d9ff66e34 100644
--- a/drivers/char/drm/memory.c
+++ b/drivers/char/drm/memory.c
@@ -192,7 +192,7 @@ void drm_free(void *pt, size_t size, int area)
int free_count;
if (!pt) DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n");
- else kfree_s(pt, size);
+ else kfree(pt);
spin_lock(&drm_mem_lock);
drm_mem_stats[area].bytes_freed += size;
free_count = ++drm_mem_stats[area].free_count;
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 2ba24a26b..1e122acba 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1599,7 +1599,7 @@ void cleanup_module()
{
if (ch->tty)
tty_hangup(ch->tty);
- kfree_s(ch->tmp_buf, ch->txbufsize);
+ kfree(ch->tmp_buf);
}
} /* End for each port */
diff --git a/drivers/char/ftape/lowlevel/ftape-tracing.h b/drivers/char/ftape/lowlevel/ftape-tracing.h
index 7f93942a5..e0f7e0f4f 100644
--- a/drivers/char/ftape/lowlevel/ftape-tracing.h
+++ b/drivers/char/ftape/lowlevel/ftape-tracing.h
@@ -149,7 +149,7 @@ extern void ftape_trace_log (const char *file, const char *name);
*/
#define TRACE_ABORT(res, i...) \
{ \
- TRACE(##i); \
+ TRACE(i); \
TRACE_EXIT res; \
}
diff --git a/drivers/char/ftape/lowlevel/ftape_syms.c b/drivers/char/ftape/lowlevel/ftape_syms.c
index 332de841c..af1b33da6 100644
--- a/drivers/char/ftape/lowlevel/ftape_syms.c
+++ b/drivers/char/ftape/lowlevel/ftape_syms.c
@@ -43,9 +43,9 @@
#include "../lowlevel/ftape-format.h"
#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
-# define FT_KSYM(sym) EXPORT_SYMBOL(##sym);
+# define FT_KSYM(sym) EXPORT_SYMBOL(sym);
#else
-# define FT_KSYM(sym) X(##sym),
+# define FT_KSYM(sym) X(sym),
#endif
#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
diff --git a/drivers/char/ftape/zftape/zftape_syms.c b/drivers/char/ftape/zftape/zftape_syms.c
index 139b19cf1..60ee8e4be 100644
--- a/drivers/char/ftape/zftape/zftape_syms.c
+++ b/drivers/char/ftape/zftape/zftape_syms.c
@@ -35,9 +35,9 @@
#include "../zftape/zftape-ctl.h"
#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
-# define FT_KSYM(sym) EXPORT_SYMBOL(##sym);
+# define FT_KSYM(sym) EXPORT_SYMBOL(sym);
#else
-# define FT_KSYM(sym) X(##sym),
+# define FT_KSYM(sym) X(sym),
#endif
#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index bee522007..71dd53691 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -868,9 +868,9 @@ void cleanup_module()
printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i);
if (stli_tmpwritebuf != (char *) NULL)
- kfree_s(stli_tmpwritebuf, STLI_TXBUFSIZE);
+ kfree(stli_tmpwritebuf);
if (stli_txcookbuf != (char *) NULL)
- kfree_s(stli_txcookbuf, STLI_TXBUFSIZE);
+ kfree(stli_txcookbuf);
for (i = 0; (i < stli_nrbrds); i++) {
if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL)
@@ -880,14 +880,14 @@ void cleanup_module()
if (portp != (stliport_t *) NULL) {
if (portp->tty != (struct tty_struct *) NULL)
tty_hangup(portp->tty);
- kfree_s(portp, sizeof(stliport_t));
+ kfree(portp);
}
}
iounmap(brdp->membase);
if (brdp->iosize > 0)
release_region(brdp->iobase, brdp->iosize);
- kfree_s(brdp, sizeof(stlibrd_t));
+ kfree(brdp);
stli_brds[i] = (stlibrd_t *) NULL;
}
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index a602e3b3b..5be8baee8 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -409,7 +409,7 @@ static int lp_release(struct inode * inode, struct file * file)
unsigned int minor = MINOR(inode->i_rdev);
lock_kernel();
- kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE);
+ kfree(lp_table[minor].lp_buffer);
lp_table[minor].lp_buffer = NULL;
LP_F(minor) &= ~LP_BUSY;
unlock_kernel();
diff --git a/drivers/char/msp3400.c b/drivers/char/msp3400.c
index 5c30ca2f0..b8390c520 100644
--- a/drivers/char/msp3400.c
+++ b/drivers/char/msp3400.c
@@ -58,11 +58,6 @@
#include "audiochip.h"
-/* sound mixer stuff */
-#if 0 /* defined(CONFIG_SOUND) || defined(CONFIG_SOUND_MODULE) */
-# define REGISTER_MIXER 1
-#endif
-
/* Addresses to scan */
static unsigned short normal_i2c[] = {I2C_CLIENT_END};
static unsigned short normal_i2c_range[] = {0x40,0x40,I2C_CLIENT_END};
@@ -85,9 +80,6 @@ static int amsound = 0; /* hard-wire AM sound at 6.5 Hz (france),
the autoscan seems work well only with FM... */
static int simple = -1; /* use short programming (>= msp3410 only) */
static int dolby = 0;
-#ifdef REGISTER_MIXER
-static int mixer = -1;
-#endif
struct msp3400c {
int simple;
@@ -110,10 +102,6 @@ struct msp3400c {
int watch_stereo;
struct timer_list wake_stereo;
-
- /* mixer */
- int mixer_modcnt;
- int mixer_num;
};
#define MSP3400_MAX 4
@@ -130,7 +118,6 @@ MODULE_PARM(debug,"i");
MODULE_PARM(simple,"i");
MODULE_PARM(amsound,"i");
MODULE_PARM(dolby,"i");
-MODULE_PARM(mixer,"i");
/* ---------------------------------------------------------------------- */
@@ -680,10 +667,7 @@ static int msp3400c_thread(void *data)
lock_kernel();
#endif
- exit_mm(current);
- exit_fs(current);
- current->session = 1;
- current->pgrp = 1;
+ daemonize();
sigfillset(&current->blocked);
strcpy(current->comm,"msp3400");
@@ -932,10 +916,7 @@ static int msp3410d_thread(void *data)
lock_kernel();
#endif
- exit_mm(current);
- exit_fs(current);
- current->session = 1;
- current->pgrp = 1;
+ daemonize();
sigfillset(&current->blocked);
strcpy(current->comm,"msp3410 [auto]");
@@ -1104,191 +1085,6 @@ done:
}
/* ----------------------------------------------------------------------- */
-/* mixer stuff -- with the modular sound driver in 2.1.x we can easily */
-/* register the msp3400 as mixer device */
-
-#ifdef REGISTER_MIXER
-
-#include <linux/sound.h>
-#include <linux/soundcard.h>
-#include <asm/uaccess.h>
-
-static int mix_to_v4l(int i)
-{
- int r;
-
- r = ((i & 0xff) * 65536 + 50) / 100;
- if (r > 65535) r = 65535;
- if (r < 0) r = 0;
- return r;
-}
-
-static int v4l_to_mix(int i)
-{
- int r;
-
- r = (i * 100 + 32768) / 65536;
- if (r > 100) r = 100;
- if (r < 0) r = 0;
- return r | (r << 8);
-}
-
-static int v4l_to_mix2(int l, int r)
-{
- r = (r * 100 + 32768) / 65536;
- if (r > 100) r = 100;
- if (r < 0) r = 0;
- l = (l * 100 + 32768) / 65536;
- if (l > 100) l = 100;
- if (l < 0) l = 0;
- return (r << 8) | l;
-}
-
-static int
-msp3400c_mixer_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
- struct i2c_client *client;
- struct msp3400c *msp;
- int ret,val = 0;
-
- client = file->private_data;
- if (!client)
- return -ENODEV;
- msp = client->data;
- if (!msp)
- return -ENODEV;
-
- if (cmd == SOUND_MIXER_INFO) {
- mixer_info info;
- strncpy(info.id, "MSP3400", sizeof(info.id));
- strncpy(info.name, "MSP 3400", sizeof(info.name));
- info.modify_counter = msp->mixer_modcnt;
- if (copy_to_user((void *)arg, &info, sizeof(info)))
- return -EFAULT;
- return 0;
- }
- if (cmd == SOUND_OLD_MIXER_INFO) {
- _old_mixer_info info;
- strncpy(info.id, "MSP3400", sizeof(info.id));
- strncpy(info.name, "MSP 3400", sizeof(info.name));
- if (copy_to_user((void *)arg, &info, sizeof(info)))
- return -EFAULT;
- return 0;
- }
- if (cmd == OSS_GETVERSION)
- return put_user(SOUND_VERSION, (int *)arg);
-
- if (_SIOC_DIR(cmd) & _SIOC_WRITE)
- if (get_user(val, (int *)arg))
- return -EFAULT;
-
- switch (cmd) {
- case MIXER_READ(SOUND_MIXER_RECMASK):
- case MIXER_READ(SOUND_MIXER_CAPS):
- case MIXER_READ(SOUND_MIXER_RECSRC):
- case MIXER_WRITE(SOUND_MIXER_RECSRC):
- ret = 0;
- break;
-
- case MIXER_READ(SOUND_MIXER_STEREODEVS):
- ret = SOUND_MASK_VOLUME;
- break;
- case MIXER_READ(SOUND_MIXER_DEVMASK):
- ret = SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE;
- break;
-
- case MIXER_WRITE(SOUND_MIXER_VOLUME):
- msp->left = mix_to_v4l(val);
- msp->right = mix_to_v4l(val >> 8);
- msp3400c_setvolume(client,msp->left,msp->right);
- msp->mixer_modcnt++;
- /* fall */
- case MIXER_READ(SOUND_MIXER_VOLUME):
- ret = v4l_to_mix2(msp->left, msp->right);
- break;
-
- case MIXER_WRITE(SOUND_MIXER_BASS):
- msp->bass = mix_to_v4l(val);
- msp3400c_setbass(client,msp->bass);
- msp->mixer_modcnt++;
- /* fall */
- case MIXER_READ(SOUND_MIXER_BASS):
- ret = v4l_to_mix(msp->bass);
- break;
-
- case MIXER_WRITE(SOUND_MIXER_TREBLE):
- msp->treble = mix_to_v4l(val);
- msp3400c_settreble(client,msp->treble);
- msp->mixer_modcnt++;
- /* fall */
- case MIXER_READ(SOUND_MIXER_TREBLE):
- ret = v4l_to_mix(msp->treble);
- break;
-
- default:
- return -EINVAL;
- }
- if (put_user(ret, (int *)arg))
- return -EFAULT;
- return 0;
-}
-
-static int
-msp3400c_mixer_open(struct inode *inode, struct file *file)
-{
- int minor = MINOR(inode->i_rdev);
- struct i2c_client *client;
- struct msp3400c *msp;
- int i;
-
- /* search for the right one... */
- for (i = 0; i < MSP3400_MAX; i++) {
- msp = msps[i]->data;
- if (msp->mixer_num == minor) {
- client = msps[i];
- file->private_data = client;
- break;
- }
- }
- if (MSP3400_MAX == i)
- return -ENODEV;
-
- /* lock bttv in memory while the mixer is in use */
- if (client->adapter->inc_use)
- client->adapter->inc_use(client->adapter);
-
- return 0;
-}
-
-static int
-msp3400c_mixer_release(struct inode *inode, struct file *file)
-{
- struct i2c_client *client = file->private_data;
-
- lock_kernel();
- if (client->adapter->dec_use)
- client->adapter->dec_use(client->adapter);
- unlock_kernel();
- return 0;
-}
-
-static loff_t
-msp3400c_mixer_llseek(struct file *file, loff_t offset, int origin)
-{
- return -ESPIPE;
-}
-
-static struct file_operations msp3400c_mixer_fops = {
- owner: THIS_MODULE,
- llseek: msp3400c_mixer_llseek,
- ioctl: msp3400c_mixer_ioctl,
- open: msp3400c_mixer_open,
- release: msp3400c_mixer_release,
-};
-
-#endif
-
-/* ----------------------------------------------------------------------- */
static int msp_attach(struct i2c_adapter *adap, int addr,
unsigned short flags, int kind);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 9f0e1374c..228c609da 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -509,7 +509,7 @@ static int create_entropy_store(int size, struct entropy_store **ret_bucket)
r->pool = kmalloc(poolwords*4, GFP_KERNEL);
if (!r->pool) {
- kfree_s(r, sizeof(struct entropy_store));
+ kfree(r);
return -ENOMEM;
}
memset(r->pool, 0, poolwords*4);
@@ -531,7 +531,7 @@ static void free_entropy_store(struct entropy_store *r)
{
if (r->pool)
kfree(r->pool);
- kfree_s(r, sizeof(struct entropy_store));
+ kfree(r);
}
/*
diff --git a/drivers/char/serial.c b/drivers/char/serial.c
index d8f077deb..05180e3df 100644
--- a/drivers/char/serial.c
+++ b/drivers/char/serial.c
@@ -3080,7 +3080,7 @@ static int get_async_struct(int line, struct async_struct **ret_info)
info->tqueue.data = info;
info->state = sstate;
if (sstate->info) {
- kfree_s(info, sizeof(struct async_struct));
+ kfree(info);
*ret_info = sstate->info;
return 0;
}
@@ -5299,7 +5299,7 @@ static void __exit rs_fini(void)
for (i = 0; i < NR_PORTS; i++) {
if ((info = rs_table[i].info)) {
rs_table[i].info = NULL;
- kfree_s(info, sizeof(struct async_struct));
+ kfree(info);
}
if ((rs_table[i].type != PORT_UNKNOWN) && rs_table[i].port) {
#ifdef CONFIG_SERIAL_RSA
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 9600c1bad..a0faeada4 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -812,7 +812,7 @@ void cleanup_module()
"errno=%d\n", -i);
if (stl_tmpwritebuf != (char *) NULL)
- kfree_s(stl_tmpwritebuf, STL_TXBUFSIZE);
+ kfree(stl_tmpwritebuf);
for (i = 0; (i < stl_nrbrds); i++) {
if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL)
@@ -828,17 +828,17 @@ void cleanup_module()
if (portp->tty != (struct tty_struct *) NULL)
stl_hangup(portp->tty);
if (portp->tx.buf != (char *) NULL)
- kfree_s(portp->tx.buf, STL_TXBUFSIZE);
- kfree_s(portp, sizeof(stlport_t));
+ kfree(portp->tx.buf);
+ kfree(portp);
}
- kfree_s(panelp, sizeof(stlpanel_t));
+ kfree(panelp);
}
release_region(brdp->ioaddr1, brdp->iosize1);
if (brdp->iosize2 > 0)
release_region(brdp->ioaddr2, brdp->iosize2);
- kfree_s(brdp, sizeof(stlbrd_t));
+ kfree(brdp);
stl_brds[i] = (stlbrd_t *) NULL;
}
@@ -1241,7 +1241,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
stl_flushbuffer(tty);
portp->istate = 0;
if (portp->tx.buf != (char *) NULL) {
- kfree_s(portp->tx.buf, STL_TXBUFSIZE);
+ kfree(portp->tx.buf);
portp->tx.buf = (char *) NULL;
portp->tx.head = (char *) NULL;
portp->tx.tail = (char *) NULL;
@@ -1830,7 +1830,7 @@ static void stl_hangup(struct tty_struct *tty)
portp->istate = 0;
set_bit(TTY_IO_ERROR, &tty->flags);
if (portp->tx.buf != (char *) NULL) {
- kfree_s(portp->tx.buf, STL_TXBUFSIZE);
+ kfree(portp->tx.buf);
portp->tx.buf = (char *) NULL;
portp->tx.head = (char *) NULL;
portp->tx.tail = (char *) NULL;
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 4435a517b..6419b4a8f 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -4006,7 +4006,7 @@ int mgsl_alloc_buffer_list_memory( struct mgsl_struct *info )
void mgsl_free_buffer_list_memory( struct mgsl_struct *info )
{
if ( info->buffer_list && info->bus_type != MGSL_BUS_TYPE_PCI )
- kfree_s(info->buffer_list, BUFFERLISTSIZE);
+ kfree(info->buffer_list);
info->buffer_list = NULL;
info->rx_buffer_list = NULL;
@@ -4080,7 +4080,7 @@ void mgsl_free_frame_memory(struct mgsl_struct *info, DMABUFFERENTRY *BufferList
for ( i = 0 ; i < Buffercount ; i++ ) {
if ( BufferList[i].virt_addr ) {
if ( info->bus_type != MGSL_BUS_TYPE_PCI )
- kfree_s(BufferList[i].virt_addr, DMABUFFERSIZE);
+ kfree(BufferList[i].virt_addr);
BufferList[i].virt_addr = NULL;
}
}
@@ -4139,7 +4139,7 @@ int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info)
void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info)
{
if ( info->intermediate_rxbuffer )
- kfree_s( info->intermediate_rxbuffer, info->max_frame_size);
+ kfree( info->intermediate_rxbuffer );
info->intermediate_rxbuffer = NULL;
@@ -4695,13 +4695,13 @@ void cleanup_module(void)
}
if (serial_table)
- kfree_s(serial_table,sizeof(struct tty_struct*)*mgsl_device_count);
+ kfree(serial_table);
if (serial_termios)
- kfree_s(serial_termios,sizeof(struct termios*)*mgsl_device_count);
+ kfree(serial_termios);
if (serial_termios_locked)
- kfree_s(serial_termios_locked,sizeof(struct termios*)*mgsl_device_count);
+ kfree(serial_termios_locked);
} /* end of cleanup_module() */
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 816f385e1..7b42d645f 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -149,9 +149,7 @@ extern int rs_8xx_init(void);
extern void hwc_console_init(void);
extern void con3215_init(void);
extern void rs285_console_init(void);
-extern void rs285_init(void);
extern void sa1100_rs_console_init(void);
-extern void sa1100_rs_init(void);
extern void sgi_serial_console_init(void);
#ifndef MIN
@@ -988,13 +986,13 @@ end_init:
/* Release locally allocated memory ... nothing placed in slots */
free_mem_out:
if (o_tp)
- kfree_s(o_tp, sizeof(struct termios));
+ kfree(o_tp);
if (o_tty)
free_tty_struct(o_tty);
if (ltp)
- kfree_s(ltp, sizeof(struct termios));
+ kfree(ltp);
if (tp)
- kfree_s(tp, sizeof(struct termios));
+ kfree(tp);
free_tty_struct(tty);
fail_no_mem:
@@ -1022,7 +1020,7 @@ static void release_mem(struct tty_struct *tty, int idx)
if (o_tty->driver.flags & TTY_DRIVER_RESET_TERMIOS) {
tp = o_tty->driver.termios[idx];
o_tty->driver.termios[idx] = NULL;
- kfree_s(tp, sizeof(struct termios));
+ kfree(tp);
}
o_tty->magic = 0;
(*o_tty->driver.refcount)--;
@@ -1033,7 +1031,7 @@ static void release_mem(struct tty_struct *tty, int idx)
if (tty->driver.flags & TTY_DRIVER_RESET_TERMIOS) {
tp = tty->driver.termios[idx];
tty->driver.termios[idx] = NULL;
- kfree_s(tp, sizeof(struct termios));
+ kfree(tp);
}
tty->magic = 0;
(*tty->driver.refcount)--;
@@ -2123,12 +2121,12 @@ int tty_unregister_driver(struct tty_driver *driver)
tp = driver->termios[i];
if (tp) {
driver->termios[i] = NULL;
- kfree_s(tp, sizeof(struct termios));
+ kfree(tp);
}
tp = driver->termios_locked[i];
if (tp) {
driver->termios_locked[i] = NULL;
- kfree_s(tp, sizeof(struct termios));
+ kfree(tp);
}
tty_unregister_devfs(driver, driver->minor_start + i);
}
@@ -2190,6 +2188,12 @@ void __init console_init(void)
#ifdef CONFIG_HWC
hwc_console_init();
#endif
+#ifdef CONFIG_SERIAL_21285_CONSOLE
+ rs285_console_init();
+#endif
+#ifdef CONFIG_SERIAL_SA1100_CONSOLE
+ sa1100_rs_console_init();
+#endif
}
static struct tty_driver dev_tty_driver, dev_syscons_driver;
@@ -2319,7 +2323,7 @@ void __init tty_init(void)
rio_init();
#endif
#if (defined(CONFIG_8xx) || defined(CONFIG_8260))
- rs_8xx_init();
+ rs_8xx_init();
#endif /* CONFIG_8xx */
pty_init();
#ifdef CONFIG_MOXA_SMARTIO
diff --git a/drivers/char/tuner.c b/drivers/char/tuner.c
index 81e19a4ab..dfbf0f6af 100644
--- a/drivers/char/tuner.c
+++ b/drivers/char/tuner.c
@@ -172,8 +172,7 @@ static void set_tv_freq(struct i2c_client *c, int freq)
config = tun->UHF;
#if 1 // Fix colorstandard mode change
- if (t->type == TUNER_PHILIPS_SECAM
- /*&& t->std == V4L2_STANDARD_DDD*/ )
+ if (t->type == TUNER_PHILIPS_SECAM && t->mode)
config |= tun->mode;
else
config &= ~tun->mode;
diff --git a/drivers/char/tvmixer.c b/drivers/char/tvmixer.c
index c3db65bae..e1034a152 100644
--- a/drivers/char/tvmixer.c
+++ b/drivers/char/tvmixer.c
@@ -7,7 +7,6 @@
#include <linux/errno.h>
#include <linux/malloc.h>
#include <linux/i2c.h>
-#include <linux/smp_lock.h>
#include <linux/videodev.h>
#include <asm/semaphore.h>
#include <linux/init.h>
@@ -220,20 +219,17 @@ static int tvmixer_open(struct inode *inode, struct file *file)
static int tvmixer_release(struct inode *inode, struct file *file)
{
- struct TVMIXER *mix = file->private_data;
+ struct TVMIXER *mix = file->private_data;
struct i2c_client *client;
- lock_kernel();
client = mix->dev;
if (NULL == client) {
- unlock_kernel();
return -ENODEV;
}
- if (client->adapter->dec_use)
+ if (client->adapter->dec_use)
client->adapter->dec_use(client->adapter);
- unlock_kernel();
- return 0;
+ return 0;
}
static loff_t tvmixer_llseek(struct file *file, loff_t offset, int origin)
diff --git a/drivers/char/videodev.c b/drivers/char/videodev.c
index 3657cb518..c806ff264 100644
--- a/drivers/char/videodev.c
+++ b/drivers/char/videodev.c
@@ -62,9 +62,6 @@ LIST_HEAD(videodev_proc_list);
#endif /* CONFIG_PROC_FS && CONFIG_VIDEO_PROC_FS */
-#ifdef CONFIG_VIDEO_BT848
-extern int i2c_tuner_init(struct video_init *);
-#endif
#ifdef CONFIG_VIDEO_BWQCAM
extern int init_bw_qcams(struct video_init *);
#endif
@@ -79,9 +76,6 @@ extern int init_zoran_cards(struct video_init *);
#endif
static struct video_init video_init_list[]={
-#ifdef CONFIG_VIDEO_BT848
- {"i2c-tuner", i2c_tuner_init},
-#endif
#ifdef CONFIG_VIDEO_BWQCAM
{"bw-qcam", init_bw_qcams},
#endif
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index c63df1039..90d01c4a4 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -178,7 +178,7 @@ do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kb
if (s && key_map) {
key_maps[s] = 0;
if (key_map[0] == U(K_ALLOCATED)) {
- kfree_s(key_map, sizeof(plain_map));
+ kfree(key_map);
keymap_count--;
}
}
@@ -335,7 +335,7 @@ do_kdgkb_ioctl(int cmd, struct kbsentry *user_kdgkb, int perm)
func_table[k] = fnw + (func_table[k] - funcbufptr) + delta;
}
if (funcbufptr != func_buf)
- kfree_s(funcbufptr, funcbufsize);
+ kfree(funcbufptr);
funcbufptr = fnw;
funcbufleft = funcbufleft - delta + sz - funcbufsize;
funcbufsize = sz;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index e8e67d549..b03bc2fac 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -360,6 +360,15 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
return;
}
+ /*
+ * If a read toc is executed for a CD-R or CD-RW medium where
+ * the first toc has not been recorded yet, it will fail with
+ * 05/24/00 (which is a confusing error)
+ */
+ if (failed_command && failed_command->c[0] == GPCMD_READ_TOC_PMA_ATIP)
+ if (sense->sense_key == 0x05 && sense->asc == 0x24)
+ return;
+
#if VERBOSE_IDE_CD_ERRORS
{
int i;
@@ -2145,29 +2154,27 @@ void ide_cdrom_release_real (struct cdrom_device_info *cdi)
/****************************************************************************
* Device initialization.
*/
-
-static
-struct cdrom_device_ops ide_cdrom_dops = {
- ide_cdrom_open_real, /* open */
- ide_cdrom_release_real, /* release */
- ide_cdrom_drive_status, /* drive_status */
- ide_cdrom_check_media_change_real, /* media_changed */
- ide_cdrom_tray_move, /* tray_move */
- ide_cdrom_lock_door, /* lock_door */
- ide_cdrom_select_speed, /* select_speed */
- NULL, /* select_disc */
- ide_cdrom_get_last_session, /* get_last_session */
- ide_cdrom_get_mcn, /* get_mcn */
- ide_cdrom_reset, /* reset */
- ide_cdrom_audio_ioctl, /* audio_ioctl */
- ide_cdrom_dev_ioctl, /* dev_ioctl */
- CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_SELECT_SPEED
- | CDC_SELECT_DISC | CDC_MULTI_SESSION | CDC_MCN
- | CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO | CDC_RESET | CDC_IOCTLS
- | CDC_DRIVE_STATUS | CDC_CD_R | CDC_CD_RW | CDC_DVD
- | CDC_DVD_R| CDC_DVD_RAM | CDC_GENERIC_PACKET, /* capability */
- 0, /* n_minors */
- ide_cdrom_packet
+static struct cdrom_device_ops ide_cdrom_dops = {
+ open: ide_cdrom_open_real,
+ release: ide_cdrom_release_real,
+ drive_status: ide_cdrom_drive_status,
+ media_changed: ide_cdrom_check_media_change_real,
+ tray_move: ide_cdrom_tray_move,
+ lock_door: ide_cdrom_lock_door,
+ select_speed: ide_cdrom_select_speed,
+ get_last_session: ide_cdrom_get_last_session,
+ get_mcn: ide_cdrom_get_mcn,
+ reset: ide_cdrom_reset,
+ audio_ioctl: ide_cdrom_audio_ioctl,
+ dev_ioctl: ide_cdrom_dev_ioctl,
+ capability: CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |
+ CDC_SELECT_SPEED | CDC_SELECT_DISC |
+ CDC_MULTI_SESSION | CDC_MCN |
+ CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO | CDC_RESET |
+ CDC_IOCTLS | CDC_DRIVE_STATUS | CDC_CD_R |
+ CDC_CD_RW | CDC_DVD | CDC_DVD_R| CDC_DVD_RAM |
+ CDC_GENERIC_PACKET,
+ generic_packet: ide_cdrom_packet,
};
static int ide_cdrom_register (ide_drive_t *drive, int nslots)
@@ -2275,9 +2282,9 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)
CDROM_CONFIG_FLAGS (drive)->dvd = 1;
if (cap.dvd_ram_write)
- CDROM_CONFIG_FLAGS (drive)->dvd_r = 1;
- if (cap.dvd_r_write)
CDROM_CONFIG_FLAGS (drive)->dvd_ram = 1;
+ if (cap.dvd_r_write)
+ CDROM_CONFIG_FLAGS (drive)->dvd_r = 1;
if (cap.audio_play)
CDROM_CONFIG_FLAGS (drive)->audio_play = 1;
if (cap.mechtype == 0)
@@ -2510,8 +2517,7 @@ int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive)
MOD_INC_USE_COUNT;
if (info->buffer == NULL)
info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL);
- rc = cdrom_fops.open (ip, fp);
- if (rc) {
+ if ((rc = cdrom_fops.open(ip, fp))) {
drive->usage--;
MOD_DEC_USE_COUNT;
}
@@ -2560,8 +2566,10 @@ unsigned long ide_cdrom_capacity (ide_drive_t *drive)
{
unsigned capacity;
- return cdrom_read_capacity(drive, &capacity, NULL)
- ? 0 : capacity * SECTORS_PER_FRAME;
+ if (cdrom_read_capacity(drive, &capacity, NULL))
+ return 0;
+
+ return capacity * SECTORS_PER_FRAME;
}
static
@@ -2586,24 +2594,19 @@ int ide_cdrom_cleanup(ide_drive_t *drive)
}
static ide_driver_t ide_cdrom_driver = {
- "ide-cdrom", /* name */
- IDECD_VERSION, /* version */
- ide_cdrom, /* media */
- 0, /* busy */
- 1, /* supports_dma */
- 1, /* supports_dsc_overlap */
- ide_cdrom_cleanup, /* cleanup */
- ide_do_rw_cdrom, /* do_request */
- NULL, /* ??? or perhaps cdrom_end_request? */
- ide_cdrom_ioctl, /* ioctl */
- ide_cdrom_open, /* open */
- ide_cdrom_release, /* release */
- ide_cdrom_check_media_change, /* media_change */
- ide_cdrom_revalidate, /* revalidate */
- NULL, /* pre_reset */
- ide_cdrom_capacity, /* capacity */
- NULL, /* special */
- NULL /* proc */
+ name: "ide-cdrom",
+ version: IDECD_VERSION,
+ media: ide_cdrom,
+ supports_dma: 1,
+ supports_dsc_overlap: 1,
+ cleanup: ide_cdrom_cleanup,
+ do_request: ide_do_rw_cdrom,
+ ioctl: ide_cdrom_ioctl,
+ open: ide_cdrom_open,
+ release: ide_cdrom_release,
+ media_change: ide_cdrom_check_media_change,
+ revalidate: ide_cdrom_revalidate,
+ capacity: ide_cdrom_capacity,
};
int ide_cdrom_init(void);
diff --git a/drivers/isdn/avmb1/avm_cs.c b/drivers/isdn/avmb1/avm_cs.c
index 4b8c9a1b4..f1538b44f 100644
--- a/drivers/isdn/avmb1/avm_cs.c
+++ b/drivers/isdn/avmb1/avm_cs.c
@@ -233,9 +233,9 @@ static void avmcs_detach(dev_link_t *link)
/* Unlink device structure, free pieces */
*linkp = link->next;
if (link->priv) {
- kfree_s(link->priv, sizeof(local_info_t));
+ kfree(link->priv);
}
- kfree_s(link, sizeof(struct dev_link_t));
+ kfree(link);
} /* avmcs_detach */
diff --git a/drivers/isdn/isdn_tty.c b/drivers/isdn/isdn_tty.c
index 665ac46e8..796cf4848 100644
--- a/drivers/isdn/isdn_tty.c
+++ b/drivers/isdn/isdn_tty.c
@@ -2942,7 +2942,7 @@ isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pluscount,
if ((jiffies - *lastplus) < PLUSWAIT2)
*pluscount = 0;
}
- if ((*pluscount == 3) && (count = 1))
+ if ((*pluscount == 3) && (count == 1))
isdn_timer_ctrl(ISDN_TIMER_MODEMPLUS, 1);
if (*pluscount > 3)
*pluscount = 1;
diff --git a/drivers/mtd/mtdram.c b/drivers/mtd/mtdram.c
index 33f3a8116..bac119919 100644
--- a/drivers/mtd/mtdram.c
+++ b/drivers/mtd/mtdram.c
@@ -9,6 +9,7 @@
*
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/malloc.h>
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 9be7f31a8..7703e1415 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -1269,7 +1269,7 @@ void cleanup_module(void)
mca_set_adapter_procfn(((struct priv *) (dev->priv))->slot,
NULL, NULL);
- kfree_s(dev->priv, sizeof(struct priv));
+ kfree(dev->priv);
dev->priv = NULL;
}
}
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 6e3910172..94a268e01 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -1510,7 +1510,7 @@ void cleanup_module(void)
slot = lp->slot;
mca_mark_as_unused(slot);
mca_set_adapter_name(slot, NULL);
- kfree_s(this_device.priv, sizeof(struct mc32_local));
+ kfree(this_device.priv);
}
free_irq(this_device.irq, &this_device);
}
diff --git a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
index ea256f789..d6a9c505d 100644
--- a/drivers/net/aironet4500_card.c
+++ b/drivers/net/aironet4500_card.c
@@ -244,8 +244,8 @@ static void awc_pci_release(void) {
unregister_netdev(aironet4500_devices[i]);
free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
- kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct net_device));
+ kfree(aironet4500_devices[i]->priv);
+ kfree(aironet4500_devices[i]);
aironet4500_devices[i]=0;
@@ -457,8 +457,8 @@ static void awc_pnp_release(void) {
unregister_netdev(aironet4500_devices[i]);
free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
- kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct net_device));
+ kfree(aironet4500_devices[i]->priv);
+ kfree(aironet4500_devices[i]);
aironet4500_devices[i]=0;
@@ -595,8 +595,8 @@ static void awc_isa_release(void) {
unregister_netdev(aironet4500_devices[i]);
free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
- kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct net_device));
+ kfree(aironet4500_devices[i]->priv);
+ kfree(aironet4500_devices[i]);
aironet4500_devices[i]=0;
@@ -865,8 +865,8 @@ static void awc_i365_release(void) {
unregister_netdev(aironet4500_devices[i]);
- //kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct net_device));
+ //kfree(aironet4500_devices[i]->priv);
+ kfree(aironet4500_devices[i]);
aironet4500_devices[i]=0;
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 76cbf0f89..950bd016c 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -1048,7 +1048,7 @@ void cleanup_module(void)
/* No need to check MOD_IN_USE, as sys_delete_module() checks. */
unregister_netdev(&cops0_dev);
if(cops0_dev.priv)
- kfree_s(cops0_dev.priv, sizeof(struct cops_local));
+ kfree(cops0_dev.priv);
if(cops0_dev.irq)
free_irq(cops0_dev.irq, &cops0_dev);
release_region(cops0_dev.base_addr, COPS_IO_EXTENT);
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index d334df665..df5acebde 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -270,7 +270,7 @@ static int ipddp_delete(struct ipddp_route *rt)
&& tmp->at.s_node == rt->at.s_node)
{
*r = tmp->next;
- kfree_s(tmp, sizeof(struct ipddp_route));
+ kfree(tmp);
return 0;
}
r = &tmp->next;
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index 48cf43deb..14646b686 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -216,7 +216,6 @@
#include <asm/bitops.h>
#include <asm/io.h>
-#include <linux/netdevice.h>
#include <linux/fddidevice.h>
#include <linux/skbuff.h>
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index b62dc591a..196c81126 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -717,7 +717,7 @@ depca_hw_init(struct net_device *dev, u_long ioaddr, int mca_slot)
ether_setup(dev);
} else { /* Incorrectly initialised hardware */
if (dev->priv) {
- kfree_s(dev->priv, sizeof(struct depca_private));
+ kfree(dev->priv);
dev->priv = NULL;
}
}
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index 2a5488a81..882ed0744 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1798,7 +1798,7 @@ cleanup_module(void)
struct net_device *d = &dev_eepro[i];
unregister_netdev(d);
- kfree_s(d->priv,sizeof(struct eepro_local));
+ kfree(d->priv);
d->priv=NULL;
/* If we don't do this, we can't re-insmod it later. */
diff --git a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c
index 83a87a635..309a2c42d 100644
--- a/drivers/net/fc/iph5526.c
+++ b/drivers/net/fc/iph5526.c
@@ -4554,7 +4554,7 @@ int i = 0;
dev_fc[i]->priv = fc[i];
fc[i]->dev = dev_fc[i];
if (register_fcdev(dev_fc[i]) != 0) {
- kfree_s(dev_fc[i], sizeof(struct net_device));
+ kfree(dev_fc[i]);
dev_fc[i] = NULL;
if (i == 0) {
printk("iph5526.c: IP registeration failed!!!\n");
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 7ed3785ff..44abcd416 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -337,7 +337,7 @@ void cleanup_module(void) {
/* Free memory */
first = info->next;
- kfree_s(info, sizeof(struct scc_info));
+ kfree(info);
}
}
@@ -545,7 +545,7 @@ int __init setup_adapter(int card_base, int type, int n) {
if (irq <= 0) {
printk("dmascc: could not find irq of %s at %#3x (irq=%d)\n",
hw[type].name, card_base, irq);
- kfree_s(info, sizeof(struct scc_info));
+ kfree(info);
return -1;
}
diff --git a/drivers/net/hamradio/soundmodem/sm_sbc.c b/drivers/net/hamradio/soundmodem/sm_sbc.c
index 772940049..85ae47588 100644
--- a/drivers/net/hamradio/soundmodem/sm_sbc.c
+++ b/drivers/net/hamradio/soundmodem/sm_sbc.c
@@ -433,13 +433,13 @@ static int sbc_open(struct net_device *dev, struct sm_state *sm)
sm->mode_rx->init(sm);
if (request_dma(dev->dma, sm->hwdrv->hw_name)) {
- kfree_s(sm->dma.obuf, dmasz);
+ kfree(sm->dma.obuf);
return -EBUSY;
}
if (request_irq(dev->irq, sbc_interrupt, SA_INTERRUPT,
sm->hwdrv->hw_name, dev)) {
free_dma(dev->dma);
- kfree_s(sm->dma.obuf, dmasz);
+ kfree(sm->dma.obuf);
return -EBUSY;
}
request_region(dev->base_addr, SBC_EXTENT, sm->hwdrv->hw_name);
diff --git a/drivers/net/hamradio/soundmodem/sm_wss.c b/drivers/net/hamradio/soundmodem/sm_wss.c
index 23abd970a..19840c491 100644
--- a/drivers/net/hamradio/soundmodem/sm_wss.c
+++ b/drivers/net/hamradio/soundmodem/sm_wss.c
@@ -468,13 +468,13 @@ static int wss_open(struct net_device *dev, struct sm_state *sm)
sm->mode_rx->init(sm);
if (request_dma(dev->dma, sm->hwdrv->hw_name)) {
- kfree_s(sm->dma.obuf, dmasz);
+ kfree(sm->dma.obuf);
return -EBUSY;
}
if (request_irq(dev->irq, wss_interrupt, SA_INTERRUPT,
sm->hwdrv->hw_name, dev)) {
free_dma(dev->dma);
- kfree_s(sm->dma.obuf, dmasz);
+ kfree(sm->dma.obuf);
return -EBUSY;
}
request_region(dev->base_addr, WSS_EXTENT, sm->hwdrv->hw_name);
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index a328fde65..d54857bb6 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -3040,7 +3040,7 @@ int init_module( void )
{
/* DeAllocate everything */
/* Note: if dev->priv is mallocated, there is no way to fail */
- kfree_s(hp100_devlist[i], sizeof(struct net_device));
+ kfree(hp100_devlist[i]);
hp100_devlist[i] = (struct net_device *) NULL;
}
else
@@ -3061,12 +3061,12 @@ void cleanup_module( void )
unregister_netdev( hp100_devlist[i] );
release_region( hp100_devlist[i]->base_addr, HP100_REGION_SIZE );
if( ((struct hp100_private *)hp100_devlist[i]->priv)->mode==1 ) /* busmaster */
- kfree_s( ((struct hp100_private *)hp100_devlist[i]->priv)->page_vaddr, MAX_RINGSIZE+0x0f);
+ kfree( ((struct hp100_private *)hp100_devlist[i]->priv)->page_vaddr );
if ( ((struct hp100_private *)hp100_devlist[i]->priv) -> mem_ptr_virt )
iounmap( ((struct hp100_private *)hp100_devlist[i]->priv) -> mem_ptr_virt );
- kfree_s( hp100_devlist[i]->priv, sizeof( struct hp100_private ) );
+ kfree( hp100_devlist[i]->priv );
hp100_devlist[i]->priv = NULL;
- kfree_s(hp100_devlist[i], sizeof(struct net_device));
+ kfree(hp100_devlist[i]);
hp100_devlist[i] = (struct net_device *) NULL;
}
}
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 7be66ce89..776169ae9 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -1252,7 +1252,7 @@ void cleanup_module(void)
#endif
mca_set_adapter_name(priv->slot, "");
mca_set_adapter_procfn(priv->slot, NULL, NULL);
- kfree_s(dev->priv, sizeof(ibmlana_priv));
+ kfree(dev->priv);
dev->priv = NULL;
}
}
diff --git a/drivers/net/pcmcia/aironet4500_cs.c b/drivers/net/pcmcia/aironet4500_cs.c
index d623828b9..45a411a21 100644
--- a/drivers/net/pcmcia/aironet4500_cs.c
+++ b/drivers/net/pcmcia/aironet4500_cs.c
@@ -321,11 +321,11 @@ static void awc_detach(dev_link_t *link)
if (link->priv) {
//struct net_device *dev = link->priv;
// dam dam damn mif (dev->priv)
- // kfree_s(dev->priv, sizeof(struct awc_private));
- kfree_s(link->priv, sizeof(struct net_device));
+ // kfree(dev->priv);
+ kfree(link->priv);
}
- kfree_s(link->dev, sizeof(struct dev_node_t));
- kfree_s(link, sizeof(struct dev_link_t));
+ kfree(link->dev);
+ kfree(link);
} /* awc_detach */
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 85d5c86eb..0c914aec2 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -333,10 +333,10 @@ static void com20020_detach(dev_link_t *link)
kfree(dev);
}
DEBUG(1,"kfree2...\n");
- kfree_s(info, sizeof(struct com20020_dev_t));
+ kfree(info);
}
DEBUG(1,"kfree3...\n");
- kfree_s(link, sizeof(struct dev_link_t));
+ kfree(link);
} /* com20020_detach */
diff --git a/drivers/net/pcmcia/ray_cs.c b/drivers/net/pcmcia/ray_cs.c
index 0408612e6..aeee5e561 100644
--- a/drivers/net/pcmcia/ray_cs.c
+++ b/drivers/net/pcmcia/ray_cs.c
@@ -468,11 +468,11 @@ static void ray_detach(dev_link_t *link)
if (link->priv) {
dev = link->priv;
if (dev->priv)
- kfree_s(dev->priv, sizeof(ray_dev_t));
+ kfree(dev->priv);
- kfree_s(link->priv, sizeof(struct net_device));
+ kfree(link->priv);
}
- kfree_s(link, sizeof(struct dev_link_t));
+ kfree(link);
DEBUG(2,"ray_cs ray_detach ending\n");
} /* ray_detach */
/*=============================================================================
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c
index 97dfb6bd4..793af1577 100644
--- a/drivers/net/sb1000.c
+++ b/drivers/net/sb1000.c
@@ -1243,7 +1243,7 @@ void cleanup_module(void)
unregister_netdev(&dev_sb1000);
release_region(dev_sb1000.base_addr, 16);
release_region(dev_sb1000.rmem_end, 16);
- kfree_s(dev_sb1000.priv, sizeof(struct sb1000_private));
+ kfree(dev_sb1000.priv);
dev_sb1000.priv = NULL;
}
#endif /* MODULE */
diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c
index a98da4115..51688271a 100644
--- a/drivers/net/sk_mca.c
+++ b/drivers/net/sk_mca.c
@@ -1290,7 +1290,7 @@ void cleanup_module(void)
mca_mark_as_unused(priv->slot);
#endif
mca_set_adapter_procfn(priv->slot, NULL, NULL);
- kfree_s(dev->priv, sizeof(skmca_priv));
+ kfree(dev->priv);
dev->priv = NULL;
}
}
diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c
index 776b7a6a6..8d6b193a2 100644
--- a/drivers/net/skeleton.c
+++ b/drivers/net/skeleton.c
@@ -703,7 +703,7 @@ cleanup_module(void)
release_region(this_device.base_addr, NETCARD_IO_EXTENT);
if (this_device.priv)
- kfree_s(this_device.priv, sizeof(struct net_local));
+ kfree(this_device.priv);
}
#endif /* MODULE */
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index 084fd4120..31521cfde 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -1632,7 +1632,7 @@ void cleanup_module(void)
release_region(devSMC9194.base_addr, SMC_IO_EXTENT);
if (devSMC9194.priv)
- kfree_s(devSMC9194.priv, sizeof(struct smc_local));
+ kfree(devSMC9194.priv);
}
#endif /* MODULE */
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index b59414255..fb6d438d0 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -456,7 +456,7 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
while(!isa_readb(ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN))
if (time_after(jiffies, timeout)) {
DPRINTK("Hardware timeout during initialization.\n");
- kfree_s(ti, sizeof(struct tok_info));
+ kfree(ti);
return -ENODEV;
}
@@ -607,7 +607,7 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
break;
default:
DPRINTK("Unknown shared ram paging info %01X\n",ti->shared_ram_paging);
- kfree_s(ti, sizeof(struct tok_info));
+ kfree(ti);
return -ENODEV;
break;
}
@@ -642,7 +642,7 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
DPRINTK("Shared RAM for this adapter (%05x) exceeds driver"
" limit (%05x), adapter not started.\n",
chk_base, ibmtr_mem_base + IBMTR_SHARED_RAM_SIZE);
- kfree_s(ti, sizeof(struct tok_info));
+ kfree(ti);
return -ENODEV;
} else { /* seems cool, record what we have figured out */
ti->sram_base = new_base >> 12;
@@ -660,7 +660,7 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
#ifndef PCMCIA
if (request_irq (dev->irq = irq, &tok_interrupt,0,"ibmtr", dev) != 0) {
DPRINTK("Could not grab irq %d. Halting Token Ring driver.\n",irq);
- kfree_s(ti, sizeof(struct tok_info));
+ kfree(ti);
return -ENODEV;
}
@@ -1885,7 +1885,7 @@ int init_module(void)
dev_ibmtr[i]->init = &ibmtr_probe;
if (register_trdev(dev_ibmtr[i]) != 0) {
- kfree_s(dev_ibmtr[i], sizeof(struct net_device));
+ kfree(dev_ibmtr[i]);
dev_ibmtr[i] = NULL;
if (i == 0) {
printk("ibmtr: register_trdev() returned non-zero.\n");
@@ -1907,8 +1907,8 @@ void cleanup_module(void)
unregister_trdev(dev_ibmtr[i]);
free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]);
release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT);
- kfree_s(dev_ibmtr[i]->priv, sizeof(struct tok_info));
- kfree_s(dev_ibmtr[i], sizeof(struct net_device));
+ kfree(dev_ibmtr[i]->priv);
+ kfree(dev_ibmtr[i]);
dev_ibmtr[i] = NULL;
}
}
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 2ef7ec903..1f2c7035a 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -1764,7 +1764,7 @@ int init_module(void)
dev_streamer[i]->init = &streamer_probe;
if (register_trdev(dev_streamer[i]) != 0) {
- kfree_s(dev_streamer[i], sizeof(struct net_device));
+ kfree(dev_streamer[i]);
dev_streamer[i] = NULL;
if (i == 0)
{
@@ -1790,12 +1790,10 @@ void cleanup_module(void)
unregister_trdev(dev_streamer[i]);
release_region(dev_streamer[i]->base_addr, STREAMER_IO_SPACE);
streamer_priv=(struct streamer_private *)dev_streamer[i]->priv;
- kfree_s(streamer_priv->streamer_rx_ring,
- sizeof(struct streamer_rx_desc)*STREAMER_RX_RING_SIZE);
- kfree_s(streamer_priv->streamer_tx_ring,
- sizeof(struct streamer_tx_desc)*STREAMER_TX_RING_SIZE);
- kfree_s(dev_streamer[i]->priv, sizeof(struct streamer_private));
- kfree_s(dev_streamer[i], sizeof(struct net_device));
+ kfree(streamer_priv->streamer_rx_ring);
+ kfree(streamer_priv->streamer_tx_ring);
+ kfree(dev_streamer[i]->priv);
+ kfree(dev_streamer[i]);
dev_streamer[i] = NULL;
}
#if STREAMER_NETWORK_MONITOR
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 73cd6a194..b8784bb29 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -1628,7 +1628,7 @@ int init_module(void)
dev_olympic[i]->init = &olympic_probe;
if (register_trdev(dev_olympic[i]) != 0) {
- kfree_s(dev_olympic[i], sizeof(struct net_device));
+ kfree(dev_olympic[i]);
dev_olympic[i] = NULL;
if (i == 0) {
printk("Olympic: No IBM PCI Token Ring cards found in system.\n");
@@ -1651,8 +1651,8 @@ void cleanup_module(void)
if (dev_olympic[i]) {
unregister_trdev(dev_olympic[i]);
release_region(dev_olympic[i]->base_addr, OLYMPIC_IO_SPACE);
- kfree_s(dev_olympic[i]->priv, sizeof(struct olympic_private));
- kfree_s(dev_olympic[i], sizeof(struct net_device));
+ kfree(dev_olympic[i]->priv);
+ kfree(dev_olympic[i]);
dev_olympic[i] = NULL;
}
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index e9481039d..83024732a 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3719,7 +3719,7 @@ static int __init smctr_probe1(struct net_device *dev, int ioaddr)
err = smctr_chk_mca(dev);
if(err < 0)
{
- kfree_s(tp, sizeof(struct net_local));
+ kfree(tp);
return (-ENODEV);
}
}
@@ -5830,7 +5830,7 @@ int init_module(void)
if(register_trdev(dev_smctr[i]) != 0)
{
- kfree_s(dev_smctr[i], sizeof(struct net_device));
+ kfree(dev_smctr[i]);
dev_smctr[i] = NULL;
if(i == 0)
{
@@ -5866,9 +5866,8 @@ void cleanup_module(void)
if(dev_smctr[i]->irq)
free_irq(dev_smctr[i]->irq, dev_smctr[i]);
if(dev_smctr[i]->priv)
- kfree_s(dev_smctr[i]->priv,
- sizeof(struct net_local));
- kfree_s(dev_smctr[i], sizeof(struct net_device));
+ kfree(dev_smctr[i]->priv);
+ kfree(dev_smctr[i]);
dev_smctr[i] = NULL;
}
}
diff --git a/drivers/net/wavelan.c b/drivers/net/wavelan.c
index fdfab3edb..1a11b1bd9 100644
--- a/drivers/net/wavelan.c
+++ b/drivers/net/wavelan.c
@@ -4221,7 +4221,7 @@ int init_module(void)
if (register_netdev(dev) != 0) {
/* Deallocate everything. */
/* Note: if dev->priv is mallocated, there is no way to fail. */
- kfree_s(dev, sizeof(struct net_device));
+ kfree(dev);
} else {
/* If at least one device OK, we do not fail */
ret = 0;
@@ -4271,8 +4271,8 @@ void cleanup_module(void)
wavelan_list = wavelan_list->next;
/* Free pieces. */
- kfree_s(dev->priv, sizeof(struct net_local));
- kfree_s(dev, sizeof(struct net_device));
+ kfree(dev->priv);
+ kfree(dev);
}
#ifdef DEBUG_MODULE_TRACE
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 96e35aece..aec5d83af 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -839,7 +839,7 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)
memset(raw, 0, sizeof(raw3215_info));
raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, GFP_KERNEL);
if (raw->buffer == NULL) {
- kfree_s(raw, sizeof(raw3215_info));
+ kfree(raw);
return -ENOMEM;
}
raw->tqueue.routine = raw3215_softint;
diff --git a/drivers/sbus/audio/audio.c b/drivers/sbus/audio/audio.c
index 6ee5c6d3c..46fa74b0c 100644
--- a/drivers/sbus/audio/audio.c
+++ b/drivers/sbus/audio/audio.c
@@ -1,4 +1,4 @@
-/* $Id: audio.c,v 1.53 2000/07/06 01:41:34 davem Exp $
+/* $Id: audio.c,v 1.54 2000/07/13 08:06:40 davem Exp $
* drivers/sbus/audio/audio.c
*
* Copyright 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 7a03036b6..8690638b3 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -1,4 +1,4 @@
-/* $Id: flash.c,v 1.18 2000/06/19 06:24:47 davem Exp $
+/* $Id: flash.c,v 1.19 2000/07/13 08:06:40 davem Exp $
* flash.c: Allow mmap access to the OBP Flash, for OBP updates.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 38e7a2ed0..c38101957 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -600,7 +600,7 @@ static int openprom_open(struct inode * inode, struct file * file)
static int openprom_release(struct inode * inode, struct file * file)
{
- kfree_s(file->private_data, sizeof(DATA));
+ kfree(file->private_data);
return 0;
}
diff --git a/drivers/sbus/char/pcikbd.c b/drivers/sbus/char/pcikbd.c
index ecce4db4b..6ddccf114 100644
--- a/drivers/sbus/char/pcikbd.c
+++ b/drivers/sbus/char/pcikbd.c
@@ -1,4 +1,4 @@
-/* $Id: pcikbd.c,v 1.48 2000/06/19 06:24:47 davem Exp $
+/* $Id: pcikbd.c,v 1.49 2000/07/13 08:06:40 davem Exp $
* pcikbd.c: Ultra/AX PC keyboard support.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c
index 7a02f543f..0702f7a03 100644
--- a/drivers/sbus/char/rtc.c
+++ b/drivers/sbus/char/rtc.c
@@ -1,4 +1,4 @@
-/* $Id: rtc.c,v 1.20 2000/06/19 06:24:47 davem Exp $
+/* $Id: rtc.c,v 1.21 2000/07/13 08:06:40 davem Exp $
*
* Linux/SPARC Real Time Clock Driver
* Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 7b7a59ea2..554a15676 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -238,7 +238,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
if(copy_from_user(buffer, inout.buffer,
inout.len*sizeof(char))) {
- kfree_s(buffer, inout.len * sizeof(char));
+ kfree(buffer);
return -EFAULT;
}
@@ -249,7 +249,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
inout.buffer,inout.len);
if (copy_to_user((void *)arg,&inout,sizeof(inout))) {
- kfree_s(buffer, inout.len);
+ kfree(buffer);
return -EFAULT;
}
vfc_unlock_device(dev);
@@ -271,14 +271,14 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
vfc_unlock_device(dev);
if (copy_to_user(inout.buffer, buffer, inout.len)) {
- kfree_s(buffer,inout.len);
+ kfree(buffer);
return -EFAULT;
}
if (copy_to_user((void *)arg,&inout,sizeof(inout))) {
- kfree_s(buffer,inout.len);
+ kfree(buffer);
return -EFAULT;
}
- kfree_s(buffer,inout.len);
+ kfree(buffer);
break;
default:
return -EINVAL;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index fd705d425..4bbfd56bf 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -557,7 +557,9 @@ static int scan_scsis_single(int channel, int dev, int lun, int *max_dev_lun,
memcpy(SDpnt->rev, scsi_result + 32, 4);
SDpnt->removable = (0x80 & scsi_result[1]) >> 7;
- SDpnt->online = TRUE;
+ /* Use the peripheral qualifier field to determine online/offline */
+ if (((scsi_result[0] >> 5) & 7) == 1) SDpnt->online = FALSE;
+ else SDpnt->online = TRUE;
SDpnt->lockable = SDpnt->removable;
SDpnt->changed = 0;
SDpnt->access_count = 0;
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index cd3f7a488..c5680bca3 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -109,26 +109,26 @@ static void sr_release(struct cdrom_device_info *cdi)
static struct cdrom_device_ops sr_dops =
{
- sr_open, /* open */
- sr_release, /* release */
- sr_drive_status, /* drive status */
- sr_media_change, /* media changed */
- sr_tray_move, /* tray move */
- sr_lock_door, /* lock door */
- sr_select_speed, /* select speed */
- NULL, /* select disc */
- sr_get_last_session, /* get last session */
- sr_get_mcn, /* get universal product code */
- sr_reset, /* hard reset */
- sr_audio_ioctl, /* audio ioctl */
- sr_dev_ioctl, /* device-specific ioctl */
- CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_SELECT_SPEED |
- CDC_SELECT_DISC | CDC_MULTI_SESSION | CDC_MCN | CDC_MEDIA_CHANGED |
- CDC_PLAY_AUDIO | CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS |
- CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM |
- CDC_GENERIC_PACKET,
- 0,
- sr_packet
+ open: sr_open,
+ release: sr_release,
+ drive_status: sr_drive_status,
+ media_changed: sr_media_change,
+ tray_move: sr_tray_move,
+ lock_door: sr_lock_door,
+ select_speed: sr_select_speed,
+ get_last_session: sr_get_last_session,
+ get_mcn: sr_get_mcn,
+ reset: sr_reset,
+ audio_ioctl: sr_audio_ioctl,
+ dev_ioctl: sr_dev_ioctl,
+ capability: CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK |
+ CDC_SELECT_SPEED | CDC_SELECT_DISC |
+ CDC_MULTI_SESSION | CDC_MCN |
+ CDC_MEDIA_CHANGED | CDC_PLAY_AUDIO |
+ CDC_RESET | CDC_IOCTLS | CDC_DRIVE_STATUS |
+ CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R |
+ CDC_DVD_RAM | CDC_GENERIC_PACKET,
+ generic_packet: sr_packet,
};
/*
diff --git a/drivers/sound/cmpci.c b/drivers/sound/cmpci.c
index cc55d508e..e97721044 100644
--- a/drivers/sound/cmpci.c
+++ b/drivers/sound/cmpci.c
@@ -2478,7 +2478,7 @@ int __init init_cmpci(void)
release_region(s->iomidi, CM_EXTENT_MIDI);
release_region(s->iobase, CM_EXTENT_CODEC);
err_region5:
- kfree_s(s, sizeof(struct cm_state));
+ kfree(s);
}
if (!devs) {
if (wavetable_mem)
@@ -2522,7 +2522,7 @@ void cleanup_module(void)
}
unregister_sound_dsp(s->dev_audio);
unregister_sound_mixer(s->dev_mixer);
- kfree_s(s, sizeof(struct cm_state));
+ kfree(s);
}
if (wavetable_mem)
free_pages(wavetable_mem, 20-PAGE_SHIFT);
diff --git a/drivers/sound/es1370.c b/drivers/sound/es1370.c
index ae004f10f..e6c5945cb 100644
--- a/drivers/sound/es1370.c
+++ b/drivers/sound/es1370.c
@@ -2595,7 +2595,7 @@ static int __devinit es1370_probe(struct pci_dev *pcidev, const struct pci_devic
err_irq:
release_region(s->io, ES1370_EXTENT);
err_region:
- kfree_s(s, sizeof(struct es1370_state));
+ kfree(s);
return -1;
}
@@ -2615,7 +2615,7 @@ static void __devinit es1370_remove(struct pci_dev *dev)
unregister_sound_mixer(s->dev_mixer);
unregister_sound_dsp(s->dev_dac);
unregister_sound_midi(s->dev_midi);
- kfree_s(s, sizeof(struct es1370_state));
+ kfree(s);
dev->driver_data = NULL;
}
diff --git a/drivers/sound/es1371.c b/drivers/sound/es1371.c
index 58d7923ab..5a2cc9574 100644
--- a/drivers/sound/es1371.c
+++ b/drivers/sound/es1371.c
@@ -2866,7 +2866,7 @@ static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_devic
err_irq:
release_region(s->io, ES1371_EXTENT);
err_region:
- kfree_s(s, sizeof(struct es1371_state));
+ kfree(s);
return -1;
}
@@ -2890,7 +2890,7 @@ static void __devinit es1371_remove(struct pci_dev *dev)
unregister_sound_mixer(s->codec.dev_mixer);
unregister_sound_dsp(s->dev_dac);
unregister_sound_midi(s->dev_midi);
- kfree_s(s, sizeof(struct es1371_state));
+ kfree(s);
dev->driver_data = NULL;
}
diff --git a/drivers/sound/esssolo1.c b/drivers/sound/esssolo1.c
index e2e0c3b12..6a1623cf0 100644
--- a/drivers/sound/esssolo1.c
+++ b/drivers/sound/esssolo1.c
@@ -2321,7 +2321,7 @@ static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device
err_region2:
release_region(s->mpubase, MPUBASE_EXTENT);
err_region1:
- kfree_s(s, sizeof(struct solo1_state));
+ kfree(s);
return -1;
}
@@ -2347,7 +2347,7 @@ static void __devinit solo1_remove(struct pci_dev *dev)
unregister_sound_mixer(s->dev_mixer);
unregister_sound_midi(s->dev_midi);
unregister_sound_special(s->dev_dmfm);
- kfree_s(s, sizeof(struct solo1_state));
+ kfree(s);
dev->driver_data = NULL;
}
diff --git a/drivers/sound/maestro.c b/drivers/sound/maestro.c
index cc54f784c..429f0055f 100644
--- a/drivers/sound/maestro.c
+++ b/drivers/sound/maestro.c
@@ -224,7 +224,6 @@
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/ioport.h>
-#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/sound.h>
#include <linux/malloc.h>
diff --git a/drivers/sound/nm256_audio.c b/drivers/sound/nm256_audio.c
index 887f4f53e..e9ec909f6 100644
--- a/drivers/sound/nm256_audio.c
+++ b/drivers/sound/nm256_audio.c
@@ -1066,7 +1066,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
/* Yuck. But we have to map in port 2 so we can check how much RAM the
card has. */
if (nm256_remap_ports (card)) {
- kfree_s (card, sizeof (struct nm256_info));
+ kfree (card);
return 0;
}
@@ -1092,7 +1092,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
printk (KERN_ERR " IRQ and/or DMA for the sound card, this is *not* the correct\n");
printk (KERN_ERR " driver to use.)\n");
nm256_release_ports (card);
- kfree_s (card, sizeof (struct nm256_info));
+ kfree (card);
return 0;
}
else {
@@ -1130,7 +1130,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
card->port[0].start_offset, card->port[0].end_offset);
if (nm256_remap_ports (card)) {
- kfree_s (card, sizeof (struct nm256_info));
+ kfree (card);
return 0;
}
@@ -1141,7 +1141,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
if (nm256_grabInterrupt (card) != 0) {
nm256_release_ports (card);
- kfree_s (card, sizeof (struct nm256_info));
+ kfree (card);
return 0;
}
@@ -1194,7 +1194,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
else {
printk(KERN_ERR "NM256: Too many PCM devices available\n");
nm256_release_ports (card);
- kfree_s (card, sizeof (struct nm256_info));
+ kfree (card);
return 0;
}
}
@@ -1680,7 +1680,7 @@ static void __exit cleanup_nm256 (void)
sound_unload_audiodev (card->dev[0]);
sound_unload_audiodev (card->dev[1]);
next_card = card->next_card;
- kfree_s (card, sizeof (struct nm256_info));
+ kfree (card);
}
nmcard_list = NULL;
}
diff --git a/drivers/sound/sonicvibes.c b/drivers/sound/sonicvibes.c
index 8a082552a..6b51468b3 100644
--- a/drivers/sound/sonicvibes.c
+++ b/drivers/sound/sonicvibes.c
@@ -2609,7 +2609,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id
err_region4:
release_region(s->ioenh, SV_EXTENT_ENH);
err_region5:
- kfree_s(s, sizeof(struct sv_state));
+ kfree(s);
return -1;
}
@@ -2636,7 +2636,7 @@ static void __devinit sv_remove(struct pci_dev *dev)
unregister_sound_mixer(s->dev_mixer);
unregister_sound_midi(s->dev_midi);
unregister_sound_special(s->dev_dmfm);
- kfree_s(s, sizeof(struct sv_state));
+ kfree(s);
dev->driver_data = NULL;
}
diff --git a/drivers/usb/Config.in b/drivers/usb/Config.in
index 7e29c7807..51229c0c0 100644
--- a/drivers/usb/Config.in
+++ b/drivers/usb/Config.in
@@ -59,10 +59,10 @@ comment 'USB Devices'
dep_tristate ' USB Kodak DC-2xx Camera support' CONFIG_USB_DC2XX $CONFIG_USB
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
dep_tristate ' USB Mustek MDC800 Digital Camera support (EXPERIMENTAL)' CONFIG_USB_MDC800 $CONFIG_USB
- dep_tristate ' USB Mass Storage support (EXPERIMENTAL)' CONFIG_USB_STORAGE $CONFIG_USB $CONFIG_SCSI
- if [ "$CONFIG_USB_STORAGE" != "n" ]; then
- bool ' USB Mass Storage verbose debug' CONFIG_USB_STORAGE_DEBUG
- fi
+ fi
+ dep_tristate ' USB Mass Storage support' CONFIG_USB_STORAGE $CONFIG_USB $CONFIG_SCSI
+ if [ "$CONFIG_USB_STORAGE" != "n" ]; then
+ bool ' USB Mass Storage verbose debug' CONFIG_USB_STORAGE_DEBUG
fi
dep_tristate ' USS720 parport driver' CONFIG_USB_USS720 $CONFIG_USB $CONFIG_PARPORT
dep_tristate ' DABUSB driver' CONFIG_USB_DABUSB $CONFIG_USB
diff --git a/drivers/usb/microtek.c b/drivers/usb/microtek.c
index 70a50d91f..a3de2b732 100644
--- a/drivers/usb/microtek.c
+++ b/drivers/usb/microtek.c
@@ -151,18 +151,18 @@ static struct usb_driver mts_usb_driver = {
#define MTS_NAME "microtek usb (rev " MTS_VERSION "): "
#define MTS_WARNING(x...) \
- printk( KERN_WARNING MTS_NAME ## x )
+ printk( KERN_WARNING MTS_NAME x )
#define MTS_ERROR(x...) \
- printk( KERN_ERR MTS_NAME ## x )
+ printk( KERN_ERR MTS_NAME x )
#define MTS_INT_ERROR(x...) \
- MTS_ERROR( ## x )
+ MTS_ERROR(x)
#define MTS_MESSAGE(x...) \
- printk( KERN_INFO MTS_NAME ## x )
+ printk( KERN_INFO MTS_NAME x )
#if defined MTS_DO_DEBUG
#define MTS_DEBUG(x...) \
- printk( KERN_DEBUG MTS_NAME ## x )
+ printk( KERN_DEBUG MTS_NAME x )
#define MTS_DEBUG_GOT_HERE() \
MTS_DEBUG("got to %s:%d (%s)\n", __FILE__, (int)__LINE__, __PRETTY_FUNCTION__ )
diff --git a/drivers/usb/ov511.c b/drivers/usb/ov511.c
index 1862415fa..462a49957 100644
--- a/drivers/usb/ov511.c
+++ b/drivers/usb/ov511.c
@@ -30,7 +30,7 @@
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-static const char version[] = "1.19";
+static const char version[] = "1.20";
#define __NO_VERSION__
@@ -101,6 +101,12 @@ static int force_rgb = 0;
/* Number of seconds before inactive buffers are deallocated */
static int buf_timeout = 5;
+/* Number of cameras to stream from simultaneously */
+static int cams = 1;
+
+/* Prevent apps from timing out if frame is not done in time */
+static int retry_sync = 0;
+
MODULE_PARM(autoadjust, "i");
MODULE_PARM(debug, "i");
MODULE_PARM(fix_rgb_offset, "i");
@@ -110,6 +116,8 @@ MODULE_PARM(i2c_detect_tries, "i");
MODULE_PARM(aperture, "i");
MODULE_PARM(force_rgb, "i");
MODULE_PARM(buf_timeout, "i");
+MODULE_PARM(cams, "i");
+MODULE_PARM(retry_sync, "i");
MODULE_AUTHOR("Mark McClelland <mmcclelland@delphi.com> & Bret Wallach & Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha <cpbotha@ieee.org> & Claudio Matsuoka <claudio@conectiva.com>");
MODULE_DESCRIPTION("OV511 USB Camera Driver");
@@ -1676,7 +1684,7 @@ static void ov511_isoc_irq(struct urb *urb)
static int ov511_init_isoc(struct usb_ov511 *ov511)
{
urb_t *urb;
- int fx, err, n;
+ int fx, err, n, size;
PDEBUG(3, "*** Initializing capture ***");
@@ -1686,11 +1694,29 @@ static int ov511_init_isoc(struct usb_ov511 *ov511)
ov511->scratchlen = 0;
if (ov511->bridge == BRG_OV511)
- ov511_set_packet_size(ov511, 993);
+ if (cams == 1) size = 993;
+ else if (cams == 2) size = 513;
+ else if (cams == 3 || cams == 4) size = 257;
+ else {
+ err("\"cams\" parameter too high!");
+ return -1;
+ }
else if (ov511->bridge == BRG_OV511PLUS)
- ov511_set_packet_size(ov511, 961);
- else
+ if (cams == 1) size = 961;
+ else if (cams == 2) size = 513;
+ else if (cams == 3 || cams == 4) size = 257;
+ else if (cams >= 5 && cams <= 8) size = 129;
+ else if (cams >= 9 && cams <= 31) size = 33;
+ else {
+ err("\"cams\" parameter too high!");
+ return -1;
+ }
+ else {
err("invalid bridge type");
+ return -1;
+ }
+
+ ov511_set_packet_size(ov511, size);
for (n = 0; n < OV511_NUMSBUF; n++) {
urb = usb_alloc_urb(FRAMES_PER_DESC);
@@ -2085,11 +2111,15 @@ static int ov511_ioctl(struct video_device *vdev, unsigned int cmd, void *arg)
if (copy_from_user(&p, arg, sizeof(p)))
return -EFAULT;
+ if (p.palette != VIDEO_PALETTE_GREY &&
+ p.palette != VIDEO_PALETTE_RGB24 &&
+ p.palette != VIDEO_PALETTE_YUV422 &&
+ p.palette != VIDEO_PALETTE_YUV422P)
+ return -EINVAL;
+
if (ov7610_set_picture(ov511, &p))
return -EIO;
- /* FIXME: check validity */
-
PDEBUG(4, "Setting depth=%d, palette=%d", p.depth, p.palette);
for (i = 0; i < OV511_NUMFRAMES; i++) {
ov511->frame[i].depth = p.depth;
@@ -2294,8 +2324,23 @@ redo:
init_waitqueue_head(&ov511->frame[frame].wq);
#endif
interruptible_sleep_on(&ov511->frame[frame].wq);
- if (signal_pending(current))
- return -EINTR;
+ if (signal_pending(current)) {
+ if (retry_sync) {
+ PDEBUG(3, "***retry sync***");
+
+ /* Polling apps will destroy frames with that! */
+ ov511_new_frame(ov511, frame);
+ ov511->curframe = -1;
+
+ /* This will request another frame. */
+ if (waitqueue_active(&ov511->frame[frame].wq))
+ wake_up_interruptible(&ov511->frame[frame].wq);
+
+ return 0;
+ } else {
+ return -EINTR;
+ }
+ }
} while (ov511->frame[frame].grabstate == FRAME_GRABBING);
if (ov511->frame[frame].grabstate == FRAME_ERROR) {
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 6bd9074a9..397e2bf48 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -22,9 +22,9 @@
Tip 'o the hat to Linuxcare for supporting staff in their work on
open source projects.
- Sat Jul 8 11:11:48 EST 2000 Hugh
- First public release - nothing works except the firmware upload.
- Tested on PPC and x86 architectures, seems to behave...
+ Tue Jul 18 16:14:52 EST 2000 Hugh
+ Basic character input/output for USA-19 now mostly works,
+ fixed at 9600 baud for the moment.
*/
@@ -55,94 +55,45 @@
#include <linux/usb.h>
#include "usb-serial.h"
-
-struct ezusb_hex_record {
- __u16 address;
- __u8 data_size;
- __u8 data[16];
+#include "keyspan.h"
+
+ /* Per device and per port private data */
+struct keyspan_serial_private {
+ struct urb *in_urbs[8];
+ struct urb *out_urbs[8];
+ char out_buffer[64];
+ char in_buffer[64];
};
- /* Conditionally include firmware images, if they aren't
- included create a null pointer instead. Current
- firmware images aren't optimised to remove duplicate
- addresses. */
-#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
- #include "keyspan_usa28_fw.h"
-#else
- static const struct ezusb_hex_record *keyspan_usa28_firmware = NULL;
-#endif
+struct keyspan_port_private {
+ /* Keep track of which output endpoint to use */
+ int out_flip;
-#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28X
- #include "keyspan_usa28x_fw.h"
-#else
- static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
-#endif
+ /* Settings for the port */
+ int baud;
+ int old_baud;
+ enum {parity_none, parity_odd, parity_even} parity;
+ enum {flow_none, flow_cts, flow_xon} flow_control;
+ int rts_state;
+ int dtr_state;
-#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
- #include "keyspan_usa19_fw.h"
-#else
- static const struct ezusb_hex_record *keyspan_usa19_firmware = NULL;
-#endif
-
-#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA18X
- #include "keyspan_usa18x_fw.h"
-#else
- static const struct ezusb_hex_record *keyspan_usa18x_firmware = NULL;
-#endif
+};
-#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19W
- #include "keyspan_usa19w_fw.h"
-#else
- static const struct ezusb_hex_record *keyspan_usa19w_firmware = NULL;
-#endif
- /* Include Keyspan message headers (not here yet, need some tweaks
+ /* FIXME this will break if multiple physical interfaces used */
+static wait_queue_head_t out_wait;
+
+ /* Include Keyspan message headers (not both yet, need some tweaks
to get clean build) */
/*#include "keyspan_usa26msg.h"*/
-/*#include "keyspan_usa28msg.h"*/
+#include "keyspan_usa28msg.h"
/* If you don't get debugging output, uncomment the following
two lines to enable cheat. */
#undef dbg
#define dbg printk
-
- /* function prototypes for Keyspan serial converter */
-static int keyspan_open (struct usb_serial_port *port,
- struct file *filp);
-static void keyspan_close (struct usb_serial_port *port,
- struct file *filp);
-static int keyspan_startup (struct usb_serial *serial);
-static void keyspan_shutdown (struct usb_serial *serial);
-static void keyspan_rx_interrupt (struct urb *urb);
-static void keyspan_rx_throttle (struct usb_serial_port *port);
-static void keyspan_rx_unthrottle (struct usb_serial_port *port);
-static int keyspan_write_room (struct usb_serial_port *port);
-static int keyspan_write (struct usb_serial_port *port,
- int from_user,
- const unsigned char *buf,
- int count);
-static void keyspan_write_bulk_callback (struct urb *urb);
-static int keyspan_chars_in_buffer (struct usb_serial_port *port);
-static int keyspan_ioctl (struct usb_serial_port *port,
- struct file *file,
- unsigned int cmd,
- unsigned long arg);
-static void keyspan_set_termios (struct usb_serial_port *port,
- struct termios *old);
-static void keyspan_break_ctl (struct usb_serial_port *port,
- int break_state);
-static int keyspan_fake_startup (struct usb_serial *serial);
-
-
/* Functions - mostly stubs for now */
-
-static void keyspan_rx_interrupt (struct urb *urb)
-{
-
-}
-
-
static void keyspan_rx_throttle (struct usb_serial_port *port)
{
dbg("keyspan_rx_throttle port %d", port->number);
@@ -170,8 +121,23 @@ static void keyspan_set_termios (struct usb_serial_port *port,
static int keyspan_ioctl(struct usb_serial_port *port, struct file *file,
unsigned int cmd, unsigned long arg)
{
+ unsigned int value;
dbg("keyspan_ioctl_info");
+
+ switch (cmd) {
+ case TIOCMGET:
+ value = TIOCM_DTR | TIOCM_RNG;
+ if (copy_to_user((unsigned int *)arg, &value, sizeof(int))) {
+ return -EFAULT;
+ }
+ else {
+ return 0;
+ }
+
+ default:
+ return -ENOIOCTLCMD;
+ }
return -ENOIOCTLCMD;
}
@@ -179,22 +145,151 @@ static int keyspan_ioctl(struct usb_serial_port *port, struct file *file,
static int keyspan_write(struct usb_serial_port *port, int from_user,
const unsigned char *buf, int count)
{
- dbg("keyspan_write called\n");
- return(count);
+ struct usb_serial *serial = port->serial;
+ struct keyspan_serial_private *s_priv;
+ struct keyspan_port_private *p_priv;
+ int current_urb;
+ int i;
+
+ s_priv = (struct keyspan_serial_private *)(serial->private);
+ p_priv = (struct keyspan_port_private *)(port->private);
+
+ if (p_priv->out_flip == 0) {
+ current_urb = 0;
+ p_priv->out_flip = 1;
+ }
+ else {
+ current_urb = 1;
+ p_priv->out_flip = 0;
+ }
+
+ dbg("keyspan_write called for port %d (%d) chars {", port->number, count);
+ for (i = 0; i < count ; i++) {
+ dbg("%02x ", buf[i]);
+ }
+ dbg("}\n");
+
+ if (count == 0) {
+ dbg("write request of 0 bytes");
+ return (0);
+ }
+
+ /* only send data if we have a bulk out endpoint */
+ if (s_priv->out_urbs[current_urb]) {
+ while (s_priv->out_urbs[current_urb]->status == -EINPROGRESS) {
+ dbg (__FUNCTION__ " INPROGRES\n");
+ interruptible_sleep_on(&out_wait);
+ if (signal_pending(current)) {
+ dbg (__FUNCTION__ " signal\n");
+ return (-ERESTARTSYS);
+ }
+ }
+ /*if (s_priv->out_urbs[current_urb]->status == -EINPROGRESS) {
+ dbg ("already writing");
+ return (-EAGAIN);
+ }*/
+ /* First byte in buffer is "last flag" - unused so
+ for now so set to zero */
+ memset(s_priv->out_urbs[current_urb]->transfer_buffer, 0, 1);
+
+ if (from_user) {
+ copy_from_user(s_priv->out_urbs[current_urb]->transfer_buffer + 1, buf, count);
+ }
+ else {
+ memcpy (s_priv->out_urbs[current_urb]->transfer_buffer + 1, buf, count);
+ }
+
+ /* send the data out the bulk port */
+ s_priv->out_urbs[current_urb]->transfer_buffer_length = count + 1;
+
+ if (usb_submit_urb(s_priv->out_urbs[current_urb])) {
+ dbg("usb_submit_urb(write bulk) failed");
+ }
+
+ return (count);
+ }
+
+ /* no bulk out, so return 0 bytes written */
+ return (0);
}
static void keyspan_write_bulk_callback (struct urb *urb)
{
+ int endpoint;
+
+ endpoint = usb_pipeendpoint(urb->pipe);
+
+ dbg("keyspan_write_bulk_callback for endpoint %d\n", endpoint);
+
+ /* Only do wakeup if this callback is from one of the data
+ endpoints. */
+ if (endpoint == 2 || endpoint == 3) {
+ wake_up_interruptible(&out_wait);
+ }
- dbg("keyspan_write_bulk_callback called\n");
}
+static void keyspan_read_bulk_callback (struct urb *urb)
+{
+ int i;
+ int endpoint;
+ struct usb_serial *serial;
+ struct usb_serial_port *port;
+ struct tty_struct *tty;
+ unsigned char *data = urb->transfer_buffer;
+
+ endpoint = usb_pipeendpoint(urb->pipe);
+
+
+ if (urb->status) {
+ dbg(__FUNCTION__ "nonzero status: %x on endpoint %d.\n",
+ urb->status, endpoint);
+ return;
+ }
+
+ switch (endpoint) {
+
+ /* If this is one of the data endpoints, stuff it's
+ contents into the tty flip_buffer. */
+ case 1:
+ case 2: serial = (struct usb_serial *) urb->context;
+ port = &serial->port[0];
+ tty = port->tty;
+ if (urb->actual_length) {
+ for (i = 0; i < urb->actual_length ; ++i) {
+ tty_insert_flip_char(tty, data[i], 0);
+ }
+ tty_flip_buffer_push(tty);
+ }
+ break;
+
+ /* INACK endpoint */
+ case 3: dbg(__FUNCTION__ " callback for INACK endpoint\n");
+ break;
+
+ /* INSTAT endpoint */
+ case 4: dbg(__FUNCTION__ " callback for INSTAT endpoint\n");
+ break;
+
+ default:
+ dbg(__FUNCTION__ " callback for unknown endpoint!\n");
+ break;
+ }
+
+ /* Resubmit urb so we continue receiving */
+ if (usb_submit_urb(urb)) {
+ dbg(__FUNCTION__ "resubmit read urb failed.\n");
+ }
+ return;
+
+}
+
static int keyspan_write_room (struct usb_serial_port *port)
{
- dbg("keyspan_write_room called\n");
- return (1);
+// dbg("keyspan_write_room called\n");
+ return (32);
}
@@ -207,13 +302,64 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port)
static int keyspan_open (struct usb_serial_port *port, struct file *filp)
{
- dbg("keyspan_open called\n");
+ struct keyspan_port_private *p_priv;
+ struct keyspan_serial_private *s_priv;
+ struct usb_serial *serial = port->serial;
+ int i;
+
+ s_priv = (struct keyspan_serial_private *)(serial->private);
+ p_priv = (struct keyspan_port_private *)(port->private);
+
+ dbg("keyspan_open called.\n");
+
+ if (port->active) {
+ dbg(__FUNCTION__ "port->active already true!\n");
+ return (-EINVAL);
+ }
+
+ p_priv = (struct keyspan_port_private *)(port->private);
+
+ p_priv->out_flip = 0;
+ port->active = 1;
+
+ /* Start reading from port */
+ for (i = 0; i < 4; i++) {
+ if (s_priv->in_urbs[i]) {
+ if (usb_submit_urb(s_priv->in_urbs[i])) {
+ dbg(__FUNCTION__ " submit in urb %d failed", i);
+ }
+ }
+
+ }
+
+ keyspan_usa19_send_setup(serial, port);
+
return (0);
}
static void keyspan_close(struct usb_serial_port *port, struct file *filp)
{
+ int i;
+ struct usb_serial *serial = port->serial; /* FIXME should so sanity check */
+ struct keyspan_serial_private *s_priv;
+
+ s_priv = (struct keyspan_serial_private *)(serial->private);
+
+ /* Stop reading/writing urbs */
+ for (i = 0; i < 4; i++) {
+ if (s_priv->in_urbs[i]) {
+ usb_unlink_urb(s_priv->in_urbs[i]);
+ }
+
+ }
+ for (i = 0; i < 3; i++) {
+ if (s_priv->out_urbs[i]) {
+ usb_unlink_urb(s_priv->out_urbs[i]);
+ }
+
+ }
+ port->active = 0;
dbg("keyspan_close called\n");
}
@@ -283,230 +429,261 @@ static int keyspan_fake_startup (struct usb_serial *serial)
}
record++;
}
- /* bring device out of reset. Renumeration will occur in a moment
- and the new device will bind to the real driver */
+ /* bring device out of reset. Renumeration will occur in a
+ moment and the new device will bind to the real driver */
response = ezusb_set_reset(serial, 0);
- /* we want this device to fail to have a driver assigned to it. */
+ /* we don't want this device to have a driver assigned to it. */
return (1);
}
-
- /* Gets called by the "real" driver (ie once firmware is loaded
- and renumeration has taken place. */
-static int keyspan_startup (struct usb_serial *serial)
+ /* USA-19 uses three output endpoints and four input
+ endpoints. First two output endpoints are for
+ data (used in an alternating fashion), the third is
+ output control. First two input endpoints are for
+ data (again alternating), the third is the ACK
+ endpoint, the fourth is input status. */
+static void keyspan_usa19_setup_urbs(struct usb_serial *serial)
{
- dbg("keyspan_startup called.\n");
+ struct keyspan_serial_private *s_priv;
+ int i;
- return (0);
+ s_priv = (struct keyspan_serial_private *)(serial->private);
+
+ /* Output urbs first */
+ dbg(__FUNCTION__ "Allocating output urbs.\n");
+ for (i = 0; i < 3; i++) {
+
+ s_priv->out_urbs[i] = usb_alloc_urb (0); /* No ISO */
+ if (!s_priv->out_urbs[i]) {
+ dbg (__FUNCTION__ "Alloc for %d out urb failed.\n", i);
+ return;
+ }
+
+ FILL_BULK_URB(s_priv->out_urbs[i], serial->dev,
+ usb_sndbulkpipe(serial->dev, i + 1),
+ &s_priv->out_buffer[i], sizeof(s_priv->out_buffer[i]),
+ keyspan_write_bulk_callback,
+ serial);
+ }
+
+ /* Now input urbs */
+ dbg(__FUNCTION__ "Allocating input urbs.\n");
+ for (i = 0; i < 4; i++) {
+
+ s_priv->in_urbs[i] = usb_alloc_urb (0); /* No ISO */
+ if (!s_priv->in_urbs[i]) {
+ dbg (__FUNCTION__ "Alloc for %d in urb failed.\n", i);
+ return;
+ }
+
+ FILL_BULK_URB(s_priv->in_urbs[i], serial->dev,
+ usb_rcvbulkpipe(serial->dev, i + 0x81),
+ &s_priv->in_buffer[i], sizeof(s_priv->in_buffer[i]),
+ keyspan_read_bulk_callback,
+ serial);
+ }
+
}
-static void keyspan_shutdown (struct usb_serial *serial)
+static int keyspan_usa19_calc_baud(u32 baud_rate, u8 *rate_hi, u8 *rate_low)
{
- dbg("keyspan_shutdown called.\n");
+ u32 b16, /* baud rate times 16 (actual rate used internally) */
+ div, /* divisor */
+ cnt; /* inverse of divisor (programmed into 8051) */
+
+ /* prevent divide by zero... */
+ if( (b16 = (baud_rate * 16L)) == 0) {
+ return (KEYSPAN_INVALID_BAUD_RATE);
+ }
+
+ /* calculate the divisor and the counter (its inverse) */
+ if( (div = (USA19_BAUDCLK / b16)) == 0) {
+ return (KEYSPAN_INVALID_BAUD_RATE);
+ }
+ else {
+ cnt = 0 - div;
+ }
+
+ if(div > 0xffff) {
+ return (KEYSPAN_INVALID_BAUD_RATE);
+ }
+
+ /* return the counter values */
+ *rate_low = (u8) (cnt & 0xff);
+ *rate_hi = (u8) ((cnt >> 8) & 0xff);
+ dbg(__FUNCTION__ " Baud rate of %d is %02x %02x.\n", baud_rate, *rate_hi, *rate_low);
+
+ return (KEYSPAN_BAUD_RATE_OK);
}
- /* Miscellaneous defines, datastructures etc. */
-
-#define KEYSPAN_VENDOR_ID 0x06cd
-
- /* Device info needed for the Keyspan serial converter */
-static __u16 keyspan_vendor_id = KEYSPAN_VENDOR_ID;
-
- /* Product IDs for the five products supported, pre-renumeration */
-static __u16 keyspan_usa18x_pre_product_id = 0x0105;
-static __u16 keyspan_usa19_pre_product_id = 0x0103;
-static __u16 keyspan_usa19w_pre_product_id = 0x0106;
-static __u16 keyspan_usa28_pre_product_id = 0x0101;
-static __u16 keyspan_usa28x_pre_product_id = 0x0102;
-
- /* Product IDs post-renumeration */
-static __u16 keyspan_usa18x_product_id = 0x0112;
-static __u16 keyspan_usa19_product_id = 0x0107;
-static __u16 keyspan_usa19w_product_id = 0x0108;
-static __u16 keyspan_usa28_product_id = 0x010f;
-static __u16 keyspan_usa28x_product_id = 0x0110;
-
- /* Structs for the devices, pre and post renumeration.
- These are incomplete at present - HAB 20000708 */
-struct usb_serial_device_type keyspan_usa18x_pre_device = {
- name: "Keyspan USA18X - (prerenumeration)",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa18x_pre_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 1,
- startup: keyspan_fake_startup
-};
+static int keyspan_usa19_send_setup(struct usb_serial *serial, struct usb_serial_port *port)
+{
+ struct portControlMessage msg;
+ struct keyspan_serial_private *s_priv;
+ struct keyspan_port_private *p_priv;
-struct usb_serial_device_type keyspan_usa19_pre_device = {
- name: "Keyspan USA19 - (prerenumeration)",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa19_pre_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 1,
- startup: keyspan_fake_startup
-};
+ s_priv = (struct keyspan_serial_private *)(serial->private);
+ p_priv = (struct keyspan_port_private *)(port->private);
+ //memset(msg, 0, sizeof (struct portControlMessage));
+
+ msg.setBaudRate = 1;
+ if (keyspan_usa19_calc_baud(9600, &msg.baudHi, &msg.baudLo) ==
+ KEYSPAN_INVALID_BAUD_RATE ) {
+ dbg(__FUNCTION__ "Invalid baud rate requested %d.\n", 9600);
+ msg.baudLo = 0xff;
+ msg.baudHi = 0xb2; /* Values for 9600 baud */
+ }
-struct usb_serial_device_type keyspan_usa19w_pre_device = {
- name: "Keyspan USA19W - (prerenumeration)",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa19w_pre_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 1,
- startup: keyspan_fake_startup
-};
+ /* If parity is enabled, we must calculate it ourselves. */
+ if (p_priv->parity) {
+ msg.parity = 1;
+ }
+ else {
+ msg.parity = 0;
+ }
+ msg.ctsFlowControl = 0;
+ msg.xonFlowControl = 0;
+ msg.rts = 1;
+ msg.dtr = 0;
+
+ msg.forwardingLength = 1;
+ msg.forwardMs = 10;
+ msg.breakThreshold = 45;
+ msg.xonChar = 17;
+ msg.xoffChar = 19;
+
+ msg._txOn = 1;
+ msg._txOff = 0;
+ msg.txFlush = 0;
+ msg.txForceXoff = 0;
+ msg.txBreak = 0;
+ msg.rxOn = 1;
+ msg.rxOff = 0;
+ msg.rxFlush = 0;
+ msg.rxForward = 0;
+ msg.returnStatus = 1;
+ msg.resetDataToggle = 1;
-struct usb_serial_device_type keyspan_usa28_pre_device = {
- name: "Keyspan USA28 - (prerenumeration)",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa28_pre_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 2,
- startup: keyspan_fake_startup
-};
+
+ /* only do something if we have a bulk out endpoint */
+ if (s_priv->out_urbs[2]) {
+ if (s_priv->out_urbs[2]->status == -EINPROGRESS) {
+ dbg (__FUNCTION__ " already writing");
+ return(-1);
+ }
+ memcpy (s_priv->out_urbs[2]->transfer_buffer, &msg, sizeof(msg));
+
+ /* send the data out the device on control endpoint */
+ s_priv->out_urbs[2]->transfer_buffer_length = sizeof(msg);
-struct usb_serial_device_type keyspan_usa28x_pre_device = {
- name: "Keyspan USA28X - (prerenumeration)",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa28x_pre_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 2,
- startup: keyspan_fake_startup
-};
+ if (usb_submit_urb(s_priv->out_urbs[2])) {
+ dbg(__FUNCTION__ " usb_submit_urb(setup) failed\n");
+ }
+ else {
+ dbg(__FUNCTION__ " usb_submit_urb(setup) OK %d bytes\n", s_priv->out_urbs[2]->transfer_buffer_length);
+ }
+
+ }
+ return (0);
+}
-struct usb_serial_device_type keyspan_usa18x_device = {
- name: "Keyspan USA18X",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa18x_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 1,
- open: keyspan_open,
- close: keyspan_close,
- throttle: keyspan_rx_throttle,
- unthrottle: keyspan_rx_unthrottle,
- set_termios: keyspan_set_termios,
-};
+ /* Gets called by the "real" driver (ie once firmware is loaded
+ and renumeration has taken place. */
+static int keyspan_startup (struct usb_serial *serial)
+{
+ int i;
+ struct usb_serial_port *port;
-struct usb_serial_device_type keyspan_usa19_device = {
- name: "Keyspan USA19",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa19_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 1,
- open: keyspan_open,
- close: keyspan_close,
- write: keyspan_write,
- write_room: keyspan_write_room,
- write_bulk_callback: keyspan_write_bulk_callback,
- read_int_callback: keyspan_rx_interrupt,
- chars_in_buffer: keyspan_chars_in_buffer,
- throttle: keyspan_rx_throttle,
- unthrottle: keyspan_rx_unthrottle,
- ioctl: keyspan_ioctl,
- set_termios: keyspan_set_termios,
- break_ctl: keyspan_break_ctl,
- startup: keyspan_startup,
- shutdown: keyspan_shutdown,
-};
+ dbg("keyspan_startup called.\n");
+ /* Setup private data for serial driver */
+ serial->private = kmalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
+ if (!serial->private) {
+ dbg(__FUNCTION__ "kmalloc for keyspan_serial_private failed!.\n");
+ return (1);
+ }
+ memset(serial->private, 0, sizeof(struct keyspan_serial_private));
+
+ init_waitqueue_head(&out_wait);
+
+ /* Now setup per port private data */
+ for (i = 0; i < serial->num_ports; i++) {
+ port = &serial->port[i];
+ port->private = kmalloc(sizeof(struct keyspan_port_private), GFP_KERNEL);
+ if (!port->private) {
+ dbg(__FUNCTION__ "kmalloc for keyspan_port_private (%d) failed!.\n", i);
+ return (1);
+ }
+ memset(port->private, 0, sizeof(struct keyspan_port_private));
+ }
-struct usb_serial_device_type keyspan_usa19w_device = {
- name: "Keyspan USA19W",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa19w_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 1,
- open: keyspan_open,
- close: keyspan_close,
- throttle: keyspan_rx_throttle,
- unthrottle: keyspan_rx_unthrottle,
- set_termios: keyspan_set_termios,
-};
+
+ switch (serial->dev->descriptor.idProduct) {
+ case 0x0107: keyspan_usa19_setup_urbs(serial);
+ //keyspan_send_usa19_setup(serial);
+ break;
-struct usb_serial_device_type keyspan_usa28_device = {
- name: "Keyspan USA28",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa28_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 2,
- open: keyspan_open,
- close: keyspan_close,
- throttle: keyspan_rx_throttle,
- unthrottle: keyspan_rx_unthrottle,
- set_termios: keyspan_set_termios,
-};
+ default: break;
+ }
+
+ return (0);
+}
-struct usb_serial_device_type keyspan_usa28x_device = {
- name: "Keyspan USA28X",
- idVendor: &keyspan_vendor_id,
- idProduct: &keyspan_usa28x_product_id,
- needs_interrupt_in: DONT_CARE,
- needs_bulk_in: DONT_CARE,
- needs_bulk_out: DONT_CARE,
- num_interrupt_in: NUM_DONT_CARE,
- num_bulk_in: NUM_DONT_CARE,
- num_bulk_out: NUM_DONT_CARE,
- num_ports: 2,
- open: keyspan_open,
- close: keyspan_close,
- throttle: keyspan_rx_throttle,
- unthrottle: keyspan_rx_unthrottle,
- set_termios: keyspan_set_termios,
-};
+static void keyspan_shutdown (struct usb_serial *serial)
+{
+ int i;
+ struct usb_serial_port *port;
+ struct keyspan_serial_private *s_priv;
+ dbg("keyspan_shutdown called freeing ");
+ s_priv = (struct keyspan_serial_private *)(serial->private);
+
+ /* Stop reading/writing urbs */
+ for (i = 0; i < 4; i++) {
+ if (s_priv->in_urbs[i]) {
+ usb_unlink_urb(s_priv->in_urbs[i]);
+ }
+
+ }
+ for (i = 0; i < 3; i++) {
+ if (s_priv->out_urbs[i]) {
+ usb_unlink_urb(s_priv->out_urbs[i]);
+ }
+ }
+ /* Now free them */
+ for (i = 0; i < 7; i ++) {
+ if (s_priv->in_urbs[i] != NULL) {
+ dbg("in%d ", i);
+ usb_free_urb(s_priv->in_urbs[i]);
+ }
+
+ if (s_priv->out_urbs[i] != NULL) {
+ dbg("out%d ", i);
+ usb_free_urb(s_priv->out_urbs[i]);
+ }
+ }
+ dbg("urbs.\n");
+
+ dbg("Freeing serial->private.\n");
+ kfree(serial->private);
+
+ dbg("Freeing port->private.\n");
+ /* Now free per port private data */
+ for (i = 0; i < serial->num_ports; i++) {
+ port = &serial->port[i];
+ kfree(port->private);
+ }
+
+}
#endif /* CONFIG_USB_SERIAL_KEYSPAN */
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
new file mode 100644
index 000000000..ce966dc4f
--- /dev/null
+++ b/drivers/usb/serial/keyspan.h
@@ -0,0 +1,326 @@
+/*
+ Keyspan USB to Serial Converter driver
+
+ (C) Copyright (C) 2000
+ Hugh Blemings <hugh@linuxcare.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ See http://www.linuxcare.com.au/hugh/keyspan.html for more
+ information on this driver.
+
+ Code in this driver inspired by and in a number of places taken
+ from Brian Warner's original Keyspan-PDA driver.
+
+ This driver has been put together with the support of Innosys, Inc.
+ and Keyspan, Inc the manufacturers of the Keyspan USB-serial products.
+ Thanks Guys :)
+
+ Tip 'o the hat to Linuxcare for supporting staff in their work on
+ open source projects.
+
+ See keyspan.c for update history.
+
+*/
+
+#ifndef __LINUX_USB_SERIAL_KEYSPAN_H
+#define __LINUX_USB_SERIAL_KEYSPAN_H
+
+
+ /* Function prototypes for Keyspan serial converter */
+static int keyspan_open (struct usb_serial_port *port,
+ struct file *filp);
+static void keyspan_close (struct usb_serial_port *port,
+ struct file *filp);
+static int keyspan_startup (struct usb_serial *serial);
+static void keyspan_shutdown (struct usb_serial *serial);
+static void keyspan_rx_throttle (struct usb_serial_port *port);
+static void keyspan_rx_unthrottle (struct usb_serial_port *port);
+static int keyspan_write_room (struct usb_serial_port *port);
+static int keyspan_write (struct usb_serial_port *port,
+ int from_user,
+ const unsigned char *buf,
+ int count);
+static void keyspan_write_bulk_callback (struct urb *urb);
+static void keyspan_read_bulk_callback (struct urb *urb);
+static int keyspan_chars_in_buffer (struct usb_serial_port *port);
+static int keyspan_ioctl (struct usb_serial_port *port,
+ struct file *file,
+ unsigned int cmd,
+ unsigned long arg);
+static void keyspan_set_termios (struct usb_serial_port *port,
+ struct termios *old);
+static void keyspan_break_ctl (struct usb_serial_port *port,
+ int break_state);
+static int keyspan_fake_startup (struct usb_serial *serial);
+
+static int keyspan_usa19_calc_baud (u32 baud_rate, u8 *rate_hi,
+ u8 *rate_low);
+static void keyspan_usa19_setup_urbs (struct usb_serial *serial);
+static int keyspan_usa19_send_setup (struct usb_serial *serial,
+ struct usb_serial_port *port);
+
+
+ /* Functions from usbserial.c for ezusb firmware handling */
+extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
+extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
+
+ /* Struct used for firmware */
+struct ezusb_hex_record {
+ __u16 address;
+ __u8 data_size;
+ __u8 data[16];
+};
+ /* Conditionally include firmware images, if they aren't
+ included create a null pointer instead. Current
+ firmware images aren't optimised to remove duplicate
+ addresses. */
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
+ #include "keyspan_usa28_fw.h"
+#else
+ static const struct ezusb_hex_record *keyspan_usa28_firmware = NULL;
+#endif
+
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28X
+ #include "keyspan_usa28x_fw.h"
+#else
+ static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
+#endif
+
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
+ #include "keyspan_usa19_fw.h"
+#else
+ static const struct ezusb_hex_record *keyspan_usa19_firmware = NULL;
+#endif
+
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA18X
+ #include "keyspan_usa18x_fw.h"
+#else
+ static const struct ezusb_hex_record *keyspan_usa18x_firmware = NULL;
+#endif
+
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19W
+ #include "keyspan_usa19w_fw.h"
+#else
+ static const struct ezusb_hex_record *keyspan_usa19w_firmware = NULL;
+#endif
+
+
+ /* Values used for baud rate calculation - device specific */
+#define KEYSPAN_INVALID_BAUD_RATE (-1)
+#define KEYSPAN_BAUD_RATE_OK (0)
+#define USA19_BAUDCLK (12000000L)
+
+ /* Device info for the Keyspan serial converter */
+#define KEYSPAN_VENDOR_ID (0x06cd)
+static __u16 keyspan_vendor_id = KEYSPAN_VENDOR_ID;
+
+ /* Product IDs for the five products supported, pre-renumeration */
+static __u16 keyspan_usa18x_pre_product_id = 0x0105;
+static __u16 keyspan_usa19_pre_product_id = 0x0103;
+static __u16 keyspan_usa19w_pre_product_id = 0x0106;
+static __u16 keyspan_usa28_pre_product_id = 0x0101;
+static __u16 keyspan_usa28x_pre_product_id = 0x0102;
+
+ /* Product IDs post-renumeration */
+static __u16 keyspan_usa18x_product_id = 0x0112;
+static __u16 keyspan_usa19_product_id = 0x0107;
+static __u16 keyspan_usa19w_product_id = 0x0108;
+static __u16 keyspan_usa28_product_id = 0x010f;
+static __u16 keyspan_usa28x_product_id = 0x0110;
+
+ /* Structs for the devices, pre and post renumeration.
+ These are incomplete at present - HAB 20000708 */
+struct usb_serial_device_type keyspan_usa18x_pre_device = {
+ name: "Keyspan USA18X - (prerenumeration)",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa18x_pre_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 1,
+ startup: keyspan_fake_startup
+};
+
+struct usb_serial_device_type keyspan_usa19_pre_device = {
+ name: "Keyspan USA19 - (prerenumeration)",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa19_pre_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 1,
+ startup: keyspan_fake_startup
+};
+
+
+struct usb_serial_device_type keyspan_usa19w_pre_device = {
+ name: "Keyspan USA19W - (prerenumeration)",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa19w_pre_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 1,
+ startup: keyspan_fake_startup
+};
+
+
+struct usb_serial_device_type keyspan_usa28_pre_device = {
+ name: "Keyspan USA28 - (prerenumeration)",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa28_pre_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 2,
+ startup: keyspan_fake_startup
+};
+
+struct usb_serial_device_type keyspan_usa28x_pre_device = {
+ name: "Keyspan USA28X - (prerenumeration)",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa28x_pre_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 2,
+ startup: keyspan_fake_startup
+};
+
+
+struct usb_serial_device_type keyspan_usa18x_device = {
+ name: "Keyspan USA18X",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa18x_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 1,
+ open: keyspan_open,
+ close: keyspan_close,
+ throttle: keyspan_rx_throttle,
+ unthrottle: keyspan_rx_unthrottle,
+ set_termios: keyspan_set_termios,
+};
+
+struct usb_serial_device_type keyspan_usa19_device = {
+ name: "Keyspan USA19",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa19_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: MUST_HAVE,
+ needs_bulk_out: MUST_HAVE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: 3,
+ num_bulk_out: 4,
+ num_ports: 1,
+ open: keyspan_open,
+ close: keyspan_close,
+ write: keyspan_write,
+ write_room: keyspan_write_room,
+ write_bulk_callback: keyspan_write_bulk_callback,
+ read_int_callback: keyspan_read_bulk_callback,
+ chars_in_buffer: keyspan_chars_in_buffer,
+ throttle: keyspan_rx_throttle,
+ unthrottle: keyspan_rx_unthrottle,
+ ioctl: keyspan_ioctl,
+ set_termios: keyspan_set_termios,
+ break_ctl: keyspan_break_ctl,
+ startup: keyspan_startup,
+ shutdown: keyspan_shutdown,
+};
+
+
+struct usb_serial_device_type keyspan_usa19w_device = {
+ name: "Keyspan USA19W",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa19w_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 1,
+ open: keyspan_open,
+ close: keyspan_close,
+ throttle: keyspan_rx_throttle,
+ unthrottle: keyspan_rx_unthrottle,
+ set_termios: keyspan_set_termios,
+};
+
+
+struct usb_serial_device_type keyspan_usa28_device = {
+ name: "Keyspan USA28",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa28_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 2,
+ open: keyspan_open,
+ close: keyspan_close,
+ throttle: keyspan_rx_throttle,
+ unthrottle: keyspan_rx_unthrottle,
+ set_termios: keyspan_set_termios,
+};
+
+
+struct usb_serial_device_type keyspan_usa28x_device = {
+ name: "Keyspan USA28X",
+ idVendor: &keyspan_vendor_id,
+ idProduct: &keyspan_usa28x_product_id,
+ needs_interrupt_in: DONT_CARE,
+ needs_bulk_in: DONT_CARE,
+ needs_bulk_out: DONT_CARE,
+ num_interrupt_in: NUM_DONT_CARE,
+ num_bulk_in: NUM_DONT_CARE,
+ num_bulk_out: NUM_DONT_CARE,
+ num_ports: 2,
+ open: keyspan_open,
+ close: keyspan_close,
+ write: keyspan_write,
+ write_room: keyspan_write_room,
+ write_bulk_callback: keyspan_write_bulk_callback,
+ read_int_callback: keyspan_read_bulk_callback,
+ chars_in_buffer: keyspan_chars_in_buffer,
+ throttle: keyspan_rx_throttle,
+ unthrottle: keyspan_rx_unthrottle,
+ ioctl: keyspan_ioctl,
+ set_termios: keyspan_set_termios,
+ break_ctl: keyspan_break_ctl,
+ startup: keyspan_startup,
+ shutdown: keyspan_shutdown,
+
+
+
+};
+
+
+
+#endif
diff --git a/drivers/usb/serial/keyspan_usa28msg.h b/drivers/usb/serial/keyspan_usa28msg.h
index 69ba3cfae..6378bc5b0 100644
--- a/drivers/usb/serial/keyspan_usa28msg.h
+++ b/drivers/usb/serial/keyspan_usa28msg.h
@@ -94,9 +94,9 @@
#ifndef __USA28MSG__
#define __USA28MSG__
-#ifndef STUBS
+/*#ifndef STUBS
#include "datadefs.h"
-#endif
+#endif*/
typedef struct txAckMessage
{
diff --git a/drivers/usb/usb.c b/drivers/usb/usb.c
index 9c650cfdc..bfac6098b 100644
--- a/drivers/usb/usb.c
+++ b/drivers/usb/usb.c
@@ -428,7 +428,7 @@ int usb_interface_claimed(struct usb_interface *iface)
void usb_driver_release_interface(struct usb_driver *driver, struct usb_interface *iface)
{
/* this should never happen, don't release something that's not ours */
- if (iface->driver != driver || !iface)
+ if (!iface || iface->driver != driver)
return;
iface->driver = NULL;
diff --git a/drivers/video/aty128fb.c b/drivers/video/aty128fb.c
index 0770f4448..3af8ee798 100644
--- a/drivers/video/aty128fb.c
+++ b/drivers/video/aty128fb.c
@@ -209,9 +209,6 @@ static int noaccel __initdata = 0;
#ifndef MODULE
static const char *mode_option __initdata = NULL;
#endif
-#if !defined(CONFIG_PPC) && !defined(__sparc__)
-static void *bios_seg = NULL;
-#endif
#ifdef CONFIG_PPC
#ifdef CONFIG_NVRAM_NOT_DEFINED
@@ -277,7 +274,6 @@ struct fb_info_aty128 {
void *regbase; /* remapped mmio */
u32 frame_buffer_phys; /* physical fb memory */
u32 frame_buffer; /* remaped framebuffer */
- u32 io_base; /* unmapped io */
u32 vram_size; /* onboard video ram */
int chip_gen;
const struct aty128_meminfo *mem; /* onboard mem info */
@@ -367,8 +363,9 @@ static int aty128_pci_register(struct pci_dev *pdev,
static struct fb_info_aty128 *aty128_board_list_add(struct fb_info_aty128
*board_list, struct fb_info_aty128 *new_node);
#if !defined(CONFIG_PPC) && !defined(__sparc__)
-static void aty128_get_pllinfo(struct fb_info_aty128 *info);
-static int aty128find_ROM(struct fb_info_aty128 *info);
+static void __init aty128_get_pllinfo(struct fb_info_aty128 *info,
+ char *bios_seg);
+static char __init *aty128find_ROM(struct fb_info_aty128 *info);
#endif
static void aty128_timings(struct fb_info_aty128 *info);
static void aty128_init_engine(const struct aty128fb_par *par,
@@ -1842,221 +1839,210 @@ static int __init
aty128_pci_register(struct pci_dev *pdev,
const struct aty128_chip_info *aci)
{
- struct fb_info_aty128 *info = NULL;
- u32 fb_addr, reg_addr, io_addr = 0;
- int err;
-
- fb_addr = pci_resource_start(pdev, 0);
- if (!request_mem_region(fb_addr, pci_resource_len(pdev, 0),
- "aty128fb FB")) {
- printk(KERN_ERR "aty128fb: cannot reserve frame buffer memory\n");
- goto err_free_fb;
- }
+ struct fb_info_aty128 *info = NULL;
+ u32 fb_addr, reg_addr;
+ int err;
+#if !defined(CONFIG_PPC) && !defined(__sparc__)
+ char *bios_seg = NULL;
+#endif
- reg_addr = pci_resource_start(pdev, 2);
- if (!request_mem_region(reg_addr, pci_resource_len(pdev, 2),
- "aty128fb MMIO")) {
- printk(KERN_ERR "aty128fb: cannot reserve MMIO region\n");
- goto err_free_mmio;
- }
+ /* Enable device in PCI config */
+ if ((err = pci_enable_device(pdev))) {
+ printk(KERN_ERR "aty128fb: Cannot enable PCI device: %d\n",
+ err);
+ goto err_out;
+ }
- /* We have the resources. Now virtualize them */
- info = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC);
- if(!info) {
- printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n");
- goto err_unmap_out;
- }
- memset(info, 0, sizeof(struct fb_info_aty128));
+ fb_addr = pci_resource_start(pdev, 0);
+ if (!request_mem_region(fb_addr, pci_resource_len(pdev, 0),
+ "aty128fb FB")) {
+ printk(KERN_ERR "aty128fb: cannot reserve frame "
+ "buffer memory\n");
+ goto err_free_fb;
+ }
- /* Copy PCI device info into info->pdev */
- info->pdev = pdev;
+ reg_addr = pci_resource_start(pdev, 2);
+ if (!request_mem_region(reg_addr, pci_resource_len(pdev, 2),
+ "aty128fb MMIO")) {
+ printk(KERN_ERR "aty128fb: cannot reserve MMIO region\n");
+ goto err_free_mmio;
+ }
- info->currcon = -1;
+ /* We have the resources. Now virtualize them */
+ if (!(info = kmalloc(sizeof(struct fb_info_aty128), GFP_ATOMIC))) {
+ printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n");
+ goto err_unmap_out;
+ }
+ memset(info, 0, sizeof(struct fb_info_aty128));
- /* Virtualize mmio region */
- info->regbase_phys = reg_addr;
- info->regbase = ioremap(reg_addr, 0x1FFF);
+ /* Copy PCI device info into info->pdev */
+ info->pdev = pdev;
- if (!info->regbase)
- goto err_free_info;
+ info->currcon = -1;
- /* Store io_base */
- info->io_base = io_addr;
+ /* Virtualize mmio region */
+ info->regbase_phys = reg_addr;
+ info->regbase = ioremap(reg_addr, 0x1FFF);
- /* Grab memory size from the card */
- info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
+ if (!info->regbase)
+ goto err_free_info;
- /* Virtualize the framebuffer */
- info->frame_buffer_phys = fb_addr;
- info->frame_buffer = (u32)ioremap(fb_addr, info->vram_size);
+ /* Grab memory size from the card */
+ info->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
- if (!info->frame_buffer) {
- iounmap((void *)info->regbase);
- goto err_free_info;
- }
+ /* Virtualize the framebuffer */
+ info->frame_buffer_phys = fb_addr;
+ info->frame_buffer = (u32)ioremap(fb_addr, info->vram_size);
- /* Enable device in PCI config */
- err = pci_enable_device(pdev);
- if (err) {
- printk(KERN_ERR "aty128fb: Cannot enable PCI device: %d\n", err);
- goto err_out;
- }
+ if (!info->frame_buffer) {
+ iounmap((void *)info->regbase);
+ goto err_free_info;
+ }
- /* If we can't test scratch registers, something is seriously wrong */
- if (!register_test(info)) {
- printk(KERN_ERR "aty128fb: Can't write to video register!\n");
- goto err_out;
- }
+ /* If we can't test scratch registers, something is seriously wrong */
+ if (!register_test(info)) {
+ printk(KERN_ERR "aty128fb: Can't write to video register!\n");
+ goto err_out;
+ }
#if !defined(CONFIG_PPC) && !defined(__sparc__)
- if (!aty128find_ROM(info))
- printk(KERN_INFO "aty128fb: Rage128 BIOS not located. Guessing...\n");
- else
- aty128_get_pllinfo(info);
+ if (!(bios_seg = aty128find_ROM(info)))
+ printk(KERN_INFO "aty128fb: Rage128 BIOS not located. "
+ "Guessing...\n");
+ else {
+ printk(KERN_INFO "aty128fb: Rage128 BIOS located at "
+ "segment %4.4X\n", (unsigned int)bios_seg);
+ aty128_get_pllinfo(info, bios_seg);
+ }
#endif
- aty128_timings(info);
+ aty128_timings(info);
- if (!aty128_init(info, "PCI"))
- goto err_out;
+ if (!aty128_init(info, "PCI"))
+ goto err_out;
#ifdef CONFIG_MTRR
- if (mtrr) {
- info->mtrr.vram = mtrr_add(info->frame_buffer_phys, info->vram_size,
- MTRR_TYPE_WRCOMB, 1);
- info->mtrr.vram_valid = 1;
- /* let there be speed */
- printk(KERN_INFO "aty128fb: Rage128 MTRR set to ON\n");
- }
+ if (mtrr) {
+ info->mtrr.vram = mtrr_add(info->frame_buffer_phys,
+ info->vram_size, MTRR_TYPE_WRCOMB, 1);
+ info->mtrr.vram_valid = 1;
+ /* let there be speed */
+ printk(KERN_INFO "aty128fb: Rage128 MTRR set to ON\n");
+ }
#endif /* CONFIG_MTRR */
- return 0;
+ return 0;
err_out:
- iounmap((void *)info->frame_buffer);
- iounmap((void *)info->regbase);
+ iounmap((void *)info->frame_buffer);
+ iounmap((void *)info->regbase);
err_free_info:
- kfree(info);
+ kfree(info);
err_unmap_out:
- release_mem_region(pci_resource_start(pdev, 2),
+ release_mem_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2));
err_free_mmio:
- release_mem_region(pci_resource_start(pdev, 0),
+ release_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
err_free_fb:
- release_mem_region(pci_resource_start(pdev, 1),
+ release_mem_region(pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1));
- return -ENODEV;
+ return -ENODEV;
}
#endif /* CONFIG_PCI */
/* PPC and Sparc cannot read video ROM */
#if !defined(CONFIG_PPC) && !defined(__sparc__)
-static int __init
-aty128find_ROM(struct fb_info_aty128 *info)
-{
- int flag = 0;
- u32 segstart;
- char *rom_base;
- char *rom;
- int stage;
- int i;
- char aty_rom_sig[] = "761295520"; /* ATI ROM Signature */
- char R128_sig[] = "R128"; /* Rage128 ROM identifier */
+static char __init
+*aty128find_ROM(struct fb_info_aty128 *info)
+{
+ u32 segstart;
+ char *rom_base;
+ char *rom;
+ int stage;
+ int i;
+ char aty_rom_sig[] = "761295520"; /* ATI ROM Signature */
+ char R128_sig[] = "R128"; /* Rage128 ROM identifier */
+
+ for (segstart=0x000c0000; segstart<0x000f0000; segstart+=0x00001000) {
+ stage = 1;
+
+ rom_base = (char *)ioremap(segstart, 0x1000);
+
+ if ((*rom_base == 0x55) && (((*(rom_base + 1)) & 0xff) == 0xaa))
+ stage = 2;
+
+ if (stage != 2) {
+ iounmap(rom_base);
+ continue;
+ }
+ rom = rom_base;
+
+ for (i = 0; (i < 128 - strlen(aty_rom_sig)) && (stage != 3); i++) {
+ if (aty_rom_sig[0] == *rom)
+ if (strncmp(aty_rom_sig, rom,
+ strlen(aty_rom_sig)) == 0)
+ stage = 3;
+ rom++;
+ }
+ if (stage != 3) {
+ iounmap(rom_base);
+ continue;
+ }
+ rom = rom_base;
+
+ /* ATI signature found. Let's see if it's a Rage128 */
+ for (i = 0; (i < 512) && (stage != 4); i++) {
+ if (R128_sig[0] == *rom)
+ if (strncmp(R128_sig, rom,
+ strlen(R128_sig)) == 0)
+ stage = 4;
+ rom++;
+ }
+ if (stage != 4) {
+ iounmap(rom_base);
+ continue;
+ }
+
+ return rom_base;
+ }
- for (segstart=0x000c0000; segstart<0x000f0000; segstart+=0x00001000) {
- stage = 1;
+ return NULL;
+}
- rom_base = (char *) ioremap(segstart, 0x1000);
- if ((*rom_base == 0x55) && (((*(rom_base + 1)) & 0xff) == 0xaa))
- stage = 2;
+static void __init
+aty128_get_pllinfo(struct fb_info_aty128 *info, char *bios_seg)
+{
+ void *bios_header;
+ void *header_ptr;
+ u16 bios_header_offset, pll_info_offset;
+ PLL_BLOCK pll;
- if (stage != 2) {
- iounmap(rom_base);
- continue;
- }
- rom = rom_base;
+ bios_header = bios_seg + 0x48L;
+ header_ptr = bios_header;
- for (i = 0; (i < 128 - strlen(aty_rom_sig)) && (stage != 3); i++) {
- if (aty_rom_sig[0] == *rom) {
- if (strncmp(aty_rom_sig, rom, strlen(aty_rom_sig)) == 0) {
- stage = 3;
- }
- }
- rom++;
- }
- if (stage != 3) {
- iounmap(rom_base);
- continue;
- }
- rom = rom_base;
-
- /* ATI signature found. Let's see if it's a Rage128 */
- for (i = 0; (i < 512) && (stage != 4); i++) {
- if (R128_sig[0] == *rom) {
- if (strncmp(R128_sig, rom, strlen(R128_sig)) == 0) {
- stage = 4;
- }
- }
- rom++;
- }
- if (stage != 4) {
- iounmap(rom_base);
- continue;
- }
+ bios_header_offset = readw(header_ptr);
+ bios_header = bios_seg + bios_header_offset;
+ bios_header += 0x30;
- bios_seg = rom_base;
- printk(KERN_INFO "aty128fb: Rage128 BIOS located at segment %4.4X\n",
- (unsigned int)rom_base);
- flag = 1;
- break;
- }
- return (flag);
-}
+ header_ptr = bios_header;
+ pll_info_offset = readw(header_ptr);
+ header_ptr = bios_seg + pll_info_offset;
+ memcpy_fromio(&pll, header_ptr, 50);
-static void __init
-aty128_get_pllinfo(struct fb_info_aty128 *info)
-{
- void *bios_header;
- void *header_ptr;
- u16 bios_header_offset, pll_info_offset;
- PLL_BLOCK pll;
-
- bios_header = bios_seg + 0x48L;
- header_ptr = bios_header;
-
- bios_header_offset = readw(header_ptr);
- bios_header = bios_seg + bios_header_offset;
- bios_header += 0x30;
-
- header_ptr = bios_header;
- pll_info_offset = readw(header_ptr);
- header_ptr = bios_seg + pll_info_offset;
-
- memcpy_fromio(&pll, header_ptr, 50);
-
- info->constants.ppll_max = pll.PCLK_max_freq;
- info->constants.ppll_min = pll.PCLK_min_freq;
- info->constants.xclk = (u32)pll.XCLK;
- info->constants.ref_divider = (u32)pll.PCLK_ref_divider;
- info->constants.dotclock = (u32)pll.PCLK_ref_freq;
-
- /* free up to be un-used resources. bios_seg is mapped by
- * aty128find_ROM() and used by aty128_get_pllinfo()
- *
- * TODO: make more elegant. doesn't need to be global */
- if (bios_seg)
- iounmap(bios_seg);
+ info->constants.ppll_max = pll.PCLK_max_freq;
+ info->constants.ppll_min = pll.PCLK_min_freq;
+ info->constants.xclk = (u32)pll.XCLK;
+ info->constants.ref_divider = (u32)pll.PCLK_ref_divider;
+ info->constants.dotclock = (u32)pll.PCLK_ref_freq;
- DBG("ppll_max %d ppll_min %d xclk %d "
- "ref_divider %d dotclock %d\n",
+ DBG("ppll_max %d ppll_min %d xclk %d ref_divider %d dotclock %d\n",
info->constants.ppll_max, info->constants.ppll_min,
info->constants.xclk, info->constants.ref_divider,
info->constants.dotclock);
- return;
}
#endif /* !CONFIG_PPC */
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 52228d56b..55fb8728b 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1042,20 +1042,50 @@ static void cyber2000fb_blank(int blank, struct fb_info *info)
struct cfb_info *cfb = (struct cfb_info *)info;
int i;
- if (blank) {
- for (i = 0; i < NR_PALETTE; i++) {
+ /*
+ * Blank the screen if blank_mode != 0, else unblank. If
+ * blank == NULL then the caller blanks by setting the CLUT
+ * (Color Look Up Table) to all black. Return 0 if blanking
+ * succeeded, != 0 if un-/blanking failed due to e.g. a
+ * video mode which doesn't support it. Implements VESA
+ * suspend and powerdown modes on hardware that supports
+ * disabling hsync/vsync:
+ * blank_mode == 2: suspend vsync
+ * blank_mode == 3: suspend hsync
+ * blank_mode == 4: powerdown
+ *
+ * wms...Enable VESA DMPS compatible powerdown mode
+ * run "setterm -powersave powerdown" to take advantage
+ */
+
+ switch (blank) {
+ case 4: /* powerdown - both sync lines down */
+ cyber2000_grphw(0x16, 0x05);
+ break;
+ case 3: /* hsync off */
+ cyber2000_grphw(0x16, 0x01);
+ break;
+ case 2: /* vsync off */
+ cyber2000_grphw(0x16, 0x04);
+ break;
+ case 1: /* just software blanking of screen */
+ cyber2000_grphw(0x16, 0x00);
+ for (i = 0; i < 256; i++) {
cyber2000_outb(i, 0x3c8);
cyber2000_outb(0, 0x3c9);
cyber2000_outb(0, 0x3c9);
cyber2000_outb(0, 0x3c9);
}
- } else {
- for (i = 0; i < NR_PALETTE; i++) {
+ break;
+ default: /* case 0, or anything else: unblank */
+ cyber2000_grphw(0x16, 0x00);
+ for (i = 0; i < 256; i++) {
cyber2000_outb(i, 0x3c8);
cyber2000_outb(cfb->palette[i].red, 0x3c9);
cyber2000_outb(cfb->palette[i].green, 0x3c9);
cyber2000_outb(cfb->palette[i].blue, 0x3c9);
}
+ break;
}
}
@@ -1196,6 +1226,7 @@ int __init cyber2000fb_setup(char *options)
static char igs_regs[] __devinitdata = {
0x12, 0x00, 0x13, 0x00,
+ 0x16, 0x00,
0x31, 0x00, 0x32, 0x00,
0x50, 0x00, 0x51, 0x00, 0x52, 0x00, 0x53, 0x00,
0x54, 0x00, 0x55, 0x00, 0x56, 0x00, 0x57, 0x01,
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 30bd06d32..bf34ca0da 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -101,8 +101,8 @@ extern int valkyriefb_setup(char*);
extern int control_init(void);
extern int control_setup(char*);
extern int g364fb_init(void);
-extern void sa1100fb_init(void);
-extern void sa1100fb_setup(char*);
+extern int sa1100fb_init(void);
+extern int sa1100fb_setup(char*);
extern int fm2fb_init(void);
extern int fm2fb_setup(char*);
extern int q40fb_init(void);
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index ef94171bc..cbdc9848b 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -201,8 +201,8 @@ static void matroxfb_remove(WPMINFO int dummy) {
release_mem_region(ACCESS_FBINFO(video.base), ACCESS_FBINFO(video.len_maximum));
release_mem_region(ACCESS_FBINFO(mmio.base), 16384);
#ifdef CONFIG_FB_MATROX_MULTIHEAD
- kfree_s(ACCESS_FBINFO(fbcon.disp), sizeof(struct display));
- kfree_s(minfo, sizeof(struct matrox_fb_info));
+ kfree(ACCESS_FBINFO(fbcon.disp));
+ kfree(minfo);
#endif
}
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index bf4ec72b7..d9789a75e 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -1113,7 +1113,7 @@ static int __init pm2pci_detect(struct pm2fb_info* p) {
}
else {
p->regions.rg_base = pci_resource_start(pci->dev, 0);
- p->regions.fb_base = pci_resource_start(pci->dev, 0);
+ p->regions.fb_base = pci_resource_start(pci->dev, 1);
}
#endif
#ifdef PM2FB_BE_APERTURE
@@ -1281,7 +1281,16 @@ static void pm2fb_clear_margins8(struct vc_data* conp, struct display* p,
}
static struct display_switch pm2_cfb8 = {
- fbcon_cfb8_setup, pm2fb_pp_bmove, pm2fb_clear8,
+ fbcon_cfb8_setup, pm2fb_pp_bmove,
+#ifdef __alpha__
+ /* Not sure why, but this works and the other does not. */
+ /* Also, perhaps we need a separate routine to wait for the
+ blitter to stop before doing this? */
+ /* In addition, maybe we need to do this for 16 and 32 bit depths? */
+ fbcon_cfb8_clear,
+#else
+ pm2fb_clear8,
+#endif
fbcon_cfb8_putc, fbcon_cfb8_putcs, fbcon_cfb8_revc,
pm2fb_cursor, pm2fb_set_font,
pm2fb_clear_margins8,
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index b8b58b4bf..eb98ba112 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -845,15 +845,15 @@ sa1100fb_activate_var(struct fb_var_screeninfo *var)
LCCR0_LDM + LCCR0_BAM + LCCR0_ERM + LCCR0_Act +
LCCR0_LtlEnd + LCCR0_DMADel(0);
lcd_shadow.lccr1 =
- LCCR1_DisWdth(var->xres) + LCCR1_HorSnchWdth(4) +
- LCCR1_BegLnDel(30) + LCCR1_EndLnDel(30);
+ LCCR1_DisWdth(var->xres) + LCCR1_HorSnchWdth(6) +
+ LCCR1_BegLnDel(61) + LCCR1_EndLnDel(9);
lcd_shadow.lccr2 =
- LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(1) +
- LCCR2_BegFrmDel(0) + LCCR2_EndFrmDel(0);
+ LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(2) +
+ LCCR2_BegFrmDel(3) + LCCR2_EndFrmDel(0);
lcd_shadow.lccr3 =
LCCR3_OutEnH + LCCR3_PixFlEdg + LCCR3_VrtSnchH +
LCCR3_HorSnchH + LCCR3_ACBsCntOff +
- LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(28);
+ LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(38);
/* Set board control register to handle new color depth */
sa1100fb_assabet_set_truecolor(var->bits_per_pixel >= 16);
@@ -1117,6 +1117,7 @@ sa1100fb_blank(int blank, struct fb_info *info)
DPRINTK("blank=%d info->modename=%s\n", blank, info->modename);
if (blank) {
+ if (current_par.visual != FB_VISUAL_TRUECOLOR)
for (i = 0; i < current_par.palette_size; i++)
sa1100fb_palette_write(i, sa1100fb_palette_encode(i, 0, 0, 0, 0));
sa1100fb_disable_lcd_controller();
@@ -1155,24 +1156,29 @@ sa1100fb_switch(int con, struct fb_info *info)
fb_display[con].var.activate = FB_ACTIVATE_NOW;
DPRINTK("fb_display[%d].var.activate=%x\n", con, fb_display[con].var.activate);
sa1100fb_set_var(&fb_display[con].var, con, info);
+ current_par.v_palette_base[0] = (current_par.v_palette_base[0] &
+ 0xcfff) | SA1100_PALETTE_MODE_VAL(current_par.bits_per_pixel);
+
return 0;
}
-void __init sa1100fb_init(void)
+int __init sa1100fb_init(void)
{
+ int ret;
+
sa1100fb_init_fbinfo();
/* Initialize video memory */
- if (sa1100fb_map_video_memory())
- return;
+ if ((ret = sa1100fb_map_video_memory()) != 0)
+ return ret;
if (current_par.montype < 0 || current_par.montype > NR_MONTYPES)
current_par.montype = 1;
if (request_irq(IRQ_LCD, sa1100fb_inter_handler, SA_INTERRUPT, "SA1100 LCD", NULL) != 0) {
printk("sa1100fb: failed in request_irq\n");
- return;
+ return -EBUSY;
}
DPRINTK("sa1100fb: request_irq succeeded\n");
disable_irq(IRQ_LCD);
@@ -1202,14 +1208,13 @@ void __init sa1100fb_init(void)
/* This driver cannot be unloaded at the moment */
MOD_INC_USE_COUNT;
+
+ return 0;
}
-void __init sa1100fb_setup(char *options)
+int __init sa1100fb_setup(char *options)
{
- if (!options || !*options)
- return;
-
- return;
+ return 0;
}
diff --git a/drivers/video/sisfb.c b/drivers/video/sisfb.c
index 019a86a8e..763ec0d4f 100644
--- a/drivers/video/sisfb.c
+++ b/drivers/video/sisfb.c
@@ -186,10 +186,10 @@ unsigned long rom_base;
unsigned long rom_vbase;
/* mode */
-int video_type = FB_TYPE_PACKED_PIXELS;
-int video_linelength;
-int video_cmap_len;
-int sisfb_off = 0;
+static int video_type = FB_TYPE_PACKED_PIXELS;
+static int video_linelength;
+static int video_cmap_len;
+static int sisfb_off = 0;
static struct fb_var_screeninfo default_var = {
0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index c465bafc7..e4ee03a82 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -47,14 +47,14 @@ int video_size;
char *video_vbase; /* mapped */
/* mode */
-int video_bpp;
-int video_width;
-int video_height;
-int video_height_virtual;
-int video_type = FB_TYPE_PACKED_PIXELS;
-int video_visual;
-int video_linelength;
-int video_cmap_len;
+static int video_bpp;
+static int video_width;
+static int video_height;
+static int video_height_virtual;
+static int video_type = FB_TYPE_PACKED_PIXELS;
+static int video_visual;
+static int video_linelength;
+static int video_cmap_len;
/* --------------------------------------------------------------------- */