diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-08-03 17:35:48 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-03 17:35:48 -0400 |
commit | 36a2c6b28003dd0592b8ece5e9409991e0820f50 (patch) | |
tree | c5b52547b2658a8a3b898b8224b835a7e8396017 /drivers | |
parent | 95916edd02e3a7752315422f386c55723d4a3637 (diff) | |
parent | f1d39b291e2263f5e2f2ec5d4061802f76d8ae67 (diff) |
Merge branch 'upstream-fixes' into upstream
Diffstat (limited to 'drivers')
107 files changed, 1536 insertions, 938 deletions
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index c2d621632383..3ef9d514b916 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -139,7 +139,7 @@ static int __cpuinit topology_sysfs_init(void) | |||
139 | (void *)(long)i); | 139 | (void *)(long)i); |
140 | } | 140 | } |
141 | 141 | ||
142 | register_cpu_notifier(&topology_cpu_notifier); | 142 | register_hotcpu_notifier(&topology_cpu_notifier); |
143 | 143 | ||
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 0a1b1ea36ddc..bdbade9a5cf5 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -300,6 +300,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
300 | lo->disk->disk_name, result); | 300 | lo->disk->disk_name, result); |
301 | goto harderror; | 301 | goto harderror; |
302 | } | 302 | } |
303 | |||
304 | if (ntohl(reply.magic) != NBD_REPLY_MAGIC) { | ||
305 | printk(KERN_ERR "%s: Wrong magic (0x%lx)\n", | ||
306 | lo->disk->disk_name, | ||
307 | (unsigned long)ntohl(reply.magic)); | ||
308 | result = -EPROTO; | ||
309 | goto harderror; | ||
310 | } | ||
311 | |||
303 | req = nbd_find_request(lo, reply.handle); | 312 | req = nbd_find_request(lo, reply.handle); |
304 | if (unlikely(IS_ERR(req))) { | 313 | if (unlikely(IS_ERR(req))) { |
305 | result = PTR_ERR(req); | 314 | result = PTR_ERR(req); |
@@ -312,13 +321,6 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
312 | goto harderror; | 321 | goto harderror; |
313 | } | 322 | } |
314 | 323 | ||
315 | if (ntohl(reply.magic) != NBD_REPLY_MAGIC) { | ||
316 | printk(KERN_ERR "%s: Wrong magic (0x%lx)\n", | ||
317 | lo->disk->disk_name, | ||
318 | (unsigned long)ntohl(reply.magic)); | ||
319 | result = -EPROTO; | ||
320 | goto harderror; | ||
321 | } | ||
322 | if (ntohl(reply.error)) { | 324 | if (ntohl(reply.error)) { |
323 | printk(KERN_ERR "%s: Other side returned error (%d)\n", | 325 | printk(KERN_ERR "%s: Other side returned error (%d)\n", |
324 | lo->disk->disk_name, ntohl(reply.error)); | 326 | lo->disk->disk_name, ntohl(reply.error)); |
@@ -339,7 +341,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
339 | printk(KERN_ERR "%s: Receive data failed (result %d)\n", | 341 | printk(KERN_ERR "%s: Receive data failed (result %d)\n", |
340 | lo->disk->disk_name, | 342 | lo->disk->disk_name, |
341 | result); | 343 | result); |
342 | goto harderror; | 344 | req->errors++; |
345 | return req; | ||
343 | } | 346 | } |
344 | dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", | 347 | dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", |
345 | lo->disk->disk_name, req, bvec->bv_len); | 348 | lo->disk->disk_name, req, bvec->bv_len); |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index bde2c64b6346..451b996bba91 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2577,19 +2577,19 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm | |||
2577 | case PKT_CTRL_CMD_SETUP: | 2577 | case PKT_CTRL_CMD_SETUP: |
2578 | if (!capable(CAP_SYS_ADMIN)) | 2578 | if (!capable(CAP_SYS_ADMIN)) |
2579 | return -EPERM; | 2579 | return -EPERM; |
2580 | mutex_lock(&ctl_mutex); | 2580 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
2581 | ret = pkt_setup_dev(&ctrl_cmd); | 2581 | ret = pkt_setup_dev(&ctrl_cmd); |
2582 | mutex_unlock(&ctl_mutex); | 2582 | mutex_unlock(&ctl_mutex); |
2583 | break; | 2583 | break; |
2584 | case PKT_CTRL_CMD_TEARDOWN: | 2584 | case PKT_CTRL_CMD_TEARDOWN: |
2585 | if (!capable(CAP_SYS_ADMIN)) | 2585 | if (!capable(CAP_SYS_ADMIN)) |
2586 | return -EPERM; | 2586 | return -EPERM; |
2587 | mutex_lock(&ctl_mutex); | 2587 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
2588 | ret = pkt_remove_dev(&ctrl_cmd); | 2588 | ret = pkt_remove_dev(&ctrl_cmd); |
2589 | mutex_unlock(&ctl_mutex); | 2589 | mutex_unlock(&ctl_mutex); |
2590 | break; | 2590 | break; |
2591 | case PKT_CTRL_CMD_STATUS: | 2591 | case PKT_CTRL_CMD_STATUS: |
2592 | mutex_lock(&ctl_mutex); | 2592 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
2593 | pkt_get_status(&ctrl_cmd); | 2593 | pkt_get_status(&ctrl_cmd); |
2594 | mutex_unlock(&ctl_mutex); | 2594 | mutex_unlock(&ctl_mutex); |
2595 | break; | 2595 | break; |
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c index be61f22ee7bb..d37ced0d132b 100644 --- a/drivers/char/hw_random/geode-rng.c +++ b/drivers/char/hw_random/geode-rng.c | |||
@@ -107,10 +107,14 @@ found: | |||
107 | if (err) { | 107 | if (err) { |
108 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | 108 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", |
109 | err); | 109 | err); |
110 | goto out; | 110 | goto err_unmap; |
111 | } | 111 | } |
112 | out: | 112 | out: |
113 | return err; | 113 | return err; |
114 | |||
115 | err_unmap: | ||
116 | iounmap(mem); | ||
117 | goto out; | ||
114 | } | 118 | } |
115 | 119 | ||
116 | static void __exit mod_exit(void) | 120 | static void __exit mod_exit(void) |
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 6594bd5645f4..ccd7e7102234 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -164,7 +164,7 @@ static int __init mod_init(void) | |||
164 | if (err) { | 164 | if (err) { |
165 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | 165 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", |
166 | err); | 166 | err); |
167 | goto out; | 167 | goto err_unmap; |
168 | } | 168 | } |
169 | out: | 169 | out: |
170 | return err; | 170 | return err; |
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c index 645eb81cb5a9..84e5a68635f1 100644 --- a/drivers/char/pc8736x_gpio.c +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -221,7 +221,6 @@ static struct nsc_gpio_ops pc8736x_gpio_ops = { | |||
221 | .gpio_change = pc8736x_gpio_change, | 221 | .gpio_change = pc8736x_gpio_change, |
222 | .gpio_current = pc8736x_gpio_current | 222 | .gpio_current = pc8736x_gpio_current |
223 | }; | 223 | }; |
224 | EXPORT_SYMBOL(pc8736x_gpio_ops); | ||
225 | 224 | ||
226 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) | 225 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) |
227 | { | 226 | { |
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 498aa37bca22..3ece69231343 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -51,6 +51,7 @@ void proc_fork_connector(struct task_struct *task) | |||
51 | struct cn_msg *msg; | 51 | struct cn_msg *msg; |
52 | struct proc_event *ev; | 52 | struct proc_event *ev; |
53 | __u8 buffer[CN_PROC_MSG_SIZE]; | 53 | __u8 buffer[CN_PROC_MSG_SIZE]; |
54 | struct timespec ts; | ||
54 | 55 | ||
55 | if (atomic_read(&proc_event_num_listeners) < 1) | 56 | if (atomic_read(&proc_event_num_listeners) < 1) |
56 | return; | 57 | return; |
@@ -58,7 +59,8 @@ void proc_fork_connector(struct task_struct *task) | |||
58 | msg = (struct cn_msg*)buffer; | 59 | msg = (struct cn_msg*)buffer; |
59 | ev = (struct proc_event*)msg->data; | 60 | ev = (struct proc_event*)msg->data; |
60 | get_seq(&msg->seq, &ev->cpu); | 61 | get_seq(&msg->seq, &ev->cpu); |
61 | ktime_get_ts(&ev->timestamp); /* get high res monotonic timestamp */ | 62 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
63 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
62 | ev->what = PROC_EVENT_FORK; | 64 | ev->what = PROC_EVENT_FORK; |
63 | ev->event_data.fork.parent_pid = task->real_parent->pid; | 65 | ev->event_data.fork.parent_pid = task->real_parent->pid; |
64 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; | 66 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; |
@@ -76,6 +78,7 @@ void proc_exec_connector(struct task_struct *task) | |||
76 | { | 78 | { |
77 | struct cn_msg *msg; | 79 | struct cn_msg *msg; |
78 | struct proc_event *ev; | 80 | struct proc_event *ev; |
81 | struct timespec ts; | ||
79 | __u8 buffer[CN_PROC_MSG_SIZE]; | 82 | __u8 buffer[CN_PROC_MSG_SIZE]; |
80 | 83 | ||
81 | if (atomic_read(&proc_event_num_listeners) < 1) | 84 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -84,7 +87,8 @@ void proc_exec_connector(struct task_struct *task) | |||
84 | msg = (struct cn_msg*)buffer; | 87 | msg = (struct cn_msg*)buffer; |
85 | ev = (struct proc_event*)msg->data; | 88 | ev = (struct proc_event*)msg->data; |
86 | get_seq(&msg->seq, &ev->cpu); | 89 | get_seq(&msg->seq, &ev->cpu); |
87 | ktime_get_ts(&ev->timestamp); | 90 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
91 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
88 | ev->what = PROC_EVENT_EXEC; | 92 | ev->what = PROC_EVENT_EXEC; |
89 | ev->event_data.exec.process_pid = task->pid; | 93 | ev->event_data.exec.process_pid = task->pid; |
90 | ev->event_data.exec.process_tgid = task->tgid; | 94 | ev->event_data.exec.process_tgid = task->tgid; |
@@ -100,6 +104,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
100 | struct cn_msg *msg; | 104 | struct cn_msg *msg; |
101 | struct proc_event *ev; | 105 | struct proc_event *ev; |
102 | __u8 buffer[CN_PROC_MSG_SIZE]; | 106 | __u8 buffer[CN_PROC_MSG_SIZE]; |
107 | struct timespec ts; | ||
103 | 108 | ||
104 | if (atomic_read(&proc_event_num_listeners) < 1) | 109 | if (atomic_read(&proc_event_num_listeners) < 1) |
105 | return; | 110 | return; |
@@ -118,7 +123,8 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
118 | } else | 123 | } else |
119 | return; | 124 | return; |
120 | get_seq(&msg->seq, &ev->cpu); | 125 | get_seq(&msg->seq, &ev->cpu); |
121 | ktime_get_ts(&ev->timestamp); | 126 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
127 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
122 | 128 | ||
123 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 129 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
124 | msg->ack = 0; /* not used */ | 130 | msg->ack = 0; /* not used */ |
@@ -131,6 +137,7 @@ void proc_exit_connector(struct task_struct *task) | |||
131 | struct cn_msg *msg; | 137 | struct cn_msg *msg; |
132 | struct proc_event *ev; | 138 | struct proc_event *ev; |
133 | __u8 buffer[CN_PROC_MSG_SIZE]; | 139 | __u8 buffer[CN_PROC_MSG_SIZE]; |
140 | struct timespec ts; | ||
134 | 141 | ||
135 | if (atomic_read(&proc_event_num_listeners) < 1) | 142 | if (atomic_read(&proc_event_num_listeners) < 1) |
136 | return; | 143 | return; |
@@ -138,7 +145,8 @@ void proc_exit_connector(struct task_struct *task) | |||
138 | msg = (struct cn_msg*)buffer; | 145 | msg = (struct cn_msg*)buffer; |
139 | ev = (struct proc_event*)msg->data; | 146 | ev = (struct proc_event*)msg->data; |
140 | get_seq(&msg->seq, &ev->cpu); | 147 | get_seq(&msg->seq, &ev->cpu); |
141 | ktime_get_ts(&ev->timestamp); | 148 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
149 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
142 | ev->what = PROC_EVENT_EXIT; | 150 | ev->what = PROC_EVENT_EXIT; |
143 | ev->event_data.exit.process_pid = task->pid; | 151 | ev->event_data.exit.process_pid = task->pid; |
144 | ev->event_data.exit.process_tgid = task->tgid; | 152 | ev->event_data.exit.process_tgid = task->tgid; |
@@ -164,6 +172,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
164 | struct cn_msg *msg; | 172 | struct cn_msg *msg; |
165 | struct proc_event *ev; | 173 | struct proc_event *ev; |
166 | __u8 buffer[CN_PROC_MSG_SIZE]; | 174 | __u8 buffer[CN_PROC_MSG_SIZE]; |
175 | struct timespec ts; | ||
167 | 176 | ||
168 | if (atomic_read(&proc_event_num_listeners) < 1) | 177 | if (atomic_read(&proc_event_num_listeners) < 1) |
169 | return; | 178 | return; |
@@ -171,7 +180,8 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
171 | msg = (struct cn_msg*)buffer; | 180 | msg = (struct cn_msg*)buffer; |
172 | ev = (struct proc_event*)msg->data; | 181 | ev = (struct proc_event*)msg->data; |
173 | msg->seq = rcvd_seq; | 182 | msg->seq = rcvd_seq; |
174 | ktime_get_ts(&ev->timestamp); | 183 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
184 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
175 | ev->cpu = -1; | 185 | ev->cpu = -1; |
176 | ev->what = PROC_EVENT_NONE; | 186 | ev->what = PROC_EVENT_NONE; |
177 | ev->event_data.ack.err = err; | 187 | ev->event_data.ack.err = err; |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index d1266fe2d1ab..b6fb167e20f6 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -682,6 +682,7 @@ config BLK_DEV_SVWKS | |||
682 | config BLK_DEV_SGIIOC4 | 682 | config BLK_DEV_SGIIOC4 |
683 | tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support" | 683 | tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support" |
684 | depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4 | 684 | depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4 |
685 | select IDEPCI_SHARE_IRQ | ||
685 | help | 686 | help |
686 | This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 | 687 | This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 |
687 | chipset, which has one channel and can support two devices. | 688 | chipset, which has one channel and can support two devices. |
@@ -773,20 +774,6 @@ config BLK_DEV_IDEDMA_PMAC | |||
773 | to transfer data to and from memory. Saying Y is safe and improves | 774 | to transfer data to and from memory. Saying Y is safe and improves |
774 | performance. | 775 | performance. |
775 | 776 | ||
776 | config BLK_DEV_IDE_PMAC_BLINK | ||
777 | bool "Blink laptop LED on drive activity (DEPRECATED)" | ||
778 | depends on BLK_DEV_IDE_PMAC && ADB_PMU | ||
779 | select ADB_PMU_LED | ||
780 | select LEDS_TRIGGERS | ||
781 | select LEDS_TRIGGER_IDE_DISK | ||
782 | help | ||
783 | This option enables the use of the sleep LED as a hard drive | ||
784 | activity LED. | ||
785 | This option is deprecated, it only selects ADB_PMU_LED and | ||
786 | LEDS_TRIGGER_IDE_DISK and changes the code in the new led class | ||
787 | device to default to the ide-disk trigger (which should be set | ||
788 | from userspace via sysfs). | ||
789 | |||
790 | config BLK_DEV_IDE_SWARM | 777 | config BLK_DEV_IDE_SWARM |
791 | tristate "IDE for Sibyte evaluation boards" | 778 | tristate "IDE for Sibyte evaluation boards" |
792 | depends on SIBYTE_SB1xxx_SOC | 779 | depends on SIBYTE_SB1xxx_SOC |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 657165297dc7..77703acaec17 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/hdreg.h> | 23 | #include <linux/hdreg.h> |
24 | #include <linux/ide.h> | 24 | #include <linux/ide.h> |
25 | #include <linux/bitops.h> | 25 | #include <linux/bitops.h> |
26 | #include <linux/nmi.h> | ||
26 | 27 | ||
27 | #include <asm/byteorder.h> | 28 | #include <asm/byteorder.h> |
28 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
@@ -1243,6 +1244,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout) | |||
1243 | if (stat == 0xff) | 1244 | if (stat == 0xff) |
1244 | return -ENODEV; | 1245 | return -ENODEV; |
1245 | touch_softlockup_watchdog(); | 1246 | touch_softlockup_watchdog(); |
1247 | touch_nmi_watchdog(); | ||
1246 | } | 1248 | } |
1247 | return -EBUSY; | 1249 | return -EBUSY; |
1248 | } | 1250 | } |
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index d294bbc42f09..1205e8027829 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <net/arp.h> | 35 | #include <net/arp.h> |
36 | #include <net/neighbour.h> | 36 | #include <net/neighbour.h> |
37 | #include <net/route.h> | 37 | #include <net/route.h> |
38 | #include <net/netevent.h> | ||
38 | #include <rdma/ib_addr.h> | 39 | #include <rdma/ib_addr.h> |
39 | 40 | ||
40 | MODULE_AUTHOR("Sean Hefty"); | 41 | MODULE_AUTHOR("Sean Hefty"); |
@@ -326,25 +327,22 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr) | |||
326 | } | 327 | } |
327 | EXPORT_SYMBOL(rdma_addr_cancel); | 328 | EXPORT_SYMBOL(rdma_addr_cancel); |
328 | 329 | ||
329 | static int addr_arp_recv(struct sk_buff *skb, struct net_device *dev, | 330 | static int netevent_callback(struct notifier_block *self, unsigned long event, |
330 | struct packet_type *pkt, struct net_device *orig_dev) | 331 | void *ctx) |
331 | { | 332 | { |
332 | struct arphdr *arp_hdr; | 333 | if (event == NETEVENT_NEIGH_UPDATE) { |
334 | struct neighbour *neigh = ctx; | ||
333 | 335 | ||
334 | arp_hdr = (struct arphdr *) skb->nh.raw; | 336 | if (neigh->dev->type == ARPHRD_INFINIBAND && |
335 | 337 | (neigh->nud_state & NUD_VALID)) { | |
336 | if (arp_hdr->ar_op == htons(ARPOP_REQUEST) || | 338 | set_timeout(jiffies); |
337 | arp_hdr->ar_op == htons(ARPOP_REPLY)) | 339 | } |
338 | set_timeout(jiffies); | 340 | } |
339 | |||
340 | kfree_skb(skb); | ||
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
343 | 343 | ||
344 | static struct packet_type addr_arp = { | 344 | static struct notifier_block nb = { |
345 | .type = __constant_htons(ETH_P_ARP), | 345 | .notifier_call = netevent_callback |
346 | .func = addr_arp_recv, | ||
347 | .af_packet_priv = (void*) 1, | ||
348 | }; | 346 | }; |
349 | 347 | ||
350 | static int addr_init(void) | 348 | static int addr_init(void) |
@@ -353,13 +351,13 @@ static int addr_init(void) | |||
353 | if (!addr_wq) | 351 | if (!addr_wq) |
354 | return -ENOMEM; | 352 | return -ENOMEM; |
355 | 353 | ||
356 | dev_add_pack(&addr_arp); | 354 | register_netevent_notifier(&nb); |
357 | return 0; | 355 | return 0; |
358 | } | 356 | } |
359 | 357 | ||
360 | static void addr_cleanup(void) | 358 | static void addr_cleanup(void) |
361 | { | 359 | { |
362 | dev_remove_pack(&addr_arp); | 360 | unregister_netevent_notifier(&nb); |
363 | destroy_workqueue(addr_wq); | 361 | destroy_workqueue(addr_wq); |
364 | } | 362 | } |
365 | 363 | ||
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index f85c97f7500a..0de335b7bfc2 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -975,8 +975,10 @@ int ib_send_cm_req(struct ib_cm_id *cm_id, | |||
975 | 975 | ||
976 | cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> | 976 | cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> |
977 | id.local_id); | 977 | id.local_id); |
978 | if (IS_ERR(cm_id_priv->timewait_info)) | 978 | if (IS_ERR(cm_id_priv->timewait_info)) { |
979 | ret = PTR_ERR(cm_id_priv->timewait_info); | ||
979 | goto out; | 980 | goto out; |
981 | } | ||
980 | 982 | ||
981 | ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av); | 983 | ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av); |
982 | if (ret) | 984 | if (ret) |
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index bb9bee56a824..102a59c033ff 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/kref.h> | 42 | #include <linux/kref.h> |
43 | #include <linux/idr.h> | 43 | #include <linux/idr.h> |
44 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/completion.h> | ||
45 | 46 | ||
46 | #include <rdma/ib_verbs.h> | 47 | #include <rdma/ib_verbs.h> |
47 | #include <rdma/ib_user_verbs.h> | 48 | #include <rdma/ib_user_verbs.h> |
@@ -69,6 +70,7 @@ | |||
69 | 70 | ||
70 | struct ib_uverbs_device { | 71 | struct ib_uverbs_device { |
71 | struct kref ref; | 72 | struct kref ref; |
73 | struct completion comp; | ||
72 | int devnum; | 74 | int devnum; |
73 | struct cdev *dev; | 75 | struct cdev *dev; |
74 | struct class_device *class_dev; | 76 | struct class_device *class_dev; |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index e725cccc7cde..4e16314e8e6d 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -122,7 +122,7 @@ static void ib_uverbs_release_dev(struct kref *ref) | |||
122 | struct ib_uverbs_device *dev = | 122 | struct ib_uverbs_device *dev = |
123 | container_of(ref, struct ib_uverbs_device, ref); | 123 | container_of(ref, struct ib_uverbs_device, ref); |
124 | 124 | ||
125 | kfree(dev); | 125 | complete(&dev->comp); |
126 | } | 126 | } |
127 | 127 | ||
128 | void ib_uverbs_release_ucq(struct ib_uverbs_file *file, | 128 | void ib_uverbs_release_ucq(struct ib_uverbs_file *file, |
@@ -740,6 +740,7 @@ static void ib_uverbs_add_one(struct ib_device *device) | |||
740 | return; | 740 | return; |
741 | 741 | ||
742 | kref_init(&uverbs_dev->ref); | 742 | kref_init(&uverbs_dev->ref); |
743 | init_completion(&uverbs_dev->comp); | ||
743 | 744 | ||
744 | spin_lock(&map_lock); | 745 | spin_lock(&map_lock); |
745 | uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); | 746 | uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); |
@@ -793,6 +794,8 @@ err_cdev: | |||
793 | 794 | ||
794 | err: | 795 | err: |
795 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); | 796 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); |
797 | wait_for_completion(&uverbs_dev->comp); | ||
798 | kfree(uverbs_dev); | ||
796 | return; | 799 | return; |
797 | } | 800 | } |
798 | 801 | ||
@@ -812,7 +815,10 @@ static void ib_uverbs_remove_one(struct ib_device *device) | |||
812 | spin_unlock(&map_lock); | 815 | spin_unlock(&map_lock); |
813 | 816 | ||
814 | clear_bit(uverbs_dev->devnum, dev_map); | 817 | clear_bit(uverbs_dev->devnum, dev_map); |
818 | |||
815 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); | 819 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); |
820 | wait_for_completion(&uverbs_dev->comp); | ||
821 | kfree(uverbs_dev); | ||
816 | } | 822 | } |
817 | 823 | ||
818 | static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags, | 824 | static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags, |
diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c index 9ba3211cef7c..25157f57a6d0 100644 --- a/drivers/infiniband/hw/mthca/mthca_allocator.c +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c | |||
@@ -108,14 +108,15 @@ void mthca_alloc_cleanup(struct mthca_alloc *alloc) | |||
108 | * serialize access to the array. | 108 | * serialize access to the array. |
109 | */ | 109 | */ |
110 | 110 | ||
111 | #define MTHCA_ARRAY_MASK (PAGE_SIZE / sizeof (void *) - 1) | ||
112 | |||
111 | void *mthca_array_get(struct mthca_array *array, int index) | 113 | void *mthca_array_get(struct mthca_array *array, int index) |
112 | { | 114 | { |
113 | int p = (index * sizeof (void *)) >> PAGE_SHIFT; | 115 | int p = (index * sizeof (void *)) >> PAGE_SHIFT; |
114 | 116 | ||
115 | if (array->page_list[p].page) { | 117 | if (array->page_list[p].page) |
116 | int i = index & (PAGE_SIZE / sizeof (void *) - 1); | 118 | return array->page_list[p].page[index & MTHCA_ARRAY_MASK]; |
117 | return array->page_list[p].page[i]; | 119 | else |
118 | } else | ||
119 | return NULL; | 120 | return NULL; |
120 | } | 121 | } |
121 | 122 | ||
@@ -130,8 +131,7 @@ int mthca_array_set(struct mthca_array *array, int index, void *value) | |||
130 | if (!array->page_list[p].page) | 131 | if (!array->page_list[p].page) |
131 | return -ENOMEM; | 132 | return -ENOMEM; |
132 | 133 | ||
133 | array->page_list[p].page[index & (PAGE_SIZE / sizeof (void *) - 1)] = | 134 | array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value; |
134 | value; | ||
135 | ++array->page_list[p].used; | 135 | ++array->page_list[p].used; |
136 | 136 | ||
137 | return 0; | 137 | return 0; |
@@ -144,7 +144,8 @@ void mthca_array_clear(struct mthca_array *array, int index) | |||
144 | if (--array->page_list[p].used == 0) { | 144 | if (--array->page_list[p].used == 0) { |
145 | free_page((unsigned long) array->page_list[p].page); | 145 | free_page((unsigned long) array->page_list[p].page); |
146 | array->page_list[p].page = NULL; | 146 | array->page_list[p].page = NULL; |
147 | } | 147 | } else |
148 | array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL; | ||
148 | 149 | ||
149 | if (array->page_list[p].used < 0) | 150 | if (array->page_list[p].used < 0) |
150 | pr_debug("Array %p index %d page %d with ref count %d < 0\n", | 151 | pr_debug("Array %p index %d page %d with ref count %d < 0\n", |
diff --git a/drivers/infiniband/ulp/ipoib/Kconfig b/drivers/infiniband/ulp/ipoib/Kconfig index 13d6d01c72c0..d74653d7de1c 100644 --- a/drivers/infiniband/ulp/ipoib/Kconfig +++ b/drivers/infiniband/ulp/ipoib/Kconfig | |||
@@ -6,8 +6,7 @@ config INFINIBAND_IPOIB | |||
6 | transports IP packets over InfiniBand so you can use your IB | 6 | transports IP packets over InfiniBand so you can use your IB |
7 | device as a fancy NIC. | 7 | device as a fancy NIC. |
8 | 8 | ||
9 | The IPoIB protocol is defined by the IETF ipoib working | 9 | See Documentation/infiniband/ipoib.txt for more information |
10 | group: <http://www.ietf.org/html.charters/ipoib-charter.html>. | ||
11 | 10 | ||
12 | config INFINIBAND_IPOIB_DEBUG | 11 | config INFINIBAND_IPOIB_DEBUG |
13 | bool "IP-over-InfiniBand debugging" if EMBEDDED | 12 | bool "IP-over-InfiniBand debugging" if EMBEDDED |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 8f472e7113b4..8257d5a2c8f8 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -77,6 +77,14 @@ MODULE_PARM_DESC(topspin_workarounds, | |||
77 | 77 | ||
78 | static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; | 78 | static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; |
79 | 79 | ||
80 | static int mellanox_workarounds = 1; | ||
81 | |||
82 | module_param(mellanox_workarounds, int, 0444); | ||
83 | MODULE_PARM_DESC(mellanox_workarounds, | ||
84 | "Enable workarounds for Mellanox SRP target bugs if != 0"); | ||
85 | |||
86 | static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 }; | ||
87 | |||
80 | static void srp_add_one(struct ib_device *device); | 88 | static void srp_add_one(struct ib_device *device); |
81 | static void srp_remove_one(struct ib_device *device); | 89 | static void srp_remove_one(struct ib_device *device); |
82 | static void srp_completion(struct ib_cq *cq, void *target_ptr); | 90 | static void srp_completion(struct ib_cq *cq, void *target_ptr); |
@@ -526,8 +534,10 @@ static int srp_reconnect_target(struct srp_target_port *target) | |||
526 | while (ib_poll_cq(target->cq, 1, &wc) > 0) | 534 | while (ib_poll_cq(target->cq, 1, &wc) > 0) |
527 | ; /* nothing */ | 535 | ; /* nothing */ |
528 | 536 | ||
537 | spin_lock_irq(target->scsi_host->host_lock); | ||
529 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) | 538 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) |
530 | srp_reset_req(target, req); | 539 | srp_reset_req(target, req); |
540 | spin_unlock_irq(target->scsi_host->host_lock); | ||
531 | 541 | ||
532 | target->rx_head = 0; | 542 | target->rx_head = 0; |
533 | target->tx_head = 0; | 543 | target->tx_head = 0; |
@@ -567,7 +577,7 @@ err: | |||
567 | return ret; | 577 | return ret; |
568 | } | 578 | } |
569 | 579 | ||
570 | static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat, | 580 | static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat, |
571 | int sg_cnt, struct srp_request *req, | 581 | int sg_cnt, struct srp_request *req, |
572 | struct srp_direct_buf *buf) | 582 | struct srp_direct_buf *buf) |
573 | { | 583 | { |
@@ -577,10 +587,15 @@ static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat, | |||
577 | int page_cnt; | 587 | int page_cnt; |
578 | int i, j; | 588 | int i, j; |
579 | int ret; | 589 | int ret; |
590 | struct srp_device *dev = target->srp_host->dev; | ||
580 | 591 | ||
581 | if (!dev->fmr_pool) | 592 | if (!dev->fmr_pool) |
582 | return -ENODEV; | 593 | return -ENODEV; |
583 | 594 | ||
595 | if ((sg_dma_address(&scat[0]) & ~dev->fmr_page_mask) && | ||
596 | mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3)) | ||
597 | return -EINVAL; | ||
598 | |||
584 | len = page_cnt = 0; | 599 | len = page_cnt = 0; |
585 | for (i = 0; i < sg_cnt; ++i) { | 600 | for (i = 0; i < sg_cnt; ++i) { |
586 | if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) { | 601 | if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) { |
@@ -683,7 +698,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, | |||
683 | buf->va = cpu_to_be64(sg_dma_address(scat)); | 698 | buf->va = cpu_to_be64(sg_dma_address(scat)); |
684 | buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey); | 699 | buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey); |
685 | buf->len = cpu_to_be32(sg_dma_len(scat)); | 700 | buf->len = cpu_to_be32(sg_dma_len(scat)); |
686 | } else if (srp_map_fmr(target->srp_host->dev, scat, count, req, | 701 | } else if (srp_map_fmr(target, scat, count, req, |
687 | (void *) cmd->add_data)) { | 702 | (void *) cmd->add_data)) { |
688 | /* | 703 | /* |
689 | * FMR mapping failed, and the scatterlist has more | 704 | * FMR mapping failed, and the scatterlist has more |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index f5fe7fb4b3ad..d5d649f5ccdb 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -90,6 +90,15 @@ config ADB_PMU_LED | |||
90 | and the ide-disk LED trigger and configure appropriately through | 90 | and the ide-disk LED trigger and configure appropriately through |
91 | sysfs. | 91 | sysfs. |
92 | 92 | ||
93 | config ADB_PMU_LED_IDE | ||
94 | bool "Use front LED as IDE LED by default" | ||
95 | depends on ADB_PMU_LED | ||
96 | select LEDS_TRIGGERS | ||
97 | select LEDS_TRIGGER_IDE_DISK | ||
98 | help | ||
99 | This option makes the front LED default to the IDE trigger | ||
100 | so that it blinks on IDE activity. | ||
101 | |||
93 | config PMAC_SMU | 102 | config PMAC_SMU |
94 | bool "Support for SMU based PowerMacs" | 103 | bool "Support for SMU based PowerMacs" |
95 | depends on PPC_PMAC64 | 104 | depends on PPC_PMAC64 |
@@ -100,7 +109,7 @@ config PMAC_SMU | |||
100 | 109 | ||
101 | config PMAC_APM_EMU | 110 | config PMAC_APM_EMU |
102 | tristate "APM emulation" | 111 | tristate "APM emulation" |
103 | depends on PPC_PMAC && PPC32 && PM | 112 | depends on PPC_PMAC && PPC32 && PM && ADB_PMU |
104 | 113 | ||
105 | config PMAC_MEDIABAY | 114 | config PMAC_MEDIABAY |
106 | bool "Support PowerBook hotswap media bay" | 115 | bool "Support PowerBook hotswap media bay" |
@@ -115,8 +124,6 @@ config PMAC_BACKLIGHT | |||
115 | bool "Backlight control for LCD screens" | 124 | bool "Backlight control for LCD screens" |
116 | depends on ADB_PMU && FB = y && (BROKEN || !PPC64) | 125 | depends on ADB_PMU && FB = y && (BROKEN || !PPC64) |
117 | select FB_BACKLIGHT | 126 | select FB_BACKLIGHT |
118 | select BACKLIGHT_CLASS_DEVICE | ||
119 | select BACKLIGHT_LCD_SUPPORT | ||
120 | help | 127 | help |
121 | Say Y here to enable Macintosh specific extensions of the generic | 128 | Say Y here to enable Macintosh specific extensions of the generic |
122 | backlight code. With this enabled, the brightness keys on older | 129 | backlight code. With this enabled, the brightness keys on older |
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c index 545be1ed6927..c69d23bb255e 100644 --- a/drivers/macintosh/adbhid.c +++ b/drivers/macintosh/adbhid.c | |||
@@ -45,14 +45,11 @@ | |||
45 | #include <linux/pmu.h> | 45 | #include <linux/pmu.h> |
46 | 46 | ||
47 | #include <asm/machdep.h> | 47 | #include <asm/machdep.h> |
48 | #include <asm/backlight.h> | ||
48 | #ifdef CONFIG_PPC_PMAC | 49 | #ifdef CONFIG_PPC_PMAC |
49 | #include <asm/pmac_feature.h> | 50 | #include <asm/pmac_feature.h> |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
53 | #include <asm/backlight.h> | ||
54 | #endif | ||
55 | |||
56 | MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>"); | 53 | MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>"); |
57 | 54 | ||
58 | #define KEYB_KEYREG 0 /* register # for key up/down data */ | 55 | #define KEYB_KEYREG 0 /* register # for key up/down data */ |
@@ -237,11 +234,6 @@ static struct adb_ids keyboard_ids; | |||
237 | static struct adb_ids mouse_ids; | 234 | static struct adb_ids mouse_ids; |
238 | static struct adb_ids buttons_ids; | 235 | static struct adb_ids buttons_ids; |
239 | 236 | ||
240 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
241 | /* Exported to via-pmu.c */ | ||
242 | int disable_kernel_backlight = 0; | ||
243 | #endif /* CONFIG_PMAC_BACKLIGHT */ | ||
244 | |||
245 | /* Kind of keyboard, see Apple technote 1152 */ | 237 | /* Kind of keyboard, see Apple technote 1152 */ |
246 | #define ADB_KEYBOARD_UNKNOWN 0 | 238 | #define ADB_KEYBOARD_UNKNOWN 0 |
247 | #define ADB_KEYBOARD_ANSI 0x0100 | 239 | #define ADB_KEYBOARD_ANSI 0x0100 |
@@ -527,7 +519,7 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto | |||
527 | 519 | ||
528 | case 0xa: /* brightness decrease */ | 520 | case 0xa: /* brightness decrease */ |
529 | #ifdef CONFIG_PMAC_BACKLIGHT | 521 | #ifdef CONFIG_PMAC_BACKLIGHT |
530 | if (!disable_kernel_backlight && down) | 522 | if (down) |
531 | pmac_backlight_key_down(); | 523 | pmac_backlight_key_down(); |
532 | #endif | 524 | #endif |
533 | input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down); | 525 | input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down); |
@@ -535,7 +527,7 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto | |||
535 | 527 | ||
536 | case 0x9: /* brightness increase */ | 528 | case 0x9: /* brightness increase */ |
537 | #ifdef CONFIG_PMAC_BACKLIGHT | 529 | #ifdef CONFIG_PMAC_BACKLIGHT |
538 | if (!disable_kernel_backlight && down) | 530 | if (down) |
539 | pmac_backlight_key_up(); | 531 | pmac_backlight_key_up(); |
540 | #endif | 532 | #endif |
541 | input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down); | 533 | input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down); |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index c1fe0b368f76..20bf67244e2c 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -95,6 +95,17 @@ | |||
95 | * - Use min/max macros here or there | 95 | * - Use min/max macros here or there |
96 | * - Latest darwin updated U3H min fan speed to 20% PWM | 96 | * - Latest darwin updated U3H min fan speed to 20% PWM |
97 | * | 97 | * |
98 | * July. 06, 2006 : 1.3 | ||
99 | * - Fix setting of RPM fans on Xserve G5 (they were going too fast) | ||
100 | * - Add missing slots fan control loop for Xserve G5 | ||
101 | * - Lower fixed slots fan speed from 50% to 40% on desktop G5s. We | ||
102 | * still can't properly implement the control loop for these, so let's | ||
103 | * reduce the noise a little bit, it appears that 40% still gives us | ||
104 | * a pretty good air flow | ||
105 | * - Add code to "tickle" the FCU regulary so it doesn't think that | ||
106 | * we are gone while in fact, the machine just didn't need any fan | ||
107 | * speed change lately | ||
108 | * | ||
98 | */ | 109 | */ |
99 | 110 | ||
100 | #include <linux/types.h> | 111 | #include <linux/types.h> |
@@ -121,7 +132,7 @@ | |||
121 | 132 | ||
122 | #include "therm_pm72.h" | 133 | #include "therm_pm72.h" |
123 | 134 | ||
124 | #define VERSION "1.2b2" | 135 | #define VERSION "1.3" |
125 | 136 | ||
126 | #undef DEBUG | 137 | #undef DEBUG |
127 | 138 | ||
@@ -146,6 +157,7 @@ static struct basckside_pid_params backside_params; | |||
146 | static struct backside_pid_state backside_state; | 157 | static struct backside_pid_state backside_state; |
147 | static struct drives_pid_state drives_state; | 158 | static struct drives_pid_state drives_state; |
148 | static struct dimm_pid_state dimms_state; | 159 | static struct dimm_pid_state dimms_state; |
160 | static struct slots_pid_state slots_state; | ||
149 | static int state; | 161 | static int state; |
150 | static int cpu_count; | 162 | static int cpu_count; |
151 | static int cpu_pid_type; | 163 | static int cpu_pid_type; |
@@ -154,7 +166,8 @@ static struct completion ctrl_complete; | |||
154 | static int critical_state; | 166 | static int critical_state; |
155 | static int rackmac; | 167 | static int rackmac; |
156 | static s32 dimm_output_clamp; | 168 | static s32 dimm_output_clamp; |
157 | 169 | static int fcu_rpm_shift; | |
170 | static int fcu_tickle_ticks; | ||
158 | static DECLARE_MUTEX(driver_lock); | 171 | static DECLARE_MUTEX(driver_lock); |
159 | 172 | ||
160 | /* | 173 | /* |
@@ -495,13 +508,20 @@ static int start_fcu(void) | |||
495 | rc = fan_write_reg(0x2e, &buf, 1); | 508 | rc = fan_write_reg(0x2e, &buf, 1); |
496 | if (rc < 0) | 509 | if (rc < 0) |
497 | return -EIO; | 510 | return -EIO; |
511 | rc = fan_read_reg(0, &buf, 1); | ||
512 | if (rc < 0) | ||
513 | return -EIO; | ||
514 | fcu_rpm_shift = (buf == 1) ? 2 : 3; | ||
515 | printk(KERN_DEBUG "FCU Initialized, RPM fan shift is %d\n", | ||
516 | fcu_rpm_shift); | ||
517 | |||
498 | return 0; | 518 | return 0; |
499 | } | 519 | } |
500 | 520 | ||
501 | static int set_rpm_fan(int fan_index, int rpm) | 521 | static int set_rpm_fan(int fan_index, int rpm) |
502 | { | 522 | { |
503 | unsigned char buf[2]; | 523 | unsigned char buf[2]; |
504 | int rc, id; | 524 | int rc, id, min, max; |
505 | 525 | ||
506 | if (fcu_fans[fan_index].type != FCU_FAN_RPM) | 526 | if (fcu_fans[fan_index].type != FCU_FAN_RPM) |
507 | return -EINVAL; | 527 | return -EINVAL; |
@@ -509,12 +529,15 @@ static int set_rpm_fan(int fan_index, int rpm) | |||
509 | if (id == FCU_FAN_ABSENT_ID) | 529 | if (id == FCU_FAN_ABSENT_ID) |
510 | return -EINVAL; | 530 | return -EINVAL; |
511 | 531 | ||
512 | if (rpm < 300) | 532 | min = 2400 >> fcu_rpm_shift; |
513 | rpm = 300; | 533 | max = 56000 >> fcu_rpm_shift; |
514 | else if (rpm > 8191) | 534 | |
515 | rpm = 8191; | 535 | if (rpm < min) |
516 | buf[0] = rpm >> 5; | 536 | rpm = min; |
517 | buf[1] = rpm << 3; | 537 | else if (rpm > max) |
538 | rpm = max; | ||
539 | buf[0] = rpm >> (8 - fcu_rpm_shift); | ||
540 | buf[1] = rpm << fcu_rpm_shift; | ||
518 | rc = fan_write_reg(0x10 + (id * 2), buf, 2); | 541 | rc = fan_write_reg(0x10 + (id * 2), buf, 2); |
519 | if (rc < 0) | 542 | if (rc < 0) |
520 | return -EIO; | 543 | return -EIO; |
@@ -551,7 +574,7 @@ static int get_rpm_fan(int fan_index, int programmed) | |||
551 | if (rc != 2) | 574 | if (rc != 2) |
552 | return -EIO; | 575 | return -EIO; |
553 | 576 | ||
554 | return (buf[0] << 5) | buf[1] >> 3; | 577 | return (buf[0] << (8 - fcu_rpm_shift)) | buf[1] >> fcu_rpm_shift; |
555 | } | 578 | } |
556 | 579 | ||
557 | static int set_pwm_fan(int fan_index, int pwm) | 580 | static int set_pwm_fan(int fan_index, int pwm) |
@@ -609,6 +632,26 @@ static int get_pwm_fan(int fan_index) | |||
609 | return (buf[0] * 1000) / 2559; | 632 | return (buf[0] * 1000) / 2559; |
610 | } | 633 | } |
611 | 634 | ||
635 | static void tickle_fcu(void) | ||
636 | { | ||
637 | int pwm; | ||
638 | |||
639 | pwm = get_pwm_fan(SLOTS_FAN_PWM_INDEX); | ||
640 | |||
641 | DBG("FCU Tickle, slots fan is: %d\n", pwm); | ||
642 | if (pwm < 0) | ||
643 | pwm = 100; | ||
644 | |||
645 | if (!rackmac) { | ||
646 | pwm = SLOTS_FAN_DEFAULT_PWM; | ||
647 | } else if (pwm < SLOTS_PID_OUTPUT_MIN) | ||
648 | pwm = SLOTS_PID_OUTPUT_MIN; | ||
649 | |||
650 | /* That is hopefully enough to make the FCU happy */ | ||
651 | set_pwm_fan(SLOTS_FAN_PWM_INDEX, pwm); | ||
652 | } | ||
653 | |||
654 | |||
612 | /* | 655 | /* |
613 | * Utility routine to read the CPU calibration EEPROM data | 656 | * Utility routine to read the CPU calibration EEPROM data |
614 | * from the device-tree | 657 | * from the device-tree |
@@ -715,6 +758,9 @@ BUILD_SHOW_FUNC_INT(backside_fan_pwm, backside_state.pwm) | |||
715 | BUILD_SHOW_FUNC_FIX(drives_temperature, drives_state.last_temp) | 758 | BUILD_SHOW_FUNC_FIX(drives_temperature, drives_state.last_temp) |
716 | BUILD_SHOW_FUNC_INT(drives_fan_rpm, drives_state.rpm) | 759 | BUILD_SHOW_FUNC_INT(drives_fan_rpm, drives_state.rpm) |
717 | 760 | ||
761 | BUILD_SHOW_FUNC_FIX(slots_temperature, slots_state.last_temp) | ||
762 | BUILD_SHOW_FUNC_INT(slots_fan_pwm, slots_state.pwm) | ||
763 | |||
718 | BUILD_SHOW_FUNC_FIX(dimms_temperature, dimms_state.last_temp) | 764 | BUILD_SHOW_FUNC_FIX(dimms_temperature, dimms_state.last_temp) |
719 | 765 | ||
720 | static DEVICE_ATTR(cpu0_temperature,S_IRUGO,show_cpu0_temperature,NULL); | 766 | static DEVICE_ATTR(cpu0_temperature,S_IRUGO,show_cpu0_temperature,NULL); |
@@ -735,6 +781,9 @@ static DEVICE_ATTR(backside_fan_pwm,S_IRUGO,show_backside_fan_pwm,NULL); | |||
735 | static DEVICE_ATTR(drives_temperature,S_IRUGO,show_drives_temperature,NULL); | 781 | static DEVICE_ATTR(drives_temperature,S_IRUGO,show_drives_temperature,NULL); |
736 | static DEVICE_ATTR(drives_fan_rpm,S_IRUGO,show_drives_fan_rpm,NULL); | 782 | static DEVICE_ATTR(drives_fan_rpm,S_IRUGO,show_drives_fan_rpm,NULL); |
737 | 783 | ||
784 | static DEVICE_ATTR(slots_temperature,S_IRUGO,show_slots_temperature,NULL); | ||
785 | static DEVICE_ATTR(slots_fan_pwm,S_IRUGO,show_slots_fan_pwm,NULL); | ||
786 | |||
738 | static DEVICE_ATTR(dimms_temperature,S_IRUGO,show_dimms_temperature,NULL); | 787 | static DEVICE_ATTR(dimms_temperature,S_IRUGO,show_dimms_temperature,NULL); |
739 | 788 | ||
740 | /* | 789 | /* |
@@ -1076,6 +1125,9 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state) | |||
1076 | fan_min = dimm_output_clamp; | 1125 | fan_min = dimm_output_clamp; |
1077 | fan_min = max(fan_min, (int)state->mpu.rminn_intake_fan); | 1126 | fan_min = max(fan_min, (int)state->mpu.rminn_intake_fan); |
1078 | 1127 | ||
1128 | DBG(" CPU min mpu = %d, min dimm = %d\n", | ||
1129 | state->mpu.rminn_intake_fan, dimm_output_clamp); | ||
1130 | |||
1079 | state->rpm = max(state->rpm, (int)fan_min); | 1131 | state->rpm = max(state->rpm, (int)fan_min); |
1080 | state->rpm = min(state->rpm, (int)state->mpu.rmaxn_intake_fan); | 1132 | state->rpm = min(state->rpm, (int)state->mpu.rmaxn_intake_fan); |
1081 | state->intake_rpm = state->rpm; | 1133 | state->intake_rpm = state->rpm; |
@@ -1374,7 +1426,8 @@ static void do_monitor_drives(struct drives_pid_state *state) | |||
1374 | DBG(" current rpm: %d\n", state->rpm); | 1426 | DBG(" current rpm: %d\n", state->rpm); |
1375 | 1427 | ||
1376 | /* Get some sensor readings */ | 1428 | /* Get some sensor readings */ |
1377 | temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, DS1775_TEMP)) << 8; | 1429 | temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, |
1430 | DS1775_TEMP)) << 8; | ||
1378 | state->last_temp = temp; | 1431 | state->last_temp = temp; |
1379 | DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp), | 1432 | DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp), |
1380 | FIX32TOPRINT(DRIVES_PID_INPUT_TARGET)); | 1433 | FIX32TOPRINT(DRIVES_PID_INPUT_TARGET)); |
@@ -1575,7 +1628,7 @@ static int init_dimms_state(struct dimm_pid_state *state) | |||
1575 | } | 1628 | } |
1576 | 1629 | ||
1577 | /* | 1630 | /* |
1578 | * Dispose of the state data for the drives control loop | 1631 | * Dispose of the state data for the DIMM control loop |
1579 | */ | 1632 | */ |
1580 | static void dispose_dimms_state(struct dimm_pid_state *state) | 1633 | static void dispose_dimms_state(struct dimm_pid_state *state) |
1581 | { | 1634 | { |
@@ -1588,6 +1641,127 @@ static void dispose_dimms_state(struct dimm_pid_state *state) | |||
1588 | state->monitor = NULL; | 1641 | state->monitor = NULL; |
1589 | } | 1642 | } |
1590 | 1643 | ||
1644 | /* | ||
1645 | * Slots fan control loop | ||
1646 | */ | ||
1647 | static void do_monitor_slots(struct slots_pid_state *state) | ||
1648 | { | ||
1649 | s32 temp, integral, derivative; | ||
1650 | s64 integ_p, deriv_p, prop_p, sum; | ||
1651 | int i, rc; | ||
1652 | |||
1653 | if (--state->ticks != 0) | ||
1654 | return; | ||
1655 | state->ticks = SLOTS_PID_INTERVAL; | ||
1656 | |||
1657 | DBG("slots:\n"); | ||
1658 | |||
1659 | /* Check fan status */ | ||
1660 | rc = get_pwm_fan(SLOTS_FAN_PWM_INDEX); | ||
1661 | if (rc < 0) { | ||
1662 | printk(KERN_WARNING "Error %d reading slots fan !\n", rc); | ||
1663 | /* XXX What do we do now ? */ | ||
1664 | } else | ||
1665 | state->pwm = rc; | ||
1666 | DBG(" current pwm: %d\n", state->pwm); | ||
1667 | |||
1668 | /* Get some sensor readings */ | ||
1669 | temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, | ||
1670 | DS1775_TEMP)) << 8; | ||
1671 | state->last_temp = temp; | ||
1672 | DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp), | ||
1673 | FIX32TOPRINT(SLOTS_PID_INPUT_TARGET)); | ||
1674 | |||
1675 | /* Store temperature and error in history array */ | ||
1676 | state->cur_sample = (state->cur_sample + 1) % SLOTS_PID_HISTORY_SIZE; | ||
1677 | state->sample_history[state->cur_sample] = temp; | ||
1678 | state->error_history[state->cur_sample] = temp - SLOTS_PID_INPUT_TARGET; | ||
1679 | |||
1680 | /* If first loop, fill the history table */ | ||
1681 | if (state->first) { | ||
1682 | for (i = 0; i < (SLOTS_PID_HISTORY_SIZE - 1); i++) { | ||
1683 | state->cur_sample = (state->cur_sample + 1) % | ||
1684 | SLOTS_PID_HISTORY_SIZE; | ||
1685 | state->sample_history[state->cur_sample] = temp; | ||
1686 | state->error_history[state->cur_sample] = | ||
1687 | temp - SLOTS_PID_INPUT_TARGET; | ||
1688 | } | ||
1689 | state->first = 0; | ||
1690 | } | ||
1691 | |||
1692 | /* Calculate the integral term */ | ||
1693 | sum = 0; | ||
1694 | integral = 0; | ||
1695 | for (i = 0; i < SLOTS_PID_HISTORY_SIZE; i++) | ||
1696 | integral += state->error_history[i]; | ||
1697 | integral *= SLOTS_PID_INTERVAL; | ||
1698 | DBG(" integral: %08x\n", integral); | ||
1699 | integ_p = ((s64)SLOTS_PID_G_r) * (s64)integral; | ||
1700 | DBG(" integ_p: %d\n", (int)(integ_p >> 36)); | ||
1701 | sum += integ_p; | ||
1702 | |||
1703 | /* Calculate the derivative term */ | ||
1704 | derivative = state->error_history[state->cur_sample] - | ||
1705 | state->error_history[(state->cur_sample + SLOTS_PID_HISTORY_SIZE - 1) | ||
1706 | % SLOTS_PID_HISTORY_SIZE]; | ||
1707 | derivative /= SLOTS_PID_INTERVAL; | ||
1708 | deriv_p = ((s64)SLOTS_PID_G_d) * (s64)derivative; | ||
1709 | DBG(" deriv_p: %d\n", (int)(deriv_p >> 36)); | ||
1710 | sum += deriv_p; | ||
1711 | |||
1712 | /* Calculate the proportional term */ | ||
1713 | prop_p = ((s64)SLOTS_PID_G_p) * (s64)(state->error_history[state->cur_sample]); | ||
1714 | DBG(" prop_p: %d\n", (int)(prop_p >> 36)); | ||
1715 | sum += prop_p; | ||
1716 | |||
1717 | /* Scale sum */ | ||
1718 | sum >>= 36; | ||
1719 | |||
1720 | DBG(" sum: %d\n", (int)sum); | ||
1721 | state->pwm = (s32)sum; | ||
1722 | |||
1723 | state->pwm = max(state->pwm, SLOTS_PID_OUTPUT_MIN); | ||
1724 | state->pwm = min(state->pwm, SLOTS_PID_OUTPUT_MAX); | ||
1725 | |||
1726 | DBG("** DRIVES PWM: %d\n", (int)state->pwm); | ||
1727 | set_pwm_fan(SLOTS_FAN_PWM_INDEX, state->pwm); | ||
1728 | } | ||
1729 | |||
1730 | /* | ||
1731 | * Initialize the state structure for the slots bay fan control loop | ||
1732 | */ | ||
1733 | static int init_slots_state(struct slots_pid_state *state) | ||
1734 | { | ||
1735 | state->ticks = 1; | ||
1736 | state->first = 1; | ||
1737 | state->pwm = 50; | ||
1738 | |||
1739 | state->monitor = attach_i2c_chip(XSERVE_SLOTS_LM75, "slots_temp"); | ||
1740 | if (state->monitor == NULL) | ||
1741 | return -ENODEV; | ||
1742 | |||
1743 | device_create_file(&of_dev->dev, &dev_attr_slots_temperature); | ||
1744 | device_create_file(&of_dev->dev, &dev_attr_slots_fan_pwm); | ||
1745 | |||
1746 | return 0; | ||
1747 | } | ||
1748 | |||
1749 | /* | ||
1750 | * Dispose of the state data for the slots control loop | ||
1751 | */ | ||
1752 | static void dispose_slots_state(struct slots_pid_state *state) | ||
1753 | { | ||
1754 | if (state->monitor == NULL) | ||
1755 | return; | ||
1756 | |||
1757 | device_remove_file(&of_dev->dev, &dev_attr_slots_temperature); | ||
1758 | device_remove_file(&of_dev->dev, &dev_attr_slots_fan_pwm); | ||
1759 | |||
1760 | detach_i2c_chip(state->monitor); | ||
1761 | state->monitor = NULL; | ||
1762 | } | ||
1763 | |||
1764 | |||
1591 | static int call_critical_overtemp(void) | 1765 | static int call_critical_overtemp(void) |
1592 | { | 1766 | { |
1593 | char *argv[] = { critical_overtemp_path, NULL }; | 1767 | char *argv[] = { critical_overtemp_path, NULL }; |
@@ -1617,14 +1791,17 @@ static int main_control_loop(void *x) | |||
1617 | goto out; | 1791 | goto out; |
1618 | } | 1792 | } |
1619 | 1793 | ||
1620 | /* Set the PCI fan once for now */ | 1794 | /* Set the PCI fan once for now on non-RackMac */ |
1621 | set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); | 1795 | if (!rackmac) |
1796 | set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); | ||
1622 | 1797 | ||
1623 | /* Initialize ADCs */ | 1798 | /* Initialize ADCs */ |
1624 | initialize_adc(&cpu_state[0]); | 1799 | initialize_adc(&cpu_state[0]); |
1625 | if (cpu_state[1].monitor != NULL) | 1800 | if (cpu_state[1].monitor != NULL) |
1626 | initialize_adc(&cpu_state[1]); | 1801 | initialize_adc(&cpu_state[1]); |
1627 | 1802 | ||
1803 | fcu_tickle_ticks = FCU_TICKLE_TICKS; | ||
1804 | |||
1628 | up(&driver_lock); | 1805 | up(&driver_lock); |
1629 | 1806 | ||
1630 | while (state == state_attached) { | 1807 | while (state == state_attached) { |
@@ -1634,6 +1811,12 @@ static int main_control_loop(void *x) | |||
1634 | 1811 | ||
1635 | down(&driver_lock); | 1812 | down(&driver_lock); |
1636 | 1813 | ||
1814 | /* Tickle the FCU just in case */ | ||
1815 | if (--fcu_tickle_ticks < 0) { | ||
1816 | fcu_tickle_ticks = FCU_TICKLE_TICKS; | ||
1817 | tickle_fcu(); | ||
1818 | } | ||
1819 | |||
1637 | /* First, we always calculate the new DIMMs state on an Xserve */ | 1820 | /* First, we always calculate the new DIMMs state on an Xserve */ |
1638 | if (rackmac) | 1821 | if (rackmac) |
1639 | do_monitor_dimms(&dimms_state); | 1822 | do_monitor_dimms(&dimms_state); |
@@ -1654,7 +1837,9 @@ static int main_control_loop(void *x) | |||
1654 | } | 1837 | } |
1655 | /* Then, the rest */ | 1838 | /* Then, the rest */ |
1656 | do_monitor_backside(&backside_state); | 1839 | do_monitor_backside(&backside_state); |
1657 | if (!rackmac) | 1840 | if (rackmac) |
1841 | do_monitor_slots(&slots_state); | ||
1842 | else | ||
1658 | do_monitor_drives(&drives_state); | 1843 | do_monitor_drives(&drives_state); |
1659 | up(&driver_lock); | 1844 | up(&driver_lock); |
1660 | 1845 | ||
@@ -1696,6 +1881,7 @@ static void dispose_control_loops(void) | |||
1696 | dispose_cpu_state(&cpu_state[1]); | 1881 | dispose_cpu_state(&cpu_state[1]); |
1697 | dispose_backside_state(&backside_state); | 1882 | dispose_backside_state(&backside_state); |
1698 | dispose_drives_state(&drives_state); | 1883 | dispose_drives_state(&drives_state); |
1884 | dispose_slots_state(&slots_state); | ||
1699 | dispose_dimms_state(&dimms_state); | 1885 | dispose_dimms_state(&dimms_state); |
1700 | } | 1886 | } |
1701 | 1887 | ||
@@ -1745,6 +1931,8 @@ static int create_control_loops(void) | |||
1745 | goto fail; | 1931 | goto fail; |
1746 | if (rackmac && init_dimms_state(&dimms_state)) | 1932 | if (rackmac && init_dimms_state(&dimms_state)) |
1747 | goto fail; | 1933 | goto fail; |
1934 | if (rackmac && init_slots_state(&slots_state)) | ||
1935 | goto fail; | ||
1748 | if (!rackmac && init_drives_state(&drives_state)) | 1936 | if (!rackmac && init_drives_state(&drives_state)) |
1749 | goto fail; | 1937 | goto fail; |
1750 | 1938 | ||
diff --git a/drivers/macintosh/therm_pm72.h b/drivers/macintosh/therm_pm72.h index fc7e9b7ecaf2..393cc9df94e1 100644 --- a/drivers/macintosh/therm_pm72.h +++ b/drivers/macintosh/therm_pm72.h | |||
@@ -105,6 +105,7 @@ static char * critical_overtemp_path = "/sbin/critical_overtemp"; | |||
105 | #define DRIVES_DALLAS_ID 0x94 | 105 | #define DRIVES_DALLAS_ID 0x94 |
106 | #define BACKSIDE_MAX_ID 0x98 | 106 | #define BACKSIDE_MAX_ID 0x98 |
107 | #define XSERVE_DIMMS_LM87 0x25a | 107 | #define XSERVE_DIMMS_LM87 0x25a |
108 | #define XSERVE_SLOTS_LM75 0x290 | ||
108 | 109 | ||
109 | /* | 110 | /* |
110 | * Some MAX6690, DS1775, LM87 register definitions | 111 | * Some MAX6690, DS1775, LM87 register definitions |
@@ -198,7 +199,7 @@ struct drives_pid_state | |||
198 | 199 | ||
199 | #define SLOTS_FAN_PWM_DEFAULT_ID 2 | 200 | #define SLOTS_FAN_PWM_DEFAULT_ID 2 |
200 | #define SLOTS_FAN_PWM_INDEX 2 | 201 | #define SLOTS_FAN_PWM_INDEX 2 |
201 | #define SLOTS_FAN_DEFAULT_PWM 50 /* Do better here ! */ | 202 | #define SLOTS_FAN_DEFAULT_PWM 40 /* Do better here ! */ |
202 | 203 | ||
203 | 204 | ||
204 | /* | 205 | /* |
@@ -206,7 +207,7 @@ struct drives_pid_state | |||
206 | */ | 207 | */ |
207 | #define DIMM_PID_G_d 0 | 208 | #define DIMM_PID_G_d 0 |
208 | #define DIMM_PID_G_p 0 | 209 | #define DIMM_PID_G_p 0 |
209 | #define DIMM_PID_G_r 0x6553600 | 210 | #define DIMM_PID_G_r 0x06553600 |
210 | #define DIMM_PID_INPUT_TARGET 3276800 | 211 | #define DIMM_PID_INPUT_TARGET 3276800 |
211 | #define DIMM_PID_INTERVAL 1 | 212 | #define DIMM_PID_INTERVAL 1 |
212 | #define DIMM_PID_OUTPUT_MAX 14000 | 213 | #define DIMM_PID_OUTPUT_MAX 14000 |
@@ -226,6 +227,31 @@ struct dimm_pid_state | |||
226 | }; | 227 | }; |
227 | 228 | ||
228 | 229 | ||
230 | /* | ||
231 | * PID factors for the Xserve Slots control loop | ||
232 | */ | ||
233 | #define SLOTS_PID_G_d 0 | ||
234 | #define SLOTS_PID_G_p 0 | ||
235 | #define SLOTS_PID_G_r 0x00100000 | ||
236 | #define SLOTS_PID_INPUT_TARGET 3200000 | ||
237 | #define SLOTS_PID_INTERVAL 1 | ||
238 | #define SLOTS_PID_OUTPUT_MAX 100 | ||
239 | #define SLOTS_PID_OUTPUT_MIN 20 | ||
240 | #define SLOTS_PID_HISTORY_SIZE 20 | ||
241 | |||
242 | struct slots_pid_state | ||
243 | { | ||
244 | int ticks; | ||
245 | struct i2c_client * monitor; | ||
246 | s32 sample_history[SLOTS_PID_HISTORY_SIZE]; | ||
247 | s32 error_history[SLOTS_PID_HISTORY_SIZE]; | ||
248 | int cur_sample; | ||
249 | s32 last_temp; | ||
250 | int first; | ||
251 | int pwm; | ||
252 | }; | ||
253 | |||
254 | |||
229 | 255 | ||
230 | /* Desktops */ | 256 | /* Desktops */ |
231 | 257 | ||
@@ -283,6 +309,9 @@ struct cpu_pid_state | |||
283 | s32 pump_max; | 309 | s32 pump_max; |
284 | }; | 310 | }; |
285 | 311 | ||
312 | /* Tickle FCU every 10 seconds */ | ||
313 | #define FCU_TICKLE_TICKS 10 | ||
314 | |||
286 | /* | 315 | /* |
287 | * Driver state | 316 | * Driver state |
288 | */ | 317 | */ |
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index b42d05f2aaff..d3f8d75bcbb4 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -15,8 +15,9 @@ | |||
15 | 15 | ||
16 | #define MAX_PMU_LEVEL 0xFF | 16 | #define MAX_PMU_LEVEL 0xFF |
17 | 17 | ||
18 | static struct device_node *vias; | ||
19 | static struct backlight_properties pmu_backlight_data; | 18 | static struct backlight_properties pmu_backlight_data; |
19 | static spinlock_t pmu_backlight_lock; | ||
20 | static int sleeping; | ||
20 | 21 | ||
21 | static int pmu_backlight_get_level_brightness(struct fb_info *info, | 22 | static int pmu_backlight_get_level_brightness(struct fb_info *info, |
22 | int level) | 23 | int level) |
@@ -40,23 +41,36 @@ static int pmu_backlight_update_status(struct backlight_device *bd) | |||
40 | { | 41 | { |
41 | struct fb_info *info = class_get_devdata(&bd->class_dev); | 42 | struct fb_info *info = class_get_devdata(&bd->class_dev); |
42 | struct adb_request req; | 43 | struct adb_request req; |
43 | int pmulevel, level = bd->props->brightness; | 44 | unsigned long flags; |
45 | int level = bd->props->brightness; | ||
44 | 46 | ||
45 | if (vias == NULL) | 47 | spin_lock_irqsave(&pmu_backlight_lock, flags); |
46 | return -ENODEV; | 48 | |
49 | /* Don't update brightness when sleeping */ | ||
50 | if (sleeping) | ||
51 | goto out; | ||
47 | 52 | ||
48 | if (bd->props->power != FB_BLANK_UNBLANK || | 53 | if (bd->props->power != FB_BLANK_UNBLANK || |
49 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 54 | bd->props->fb_blank != FB_BLANK_UNBLANK) |
50 | level = 0; | 55 | level = 0; |
51 | 56 | ||
52 | pmulevel = pmu_backlight_get_level_brightness(info, level); | 57 | if (level > 0) { |
58 | int pmulevel = pmu_backlight_get_level_brightness(info, level); | ||
53 | 59 | ||
54 | pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, pmulevel); | 60 | pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, pmulevel); |
55 | pmu_wait_complete(&req); | 61 | pmu_wait_complete(&req); |
56 | 62 | ||
57 | pmu_request(&req, NULL, 2, PMU_POWER_CTRL, | 63 | pmu_request(&req, NULL, 2, PMU_POWER_CTRL, |
58 | PMU_POW_BACKLIGHT | (level > 0 ? PMU_POW_ON : PMU_POW_OFF)); | 64 | PMU_POW_BACKLIGHT | PMU_POW_ON); |
59 | pmu_wait_complete(&req); | 65 | pmu_wait_complete(&req); |
66 | } else { | ||
67 | pmu_request(&req, NULL, 2, PMU_POWER_CTRL, | ||
68 | PMU_POW_BACKLIGHT | PMU_POW_OFF); | ||
69 | pmu_wait_complete(&req); | ||
70 | } | ||
71 | |||
72 | out: | ||
73 | spin_unlock_irqrestore(&pmu_backlight_lock, flags); | ||
60 | 74 | ||
61 | return 0; | 75 | return 0; |
62 | } | 76 | } |
@@ -73,15 +87,39 @@ static struct backlight_properties pmu_backlight_data = { | |||
73 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 87 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), |
74 | }; | 88 | }; |
75 | 89 | ||
76 | void __init pmu_backlight_init(struct device_node *in_vias) | 90 | #ifdef CONFIG_PM |
91 | static int pmu_backlight_sleep_call(struct pmu_sleep_notifier *self, int when) | ||
92 | { | ||
93 | unsigned long flags; | ||
94 | |||
95 | spin_lock_irqsave(&pmu_backlight_lock, flags); | ||
96 | |||
97 | switch (when) { | ||
98 | case PBOOK_SLEEP_REQUEST: | ||
99 | sleeping = 1; | ||
100 | break; | ||
101 | case PBOOK_WAKE: | ||
102 | sleeping = 0; | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | spin_unlock_irqrestore(&pmu_backlight_lock, flags); | ||
107 | |||
108 | return PBOOK_SLEEP_OK; | ||
109 | } | ||
110 | |||
111 | static struct pmu_sleep_notifier pmu_backlight_sleep_notif = { | ||
112 | .notifier_call = pmu_backlight_sleep_call, | ||
113 | }; | ||
114 | #endif | ||
115 | |||
116 | void __init pmu_backlight_init() | ||
77 | { | 117 | { |
78 | struct backlight_device *bd; | 118 | struct backlight_device *bd; |
79 | struct fb_info *info; | 119 | struct fb_info *info; |
80 | char name[10]; | 120 | char name[10]; |
81 | int level, autosave; | 121 | int level, autosave; |
82 | 122 | ||
83 | vias = in_vias; | ||
84 | |||
85 | /* Special case for the old PowerBook since I can't test on it */ | 123 | /* Special case for the old PowerBook since I can't test on it */ |
86 | autosave = | 124 | autosave = |
87 | machine_is_compatible("AAPL,3400/2400") || | 125 | machine_is_compatible("AAPL,3400/2400") || |
@@ -141,6 +179,10 @@ void __init pmu_backlight_init(struct device_node *in_vias) | |||
141 | pmac_backlight = bd; | 179 | pmac_backlight = bd; |
142 | mutex_unlock(&pmac_backlight_mutex); | 180 | mutex_unlock(&pmac_backlight_mutex); |
143 | 181 | ||
182 | #ifdef CONFIG_PM | ||
183 | pmu_register_sleep_notifier(&pmu_backlight_sleep_notif); | ||
184 | #endif | ||
185 | |||
144 | printk("pmubl: Backlight initialized (%s)\n", name); | 186 | printk("pmubl: Backlight initialized (%s)\n", name); |
145 | 187 | ||
146 | return; | 188 | return; |
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c index af8375ed0f5e..5189d5454b1f 100644 --- a/drivers/macintosh/via-pmu-led.c +++ b/drivers/macintosh/via-pmu-led.c | |||
@@ -74,7 +74,7 @@ static void pmu_led_set(struct led_classdev *led_cdev, | |||
74 | 74 | ||
75 | static struct led_classdev pmu_led = { | 75 | static struct led_classdev pmu_led = { |
76 | .name = "pmu-front-led", | 76 | .name = "pmu-front-led", |
77 | #ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK | 77 | #ifdef CONFIG_ADB_PMU_LED_IDE |
78 | .default_trigger = "ide-disk", | 78 | .default_trigger = "ide-disk", |
79 | #endif | 79 | #endif |
80 | .brightness_set = pmu_led_set, | 80 | .brightness_set = pmu_led_set, |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 06ca80bfd6b9..ea386801e215 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * a sleep or a freq. switch | 16 | * a sleep or a freq. switch |
17 | * - Move sleep code out of here to pmac_pm, merge into new | 17 | * - Move sleep code out of here to pmac_pm, merge into new |
18 | * common PM infrastructure | 18 | * common PM infrastructure |
19 | * - Move backlight code out as well | ||
20 | * - Save/Restore PCI space properly | 19 | * - Save/Restore PCI space properly |
21 | * | 20 | * |
22 | */ | 21 | */ |
@@ -60,9 +59,7 @@ | |||
60 | #include <asm/mmu_context.h> | 59 | #include <asm/mmu_context.h> |
61 | #include <asm/cputable.h> | 60 | #include <asm/cputable.h> |
62 | #include <asm/time.h> | 61 | #include <asm/time.h> |
63 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
64 | #include <asm/backlight.h> | 62 | #include <asm/backlight.h> |
65 | #endif | ||
66 | 63 | ||
67 | #include "via-pmu-event.h" | 64 | #include "via-pmu-event.h" |
68 | 65 | ||
@@ -177,10 +174,6 @@ static int query_batt_timer = BATTERY_POLLING_COUNT; | |||
177 | static struct adb_request batt_req; | 174 | static struct adb_request batt_req; |
178 | static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES]; | 175 | static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES]; |
179 | 176 | ||
180 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) | ||
181 | extern int disable_kernel_backlight; | ||
182 | #endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ | ||
183 | |||
184 | int __fake_sleep; | 177 | int __fake_sleep; |
185 | int asleep; | 178 | int asleep; |
186 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); | 179 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); |
@@ -466,7 +459,7 @@ static int __init via_pmu_dev_init(void) | |||
466 | 459 | ||
467 | #ifdef CONFIG_PMAC_BACKLIGHT | 460 | #ifdef CONFIG_PMAC_BACKLIGHT |
468 | /* Initialize backlight */ | 461 | /* Initialize backlight */ |
469 | pmu_backlight_init(vias); | 462 | pmu_backlight_init(); |
470 | #endif | 463 | #endif |
471 | 464 | ||
472 | #ifdef CONFIG_PPC32 | 465 | #ifdef CONFIG_PPC32 |
@@ -1403,11 +1396,8 @@ next: | |||
1403 | else if ((1 << pirq) & PMU_INT_SNDBRT) { | 1396 | else if ((1 << pirq) & PMU_INT_SNDBRT) { |
1404 | #ifdef CONFIG_PMAC_BACKLIGHT | 1397 | #ifdef CONFIG_PMAC_BACKLIGHT |
1405 | if (len == 3) | 1398 | if (len == 3) |
1406 | #ifdef CONFIG_INPUT_ADBHID | 1399 | pmac_backlight_set_legacy_brightness_pmu(data[1] >> 4); |
1407 | if (!disable_kernel_backlight) | 1400 | #endif |
1408 | #endif /* CONFIG_INPUT_ADBHID */ | ||
1409 | pmac_backlight_set_legacy_brightness(data[1] >> 4); | ||
1410 | #endif /* CONFIG_PMAC_BACKLIGHT */ | ||
1411 | } | 1401 | } |
1412 | /* Tick interrupt */ | 1402 | /* Tick interrupt */ |
1413 | else if ((1 << pirq) & PMU_INT_TICK) { | 1403 | else if ((1 << pirq) & PMU_INT_TICK) { |
@@ -2414,7 +2404,7 @@ struct pmu_private { | |||
2414 | spinlock_t lock; | 2404 | spinlock_t lock; |
2415 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) | 2405 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) |
2416 | int backlight_locker; | 2406 | int backlight_locker; |
2417 | #endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ | 2407 | #endif |
2418 | }; | 2408 | }; |
2419 | 2409 | ||
2420 | static LIST_HEAD(all_pmu_pvt); | 2410 | static LIST_HEAD(all_pmu_pvt); |
@@ -2464,7 +2454,7 @@ pmu_open(struct inode *inode, struct file *file) | |||
2464 | spin_lock_irqsave(&all_pvt_lock, flags); | 2454 | spin_lock_irqsave(&all_pvt_lock, flags); |
2465 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) | 2455 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) |
2466 | pp->backlight_locker = 0; | 2456 | pp->backlight_locker = 0; |
2467 | #endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ | 2457 | #endif |
2468 | list_add(&pp->list, &all_pmu_pvt); | 2458 | list_add(&pp->list, &all_pmu_pvt); |
2469 | spin_unlock_irqrestore(&all_pvt_lock, flags); | 2459 | spin_unlock_irqrestore(&all_pvt_lock, flags); |
2470 | file->private_data = pp; | 2460 | file->private_data = pp; |
@@ -2559,13 +2549,12 @@ pmu_release(struct inode *inode, struct file *file) | |||
2559 | spin_lock_irqsave(&all_pvt_lock, flags); | 2549 | spin_lock_irqsave(&all_pvt_lock, flags); |
2560 | list_del(&pp->list); | 2550 | list_del(&pp->list); |
2561 | spin_unlock_irqrestore(&all_pvt_lock, flags); | 2551 | spin_unlock_irqrestore(&all_pvt_lock, flags); |
2552 | |||
2562 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) | 2553 | #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) |
2563 | if (pp->backlight_locker) { | 2554 | if (pp->backlight_locker) |
2564 | spin_lock_irqsave(&pmu_lock, flags); | 2555 | pmac_backlight_enable(); |
2565 | disable_kernel_backlight--; | 2556 | #endif |
2566 | spin_unlock_irqrestore(&pmu_lock, flags); | 2557 | |
2567 | } | ||
2568 | #endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ | ||
2569 | kfree(pp); | 2558 | kfree(pp); |
2570 | } | 2559 | } |
2571 | unlock_kernel(); | 2560 | unlock_kernel(); |
@@ -2642,18 +2631,18 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
2642 | #ifdef CONFIG_INPUT_ADBHID | 2631 | #ifdef CONFIG_INPUT_ADBHID |
2643 | case PMU_IOC_GRAB_BACKLIGHT: { | 2632 | case PMU_IOC_GRAB_BACKLIGHT: { |
2644 | struct pmu_private *pp = filp->private_data; | 2633 | struct pmu_private *pp = filp->private_data; |
2645 | unsigned long flags; | ||
2646 | 2634 | ||
2647 | if (pp->backlight_locker) | 2635 | if (pp->backlight_locker) |
2648 | return 0; | 2636 | return 0; |
2637 | |||
2649 | pp->backlight_locker = 1; | 2638 | pp->backlight_locker = 1; |
2650 | spin_lock_irqsave(&pmu_lock, flags); | 2639 | pmac_backlight_disable(); |
2651 | disable_kernel_backlight++; | 2640 | |
2652 | spin_unlock_irqrestore(&pmu_lock, flags); | ||
2653 | return 0; | 2641 | return 0; |
2654 | } | 2642 | } |
2655 | #endif /* CONFIG_INPUT_ADBHID */ | 2643 | #endif /* CONFIG_INPUT_ADBHID */ |
2656 | #endif /* CONFIG_PMAC_BACKLIGHT_LEGACY */ | 2644 | #endif /* CONFIG_PMAC_BACKLIGHT_LEGACY */ |
2645 | |||
2657 | case PMU_IOC_GET_MODEL: | 2646 | case PMU_IOC_GET_MODEL: |
2658 | return put_user(pmu_kind, argp); | 2647 | return put_user(pmu_kind, argp); |
2659 | case PMU_IOC_HAS_ADB: | 2648 | case PMU_IOC_HAS_ADB: |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 59ac35ddd51e..57b34cda99f5 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -526,7 +526,9 @@ static int dvb_frontend_thread(void *data) | |||
526 | fepriv->delay = 3*HZ; | 526 | fepriv->delay = 3*HZ; |
527 | fepriv->status = 0; | 527 | fepriv->status = 0; |
528 | fepriv->wakeup = 0; | 528 | fepriv->wakeup = 0; |
529 | fepriv->reinitialise = 1; | 529 | fepriv->reinitialise = 0; |
530 | |||
531 | dvb_frontend_init(fe); | ||
530 | 532 | ||
531 | while (1) { | 533 | while (1) { |
532 | up(&fepriv->sem); /* is locked when we enter the thread... */ | 534 | up(&fepriv->sem); /* is locked when we enter the thread... */ |
@@ -1013,17 +1015,18 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) | |||
1013 | return ret; | 1015 | return ret; |
1014 | 1016 | ||
1015 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { | 1017 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { |
1018 | |||
1019 | /* normal tune mode when opened R/W */ | ||
1020 | fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; | ||
1021 | fepriv->tone = -1; | ||
1022 | fepriv->voltage = -1; | ||
1023 | |||
1016 | ret = dvb_frontend_start (fe); | 1024 | ret = dvb_frontend_start (fe); |
1017 | if (ret) | 1025 | if (ret) |
1018 | dvb_generic_release (inode, file); | 1026 | dvb_generic_release (inode, file); |
1019 | 1027 | ||
1020 | /* empty event queue */ | 1028 | /* empty event queue */ |
1021 | fepriv->events.eventr = fepriv->events.eventw = 0; | 1029 | fepriv->events.eventr = fepriv->events.eventw = 0; |
1022 | |||
1023 | /* normal tune mode when opened R/W */ | ||
1024 | fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; | ||
1025 | fepriv->tone = -1; | ||
1026 | fepriv->voltage = -1; | ||
1027 | } | 1030 | } |
1028 | 1031 | ||
1029 | return ret; | 1032 | return ret; |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index a189683454b7..2be33f27c69f 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -194,11 +194,11 @@ struct dvb_pll_desc dvb_pll_tda665x = { | |||
194 | { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ }, | 194 | { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ }, |
195 | { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ }, | 195 | { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ }, |
196 | { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, | 196 | { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, |
197 | { 444000000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, | 197 | { 444000000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ }, |
198 | { 583834000, 36249333, 166667, 0xca, 0x63 /* 011 0 0 0 11 */ }, | 198 | { 583834000, 36249333, 166667, 0xca, 0x64 /* 011 0 0 1 00 */ }, |
199 | { 793834000, 36249333, 166667, 0xca, 0xa3 /* 101 0 0 0 11 */ }, | 199 | { 793834000, 36249333, 166667, 0xca, 0xa4 /* 101 0 0 1 00 */ }, |
200 | { 444834000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, | 200 | { 444834000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ }, |
201 | { 861000000, 36249333, 166667, 0xca, 0xe3 /* 111 0 0 0 11 */ }, | 201 | { 861000000, 36249333, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ }, |
202 | } | 202 | } |
203 | }; | 203 | }; |
204 | EXPORT_SYMBOL(dvb_pll_tda665x); | 204 | EXPORT_SYMBOL(dvb_pll_tda665x); |
@@ -613,7 +613,21 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = { | |||
613 | 613 | ||
614 | int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) | 614 | int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) |
615 | { | 615 | { |
616 | u8 b1 [] = { 0 }; | ||
617 | struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .buf = b1, .len = 1 }; | ||
616 | struct dvb_pll_priv *priv = NULL; | 618 | struct dvb_pll_priv *priv = NULL; |
619 | int ret; | ||
620 | |||
621 | if (i2c != NULL) { | ||
622 | if (fe->ops.i2c_gate_ctrl) | ||
623 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
624 | |||
625 | ret = i2c_transfer (i2c, &msg, 1); | ||
626 | if (ret != 1) | ||
627 | return -1; | ||
628 | if (fe->ops.i2c_gate_ctrl) | ||
629 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
630 | } | ||
617 | 631 | ||
618 | priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); | 632 | priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); |
619 | if (priv == NULL) | 633 | if (priv == NULL) |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 500f15c10aaf..4506165c5de2 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -2203,8 +2203,8 @@ static int frontend_init(struct av7110 *av7110) | |||
2203 | av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; | 2203 | av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; |
2204 | 2204 | ||
2205 | /* set TDA9819 into DVB mode */ | 2205 | /* set TDA9819 into DVB mode */ |
2206 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) | 2206 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) |
2207 | saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) | 2207 | saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) |
2208 | 2208 | ||
2209 | /* tuner on this needs a slower i2c bus speed */ | 2209 | /* tuner on this needs a slower i2c bus speed */ |
2210 | av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; | 2210 | av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; |
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index 64055461559d..6ffe53fdcf57 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c | |||
@@ -272,8 +272,8 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
272 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) | 272 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) |
273 | dprintk(1, "setting band in demodulator failed.\n"); | 273 | dprintk(1, "setting band in demodulator failed.\n"); |
274 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 274 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { |
275 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) | 275 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD) |
276 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) | 276 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF) |
277 | } | 277 | } |
278 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1) | 278 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1) |
279 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | 279 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); |
@@ -308,8 +308,8 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
308 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) | 308 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) |
309 | dprintk(1, "setting band in demodulator failed.\n"); | 309 | dprintk(1, "setting band in demodulator failed.\n"); |
310 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 310 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { |
311 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) | 311 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) |
312 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) | 312 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
@@ -750,8 +750,8 @@ int av7110_init_analog_module(struct av7110 *av7110) | |||
750 | if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) | 750 | if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) |
751 | dprintk(1, "setting band in demodulator failed.\n"); | 751 | dprintk(1, "setting band in demodulator failed.\n"); |
752 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 752 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { |
753 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) | 753 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) |
754 | saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) | 754 | saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) |
755 | } | 755 | } |
756 | 756 | ||
757 | /* init the saa7113 */ | 757 | /* init the saa7113 */ |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 5f111d407730..2d21fec23b4d 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -1303,6 +1303,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1303 | budget_av->budget.dvb_adapter.priv = budget_av; | 1303 | budget_av->budget.dvb_adapter.priv = budget_av; |
1304 | frontend_init(budget_av); | 1304 | frontend_init(budget_av); |
1305 | ciintf_init(budget_av); | 1305 | ciintf_init(budget_av); |
1306 | |||
1307 | ttpci_budget_init_hooks(&budget_av->budget); | ||
1308 | |||
1306 | return 0; | 1309 | return 0; |
1307 | } | 1310 | } |
1308 | 1311 | ||
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 4b966eea3834..ffbbb3e34be4 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -1101,6 +1101,8 @@ static int budget_ci_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
1101 | budget_ci->budget.dvb_adapter.priv = budget_ci; | 1101 | budget_ci->budget.dvb_adapter.priv = budget_ci; |
1102 | frontend_init(budget_ci); | 1102 | frontend_init(budget_ci); |
1103 | 1103 | ||
1104 | ttpci_budget_init_hooks(&budget_ci->budget); | ||
1105 | |||
1104 | return 0; | 1106 | return 0; |
1105 | } | 1107 | } |
1106 | 1108 | ||
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c index e4cf7775e07f..e15562f81664 100644 --- a/drivers/media/dvb/ttpci/budget-core.c +++ b/drivers/media/dvb/ttpci/budget-core.c | |||
@@ -63,9 +63,6 @@ static int stop_ts_capture(struct budget *budget) | |||
63 | { | 63 | { |
64 | dprintk(2, "budget: %p\n", budget); | 64 | dprintk(2, "budget: %p\n", budget); |
65 | 65 | ||
66 | if (--budget->feeding) | ||
67 | return budget->feeding; | ||
68 | |||
69 | saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off | 66 | saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off |
70 | SAA7146_IER_DISABLE(budget->dev, MASK_10); | 67 | SAA7146_IER_DISABLE(budget->dev, MASK_10); |
71 | return 0; | 68 | return 0; |
@@ -77,8 +74,8 @@ static int start_ts_capture(struct budget *budget) | |||
77 | 74 | ||
78 | dprintk(2, "budget: %p\n", budget); | 75 | dprintk(2, "budget: %p\n", budget); |
79 | 76 | ||
80 | if (budget->feeding) | 77 | if (!budget->feeding || !budget->fe_synced) |
81 | return ++budget->feeding; | 78 | return 0; |
82 | 79 | ||
83 | saa7146_write(dev, MC1, MASK_20); // DMA3 off | 80 | saa7146_write(dev, MC1, MASK_20); // DMA3 off |
84 | 81 | ||
@@ -139,7 +136,33 @@ static int start_ts_capture(struct budget *budget) | |||
139 | SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */ | 136 | SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */ |
140 | saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */ | 137 | saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */ |
141 | 138 | ||
142 | return ++budget->feeding; | 139 | return 0; |
140 | } | ||
141 | |||
142 | static int budget_read_fe_status(struct dvb_frontend *fe, fe_status_t *status) | ||
143 | { | ||
144 | struct budget *budget = (struct budget *) fe->dvb->priv; | ||
145 | int synced; | ||
146 | int ret; | ||
147 | |||
148 | if (budget->read_fe_status) | ||
149 | ret = budget->read_fe_status(fe, status); | ||
150 | else | ||
151 | ret = -EINVAL; | ||
152 | |||
153 | if (!ret) { | ||
154 | synced = (*status & FE_HAS_LOCK); | ||
155 | if (synced != budget->fe_synced) { | ||
156 | budget->fe_synced = synced; | ||
157 | spin_lock(&budget->feedlock); | ||
158 | if (synced) | ||
159 | start_ts_capture(budget); | ||
160 | else | ||
161 | stop_ts_capture(budget); | ||
162 | spin_unlock(&budget->feedlock); | ||
163 | } | ||
164 | } | ||
165 | return ret; | ||
143 | } | 166 | } |
144 | 167 | ||
145 | static void vpeirq(unsigned long data) | 168 | static void vpeirq(unsigned long data) |
@@ -267,7 +290,7 @@ static int budget_start_feed(struct dvb_demux_feed *feed) | |||
267 | { | 290 | { |
268 | struct dvb_demux *demux = feed->demux; | 291 | struct dvb_demux *demux = feed->demux; |
269 | struct budget *budget = (struct budget *) demux->priv; | 292 | struct budget *budget = (struct budget *) demux->priv; |
270 | int status; | 293 | int status = 0; |
271 | 294 | ||
272 | dprintk(2, "budget: %p\n", budget); | 295 | dprintk(2, "budget: %p\n", budget); |
273 | 296 | ||
@@ -276,7 +299,8 @@ static int budget_start_feed(struct dvb_demux_feed *feed) | |||
276 | 299 | ||
277 | spin_lock(&budget->feedlock); | 300 | spin_lock(&budget->feedlock); |
278 | feed->pusi_seen = 0; /* have a clean section start */ | 301 | feed->pusi_seen = 0; /* have a clean section start */ |
279 | status = start_ts_capture(budget); | 302 | if (budget->feeding++ == 0) |
303 | status = start_ts_capture(budget); | ||
280 | spin_unlock(&budget->feedlock); | 304 | spin_unlock(&budget->feedlock); |
281 | return status; | 305 | return status; |
282 | } | 306 | } |
@@ -285,12 +309,13 @@ static int budget_stop_feed(struct dvb_demux_feed *feed) | |||
285 | { | 309 | { |
286 | struct dvb_demux *demux = feed->demux; | 310 | struct dvb_demux *demux = feed->demux; |
287 | struct budget *budget = (struct budget *) demux->priv; | 311 | struct budget *budget = (struct budget *) demux->priv; |
288 | int status; | 312 | int status = 0; |
289 | 313 | ||
290 | dprintk(2, "budget: %p\n", budget); | 314 | dprintk(2, "budget: %p\n", budget); |
291 | 315 | ||
292 | spin_lock(&budget->feedlock); | 316 | spin_lock(&budget->feedlock); |
293 | status = stop_ts_capture(budget); | 317 | if (--budget->feeding == 0) |
318 | status = stop_ts_capture(budget); | ||
294 | spin_unlock(&budget->feedlock); | 319 | spin_unlock(&budget->feedlock); |
295 | return status; | 320 | return status; |
296 | } | 321 | } |
@@ -470,6 +495,14 @@ err: | |||
470 | return ret; | 495 | return ret; |
471 | } | 496 | } |
472 | 497 | ||
498 | void ttpci_budget_init_hooks(struct budget *budget) | ||
499 | { | ||
500 | if (budget->dvb_frontend && !budget->read_fe_status) { | ||
501 | budget->read_fe_status = budget->dvb_frontend->ops.read_status; | ||
502 | budget->dvb_frontend->ops.read_status = budget_read_fe_status; | ||
503 | } | ||
504 | } | ||
505 | |||
473 | int ttpci_budget_deinit(struct budget *budget) | 506 | int ttpci_budget_deinit(struct budget *budget) |
474 | { | 507 | { |
475 | struct saa7146_dev *dev = budget->dev; | 508 | struct saa7146_dev *dev = budget->dev; |
@@ -508,11 +541,8 @@ void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port) | |||
508 | spin_lock(&budget->feedlock); | 541 | spin_lock(&budget->feedlock); |
509 | budget->video_port = video_port; | 542 | budget->video_port = video_port; |
510 | if (budget->feeding) { | 543 | if (budget->feeding) { |
511 | int oldfeeding = budget->feeding; | ||
512 | budget->feeding = 1; | ||
513 | stop_ts_capture(budget); | 544 | stop_ts_capture(budget); |
514 | start_ts_capture(budget); | 545 | start_ts_capture(budget); |
515 | budget->feeding = oldfeeding; | ||
516 | } | 546 | } |
517 | spin_unlock(&budget->feedlock); | 547 | spin_unlock(&budget->feedlock); |
518 | } | 548 | } |
@@ -520,6 +550,7 @@ void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port) | |||
520 | EXPORT_SYMBOL_GPL(ttpci_budget_debiread); | 550 | EXPORT_SYMBOL_GPL(ttpci_budget_debiread); |
521 | EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite); | 551 | EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite); |
522 | EXPORT_SYMBOL_GPL(ttpci_budget_init); | 552 | EXPORT_SYMBOL_GPL(ttpci_budget_init); |
553 | EXPORT_SYMBOL_GPL(ttpci_budget_init_hooks); | ||
523 | EXPORT_SYMBOL_GPL(ttpci_budget_deinit); | 554 | EXPORT_SYMBOL_GPL(ttpci_budget_deinit); |
524 | EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler); | 555 | EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler); |
525 | EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port); | 556 | EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port); |
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c index ee60ce90a400..57227441891e 100644 --- a/drivers/media/dvb/ttpci/budget-patch.c +++ b/drivers/media/dvb/ttpci/budget-patch.c | |||
@@ -617,6 +617,8 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte | |||
617 | budget->dvb_adapter.priv = budget; | 617 | budget->dvb_adapter.priv = budget; |
618 | frontend_init(budget); | 618 | frontend_init(budget); |
619 | 619 | ||
620 | ttpci_budget_init_hooks(budget); | ||
621 | |||
620 | return 0; | 622 | return 0; |
621 | } | 623 | } |
622 | 624 | ||
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 35761f13c12b..863dffb4ed8e 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -375,9 +375,6 @@ static void frontend_init(struct budget *budget) | |||
375 | if (budget->dvb_frontend) { | 375 | if (budget->dvb_frontend) { |
376 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; | 376 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; |
377 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | 377 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; |
378 | budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd; | ||
379 | budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst; | ||
380 | budget->dvb_frontend->ops.set_tone = budget_set_tone; | ||
381 | break; | 378 | break; |
382 | } | 379 | } |
383 | break; | 380 | break; |
@@ -474,6 +471,8 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ | |||
474 | budget->dvb_adapter.priv = budget; | 471 | budget->dvb_adapter.priv = budget; |
475 | frontend_init(budget); | 472 | frontend_init(budget); |
476 | 473 | ||
474 | ttpci_budget_init_hooks(budget); | ||
475 | |||
477 | return 0; | 476 | return 0; |
478 | } | 477 | } |
479 | 478 | ||
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h index ecea3a13030e..e8a5c79178e1 100644 --- a/drivers/media/dvb/ttpci/budget.h +++ b/drivers/media/dvb/ttpci/budget.h | |||
@@ -52,9 +52,6 @@ struct budget { | |||
52 | struct dmx_frontend hw_frontend; | 52 | struct dmx_frontend hw_frontend; |
53 | struct dmx_frontend mem_frontend; | 53 | struct dmx_frontend mem_frontend; |
54 | 54 | ||
55 | int fe_synced; | ||
56 | struct mutex pid_mutex; | ||
57 | |||
58 | int ci_present; | 55 | int ci_present; |
59 | int video_port; | 56 | int video_port; |
60 | 57 | ||
@@ -74,6 +71,9 @@ struct budget { | |||
74 | 71 | ||
75 | struct dvb_adapter dvb_adapter; | 72 | struct dvb_adapter dvb_adapter; |
76 | struct dvb_frontend *dvb_frontend; | 73 | struct dvb_frontend *dvb_frontend; |
74 | int (*read_fe_status)(struct dvb_frontend *fe, fe_status_t *status); | ||
75 | int fe_synced; | ||
76 | |||
77 | void *priv; | 77 | void *priv; |
78 | }; | 78 | }; |
79 | 79 | ||
@@ -106,6 +106,7 @@ static struct saa7146_pci_extension_data x_var = { \ | |||
106 | extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, | 106 | extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, |
107 | struct saa7146_pci_extension_data *info, | 107 | struct saa7146_pci_extension_data *info, |
108 | struct module *owner); | 108 | struct module *owner); |
109 | extern void ttpci_budget_init_hooks(struct budget *budget); | ||
109 | extern int ttpci_budget_deinit(struct budget *budget); | 110 | extern int ttpci_budget_deinit(struct budget *budget); |
110 | extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr); | 111 | extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr); |
111 | extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port); | 112 | extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port); |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 6d532f170ce5..fe56862d51e4 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -145,7 +145,7 @@ config VIDEO_SAA5246A | |||
145 | 145 | ||
146 | config VIDEO_SAA5249 | 146 | config VIDEO_SAA5249 |
147 | tristate "SAA5249 Teletext processor" | 147 | tristate "SAA5249 Teletext processor" |
148 | depends on VIDEO_DEV && I2C | 148 | depends on VIDEO_DEV && I2C && VIDEO_V4L1 |
149 | help | 149 | help |
150 | Support for I2C bus based teletext using the SAA5249 chip. At the | 150 | Support for I2C bus based teletext using the SAA5249 chip. At the |
151 | moment this is only useful on some European WinTV cards. | 151 | moment this is only useful on some European WinTV cards. |
@@ -155,7 +155,7 @@ config VIDEO_SAA5249 | |||
155 | 155 | ||
156 | config TUNER_3036 | 156 | config TUNER_3036 |
157 | tristate "SAB3036 tuner" | 157 | tristate "SAB3036 tuner" |
158 | depends on VIDEO_DEV && I2C | 158 | depends on VIDEO_DEV && I2C && VIDEO_V4L1 |
159 | help | 159 | help |
160 | Say Y here to include support for Philips SAB3036 compatible tuners. | 160 | Say Y here to include support for Philips SAB3036 compatible tuners. |
161 | If in doubt, say N. | 161 | If in doubt, say N. |
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig index 153f6a4a96c9..cdcf55650714 100644 --- a/drivers/media/video/bt8xx/Kconfig +++ b/drivers/media/video/bt8xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_BT848 | 1 | config VIDEO_BT848 |
2 | tristate "BT848 Video For Linux" | 2 | tristate "BT848 Video For Linux" |
3 | depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 | 3 | depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L1 |
4 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select VIDEO_BTCX | 6 | select VIDEO_BTCX |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 5764a89d3562..20dff7c316eb 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3923,7 +3923,12 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
3923 | goto err; | 3923 | goto err; |
3924 | printk(KERN_INFO "bttv%d: registered device video%d\n", | 3924 | printk(KERN_INFO "bttv%d: registered device video%d\n", |
3925 | btv->c.nr,btv->video_dev->minor & 0x1f); | 3925 | btv->c.nr,btv->video_dev->minor & 0x1f); |
3926 | video_device_create_file(btv->video_dev, &class_device_attr_card); | 3926 | if (class_device_create_file(&btv->video_dev->class_dev, |
3927 | &class_device_attr_card)<0) { | ||
3928 | printk(KERN_ERR "bttv%d: class_device_create_file 'card' " | ||
3929 | "failed\n", btv->c.nr); | ||
3930 | goto err; | ||
3931 | } | ||
3927 | 3932 | ||
3928 | /* vbi */ | 3933 | /* vbi */ |
3929 | btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); | 3934 | btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); |
@@ -4287,6 +4292,8 @@ static struct pci_driver bttv_pci_driver = { | |||
4287 | 4292 | ||
4288 | static int bttv_init_module(void) | 4293 | static int bttv_init_module(void) |
4289 | { | 4294 | { |
4295 | int ret; | ||
4296 | |||
4290 | bttv_num = 0; | 4297 | bttv_num = 0; |
4291 | 4298 | ||
4292 | printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n", | 4299 | printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n", |
@@ -4308,7 +4315,11 @@ static int bttv_init_module(void) | |||
4308 | 4315 | ||
4309 | bttv_check_chipset(); | 4316 | bttv_check_chipset(); |
4310 | 4317 | ||
4311 | bus_register(&bttv_sub_bus_type); | 4318 | ret = bus_register(&bttv_sub_bus_type); |
4319 | if (ret < 0) { | ||
4320 | printk(KERN_WARNING "bttv: bus_register error: %d\n", ret); | ||
4321 | return ret; | ||
4322 | } | ||
4312 | return pci_register_driver(&bttv_pci_driver); | 4323 | return pci_register_driver(&bttv_pci_driver); |
4313 | } | 4324 | } |
4314 | 4325 | ||
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c index 8c9f0f7cf467..63676e7bd635 100644 --- a/drivers/media/video/bt8xx/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c | |||
@@ -31,11 +31,16 @@ | |||
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include "bttvp.h" | 32 | #include "bttvp.h" |
33 | 33 | ||
34 | /* Offset from line sync pulse leading edge (0H) in 1 / sampling_rate: | 34 | /* Offset from line sync pulse leading edge (0H) to start of VBI capture, |
35 | bt8x8 /HRESET pulse starts at 0H and has length 64 / fCLKx1 (E|O_VTC | 35 | in fCLKx2 pixels. According to the datasheet, VBI capture starts |
36 | HSFMT = 0). VBI_HDELAY (always 0) is an offset from the trailing edge | 36 | VBI_HDELAY fCLKx1 pixels from the tailing edgeof /HRESET, and /HRESET |
37 | of /HRESET in 1 / fCLKx1, and the sampling_rate tvnorm->Fsc is fCLKx2. */ | 37 | is 64 fCLKx1 pixels wide. VBI_HDELAY is set to 0, so this should be |
38 | #define VBI_OFFSET ((64 + 0) * 2) | 38 | (64 + 0) * 2 = 128 fCLKx2 pixels. But it's not! The datasheet is |
39 | Just Plain Wrong. The real value appears to be different for | ||
40 | different revisions of the bt8x8 chips, and to be affected by the | ||
41 | horizontal scaling factor. Experimentally, the value is measured | ||
42 | to be about 244. */ | ||
43 | #define VBI_OFFSET 244 | ||
39 | 44 | ||
40 | #define VBI_DEFLINES 16 | 45 | #define VBI_DEFLINES 16 |
41 | #define VBI_MAXLINES 32 | 46 | #define VBI_MAXLINES 32 |
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c index 353d02b67c33..9dddff42ec13 100644 --- a/drivers/media/video/compat_ioctl32.c +++ b/drivers/media/video/compat_ioctl32.c | |||
@@ -490,6 +490,23 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user | |||
490 | return 0; | 490 | return 0; |
491 | } | 491 | } |
492 | 492 | ||
493 | struct video_code32 | ||
494 | { | ||
495 | char loadwhat[16]; /* name or tag of file being passed */ | ||
496 | compat_int_t datasize; | ||
497 | unsigned char *data; | ||
498 | }; | ||
499 | |||
500 | static inline int microcode32(struct video_code *kp, struct video_code32 __user *up) | ||
501 | { | ||
502 | if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || | ||
503 | copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) || | ||
504 | get_user(kp->datasize, &up->datasize) || | ||
505 | copy_from_user(kp->data, up->data, up->datasize)) | ||
506 | return -EFAULT; | ||
507 | return 0; | ||
508 | } | ||
509 | |||
493 | #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) | 510 | #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) |
494 | #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) | 511 | #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) |
495 | #define VIDIOCGWIN32 _IOR('v',9, struct video_window32) | 512 | #define VIDIOCGWIN32 _IOR('v',9, struct video_window32) |
@@ -498,6 +515,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user | |||
498 | #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32) | 515 | #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32) |
499 | #define VIDIOCGFREQ32 _IOR('v',14, u32) | 516 | #define VIDIOCGFREQ32 _IOR('v',14, u32) |
500 | #define VIDIOCSFREQ32 _IOW('v',15, u32) | 517 | #define VIDIOCSFREQ32 _IOW('v',15, u32) |
518 | #define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) | ||
501 | 519 | ||
502 | /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ | 520 | /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ |
503 | #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) | 521 | #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) |
@@ -590,6 +608,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
590 | struct video_tuner vt; | 608 | struct video_tuner vt; |
591 | struct video_buffer vb; | 609 | struct video_buffer vb; |
592 | struct video_window vw; | 610 | struct video_window vw; |
611 | struct video_code vc; | ||
593 | struct v4l2_format v2f; | 612 | struct v4l2_format v2f; |
594 | struct v4l2_buffer v2b; | 613 | struct v4l2_buffer v2b; |
595 | struct v4l2_framebuffer v2fb; | 614 | struct v4l2_framebuffer v2fb; |
@@ -628,6 +647,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
628 | case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; | 647 | case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; |
629 | case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; | 648 | case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; |
630 | case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; | 649 | case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; |
650 | case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; | ||
631 | }; | 651 | }; |
632 | 652 | ||
633 | switch(cmd) { | 653 | switch(cmd) { |
@@ -703,6 +723,10 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
703 | case VIDIOC_G_FBUF: | 723 | case VIDIOC_G_FBUF: |
704 | case VIDIOC_G_INPUT: | 724 | case VIDIOC_G_INPUT: |
705 | compatible_arg = 0; | 725 | compatible_arg = 0; |
726 | case VIDIOCSMICROCODE: | ||
727 | err = microcode32(&karg.vc, up); | ||
728 | compatible_arg = 0; | ||
729 | break; | ||
706 | }; | 730 | }; |
707 | 731 | ||
708 | if(err) | 732 | if(err) |
diff --git a/drivers/media/video/cpia2/Kconfig b/drivers/media/video/cpia2/Kconfig index 513cc0927389..e39a96152004 100644 --- a/drivers/media/video/cpia2/Kconfig +++ b/drivers/media/video/cpia2/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_CPIA2 | 1 | config VIDEO_CPIA2 |
2 | tristate "CPiA2 Video For Linux" | 2 | tristate "CPiA2 Video For Linux" |
3 | depends on VIDEO_DEV && USB | 3 | depends on VIDEO_DEV && USB && VIDEO_V4L1 |
4 | ---help--- | 4 | ---help--- |
5 | This is the video4linux driver for cameras based on Vision's CPiA2 | 5 | This is the video4linux driver for cameras based on Vision's CPiA2 |
6 | (Colour Processor Interface ASIC), such as the Digital Blue QX5 | 6 | (Colour Processor Interface ASIC), such as the Digital Blue QX5 |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 72b630a91f41..c25564648993 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -89,7 +89,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
89 | 89 | ||
90 | auxgpio = cx_read(MO_GP1_IO); | 90 | auxgpio = cx_read(MO_GP1_IO); |
91 | /* Take out the parity part */ | 91 | /* Take out the parity part */ |
92 | gpio+=(gpio & 0x7fd) + (auxgpio & 0xef); | 92 | gpio=(gpio & 0x7fd) + (auxgpio & 0xef); |
93 | } else | 93 | } else |
94 | auxgpio = gpio; | 94 | auxgpio = gpio; |
95 | 95 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 2225d4b94140..547cdbdb644d 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1180,7 +1180,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1180 | V4L2_CAP_READWRITE | | 1180 | V4L2_CAP_READWRITE | |
1181 | V4L2_CAP_STREAMING | | 1181 | V4L2_CAP_STREAMING | |
1182 | V4L2_CAP_VBI_CAPTURE | | 1182 | V4L2_CAP_VBI_CAPTURE | |
1183 | V4L2_CAP_VIDEO_OVERLAY | | ||
1184 | 0; | 1183 | 0; |
1185 | if (UNSET != core->tuner_type) | 1184 | if (UNSET != core->tuner_type) |
1186 | cap->capabilities |= V4L2_CAP_TUNER; | 1185 | cap->capabilities |= V4L2_CAP_TUNER; |
@@ -1226,7 +1225,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1226 | struct v4l2_format *f = arg; | 1225 | struct v4l2_format *f = arg; |
1227 | return cx8800_try_fmt(dev,fh,f); | 1226 | return cx8800_try_fmt(dev,fh,f); |
1228 | } | 1227 | } |
1229 | #ifdef HAVE_V4L1 | 1228 | #ifdef CONFIG_V4L1_COMPAT |
1230 | /* --- streaming capture ------------------------------------- */ | 1229 | /* --- streaming capture ------------------------------------- */ |
1231 | case VIDIOCGMBUF: | 1230 | case VIDIOCGMBUF: |
1232 | { | 1231 | { |
@@ -1585,7 +1584,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1585 | *id = 0; | 1584 | *id = 0; |
1586 | return 0; | 1585 | return 0; |
1587 | } | 1586 | } |
1588 | #ifdef HAVE_V4L1 | 1587 | #ifdef CONFIG_V4L1_COMPAT |
1589 | case VIDIOCSTUNER: | 1588 | case VIDIOCSTUNER: |
1590 | { | 1589 | { |
1591 | struct video_tuner *v = arg; | 1590 | struct video_tuner *v = arg; |
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index dbb75a7db199..56246b8578f3 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -362,7 +362,7 @@ int msp_sleep(struct msp_state *state, int timeout) | |||
362 | } | 362 | } |
363 | 363 | ||
364 | /* ------------------------------------------------------------------------ */ | 364 | /* ------------------------------------------------------------------------ */ |
365 | 365 | #ifdef CONFIG_VIDEO_V4L1 | |
366 | static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode) | 366 | static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode) |
367 | { | 367 | { |
368 | if (rxsubchans == V4L2_TUNER_SUB_MONO) | 368 | if (rxsubchans == V4L2_TUNER_SUB_MONO) |
@@ -384,6 +384,7 @@ static int msp_mode_v4l1_to_v4l2(int mode) | |||
384 | return V4L2_TUNER_MODE_LANG1; | 384 | return V4L2_TUNER_MODE_LANG1; |
385 | return V4L2_TUNER_MODE_MONO; | 385 | return V4L2_TUNER_MODE_MONO; |
386 | } | 386 | } |
387 | #endif | ||
387 | 388 | ||
388 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | 389 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) |
389 | { | 390 | { |
@@ -509,6 +510,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
509 | /* --- v4l ioctls --- */ | 510 | /* --- v4l ioctls --- */ |
510 | /* take care: bttv does userspace copying, we'll get a | 511 | /* take care: bttv does userspace copying, we'll get a |
511 | kernel pointer here... */ | 512 | kernel pointer here... */ |
513 | #ifdef CONFIG_VIDEO_V4L1 | ||
512 | case VIDIOCGAUDIO: | 514 | case VIDIOCGAUDIO: |
513 | { | 515 | { |
514 | struct video_audio *va = arg; | 516 | struct video_audio *va = arg; |
@@ -577,6 +579,12 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
577 | } | 579 | } |
578 | 580 | ||
579 | case VIDIOCSFREQ: | 581 | case VIDIOCSFREQ: |
582 | { | ||
583 | /* new channel -- kick audio carrier scan */ | ||
584 | msp_wake_thread(client); | ||
585 | break; | ||
586 | } | ||
587 | #endif | ||
580 | case VIDIOC_S_FREQUENCY: | 588 | case VIDIOC_S_FREQUENCY: |
581 | { | 589 | { |
582 | /* new channel -- kick audio carrier scan */ | 590 | /* new channel -- kick audio carrier scan */ |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 9b48abcf6089..be1e5cc78081 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -852,7 +852,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw) | |||
852 | return hdw->serial_number; | 852 | return hdw->serial_number; |
853 | } | 853 | } |
854 | 854 | ||
855 | |||
856 | int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) | 855 | int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) |
857 | { | 856 | { |
858 | return hdw->unit_number; | 857 | return hdw->unit_number; |
@@ -2318,7 +2317,6 @@ void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *hdw) | |||
2318 | } | 2317 | } |
2319 | } | 2318 | } |
2320 | 2319 | ||
2321 | |||
2322 | /* Return name for this driver instance */ | 2320 | /* Return name for this driver instance */ |
2323 | const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) | 2321 | const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) |
2324 | { | 2322 | { |
@@ -2542,6 +2540,10 @@ static void pvr2_ctl_timeout(unsigned long data) | |||
2542 | } | 2540 | } |
2543 | 2541 | ||
2544 | 2542 | ||
2543 | /* Issue a command and get a response from the device. This extended | ||
2544 | version includes a probe flag (which if set means that device errors | ||
2545 | should not be logged or treated as fatal) and a timeout in jiffies. | ||
2546 | This can be used to non-lethally probe the health of endpoint 1. */ | ||
2545 | static int pvr2_send_request_ex(struct pvr2_hdw *hdw, | 2547 | static int pvr2_send_request_ex(struct pvr2_hdw *hdw, |
2546 | unsigned int timeout,int probe_fl, | 2548 | unsigned int timeout,int probe_fl, |
2547 | void *write_data,unsigned int write_len, | 2549 | void *write_data,unsigned int write_len, |
@@ -2970,6 +2972,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw) | |||
2970 | } | 2972 | } |
2971 | 2973 | ||
2972 | 2974 | ||
2975 | /* Stop / start video stream transport */ | ||
2973 | static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) | 2976 | static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) |
2974 | { | 2977 | { |
2975 | int status; | 2978 | int status; |
@@ -3068,6 +3071,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val) | |||
3068 | } | 3071 | } |
3069 | 3072 | ||
3070 | 3073 | ||
3074 | /* Find I2C address of eeprom */ | ||
3071 | static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) | 3075 | static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) |
3072 | { | 3076 | { |
3073 | int result; | 3077 | int result; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c index 681f79c8064e..1e393762546c 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.c +++ b/drivers/media/video/pvrusb2/pvrusb2-io.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | 28 | ||
29 | static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state); | ||
30 | |||
29 | #define BUFFER_SIG 0x47653271 | 31 | #define BUFFER_SIG 0x47653271 |
30 | 32 | ||
31 | // #define SANITY_CHECK_BUFFERS | 33 | // #define SANITY_CHECK_BUFFERS |
@@ -515,6 +517,10 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp, | |||
515 | } | 517 | } |
516 | 518 | ||
517 | /* Query / set the nominal buffer count */ | 519 | /* Query / set the nominal buffer count */ |
520 | int pvr2_stream_get_buffer_count(struct pvr2_stream *sp) | ||
521 | { | ||
522 | return sp->buffer_target_count; | ||
523 | } | ||
518 | 524 | ||
519 | int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) | 525 | int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) |
520 | { | 526 | { |
@@ -553,7 +559,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp) | |||
553 | return sp->r_count; | 559 | return sp->r_count; |
554 | } | 560 | } |
555 | 561 | ||
556 | |||
557 | void pvr2_stream_kill(struct pvr2_stream *sp) | 562 | void pvr2_stream_kill(struct pvr2_stream *sp) |
558 | { | 563 | { |
559 | struct pvr2_buffer *bp; | 564 | struct pvr2_buffer *bp; |
@@ -607,7 +612,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp) | |||
607 | return ret; | 612 | return ret; |
608 | } | 613 | } |
609 | 614 | ||
610 | |||
611 | int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) | 615 | int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) |
612 | { | 616 | { |
613 | int ret = 0; | 617 | int ret = 0; |
@@ -646,7 +650,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp) | |||
646 | return bp->status; | 650 | return bp->status; |
647 | } | 651 | } |
648 | 652 | ||
649 | |||
650 | int pvr2_buffer_get_id(struct pvr2_buffer *bp) | 653 | int pvr2_buffer_get_id(struct pvr2_buffer *bp) |
651 | { | 654 | { |
652 | return bp->id; | 655 | return bp->id; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.h b/drivers/media/video/pvrusb2/pvrusb2-io.h index 96285ad234a6..93279cc2a35e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.h +++ b/drivers/media/video/pvrusb2/pvrusb2-io.h | |||
@@ -47,6 +47,7 @@ void pvr2_stream_set_callback(struct pvr2_stream *, | |||
47 | void *data); | 47 | void *data); |
48 | 48 | ||
49 | /* Query / set the nominal buffer count */ | 49 | /* Query / set the nominal buffer count */ |
50 | int pvr2_stream_get_buffer_count(struct pvr2_stream *); | ||
50 | int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); | 51 | int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); |
51 | 52 | ||
52 | /* Get a pointer to a buffer that is either idle, ready, or is specified | 53 | /* Get a pointer to a buffer that is either idle, ready, or is specified |
@@ -58,6 +59,7 @@ struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id); | |||
58 | /* Find out how many buffers are idle or ready */ | 59 | /* Find out how many buffers are idle or ready */ |
59 | int pvr2_stream_get_ready_count(struct pvr2_stream *); | 60 | int pvr2_stream_get_ready_count(struct pvr2_stream *); |
60 | 61 | ||
62 | |||
61 | /* Kill all pending buffers and throw away any ready buffers as well */ | 63 | /* Kill all pending buffers and throw away any ready buffers as well */ |
62 | void pvr2_stream_kill(struct pvr2_stream *); | 64 | void pvr2_stream_kill(struct pvr2_stream *); |
63 | 65 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c index f7a2e225a002..b71f9a961f8a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c | |||
@@ -213,7 +213,9 @@ int pvr2_ioread_setup(struct pvr2_ioread *cp,struct pvr2_stream *sp) | |||
213 | " pvr2_ioread_setup (tear-down) id=%p",cp); | 213 | " pvr2_ioread_setup (tear-down) id=%p",cp); |
214 | pvr2_ioread_stop(cp); | 214 | pvr2_ioread_stop(cp); |
215 | pvr2_stream_kill(cp->stream); | 215 | pvr2_stream_kill(cp->stream); |
216 | pvr2_stream_set_buffer_count(cp->stream,0); | 216 | if (pvr2_stream_get_buffer_count(cp->stream)) { |
217 | pvr2_stream_set_buffer_count(cp->stream,0); | ||
218 | } | ||
217 | cp->stream = NULL; | 219 | cp->stream = NULL; |
218 | } | 220 | } |
219 | if (sp) { | 221 | if (sp) { |
@@ -251,7 +253,6 @@ int pvr2_ioread_set_enabled(struct pvr2_ioread *cp,int fl) | |||
251 | return ret; | 253 | return ret; |
252 | } | 254 | } |
253 | 255 | ||
254 | |||
255 | static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) | 256 | static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) |
256 | { | 257 | { |
257 | int stat; | 258 | int stat; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 6af55a8b6f05..d1dda5caf406 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -44,12 +44,16 @@ struct pvr2_sysfs { | |||
44 | struct kobj_type ktype; | 44 | struct kobj_type ktype; |
45 | struct class_device_attribute attr_v4l_minor_number; | 45 | struct class_device_attribute attr_v4l_minor_number; |
46 | struct class_device_attribute attr_unit_number; | 46 | struct class_device_attribute attr_unit_number; |
47 | int v4l_minor_number_created_ok; | ||
48 | int unit_number_created_ok; | ||
47 | }; | 49 | }; |
48 | 50 | ||
49 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 51 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
50 | struct pvr2_sysfs_debugifc { | 52 | struct pvr2_sysfs_debugifc { |
51 | struct class_device_attribute attr_debugcmd; | 53 | struct class_device_attribute attr_debugcmd; |
52 | struct class_device_attribute attr_debuginfo; | 54 | struct class_device_attribute attr_debuginfo; |
55 | int debugcmd_created_ok; | ||
56 | int debuginfo_created_ok; | ||
53 | }; | 57 | }; |
54 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 58 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
55 | 59 | ||
@@ -67,6 +71,7 @@ struct pvr2_sysfs_ctl_item { | |||
67 | struct pvr2_sysfs_ctl_item *item_next; | 71 | struct pvr2_sysfs_ctl_item *item_next; |
68 | struct attribute *attr_gen[7]; | 72 | struct attribute *attr_gen[7]; |
69 | struct attribute_group grp; | 73 | struct attribute_group grp; |
74 | int created_ok; | ||
70 | char name[80]; | 75 | char name[80]; |
71 | }; | 76 | }; |
72 | 77 | ||
@@ -487,6 +492,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) | |||
487 | struct pvr2_sysfs_func_set *fp; | 492 | struct pvr2_sysfs_func_set *fp; |
488 | struct pvr2_ctrl *cptr; | 493 | struct pvr2_ctrl *cptr; |
489 | unsigned int cnt,acnt; | 494 | unsigned int cnt,acnt; |
495 | int ret; | ||
490 | 496 | ||
491 | if ((ctl_id < 0) || (ctl_id >= (sizeof(funcs)/sizeof(funcs[0])))) { | 497 | if ((ctl_id < 0) || (ctl_id >= (sizeof(funcs)/sizeof(funcs[0])))) { |
492 | return; | 498 | return; |
@@ -589,7 +595,13 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) | |||
589 | cip->grp.name = cip->name; | 595 | cip->grp.name = cip->name; |
590 | cip->grp.attrs = cip->attr_gen; | 596 | cip->grp.attrs = cip->attr_gen; |
591 | 597 | ||
592 | sysfs_create_group(&sfp->class_dev->kobj,&cip->grp); | 598 | ret = sysfs_create_group(&sfp->class_dev->kobj,&cip->grp); |
599 | if (ret) { | ||
600 | printk(KERN_WARNING "%s: sysfs_create_group error: %d\n", | ||
601 | __FUNCTION__, ret); | ||
602 | return; | ||
603 | } | ||
604 | cip->created_ok = !0; | ||
593 | } | 605 | } |
594 | 606 | ||
595 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 607 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
@@ -600,6 +612,8 @@ static ssize_t debugcmd_store(struct class_device *,const char *,size_t count); | |||
600 | static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) | 612 | static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) |
601 | { | 613 | { |
602 | struct pvr2_sysfs_debugifc *dip; | 614 | struct pvr2_sysfs_debugifc *dip; |
615 | int ret; | ||
616 | |||
603 | dip = kmalloc(sizeof(*dip),GFP_KERNEL); | 617 | dip = kmalloc(sizeof(*dip),GFP_KERNEL); |
604 | if (!dip) return; | 618 | if (!dip) return; |
605 | memset(dip,0,sizeof(*dip)); | 619 | memset(dip,0,sizeof(*dip)); |
@@ -613,17 +627,34 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) | |||
613 | dip->attr_debuginfo.attr.mode = S_IRUGO; | 627 | dip->attr_debuginfo.attr.mode = S_IRUGO; |
614 | dip->attr_debuginfo.show = debuginfo_show; | 628 | dip->attr_debuginfo.show = debuginfo_show; |
615 | sfp->debugifc = dip; | 629 | sfp->debugifc = dip; |
616 | class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); | 630 | ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); |
617 | class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); | 631 | if (ret < 0) { |
632 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | ||
633 | __FUNCTION__, ret); | ||
634 | } else { | ||
635 | dip->debugcmd_created_ok = !0; | ||
636 | } | ||
637 | ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); | ||
638 | if (ret < 0) { | ||
639 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | ||
640 | __FUNCTION__, ret); | ||
641 | } else { | ||
642 | dip->debuginfo_created_ok = !0; | ||
643 | } | ||
618 | } | 644 | } |
619 | 645 | ||
620 | 646 | ||
621 | static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) | 647 | static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) |
622 | { | 648 | { |
623 | if (!sfp->debugifc) return; | 649 | if (!sfp->debugifc) return; |
624 | class_device_remove_file(sfp->class_dev, | 650 | if (sfp->debugifc->debuginfo_created_ok) { |
625 | &sfp->debugifc->attr_debuginfo); | 651 | class_device_remove_file(sfp->class_dev, |
626 | class_device_remove_file(sfp->class_dev,&sfp->debugifc->attr_debugcmd); | 652 | &sfp->debugifc->attr_debuginfo); |
653 | } | ||
654 | if (sfp->debugifc->debugcmd_created_ok) { | ||
655 | class_device_remove_file(sfp->class_dev, | ||
656 | &sfp->debugifc->attr_debugcmd); | ||
657 | } | ||
627 | kfree(sfp->debugifc); | 658 | kfree(sfp->debugifc); |
628 | sfp->debugifc = NULL; | 659 | sfp->debugifc = NULL; |
629 | } | 660 | } |
@@ -645,7 +676,9 @@ static void pvr2_sysfs_tear_down_controls(struct pvr2_sysfs *sfp) | |||
645 | struct pvr2_sysfs_ctl_item *cip1,*cip2; | 676 | struct pvr2_sysfs_ctl_item *cip1,*cip2; |
646 | for (cip1 = sfp->item_first; cip1; cip1 = cip2) { | 677 | for (cip1 = sfp->item_first; cip1; cip1 = cip2) { |
647 | cip2 = cip1->item_next; | 678 | cip2 = cip1->item_next; |
648 | sysfs_remove_group(&sfp->class_dev->kobj,&cip1->grp); | 679 | if (cip1->created_ok) { |
680 | sysfs_remove_group(&sfp->class_dev->kobj,&cip1->grp); | ||
681 | } | ||
649 | pvr2_sysfs_trace("Destroying pvr2_sysfs_ctl_item id=%p",cip1); | 682 | pvr2_sysfs_trace("Destroying pvr2_sysfs_ctl_item id=%p",cip1); |
650 | kfree(cip1); | 683 | kfree(cip1); |
651 | } | 684 | } |
@@ -675,8 +708,14 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) | |||
675 | pvr2_sysfs_tear_down_debugifc(sfp); | 708 | pvr2_sysfs_tear_down_debugifc(sfp); |
676 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 709 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
677 | pvr2_sysfs_tear_down_controls(sfp); | 710 | pvr2_sysfs_tear_down_controls(sfp); |
678 | class_device_remove_file(sfp->class_dev,&sfp->attr_v4l_minor_number); | 711 | if (sfp->v4l_minor_number_created_ok) { |
679 | class_device_remove_file(sfp->class_dev,&sfp->attr_unit_number); | 712 | class_device_remove_file(sfp->class_dev, |
713 | &sfp->attr_v4l_minor_number); | ||
714 | } | ||
715 | if (sfp->unit_number_created_ok) { | ||
716 | class_device_remove_file(sfp->class_dev, | ||
717 | &sfp->attr_unit_number); | ||
718 | } | ||
680 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); | 719 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); |
681 | sfp->class_dev->class_data = NULL; | 720 | sfp->class_dev->class_data = NULL; |
682 | class_device_unregister(sfp->class_dev); | 721 | class_device_unregister(sfp->class_dev); |
@@ -709,6 +748,8 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
709 | { | 748 | { |
710 | struct usb_device *usb_dev; | 749 | struct usb_device *usb_dev; |
711 | struct class_device *class_dev; | 750 | struct class_device *class_dev; |
751 | int ret; | ||
752 | |||
712 | usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); | 753 | usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); |
713 | if (!usb_dev) return; | 754 | if (!usb_dev) return; |
714 | class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL); | 755 | class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL); |
@@ -733,20 +774,40 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
733 | 774 | ||
734 | sfp->class_dev = class_dev; | 775 | sfp->class_dev = class_dev; |
735 | class_dev->class_data = sfp; | 776 | class_dev->class_data = sfp; |
736 | class_device_register(class_dev); | 777 | ret = class_device_register(class_dev); |
778 | if (ret) { | ||
779 | printk(KERN_ERR "%s: class_device_register failed\n", | ||
780 | __FUNCTION__); | ||
781 | kfree(class_dev); | ||
782 | return; | ||
783 | } | ||
737 | 784 | ||
738 | sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; | 785 | sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; |
739 | sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; | 786 | sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; |
740 | sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; | 787 | sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; |
741 | sfp->attr_v4l_minor_number.show = v4l_minor_number_show; | 788 | sfp->attr_v4l_minor_number.show = v4l_minor_number_show; |
742 | sfp->attr_v4l_minor_number.store = NULL; | 789 | sfp->attr_v4l_minor_number.store = NULL; |
743 | class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); | 790 | ret = class_device_create_file(sfp->class_dev, |
791 | &sfp->attr_v4l_minor_number); | ||
792 | if (ret < 0) { | ||
793 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | ||
794 | __FUNCTION__, ret); | ||
795 | } else { | ||
796 | sfp->v4l_minor_number_created_ok = !0; | ||
797 | } | ||
798 | |||
744 | sfp->attr_unit_number.attr.owner = THIS_MODULE; | 799 | sfp->attr_unit_number.attr.owner = THIS_MODULE; |
745 | sfp->attr_unit_number.attr.name = "unit_number"; | 800 | sfp->attr_unit_number.attr.name = "unit_number"; |
746 | sfp->attr_unit_number.attr.mode = S_IRUGO; | 801 | sfp->attr_unit_number.attr.mode = S_IRUGO; |
747 | sfp->attr_unit_number.show = unit_number_show; | 802 | sfp->attr_unit_number.show = unit_number_show; |
748 | sfp->attr_unit_number.store = NULL; | 803 | sfp->attr_unit_number.store = NULL; |
749 | class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); | 804 | ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); |
805 | if (ret < 0) { | ||
806 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | ||
807 | __FUNCTION__, ret); | ||
808 | } else { | ||
809 | sfp->unit_number_created_ok = !0; | ||
810 | } | ||
750 | 811 | ||
751 | pvr2_sysfs_add_controls(sfp); | 812 | pvr2_sysfs_add_controls(sfp); |
752 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 813 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index f1fd69e7f119..d73cff1970ae 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -997,9 +997,9 @@ static int saa7134_alsa_init(void) | |||
997 | struct saa7134_dev *dev = NULL; | 997 | struct saa7134_dev *dev = NULL; |
998 | struct list_head *list; | 998 | struct list_head *list; |
999 | 999 | ||
1000 | if (!dmasound_init && !dmasound_exit) { | 1000 | if (!saa7134_dmasound_init && !saa7134_dmasound_exit) { |
1001 | dmasound_init = alsa_device_init; | 1001 | saa7134_dmasound_init = alsa_device_init; |
1002 | dmasound_exit = alsa_device_exit; | 1002 | saa7134_dmasound_exit = alsa_device_exit; |
1003 | } else { | 1003 | } else { |
1004 | printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); | 1004 | printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); |
1005 | return -EBUSY; | 1005 | return -EBUSY; |
@@ -1036,8 +1036,8 @@ static void saa7134_alsa_exit(void) | |||
1036 | snd_card_free(snd_saa7134_cards[idx]); | 1036 | snd_card_free(snd_saa7134_cards[idx]); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | dmasound_init = NULL; | 1039 | saa7134_dmasound_init = NULL; |
1040 | dmasound_exit = NULL; | 1040 | saa7134_dmasound_exit = NULL; |
1041 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); | 1041 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); |
1042 | 1042 | ||
1043 | return; | 1043 | return; |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 6e97cc84ba89..be3a81fc90a2 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -95,8 +95,8 @@ LIST_HEAD(saa7134_devlist); | |||
95 | static LIST_HEAD(mops_list); | 95 | static LIST_HEAD(mops_list); |
96 | static unsigned int saa7134_devcount; | 96 | static unsigned int saa7134_devcount; |
97 | 97 | ||
98 | int (*dmasound_init)(struct saa7134_dev *dev); | 98 | int (*saa7134_dmasound_init)(struct saa7134_dev *dev); |
99 | int (*dmasound_exit)(struct saa7134_dev *dev); | 99 | int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); |
100 | 100 | ||
101 | #define dprintk(fmt, arg...) if (core_debug) \ | 101 | #define dprintk(fmt, arg...) if (core_debug) \ |
102 | printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) | 102 | printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) |
@@ -1008,8 +1008,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1008 | /* check for signal */ | 1008 | /* check for signal */ |
1009 | saa7134_irq_video_intl(dev); | 1009 | saa7134_irq_video_intl(dev); |
1010 | 1010 | ||
1011 | if (dmasound_init && !dev->dmasound.priv_data) { | 1011 | if (saa7134_dmasound_init && !dev->dmasound.priv_data) { |
1012 | dmasound_init(dev); | 1012 | saa7134_dmasound_init(dev); |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | return 0; | 1015 | return 0; |
@@ -1036,8 +1036,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) | |||
1036 | struct saa7134_mpeg_ops *mops; | 1036 | struct saa7134_mpeg_ops *mops; |
1037 | 1037 | ||
1038 | /* Release DMA sound modules if present */ | 1038 | /* Release DMA sound modules if present */ |
1039 | if (dmasound_exit && dev->dmasound.priv_data) { | 1039 | if (saa7134_dmasound_exit && dev->dmasound.priv_data) { |
1040 | dmasound_exit(dev); | 1040 | saa7134_dmasound_exit(dev); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | /* debugging ... */ | 1043 | /* debugging ... */ |
@@ -1169,8 +1169,8 @@ EXPORT_SYMBOL(saa7134_boards); | |||
1169 | 1169 | ||
1170 | /* ----------------- for the DMA sound modules --------------- */ | 1170 | /* ----------------- for the DMA sound modules --------------- */ |
1171 | 1171 | ||
1172 | EXPORT_SYMBOL(dmasound_init); | 1172 | EXPORT_SYMBOL(saa7134_dmasound_init); |
1173 | EXPORT_SYMBOL(dmasound_exit); | 1173 | EXPORT_SYMBOL(saa7134_dmasound_exit); |
1174 | EXPORT_SYMBOL(saa7134_pgtable_free); | 1174 | EXPORT_SYMBOL(saa7134_pgtable_free); |
1175 | EXPORT_SYMBOL(saa7134_pgtable_build); | 1175 | EXPORT_SYMBOL(saa7134_pgtable_build); |
1176 | EXPORT_SYMBOL(saa7134_pgtable_alloc); | 1176 | EXPORT_SYMBOL(saa7134_pgtable_alloc); |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 3895d05804ae..2e3ba5f31453 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -993,9 +993,9 @@ static int saa7134_oss_init(void) | |||
993 | struct saa7134_dev *dev = NULL; | 993 | struct saa7134_dev *dev = NULL; |
994 | struct list_head *list; | 994 | struct list_head *list; |
995 | 995 | ||
996 | if (!dmasound_init && !dmasound_exit) { | 996 | if (!saa7134_dmasound_init && !saa7134_dmasound_exit) { |
997 | dmasound_init = oss_device_init; | 997 | saa7134_dmasound_init = oss_device_init; |
998 | dmasound_exit = oss_device_exit; | 998 | saa7134_dmasound_exit = oss_device_exit; |
999 | } else { | 999 | } else { |
1000 | printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n"); | 1000 | printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n"); |
1001 | return -EBUSY; | 1001 | return -EBUSY; |
@@ -1037,8 +1037,8 @@ static void saa7134_oss_exit(void) | |||
1037 | 1037 | ||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | dmasound_init = NULL; | 1040 | saa7134_dmasound_init = NULL; |
1041 | dmasound_exit = NULL; | 1041 | saa7134_dmasound_exit = NULL; |
1042 | 1042 | ||
1043 | printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); | 1043 | printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); |
1044 | 1044 | ||
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index e4156ec9c6d7..8656f2400e18 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | static unsigned int video_debug = 0; | 41 | static unsigned int video_debug = 0; |
42 | static unsigned int gbuffers = 8; | 42 | static unsigned int gbuffers = 8; |
43 | static unsigned int noninterlaced = 0; | 43 | static unsigned int noninterlaced = 1; |
44 | static unsigned int gbufsize = 720*576*4; | 44 | static unsigned int gbufsize = 720*576*4; |
45 | static unsigned int gbufsize_max = 720*576*4; | 45 | static unsigned int gbufsize_max = 720*576*4; |
46 | module_param(video_debug, int, 0644); | 46 | module_param(video_debug, int, 0644); |
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); | |||
48 | module_param(gbuffers, int, 0444); | 48 | module_param(gbuffers, int, 0444); |
49 | MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32"); | 49 | MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32"); |
50 | module_param(noninterlaced, int, 0644); | 50 | module_param(noninterlaced, int, 0644); |
51 | MODULE_PARM_DESC(noninterlaced,"video input is noninterlaced"); | 51 | MODULE_PARM_DESC(noninterlaced,"capture non interlaced video"); |
52 | 52 | ||
53 | #define dprintk(fmt, arg...) if (video_debug) \ | 53 | #define dprintk(fmt, arg...) if (video_debug) \ |
54 | printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg) | 54 | printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg) |
@@ -2087,7 +2087,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
2087 | struct v4l2_format *f = arg; | 2087 | struct v4l2_format *f = arg; |
2088 | return saa7134_try_fmt(dev,fh,f); | 2088 | return saa7134_try_fmt(dev,fh,f); |
2089 | } | 2089 | } |
2090 | #ifdef HAVE_V4L1 | 2090 | #ifdef CONFIG_V4L1_COMPAT |
2091 | case VIDIOCGMBUF: | 2091 | case VIDIOCGMBUF: |
2092 | { | 2092 | { |
2093 | struct video_mbuf *mbuf = arg; | 2093 | struct video_mbuf *mbuf = arg; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index d5ee99c574cc..c04ce6152fd5 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -586,8 +586,8 @@ void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); | |||
586 | 586 | ||
587 | int saa7134_set_dmabits(struct saa7134_dev *dev); | 587 | int saa7134_set_dmabits(struct saa7134_dev *dev); |
588 | 588 | ||
589 | extern int (*dmasound_init)(struct saa7134_dev *dev); | 589 | extern int (*saa7134_dmasound_init)(struct saa7134_dev *dev); |
590 | extern int (*dmasound_exit)(struct saa7134_dev *dev); | 590 | extern int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); |
591 | 591 | ||
592 | 592 | ||
593 | /* ----------------------------------------------------------- */ | 593 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index b36ba9fa3a28..5686547ba76a 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -2181,7 +2181,6 @@ static struct pci_device_id stradis_pci_tbl[] = { | |||
2181 | { 0 } | 2181 | { 0 } |
2182 | }; | 2182 | }; |
2183 | 2183 | ||
2184 | MODULE_DEVICE_TABLE(pci, stradis_pci_tbl); | ||
2185 | 2184 | ||
2186 | static struct pci_driver stradis_driver = { | 2185 | static struct pci_driver stradis_driver = { |
2187 | .name = "stradis", | 2186 | .name = "stradis", |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index f7eb402d5f2b..40590bae5ff7 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -196,14 +196,6 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
196 | i2c_master_send(c, buffer, 4); | 196 | i2c_master_send(c, buffer, 4); |
197 | default_tuner_init(c); | 197 | default_tuner_init(c); |
198 | break; | 198 | break; |
199 | case TUNER_LG_TDVS_H06XF: | ||
200 | /* Set the Auxiliary Byte. */ | ||
201 | buffer[2] &= ~0x20; | ||
202 | buffer[2] |= 0x18; | ||
203 | buffer[3] = 0x20; | ||
204 | i2c_master_send(c, buffer, 4); | ||
205 | default_tuner_init(c); | ||
206 | break; | ||
207 | case TUNER_PHILIPS_TD1316: | 199 | case TUNER_PHILIPS_TD1316: |
208 | buffer[0] = 0x0b; | 200 | buffer[0] = 0x0b; |
209 | buffer[1] = 0xdc; | 201 | buffer[1] = 0xdc; |
@@ -598,6 +590,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
598 | if (t->standby) | 590 | if (t->standby) |
599 | t->standby (client); | 591 | t->standby (client); |
600 | break; | 592 | break; |
593 | #ifdef CONFIG_VIDEO_V4L1 | ||
601 | case VIDIOCSAUDIO: | 594 | case VIDIOCSAUDIO: |
602 | if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) | 595 | if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) |
603 | return 0; | 596 | return 0; |
@@ -607,17 +600,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
607 | /* Should be implemented, since bttv calls it */ | 600 | /* Should be implemented, since bttv calls it */ |
608 | tuner_dbg("VIDIOCSAUDIO not implemented.\n"); | 601 | tuner_dbg("VIDIOCSAUDIO not implemented.\n"); |
609 | break; | 602 | break; |
610 | case TDA9887_SET_CONFIG: | ||
611 | if (t->type == TUNER_TDA9887) { | ||
612 | int *i = arg; | ||
613 | |||
614 | t->tda9887_config = *i; | ||
615 | set_freq(client, t->tv_freq); | ||
616 | } | ||
617 | break; | ||
618 | /* --- v4l ioctls --- */ | ||
619 | /* take care: bttv does userspace copying, we'll get a | ||
620 | kernel pointer here... */ | ||
621 | case VIDIOCSCHAN: | 603 | case VIDIOCSCHAN: |
622 | { | 604 | { |
623 | static const v4l2_std_id map[] = { | 605 | static const v4l2_std_id map[] = { |
@@ -701,7 +683,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
701 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; | 683 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; |
702 | return 0; | 684 | return 0; |
703 | } | 685 | } |
686 | #endif | ||
687 | case TDA9887_SET_CONFIG: | ||
688 | if (t->type == TUNER_TDA9887) { | ||
689 | int *i = arg; | ||
704 | 690 | ||
691 | t->tda9887_config = *i; | ||
692 | set_freq(client, t->tv_freq); | ||
693 | } | ||
694 | break; | ||
695 | /* --- v4l ioctls --- */ | ||
696 | /* take care: bttv does userspace copying, we'll get a | ||
697 | kernel pointer here... */ | ||
705 | case VIDIOC_S_STD: | 698 | case VIDIOC_S_STD: |
706 | { | 699 | { |
707 | v4l2_std_id *id = arg; | 700 | v4l2_std_id *id = arg; |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index d071c5cbf013..abe37cf632c6 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -339,7 +339,20 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
339 | if (4 != (rc = i2c_master_send(c,buffer,4))) | 339 | if (4 != (rc = i2c_master_send(c,buffer,4))) |
340 | tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); | 340 | tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); |
341 | 341 | ||
342 | if (t->type == TUNER_MICROTUNE_4042FI5) { | 342 | switch (t->type) { |
343 | case TUNER_LG_TDVS_H06XF: | ||
344 | /* Set the Auxiliary Byte. */ | ||
345 | buffer[0] = buffer[2]; | ||
346 | buffer[0] &= ~0x20; | ||
347 | buffer[0] |= 0x18; | ||
348 | buffer[1] = 0x20; | ||
349 | tuner_dbg("tv 0x%02x 0x%02x\n",buffer[0],buffer[1]); | ||
350 | |||
351 | if (2 != (rc = i2c_master_send(c,buffer,2))) | ||
352 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc); | ||
353 | break; | ||
354 | case TUNER_MICROTUNE_4042FI5: | ||
355 | { | ||
343 | // FIXME - this may also work for other tuners | 356 | // FIXME - this may also work for other tuners |
344 | unsigned long timeout = jiffies + msecs_to_jiffies(1); | 357 | unsigned long timeout = jiffies + msecs_to_jiffies(1); |
345 | u8 status_byte = 0; | 358 | u8 status_byte = 0; |
@@ -364,10 +377,12 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
364 | buffer[2] = config; | 377 | buffer[2] = config; |
365 | buffer[3] = cb; | 378 | buffer[3] = cb; |
366 | tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", | 379 | tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", |
367 | buffer[0],buffer[1],buffer[2],buffer[3]); | 380 | buffer[0],buffer[1],buffer[2],buffer[3]); |
368 | 381 | ||
369 | if (4 != (rc = i2c_master_send(c,buffer,4))) | 382 | if (4 != (rc = i2c_master_send(c,buffer,4))) |
370 | tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); | 383 | tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); |
384 | break; | ||
385 | } | ||
371 | } | 386 | } |
372 | } | 387 | } |
373 | 388 | ||
diff --git a/drivers/media/video/usbvideo/Kconfig b/drivers/media/video/usbvideo/Kconfig index 59fb899f31f3..a0fd82b924f2 100644 --- a/drivers/media/video/usbvideo/Kconfig +++ b/drivers/media/video/usbvideo/Kconfig | |||
@@ -3,7 +3,7 @@ config VIDEO_USBVIDEO | |||
3 | 3 | ||
4 | config USB_VICAM | 4 | config USB_VICAM |
5 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | 5 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" |
6 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL | 6 | depends on USB && VIDEO_DEV && VIDEO_V4L1 && EXPERIMENTAL |
7 | select VIDEO_USBVIDEO | 7 | select VIDEO_USBVIDEO |
8 | ---help--- | 8 | ---help--- |
9 | Say Y here if you have 3com homeconnect camera (vicam). | 9 | Say Y here if you have 3com homeconnect camera (vicam). |
@@ -13,7 +13,7 @@ config USB_VICAM | |||
13 | 13 | ||
14 | config USB_IBMCAM | 14 | config USB_IBMCAM |
15 | tristate "USB IBM (Xirlink) C-it Camera support" | 15 | tristate "USB IBM (Xirlink) C-it Camera support" |
16 | depends on USB && VIDEO_V4L1 | 16 | depends on USB && VIDEO_DEV && VIDEO_V4L1 |
17 | select VIDEO_USBVIDEO | 17 | select VIDEO_USBVIDEO |
18 | ---help--- | 18 | ---help--- |
19 | Say Y here if you want to connect a IBM "C-It" camera, also known as | 19 | Say Y here if you want to connect a IBM "C-It" camera, also known as |
@@ -28,7 +28,7 @@ config USB_IBMCAM | |||
28 | 28 | ||
29 | config USB_KONICAWC | 29 | config USB_KONICAWC |
30 | tristate "USB Konica Webcam support" | 30 | tristate "USB Konica Webcam support" |
31 | depends on USB && VIDEO_V4L1 | 31 | depends on USB && VIDEO_DEV && VIDEO_V4L1 |
32 | select VIDEO_USBVIDEO | 32 | select VIDEO_USBVIDEO |
33 | ---help--- | 33 | ---help--- |
34 | Say Y here if you want support for webcams based on a Konica | 34 | Say Y here if you want support for webcams based on a Konica |
@@ -39,7 +39,7 @@ config USB_KONICAWC | |||
39 | 39 | ||
40 | config USB_QUICKCAM_MESSENGER | 40 | config USB_QUICKCAM_MESSENGER |
41 | tristate "USB Logitech Quickcam Messenger" | 41 | tristate "USB Logitech Quickcam Messenger" |
42 | depends on USB && VIDEO_DEV | 42 | depends on USB && VIDEO_DEV && VIDEO_V4L1 |
43 | select VIDEO_USBVIDEO | 43 | select VIDEO_USBVIDEO |
44 | ---help--- | 44 | ---help--- |
45 | Say Y or M here to enable support for the USB Logitech Quickcam | 45 | Say Y or M here to enable support for the USB Logitech Quickcam |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index f06dc19e504a..2ecbeffb559e 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -202,7 +202,7 @@ static char *v4l2_memory_names[] = { | |||
202 | /* ------------------------------------------------------------------ */ | 202 | /* ------------------------------------------------------------------ */ |
203 | /* debug help functions */ | 203 | /* debug help functions */ |
204 | 204 | ||
205 | #ifdef HAVE_V4L1 | 205 | #ifdef CONFIG_V4L1_COMPAT |
206 | static const char *v4l1_ioctls[] = { | 206 | static const char *v4l1_ioctls[] = { |
207 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", | 207 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", |
208 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", | 208 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", |
@@ -301,7 +301,7 @@ static const char *v4l2_ioctls[] = { | |||
301 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | 301 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) |
302 | 302 | ||
303 | static const char *v4l2_int_ioctls[] = { | 303 | static const char *v4l2_int_ioctls[] = { |
304 | #ifdef HAVE_VIDEO_DECODER | 304 | #ifdef CONFIG_V4L1_COMPAT |
305 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", | 305 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", |
306 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", | 306 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", |
307 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", | 307 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", |
@@ -367,7 +367,7 @@ void v4l_printk_ioctl(unsigned int cmd) | |||
367 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? | 367 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? |
368 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | 368 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); |
369 | break; | 369 | break; |
370 | #ifdef HAVE_V4L1 | 370 | #ifdef CONFIG_V4L1_COMPAT |
371 | case 'v': | 371 | case 'v': |
372 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", | 372 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", |
373 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? | 373 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? |
@@ -414,6 +414,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
414 | printk ("%s: tuner type=%d\n", s, *p); | 414 | printk ("%s: tuner type=%d\n", s, *p); |
415 | break; | 415 | break; |
416 | } | 416 | } |
417 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
417 | case DECODER_SET_VBI_BYPASS: | 418 | case DECODER_SET_VBI_BYPASS: |
418 | case DECODER_ENABLE_OUTPUT: | 419 | case DECODER_ENABLE_OUTPUT: |
419 | case DECODER_GET_STATUS: | 420 | case DECODER_GET_STATUS: |
@@ -424,6 +425,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
424 | case VIDIOCCAPTURE: | 425 | case VIDIOCCAPTURE: |
425 | case VIDIOCSYNC: | 426 | case VIDIOCSYNC: |
426 | case VIDIOCSWRITEMODE: | 427 | case VIDIOCSWRITEMODE: |
428 | #endif | ||
427 | case TUNER_SET_TYPE_ADDR: | 429 | case TUNER_SET_TYPE_ADDR: |
428 | case TUNER_SET_STANDBY: | 430 | case TUNER_SET_STANDBY: |
429 | case TDA9887_SET_CONFIG: | 431 | case TDA9887_SET_CONFIG: |
@@ -755,6 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
755 | p->afc); | 757 | p->afc); |
756 | break; | 758 | break; |
757 | } | 759 | } |
760 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
758 | case VIDIOCGVBIFMT: | 761 | case VIDIOCGVBIFMT: |
759 | case VIDIOCSVBIFMT: | 762 | case VIDIOCSVBIFMT: |
760 | { | 763 | { |
@@ -924,6 +927,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
924 | p->clipcount); | 927 | p->clipcount); |
925 | break; | 928 | break; |
926 | } | 929 | } |
930 | case VIDIOCGFREQ: | ||
931 | case VIDIOCSFREQ: | ||
932 | { | ||
933 | unsigned long *p=arg; | ||
934 | printk ("%s: value=%lu\n", s, *p); | ||
935 | break; | ||
936 | } | ||
937 | #endif | ||
927 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | 938 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: |
928 | case VIDIOC_INT_I2S_CLOCK_FREQ: | 939 | case VIDIOC_INT_I2S_CLOCK_FREQ: |
929 | case VIDIOC_INT_S_STANDBY: | 940 | case VIDIOC_INT_S_STANDBY: |
@@ -933,13 +944,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
933 | printk ("%s: value=%d\n", s, *p); | 944 | printk ("%s: value=%d\n", s, *p); |
934 | break; | 945 | break; |
935 | } | 946 | } |
936 | case VIDIOCGFREQ: | ||
937 | case VIDIOCSFREQ: | ||
938 | { | ||
939 | unsigned long *p=arg; | ||
940 | printk ("%s: value=%lu\n", s, *p); | ||
941 | break; | ||
942 | } | ||
943 | case VIDIOC_G_STD: | 947 | case VIDIOC_G_STD: |
944 | case VIDIOC_S_STD: | 948 | case VIDIOC_S_STD: |
945 | case VIDIOC_QUERYSTD: | 949 | case VIDIOC_QUERYSTD: |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index b26ebaff226f..0fc90cd393f6 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
760 | ret=vfd->vidioc_overlay(file, fh, *i); | 760 | ret=vfd->vidioc_overlay(file, fh, *i); |
761 | break; | 761 | break; |
762 | } | 762 | } |
763 | #ifdef HAVE_V4L1 | 763 | #ifdef CONFIG_V4L1_COMPAT |
764 | /* --- streaming capture ------------------------------------- */ | 764 | /* --- streaming capture ------------------------------------- */ |
765 | case VIDIOCGMBUF: | 765 | case VIDIOCGMBUF: |
766 | { | 766 | { |
@@ -1512,6 +1512,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1512 | int i=0; | 1512 | int i=0; |
1513 | int base; | 1513 | int base; |
1514 | int end; | 1514 | int end; |
1515 | int ret; | ||
1515 | char *name_base; | 1516 | char *name_base; |
1516 | 1517 | ||
1517 | switch(type) | 1518 | switch(type) |
@@ -1537,6 +1538,8 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1537 | name_base = "radio"; | 1538 | name_base = "radio"; |
1538 | break; | 1539 | break; |
1539 | default: | 1540 | default: |
1541 | printk(KERN_ERR "%s called with unknown type: %d\n", | ||
1542 | __FUNCTION__, type); | ||
1540 | return -1; | 1543 | return -1; |
1541 | } | 1544 | } |
1542 | 1545 | ||
@@ -1571,9 +1574,18 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1571 | vfd->class_dev.class = &video_class; | 1574 | vfd->class_dev.class = &video_class; |
1572 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); | 1575 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); |
1573 | sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); | 1576 | sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); |
1574 | class_device_register(&vfd->class_dev); | 1577 | ret = class_device_register(&vfd->class_dev); |
1575 | class_device_create_file(&vfd->class_dev, | 1578 | if (ret < 0) { |
1576 | &class_device_attr_name); | 1579 | printk(KERN_ERR "%s: class_device_register failed\n", |
1580 | __FUNCTION__); | ||
1581 | goto fail_minor; | ||
1582 | } | ||
1583 | ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name); | ||
1584 | if (ret < 0) { | ||
1585 | printk(KERN_ERR "%s: class_device_create_file 'name' failed\n", | ||
1586 | __FUNCTION__); | ||
1587 | goto fail_classdev; | ||
1588 | } | ||
1577 | 1589 | ||
1578 | #if 1 | 1590 | #if 1 |
1579 | /* needed until all drivers are fixed */ | 1591 | /* needed until all drivers are fixed */ |
@@ -1583,6 +1595,15 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1583 | "http://lwn.net/Articles/36850/\n", vfd->name); | 1595 | "http://lwn.net/Articles/36850/\n", vfd->name); |
1584 | #endif | 1596 | #endif |
1585 | return 0; | 1597 | return 0; |
1598 | |||
1599 | fail_classdev: | ||
1600 | class_device_unregister(&vfd->class_dev); | ||
1601 | fail_minor: | ||
1602 | mutex_lock(&videodev_lock); | ||
1603 | video_device[vfd->minor] = NULL; | ||
1604 | vfd->minor = -1; | ||
1605 | mutex_unlock(&videodev_lock); | ||
1606 | return ret; | ||
1586 | } | 1607 | } |
1587 | 1608 | ||
1588 | /** | 1609 | /** |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 41d23c8acbd8..38bd0c1018c2 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -986,7 +986,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *p) | |||
986 | file->f_flags & O_NONBLOCK)); | 986 | file->f_flags & O_NONBLOCK)); |
987 | } | 987 | } |
988 | 988 | ||
989 | #ifdef HAVE_V4L1 | 989 | #ifdef CONFIG_V4L1_COMPAT |
990 | static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) | 990 | static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) |
991 | { | 991 | { |
992 | struct vivi_fh *fh=priv; | 992 | struct vivi_fh *fh=priv; |
@@ -1328,7 +1328,7 @@ static struct video_device vivi = { | |||
1328 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1328 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1329 | .vidioc_streamon = vidioc_streamon, | 1329 | .vidioc_streamon = vidioc_streamon, |
1330 | .vidioc_streamoff = vidioc_streamoff, | 1330 | .vidioc_streamoff = vidioc_streamoff, |
1331 | #ifdef HAVE_V4L1 | 1331 | #ifdef CONFIG_V4L1_COMPAT |
1332 | .vidiocgmbuf = vidiocgmbuf, | 1332 | .vidiocgmbuf = vidiocgmbuf, |
1333 | #endif | 1333 | #endif |
1334 | .tvnorms = tvnorms, | 1334 | .tvnorms = tvnorms, |
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig index b14e89004c3a..0a0e0cd81a23 100644 --- a/drivers/net/appletalk/Kconfig +++ b/drivers/net/appletalk/Kconfig | |||
@@ -29,7 +29,7 @@ config ATALK | |||
29 | even politically correct people are allowed to say Y here. | 29 | even politically correct people are allowed to say Y here. |
30 | 30 | ||
31 | config DEV_APPLETALK | 31 | config DEV_APPLETALK |
32 | bool "Appletalk interfaces support" | 32 | tristate "Appletalk interfaces support" |
33 | depends on ATALK | 33 | depends on ATALK |
34 | help | 34 | help |
35 | AppleTalk is the protocol that Apple computers can use to communicate | 35 | AppleTalk is the protocol that Apple computers can use to communicate |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index da62db897426..627f224d78bc 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3127,7 +3127,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3127 | break; | 3127 | break; |
3128 | } | 3128 | } |
3129 | 3129 | ||
3130 | /* NOTE: dev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN | 3130 | /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN |
3131 | * means we reserve 2 more, this pushes us to allocate from the next | 3131 | * means we reserve 2 more, this pushes us to allocate from the next |
3132 | * larger slab size | 3132 | * larger slab size |
3133 | * i.e. RXBUFFER_2048 --> size-4096 slab */ | 3133 | * i.e. RXBUFFER_2048 --> size-4096 slab */ |
@@ -3708,7 +3708,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3708 | #define E1000_CB_LENGTH 256 | 3708 | #define E1000_CB_LENGTH 256 |
3709 | if (length < E1000_CB_LENGTH) { | 3709 | if (length < E1000_CB_LENGTH) { |
3710 | struct sk_buff *new_skb = | 3710 | struct sk_buff *new_skb = |
3711 | dev_alloc_skb(length + NET_IP_ALIGN); | 3711 | netdev_alloc_skb(netdev, length + NET_IP_ALIGN); |
3712 | if (new_skb) { | 3712 | if (new_skb) { |
3713 | skb_reserve(new_skb, NET_IP_ALIGN); | 3713 | skb_reserve(new_skb, NET_IP_ALIGN); |
3714 | new_skb->dev = netdev; | 3714 | new_skb->dev = netdev; |
@@ -3979,7 +3979,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
3979 | 3979 | ||
3980 | while (cleaned_count--) { | 3980 | while (cleaned_count--) { |
3981 | if (!(skb = buffer_info->skb)) | 3981 | if (!(skb = buffer_info->skb)) |
3982 | skb = dev_alloc_skb(bufsz); | 3982 | skb = netdev_alloc_skb(netdev, bufsz); |
3983 | else { | 3983 | else { |
3984 | skb_trim(skb, 0); | 3984 | skb_trim(skb, 0); |
3985 | goto map_skb; | 3985 | goto map_skb; |
@@ -3997,7 +3997,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter, | |||
3997 | DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " | 3997 | DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " |
3998 | "at %p\n", bufsz, skb->data); | 3998 | "at %p\n", bufsz, skb->data); |
3999 | /* Try again, without freeing the previous */ | 3999 | /* Try again, without freeing the previous */ |
4000 | skb = dev_alloc_skb(bufsz); | 4000 | skb = netdev_alloc_skb(netdev, bufsz); |
4001 | /* Failed allocation, critical failure */ | 4001 | /* Failed allocation, critical failure */ |
4002 | if (!skb) { | 4002 | if (!skb) { |
4003 | dev_kfree_skb(oldskb); | 4003 | dev_kfree_skb(oldskb); |
@@ -4121,7 +4121,8 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | |||
4121 | rx_desc->read.buffer_addr[j+1] = ~0; | 4121 | rx_desc->read.buffer_addr[j+1] = ~0; |
4122 | } | 4122 | } |
4123 | 4123 | ||
4124 | skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); | 4124 | skb = netdev_alloc_skb(netdev, |
4125 | adapter->rx_ps_bsize0 + NET_IP_ALIGN); | ||
4125 | 4126 | ||
4126 | if (unlikely(!skb)) { | 4127 | if (unlikely(!skb)) { |
4127 | adapter->alloc_rx_buff_failed++; | 4128 | adapter->alloc_rx_buff_failed++; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 1b8138f641e3..6f97962dd06b 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -68,8 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_MODULE_NAME "tg3" | 69 | #define DRV_MODULE_NAME "tg3" |
70 | #define PFX DRV_MODULE_NAME ": " | 70 | #define PFX DRV_MODULE_NAME ": " |
71 | #define DRV_MODULE_VERSION "3.63" | 71 | #define DRV_MODULE_VERSION "3.64" |
72 | #define DRV_MODULE_RELDATE "July 25, 2006" | 72 | #define DRV_MODULE_RELDATE "July 31, 2006" |
73 | 73 | ||
74 | #define TG3_DEF_MAC_MODE 0 | 74 | #define TG3_DEF_MAC_MODE 0 |
75 | #define TG3_DEF_RX_MODE 0 | 75 | #define TG3_DEF_RX_MODE 0 |
@@ -3097,7 +3097,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key, | |||
3097 | * Callers depend upon this behavior and assume that | 3097 | * Callers depend upon this behavior and assume that |
3098 | * we leave everything unchanged if we fail. | 3098 | * we leave everything unchanged if we fail. |
3099 | */ | 3099 | */ |
3100 | skb = dev_alloc_skb(skb_size); | 3100 | skb = netdev_alloc_skb(tp->dev, skb_size); |
3101 | if (skb == NULL) | 3101 | if (skb == NULL) |
3102 | return -ENOMEM; | 3102 | return -ENOMEM; |
3103 | 3103 | ||
@@ -3270,7 +3270,7 @@ static int tg3_rx(struct tg3 *tp, int budget) | |||
3270 | tg3_recycle_rx(tp, opaque_key, | 3270 | tg3_recycle_rx(tp, opaque_key, |
3271 | desc_idx, *post_ptr); | 3271 | desc_idx, *post_ptr); |
3272 | 3272 | ||
3273 | copy_skb = dev_alloc_skb(len + 2); | 3273 | copy_skb = netdev_alloc_skb(tp->dev, len + 2); |
3274 | if (copy_skb == NULL) | 3274 | if (copy_skb == NULL) |
3275 | goto drop_it_no_recycle; | 3275 | goto drop_it_no_recycle; |
3276 | 3276 | ||
@@ -8618,7 +8618,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8618 | err = -EIO; | 8618 | err = -EIO; |
8619 | 8619 | ||
8620 | tx_len = 1514; | 8620 | tx_len = 1514; |
8621 | skb = dev_alloc_skb(tx_len); | 8621 | skb = netdev_alloc_skb(tp->dev, tx_len); |
8622 | if (!skb) | 8622 | if (!skb) |
8623 | return -ENOMEM; | 8623 | return -ENOMEM; |
8624 | 8624 | ||
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 622b3f8ba820..f8ae2b7db0a7 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -61,7 +61,7 @@ struct pci_bus * __devinit pci_find_bus(int domain, int busnr) | |||
61 | * @from: Previous PCI bus found, or %NULL for new search. | 61 | * @from: Previous PCI bus found, or %NULL for new search. |
62 | * | 62 | * |
63 | * Iterates through the list of known PCI busses. A new search is | 63 | * Iterates through the list of known PCI busses. A new search is |
64 | * initiated by passing %NULL to the @from argument. Otherwise if | 64 | * initiated by passing %NULL as the @from argument. Otherwise if |
65 | * @from is not %NULL, searches continue from next device on the | 65 | * @from is not %NULL, searches continue from next device on the |
66 | * global list. | 66 | * global list. |
67 | */ | 67 | */ |
@@ -148,13 +148,14 @@ struct pci_dev * pci_get_slot(struct pci_bus *bus, unsigned int devfn) | |||
148 | * @from: Previous PCI device found in search, or %NULL for new search. | 148 | * @from: Previous PCI device found in search, or %NULL for new search. |
149 | * | 149 | * |
150 | * Iterates through the list of known PCI devices. If a PCI device is | 150 | * Iterates through the list of known PCI devices. If a PCI device is |
151 | * found with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its | 151 | * found with a matching @vendor, @device, @ss_vendor and @ss_device, a |
152 | * device structure is returned. Otherwise, %NULL is returned. | 152 | * pointer to its device structure is returned. Otherwise, %NULL is returned. |
153 | * A new search is initiated by passing %NULL to the @from argument. | 153 | * A new search is initiated by passing %NULL as the @from argument. |
154 | * Otherwise if @from is not %NULL, searches continue from next device on the global list. | 154 | * Otherwise if @from is not %NULL, searches continue from next device |
155 | * on the global list. | ||
155 | * | 156 | * |
156 | * NOTE: Do not use this function anymore, use pci_get_subsys() instead, as | 157 | * NOTE: Do not use this function any more; use pci_get_subsys() instead, as |
157 | * the pci device returned by this function can disappear at any moment in | 158 | * the PCI device returned by this function can disappear at any moment in |
158 | * time. | 159 | * time. |
159 | */ | 160 | */ |
160 | static struct pci_dev * pci_find_subsys(unsigned int vendor, | 161 | static struct pci_dev * pci_find_subsys(unsigned int vendor, |
@@ -191,14 +192,15 @@ exit: | |||
191 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids | 192 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids |
192 | * @from: Previous PCI device found in search, or %NULL for new search. | 193 | * @from: Previous PCI device found in search, or %NULL for new search. |
193 | * | 194 | * |
194 | * Iterates through the list of known PCI devices. If a PCI device is | 195 | * Iterates through the list of known PCI devices. If a PCI device is found |
195 | * found with a matching @vendor and @device, a pointer to its device structure is | 196 | * with a matching @vendor and @device, a pointer to its device structure is |
196 | * returned. Otherwise, %NULL is returned. | 197 | * returned. Otherwise, %NULL is returned. |
197 | * A new search is initiated by passing %NULL to the @from argument. | 198 | * A new search is initiated by passing %NULL as the @from argument. |
198 | * Otherwise if @from is not %NULL, searches continue from next device on the global list. | 199 | * Otherwise if @from is not %NULL, searches continue from next device |
200 | * on the global list. | ||
199 | * | 201 | * |
200 | * NOTE: Do not use this function anymore, use pci_get_device() instead, as | 202 | * NOTE: Do not use this function any more; use pci_get_device() instead, as |
201 | * the pci device returned by this function can disappear at any moment in | 203 | * the PCI device returned by this function can disappear at any moment in |
202 | * time. | 204 | * time. |
203 | */ | 205 | */ |
204 | struct pci_dev * | 206 | struct pci_dev * |
@@ -215,11 +217,11 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev * | |||
215 | * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids | 217 | * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids |
216 | * @from: Previous PCI device found in search, or %NULL for new search. | 218 | * @from: Previous PCI device found in search, or %NULL for new search. |
217 | * | 219 | * |
218 | * Iterates through the list of known PCI devices. If a PCI device is | 220 | * Iterates through the list of known PCI devices. If a PCI device is found |
219 | * found with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its | 221 | * with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its |
220 | * device structure is returned, and the reference count to the device is | 222 | * device structure is returned, and the reference count to the device is |
221 | * incremented. Otherwise, %NULL is returned. A new search is initiated by | 223 | * incremented. Otherwise, %NULL is returned. A new search is initiated by |
222 | * passing %NULL to the @from argument. Otherwise if @from is not %NULL, | 224 | * passing %NULL as the @from argument. Otherwise if @from is not %NULL, |
223 | * searches continue from next device on the global list. | 225 | * searches continue from next device on the global list. |
224 | * The reference count for @from is always decremented if it is not %NULL. | 226 | * The reference count for @from is always decremented if it is not %NULL. |
225 | */ | 227 | */ |
@@ -262,7 +264,7 @@ exit: | |||
262 | * found with a matching @vendor and @device, the reference count to the | 264 | * found with a matching @vendor and @device, the reference count to the |
263 | * device is incremented and a pointer to its device structure is returned. | 265 | * device is incremented and a pointer to its device structure is returned. |
264 | * Otherwise, %NULL is returned. A new search is initiated by passing %NULL | 266 | * Otherwise, %NULL is returned. A new search is initiated by passing %NULL |
265 | * to the @from argument. Otherwise if @from is not %NULL, searches continue | 267 | * as the @from argument. Otherwise if @from is not %NULL, searches continue |
266 | * from next device on the global list. The reference count for @from is | 268 | * from next device on the global list. The reference count for @from is |
267 | * always decremented if it is not %NULL. | 269 | * always decremented if it is not %NULL. |
268 | */ | 270 | */ |
@@ -279,11 +281,13 @@ pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from) | |||
279 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids | 281 | * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids |
280 | * @from: Previous PCI device found in search, or %NULL for new search. | 282 | * @from: Previous PCI device found in search, or %NULL for new search. |
281 | * | 283 | * |
282 | * Iterates through the list of known PCI devices in the reverse order of pci_find_device(). | 284 | * Iterates through the list of known PCI devices in the reverse order of |
285 | * pci_find_device(). | ||
283 | * If a PCI device is found with a matching @vendor and @device, a pointer to | 286 | * If a PCI device is found with a matching @vendor and @device, a pointer to |
284 | * its device structure is returned. Otherwise, %NULL is returned. | 287 | * its device structure is returned. Otherwise, %NULL is returned. |
285 | * A new search is initiated by passing %NULL to the @from argument. | 288 | * A new search is initiated by passing %NULL as the @from argument. |
286 | * Otherwise if @from is not %NULL, searches continue from previous device on the global list. | 289 | * Otherwise if @from is not %NULL, searches continue from previous device |
290 | * on the global list. | ||
287 | */ | 291 | */ |
288 | struct pci_dev * | 292 | struct pci_dev * |
289 | pci_find_device_reverse(unsigned int vendor, unsigned int device, const struct pci_dev *from) | 293 | pci_find_device_reverse(unsigned int vendor, unsigned int device, const struct pci_dev *from) |
@@ -317,7 +321,7 @@ exit: | |||
317 | * found with a matching @class, the reference count to the device is | 321 | * found with a matching @class, the reference count to the device is |
318 | * incremented and a pointer to its device structure is returned. | 322 | * incremented and a pointer to its device structure is returned. |
319 | * Otherwise, %NULL is returned. | 323 | * Otherwise, %NULL is returned. |
320 | * A new search is initiated by passing %NULL to the @from argument. | 324 | * A new search is initiated by passing %NULL as the @from argument. |
321 | * Otherwise if @from is not %NULL, searches continue from next device | 325 | * Otherwise if @from is not %NULL, searches continue from next device |
322 | * on the global list. The reference count for @from is always decremented | 326 | * on the global list. The reference count for @from is always decremented |
323 | * if it is not %NULL. | 327 | * if it is not %NULL. |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 738b1ef595a3..9ad18e62658d 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -601,12 +601,8 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
601 | ret = CS_BAD_ARGS; | 601 | ret = CS_BAD_ARGS; |
602 | else { | 602 | else { |
603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); | 603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); |
604 | if (p_dev == NULL) | 604 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); |
605 | ret = CS_BAD_ARGS; | 605 | pcmcia_put_dev(p_dev); |
606 | else { | ||
607 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | ||
608 | pcmcia_put_dev(p_dev); | ||
609 | } | ||
610 | } | 606 | } |
611 | break; | 607 | break; |
612 | case DS_GET_FIRST_TUPLE: | 608 | case DS_GET_FIRST_TUPLE: |
@@ -636,12 +632,8 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
636 | ret = CS_BAD_ARGS; | 632 | ret = CS_BAD_ARGS; |
637 | else { | 633 | else { |
638 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); | 634 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); |
639 | if (p_dev == NULL) | 635 | ret = pccard_get_status(s, p_dev, &buf->status); |
640 | ret = CS_BAD_ARGS; | 636 | pcmcia_put_dev(p_dev); |
641 | else { | ||
642 | ret = pccard_get_status(s, p_dev, &buf->status); | ||
643 | pcmcia_put_dev(p_dev); | ||
644 | } | ||
645 | } | 637 | } |
646 | break; | 638 | break; |
647 | case DS_VALIDATE_CIS: | 639 | case DS_VALIDATE_CIS: |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 7bf25b88ea31..c8323399e9e4 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -245,10 +245,17 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, | |||
245 | return CS_SUCCESS; | 245 | return CS_SUCCESS; |
246 | } | 246 | } |
247 | 247 | ||
248 | /* !!! This is a hack !!! */ | 248 | config->Attributes = c->Attributes | CONF_VALID_CLIENT; |
249 | memcpy(&config->Attributes, &c->Attributes, sizeof(config_t)); | 249 | config->Vcc = s->socket.Vcc; |
250 | config->Attributes |= CONF_VALID_CLIENT; | 250 | config->Vpp1 = config->Vpp2 = s->socket.Vpp; |
251 | config->CardValues = c->CardValues; | 251 | config->IntType = c->IntType; |
252 | config->ConfigBase = c->ConfigBase; | ||
253 | config->Status = c->Status; | ||
254 | config->Pin = c->Pin; | ||
255 | config->Copy = c->Copy; | ||
256 | config->Option = c->Option; | ||
257 | config->ExtStatus = c->ExtStatus; | ||
258 | config->Present = config->CardValues = c->CardValues; | ||
252 | config->IRQAttributes = c->irq.Attributes; | 259 | config->IRQAttributes = c->irq.Attributes; |
253 | config->AssignedIRQ = s->irq.AssignedIRQ; | 260 | config->AssignedIRQ = s->irq.AssignedIRQ; |
254 | config->BasePort1 = c->io.BasePort1; | 261 | config->BasePort1 = c->io.BasePort1; |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index b154b3f52cbe..551f58e29810 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -346,7 +346,7 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node) | |||
346 | dev->flags = node->flags; | 346 | dev->flags = node->flags; |
347 | if (!(dev->flags & PNPBIOS_NO_CONFIG)) | 347 | if (!(dev->flags & PNPBIOS_NO_CONFIG)) |
348 | dev->capabilities |= PNP_CONFIGURABLE; | 348 | dev->capabilities |= PNP_CONFIGURABLE; |
349 | if (!(dev->flags & PNPBIOS_NO_DISABLE)) | 349 | if (!(dev->flags & PNPBIOS_NO_DISABLE) && pnpbios_is_dynamic(dev)) |
350 | dev->capabilities |= PNP_DISABLE; | 350 | dev->capabilities |= PNP_DISABLE; |
351 | dev->capabilities |= PNP_READ; | 351 | dev->capabilities |= PNP_READ; |
352 | if (pnpbios_is_dynamic(dev)) | 352 | if (pnpbios_is_dynamic(dev)) |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 35058f9296d8..f5734a97580a 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -1076,14 +1076,8 @@ static void ahci_host_intr(struct ata_port *ap) | |||
1076 | return; | 1076 | return; |
1077 | 1077 | ||
1078 | /* ignore interim PIO setup fis interrupts */ | 1078 | /* ignore interim PIO setup fis interrupts */ |
1079 | if (ata_tag_valid(ap->active_tag)) { | 1079 | if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) |
1080 | struct ata_queued_cmd *qc = | 1080 | return; |
1081 | ata_qc_from_tag(ap, ap->active_tag); | ||
1082 | |||
1083 | if (qc && qc->tf.protocol == ATA_PROT_PIO && | ||
1084 | (status & PORT_IRQ_PIOS_FIS)) | ||
1085 | return; | ||
1086 | } | ||
1087 | 1081 | ||
1088 | if (ata_ratelimit()) | 1082 | if (ata_ratelimit()) |
1089 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " | 1083 | ata_port_printk(ap, KERN_INFO, "spurious interrupt " |
diff --git a/drivers/scsi/aic7xxx/aicasm/Makefile b/drivers/scsi/aic7xxx/aicasm/Makefile index 8c91fda6482c..b98c5c1056c3 100644 --- a/drivers/scsi/aic7xxx/aicasm/Makefile +++ b/drivers/scsi/aic7xxx/aicasm/Makefile | |||
@@ -14,6 +14,8 @@ LIBS= -ldb | |||
14 | clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) | 14 | clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) |
15 | # Override default kernel CFLAGS. This is a userland app. | 15 | # Override default kernel CFLAGS. This is a userland app. |
16 | AICASM_CFLAGS:= -I/usr/include -I. | 16 | AICASM_CFLAGS:= -I/usr/include -I. |
17 | LEX= flex | ||
18 | YACC= bison | ||
17 | YFLAGS= -d | 19 | YFLAGS= -d |
18 | 20 | ||
19 | NOMAN= noman | 21 | NOMAN= noman |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 2ee742d40c43..005043197527 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -24,7 +24,7 @@ config USB_ARCH_HAS_OHCI | |||
24 | default y if ARCH_S3C2410 | 24 | default y if ARCH_S3C2410 |
25 | default y if PXA27x | 25 | default y if PXA27x |
26 | default y if ARCH_EP93XX | 26 | default y if ARCH_EP93XX |
27 | default y if ARCH_AT91RM9200 | 27 | default y if (ARCH_AT91RM9200 || ARCH_AT91SAM9261) |
28 | # PPC: | 28 | # PPC: |
29 | default y if STB03xxx | 29 | default y if STB03xxx |
30 | default y if PPC_MPC52xx | 30 | default y if PPC_MPC52xx |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index f7bdd94b3aa8..218621b9958e 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -517,19 +517,19 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig | |||
517 | 517 | ||
518 | static struct usb_device *usbdev_lookup_minor(int minor) | 518 | static struct usb_device *usbdev_lookup_minor(int minor) |
519 | { | 519 | { |
520 | struct device *device; | 520 | struct class_device *class_dev; |
521 | struct usb_device *udev = NULL; | 521 | struct usb_device *dev = NULL; |
522 | 522 | ||
523 | down(&usb_device_class->sem); | 523 | down(&usb_device_class->sem); |
524 | list_for_each_entry(device, &usb_device_class->devices, node) { | 524 | list_for_each_entry(class_dev, &usb_device_class->children, node) { |
525 | if (device->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { | 525 | if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { |
526 | udev = device->platform_data; | 526 | dev = class_dev->class_data; |
527 | break; | 527 | break; |
528 | } | 528 | } |
529 | } | 529 | } |
530 | up(&usb_device_class->sem); | 530 | up(&usb_device_class->sem); |
531 | 531 | ||
532 | return udev; | 532 | return dev; |
533 | }; | 533 | }; |
534 | 534 | ||
535 | /* | 535 | /* |
@@ -1580,16 +1580,16 @@ static void usbdev_add(struct usb_device *dev) | |||
1580 | { | 1580 | { |
1581 | int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); | 1581 | int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); |
1582 | 1582 | ||
1583 | dev->usbfs_dev = device_create(usb_device_class, &dev->dev, | 1583 | dev->class_dev = class_device_create(usb_device_class, NULL, |
1584 | MKDEV(USB_DEVICE_MAJOR, minor), | 1584 | MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev, |
1585 | "usbdev%d.%d", dev->bus->busnum, dev->devnum); | 1585 | "usbdev%d.%d", dev->bus->busnum, dev->devnum); |
1586 | 1586 | ||
1587 | dev->usbfs_dev->platform_data = dev; | 1587 | dev->class_dev->class_data = dev; |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | static void usbdev_remove(struct usb_device *dev) | 1590 | static void usbdev_remove(struct usb_device *dev) |
1591 | { | 1591 | { |
1592 | device_unregister(dev->usbfs_dev); | 1592 | class_device_unregister(dev->class_dev); |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | static int usbdev_notify(struct notifier_block *self, unsigned long action, | 1595 | static int usbdev_notify(struct notifier_block *self, unsigned long action, |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index abee0f5b6a66..8de4f8c99d61 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -194,13 +194,14 @@ int usb_register_dev(struct usb_interface *intf, | |||
194 | ++temp; | 194 | ++temp; |
195 | else | 195 | else |
196 | temp = name; | 196 | temp = name; |
197 | intf->usb_dev = device_create(usb_class->class, &intf->dev, | 197 | intf->class_dev = class_device_create(usb_class->class, NULL, |
198 | MKDEV(USB_MAJOR, minor), "%s", temp); | 198 | MKDEV(USB_MAJOR, minor), |
199 | if (IS_ERR(intf->usb_dev)) { | 199 | &intf->dev, "%s", temp); |
200 | if (IS_ERR(intf->class_dev)) { | ||
200 | spin_lock (&minor_lock); | 201 | spin_lock (&minor_lock); |
201 | usb_minors[intf->minor] = NULL; | 202 | usb_minors[intf->minor] = NULL; |
202 | spin_unlock (&minor_lock); | 203 | spin_unlock (&minor_lock); |
203 | retval = PTR_ERR(intf->usb_dev); | 204 | retval = PTR_ERR(intf->class_dev); |
204 | } | 205 | } |
205 | exit: | 206 | exit: |
206 | return retval; | 207 | return retval; |
@@ -241,8 +242,8 @@ void usb_deregister_dev(struct usb_interface *intf, | |||
241 | spin_unlock (&minor_lock); | 242 | spin_unlock (&minor_lock); |
242 | 243 | ||
243 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); | 244 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); |
244 | device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); | 245 | class_device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); |
245 | intf->usb_dev = NULL; | 246 | intf->class_dev = NULL; |
246 | intf->minor = -1; | 247 | intf->minor = -1; |
247 | destroy_usb_class(); | 248 | destroy_usb_class(); |
248 | } | 249 | } |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 363b2ad74ae6..1a32d96774b4 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -207,7 +207,7 @@ config USB_AT91 | |||
207 | 207 | ||
208 | config USB_GADGET_DUMMY_HCD | 208 | config USB_GADGET_DUMMY_HCD |
209 | boolean "Dummy HCD (DEVELOPMENT)" | 209 | boolean "Dummy HCD (DEVELOPMENT)" |
210 | depends on USB && EXPERIMENTAL | 210 | depends on (USB=y || (USB=m && USB_GADGET=m)) && EXPERIMENTAL |
211 | select USB_GADGET_DUALSPEED | 211 | select USB_GADGET_DUALSPEED |
212 | help | 212 | help |
213 | This host controller driver emulates USB, looping all data transfer | 213 | This host controller driver emulates USB, looping all data transfer |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 1c459ff037ce..cfebca05ead5 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -57,19 +57,23 @@ | |||
57 | 57 | ||
58 | /* | 58 | /* |
59 | * This controller is simple and PIO-only. It's used in many AT91-series | 59 | * This controller is simple and PIO-only. It's used in many AT91-series |
60 | * ARMv4T controllers, including the at91rm9200 (arm920T, with MMU), | 60 | * full speed USB controllers, including the at91rm9200 (arm920T, with MMU), |
61 | * at91sam9261 (arm926ejs, with MMU), and several no-mmu versions. | 61 | * at91sam926x (arm926ejs, with MMU), and several no-mmu versions. |
62 | * | 62 | * |
63 | * This driver expects the board has been wired with two GPIOs suppporting | 63 | * This driver expects the board has been wired with two GPIOs suppporting |
64 | * a VBUS sensing IRQ, and a D+ pullup. (They may be omitted, but the | 64 | * a VBUS sensing IRQ, and a D+ pullup. (They may be omitted, but the |
65 | * testing hasn't covered such cases.) The pullup is most important; it | 65 | * testing hasn't covered such cases.) |
66 | * | ||
67 | * The pullup is most important (so it's integrated on sam926x parts). It | ||
66 | * provides software control over whether the host enumerates the device. | 68 | * provides software control over whether the host enumerates the device. |
69 | * | ||
67 | * The VBUS sensing helps during enumeration, and allows both USB clocks | 70 | * The VBUS sensing helps during enumeration, and allows both USB clocks |
68 | * (and the transceiver) to stay gated off until they're necessary, saving | 71 | * (and the transceiver) to stay gated off until they're necessary, saving |
69 | * power. During USB suspend, the 48 MHz clock is gated off. | 72 | * power. During USB suspend, the 48 MHz clock is gated off in hardware; |
73 | * it may also be gated off by software during some Linux sleep states. | ||
70 | */ | 74 | */ |
71 | 75 | ||
72 | #define DRIVER_VERSION "8 March 2005" | 76 | #define DRIVER_VERSION "3 May 2006" |
73 | 77 | ||
74 | static const char driver_name [] = "at91_udc"; | 78 | static const char driver_name [] = "at91_udc"; |
75 | static const char ep0name[] = "ep0"; | 79 | static const char ep0name[] = "ep0"; |
@@ -316,9 +320,15 @@ static void done(struct at91_ep *ep, struct at91_request *req, int status) | |||
316 | * | 320 | * |
317 | * There are also state bits like FORCESTALL, EPEDS, DIR, and EPTYPE | 321 | * There are also state bits like FORCESTALL, EPEDS, DIR, and EPTYPE |
318 | * that shouldn't normally be changed. | 322 | * that shouldn't normally be changed. |
323 | * | ||
324 | * NOTE at91sam9260 docs mention synch between UDPCK and MCK clock domains, | ||
325 | * implying a need to wait for one write to complete (test relevant bits) | ||
326 | * before starting the next write. This shouldn't be an issue given how | ||
327 | * infrequently we write, except maybe for write-then-read idioms. | ||
319 | */ | 328 | */ |
320 | #define SET_FX (AT91_UDP_TXPKTRDY) | 329 | #define SET_FX (AT91_UDP_TXPKTRDY) |
321 | #define CLR_FX (RX_DATA_READY | AT91_UDP_RXSETUP | AT91_UDP_STALLSENT | AT91_UDP_TXCOMP) | 330 | #define CLR_FX (RX_DATA_READY | AT91_UDP_RXSETUP \ |
331 | | AT91_UDP_STALLSENT | AT91_UDP_TXCOMP) | ||
322 | 332 | ||
323 | /* pull OUT packet data from the endpoint's fifo */ | 333 | /* pull OUT packet data from the endpoint's fifo */ |
324 | static int read_fifo (struct at91_ep *ep, struct at91_request *req) | 334 | static int read_fifo (struct at91_ep *ep, struct at91_request *req) |
@@ -472,7 +482,8 @@ static void nuke(struct at91_ep *ep, int status) | |||
472 | 482 | ||
473 | /*-------------------------------------------------------------------------*/ | 483 | /*-------------------------------------------------------------------------*/ |
474 | 484 | ||
475 | static int at91_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | 485 | static int at91_ep_enable(struct usb_ep *_ep, |
486 | const struct usb_endpoint_descriptor *desc) | ||
476 | { | 487 | { |
477 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); | 488 | struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); |
478 | struct at91_udc *dev = ep->udc; | 489 | struct at91_udc *dev = ep->udc; |
@@ -582,11 +593,12 @@ static int at91_ep_disable (struct usb_ep * _ep) | |||
582 | * interesting for request or buffer allocation. | 593 | * interesting for request or buffer allocation. |
583 | */ | 594 | */ |
584 | 595 | ||
585 | static struct usb_request *at91_ep_alloc_request (struct usb_ep *_ep, unsigned int gfp_flags) | 596 | static struct usb_request * |
597 | at91_ep_alloc_request(struct usb_ep *_ep, unsigned int gfp_flags) | ||
586 | { | 598 | { |
587 | struct at91_request *req; | 599 | struct at91_request *req; |
588 | 600 | ||
589 | req = kcalloc(1, sizeof (struct at91_request), SLAB_KERNEL); | 601 | req = kcalloc(1, sizeof (struct at91_request), gfp_flags); |
590 | if (!req) | 602 | if (!req) |
591 | return NULL; | 603 | return NULL; |
592 | 604 | ||
@@ -862,6 +874,7 @@ static void stop_activity(struct at91_udc *udc) | |||
862 | if (udc->gadget.speed == USB_SPEED_UNKNOWN) | 874 | if (udc->gadget.speed == USB_SPEED_UNKNOWN) |
863 | driver = NULL; | 875 | driver = NULL; |
864 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 876 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
877 | udc->suspended = 0; | ||
865 | 878 | ||
866 | for (i = 0; i < NUM_ENDPOINTS; i++) { | 879 | for (i = 0; i < NUM_ENDPOINTS; i++) { |
867 | struct at91_ep *ep = &udc->ep[i]; | 880 | struct at91_ep *ep = &udc->ep[i]; |
@@ -889,8 +902,8 @@ static void clk_off(struct at91_udc *udc) | |||
889 | return; | 902 | return; |
890 | udc->clocked = 0; | 903 | udc->clocked = 0; |
891 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 904 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
892 | clk_disable(udc->iclk); | ||
893 | clk_disable(udc->fclk); | 905 | clk_disable(udc->fclk); |
906 | clk_disable(udc->iclk); | ||
894 | } | 907 | } |
895 | 908 | ||
896 | /* | 909 | /* |
@@ -911,9 +924,6 @@ static void pullup(struct at91_udc *udc, int is_on) | |||
911 | at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); | 924 | at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); |
912 | at91_set_gpio_value(udc->board.pullup_pin, 0); | 925 | at91_set_gpio_value(udc->board.pullup_pin, 0); |
913 | clk_off(udc); | 926 | clk_off(udc); |
914 | |||
915 | // REVISIT: with transceiver disabled, will D- float | ||
916 | // so that a host would falsely detect a device? | ||
917 | } | 927 | } |
918 | } | 928 | } |
919 | 929 | ||
@@ -1290,7 +1300,8 @@ static void handle_ep0(struct at91_udc *udc) | |||
1290 | if (udc->wait_for_addr_ack) { | 1300 | if (udc->wait_for_addr_ack) { |
1291 | u32 tmp; | 1301 | u32 tmp; |
1292 | 1302 | ||
1293 | at91_udp_write(AT91_UDP_FADDR, AT91_UDP_FEN | udc->addr); | 1303 | at91_udp_write(AT91_UDP_FADDR, |
1304 | AT91_UDP_FEN | udc->addr); | ||
1294 | tmp = at91_udp_read(AT91_UDP_GLB_STAT); | 1305 | tmp = at91_udp_read(AT91_UDP_GLB_STAT); |
1295 | tmp &= ~AT91_UDP_FADDEN; | 1306 | tmp &= ~AT91_UDP_FADDEN; |
1296 | if (udc->addr) | 1307 | if (udc->addr) |
@@ -1361,9 +1372,10 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r) | |||
1361 | u32 rescans = 5; | 1372 | u32 rescans = 5; |
1362 | 1373 | ||
1363 | while (rescans--) { | 1374 | while (rescans--) { |
1364 | u32 status = at91_udp_read(AT91_UDP_ISR); | 1375 | u32 status; |
1365 | 1376 | ||
1366 | status &= at91_udp_read(AT91_UDP_IMR); | 1377 | status = at91_udp_read(AT91_UDP_ISR) |
1378 | & at91_udp_read(AT91_UDP_IMR); | ||
1367 | if (!status) | 1379 | if (!status) |
1368 | break; | 1380 | break; |
1369 | 1381 | ||
@@ -1379,18 +1391,17 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r) | |||
1379 | stop_activity(udc); | 1391 | stop_activity(udc); |
1380 | 1392 | ||
1381 | /* enable ep0 */ | 1393 | /* enable ep0 */ |
1382 | at91_udp_write(AT91_UDP_CSR(0), AT91_UDP_EPEDS | AT91_UDP_EPTYPE_CTRL); | 1394 | at91_udp_write(AT91_UDP_CSR(0), |
1395 | AT91_UDP_EPEDS | AT91_UDP_EPTYPE_CTRL); | ||
1383 | udc->gadget.speed = USB_SPEED_FULL; | 1396 | udc->gadget.speed = USB_SPEED_FULL; |
1384 | udc->suspended = 0; | 1397 | udc->suspended = 0; |
1385 | at91_udp_write(AT91_UDP_IER, AT91_UDP_EP(0)); | 1398 | at91_udp_write(AT91_UDP_IER, AT91_UDP_EP(0)); |
1386 | 1399 | ||
1387 | /* | 1400 | /* |
1388 | * NOTE: this driver keeps clocks off unless the | 1401 | * NOTE: this driver keeps clocks off unless the |
1389 | * USB host is present. That saves power, and also | 1402 | * USB host is present. That saves power, but for |
1390 | * eliminates IRQs (reset, resume, suspend) that can | 1403 | * boards that don't support VBUS detection, both |
1391 | * otherwise flood from the controller. If your | 1404 | * clocks need to be active most of the time. |
1392 | * board doesn't support VBUS detection, suspend and | ||
1393 | * resume irq logic may need more attention... | ||
1394 | */ | 1405 | */ |
1395 | 1406 | ||
1396 | /* host initiated suspend (3+ms bus idle) */ | 1407 | /* host initiated suspend (3+ms bus idle) */ |
@@ -1452,13 +1463,19 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r) | |||
1452 | 1463 | ||
1453 | /*-------------------------------------------------------------------------*/ | 1464 | /*-------------------------------------------------------------------------*/ |
1454 | 1465 | ||
1466 | static void nop_release(struct device *dev) | ||
1467 | { | ||
1468 | /* nothing to free */ | ||
1469 | } | ||
1470 | |||
1455 | static struct at91_udc controller = { | 1471 | static struct at91_udc controller = { |
1456 | .gadget = { | 1472 | .gadget = { |
1457 | .ops = &at91_udc_ops, | 1473 | .ops = &at91_udc_ops, |
1458 | .ep0 = &controller.ep[0].ep, | 1474 | .ep0 = &controller.ep[0].ep, |
1459 | .name = driver_name, | 1475 | .name = driver_name, |
1460 | .dev = { | 1476 | .dev = { |
1461 | .bus_id = "gadget" | 1477 | .bus_id = "gadget", |
1478 | .release = nop_release, | ||
1462 | } | 1479 | } |
1463 | }, | 1480 | }, |
1464 | .ep[0] = { | 1481 | .ep[0] = { |
@@ -1468,7 +1485,8 @@ static struct at91_udc controller = { | |||
1468 | }, | 1485 | }, |
1469 | .udc = &controller, | 1486 | .udc = &controller, |
1470 | .maxpacket = 8, | 1487 | .maxpacket = 8, |
1471 | .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(0)), | 1488 | .creg = (void __iomem *)(AT91_VA_BASE_UDP |
1489 | + AT91_UDP_CSR(0)), | ||
1472 | .int_mask = 1 << 0, | 1490 | .int_mask = 1 << 0, |
1473 | }, | 1491 | }, |
1474 | .ep[1] = { | 1492 | .ep[1] = { |
@@ -1479,7 +1497,8 @@ static struct at91_udc controller = { | |||
1479 | .udc = &controller, | 1497 | .udc = &controller, |
1480 | .is_pingpong = 1, | 1498 | .is_pingpong = 1, |
1481 | .maxpacket = 64, | 1499 | .maxpacket = 64, |
1482 | .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(1)), | 1500 | .creg = (void __iomem *)(AT91_VA_BASE_UDP |
1501 | + AT91_UDP_CSR(1)), | ||
1483 | .int_mask = 1 << 1, | 1502 | .int_mask = 1 << 1, |
1484 | }, | 1503 | }, |
1485 | .ep[2] = { | 1504 | .ep[2] = { |
@@ -1490,7 +1509,8 @@ static struct at91_udc controller = { | |||
1490 | .udc = &controller, | 1509 | .udc = &controller, |
1491 | .is_pingpong = 1, | 1510 | .is_pingpong = 1, |
1492 | .maxpacket = 64, | 1511 | .maxpacket = 64, |
1493 | .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(2)), | 1512 | .creg = (void __iomem *)(AT91_VA_BASE_UDP |
1513 | + AT91_UDP_CSR(2)), | ||
1494 | .int_mask = 1 << 2, | 1514 | .int_mask = 1 << 2, |
1495 | }, | 1515 | }, |
1496 | .ep[3] = { | 1516 | .ep[3] = { |
@@ -1501,7 +1521,8 @@ static struct at91_udc controller = { | |||
1501 | }, | 1521 | }, |
1502 | .udc = &controller, | 1522 | .udc = &controller, |
1503 | .maxpacket = 8, | 1523 | .maxpacket = 8, |
1504 | .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(3)), | 1524 | .creg = (void __iomem *)(AT91_VA_BASE_UDP |
1525 | + AT91_UDP_CSR(3)), | ||
1505 | .int_mask = 1 << 3, | 1526 | .int_mask = 1 << 3, |
1506 | }, | 1527 | }, |
1507 | .ep[4] = { | 1528 | .ep[4] = { |
@@ -1512,7 +1533,8 @@ static struct at91_udc controller = { | |||
1512 | .udc = &controller, | 1533 | .udc = &controller, |
1513 | .is_pingpong = 1, | 1534 | .is_pingpong = 1, |
1514 | .maxpacket = 256, | 1535 | .maxpacket = 256, |
1515 | .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(4)), | 1536 | .creg = (void __iomem *)(AT91_VA_BASE_UDP |
1537 | + AT91_UDP_CSR(4)), | ||
1516 | .int_mask = 1 << 4, | 1538 | .int_mask = 1 << 4, |
1517 | }, | 1539 | }, |
1518 | .ep[5] = { | 1540 | .ep[5] = { |
@@ -1523,10 +1545,11 @@ static struct at91_udc controller = { | |||
1523 | .udc = &controller, | 1545 | .udc = &controller, |
1524 | .is_pingpong = 1, | 1546 | .is_pingpong = 1, |
1525 | .maxpacket = 256, | 1547 | .maxpacket = 256, |
1526 | .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(5)), | 1548 | .creg = (void __iomem *)(AT91_VA_BASE_UDP |
1549 | + AT91_UDP_CSR(5)), | ||
1527 | .int_mask = 1 << 5, | 1550 | .int_mask = 1 << 5, |
1528 | }, | 1551 | }, |
1529 | /* ep6 and ep7 are also reserved */ | 1552 | /* ep6 and ep7 are also reserved (custom silicon might use them) */ |
1530 | }; | 1553 | }; |
1531 | 1554 | ||
1532 | static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r) | 1555 | static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r) |
@@ -1593,6 +1616,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) | |||
1593 | 1616 | ||
1594 | local_irq_disable(); | 1617 | local_irq_disable(); |
1595 | udc->enabled = 0; | 1618 | udc->enabled = 0; |
1619 | at91_udp_write(AT91_UDP_IDR, ~0); | ||
1596 | pullup(udc, 0); | 1620 | pullup(udc, 0); |
1597 | local_irq_enable(); | 1621 | local_irq_enable(); |
1598 | 1622 | ||
@@ -1624,6 +1648,16 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1624 | return -ENODEV; | 1648 | return -ENODEV; |
1625 | } | 1649 | } |
1626 | 1650 | ||
1651 | if (pdev->num_resources != 2) { | ||
1652 | DBG("invalid num_resources"); | ||
1653 | return -ENODEV; | ||
1654 | } | ||
1655 | if ((pdev->resource[0].flags != IORESOURCE_MEM) | ||
1656 | || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | ||
1657 | DBG("invalid resource type"); | ||
1658 | return -ENODEV; | ||
1659 | } | ||
1660 | |||
1627 | if (!request_mem_region(AT91_BASE_UDP, SZ_16K, driver_name)) { | 1661 | if (!request_mem_region(AT91_BASE_UDP, SZ_16K, driver_name)) { |
1628 | DBG("someone's using UDC memory\n"); | 1662 | DBG("someone's using UDC memory\n"); |
1629 | return -EBUSY; | 1663 | return -EBUSY; |
@@ -1649,19 +1683,26 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1649 | if (retval < 0) | 1683 | if (retval < 0) |
1650 | goto fail0; | 1684 | goto fail0; |
1651 | 1685 | ||
1652 | /* disable everything until there's a gadget driver and vbus */ | 1686 | /* don't do anything until we have both gadget driver and VBUS */ |
1653 | pullup(udc, 0); | 1687 | clk_enable(udc->iclk); |
1688 | at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); | ||
1689 | at91_udp_write(AT91_UDP_IDR, 0xffffffff); | ||
1690 | clk_disable(udc->iclk); | ||
1654 | 1691 | ||
1655 | /* request UDC and maybe VBUS irqs */ | 1692 | /* request UDC and maybe VBUS irqs */ |
1656 | if (request_irq(AT91_ID_UDP, at91_udc_irq, IRQF_DISABLED, driver_name, udc)) { | 1693 | udc->udp_irq = platform_get_irq(pdev, 0); |
1657 | DBG("request irq %d failed\n", AT91_ID_UDP); | 1694 | if (request_irq(udc->udp_irq, at91_udc_irq, |
1695 | IRQF_DISABLED, driver_name, udc)) { | ||
1696 | DBG("request irq %d failed\n", udc->udp_irq); | ||
1658 | retval = -EBUSY; | 1697 | retval = -EBUSY; |
1659 | goto fail1; | 1698 | goto fail1; |
1660 | } | 1699 | } |
1661 | if (udc->board.vbus_pin > 0) { | 1700 | if (udc->board.vbus_pin > 0) { |
1662 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, IRQF_DISABLED, driver_name, udc)) { | 1701 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, |
1663 | DBG("request vbus irq %d failed\n", udc->board.vbus_pin); | 1702 | IRQF_DISABLED, driver_name, udc)) { |
1664 | free_irq(AT91_ID_UDP, udc); | 1703 | DBG("request vbus irq %d failed\n", |
1704 | udc->board.vbus_pin); | ||
1705 | free_irq(udc->udp_irq, udc); | ||
1665 | retval = -EBUSY; | 1706 | retval = -EBUSY; |
1666 | goto fail1; | 1707 | goto fail1; |
1667 | } | 1708 | } |
@@ -1670,6 +1711,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1670 | udc->vbus = 1; | 1711 | udc->vbus = 1; |
1671 | } | 1712 | } |
1672 | dev_set_drvdata(dev, udc); | 1713 | dev_set_drvdata(dev, udc); |
1714 | device_init_wakeup(dev, 1); | ||
1673 | create_debug_file(udc); | 1715 | create_debug_file(udc); |
1674 | 1716 | ||
1675 | INFO("%s version %s\n", driver_name, DRIVER_VERSION); | 1717 | INFO("%s version %s\n", driver_name, DRIVER_VERSION); |
@@ -1678,14 +1720,14 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1678 | fail1: | 1720 | fail1: |
1679 | device_unregister(&udc->gadget.dev); | 1721 | device_unregister(&udc->gadget.dev); |
1680 | fail0: | 1722 | fail0: |
1681 | release_mem_region(AT91_VA_BASE_UDP, SZ_16K); | 1723 | release_mem_region(AT91_BASE_UDP, SZ_16K); |
1682 | DBG("%s probe failed, %d\n", driver_name, retval); | 1724 | DBG("%s probe failed, %d\n", driver_name, retval); |
1683 | return retval; | 1725 | return retval; |
1684 | } | 1726 | } |
1685 | 1727 | ||
1686 | static int __devexit at91udc_remove(struct platform_device *dev) | 1728 | static int __devexit at91udc_remove(struct platform_device *pdev) |
1687 | { | 1729 | { |
1688 | struct at91_udc *udc = platform_get_drvdata(dev); | 1730 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1689 | 1731 | ||
1690 | DBG("remove\n"); | 1732 | DBG("remove\n"); |
1691 | 1733 | ||
@@ -1694,10 +1736,11 @@ static int __devexit at91udc_remove(struct platform_device *dev) | |||
1694 | if (udc->driver != 0) | 1736 | if (udc->driver != 0) |
1695 | usb_gadget_unregister_driver(udc->driver); | 1737 | usb_gadget_unregister_driver(udc->driver); |
1696 | 1738 | ||
1739 | device_init_wakeup(&pdev->dev, 0); | ||
1697 | remove_debug_file(udc); | 1740 | remove_debug_file(udc); |
1698 | if (udc->board.vbus_pin > 0) | 1741 | if (udc->board.vbus_pin > 0) |
1699 | free_irq(udc->board.vbus_pin, udc); | 1742 | free_irq(udc->board.vbus_pin, udc); |
1700 | free_irq(AT91_ID_UDP, udc); | 1743 | free_irq(udc->udp_irq, udc); |
1701 | device_unregister(&udc->gadget.dev); | 1744 | device_unregister(&udc->gadget.dev); |
1702 | release_mem_region(AT91_BASE_UDP, SZ_16K); | 1745 | release_mem_region(AT91_BASE_UDP, SZ_16K); |
1703 | 1746 | ||
@@ -1708,31 +1751,36 @@ static int __devexit at91udc_remove(struct platform_device *dev) | |||
1708 | } | 1751 | } |
1709 | 1752 | ||
1710 | #ifdef CONFIG_PM | 1753 | #ifdef CONFIG_PM |
1711 | static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg) | 1754 | static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) |
1712 | { | 1755 | { |
1713 | struct at91_udc *udc = platform_get_drvdata(dev); | 1756 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1757 | int wake = udc->driver && device_may_wakeup(&pdev->dev); | ||
1714 | 1758 | ||
1715 | /* | 1759 | /* Unless we can act normally to the host (letting it wake us up |
1716 | * The "safe" suspend transitions are opportunistic ... e.g. when | 1760 | * whenever it has work for us) force disconnect. Wakeup requires |
1717 | * the USB link is suspended (48MHz clock autogated off), or when | 1761 | * PLLB for USB events (signaling for reset, wakeup, or incoming |
1718 | * it's disconnected (programmatically gated off, elsewhere). | 1762 | * tokens) and VBUS irqs (on systems which support them). |
1719 | * Then we can suspend, and the chip can enter slow clock mode. | ||
1720 | * | ||
1721 | * The problem case is some component (user mode?) suspending this | ||
1722 | * device while it's active, with the 48 MHz clock in use. There | ||
1723 | * are two basic approaches: (a) veto suspend levels involving slow | ||
1724 | * clock mode, (b) disconnect, so 48 MHz will no longer be in use | ||
1725 | * and we can enter slow clock mode. This uses (b) for now, since | ||
1726 | * it's simplest until AT91 PM exists and supports the other option. | ||
1727 | */ | 1763 | */ |
1728 | if (udc->vbus && !udc->suspended) | 1764 | if ((!udc->suspended && udc->addr) |
1765 | || !wake | ||
1766 | || at91_suspend_entering_slow_clock()) { | ||
1729 | pullup(udc, 0); | 1767 | pullup(udc, 0); |
1768 | disable_irq_wake(udc->udp_irq); | ||
1769 | } else | ||
1770 | enable_irq_wake(udc->udp_irq); | ||
1771 | |||
1772 | if (udc->board.vbus_pin > 0) { | ||
1773 | if (wake) | ||
1774 | enable_irq_wake(udc->board.vbus_pin); | ||
1775 | else | ||
1776 | disable_irq_wake(udc->board.vbus_pin); | ||
1777 | } | ||
1730 | return 0; | 1778 | return 0; |
1731 | } | 1779 | } |
1732 | 1780 | ||
1733 | static int at91udc_resume(struct platform_device *dev) | 1781 | static int at91udc_resume(struct platform_device *pdev) |
1734 | { | 1782 | { |
1735 | struct at91_udc *udc = platform_get_drvdata(dev); | 1783 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1736 | 1784 | ||
1737 | /* maybe reconnect to host; if so, clocks on */ | 1785 | /* maybe reconnect to host; if so, clocks on */ |
1738 | pullup(udc, 1); | 1786 | pullup(udc, 1); |
@@ -1748,7 +1796,7 @@ static struct platform_driver at91_udc = { | |||
1748 | .remove = __devexit_p(at91udc_remove), | 1796 | .remove = __devexit_p(at91udc_remove), |
1749 | .shutdown = at91udc_shutdown, | 1797 | .shutdown = at91udc_shutdown, |
1750 | .suspend = at91udc_suspend, | 1798 | .suspend = at91udc_suspend, |
1751 | .resume = at91udc_resume, | 1799 | .resume = at91udc_resume, |
1752 | .driver = { | 1800 | .driver = { |
1753 | .name = (char *) driver_name, | 1801 | .name = (char *) driver_name, |
1754 | .owner = THIS_MODULE, | 1802 | .owner = THIS_MODULE, |
@@ -1767,6 +1815,6 @@ static void __devexit udc_exit_module(void) | |||
1767 | } | 1815 | } |
1768 | module_exit(udc_exit_module); | 1816 | module_exit(udc_exit_module); |
1769 | 1817 | ||
1770 | MODULE_DESCRIPTION("AT91RM9200 udc driver"); | 1818 | MODULE_DESCRIPTION("AT91 udc driver"); |
1771 | MODULE_AUTHOR("Thomas Rathbone, David Brownell"); | 1819 | MODULE_AUTHOR("Thomas Rathbone, David Brownell"); |
1772 | MODULE_LICENSE("GPL"); | 1820 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h index 5a4799cedd19..882af42e86cc 100644 --- a/drivers/usb/gadget/at91_udc.h +++ b/drivers/usb/gadget/at91_udc.h | |||
@@ -141,6 +141,7 @@ struct at91_udc { | |||
141 | struct clk *iclk, *fclk; | 141 | struct clk *iclk, *fclk; |
142 | struct platform_device *pdev; | 142 | struct platform_device *pdev; |
143 | struct proc_dir_entry *pde; | 143 | struct proc_dir_entry *pde; |
144 | int udp_irq; | ||
144 | }; | 145 | }; |
145 | 146 | ||
146 | static inline struct at91_udc *to_udc(struct usb_gadget *g) | 147 | static inline struct at91_udc *to_udc(struct usb_gadget *g) |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 4be47195bd38..7d1c22c34957 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -609,7 +609,8 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req) | |||
609 | if (!dum->driver) | 609 | if (!dum->driver) |
610 | return -ESHUTDOWN; | 610 | return -ESHUTDOWN; |
611 | 611 | ||
612 | spin_lock_irqsave (&dum->lock, flags); | 612 | local_irq_save (flags); |
613 | spin_lock (&dum->lock); | ||
613 | list_for_each_entry (req, &ep->queue, queue) { | 614 | list_for_each_entry (req, &ep->queue, queue) { |
614 | if (&req->req == _req) { | 615 | if (&req->req == _req) { |
615 | list_del_init (&req->queue); | 616 | list_del_init (&req->queue); |
@@ -618,7 +619,7 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req) | |||
618 | break; | 619 | break; |
619 | } | 620 | } |
620 | } | 621 | } |
621 | spin_unlock_irqrestore (&dum->lock, flags); | 622 | spin_unlock (&dum->lock); |
622 | 623 | ||
623 | if (retval == 0) { | 624 | if (retval == 0) { |
624 | dev_dbg (udc_dev(dum), | 625 | dev_dbg (udc_dev(dum), |
@@ -626,6 +627,7 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req) | |||
626 | req, _ep->name, _req->length, _req->buf); | 627 | req, _ep->name, _req->length, _req->buf); |
627 | _req->complete (_ep, _req); | 628 | _req->complete (_ep, _req); |
628 | } | 629 | } |
630 | local_irq_restore (flags); | ||
629 | return retval; | 631 | return retval; |
630 | } | 632 | } |
631 | 633 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 85b0b4ad4c16..d63177a8eaea 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -892,7 +892,7 @@ MODULE_LICENSE ("GPL"); | |||
892 | #define PCI_DRIVER ehci_pci_driver | 892 | #define PCI_DRIVER ehci_pci_driver |
893 | #endif | 893 | #endif |
894 | 894 | ||
895 | #ifdef CONFIG_PPC_83xx | 895 | #ifdef CONFIG_MPC834x |
896 | #include "ehci-fsl.c" | 896 | #include "ehci-fsl.c" |
897 | #define PLATFORM_DRIVER ehci_fsl_driver | 897 | #define PLATFORM_DRIVER ehci_fsl_driver |
898 | #endif | 898 | #endif |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index cdbafb710000..85cc059705a6 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2004 SAN People (Pty) Ltd. | 4 | * Copyright (C) 2004 SAN People (Pty) Ltd. |
5 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> | 5 | * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> |
6 | * | 6 | * |
7 | * AT91RM9200 Bus Glue | 7 | * AT91 Bus Glue |
8 | * | 8 | * |
9 | * Based on fragments of 2.4 driver by Rick Bronson. | 9 | * Based on fragments of 2.4 driver by Rick Bronson. |
10 | * Based on ohci-omap.c | 10 | * Based on ohci-omap.c |
@@ -19,12 +19,13 @@ | |||
19 | #include <asm/hardware.h> | 19 | #include <asm/hardware.h> |
20 | #include <asm/arch/board.h> | 20 | #include <asm/arch/board.h> |
21 | 21 | ||
22 | #ifndef CONFIG_ARCH_AT91RM9200 | 22 | #ifndef CONFIG_ARCH_AT91 |
23 | #error "CONFIG_ARCH_AT91RM9200 must be defined." | 23 | #error "CONFIG_ARCH_AT91 must be defined." |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | /* interface and function clocks */ | 26 | /* interface and function clocks */ |
27 | static struct clk *iclk, *fclk; | 27 | static struct clk *iclk, *fclk; |
28 | static int clocked; | ||
28 | 29 | ||
29 | extern int usb_disabled(void); | 30 | extern int usb_disabled(void); |
30 | 31 | ||
@@ -35,13 +36,14 @@ static void at91_start_hc(struct platform_device *pdev) | |||
35 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 36 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
36 | struct ohci_regs __iomem *regs = hcd->regs; | 37 | struct ohci_regs __iomem *regs = hcd->regs; |
37 | 38 | ||
38 | dev_dbg(&pdev->dev, "starting AT91RM9200 OHCI USB Controller\n"); | 39 | dev_dbg(&pdev->dev, "start\n"); |
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Start the USB clocks. | 42 | * Start the USB clocks. |
42 | */ | 43 | */ |
43 | clk_enable(iclk); | 44 | clk_enable(iclk); |
44 | clk_enable(fclk); | 45 | clk_enable(fclk); |
46 | clocked = 1; | ||
45 | 47 | ||
46 | /* | 48 | /* |
47 | * The USB host controller must remain in reset. | 49 | * The USB host controller must remain in reset. |
@@ -54,7 +56,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
54 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 56 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
55 | struct ohci_regs __iomem *regs = hcd->regs; | 57 | struct ohci_regs __iomem *regs = hcd->regs; |
56 | 58 | ||
57 | dev_dbg(&pdev->dev, "stopping AT91RM9200 OHCI USB Controller\n"); | 59 | dev_dbg(&pdev->dev, "stop\n"); |
58 | 60 | ||
59 | /* | 61 | /* |
60 | * Put the USB host controller into reset. | 62 | * Put the USB host controller into reset. |
@@ -66,6 +68,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
66 | */ | 68 | */ |
67 | clk_disable(fclk); | 69 | clk_disable(fclk); |
68 | clk_disable(iclk); | 70 | clk_disable(iclk); |
71 | clocked = 0; | ||
69 | } | 72 | } |
70 | 73 | ||
71 | 74 | ||
@@ -78,14 +81,15 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
78 | 81 | ||
79 | 82 | ||
80 | /** | 83 | /** |
81 | * usb_hcd_at91_probe - initialize AT91RM9200-based HCDs | 84 | * usb_hcd_at91_probe - initialize AT91-based HCDs |
82 | * Context: !in_interrupt() | 85 | * Context: !in_interrupt() |
83 | * | 86 | * |
84 | * Allocates basic resources for this USB host controller, and | 87 | * Allocates basic resources for this USB host controller, and |
85 | * then invokes the start() method for the HCD associated with it | 88 | * then invokes the start() method for the HCD associated with it |
86 | * through the hotplug entry's driver_data. | 89 | * through the hotplug entry's driver_data. |
87 | */ | 90 | */ |
88 | int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) | 91 | static int usb_hcd_at91_probe(const struct hc_driver *driver, |
92 | struct platform_device *pdev) | ||
89 | { | 93 | { |
90 | int retval; | 94 | int retval; |
91 | struct usb_hcd *hcd = NULL; | 95 | struct usb_hcd *hcd = NULL; |
@@ -95,12 +99,13 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
95 | return -ENODEV; | 99 | return -ENODEV; |
96 | } | 100 | } |
97 | 101 | ||
98 | if ((pdev->resource[0].flags != IORESOURCE_MEM) || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | 102 | if ((pdev->resource[0].flags != IORESOURCE_MEM) |
103 | || (pdev->resource[1].flags != IORESOURCE_IRQ)) { | ||
99 | pr_debug("hcd probe: invalid resource type\n"); | 104 | pr_debug("hcd probe: invalid resource type\n"); |
100 | return -ENODEV; | 105 | return -ENODEV; |
101 | } | 106 | } |
102 | 107 | ||
103 | hcd = usb_create_hcd(driver, &pdev->dev, "at91rm9200"); | 108 | hcd = usb_create_hcd(driver, &pdev->dev, "at91"); |
104 | if (!hcd) | 109 | if (!hcd) |
105 | return -ENOMEM; | 110 | return -ENOMEM; |
106 | hcd->rsrc_start = pdev->resource[0].start; | 111 | hcd->rsrc_start = pdev->resource[0].start; |
@@ -149,21 +154,23 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
149 | /* may be called with controller, bus, and devices active */ | 154 | /* may be called with controller, bus, and devices active */ |
150 | 155 | ||
151 | /** | 156 | /** |
152 | * usb_hcd_at91_remove - shutdown processing for AT91RM9200-based HCDs | 157 | * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs |
153 | * @dev: USB Host Controller being removed | 158 | * @dev: USB Host Controller being removed |
154 | * Context: !in_interrupt() | 159 | * Context: !in_interrupt() |
155 | * | 160 | * |
156 | * Reverses the effect of usb_hcd_at91_probe(), first invoking | 161 | * Reverses the effect of usb_hcd_at91_probe(), first invoking |
157 | * the HCD's stop() method. It is always called from a thread | 162 | * the HCD's stop() method. It is always called from a thread |
158 | * context, normally "rmmod", "apmd", or something similar. | 163 | * context, "rmmod" or something similar. |
159 | * | 164 | * |
160 | */ | 165 | */ |
161 | static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pdev) | 166 | static int usb_hcd_at91_remove(struct usb_hcd *hcd, |
167 | struct platform_device *pdev) | ||
162 | { | 168 | { |
163 | usb_remove_hcd(hcd); | 169 | usb_remove_hcd(hcd); |
164 | at91_stop_hc(pdev); | 170 | at91_stop_hc(pdev); |
165 | iounmap(hcd->regs); | 171 | iounmap(hcd->regs); |
166 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 172 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
173 | disable_irq_wake(hcd->irq); | ||
167 | 174 | ||
168 | clk_put(fclk); | 175 | clk_put(fclk); |
169 | clk_put(iclk); | 176 | clk_put(iclk); |
@@ -178,19 +185,21 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde | |||
178 | static int __devinit | 185 | static int __devinit |
179 | ohci_at91_start (struct usb_hcd *hcd) | 186 | ohci_at91_start (struct usb_hcd *hcd) |
180 | { | 187 | { |
181 | // struct at91_ohci_data *board = hcd->self.controller->platform_data; | 188 | struct at91_usbh_data *board = hcd->self.controller->platform_data; |
182 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 189 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
190 | struct usb_device *root = hcd->self.root_hub; | ||
183 | int ret; | 191 | int ret; |
184 | 192 | ||
185 | if ((ret = ohci_init(ohci)) < 0) | 193 | if ((ret = ohci_init(ohci)) < 0) |
186 | return ret; | 194 | return ret; |
187 | 195 | ||
196 | root->maxchild = board->ports; | ||
197 | |||
188 | if ((ret = ohci_run(ohci)) < 0) { | 198 | if ((ret = ohci_run(ohci)) < 0) { |
189 | err("can't start %s", hcd->self.bus_name); | 199 | err("can't start %s", hcd->self.bus_name); |
190 | ohci_stop(hcd); | 200 | ohci_stop(hcd); |
191 | return ret; | 201 | return ret; |
192 | } | 202 | } |
193 | // hcd->self.root_hub->maxchild = board->ports; | ||
194 | return 0; | 203 | return 0; |
195 | } | 204 | } |
196 | 205 | ||
@@ -198,7 +207,7 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
198 | 207 | ||
199 | static const struct hc_driver ohci_at91_hc_driver = { | 208 | static const struct hc_driver ohci_at91_hc_driver = { |
200 | .description = hcd_name, | 209 | .description = hcd_name, |
201 | .product_desc = "AT91RM9200 OHCI", | 210 | .product_desc = "AT91 OHCI", |
202 | .hcd_priv_size = sizeof(struct ohci_hcd), | 211 | .hcd_priv_size = sizeof(struct ohci_hcd), |
203 | 212 | ||
204 | /* | 213 | /* |
@@ -240,33 +249,54 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
240 | 249 | ||
241 | /*-------------------------------------------------------------------------*/ | 250 | /*-------------------------------------------------------------------------*/ |
242 | 251 | ||
243 | static int ohci_hcd_at91_drv_probe(struct platform_device *dev) | 252 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
244 | { | 253 | { |
245 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, dev); | 254 | device_init_wakeup(&pdev->dev, 1); |
255 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | ||
246 | } | 256 | } |
247 | 257 | ||
248 | static int ohci_hcd_at91_drv_remove(struct platform_device *dev) | 258 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
249 | { | 259 | { |
250 | return usb_hcd_at91_remove(platform_get_drvdata(dev), dev); | 260 | device_init_wakeup(&pdev->dev, 0); |
261 | return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev); | ||
251 | } | 262 | } |
252 | 263 | ||
253 | #ifdef CONFIG_PM | 264 | #ifdef CONFIG_PM |
254 | 265 | ||
255 | /* REVISIT suspend/resume look "too" simple here */ | ||
256 | |||
257 | static int | 266 | static int |
258 | ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) | 267 | ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) |
259 | { | 268 | { |
260 | clk_disable(fclk); | 269 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
261 | clk_disable(iclk); | 270 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
271 | |||
272 | if (device_may_wakeup(&pdev->dev)) | ||
273 | enable_irq_wake(hcd->irq); | ||
274 | else | ||
275 | disable_irq_wake(hcd->irq); | ||
276 | |||
277 | /* | ||
278 | * The integrated transceivers seem unable to notice disconnect, | ||
279 | * reconnect, or wakeup without the 48 MHz clock active. so for | ||
280 | * correctness, always discard connection state (using reset). | ||
281 | * | ||
282 | * REVISIT: some boards will be able to turn VBUS off... | ||
283 | */ | ||
284 | if (at91_suspend_entering_slow_clock()) { | ||
285 | ohci_usb_reset (ohci); | ||
286 | clk_disable(fclk); | ||
287 | clk_disable(iclk); | ||
288 | clocked = 0; | ||
289 | } | ||
262 | 290 | ||
263 | return 0; | 291 | return 0; |
264 | } | 292 | } |
265 | 293 | ||
266 | static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | 294 | static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) |
267 | { | 295 | { |
268 | clk_enable(iclk); | 296 | if (!clocked) { |
269 | clk_enable(fclk); | 297 | clk_enable(iclk); |
298 | clk_enable(fclk); | ||
299 | } | ||
270 | 300 | ||
271 | return 0; | 301 | return 0; |
272 | } | 302 | } |
@@ -275,7 +305,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev) | |||
275 | #define ohci_hcd_at91_drv_resume NULL | 305 | #define ohci_hcd_at91_drv_resume NULL |
276 | #endif | 306 | #endif |
277 | 307 | ||
278 | MODULE_ALIAS("at91rm9200-ohci"); | 308 | MODULE_ALIAS("at91_ohci"); |
279 | 309 | ||
280 | static struct platform_driver ohci_hcd_at91_driver = { | 310 | static struct platform_driver ohci_hcd_at91_driver = { |
281 | .probe = ohci_hcd_at91_drv_probe, | 311 | .probe = ohci_hcd_at91_drv_probe, |
@@ -283,7 +313,7 @@ static struct platform_driver ohci_hcd_at91_driver = { | |||
283 | .suspend = ohci_hcd_at91_drv_suspend, | 313 | .suspend = ohci_hcd_at91_drv_suspend, |
284 | .resume = ohci_hcd_at91_drv_resume, | 314 | .resume = ohci_hcd_at91_drv_resume, |
285 | .driver = { | 315 | .driver = { |
286 | .name = "at91rm9200-ohci", | 316 | .name = "at91_ohci", |
287 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
288 | }, | 318 | }, |
289 | }; | 319 | }; |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index afef5ac35b4a..94d8cf4b36c1 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -913,7 +913,7 @@ MODULE_LICENSE ("GPL"); | |||
913 | #include "ohci-ppc-soc.c" | 913 | #include "ohci-ppc-soc.c" |
914 | #endif | 914 | #endif |
915 | 915 | ||
916 | #ifdef CONFIG_ARCH_AT91RM9200 | 916 | #if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261) |
917 | #include "ohci-at91.c" | 917 | #include "ohci-at91.c" |
918 | #endif | 918 | #endif |
919 | 919 | ||
@@ -927,6 +927,7 @@ MODULE_LICENSE ("GPL"); | |||
927 | || defined (CONFIG_SOC_AU1X00) \ | 927 | || defined (CONFIG_SOC_AU1X00) \ |
928 | || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ | 928 | || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ |
929 | || defined (CONFIG_ARCH_AT91RM9200) \ | 929 | || defined (CONFIG_ARCH_AT91RM9200) \ |
930 | || defined (CONFIG_ARCH_AT91SAM9261) \ | ||
930 | ) | 931 | ) |
931 | #error "missing bus glue for ohci-hcd" | 932 | #error "missing bus glue for ohci-hcd" |
932 | #endif | 933 | #endif |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index c9d72ac0a1d7..66c3f61bc9d1 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -943,7 +943,9 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) | |||
943 | /* We received a short packet */ | 943 | /* We received a short packet */ |
944 | if (urb->transfer_flags & URB_SHORT_NOT_OK) | 944 | if (urb->transfer_flags & URB_SHORT_NOT_OK) |
945 | ret = -EREMOTEIO; | 945 | ret = -EREMOTEIO; |
946 | else if (ctrlstat & TD_CTRL_SPD) | 946 | |
947 | /* Fixup needed only if this isn't the URB's last TD */ | ||
948 | else if (&td->list != urbp->td_list.prev) | ||
947 | ret = 1; | 949 | ret = 1; |
948 | } | 950 | } |
949 | 951 | ||
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index 05d2d6012eb2..df198cf76f52 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -152,9 +152,8 @@ static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; | |||
152 | * events. The hardware generates 5 events for the first keypress | 152 | * events. The hardware generates 5 events for the first keypress |
153 | * and we have to take this into account for an accurate repeat | 153 | * and we have to take this into account for an accurate repeat |
154 | * behaviour. | 154 | * behaviour. |
155 | * (HZ / 20) == 50 ms and works well for me. | ||
156 | */ | 155 | */ |
157 | #define FILTER_TIME (HZ / 20) | 156 | #define FILTER_TIME 60 /* msec */ |
158 | 157 | ||
159 | struct ati_remote { | 158 | struct ati_remote { |
160 | struct input_dev *idev; | 159 | struct input_dev *idev; |
@@ -467,7 +466,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) | |||
467 | /* Filter duplicate events which happen "too close" together. */ | 466 | /* Filter duplicate events which happen "too close" together. */ |
468 | if ((ati_remote->old_data[0] == data[1]) && | 467 | if ((ati_remote->old_data[0] == data[1]) && |
469 | (ati_remote->old_data[1] == data[2]) && | 468 | (ati_remote->old_data[1] == data[2]) && |
470 | time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) { | 469 | time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) { |
471 | ati_remote->repeat_count++; | 470 | ati_remote->repeat_count++; |
472 | } else { | 471 | } else { |
473 | ati_remote->repeat_count = 0; | 472 | ati_remote->repeat_count = 0; |
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index e091d327bd9e..a4062a6adbb8 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
@@ -12,8 +12,13 @@ | |||
12 | * the single I/O ports of the device. | 12 | * the single I/O ports of the device. |
13 | * | 13 | * |
14 | * Supported vendors: AK Modul-Bus Computer GmbH | 14 | * Supported vendors: AK Modul-Bus Computer GmbH |
15 | * Supported devices: CY7C63001A-PC (to be continued...) | 15 | * (Firmware "Port-Chip") |
16 | * Supported functions: Read/Write Ports (to be continued...) | 16 | * |
17 | * Supported devices: CY7C63001A-PC | ||
18 | * CY7C63001C-PXC | ||
19 | * CY7C63001C-SXC | ||
20 | * | ||
21 | * Supported functions: Read/Write Ports | ||
17 | * | 22 | * |
18 | * | 23 | * |
19 | * This program is free software; you can redistribute it and/or | 24 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index e5e6e4f3ef87..bd09232ce13c 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -175,6 +175,8 @@ static inline struct sk_buff *pull_skb(rtl8150_t *); | |||
175 | static void rtl8150_disconnect(struct usb_interface *intf); | 175 | static void rtl8150_disconnect(struct usb_interface *intf); |
176 | static int rtl8150_probe(struct usb_interface *intf, | 176 | static int rtl8150_probe(struct usb_interface *intf, |
177 | const struct usb_device_id *id); | 177 | const struct usb_device_id *id); |
178 | static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message); | ||
179 | static int rtl8150_resume(struct usb_interface *intf); | ||
178 | 180 | ||
179 | static const char driver_name [] = "rtl8150"; | 181 | static const char driver_name [] = "rtl8150"; |
180 | 182 | ||
@@ -183,6 +185,8 @@ static struct usb_driver rtl8150_driver = { | |||
183 | .probe = rtl8150_probe, | 185 | .probe = rtl8150_probe, |
184 | .disconnect = rtl8150_disconnect, | 186 | .disconnect = rtl8150_disconnect, |
185 | .id_table = rtl8150_table, | 187 | .id_table = rtl8150_table, |
188 | .suspend = rtl8150_suspend, | ||
189 | .resume = rtl8150_resume | ||
186 | }; | 190 | }; |
187 | 191 | ||
188 | /* | 192 | /* |
@@ -238,9 +242,11 @@ static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size) | |||
238 | usb_fill_control_urb(dev->ctrl_urb, dev->udev, | 242 | usb_fill_control_urb(dev->ctrl_urb, dev->udev, |
239 | usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, | 243 | usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, |
240 | &dev->rx_creg, size, ctrl_callback, dev); | 244 | &dev->rx_creg, size, ctrl_callback, dev); |
241 | if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) | 245 | if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) { |
246 | if (ret == -ENODEV) | ||
247 | netif_device_detach(dev->netdev); | ||
242 | err("control request submission failed: %d", ret); | 248 | err("control request submission failed: %d", ret); |
243 | else | 249 | } else |
244 | set_bit(RX_REG_SET, &dev->flags); | 250 | set_bit(RX_REG_SET, &dev->flags); |
245 | 251 | ||
246 | return ret; | 252 | return ret; |
@@ -416,6 +422,7 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
416 | struct sk_buff *skb; | 422 | struct sk_buff *skb; |
417 | struct net_device *netdev; | 423 | struct net_device *netdev; |
418 | u16 rx_stat; | 424 | u16 rx_stat; |
425 | int status; | ||
419 | 426 | ||
420 | dev = urb->context; | 427 | dev = urb->context; |
421 | if (!dev) | 428 | if (!dev) |
@@ -465,7 +472,10 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
465 | goon: | 472 | goon: |
466 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | 473 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), |
467 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 474 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
468 | if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) { | 475 | status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC); |
476 | if (status == -ENODEV) | ||
477 | netif_device_detach(dev->netdev); | ||
478 | else if (status) { | ||
469 | set_bit(RX_URB_FAIL, &dev->flags); | 479 | set_bit(RX_URB_FAIL, &dev->flags); |
470 | goto resched; | 480 | goto resched; |
471 | } else { | 481 | } else { |
@@ -481,6 +491,7 @@ static void rx_fixup(unsigned long data) | |||
481 | { | 491 | { |
482 | rtl8150_t *dev; | 492 | rtl8150_t *dev; |
483 | struct sk_buff *skb; | 493 | struct sk_buff *skb; |
494 | int status; | ||
484 | 495 | ||
485 | dev = (rtl8150_t *)data; | 496 | dev = (rtl8150_t *)data; |
486 | 497 | ||
@@ -499,10 +510,13 @@ static void rx_fixup(unsigned long data) | |||
499 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | 510 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), |
500 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 511 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
501 | try_again: | 512 | try_again: |
502 | if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) { | 513 | status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC); |
514 | if (status == -ENODEV) { | ||
515 | netif_device_detach(dev->netdev); | ||
516 | } else if (status) { | ||
503 | set_bit(RX_URB_FAIL, &dev->flags); | 517 | set_bit(RX_URB_FAIL, &dev->flags); |
504 | goto tlsched; | 518 | goto tlsched; |
505 | } else { | 519 | } else { |
506 | clear_bit(RX_URB_FAIL, &dev->flags); | 520 | clear_bit(RX_URB_FAIL, &dev->flags); |
507 | } | 521 | } |
508 | 522 | ||
@@ -574,12 +588,43 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs) | |||
574 | 588 | ||
575 | resubmit: | 589 | resubmit: |
576 | status = usb_submit_urb (urb, SLAB_ATOMIC); | 590 | status = usb_submit_urb (urb, SLAB_ATOMIC); |
577 | if (status) | 591 | if (status == -ENODEV) |
592 | netif_device_detach(dev->netdev); | ||
593 | else if (status) | ||
578 | err ("can't resubmit intr, %s-%s/input0, status %d", | 594 | err ("can't resubmit intr, %s-%s/input0, status %d", |
579 | dev->udev->bus->bus_name, | 595 | dev->udev->bus->bus_name, |
580 | dev->udev->devpath, status); | 596 | dev->udev->devpath, status); |
581 | } | 597 | } |
582 | 598 | ||
599 | static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message) | ||
600 | { | ||
601 | rtl8150_t *dev = usb_get_intfdata(intf); | ||
602 | |||
603 | netif_device_detach(dev->netdev); | ||
604 | |||
605 | if (netif_running(dev->netdev)) { | ||
606 | usb_kill_urb(dev->rx_urb); | ||
607 | usb_kill_urb(dev->intr_urb); | ||
608 | } | ||
609 | return 0; | ||
610 | } | ||
611 | |||
612 | static int rtl8150_resume(struct usb_interface *intf) | ||
613 | { | ||
614 | rtl8150_t *dev = usb_get_intfdata(intf); | ||
615 | |||
616 | netif_device_attach(dev->netdev); | ||
617 | if (netif_running(dev->netdev)) { | ||
618 | dev->rx_urb->status = 0; | ||
619 | dev->rx_urb->actual_length = 0; | ||
620 | read_bulk_callback(dev->rx_urb, NULL); | ||
621 | |||
622 | dev->intr_urb->status = 0; | ||
623 | dev->intr_urb->actual_length = 0; | ||
624 | intr_callback(dev->intr_urb, NULL); | ||
625 | } | ||
626 | return 0; | ||
627 | } | ||
583 | 628 | ||
584 | /* | 629 | /* |
585 | ** | 630 | ** |
@@ -690,9 +735,14 @@ static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
690 | usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), | 735 | usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), |
691 | skb->data, count, write_bulk_callback, dev); | 736 | skb->data, count, write_bulk_callback, dev); |
692 | if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) { | 737 | if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) { |
693 | warn("failed tx_urb %d\n", res); | 738 | /* Can we get/handle EPIPE here? */ |
694 | dev->stats.tx_errors++; | 739 | if (res == -ENODEV) |
695 | netif_start_queue(netdev); | 740 | netif_device_detach(dev->netdev); |
741 | else { | ||
742 | warn("failed tx_urb %d\n", res); | ||
743 | dev->stats.tx_errors++; | ||
744 | netif_start_queue(netdev); | ||
745 | } | ||
696 | } else { | 746 | } else { |
697 | dev->stats.tx_packets++; | 747 | dev->stats.tx_packets++; |
698 | dev->stats.tx_bytes += skb->len; | 748 | dev->stats.tx_bytes += skb->len; |
@@ -729,16 +779,25 @@ static int rtl8150_open(struct net_device *netdev) | |||
729 | 779 | ||
730 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | 780 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), |
731 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 781 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
732 | if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) | 782 | if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) { |
783 | if (res == -ENODEV) | ||
784 | netif_device_detach(dev->netdev); | ||
733 | warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); | 785 | warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); |
786 | return res; | ||
787 | } | ||
734 | usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3), | 788 | usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3), |
735 | dev->intr_buff, INTBUFSIZE, intr_callback, | 789 | dev->intr_buff, INTBUFSIZE, intr_callback, |
736 | dev, dev->intr_interval); | 790 | dev, dev->intr_interval); |
737 | if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) | 791 | if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) { |
792 | if (res == -ENODEV) | ||
793 | netif_device_detach(dev->netdev); | ||
738 | warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); | 794 | warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); |
739 | netif_start_queue(netdev); | 795 | usb_kill_urb(dev->rx_urb); |
796 | return res; | ||
797 | } | ||
740 | enable_net_traffic(dev); | 798 | enable_net_traffic(dev); |
741 | set_carrier(netdev); | 799 | set_carrier(netdev); |
800 | netif_start_queue(netdev); | ||
742 | 801 | ||
743 | return res; | 802 | return res; |
744 | } | 803 | } |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index ac33bd47cfce..f5b9438c94f0 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -62,15 +62,6 @@ config USB_SERIAL_AIRPRIME | |||
62 | To compile this driver as a module, choose M here: the | 62 | To compile this driver as a module, choose M here: the |
63 | module will be called airprime. | 63 | module will be called airprime. |
64 | 64 | ||
65 | config USB_SERIAL_ANYDATA | ||
66 | tristate "USB AnyData CDMA Wireless Driver" | ||
67 | depends on USB_SERIAL | ||
68 | help | ||
69 | Say Y here if you want to use a AnyData CDMA device. | ||
70 | |||
71 | To compile this driver as a module, choose M here: the | ||
72 | module will be called anydata. | ||
73 | |||
74 | config USB_SERIAL_ARK3116 | 65 | config USB_SERIAL_ARK3116 |
75 | tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" | 66 | tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" |
76 | depends on USB_SERIAL && EXPERIMENTAL | 67 | depends on USB_SERIAL && EXPERIMENTAL |
@@ -502,15 +493,18 @@ config USB_SERIAL_XIRCOM | |||
502 | module will be called keyspan_pda. | 493 | module will be called keyspan_pda. |
503 | 494 | ||
504 | config USB_SERIAL_OPTION | 495 | config USB_SERIAL_OPTION |
505 | tristate "USB driver for GSM modems" | 496 | tristate "USB driver for GSM and CDMA modems" |
506 | depends on USB_SERIAL | 497 | depends on USB_SERIAL |
507 | help | 498 | help |
508 | Say Y here if you have an "Option" GSM PCMCIA card | 499 | Say Y here if you have a GSM or CDMA modem that's connected to USB. |
509 | (or an OEM version: branded Huawei, Audiovox, or Novatel). | 500 | |
501 | This driver also supports several PCMCIA cards which have a | ||
502 | built-in OHCI-USB adapter and an internally-connected GSM modem. | ||
503 | The USB bus on these cards is not accessible externally. | ||
510 | 504 | ||
511 | These cards feature a built-in OHCI-USB adapter and an | 505 | Supported devices include (some of?) those made by: |
512 | internally-connected GSM modem. The USB bus is not | 506 | Option, Huawei, Audiovox, Sierra Wireless, Novatel Wireless, or |
513 | accessible externally. | 507 | Anydata. |
514 | 508 | ||
515 | To compile this driver as a module, choose M here: the | 509 | To compile this driver as a module, choose M here: the |
516 | module will be called option. | 510 | module will be called option. |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 35d4acc7f1d3..8efed2ce1ba3 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -12,7 +12,6 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o | |||
12 | usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) | 12 | usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) |
13 | 13 | ||
14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o | 14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o |
15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o | ||
16 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o | 15 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o |
17 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o | 16 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o |
18 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o | 17 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o |
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c deleted file mode 100644 index 01843ef8c11e..000000000000 --- a/drivers/usb/serial/anydata.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* | ||
2 | * AnyData CDMA Serial USB driver | ||
3 | * | ||
4 | * Copyright (C) 2005 Greg Kroah-Hartman <gregkh@suse.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/tty.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/usb.h> | ||
16 | #include <linux/usb/serial.h> | ||
17 | |||
18 | static struct usb_device_id id_table [] = { | ||
19 | { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */ | ||
20 | { }, | ||
21 | }; | ||
22 | MODULE_DEVICE_TABLE(usb, id_table); | ||
23 | |||
24 | /* if overridden by the user, then use their value for the size of the | ||
25 | * read and write urbs */ | ||
26 | static int buffer_size; | ||
27 | static int debug; | ||
28 | |||
29 | static struct usb_driver anydata_driver = { | ||
30 | .name = "anydata", | ||
31 | .probe = usb_serial_probe, | ||
32 | .disconnect = usb_serial_disconnect, | ||
33 | .id_table = id_table, | ||
34 | .no_dynamic_id = 1, | ||
35 | }; | ||
36 | |||
37 | static int anydata_open(struct usb_serial_port *port, struct file *filp) | ||
38 | { | ||
39 | char *buffer; | ||
40 | int result = 0; | ||
41 | |||
42 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
43 | |||
44 | if (buffer_size) { | ||
45 | /* override the default buffer sizes */ | ||
46 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
47 | if (!buffer) { | ||
48 | dev_err(&port->dev, "%s - out of memory.\n", | ||
49 | __FUNCTION__); | ||
50 | return -ENOMEM; | ||
51 | } | ||
52 | kfree (port->read_urb->transfer_buffer); | ||
53 | port->read_urb->transfer_buffer = buffer; | ||
54 | port->read_urb->transfer_buffer_length = buffer_size; | ||
55 | |||
56 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
57 | if (!buffer) { | ||
58 | dev_err(&port->dev, "%s - out of memory.\n", | ||
59 | __FUNCTION__); | ||
60 | return -ENOMEM; | ||
61 | } | ||
62 | kfree (port->write_urb->transfer_buffer); | ||
63 | port->write_urb->transfer_buffer = buffer; | ||
64 | port->write_urb->transfer_buffer_length = buffer_size; | ||
65 | port->bulk_out_size = buffer_size; | ||
66 | } | ||
67 | |||
68 | /* Start reading from the device */ | ||
69 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, | ||
70 | usb_rcvbulkpipe(port->serial->dev, | ||
71 | port->bulk_in_endpointAddress), | ||
72 | port->read_urb->transfer_buffer, | ||
73 | port->read_urb->transfer_buffer_length, | ||
74 | usb_serial_generic_read_bulk_callback, port); | ||
75 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
76 | if (result) | ||
77 | dev_err(&port->dev, | ||
78 | "%s - failed submitting read urb, error %d\n", | ||
79 | __FUNCTION__, result); | ||
80 | |||
81 | return result; | ||
82 | } | ||
83 | |||
84 | static struct usb_serial_driver anydata_device = { | ||
85 | .driver = { | ||
86 | .owner = THIS_MODULE, | ||
87 | .name = "anydata", | ||
88 | }, | ||
89 | .id_table = id_table, | ||
90 | .num_interrupt_in = NUM_DONT_CARE, | ||
91 | .num_bulk_in = NUM_DONT_CARE, | ||
92 | .num_bulk_out = NUM_DONT_CARE, | ||
93 | .num_ports = 1, | ||
94 | .open = anydata_open, | ||
95 | }; | ||
96 | |||
97 | static int __init anydata_init(void) | ||
98 | { | ||
99 | int retval; | ||
100 | |||
101 | retval = usb_serial_register(&anydata_device); | ||
102 | if (retval) | ||
103 | return retval; | ||
104 | retval = usb_register(&anydata_driver); | ||
105 | if (retval) | ||
106 | usb_serial_deregister(&anydata_device); | ||
107 | return retval; | ||
108 | } | ||
109 | |||
110 | static void __exit anydata_exit(void) | ||
111 | { | ||
112 | usb_deregister(&anydata_driver); | ||
113 | usb_serial_deregister(&anydata_device); | ||
114 | } | ||
115 | |||
116 | module_init(anydata_init); | ||
117 | module_exit(anydata_exit); | ||
118 | MODULE_LICENSE("GPL"); | ||
119 | |||
120 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
121 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
122 | module_param(buffer_size, int, 0); | ||
123 | MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers"); | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index b458aedc5fb6..a20da8528a5f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -337,6 +337,7 @@ static struct usb_device_id id_table_combined [] = { | |||
337 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 337 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
338 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 338 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
339 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 339 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
340 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | ||
340 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, | 341 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, |
341 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, | 342 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, |
342 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, | 343 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 04ef90fcb876..9f7343a45424 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -182,6 +182,10 @@ | |||
182 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ | 182 | /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ |
183 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ | 183 | #define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ |
184 | 184 | ||
185 | /* TNC-X USB-to-packet-radio adapter, versions prior to 3.0 (DLP module) */ | ||
186 | |||
187 | #define FTDI_TNC_X_PID 0xEBE0 | ||
188 | |||
185 | /* | 189 | /* |
186 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). | 190 | * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). |
187 | * All of these devices use FTDI's vendor ID (0x0403). | 191 | * All of these devices use FTDI's vendor ID (0x0403). |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 59c5d999009a..7e1bd5d6dfa0 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -250,6 +250,7 @@ static struct usb_device_id ipaq_id_table [] = { | |||
250 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ | 250 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ |
251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ |
252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ | 252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ |
253 | { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */ | ||
253 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ | 254 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ |
254 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ | 255 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ |
255 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ | 256 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f0530c1d7b7a..c856e6f40e22 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -9,40 +9,14 @@ | |||
9 | 9 | ||
10 | Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 10 | Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
11 | 11 | ||
12 | History: | 12 | History: see the git log. |
13 | |||
14 | 2005-05-19 v0.1 Initial version, based on incomplete docs | ||
15 | and analysis of misbehavior with the standard driver | ||
16 | 2005-05-20 v0.2 Extended the input buffer to avoid losing | ||
17 | random 64-byte chunks of data | ||
18 | 2005-05-21 v0.3 implemented chars_in_buffer() | ||
19 | turned on low_latency | ||
20 | simplified the code somewhat | ||
21 | 2005-05-24 v0.4 option_write() sometimes deadlocked under heavy load | ||
22 | removed some dead code | ||
23 | added sponsor notice | ||
24 | coding style clean-up | ||
25 | 2005-06-20 v0.4.1 add missing braces :-/ | ||
26 | killed end-of-line whitespace | ||
27 | 2005-07-15 v0.4.2 rename WLAN product to FUSION, add FUSION2 | ||
28 | 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard | ||
29 | 2005-09-20 v0.4.4 increased recv buffer size: the card sometimes | ||
30 | wants to send >2000 bytes. | ||
31 | 2006-04-10 v0.5 fixed two array overrun errors :-/ | ||
32 | 2006-04-21 v0.5.1 added support for Sierra Wireless MC8755 | ||
33 | 2006-05-15 v0.6 re-enable multi-port support | ||
34 | 2006-06-01 v0.6.1 add COBRA | ||
35 | 2006-06-01 v0.6.2 add backwards-compatibility stuff | ||
36 | 2006-06-01 v0.6.3 add Novatel Wireless | ||
37 | 2006-06-01 v0.7 Option => GSM | ||
38 | 2006-06-01 v0.7.1 add COBRA2 | ||
39 | 13 | ||
40 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> | 14 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> |
41 | 15 | ||
42 | This driver exists because the "normal" serial driver doesn't work too well | 16 | This driver exists because the "normal" serial driver doesn't work too well |
43 | with GSM modems. Issues: | 17 | with GSM modems. Issues: |
44 | - data loss -- one single Receive URB is not nearly enough | 18 | - data loss -- one single Receive URB is not nearly enough |
45 | - nonstandard flow (Option devices) and multiplex (Sierra) control | 19 | - nonstandard flow (Option devices) control |
46 | - controlling the baud rate doesn't make sense | 20 | - controlling the baud rate doesn't make sense |
47 | 21 | ||
48 | This driver is named "option" because the most common device it's | 22 | This driver is named "option" because the most common device it's |
@@ -96,8 +70,8 @@ static int option_send_setup(struct usb_serial_port *port); | |||
96 | #define OPTION_VENDOR_ID 0x0AF0 | 70 | #define OPTION_VENDOR_ID 0x0AF0 |
97 | #define HUAWEI_VENDOR_ID 0x12D1 | 71 | #define HUAWEI_VENDOR_ID 0x12D1 |
98 | #define AUDIOVOX_VENDOR_ID 0x0F3D | 72 | #define AUDIOVOX_VENDOR_ID 0x0F3D |
99 | #define SIERRAWIRELESS_VENDOR_ID 0x1199 | ||
100 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 | 73 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 |
74 | #define ANYDATA_VENDOR_ID 0x16d5 | ||
101 | 75 | ||
102 | #define OPTION_PRODUCT_OLD 0x5000 | 76 | #define OPTION_PRODUCT_OLD 0x5000 |
103 | #define OPTION_PRODUCT_FUSION 0x6000 | 77 | #define OPTION_PRODUCT_FUSION 0x6000 |
@@ -106,8 +80,8 @@ static int option_send_setup(struct usb_serial_port *port); | |||
106 | #define OPTION_PRODUCT_COBRA2 0x6600 | 80 | #define OPTION_PRODUCT_COBRA2 0x6600 |
107 | #define HUAWEI_PRODUCT_E600 0x1001 | 81 | #define HUAWEI_PRODUCT_E600 0x1001 |
108 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 | 82 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 |
109 | #define SIERRAWIRELESS_PRODUCT_MC8755 0x6802 | ||
110 | #define NOVATELWIRELESS_PRODUCT_U740 0x1400 | 83 | #define NOVATELWIRELESS_PRODUCT_U740 0x1400 |
84 | #define ANYDATA_PRODUCT_ID 0x6501 | ||
111 | 85 | ||
112 | static struct usb_device_id option_ids[] = { | 86 | static struct usb_device_id option_ids[] = { |
113 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, | 87 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, |
@@ -117,8 +91,8 @@ static struct usb_device_id option_ids[] = { | |||
117 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, | 91 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, |
118 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 92 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
119 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, | 93 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
120 | { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) }, | ||
121 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, | 94 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, |
95 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, | ||
122 | { } /* Terminating entry */ | 96 | { } /* Terminating entry */ |
123 | }; | 97 | }; |
124 | 98 | ||
@@ -131,10 +105,7 @@ static struct usb_device_id option_ids1[] = { | |||
131 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 105 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
132 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, | 106 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
133 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, | 107 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, |
134 | { } /* Terminating entry */ | 108 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, |
135 | }; | ||
136 | static struct usb_device_id option_ids3[] = { | ||
137 | { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) }, | ||
138 | { } /* Terminating entry */ | 109 | { } /* Terminating entry */ |
139 | }; | 110 | }; |
140 | 111 | ||
@@ -151,37 +122,11 @@ static struct usb_driver option_driver = { | |||
151 | /* The card has three separate interfaces, which the serial driver | 122 | /* The card has three separate interfaces, which the serial driver |
152 | * recognizes separately, thus num_port=1. | 123 | * recognizes separately, thus num_port=1. |
153 | */ | 124 | */ |
154 | static struct usb_serial_driver option_3port_device = { | ||
155 | .driver = { | ||
156 | .owner = THIS_MODULE, | ||
157 | .name = "option", | ||
158 | }, | ||
159 | .description = "GSM modem (3-port)", | ||
160 | .id_table = option_ids3, | ||
161 | .num_interrupt_in = NUM_DONT_CARE, | ||
162 | .num_bulk_in = NUM_DONT_CARE, | ||
163 | .num_bulk_out = NUM_DONT_CARE, | ||
164 | .num_ports = 3, | ||
165 | .open = option_open, | ||
166 | .close = option_close, | ||
167 | .write = option_write, | ||
168 | .write_room = option_write_room, | ||
169 | .chars_in_buffer = option_chars_in_buffer, | ||
170 | .throttle = option_rx_throttle, | ||
171 | .unthrottle = option_rx_unthrottle, | ||
172 | .set_termios = option_set_termios, | ||
173 | .break_ctl = option_break_ctl, | ||
174 | .tiocmget = option_tiocmget, | ||
175 | .tiocmset = option_tiocmset, | ||
176 | .attach = option_startup, | ||
177 | .shutdown = option_shutdown, | ||
178 | .read_int_callback = option_instat_callback, | ||
179 | }; | ||
180 | 125 | ||
181 | static struct usb_serial_driver option_1port_device = { | 126 | static struct usb_serial_driver option_1port_device = { |
182 | .driver = { | 127 | .driver = { |
183 | .owner = THIS_MODULE, | 128 | .owner = THIS_MODULE, |
184 | .name = "option", | 129 | .name = "option1", |
185 | }, | 130 | }, |
186 | .description = "GSM modem (1-port)", | 131 | .description = "GSM modem (1-port)", |
187 | .id_table = option_ids1, | 132 | .id_table = option_ids1, |
@@ -245,9 +190,6 @@ static int __init option_init(void) | |||
245 | retval = usb_serial_register(&option_1port_device); | 190 | retval = usb_serial_register(&option_1port_device); |
246 | if (retval) | 191 | if (retval) |
247 | goto failed_1port_device_register; | 192 | goto failed_1port_device_register; |
248 | retval = usb_serial_register(&option_3port_device); | ||
249 | if (retval) | ||
250 | goto failed_3port_device_register; | ||
251 | retval = usb_register(&option_driver); | 193 | retval = usb_register(&option_driver); |
252 | if (retval) | 194 | if (retval) |
253 | goto failed_driver_register; | 195 | goto failed_driver_register; |
@@ -257,8 +199,6 @@ static int __init option_init(void) | |||
257 | return 0; | 199 | return 0; |
258 | 200 | ||
259 | failed_driver_register: | 201 | failed_driver_register: |
260 | usb_serial_deregister (&option_3port_device); | ||
261 | failed_3port_device_register: | ||
262 | usb_serial_deregister (&option_1port_device); | 202 | usb_serial_deregister (&option_1port_device); |
263 | failed_1port_device_register: | 203 | failed_1port_device_register: |
264 | return retval; | 204 | return retval; |
@@ -267,7 +207,6 @@ failed_1port_device_register: | |||
267 | static void __exit option_exit(void) | 207 | static void __exit option_exit(void) |
268 | { | 208 | { |
269 | usb_deregister (&option_driver); | 209 | usb_deregister (&option_driver); |
270 | usb_serial_deregister (&option_3port_device); | ||
271 | usb_serial_deregister (&option_1port_device); | 210 | usb_serial_deregister (&option_1port_device); |
272 | } | 211 | } |
273 | 212 | ||
@@ -656,7 +595,6 @@ static void option_setup_urbs(struct usb_serial *serial) | |||
656 | 595 | ||
657 | dbg("%s", __FUNCTION__); | 596 | dbg("%s", __FUNCTION__); |
658 | 597 | ||
659 | |||
660 | for (i = 0; i < serial->num_ports; i++) { | 598 | for (i = 0; i < serial->num_ports; i++) { |
661 | port = serial->port[i]; | 599 | port = serial->port[i]; |
662 | portdata = usb_get_serial_port_data(port); | 600 | portdata = usb_get_serial_port_data(port); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 259db31b65c1..efbbc0adb89a 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -81,6 +81,7 @@ static struct usb_device_id id_table [] = { | |||
81 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, | 81 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, |
82 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, | 82 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, |
83 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, | 83 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, |
84 | { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) }, | ||
84 | { } /* Terminating entry */ | 85 | { } /* Terminating entry */ |
85 | }; | 86 | }; |
86 | 87 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index d9c1e6e0b4b3..a692ac66ca6c 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -89,3 +89,7 @@ | |||
89 | /* DATAPILOT Universal-2 Phone Cable */ | 89 | /* DATAPILOT Universal-2 Phone Cable */ |
90 | #define DATAPILOT_U2_VENDOR_ID 0x0731 | 90 | #define DATAPILOT_U2_VENDOR_ID 0x0731 |
91 | #define DATAPILOT_U2_PRODUCT_ID 0x2003 | 91 | #define DATAPILOT_U2_PRODUCT_ID 0x2003 |
92 | |||
93 | /* Belkin "F5U257" Serial Adapter */ | ||
94 | #define BELKIN_VENDOR_ID 0x050d | ||
95 | #define BELKIN_PRODUCT_ID 0x0257 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index a5ca449f6e64..2793f9a912b4 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -145,6 +145,13 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100, | |||
145 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 145 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
146 | US_FL_IGNORE_RESIDUE ), | 146 | US_FL_IGNORE_RESIDUE ), |
147 | 147 | ||
148 | /* Reported by Mario Rettig <mariorettig@web.de> */ | ||
149 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, | ||
150 | "Nokia", | ||
151 | "Nokia 3250", | ||
152 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
153 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | ||
154 | |||
148 | /* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and | 155 | /* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and |
149 | * Einar Th. Einarsson <einarthered@gmail.com> */ | 156 | * Einar Th. Einarsson <einarthered@gmail.com> */ |
150 | UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, | 157 | UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, |
@@ -627,18 +634,6 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, | |||
627 | "Digital Camera EX-20 DSC", | 634 | "Digital Camera EX-20 DSC", |
628 | US_SC_8070, US_PR_DEVICE, NULL, 0 ), | 635 | US_SC_8070, US_PR_DEVICE, NULL, 0 ), |
629 | 636 | ||
630 | /* The entry was here before I took over, and had US_SC_RBC. It turns | ||
631 | * out that isn't needed. Additionally, Torsten Eriksson | ||
632 | * <Torsten.Eriksson@bergianska.se> is able to use his device fine | ||
633 | * without this entry at all - but I don't suspect that will be true | ||
634 | * for all users (the protocol is likely needed), so is staying at | ||
635 | * this time. - Phil Dibowitz <phil@ipom.com> | ||
636 | */ | ||
637 | UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200, | ||
638 | "LaCie", | ||
639 | "USB Hard Disk", | ||
640 | US_SC_DEVICE, US_PR_CB, NULL, 0 ), | ||
641 | |||
642 | /* Submitted by Joel Bourquard <numlock@freesurf.ch> | 637 | /* Submitted by Joel Bourquard <numlock@freesurf.ch> |
643 | * Some versions of this device need the SubClass and Protocol overrides | 638 | * Some versions of this device need the SubClass and Protocol overrides |
644 | * while others don't. | 639 | * while others don't. |
@@ -1106,7 +1101,15 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff, | |||
1106 | "Optio S/S4", | 1101 | "Optio S/S4", |
1107 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1102 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1108 | US_FL_FIX_INQUIRY ), | 1103 | US_FL_FIX_INQUIRY ), |
1109 | 1104 | ||
1105 | /* This is a virtual windows driver CD, which the zd1211rw driver automatically | ||
1106 | * converts into a WLAN device. */ | ||
1107 | UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101, | ||
1108 | "ZyXEL", | ||
1109 | "G-220F USB-WLAN Install", | ||
1110 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1111 | US_FL_IGNORE_DEVICE ), | ||
1112 | |||
1110 | #ifdef CONFIG_USB_STORAGE_ISD200 | 1113 | #ifdef CONFIG_USB_STORAGE_ISD200 |
1111 | UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, | 1114 | UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, |
1112 | "ATI", | 1115 | "ATI", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 5ee19be52f65..8d7bdcb5924d 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -483,7 +483,7 @@ static struct us_unusual_dev *find_unusual(const struct usb_device_id *id) | |||
483 | } | 483 | } |
484 | 484 | ||
485 | /* Get the unusual_devs entries and the string descriptors */ | 485 | /* Get the unusual_devs entries and the string descriptors */ |
486 | static void get_device_info(struct us_data *us, const struct usb_device_id *id) | 486 | static int get_device_info(struct us_data *us, const struct usb_device_id *id) |
487 | { | 487 | { |
488 | struct usb_device *dev = us->pusb_dev; | 488 | struct usb_device *dev = us->pusb_dev; |
489 | struct usb_interface_descriptor *idesc = | 489 | struct usb_interface_descriptor *idesc = |
@@ -500,6 +500,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
500 | unusual_dev->useTransport; | 500 | unusual_dev->useTransport; |
501 | us->flags = USB_US_ORIG_FLAGS(id->driver_info); | 501 | us->flags = USB_US_ORIG_FLAGS(id->driver_info); |
502 | 502 | ||
503 | if (us->flags & US_FL_IGNORE_DEVICE) { | ||
504 | printk(KERN_INFO USB_STORAGE "device ignored\n"); | ||
505 | return -ENODEV; | ||
506 | } | ||
507 | |||
503 | /* | 508 | /* |
504 | * This flag is only needed when we're in high-speed, so let's | 509 | * This flag is only needed when we're in high-speed, so let's |
505 | * disable it if we're in full-speed | 510 | * disable it if we're in full-speed |
@@ -541,6 +546,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
541 | msgs[msg], | 546 | msgs[msg], |
542 | UTS_RELEASE); | 547 | UTS_RELEASE); |
543 | } | 548 | } |
549 | |||
550 | return 0; | ||
544 | } | 551 | } |
545 | 552 | ||
546 | /* Get the transport settings */ | 553 | /* Get the transport settings */ |
@@ -969,7 +976,9 @@ static int storage_probe(struct usb_interface *intf, | |||
969 | * of the match from the usb_device_id table, so we can find the | 976 | * of the match from the usb_device_id table, so we can find the |
970 | * corresponding entry in the private table. | 977 | * corresponding entry in the private table. |
971 | */ | 978 | */ |
972 | get_device_info(us, id); | 979 | result = get_device_info(us, id); |
980 | if (result) | ||
981 | goto BadDevice; | ||
973 | 982 | ||
974 | /* Get the transport, protocol, and pipe settings */ | 983 | /* Get the transport, protocol, and pipe settings */ |
975 | result = get_transport(us); | 984 | result = get_transport(us); |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6533b0f39231..c40b9b8b1e7e 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -86,9 +86,11 @@ config FB_MACMODES | |||
86 | default n | 86 | default n |
87 | 87 | ||
88 | config FB_BACKLIGHT | 88 | config FB_BACKLIGHT |
89 | bool | 89 | bool |
90 | depends on FB | 90 | depends on FB |
91 | default n | 91 | select BACKLIGHT_LCD_SUPPORT |
92 | select BACKLIGHT_CLASS_DEVICE | ||
93 | default n | ||
92 | 94 | ||
93 | config FB_MODE_HELPERS | 95 | config FB_MODE_HELPERS |
94 | bool "Enable Video Mode Handling Helpers" | 96 | bool "Enable Video Mode Handling Helpers" |
@@ -420,7 +422,7 @@ config FB_OF | |||
420 | 422 | ||
421 | config FB_CONTROL | 423 | config FB_CONTROL |
422 | bool "Apple \"control\" display support" | 424 | bool "Apple \"control\" display support" |
423 | depends on (FB = y) && PPC_PMAC | 425 | depends on (FB = y) && PPC_PMAC && PPC32 |
424 | select FB_CFB_FILLRECT | 426 | select FB_CFB_FILLRECT |
425 | select FB_CFB_COPYAREA | 427 | select FB_CFB_COPYAREA |
426 | select FB_CFB_IMAGEBLIT | 428 | select FB_CFB_IMAGEBLIT |
@@ -431,7 +433,7 @@ config FB_CONTROL | |||
431 | 433 | ||
432 | config FB_PLATINUM | 434 | config FB_PLATINUM |
433 | bool "Apple \"platinum\" display support" | 435 | bool "Apple \"platinum\" display support" |
434 | depends on (FB = y) && PPC_PMAC | 436 | depends on (FB = y) && PPC_PMAC && PPC32 |
435 | select FB_CFB_FILLRECT | 437 | select FB_CFB_FILLRECT |
436 | select FB_CFB_COPYAREA | 438 | select FB_CFB_COPYAREA |
437 | select FB_CFB_IMAGEBLIT | 439 | select FB_CFB_IMAGEBLIT |
@@ -442,7 +444,7 @@ config FB_PLATINUM | |||
442 | 444 | ||
443 | config FB_VALKYRIE | 445 | config FB_VALKYRIE |
444 | bool "Apple \"valkyrie\" display support" | 446 | bool "Apple \"valkyrie\" display support" |
445 | depends on (FB = y) && (MAC || PPC_PMAC) | 447 | depends on (FB = y) && (MAC || (PPC_PMAC && PPC32)) |
446 | select FB_CFB_FILLRECT | 448 | select FB_CFB_FILLRECT |
447 | select FB_CFB_COPYAREA | 449 | select FB_CFB_COPYAREA |
448 | select FB_CFB_IMAGEBLIT | 450 | select FB_CFB_IMAGEBLIT |
@@ -453,7 +455,7 @@ config FB_VALKYRIE | |||
453 | 455 | ||
454 | config FB_CT65550 | 456 | config FB_CT65550 |
455 | bool "Chips 65550 display support" | 457 | bool "Chips 65550 display support" |
456 | depends on (FB = y) && PPC | 458 | depends on (FB = y) && PPC32 |
457 | select FB_CFB_FILLRECT | 459 | select FB_CFB_FILLRECT |
458 | select FB_CFB_COPYAREA | 460 | select FB_CFB_COPYAREA |
459 | select FB_CFB_IMAGEBLIT | 461 | select FB_CFB_IMAGEBLIT |
@@ -721,10 +723,8 @@ config FB_NVIDIA_I2C | |||
721 | 723 | ||
722 | config FB_NVIDIA_BACKLIGHT | 724 | config FB_NVIDIA_BACKLIGHT |
723 | bool "Support for backlight control" | 725 | bool "Support for backlight control" |
724 | depends on FB_NVIDIA && PPC_PMAC | 726 | depends on FB_NVIDIA && PMAC_BACKLIGHT |
725 | select FB_BACKLIGHT | 727 | select FB_BACKLIGHT |
726 | select BACKLIGHT_LCD_SUPPORT | ||
727 | select BACKLIGHT_CLASS_DEVICE | ||
728 | default y | 728 | default y |
729 | help | 729 | help |
730 | Say Y here if you want to control the backlight of your display. | 730 | Say Y here if you want to control the backlight of your display. |
@@ -769,10 +769,8 @@ config FB_RIVA_DEBUG | |||
769 | 769 | ||
770 | config FB_RIVA_BACKLIGHT | 770 | config FB_RIVA_BACKLIGHT |
771 | bool "Support for backlight control" | 771 | bool "Support for backlight control" |
772 | depends on FB_RIVA && PPC_PMAC | 772 | depends on FB_RIVA && PMAC_BACKLIGHT |
773 | select FB_BACKLIGHT | 773 | select FB_BACKLIGHT |
774 | select BACKLIGHT_LCD_SUPPORT | ||
775 | select BACKLIGHT_CLASS_DEVICE | ||
776 | default y | 774 | default y |
777 | help | 775 | help |
778 | Say Y here if you want to control the backlight of your display. | 776 | Say Y here if you want to control the backlight of your display. |
@@ -1025,10 +1023,8 @@ config FB_RADEON_I2C | |||
1025 | 1023 | ||
1026 | config FB_RADEON_BACKLIGHT | 1024 | config FB_RADEON_BACKLIGHT |
1027 | bool "Support for backlight control" | 1025 | bool "Support for backlight control" |
1028 | depends on FB_RADEON && PPC_PMAC | 1026 | depends on FB_RADEON && PMAC_BACKLIGHT |
1029 | select FB_BACKLIGHT | 1027 | select FB_BACKLIGHT |
1030 | select BACKLIGHT_LCD_SUPPORT | ||
1031 | select BACKLIGHT_CLASS_DEVICE | ||
1032 | default y | 1028 | default y |
1033 | help | 1029 | help |
1034 | Say Y here if you want to control the backlight of your display. | 1030 | Say Y here if you want to control the backlight of your display. |
@@ -1059,10 +1055,8 @@ config FB_ATY128 | |||
1059 | 1055 | ||
1060 | config FB_ATY128_BACKLIGHT | 1056 | config FB_ATY128_BACKLIGHT |
1061 | bool "Support for backlight control" | 1057 | bool "Support for backlight control" |
1062 | depends on FB_ATY128 && PPC_PMAC | 1058 | depends on FB_ATY128 && PMAC_BACKLIGHT |
1063 | select FB_BACKLIGHT | 1059 | select FB_BACKLIGHT |
1064 | select BACKLIGHT_LCD_SUPPORT | ||
1065 | select BACKLIGHT_CLASS_DEVICE | ||
1066 | default y | 1060 | default y |
1067 | help | 1061 | help |
1068 | Say Y here if you want to control the backlight of your display. | 1062 | Say Y here if you want to control the backlight of your display. |
@@ -1111,10 +1105,8 @@ config FB_ATY_GX | |||
1111 | 1105 | ||
1112 | config FB_ATY_BACKLIGHT | 1106 | config FB_ATY_BACKLIGHT |
1113 | bool "Support for backlight control" | 1107 | bool "Support for backlight control" |
1114 | depends on FB_ATY && PPC_PMAC | 1108 | depends on FB_ATY && PMAC_BACKLIGHT |
1115 | select FB_BACKLIGHT | 1109 | select FB_BACKLIGHT |
1116 | select BACKLIGHT_LCD_SUPPORT | ||
1117 | select BACKLIGHT_CLASS_DEVICE | ||
1118 | default y | 1110 | default y |
1119 | help | 1111 | help |
1120 | Say Y here if you want to control the backlight of your display. | 1112 | Say Y here if you want to control the backlight of your display. |
@@ -1620,7 +1612,7 @@ if FB || SGI_NEWPORT_CONSOLE | |||
1620 | source "drivers/video/logo/Kconfig" | 1612 | source "drivers/video/logo/Kconfig" |
1621 | endif | 1613 | endif |
1622 | 1614 | ||
1623 | if FB && SYSFS | 1615 | if SYSFS |
1624 | source "drivers/video/backlight/Kconfig" | 1616 | source "drivers/video/backlight/Kconfig" |
1625 | endif | 1617 | endif |
1626 | 1618 | ||
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 95563c9c6b9c..481c6c9695f8 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-y += fb_notify.o | ||
7 | obj-$(CONFIG_FB) += fb.o | 8 | obj-$(CONFIG_FB) += fb.o |
8 | fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ | 9 | fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ |
9 | modedb.o fbcvt.o | 10 | modedb.o fbcvt.o |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index c64a717e2d4b..8b08121b390b 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -455,7 +455,10 @@ static void do_wait_for_fifo(u16 entries, struct aty128fb_par *par); | |||
455 | static void wait_for_fifo(u16 entries, struct aty128fb_par *par); | 455 | static void wait_for_fifo(u16 entries, struct aty128fb_par *par); |
456 | static void wait_for_idle(struct aty128fb_par *par); | 456 | static void wait_for_idle(struct aty128fb_par *par); |
457 | static u32 depth_to_dst(u32 depth); | 457 | static u32 depth_to_dst(u32 depth); |
458 | |||
459 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | ||
458 | static void aty128_bl_set_power(struct fb_info *info, int power); | 460 | static void aty128_bl_set_power(struct fb_info *info, int power); |
461 | #endif | ||
459 | 462 | ||
460 | #define BIOS_IN8(v) (readb(bios + (v))) | 463 | #define BIOS_IN8(v) (readb(bios + (v))) |
461 | #define BIOS_IN16(v) (readb(bios + (v)) | \ | 464 | #define BIOS_IN16(v) (readb(bios + (v)) | \ |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 1507d19f481f..053ff63365b7 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2812,7 +2812,7 @@ static int atyfb_blank(int blank, struct fb_info *info) | |||
2812 | if (par->lock_blank || par->asleep) | 2812 | if (par->lock_blank || par->asleep) |
2813 | return 0; | 2813 | return 0; |
2814 | 2814 | ||
2815 | #ifdef CONFIG_PMAC_BACKLIGHT | 2815 | #ifdef CONFIG_FB_ATY_BACKLIGHT |
2816 | if (machine_is(powermac) && blank > FB_BLANK_NORMAL) | 2816 | if (machine_is(powermac) && blank > FB_BLANK_NORMAL) |
2817 | aty_bl_set_power(info, FB_BLANK_POWERDOWN); | 2817 | aty_bl_set_power(info, FB_BLANK_POWERDOWN); |
2818 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2818 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
@@ -2844,7 +2844,7 @@ static int atyfb_blank(int blank, struct fb_info *info) | |||
2844 | } | 2844 | } |
2845 | aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); | 2845 | aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); |
2846 | 2846 | ||
2847 | #ifdef CONFIG_PMAC_BACKLIGHT | 2847 | #ifdef CONFIG_FB_ATY_BACKLIGHT |
2848 | if (machine_is(powermac) && blank <= FB_BLANK_NORMAL) | 2848 | if (machine_is(powermac) && blank <= FB_BLANK_NORMAL) |
2849 | aty_bl_set_power(info, FB_BLANK_UNBLANK); | 2849 | aty_bl_set_power(info, FB_BLANK_UNBLANK); |
2850 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2850 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 8d85fc58142e..8e3400d5dd21 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -266,6 +266,8 @@ static int force_measure_pll = 0; | |||
266 | #ifdef CONFIG_MTRR | 266 | #ifdef CONFIG_MTRR |
267 | static int nomtrr = 0; | 267 | static int nomtrr = 0; |
268 | #endif | 268 | #endif |
269 | static int force_sleep; | ||
270 | static int ignore_devlist; | ||
269 | 271 | ||
270 | /* | 272 | /* |
271 | * prototypes | 273 | * prototypes |
@@ -2327,9 +2329,9 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2327 | /* -2 is special: means ON on mobility chips and do not | 2329 | /* -2 is special: means ON on mobility chips and do not |
2328 | * change on others | 2330 | * change on others |
2329 | */ | 2331 | */ |
2330 | radeonfb_pm_init(rinfo, rinfo->is_mobility ? 1 : -1); | 2332 | radeonfb_pm_init(rinfo, rinfo->is_mobility ? 1 : -1, ignore_devlist, force_sleep); |
2331 | } else | 2333 | } else |
2332 | radeonfb_pm_init(rinfo, default_dynclk); | 2334 | radeonfb_pm_init(rinfo, default_dynclk, ignore_devlist, force_sleep); |
2333 | 2335 | ||
2334 | pci_set_drvdata(pdev, info); | 2336 | pci_set_drvdata(pdev, info); |
2335 | 2337 | ||
@@ -2477,6 +2479,12 @@ static int __init radeonfb_setup (char *options) | |||
2477 | force_measure_pll = 1; | 2479 | force_measure_pll = 1; |
2478 | } else if (!strncmp(this_opt, "ignore_edid", 11)) { | 2480 | } else if (!strncmp(this_opt, "ignore_edid", 11)) { |
2479 | ignore_edid = 1; | 2481 | ignore_edid = 1; |
2482 | #if defined(CONFIG_PM) && defined(CONFIG_X86) | ||
2483 | } else if (!strncmp(this_opt, "force_sleep", 11)) { | ||
2484 | force_sleep = 1; | ||
2485 | } else if (!strncmp(this_opt, "ignore_devlist", 14)) { | ||
2486 | ignore_devlist = 1; | ||
2487 | #endif | ||
2480 | } else | 2488 | } else |
2481 | mode_option = this_opt; | 2489 | mode_option = this_opt; |
2482 | } | 2490 | } |
@@ -2532,3 +2540,9 @@ module_param(panel_yres, int, 0); | |||
2532 | MODULE_PARM_DESC(panel_yres, "int: set panel yres"); | 2540 | MODULE_PARM_DESC(panel_yres, "int: set panel yres"); |
2533 | module_param(mode_option, charp, 0); | 2541 | module_param(mode_option, charp, 0); |
2534 | MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" "); | 2542 | MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" "); |
2543 | #if defined(CONFIG_PM) && defined(CONFIG_X86) | ||
2544 | module_param(force_sleep, bool, 0); | ||
2545 | MODULE_PARM_DESC(force_sleep, "bool: force D2 sleep mode on all hardware"); | ||
2546 | module_param(ignore_devlist, bool, 0); | ||
2547 | MODULE_PARM_DESC(ignore_devlist, "bool: ignore workarounds for bugs in specific laptops"); | ||
2548 | #endif | ||
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index c7091761cef4..f31e606a2ded 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -27,6 +27,99 @@ | |||
27 | 27 | ||
28 | #include "ati_ids.h" | 28 | #include "ati_ids.h" |
29 | 29 | ||
30 | static void radeon_reinitialize_M10(struct radeonfb_info *rinfo); | ||
31 | |||
32 | /* | ||
33 | * Workarounds for bugs in PC laptops: | ||
34 | * - enable D2 sleep in some IBM Thinkpads | ||
35 | * - special case for Samsung P35 | ||
36 | * | ||
37 | * Whitelist by subsystem vendor/device because | ||
38 | * its the subsystem vendor's fault! | ||
39 | */ | ||
40 | |||
41 | #if defined(CONFIG_PM) && defined(CONFIG_X86) | ||
42 | struct radeon_device_id { | ||
43 | const char *ident; /* (arbitrary) Name */ | ||
44 | const unsigned short subsystem_vendor; /* Subsystem Vendor ID */ | ||
45 | const unsigned short subsystem_device; /* Subsystem Device ID */ | ||
46 | const enum radeon_pm_mode pm_mode_modifier; /* modify pm_mode */ | ||
47 | const reinit_function_ptr new_reinit_func; /* changed reinit_func */ | ||
48 | }; | ||
49 | |||
50 | #define BUGFIX(model, sv, sd, pm, fn) { \ | ||
51 | .ident = model, \ | ||
52 | .subsystem_vendor = sv, \ | ||
53 | .subsystem_device = sd, \ | ||
54 | .pm_mode_modifier = pm, \ | ||
55 | .new_reinit_func = fn \ | ||
56 | } | ||
57 | |||
58 | static struct radeon_device_id radeon_workaround_list[] = { | ||
59 | BUGFIX("IBM Thinkpad R32", | ||
60 | PCI_VENDOR_ID_IBM, 0x1905, | ||
61 | radeon_pm_d2, NULL), | ||
62 | BUGFIX("IBM Thinkpad R40", | ||
63 | PCI_VENDOR_ID_IBM, 0x0526, | ||
64 | radeon_pm_d2, NULL), | ||
65 | BUGFIX("IBM Thinkpad R40", | ||
66 | PCI_VENDOR_ID_IBM, 0x0527, | ||
67 | radeon_pm_d2, NULL), | ||
68 | BUGFIX("IBM Thinkpad R50/R51/T40/T41", | ||
69 | PCI_VENDOR_ID_IBM, 0x0531, | ||
70 | radeon_pm_d2, NULL), | ||
71 | BUGFIX("IBM Thinkpad R51/T40/T41/T42", | ||
72 | PCI_VENDOR_ID_IBM, 0x0530, | ||
73 | radeon_pm_d2, NULL), | ||
74 | BUGFIX("IBM Thinkpad T30", | ||
75 | PCI_VENDOR_ID_IBM, 0x0517, | ||
76 | radeon_pm_d2, NULL), | ||
77 | BUGFIX("IBM Thinkpad T40p", | ||
78 | PCI_VENDOR_ID_IBM, 0x054d, | ||
79 | radeon_pm_d2, NULL), | ||
80 | BUGFIX("IBM Thinkpad T42", | ||
81 | PCI_VENDOR_ID_IBM, 0x0550, | ||
82 | radeon_pm_d2, NULL), | ||
83 | BUGFIX("IBM Thinkpad X31/X32", | ||
84 | PCI_VENDOR_ID_IBM, 0x052f, | ||
85 | radeon_pm_d2, NULL), | ||
86 | BUGFIX("Samsung P35", | ||
87 | PCI_VENDOR_ID_SAMSUNG, 0xc00c, | ||
88 | radeon_pm_off, radeon_reinitialize_M10), | ||
89 | { .ident = NULL } | ||
90 | }; | ||
91 | |||
92 | static int radeon_apply_workarounds(struct radeonfb_info *rinfo) | ||
93 | { | ||
94 | struct radeon_device_id *id; | ||
95 | |||
96 | for (id = radeon_workaround_list; id->ident != NULL; id++ ) | ||
97 | if ((id->subsystem_vendor == rinfo->pdev->subsystem_vendor ) && | ||
98 | (id->subsystem_device == rinfo->pdev->subsystem_device )) { | ||
99 | |||
100 | /* we found a device that requires workaround */ | ||
101 | printk(KERN_DEBUG "radeonfb: %s detected" | ||
102 | ", enabling workaround\n", id->ident); | ||
103 | |||
104 | rinfo->pm_mode |= id->pm_mode_modifier; | ||
105 | |||
106 | if (id->new_reinit_func != NULL) | ||
107 | rinfo->reinit_func = id->new_reinit_func; | ||
108 | |||
109 | return 1; | ||
110 | } | ||
111 | return 0; /* not found */ | ||
112 | } | ||
113 | |||
114 | #else /* defined(CONFIG_PM) && defined(CONFIG_X86) */ | ||
115 | static inline int radeon_apply_workarounds(struct radeonfb_info *rinfo) | ||
116 | { | ||
117 | return 0; | ||
118 | } | ||
119 | #endif /* defined(CONFIG_PM) && defined(CONFIG_X86) */ | ||
120 | |||
121 | |||
122 | |||
30 | static void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo) | 123 | static void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo) |
31 | { | 124 | { |
32 | u32 tmp; | 125 | u32 tmp; |
@@ -852,18 +945,26 @@ static void radeon_pm_setup_for_suspend(struct radeonfb_info *rinfo) | |||
852 | /* because both INPLL and OUTPLL take the same lock, that's why. */ | 945 | /* because both INPLL and OUTPLL take the same lock, that's why. */ |
853 | tmp = INPLL( pllMCLK_MISC) | MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND; | 946 | tmp = INPLL( pllMCLK_MISC) | MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND; |
854 | OUTPLL( pllMCLK_MISC, tmp); | 947 | OUTPLL( pllMCLK_MISC, tmp); |
855 | |||
856 | /* AGP PLL control */ | ||
857 | if (rinfo->family <= CHIP_FAMILY_RV280) { | ||
858 | OUTREG(BUS_CNTL1, INREG(BUS_CNTL1) | BUS_CNTL1__AGPCLK_VALID); | ||
859 | 948 | ||
860 | OUTREG(BUS_CNTL1, | 949 | /* BUS_CNTL1__MOBILE_PLATORM_SEL setting is northbridge chipset |
861 | (INREG(BUS_CNTL1) & ~BUS_CNTL1__MOBILE_PLATFORM_SEL_MASK) | 950 | * and radeon chip dependent. Thus we only enable it on Mac for |
862 | | (2<<BUS_CNTL1__MOBILE_PLATFORM_SEL__SHIFT)); // 440BX | 951 | * now (until we get more info on how to compute the correct |
863 | } else { | 952 | * value for various X86 bridges). |
864 | OUTREG(BUS_CNTL1, INREG(BUS_CNTL1)); | 953 | */ |
865 | OUTREG(BUS_CNTL1, (INREG(BUS_CNTL1) & ~0x4000) | 0x8000); | 954 | #ifdef CONFIG_PPC_PMAC |
955 | if (machine_is(powermac)) { | ||
956 | /* AGP PLL control */ | ||
957 | if (rinfo->family <= CHIP_FAMILY_RV280) { | ||
958 | OUTREG(BUS_CNTL1, INREG(BUS_CNTL1) | BUS_CNTL1__AGPCLK_VALID); | ||
959 | OUTREG(BUS_CNTL1, | ||
960 | (INREG(BUS_CNTL1) & ~BUS_CNTL1__MOBILE_PLATFORM_SEL_MASK) | ||
961 | | (2<<BUS_CNTL1__MOBILE_PLATFORM_SEL__SHIFT)); // 440BX | ||
962 | } else { | ||
963 | OUTREG(BUS_CNTL1, INREG(BUS_CNTL1)); | ||
964 | OUTREG(BUS_CNTL1, (INREG(BUS_CNTL1) & ~0x4000) | 0x8000); | ||
965 | } | ||
866 | } | 966 | } |
967 | #endif | ||
867 | 968 | ||
868 | OUTREG(CRTC_OFFSET_CNTL, (INREG(CRTC_OFFSET_CNTL) | 969 | OUTREG(CRTC_OFFSET_CNTL, (INREG(CRTC_OFFSET_CNTL) |
869 | & ~CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN)); | 970 | & ~CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN)); |
@@ -2713,7 +2814,7 @@ static void radeonfb_early_resume(void *data) | |||
2713 | 2814 | ||
2714 | #endif /* CONFIG_PM */ | 2815 | #endif /* CONFIG_PM */ |
2715 | 2816 | ||
2716 | void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | 2817 | void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep) |
2717 | { | 2818 | { |
2718 | /* Find PM registers in config space if any*/ | 2819 | /* Find PM registers in config space if any*/ |
2719 | rinfo->pm_reg = pci_find_capability(rinfo->pdev, PCI_CAP_ID_PM); | 2820 | rinfo->pm_reg = pci_find_capability(rinfo->pdev, PCI_CAP_ID_PM); |
@@ -2729,22 +2830,13 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2729 | } | 2830 | } |
2730 | 2831 | ||
2731 | #if defined(CONFIG_PM) | 2832 | #if defined(CONFIG_PM) |
2833 | #if defined(CONFIG_PPC_PMAC) | ||
2732 | /* Check if we can power manage on suspend/resume. We can do | 2834 | /* Check if we can power manage on suspend/resume. We can do |
2733 | * D2 on M6, M7 and M9, and we can resume from D3 cold a few other | 2835 | * D2 on M6, M7 and M9, and we can resume from D3 cold a few other |
2734 | * "Mac" cards, but that's all. We need more infos about what the | 2836 | * "Mac" cards, but that's all. We need more infos about what the |
2735 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that | 2837 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that |
2736 | * reason. --BenH | 2838 | * reason. --BenH |
2737 | */ | 2839 | */ |
2738 | /* Special case for Samsung P35 laptops | ||
2739 | */ | ||
2740 | if ((rinfo->pdev->vendor == PCI_VENDOR_ID_ATI) && | ||
2741 | (rinfo->pdev->device == PCI_CHIP_RV350_NP) && | ||
2742 | (rinfo->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG) && | ||
2743 | (rinfo->pdev->subsystem_device == 0xc00c)) { | ||
2744 | rinfo->reinit_func = radeon_reinitialize_M10; | ||
2745 | rinfo->pm_mode |= radeon_pm_off; | ||
2746 | } | ||
2747 | #if defined(CONFIG_PPC_PMAC) | ||
2748 | if (machine_is(powermac) && rinfo->of_node) { | 2840 | if (machine_is(powermac) && rinfo->of_node) { |
2749 | if (rinfo->is_mobility && rinfo->pm_reg && | 2841 | if (rinfo->is_mobility && rinfo->pm_reg && |
2750 | rinfo->family <= CHIP_FAMILY_RV250) | 2842 | rinfo->family <= CHIP_FAMILY_RV250) |
@@ -2790,6 +2882,18 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2790 | } | 2882 | } |
2791 | #endif /* defined(CONFIG_PPC_PMAC) */ | 2883 | #endif /* defined(CONFIG_PPC_PMAC) */ |
2792 | #endif /* defined(CONFIG_PM) */ | 2884 | #endif /* defined(CONFIG_PM) */ |
2885 | |||
2886 | if (ignore_devlist) | ||
2887 | printk(KERN_DEBUG | ||
2888 | "radeonfb: skipping test for device workarounds\n"); | ||
2889 | else | ||
2890 | radeon_apply_workarounds(rinfo); | ||
2891 | |||
2892 | if (force_sleep) { | ||
2893 | printk(KERN_DEBUG | ||
2894 | "radeonfb: forcefully enabling D2 sleep mode\n"); | ||
2895 | rinfo->pm_mode |= radeon_pm_d2; | ||
2896 | } | ||
2793 | } | 2897 | } |
2794 | 2898 | ||
2795 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) | 2899 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) |
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h index 38657b2d10eb..d5ff224a6258 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/aty/radeonfb.h | |||
@@ -273,6 +273,8 @@ enum radeon_pm_mode { | |||
273 | radeon_pm_off = 0x00000002, /* Can resume from D3 cold */ | 273 | radeon_pm_off = 0x00000002, /* Can resume from D3 cold */ |
274 | }; | 274 | }; |
275 | 275 | ||
276 | typedef void (*reinit_function_ptr)(struct radeonfb_info *rinfo); | ||
277 | |||
276 | struct radeonfb_info { | 278 | struct radeonfb_info { |
277 | struct fb_info *info; | 279 | struct fb_info *info; |
278 | 280 | ||
@@ -338,7 +340,7 @@ struct radeonfb_info { | |||
338 | int dynclk; | 340 | int dynclk; |
339 | int no_schedule; | 341 | int no_schedule; |
340 | enum radeon_pm_mode pm_mode; | 342 | enum radeon_pm_mode pm_mode; |
341 | void (*reinit_func)(struct radeonfb_info *rinfo); | 343 | reinit_function_ptr reinit_func; |
342 | 344 | ||
343 | /* Lock on register access */ | 345 | /* Lock on register access */ |
344 | spinlock_t reg_lock; | 346 | spinlock_t reg_lock; |
@@ -600,7 +602,7 @@ extern int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 | |||
600 | /* PM Functions */ | 602 | /* PM Functions */ |
601 | extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state); | 603 | extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state); |
602 | extern int radeonfb_pci_resume(struct pci_dev *pdev); | 604 | extern int radeonfb_pci_resume(struct pci_dev *pdev); |
603 | extern void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk); | 605 | extern void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep); |
604 | extern void radeonfb_pm_exit(struct radeonfb_info *rinfo); | 606 | extern void radeonfb_pm_exit(struct radeonfb_info *rinfo); |
605 | 607 | ||
606 | /* Monitor probe functions */ | 608 | /* Monitor probe functions */ |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 022f9d3473f5..02f15297a021 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -10,7 +10,7 @@ menuconfig BACKLIGHT_LCD_SUPPORT | |||
10 | 10 | ||
11 | config BACKLIGHT_CLASS_DEVICE | 11 | config BACKLIGHT_CLASS_DEVICE |
12 | tristate "Lowlevel Backlight controls" | 12 | tristate "Lowlevel Backlight controls" |
13 | depends on BACKLIGHT_LCD_SUPPORT && FB | 13 | depends on BACKLIGHT_LCD_SUPPORT |
14 | default m | 14 | default m |
15 | help | 15 | help |
16 | This framework adds support for low-level control of the LCD | 16 | This framework adds support for low-level control of the LCD |
@@ -26,7 +26,7 @@ config BACKLIGHT_DEVICE | |||
26 | 26 | ||
27 | config LCD_CLASS_DEVICE | 27 | config LCD_CLASS_DEVICE |
28 | tristate "Lowlevel LCD controls" | 28 | tristate "Lowlevel LCD controls" |
29 | depends on BACKLIGHT_LCD_SUPPORT && FB | 29 | depends on BACKLIGHT_LCD_SUPPORT |
30 | default m | 30 | default m |
31 | help | 31 | help |
32 | This framework adds support for low-level control of LCD. | 32 | This framework adds support for low-level control of LCD. |
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c index 52ed12b12acc..eb4d03fa5391 100644 --- a/drivers/video/console/mdacon.c +++ b/drivers/video/console/mdacon.c | |||
@@ -197,7 +197,7 @@ static int __init mdacon_setup(char *str) | |||
197 | __setup("mdacon=", mdacon_setup); | 197 | __setup("mdacon=", mdacon_setup); |
198 | #endif | 198 | #endif |
199 | 199 | ||
200 | static int __init mda_detect(void) | 200 | static int mda_detect(void) |
201 | { | 201 | { |
202 | int count=0; | 202 | int count=0; |
203 | u16 *p, p_save; | 203 | u16 *p, p_save; |
@@ -282,7 +282,7 @@ static int __init mda_detect(void) | |||
282 | return 1; | 282 | return 1; |
283 | } | 283 | } |
284 | 284 | ||
285 | static void __init mda_initialize(void) | 285 | static void mda_initialize(void) |
286 | { | 286 | { |
287 | write_mda_b(97, 0x00); /* horizontal total */ | 287 | write_mda_b(97, 0x00); /* horizontal total */ |
288 | write_mda_b(80, 0x01); /* horizontal displayed */ | 288 | write_mda_b(80, 0x01); /* horizontal displayed */ |
diff --git a/drivers/video/fb_notify.c b/drivers/video/fb_notify.c new file mode 100644 index 000000000000..8c020389e4fa --- /dev/null +++ b/drivers/video/fb_notify.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/fb_notify.c | ||
3 | * | ||
4 | * Copyright (C) 2006 Antonino Daplas <adaplas@pol.net> | ||
5 | * | ||
6 | * 2001 - Documented with DocBook | ||
7 | * - Brad Douglas <brad@neruo.com> | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file COPYING in the main directory of this archive | ||
11 | * for more details. | ||
12 | */ | ||
13 | #include <linux/fb.h> | ||
14 | #include <linux/notifier.h> | ||
15 | |||
16 | static BLOCKING_NOTIFIER_HEAD(fb_notifier_list); | ||
17 | |||
18 | /** | ||
19 | * fb_register_client - register a client notifier | ||
20 | * @nb: notifier block to callback on events | ||
21 | */ | ||
22 | int fb_register_client(struct notifier_block *nb) | ||
23 | { | ||
24 | return blocking_notifier_chain_register(&fb_notifier_list, nb); | ||
25 | } | ||
26 | EXPORT_SYMBOL(fb_register_client); | ||
27 | |||
28 | /** | ||
29 | * fb_unregister_client - unregister a client notifier | ||
30 | * @nb: notifier block to callback on events | ||
31 | */ | ||
32 | int fb_unregister_client(struct notifier_block *nb) | ||
33 | { | ||
34 | return blocking_notifier_chain_unregister(&fb_notifier_list, nb); | ||
35 | } | ||
36 | EXPORT_SYMBOL(fb_unregister_client); | ||
37 | |||
38 | /** | ||
39 | * fb_notifier_call_chain - notify clients of fb_events | ||
40 | * | ||
41 | */ | ||
42 | int fb_notifier_call_chain(unsigned long val, void *v) | ||
43 | { | ||
44 | return blocking_notifier_call_chain(&fb_notifier_list, val, v); | ||
45 | } | ||
46 | EXPORT_SYMBOL_GPL(fb_notifier_call_chain); | ||
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 4fc9df426c1a..17961e3ecaa0 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -52,7 +52,6 @@ | |||
52 | 52 | ||
53 | #define FBPIXMAPSIZE (1024 * 8) | 53 | #define FBPIXMAPSIZE (1024 * 8) |
54 | 54 | ||
55 | static BLOCKING_NOTIFIER_HEAD(fb_notifier_list); | ||
56 | struct fb_info *registered_fb[FB_MAX]; | 55 | struct fb_info *registered_fb[FB_MAX]; |
57 | int num_registered_fb; | 56 | int num_registered_fb; |
58 | 57 | ||
@@ -791,8 +790,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
791 | 790 | ||
792 | event.info = info; | 791 | event.info = info; |
793 | event.data = &mode1; | 792 | event.data = &mode1; |
794 | ret = blocking_notifier_call_chain(&fb_notifier_list, | 793 | ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event); |
795 | FB_EVENT_MODE_DELETE, &event); | ||
796 | } | 794 | } |
797 | 795 | ||
798 | if (!ret) | 796 | if (!ret) |
@@ -837,8 +835,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) | |||
837 | 835 | ||
838 | info->flags &= ~FBINFO_MISC_USEREVENT; | 836 | info->flags &= ~FBINFO_MISC_USEREVENT; |
839 | event.info = info; | 837 | event.info = info; |
840 | blocking_notifier_call_chain(&fb_notifier_list, | 838 | fb_notifier_call_chain(evnt, &event); |
841 | evnt, &event); | ||
842 | } | 839 | } |
843 | } | 840 | } |
844 | } | 841 | } |
@@ -861,8 +858,7 @@ fb_blank(struct fb_info *info, int blank) | |||
861 | 858 | ||
862 | event.info = info; | 859 | event.info = info; |
863 | event.data = ␣ | 860 | event.data = ␣ |
864 | blocking_notifier_call_chain(&fb_notifier_list, | 861 | fb_notifier_call_chain(FB_EVENT_BLANK, &event); |
865 | FB_EVENT_BLANK, &event); | ||
866 | } | 862 | } |
867 | 863 | ||
868 | return ret; | 864 | return ret; |
@@ -933,8 +929,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
933 | con2fb.framebuffer = -1; | 929 | con2fb.framebuffer = -1; |
934 | event.info = info; | 930 | event.info = info; |
935 | event.data = &con2fb; | 931 | event.data = &con2fb; |
936 | blocking_notifier_call_chain(&fb_notifier_list, | 932 | fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); |
937 | FB_EVENT_GET_CONSOLE_MAP, &event); | ||
938 | return copy_to_user(argp, &con2fb, | 933 | return copy_to_user(argp, &con2fb, |
939 | sizeof(con2fb)) ? -EFAULT : 0; | 934 | sizeof(con2fb)) ? -EFAULT : 0; |
940 | case FBIOPUT_CON2FBMAP: | 935 | case FBIOPUT_CON2FBMAP: |
@@ -952,9 +947,8 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
952 | return -EINVAL; | 947 | return -EINVAL; |
953 | event.info = info; | 948 | event.info = info; |
954 | event.data = &con2fb; | 949 | event.data = &con2fb; |
955 | return blocking_notifier_call_chain(&fb_notifier_list, | 950 | return fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, |
956 | FB_EVENT_SET_CONSOLE_MAP, | 951 | &event); |
957 | &event); | ||
958 | case FBIOBLANK: | 952 | case FBIOBLANK: |
959 | acquire_console_sem(); | 953 | acquire_console_sem(); |
960 | info->flags |= FBINFO_MISC_USEREVENT; | 954 | info->flags |= FBINFO_MISC_USEREVENT; |
@@ -1330,8 +1324,7 @@ register_framebuffer(struct fb_info *fb_info) | |||
1330 | registered_fb[i] = fb_info; | 1324 | registered_fb[i] = fb_info; |
1331 | 1325 | ||
1332 | event.info = fb_info; | 1326 | event.info = fb_info; |
1333 | blocking_notifier_call_chain(&fb_notifier_list, | 1327 | fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); |
1334 | FB_EVENT_FB_REGISTERED, &event); | ||
1335 | return 0; | 1328 | return 0; |
1336 | } | 1329 | } |
1337 | 1330 | ||
@@ -1365,30 +1358,11 @@ unregister_framebuffer(struct fb_info *fb_info) | |||
1365 | fb_cleanup_class_device(fb_info); | 1358 | fb_cleanup_class_device(fb_info); |
1366 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); | 1359 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
1367 | event.info = fb_info; | 1360 | event.info = fb_info; |
1368 | blocking_notifier_call_chain(&fb_notifier_list, | 1361 | fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); |
1369 | FB_EVENT_FB_UNREGISTERED, &event); | ||
1370 | return 0; | 1362 | return 0; |
1371 | } | 1363 | } |
1372 | 1364 | ||
1373 | /** | 1365 | /** |
1374 | * fb_register_client - register a client notifier | ||
1375 | * @nb: notifier block to callback on events | ||
1376 | */ | ||
1377 | int fb_register_client(struct notifier_block *nb) | ||
1378 | { | ||
1379 | return blocking_notifier_chain_register(&fb_notifier_list, nb); | ||
1380 | } | ||
1381 | |||
1382 | /** | ||
1383 | * fb_unregister_client - unregister a client notifier | ||
1384 | * @nb: notifier block to callback on events | ||
1385 | */ | ||
1386 | int fb_unregister_client(struct notifier_block *nb) | ||
1387 | { | ||
1388 | return blocking_notifier_chain_unregister(&fb_notifier_list, nb); | ||
1389 | } | ||
1390 | |||
1391 | /** | ||
1392 | * fb_set_suspend - low level driver signals suspend | 1366 | * fb_set_suspend - low level driver signals suspend |
1393 | * @info: framebuffer affected | 1367 | * @info: framebuffer affected |
1394 | * @state: 0 = resuming, !=0 = suspending | 1368 | * @state: 0 = resuming, !=0 = suspending |
@@ -1403,13 +1377,11 @@ void fb_set_suspend(struct fb_info *info, int state) | |||
1403 | 1377 | ||
1404 | event.info = info; | 1378 | event.info = info; |
1405 | if (state) { | 1379 | if (state) { |
1406 | blocking_notifier_call_chain(&fb_notifier_list, | 1380 | fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); |
1407 | FB_EVENT_SUSPEND, &event); | ||
1408 | info->state = FBINFO_STATE_SUSPENDED; | 1381 | info->state = FBINFO_STATE_SUSPENDED; |
1409 | } else { | 1382 | } else { |
1410 | info->state = FBINFO_STATE_RUNNING; | 1383 | info->state = FBINFO_STATE_RUNNING; |
1411 | blocking_notifier_call_chain(&fb_notifier_list, | 1384 | fb_notifier_call_chain(FB_EVENT_RESUME, &event); |
1412 | FB_EVENT_RESUME, &event); | ||
1413 | } | 1385 | } |
1414 | } | 1386 | } |
1415 | 1387 | ||
@@ -1480,9 +1452,7 @@ int fb_new_modelist(struct fb_info *info) | |||
1480 | 1452 | ||
1481 | if (!list_empty(&info->modelist)) { | 1453 | if (!list_empty(&info->modelist)) { |
1482 | event.info = info; | 1454 | event.info = info; |
1483 | err = blocking_notifier_call_chain(&fb_notifier_list, | 1455 | err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); |
1484 | FB_EVENT_NEW_MODELIST, | ||
1485 | &event); | ||
1486 | } | 1456 | } |
1487 | 1457 | ||
1488 | return err; | 1458 | return err; |
@@ -1594,8 +1564,6 @@ EXPORT_SYMBOL(fb_blank); | |||
1594 | EXPORT_SYMBOL(fb_pan_display); | 1564 | EXPORT_SYMBOL(fb_pan_display); |
1595 | EXPORT_SYMBOL(fb_get_buffer_offset); | 1565 | EXPORT_SYMBOL(fb_get_buffer_offset); |
1596 | EXPORT_SYMBOL(fb_set_suspend); | 1566 | EXPORT_SYMBOL(fb_set_suspend); |
1597 | EXPORT_SYMBOL(fb_register_client); | ||
1598 | EXPORT_SYMBOL(fb_unregister_client); | ||
1599 | EXPORT_SYMBOL(fb_get_options); | 1567 | EXPORT_SYMBOL(fb_get_options); |
1600 | 1568 | ||
1601 | MODULE_LICENSE("GPL"); | 1569 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index 9f2066f0745a..d4f850117874 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -34,10 +34,6 @@ | |||
34 | #include "nv_proto.h" | 34 | #include "nv_proto.h" |
35 | #include "nv_dma.h" | 35 | #include "nv_dma.h" |
36 | 36 | ||
37 | #ifndef CONFIG_PCI /* sanity check */ | ||
38 | #error This driver requires PCI support. | ||
39 | #endif | ||
40 | |||
41 | #undef CONFIG_FB_NVIDIA_DEBUG | 37 | #undef CONFIG_FB_NVIDIA_DEBUG |
42 | #ifdef CONFIG_FB_NVIDIA_DEBUG | 38 | #ifdef CONFIG_FB_NVIDIA_DEBUG |
43 | #define NVTRACE printk | 39 | #define NVTRACE printk |
@@ -1303,20 +1299,19 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1303 | 1299 | ||
1304 | nvidia_save_vga(par, &par->SavedReg); | 1300 | nvidia_save_vga(par, &par->SavedReg); |
1305 | 1301 | ||
1302 | pci_set_drvdata(pd, info); | ||
1303 | nvidia_bl_init(par); | ||
1306 | if (register_framebuffer(info) < 0) { | 1304 | if (register_framebuffer(info) < 0) { |
1307 | printk(KERN_ERR PFX "error registering nVidia framebuffer\n"); | 1305 | printk(KERN_ERR PFX "error registering nVidia framebuffer\n"); |
1308 | goto err_out_iounmap_fb; | 1306 | goto err_out_iounmap_fb; |
1309 | } | 1307 | } |
1310 | 1308 | ||
1311 | pci_set_drvdata(pd, info); | ||
1312 | 1309 | ||
1313 | printk(KERN_INFO PFX | 1310 | printk(KERN_INFO PFX |
1314 | "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n", | 1311 | "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n", |
1315 | info->fix.id, | 1312 | info->fix.id, |
1316 | par->FbMapSize / (1024 * 1024), info->fix.smem_start); | 1313 | par->FbMapSize / (1024 * 1024), info->fix.smem_start); |
1317 | 1314 | ||
1318 | nvidia_bl_init(par); | ||
1319 | |||
1320 | NVTRACE_LEAVE(); | 1315 | NVTRACE_LEAVE(); |
1321 | return 0; | 1316 | return 0; |
1322 | 1317 | ||
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index ce5f3031b99b..0013311e0564 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -62,8 +62,6 @@ struct offb_par default_par; | |||
62 | * Interface used by the world | 62 | * Interface used by the world |
63 | */ | 63 | */ |
64 | 64 | ||
65 | int offb_init(void); | ||
66 | |||
67 | static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 65 | static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
68 | u_int transp, struct fb_info *info); | 66 | u_int transp, struct fb_info *info); |
69 | static int offb_blank(int blank, struct fb_info *info); | 67 | static int offb_blank(int blank, struct fb_info *info); |
@@ -72,11 +70,6 @@ static int offb_blank(int blank, struct fb_info *info); | |||
72 | extern boot_infos_t *boot_infos; | 70 | extern boot_infos_t *boot_infos; |
73 | #endif | 71 | #endif |
74 | 72 | ||
75 | static void offb_init_nodriver(struct device_node *); | ||
76 | static void offb_init_fb(const char *name, const char *full_name, | ||
77 | int width, int height, int depth, int pitch, | ||
78 | unsigned long address, struct device_node *dp); | ||
79 | |||
80 | static struct fb_ops offb_ops = { | 73 | static struct fb_ops offb_ops = { |
81 | .owner = THIS_MODULE, | 74 | .owner = THIS_MODULE, |
82 | .fb_setcolreg = offb_setcolreg, | 75 | .fb_setcolreg = offb_setcolreg, |
@@ -229,123 +222,17 @@ static int offb_blank(int blank, struct fb_info *info) | |||
229 | return 0; | 222 | return 0; |
230 | } | 223 | } |
231 | 224 | ||
232 | /* | ||
233 | * Initialisation | ||
234 | */ | ||
235 | 225 | ||
236 | int __init offb_init(void) | 226 | static void __iomem *offb_map_reg(struct device_node *np, int index, |
227 | unsigned long offset, unsigned long size) | ||
237 | { | 228 | { |
238 | struct device_node *dp = NULL, *boot_disp = NULL; | 229 | struct resource r; |
239 | |||
240 | if (fb_get_options("offb", NULL)) | ||
241 | return -ENODEV; | ||
242 | 230 | ||
243 | for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { | 231 | if (of_address_to_resource(np, index, &r)) |
244 | if (get_property(dp, "linux,opened", NULL) && | 232 | return 0; |
245 | get_property(dp, "linux,boot-display", NULL)) { | 233 | if ((r.start + offset + size) > r.end) |
246 | boot_disp = dp; | 234 | return 0; |
247 | offb_init_nodriver(dp); | 235 | return ioremap(r.start + offset, size); |
248 | } | ||
249 | } | ||
250 | for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { | ||
251 | if (get_property(dp, "linux,opened", NULL) && | ||
252 | dp != boot_disp) | ||
253 | offb_init_nodriver(dp); | ||
254 | } | ||
255 | |||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | |||
260 | static void __init offb_init_nodriver(struct device_node *dp) | ||
261 | { | ||
262 | unsigned int len; | ||
263 | int i, width = 640, height = 480, depth = 8, pitch = 640; | ||
264 | unsigned int flags, rsize, addr_prop = 0; | ||
265 | unsigned long max_size = 0; | ||
266 | u64 rstart, address = OF_BAD_ADDR; | ||
267 | u32 *pp, *addrp, *up; | ||
268 | u64 asize; | ||
269 | |||
270 | pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); | ||
271 | if (pp == NULL) | ||
272 | pp = (u32 *)get_property(dp, "depth", &len); | ||
273 | if (pp && len == sizeof(u32)) | ||
274 | depth = *pp; | ||
275 | |||
276 | pp = (u32 *)get_property(dp, "linux,bootx-width", &len); | ||
277 | if (pp == NULL) | ||
278 | pp = (u32 *)get_property(dp, "width", &len); | ||
279 | if (pp && len == sizeof(u32)) | ||
280 | width = *pp; | ||
281 | |||
282 | pp = (u32 *)get_property(dp, "linux,bootx-height", &len); | ||
283 | if (pp == NULL) | ||
284 | pp = (u32 *)get_property(dp, "height", &len); | ||
285 | if (pp && len == sizeof(u32)) | ||
286 | height = *pp; | ||
287 | |||
288 | pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); | ||
289 | if (pp == NULL) | ||
290 | pp = (u32 *)get_property(dp, "linebytes", &len); | ||
291 | if (pp && len == sizeof(u32)) | ||
292 | pitch = *pp; | ||
293 | else | ||
294 | pitch = width * ((depth + 7) / 8); | ||
295 | |||
296 | rsize = (unsigned long)pitch * (unsigned long)height; | ||
297 | |||
298 | /* Ok, now we try to figure out the address of the framebuffer. | ||
299 | * | ||
300 | * Unfortunately, Open Firmware doesn't provide a standard way to do | ||
301 | * so. All we can do is a dodgy heuristic that happens to work in | ||
302 | * practice. On most machines, the "address" property contains what | ||
303 | * we need, though not on Matrox cards found in IBM machines. What I've | ||
304 | * found that appears to give good results is to go through the PCI | ||
305 | * ranges and pick one that is both big enough and if possible encloses | ||
306 | * the "address" property. If none match, we pick the biggest | ||
307 | */ | ||
308 | up = (u32 *)get_property(dp, "linux,bootx-addr", &len); | ||
309 | if (up == NULL) | ||
310 | up = (u32 *)get_property(dp, "address", &len); | ||
311 | if (up && len == sizeof(u32)) | ||
312 | addr_prop = *up; | ||
313 | |||
314 | for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) | ||
315 | != NULL; i++) { | ||
316 | int match_addrp = 0; | ||
317 | |||
318 | if (!(flags & IORESOURCE_MEM)) | ||
319 | continue; | ||
320 | if (asize < rsize) | ||
321 | continue; | ||
322 | rstart = of_translate_address(dp, addrp); | ||
323 | if (rstart == OF_BAD_ADDR) | ||
324 | continue; | ||
325 | if (addr_prop && (rstart <= addr_prop) && | ||
326 | ((rstart + asize) >= (addr_prop + rsize))) | ||
327 | match_addrp = 1; | ||
328 | if (match_addrp) { | ||
329 | address = addr_prop; | ||
330 | break; | ||
331 | } | ||
332 | if (rsize > max_size) { | ||
333 | max_size = rsize; | ||
334 | address = OF_BAD_ADDR; | ||
335 | } | ||
336 | |||
337 | if (address == OF_BAD_ADDR) | ||
338 | address = rstart; | ||
339 | } | ||
340 | if (address == OF_BAD_ADDR && addr_prop) | ||
341 | address = (u64)addr_prop; | ||
342 | if (address != OF_BAD_ADDR) { | ||
343 | /* kludge for valkyrie */ | ||
344 | if (strcmp(dp->name, "valkyrie") == 0) | ||
345 | address += 0x1000; | ||
346 | offb_init_fb(dp->name, dp->full_name, width, height, depth, | ||
347 | pitch, address, dp); | ||
348 | } | ||
349 | } | 236 | } |
350 | 237 | ||
351 | static void __init offb_init_fb(const char *name, const char *full_name, | 238 | static void __init offb_init_fb(const char *name, const char *full_name, |
@@ -402,45 +289,39 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
402 | 289 | ||
403 | par->cmap_type = cmap_unknown; | 290 | par->cmap_type = cmap_unknown; |
404 | if (depth == 8) { | 291 | if (depth == 8) { |
405 | |||
406 | /* Palette hacks disabled for now */ | 292 | /* Palette hacks disabled for now */ |
407 | #if 0 | ||
408 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { | 293 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { |
409 | unsigned long regbase = dp->addrs[2].address; | 294 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); |
410 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 295 | if (par->cmap_adr) |
411 | par->cmap_type = cmap_r128; | 296 | par->cmap_type = cmap_r128; |
412 | } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) | 297 | } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) |
413 | || !strncmp(name, "ATY,RageM3p12A", 14))) { | 298 | || !strncmp(name, "ATY,RageM3p12A", 14))) { |
414 | unsigned long regbase = | 299 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); |
415 | dp->parent->addrs[2].address; | 300 | if (par->cmap_adr) |
416 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 301 | par->cmap_type = cmap_M3A; |
417 | par->cmap_type = cmap_M3A; | ||
418 | } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { | 302 | } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { |
419 | unsigned long regbase = | 303 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); |
420 | dp->parent->addrs[2].address; | 304 | if (par->cmap_adr) |
421 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 305 | par->cmap_type = cmap_M3B; |
422 | par->cmap_type = cmap_M3B; | ||
423 | } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { | 306 | } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { |
424 | unsigned long regbase = dp->addrs[1].address; | 307 | par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff); |
425 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 308 | if (par->cmap_adr) |
426 | par->cmap_type = cmap_radeon; | 309 | par->cmap_type = cmap_radeon; |
427 | } else if (!strncmp(name, "ATY,", 4)) { | 310 | } else if (!strncmp(name, "ATY,", 4)) { |
428 | unsigned long base = address & 0xff000000UL; | 311 | unsigned long base = address & 0xff000000UL; |
429 | par->cmap_adr = | 312 | par->cmap_adr = |
430 | ioremap(base + 0x7ff000, 0x1000) + 0xcc0; | 313 | ioremap(base + 0x7ff000, 0x1000) + 0xcc0; |
431 | par->cmap_data = par->cmap_adr + 1; | 314 | par->cmap_data = par->cmap_adr + 1; |
432 | par->cmap_type = cmap_m64; | 315 | par->cmap_type = cmap_m64; |
433 | } else if (device_is_compatible(dp, "pci1014,b7")) { | 316 | } else if (dp && device_is_compatible(dp, "pci1014,b7")) { |
434 | unsigned long regbase = dp->addrs[0].address; | 317 | par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); |
435 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); | 318 | if (par->cmap_adr) |
436 | par->cmap_type = cmap_gxt2000; | 319 | par->cmap_type = cmap_gxt2000; |
437 | } | 320 | } |
438 | #endif | 321 | fix->visual = (par->cmap_type != cmap_unknown) ? |
439 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR | 322 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; |
440 | : FB_VISUAL_STATIC_PSEUDOCOLOR; | ||
441 | } else | 323 | } else |
442 | fix->visual = /* par->cmap_adr ? FB_VISUAL_DIRECTCOLOR | 324 | fix->visual = FB_VISUAL_TRUECOLOR; |
443 | : */ FB_VISUAL_TRUECOLOR; | ||
444 | 325 | ||
445 | var->xoffset = var->yoffset = 0; | 326 | var->xoffset = var->yoffset = 0; |
446 | switch (depth) { | 327 | switch (depth) { |
@@ -520,5 +401,139 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
520 | info->node, full_name); | 401 | info->node, full_name); |
521 | } | 402 | } |
522 | 403 | ||
404 | |||
405 | static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | ||
406 | { | ||
407 | unsigned int len; | ||
408 | int i, width = 640, height = 480, depth = 8, pitch = 640; | ||
409 | unsigned int flags, rsize, addr_prop = 0; | ||
410 | unsigned long max_size = 0; | ||
411 | u64 rstart, address = OF_BAD_ADDR; | ||
412 | u32 *pp, *addrp, *up; | ||
413 | u64 asize; | ||
414 | |||
415 | pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); | ||
416 | if (pp == NULL) | ||
417 | pp = (u32 *)get_property(dp, "depth", &len); | ||
418 | if (pp && len == sizeof(u32)) | ||
419 | depth = *pp; | ||
420 | |||
421 | pp = (u32 *)get_property(dp, "linux,bootx-width", &len); | ||
422 | if (pp == NULL) | ||
423 | pp = (u32 *)get_property(dp, "width", &len); | ||
424 | if (pp && len == sizeof(u32)) | ||
425 | width = *pp; | ||
426 | |||
427 | pp = (u32 *)get_property(dp, "linux,bootx-height", &len); | ||
428 | if (pp == NULL) | ||
429 | pp = (u32 *)get_property(dp, "height", &len); | ||
430 | if (pp && len == sizeof(u32)) | ||
431 | height = *pp; | ||
432 | |||
433 | pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); | ||
434 | if (pp == NULL) | ||
435 | pp = (u32 *)get_property(dp, "linebytes", &len); | ||
436 | if (pp && len == sizeof(u32)) | ||
437 | pitch = *pp; | ||
438 | else | ||
439 | pitch = width * ((depth + 7) / 8); | ||
440 | |||
441 | rsize = (unsigned long)pitch * (unsigned long)height; | ||
442 | |||
443 | /* Ok, now we try to figure out the address of the framebuffer. | ||
444 | * | ||
445 | * Unfortunately, Open Firmware doesn't provide a standard way to do | ||
446 | * so. All we can do is a dodgy heuristic that happens to work in | ||
447 | * practice. On most machines, the "address" property contains what | ||
448 | * we need, though not on Matrox cards found in IBM machines. What I've | ||
449 | * found that appears to give good results is to go through the PCI | ||
450 | * ranges and pick one that is both big enough and if possible encloses | ||
451 | * the "address" property. If none match, we pick the biggest | ||
452 | */ | ||
453 | up = (u32 *)get_property(dp, "linux,bootx-addr", &len); | ||
454 | if (up == NULL) | ||
455 | up = (u32 *)get_property(dp, "address", &len); | ||
456 | if (up && len == sizeof(u32)) | ||
457 | addr_prop = *up; | ||
458 | |||
459 | /* Hack for when BootX is passing us */ | ||
460 | if (no_real_node) | ||
461 | goto skip_addr; | ||
462 | |||
463 | for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) | ||
464 | != NULL; i++) { | ||
465 | int match_addrp = 0; | ||
466 | |||
467 | if (!(flags & IORESOURCE_MEM)) | ||
468 | continue; | ||
469 | if (asize < rsize) | ||
470 | continue; | ||
471 | rstart = of_translate_address(dp, addrp); | ||
472 | if (rstart == OF_BAD_ADDR) | ||
473 | continue; | ||
474 | if (addr_prop && (rstart <= addr_prop) && | ||
475 | ((rstart + asize) >= (addr_prop + rsize))) | ||
476 | match_addrp = 1; | ||
477 | if (match_addrp) { | ||
478 | address = addr_prop; | ||
479 | break; | ||
480 | } | ||
481 | if (rsize > max_size) { | ||
482 | max_size = rsize; | ||
483 | address = OF_BAD_ADDR; | ||
484 | } | ||
485 | |||
486 | if (address == OF_BAD_ADDR) | ||
487 | address = rstart; | ||
488 | } | ||
489 | skip_addr: | ||
490 | if (address == OF_BAD_ADDR && addr_prop) | ||
491 | address = (u64)addr_prop; | ||
492 | if (address != OF_BAD_ADDR) { | ||
493 | /* kludge for valkyrie */ | ||
494 | if (strcmp(dp->name, "valkyrie") == 0) | ||
495 | address += 0x1000; | ||
496 | offb_init_fb(no_real_node ? "bootx" : dp->name, | ||
497 | no_real_node ? "display" : dp->full_name, | ||
498 | width, height, depth, pitch, address, | ||
499 | no_real_node ? dp : NULL); | ||
500 | } | ||
501 | } | ||
502 | |||
503 | static int __init offb_init(void) | ||
504 | { | ||
505 | struct device_node *dp = NULL, *boot_disp = NULL; | ||
506 | |||
507 | if (fb_get_options("offb", NULL)) | ||
508 | return -ENODEV; | ||
509 | |||
510 | /* Check if we have a MacOS display without a node spec */ | ||
511 | if (get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) { | ||
512 | /* The old code tried to work out which node was the MacOS | ||
513 | * display based on the address. I'm dropping that since the | ||
514 | * lack of a node spec only happens with old BootX versions | ||
515 | * (users can update) and with this code, they'll still get | ||
516 | * a display (just not the palette hacks). | ||
517 | */ | ||
518 | offb_init_nodriver(of_chosen, 1); | ||
519 | } | ||
520 | |||
521 | for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { | ||
522 | if (get_property(dp, "linux,opened", NULL) && | ||
523 | get_property(dp, "linux,boot-display", NULL)) { | ||
524 | boot_disp = dp; | ||
525 | offb_init_nodriver(dp, 0); | ||
526 | } | ||
527 | } | ||
528 | for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { | ||
529 | if (get_property(dp, "linux,opened", NULL) && | ||
530 | dp != boot_disp) | ||
531 | offb_init_nodriver(dp, 0); | ||
532 | } | ||
533 | |||
534 | return 0; | ||
535 | } | ||
536 | |||
537 | |||
523 | module_init(offb_init); | 538 | module_init(offb_init); |
524 | MODULE_LICENSE("GPL"); | 539 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 33dddbae5420..76fc9d355eb7 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -2132,6 +2132,9 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
2132 | 2132 | ||
2133 | fb_destroy_modedb(info->monspecs.modedb); | 2133 | fb_destroy_modedb(info->monspecs.modedb); |
2134 | info->monspecs.modedb = NULL; | 2134 | info->monspecs.modedb = NULL; |
2135 | |||
2136 | pci_set_drvdata(pd, info); | ||
2137 | riva_bl_init(info->par); | ||
2135 | ret = register_framebuffer(info); | 2138 | ret = register_framebuffer(info); |
2136 | if (ret < 0) { | 2139 | if (ret < 0) { |
2137 | printk(KERN_ERR PFX | 2140 | printk(KERN_ERR PFX |
@@ -2139,8 +2142,6 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
2139 | goto err_iounmap_screen_base; | 2142 | goto err_iounmap_screen_base; |
2140 | } | 2143 | } |
2141 | 2144 | ||
2142 | pci_set_drvdata(pd, info); | ||
2143 | |||
2144 | printk(KERN_INFO PFX | 2145 | printk(KERN_INFO PFX |
2145 | "PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n", | 2146 | "PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n", |
2146 | info->fix.id, | 2147 | info->fix.id, |
@@ -2148,8 +2149,6 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
2148 | info->fix.smem_len / (1024 * 1024), | 2149 | info->fix.smem_len / (1024 * 1024), |
2149 | info->fix.smem_start); | 2150 | info->fix.smem_start); |
2150 | 2151 | ||
2151 | riva_bl_init(info->par); | ||
2152 | |||
2153 | NVTRACE_LEAVE(); | 2152 | NVTRACE_LEAVE(); |
2154 | return 0; | 2153 | return 0; |
2155 | 2154 | ||