Commit 2695c2ac authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://ppc.bkbits.net/for-linus-ppcdrivers

into home.transmeta.com:/home/torvalds/v2.5/linux
parents fa44005c fe2bb3f5
...@@ -29,13 +29,15 @@ ...@@ -29,13 +29,15 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/mediabay.h> #include <asm/mediabay.h>
#include <asm/feature.h> #include <asm/machdep.h>
#include <asm/pmac_feature.h>
#define MAJOR_NR FLOPPY_MAJOR #define MAJOR_NR FLOPPY_MAJOR
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
static int floppy_sizes[2] = {2880,2880}; static int floppy_blocksizes[2] = {512,512};
static int floppy_sizes[2] = {1440,1440};
#define MAX_FLOPPIES 2 #define MAX_FLOPPIES 2
...@@ -312,10 +314,10 @@ static void start_request(struct floppy_state *fs) ...@@ -312,10 +314,10 @@ static void start_request(struct floppy_state *fs)
return; return;
} }
while (!QUEUE_EMPTY && fs->state == idle) { while (!QUEUE_EMPTY && fs->state == idle) {
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed"); panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh && !buffer_locked(CURRENT->bh)) // if (CURRENT->bh && !buffer_locked(CURRENT->bh))
panic(DEVICE_NAME ": block not locked"); // panic(DEVICE_NAME ": block not locked");
#if 0 #if 0
printk("do_fd_req: dev=%x cmd=%d sec=%ld nr_sec=%ld buf=%p\n", printk("do_fd_req: dev=%x cmd=%d sec=%ld nr_sec=%ld buf=%p\n",
kdev_t_to_nr(CURRENT->rq_dev), CURRENT->cmd, kdev_t_to_nr(CURRENT->rq_dev), CURRENT->cmd,
...@@ -337,7 +339,7 @@ static void start_request(struct floppy_state *fs) ...@@ -337,7 +339,7 @@ static void start_request(struct floppy_state *fs)
continue; continue;
} }
if (CURRENT->cmd == WRITE) { if (rq_data_dir(CURRENT) == WRITE) {
if (fs->write_prot < 0) if (fs->write_prot < 0)
fs->write_prot = swim3_readbit(fs, WRITE_PROT); fs->write_prot = swim3_readbit(fs, WRITE_PROT);
if (fs->write_prot) { if (fs->write_prot) {
...@@ -425,7 +427,7 @@ static inline void setup_transfer(struct floppy_state *fs) ...@@ -425,7 +427,7 @@ static inline void setup_transfer(struct floppy_state *fs)
printk(KERN_ERR "swim3: transfer 0 sectors?\n"); printk(KERN_ERR "swim3: transfer 0 sectors?\n");
return; return;
} }
if (CURRENT->cmd == WRITE) if (rq_data_dir(CURRENT) == WRITE)
n = 1; n = 1;
else { else {
n = fs->secpertrack - fs->req_sector + 1; n = fs->secpertrack - fs->req_sector + 1;
...@@ -438,21 +440,21 @@ static inline void setup_transfer(struct floppy_state *fs) ...@@ -438,21 +440,21 @@ static inline void setup_transfer(struct floppy_state *fs)
out_8(&sw->nsect, n); out_8(&sw->nsect, n);
out_8(&sw->gap3, 0); out_8(&sw->gap3, 0);
st_le32(&dr->cmdptr, virt_to_bus(cp)); st_le32(&dr->cmdptr, virt_to_bus(cp));
if (CURRENT->cmd == WRITE) { if (rq_data_dir(CURRENT) == WRITE) {
/* Set up 3 dma commands: write preamble, data, postamble */ /* Set up 3 dma commands: write preamble, data, postamble */
init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble)); init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble));
++cp; ++cp;
init_dma(cp, OUTPUT_MORE, CURRENT->buffer, 512); init_dma(cp, OUTPUT_MORE, CURRENT->buffer, 512);
++cp; ++cp;
init_dma(cp, OUTPUT_MORE, write_postamble, sizeof(write_postamble)); init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble));
} else { } else {
init_dma(cp, INPUT_MORE, CURRENT->buffer, n * 512); init_dma(cp, INPUT_LAST, CURRENT->buffer, n * 512);
} }
++cp; ++cp;
out_le16(&cp->command, DBDMA_STOP); out_le16(&cp->command, DBDMA_STOP);
out_le32(&dr->control, (RUN << 16) | RUN); out_le32(&dr->control, (RUN << 16) | RUN);
out_8(&sw->control_bis, out_8(&sw->control_bis,
(CURRENT->cmd == WRITE? WRITE_SECTORS: 0) | DO_ACTION); (rq_data_dir(CURRENT) == WRITE? WRITE_SECTORS: 0) | DO_ACTION);
/* enable intr when transfer complete */ /* enable intr when transfer complete */
out_8(&sw->intr_enable, ERROR_INTR | TRANSFER_DONE); out_8(&sw->intr_enable, ERROR_INTR | TRANSFER_DONE);
set_timeout(fs, 2*HZ, xfer_timeout); /* enable timeout */ set_timeout(fs, 2*HZ, xfer_timeout); /* enable timeout */
...@@ -591,7 +593,7 @@ static void xfer_timeout(unsigned long data) ...@@ -591,7 +593,7 @@ static void xfer_timeout(unsigned long data)
out_8(&sw->intr_enable, 0); out_8(&sw->intr_enable, 0);
out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION);
out_8(&sw->select, RELAX); out_8(&sw->select, RELAX);
if (CURRENT->cmd == WRITE) if (rq_data_dir(CURRENT) == WRITE)
++cp; ++cp;
if (ld_le16(&cp->xfer_status) != 0) if (ld_le16(&cp->xfer_status) != 0)
s = fs->scount - ((ld_le16(&cp->res_count) + 511) >> 9); s = fs->scount - ((ld_le16(&cp->res_count) + 511) >> 9);
...@@ -600,7 +602,7 @@ static void xfer_timeout(unsigned long data) ...@@ -600,7 +602,7 @@ static void xfer_timeout(unsigned long data)
CURRENT->sector += s; CURRENT->sector += s;
CURRENT->current_nr_sectors -= s; CURRENT->current_nr_sectors -= s;
printk(KERN_ERR "swim3: timeout %sing sector %ld\n", printk(KERN_ERR "swim3: timeout %sing sector %ld\n",
(CURRENT->cmd==WRITE? "writ": "read"), CURRENT->sector); (rq_data_dir(CURRENT)==WRITE? "writ": "read"), CURRENT->sector);
end_request(0); end_request(0);
fs->state = idle; fs->state = idle;
start_request(fs); start_request(fs);
...@@ -621,8 +623,8 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -621,8 +623,8 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
printk("swim3 intr state=%d intr=%x err=%x\n", fs->state, intr, err); printk("swim3 intr state=%d intr=%x err=%x\n", fs->state, intr, err);
#endif #endif
if ((intr & ERROR_INTR) && fs->state != do_transfer) if ((intr & ERROR_INTR) && fs->state != do_transfer)
printk(KERN_ERR "swim3_interrupt, state=%d, cmd=%x, intr=%x, err=%x\n", printk(KERN_ERR "swim3_interrupt, state=%d, dir=%lx, intr=%x, err=%x\n",
fs->state, CURRENT->cmd, intr, err); fs->state, rq_data_dir(CURRENT), intr, err);
switch (fs->state) { switch (fs->state) {
case locating: case locating:
if (intr & SEEN_SECTOR) { if (intr & SEEN_SECTOR) {
...@@ -678,13 +680,16 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -678,13 +680,16 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
break; break;
dr = fs->dma; dr = fs->dma;
cp = fs->dma_cmd; cp = fs->dma_cmd;
st_le32(&dr->control, RUN << 16); /* We must wait a bit for dbdma to complete */
for (n=0; (in_le32(&dr->status) & ACTIVE) && n < 1000; n++)
udelay(10);
DBDMA_DO_STOP(dr);
out_8(&sw->intr_enable, 0); out_8(&sw->intr_enable, 0);
out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION);
out_8(&sw->select, RELAX); out_8(&sw->select, RELAX);
del_timer(&fs->timeout); del_timer(&fs->timeout);
fs->timeout_pending = 0; fs->timeout_pending = 0;
if (CURRENT->cmd == WRITE) if (rq_data_dir(CURRENT) == WRITE)
++cp; ++cp;
stat = ld_le16(&cp->xfer_status); stat = ld_le16(&cp->xfer_status);
resid = ld_le16(&cp->res_count); resid = ld_le16(&cp->res_count);
...@@ -701,7 +706,7 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -701,7 +706,7 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
act(fs); act(fs);
} else { } else {
printk("swim3: error %sing block %ld (err=%x)\n", printk("swim3: error %sing block %ld (err=%x)\n",
CURRENT->cmd == WRITE? "writ": "read", rq_data_dir(CURRENT) == WRITE? "writ": "read",
CURRENT->sector, err); CURRENT->sector, err);
end_request(0); end_request(0);
fs->state = idle; fs->state = idle;
...@@ -710,8 +715,8 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -710,8 +715,8 @@ static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if ((stat & ACTIVE) == 0 || resid != 0) { if ((stat & ACTIVE) == 0 || resid != 0) {
/* musta been an error */ /* musta been an error */
printk(KERN_ERR "swim3: fd dma: stat=%x resid=%d\n", stat, resid); printk(KERN_ERR "swim3: fd dma: stat=%x resid=%d\n", stat, resid);
printk(KERN_ERR " state=%d, cmd=%x, intr=%x, err=%x\n", printk(KERN_ERR " state=%d, dir=%lx, intr=%x, err=%x\n",
fs->state, CURRENT->cmd, intr, err); fs->state, rq_data_dir(CURRENT), intr, err);
end_request(0); end_request(0);
fs->state = idle; fs->state = idle;
start_request(fs); start_request(fs);
...@@ -815,7 +820,7 @@ static int floppy_ioctl(struct inode *inode, struct file *filp, ...@@ -815,7 +820,7 @@ static int floppy_ioctl(struct inode *inode, struct file *filp,
{ {
struct floppy_state *fs; struct floppy_state *fs;
int err; int err;
int devnum = MINOR(inode->i_rdev); int devnum = minor(inode->i_rdev);
if (devnum >= floppy_count) if (devnum >= floppy_count)
return -ENODEV; return -ENODEV;
...@@ -847,7 +852,7 @@ static int floppy_open(struct inode *inode, struct file *filp) ...@@ -847,7 +852,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
struct floppy_state *fs; struct floppy_state *fs;
volatile struct swim3 *sw; volatile struct swim3 *sw;
int n, err; int n, err;
int devnum = MINOR(inode->i_rdev); int devnum = minor(inode->i_rdev);
if (devnum >= floppy_count) if (devnum >= floppy_count)
return -ENODEV; return -ENODEV;
...@@ -921,7 +926,7 @@ static int floppy_release(struct inode *inode, struct file *filp) ...@@ -921,7 +926,7 @@ static int floppy_release(struct inode *inode, struct file *filp)
{ {
struct floppy_state *fs; struct floppy_state *fs;
volatile struct swim3 *sw; volatile struct swim3 *sw;
int devnum = MINOR(inode->i_rdev); int devnum = minor(inode->i_rdev);
if (devnum >= floppy_count) if (devnum >= floppy_count)
return -ENODEV; return -ENODEV;
...@@ -938,9 +943,9 @@ static int floppy_release(struct inode *inode, struct file *filp) ...@@ -938,9 +943,9 @@ static int floppy_release(struct inode *inode, struct file *filp)
static int floppy_check_change(kdev_t dev) static int floppy_check_change(kdev_t dev)
{ {
struct floppy_state *fs; struct floppy_state *fs;
int devnum = MINOR(dev); int devnum = minor(dev);
if (MAJOR(dev) != MAJOR_NR || (devnum >= floppy_count)) if (major(dev) != MAJOR_NR || (devnum >= floppy_count))
return 0; return 0;
fs = &floppy_states[devnum]; fs = &floppy_states[devnum];
...@@ -952,9 +957,9 @@ static int floppy_revalidate(kdev_t dev) ...@@ -952,9 +957,9 @@ static int floppy_revalidate(kdev_t dev)
struct floppy_state *fs; struct floppy_state *fs;
volatile struct swim3 *sw; volatile struct swim3 *sw;
int ret, n; int ret, n;
int devnum = MINOR(dev); int devnum = minor(dev);
if (MAJOR(dev) != MAJOR_NR || (devnum >= floppy_count)) if (major(dev) != MAJOR_NR || (devnum >= floppy_count))
return 0; return 0;
fs = &floppy_states[devnum]; fs = &floppy_states[devnum];
...@@ -1031,8 +1036,8 @@ int swim3_init(void) ...@@ -1031,8 +1036,8 @@ int swim3_init(void)
MAJOR_NR); MAJOR_NR);
return -EBUSY; return -EBUSY;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request, blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&swim3_lock);
&swim3_lock); blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
} }
...@@ -1060,9 +1065,14 @@ static int swim3_add_device(struct device_node *swim) ...@@ -1060,9 +1065,14 @@ static int swim3_add_device(struct device_node *swim)
return -EINVAL; return -EINVAL;
} }
if (!request_OF_resource(swim, 0, NULL)) {
printk(KERN_INFO "swim3: can't request IO resource !\n");
return -EINVAL;
}
mediabay = (strcasecmp(swim->parent->type, "media-bay") == 0) ? swim->parent : NULL; mediabay = (strcasecmp(swim->parent->type, "media-bay") == 0) ? swim->parent : NULL;
if (mediabay == NULL) if (mediabay == NULL)
feature_set(swim, FEATURE_SWIM3_enable); pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1);
memset(fs, 0, sizeof(*fs)); memset(fs, 0, sizeof(*fs));
fs->state = idle; fs->state = idle;
...@@ -1084,14 +1094,14 @@ static int swim3_add_device(struct device_node *swim) ...@@ -1084,14 +1094,14 @@ static int swim3_add_device(struct device_node *swim)
if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) { if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) {
printk(KERN_ERR "Couldn't get irq %d for SWIM3\n", fs->swim3_intr); printk(KERN_ERR "Couldn't get irq %d for SWIM3\n", fs->swim3_intr);
feature_clear(swim, FEATURE_SWIM3_enable); pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0);
return -EBUSY; return -EBUSY;
} }
/* /*
if (request_irq(fs->dma_intr, fd_dma_interrupt, 0, "SWIM3-dma", fs)) { if (request_irq(fs->dma_intr, fd_dma_interrupt, 0, "SWIM3-dma", fs)) {
printk(KERN_ERR "Couldn't get irq %d for SWIM3 DMA", printk(KERN_ERR "Couldn't get irq %d for SWIM3 DMA",
fs->dma_intr); fs->dma_intr);
feature_clear(swim, FEATURE_SWIM3_enable); pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0);
return -EBUSY; return -EBUSY;
} }
*/ */
......
...@@ -32,9 +32,11 @@ obj-$(CONFIG_NVRAM) += nvram.o ...@@ -32,9 +32,11 @@ obj-$(CONFIG_NVRAM) += nvram.o
obj-$(CONFIG_MAC_HID) += mac_hid.o obj-$(CONFIG_MAC_HID) += mac_hid.o
obj-$(CONFIG_INPUT_ADBHID) += adbhid.o obj-$(CONFIG_INPUT_ADBHID) += adbhid.o
obj-$(CONFIG_PPC_RTC) += rtc.o obj-$(CONFIG_PPC_RTC) += rtc.o
obj-$(CONFIG_ANSLCD) += ans-lcd.o
obj-$(CONFIG_ADB_PMU) += via-pmu.o obj-$(CONFIG_ADB_PMU) += via-pmu.o
obj-$(CONFIG_ADB_CUDA) += via-cuda.o obj-$(CONFIG_ADB_CUDA) += via-cuda.o
obj-$(CONFIG_PMAC_APM_EMU) += apm_emu.o
obj-$(CONFIG_ADB) += adb.o obj-$(CONFIG_ADB) += adb.o
obj-$(CONFIG_ADB_KEYBOARD) += mac_keyb.o obj-$(CONFIG_ADB_KEYBOARD) += mac_keyb.o
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/completion.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
#include <asm/prom.h> #include <asm/prom.h>
...@@ -77,8 +78,8 @@ struct notifier_block *adb_client_list = NULL; ...@@ -77,8 +78,8 @@ struct notifier_block *adb_client_list = NULL;
static int adb_got_sleep = 0; static int adb_got_sleep = 0;
static int adb_inited = 0; static int adb_inited = 0;
static pid_t adb_probe_task_pid; static pid_t adb_probe_task_pid;
static unsigned long adb_probe_task_flag; static DECLARE_MUTEX(adb_probe_mutex);
static wait_queue_head_t adb_probe_task_wq; static struct completion adb_probe_task_comp;
static int sleepy_trackpad; static int sleepy_trackpad;
int __adb_probe_sync; int __adb_probe_sync;
...@@ -241,7 +242,8 @@ adb_probe_task(void *x) ...@@ -241,7 +242,8 @@ adb_probe_task(void *x)
printk(KERN_INFO "adb: finished probe task...\n"); printk(KERN_INFO "adb: finished probe task...\n");
adb_probe_task_pid = 0; adb_probe_task_pid = 0;
clear_bit(0, &adb_probe_task_flag); up(&adb_probe_mutex);
return 0; return 0;
} }
...@@ -264,13 +266,7 @@ adb_reset_bus(void) ...@@ -264,13 +266,7 @@ adb_reset_bus(void)
return 0; return 0;
} }
/* We need to get a lock on the probe thread */ down(&adb_probe_mutex);
while (test_and_set_bit(0, &adb_probe_task_flag))
schedule();
/* Just wait for PID to be 0 just in case (possible race) */
while (adb_probe_task_pid != 0)
schedule();
/* Create probe thread as a child of keventd */ /* Create probe thread as a child of keventd */
if (current_is_keventd()) if (current_is_keventd())
...@@ -318,7 +314,7 @@ int __init adb_init(void) ...@@ -318,7 +314,7 @@ int __init adb_init(void)
if (machine_is_compatible("AAPL,PowerBook1998") || if (machine_is_compatible("AAPL,PowerBook1998") ||
machine_is_compatible("PowerBook1,1")) machine_is_compatible("PowerBook1,1"))
sleepy_trackpad = 1; sleepy_trackpad = 1;
init_waitqueue_head(&adb_probe_task_wq); init_completion(&adb_probe_task_comp);
adbdev_init(); adbdev_init();
adb_reset_bus(); adb_reset_bus();
} }
...@@ -340,21 +336,20 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when) ...@@ -340,21 +336,20 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
case PBOOK_SLEEP_REQUEST: case PBOOK_SLEEP_REQUEST:
adb_got_sleep = 1; adb_got_sleep = 1;
/* We need to get a lock on the probe thread */ /* We need to get a lock on the probe thread */
while (test_and_set_bit(0, &adb_probe_task_flag)) down(&adb_probe_mutex);
schedule(); /* Stop autopoll */
/* Just wait for PID to be 0 just in case (possible race) */
while (adb_probe_task_pid != 0)
schedule();
if (adb_controller->autopoll) if (adb_controller->autopoll)
adb_controller->autopoll(0); adb_controller->autopoll(0);
ret = notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL); ret = notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL);
if (ret & NOTIFY_STOP_MASK) if (ret & NOTIFY_STOP_MASK) {
up(&adb_probe_mutex);
return PBOOK_SLEEP_REFUSE; return PBOOK_SLEEP_REFUSE;
}
break; break;
case PBOOK_SLEEP_REJECT: case PBOOK_SLEEP_REJECT:
if (adb_got_sleep) { if (adb_got_sleep) {
adb_got_sleep = 0; adb_got_sleep = 0;
clear_bit(0, &adb_probe_task_flag); up(&adb_probe_mutex);
adb_reset_bus(); adb_reset_bus();
} }
break; break;
...@@ -363,7 +358,7 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when) ...@@ -363,7 +358,7 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
break; break;
case PBOOK_WAKE: case PBOOK_WAKE:
adb_got_sleep = 0; adb_got_sleep = 0;
clear_bit(0, &adb_probe_task_flag); up(&adb_probe_mutex);
adb_reset_bus(); adb_reset_bus();
break; break;
} }
...@@ -435,9 +430,10 @@ adb_poll(void) ...@@ -435,9 +430,10 @@ adb_poll(void)
static void static void
adb_probe_wakeup(struct adb_request *req) adb_probe_wakeup(struct adb_request *req)
{ {
wake_up(&adb_probe_task_wq); complete(&adb_probe_task_comp);
} }
/* Static request used during probe */
static struct adb_request adb_sreq; static struct adb_request adb_sreq;
static unsigned long adb_sreq_lock; // Use semaphore ! */ static unsigned long adb_sreq_lock; // Use semaphore ! */
...@@ -484,20 +480,11 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *), ...@@ -484,20 +480,11 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *),
if ((flags & ADBREQ_SYNC) && if ((flags & ADBREQ_SYNC) &&
(current->pid && adb_probe_task_pid && (current->pid && adb_probe_task_pid &&
adb_probe_task_pid == current->pid)) { adb_probe_task_pid == current->pid)) {
DECLARE_WAITQUEUE(wait, current);
req->done = adb_probe_wakeup; req->done = adb_probe_wakeup;
add_wait_queue(&adb_probe_task_wq, &wait);
rc = adb_controller->send_request(req, 0); rc = adb_controller->send_request(req, 0);
if (rc || req->complete) if (rc || req->complete)
goto bail; goto bail;
for (;;) { wait_for_completion(&adb_probe_task_comp);
set_current_state(TASK_UNINTERRUPTIBLE);
if (req->complete)
break;
schedule();
}
current->state = TASK_RUNNING;
remove_wait_queue(&adb_probe_task_wq, &wait);
rc = 0; rc = 0;
goto bail; goto bail;
} }
...@@ -652,7 +639,7 @@ static int adb_open(struct inode *inode, struct file *file) ...@@ -652,7 +639,7 @@ static int adb_open(struct inode *inode, struct file *file)
{ {
struct adbdev_state *state; struct adbdev_state *state;
if (MINOR(inode->i_rdev) > 0 || adb_controller == NULL) if (minor(inode->i_rdev) > 0 || adb_controller == NULL)
return -ENXIO; return -ENXIO;
state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
if (state == 0) if (state == 0)
...@@ -672,6 +659,7 @@ static int adb_release(struct inode *inode, struct file *file) ...@@ -672,6 +659,7 @@ static int adb_release(struct inode *inode, struct file *file)
struct adbdev_state *state = file->private_data; struct adbdev_state *state = file->private_data;
unsigned long flags; unsigned long flags;
lock_kernel();
if (state) { if (state) {
file->private_data = NULL; file->private_data = NULL;
spin_lock_irqsave(&state->lock, flags); spin_lock_irqsave(&state->lock, flags);
...@@ -684,6 +672,7 @@ static int adb_release(struct inode *inode, struct file *file) ...@@ -684,6 +672,7 @@ static int adb_release(struct inode *inode, struct file *file)
spin_unlock_irqrestore(&state->lock, flags); spin_unlock_irqrestore(&state->lock, flags);
} }
} }
unlock_kernel();
return 0; return 0;
} }
...@@ -705,17 +694,16 @@ static ssize_t adb_read(struct file *file, char *buf, ...@@ -705,17 +694,16 @@ static ssize_t adb_read(struct file *file, char *buf,
return ret; return ret;
req = NULL; req = NULL;
spin_lock_irqsave(&state->lock, flags);
add_wait_queue(&state->wait_queue, &wait); add_wait_queue(&state->wait_queue, &wait);
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
for (;;) { for (;;) {
spin_lock_irqsave(&state->lock, flags);
req = state->completed; req = state->completed;
if (req != NULL) if (req != NULL)
state->completed = req->next; state->completed = req->next;
else if (atomic_read(&state->n_pending) == 0) else if (atomic_read(&state->n_pending) == 0)
ret = -EIO; ret = -EIO;
spin_unlock_irqrestore(&state->lock, flags);
if (req != NULL || ret != 0) if (req != NULL || ret != 0)
break; break;
...@@ -727,11 +715,14 @@ static ssize_t adb_read(struct file *file, char *buf, ...@@ -727,11 +715,14 @@ static ssize_t adb_read(struct file *file, char *buf,
ret = -ERESTARTSYS; ret = -ERESTARTSYS;
break; break;
} }
spin_unlock_irqrestore(&state->lock, flags);
schedule(); schedule();
spin_lock_irqsave(&state->lock, flags);
} }
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
remove_wait_queue(&state->wait_queue, &wait); remove_wait_queue(&state->wait_queue, &wait);
spin_unlock_irqrestore(&state->lock, flags);
if (ret) if (ret)
return ret; return ret;
...@@ -755,6 +746,8 @@ static ssize_t adb_write(struct file *file, const char *buf, ...@@ -755,6 +746,8 @@ static ssize_t adb_write(struct file *file, const char *buf,
if (count < 2 || count > sizeof(req->data)) if (count < 2 || count > sizeof(req->data))
return -EINVAL; return -EINVAL;
if (adb_controller == NULL)
return -ENXIO;
ret = verify_area(VERIFY_READ, buf, count); ret = verify_area(VERIFY_READ, buf, count);
if (ret) if (ret)
return ret; return ret;
...@@ -774,7 +767,10 @@ static ssize_t adb_write(struct file *file, const char *buf, ...@@ -774,7 +767,10 @@ static ssize_t adb_write(struct file *file, const char *buf,
goto out; goto out;
atomic_inc(&state->n_pending); atomic_inc(&state->n_pending);
if (adb_controller == NULL) return -ENXIO;
/* If a probe is in progress or we are sleeping, wait for it to complete */
down(&adb_probe_mutex);
up(&adb_probe_mutex);
/* Special case for ADB_BUSRESET request, all others are sent to /* Special case for ADB_BUSRESET request, all others are sent to
the controller */ the controller */
...@@ -782,6 +778,8 @@ static ssize_t adb_write(struct file *file, const char *buf, ...@@ -782,6 +778,8 @@ static ssize_t adb_write(struct file *file, const char *buf,
&&(req->data[1] == ADB_BUSRESET)) { &&(req->data[1] == ADB_BUSRESET)) {
ret = do_adb_reset_bus(); ret = do_adb_reset_bus();
atomic_dec(&state->n_pending); atomic_dec(&state->n_pending);
if (ret == 0)
ret = count;
goto out; goto out;
} else { } else {
req->reply_expected = ((req->data[1] & 0xc) == 0xc); req->reply_expected = ((req->data[1] & 0xc) == 0xc);
......
...@@ -96,6 +96,11 @@ static struct adb_ids keyboard_ids; ...@@ -96,6 +96,11 @@ static struct adb_ids keyboard_ids;
static struct adb_ids mouse_ids; static struct adb_ids mouse_ids;
static struct adb_ids buttons_ids; static struct adb_ids buttons_ids;
#ifdef CONFIG_PMAC_BACKLIGHT
/* Exported to via-pmu.c */
int disable_kernel_backlight = 0;
#endif /* CONFIG_PMAC_BACKLIGHT */
/* Kind of keyboard, see Apple technote 1152 */ /* Kind of keyboard, see Apple technote 1152 */
#define ADB_KEYBOARD_UNKNOWN 0 #define ADB_KEYBOARD_UNKNOWN 0
#define ADB_KEYBOARD_ANSI 0x0100 #define ADB_KEYBOARD_ANSI 0x0100
...@@ -273,35 +278,49 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto ...@@ -273,35 +278,49 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
break; break;
case 0x1f: /* Powerbook button device */ case 0x1f: /* Powerbook button device */
{ {
int down = (data[1] == (data[1] & 0xf));
#ifdef CONFIG_PMAC_BACKLIGHT #ifdef CONFIG_PMAC_BACKLIGHT
int backlight = get_backlight_level(); int backlight = get_backlight_level();
#endif
/* /*
* XXX: Where is the contrast control for the passive? * XXX: Where is the contrast control for the passive?
* -- Cort * -- Cort
*/ */
switch (data[1]) { switch (data[1] & 0x0f) {
case 0x8: /* mute */ case 0x8: /* mute */
input_report_key(&adbhid[id]->input, KEY_MUTE, down);
break; break;
case 0x7: /* contrast decrease */ case 0x7: /* volume decrease */
input_report_key(&adbhid[id]->input, KEY_VOLUMEDOWN, down);
break; break;
case 0x6: /* contrast increase */ case 0x6: /* volume increase */
input_report_key(&adbhid[id]->input, KEY_VOLUMEUP, down);
break; break;
case 0xb: /* eject */
input_report_key(&adbhid[id]->input, KEY_EJECTCD, down);
break;
case 0xa: /* brightness decrease */ case 0xa: /* brightness decrease */
if (backlight < 0) #ifdef CONFIG_PMAC_BACKLIGHT
if (!disable_kernel_backlight) {
if (!down || backlight < 0)
break; break;
if (backlight > BACKLIGHT_OFF) if (backlight > BACKLIGHT_OFF)
set_backlight_level(backlight-1); set_backlight_level(backlight-1);
else else
set_backlight_level(BACKLIGHT_OFF); set_backlight_level(BACKLIGHT_OFF);
break; break;
}
#endif /* CONFIG_PMAC_BACKLIGHT */
input_report_key(&adbhid[id]->input, KEY_BRIGHTNESSDOWN, down);
break;
case 0x9: /* brightness increase */ case 0x9: /* brightness increase */
if (backlight < 0) #ifdef CONFIG_PMAC_BACKLIGHT
if (!disable_kernel_backlight) {
if (!down || backlight < 0)
break; break;
if (backlight < BACKLIGHT_MAX) if (backlight < BACKLIGHT_MAX)
set_backlight_level(backlight+1); set_backlight_level(backlight+1);
...@@ -310,6 +329,9 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto ...@@ -310,6 +329,9 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
break; break;
} }
#endif /* CONFIG_PMAC_BACKLIGHT */ #endif /* CONFIG_PMAC_BACKLIGHT */
input_report_key(&adbhid[id]->input, KEY_BRIGHTNESSUP, down);
break;
}
} }
break; break;
} }
...@@ -504,6 +526,13 @@ adbhid_input_register(int id, int default_id, int original_handler_id, ...@@ -504,6 +526,13 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
case 0x1f: /* Powerbook button device */ case 0x1f: /* Powerbook button device */
sprintf(adbhid[id]->name, "ADB Powerbook buttons on ID %d:%d.%02x", sprintf(adbhid[id]->name, "ADB Powerbook buttons on ID %d:%d.%02x",
id, default_id, original_handler_id); id, default_id, original_handler_id);
adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
set_bit(KEY_MUTE, adbhid[id]->input.keybit);
set_bit(KEY_VOLUMEUP, adbhid[id]->input.keybit);
set_bit(KEY_VOLUMEDOWN, adbhid[id]->input.keybit);
set_bit(KEY_BRIGHTNESSUP, adbhid[id]->input.keybit);
set_bit(KEY_BRIGHTNESSDOWN, adbhid[id]->input.keybit);
set_bit(KEY_EJECTCD, adbhid[id]->input.keybit);
break; break;
} }
if (adbhid[id]->name[0]) if (adbhid[id]->name[0])
...@@ -542,16 +571,38 @@ static void adbhid_input_unregister(int id) ...@@ -542,16 +571,38 @@ static void adbhid_input_unregister(int id)
} }
static u16
adbhid_input_reregister(int id, int default_id, int org_handler_id,
int cur_handler_id, int mk)
{
if (adbhid[id]) {
if (adbhid[id]->input.idproduct !=
((id << 12)|(default_id << 8)|org_handler_id)) {
adbhid_input_unregister(id);
adbhid_input_register(id, default_id, org_handler_id,
cur_handler_id, mk);
}
} else
adbhid_input_register(id, default_id, org_handler_id,
cur_handler_id, mk);
return 1<<id;
}
static void
adbhid_input_devcleanup(u16 exist)
{
int i;
for(i=1; i<16; i++)
if (adbhid[i] && !(exist&(1<<i)))
adbhid_input_unregister(i);
}
static void static void
adbhid_probe(void) adbhid_probe(void)
{ {
struct adb_request req; struct adb_request req;
int i, default_id, org_handler_id, cur_handler_id; int i, default_id, org_handler_id, cur_handler_id;
u16 reg = 0;
for (i = 1; i < 16; i++) {
if (adbhid[i])
adbhid_input_unregister(i);
}
adb_register(ADB_MOUSE, 0, &mouse_ids, adbhid_mouse_input); adb_register(ADB_MOUSE, 0, &mouse_ids, adbhid_mouse_input);
adb_register(ADB_KEYBOARD, 0, &keyboard_ids, adbhid_keyboard_input); adb_register(ADB_KEYBOARD, 0, &keyboard_ids, adbhid_keyboard_input);
...@@ -580,14 +631,14 @@ adbhid_probe(void) ...@@ -580,14 +631,14 @@ adbhid_probe(void)
printk("ADB keyboard at %d, handler 1\n", id); printk("ADB keyboard at %d, handler 1\n", id);
adb_get_infos(id, &default_id, &cur_handler_id); adb_get_infos(id, &default_id, &cur_handler_id);
adbhid_input_register(id, default_id, org_handler_id, cur_handler_id, 0); reg |= adbhid_input_reregister(id, default_id, org_handler_id, cur_handler_id, 0);
} }
for (i = 0; i < buttons_ids.nids; i++) { for (i = 0; i < buttons_ids.nids; i++) {
int id = buttons_ids.id[i]; int id = buttons_ids.id[i];
adb_get_infos(id, &default_id, &org_handler_id); adb_get_infos(id, &default_id, &org_handler_id);
adbhid_input_register(id, default_id, org_handler_id, org_handler_id, 0); reg |= adbhid_input_reregister(id, default_id, org_handler_id, org_handler_id, 0);
} }
/* Try to switch all mice to handler 4, or 2 for three-button /* Try to switch all mice to handler 4, or 2 for three-button
...@@ -676,9 +727,10 @@ adbhid_probe(void) ...@@ -676,9 +727,10 @@ adbhid_probe(void)
printk("\n"); printk("\n");
adb_get_infos(id, &default_id, &cur_handler_id); adb_get_infos(id, &default_id, &cur_handler_id);
adbhid_input_register(id, default_id, org_handler_id, reg |= adbhid_input_reregister(id, default_id, org_handler_id,
cur_handler_id, mouse_kind); cur_handler_id, mouse_kind);
} }
adbhid_input_devcleanup(reg);
} }
static void static void
......
/*
* /dev/lcd driver for Apple Network Servers.
*/
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/ans-lcd.h>
#include <asm/io.h>
#define ANSLCD_ADDR 0xf301c000
#define ANSLCD_CTRL_IX 0x00
#define ANSLCD_DATA_IX 0x10
static unsigned long anslcd_short_delay = 80;
static unsigned long anslcd_long_delay = 3280;
static volatile unsigned char* anslcd_ptr;
#undef DEBUG
static void __pmac
anslcd_write_byte_ctrl ( unsigned char c )
{
#ifdef DEBUG
printk(KERN_DEBUG "LCD: CTRL byte: %02x\n",c);
#endif
out_8(anslcd_ptr + ANSLCD_CTRL_IX, c);
switch(c) {
case 1:
case 2:
case 3:
udelay(anslcd_long_delay); break;
default: udelay(anslcd_short_delay);
}
}
static void __pmac
anslcd_write_byte_data ( unsigned char c )
{
out_8(anslcd_ptr + ANSLCD_DATA_IX, c);
udelay(anslcd_short_delay);
}
static ssize_t __pmac
anslcd_write( struct file * file, const char * buf,
size_t count, loff_t *ppos )
{
const char * p = buf;
int i;
#ifdef DEBUG
printk(KERN_DEBUG "LCD: write\n");
#endif
if ( verify_area(VERIFY_READ, buf, count) )
return -EFAULT;
for ( i = *ppos; count > 0; ++i, ++p, --count )
{
char c;
__get_user(c, p);
anslcd_write_byte_data( c );
}
*ppos = i;
return p - buf;
}
static int __pmac
anslcd_ioctl( struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg )
{
char ch, *temp;
#ifdef DEBUG
printk(KERN_DEBUG "LCD: ioctl(%d,%d)\n",cmd,arg);
#endif
switch ( cmd )
{
case ANSLCD_CLEAR:
anslcd_write_byte_ctrl ( 0x38 );
anslcd_write_byte_ctrl ( 0x0f );
anslcd_write_byte_ctrl ( 0x06 );
anslcd_write_byte_ctrl ( 0x01 );
anslcd_write_byte_ctrl ( 0x02 );
return 0;
case ANSLCD_SENDCTRL:
temp = (char *) arg;
__get_user(ch, temp);
for (; ch; temp++) { /* FIXME: This is ugly, but should work, as a \0 byte is not a valid command code */
anslcd_write_byte_ctrl ( ch );
__get_user(ch, temp);
}
return 0;
case ANSLCD_SETSHORTDELAY:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
anslcd_short_delay=arg;
return 0;
case ANSLCD_SETLONGDELAY:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
anslcd_long_delay=arg;
return 0;
default:
return -EINVAL;
}
}
static int __pmac
anslcd_open( struct inode * inode, struct file * file )
{
return 0;
}
struct file_operations anslcd_fops = {
write: anslcd_write,
ioctl: anslcd_ioctl,
open: anslcd_open,
};
static struct miscdevice anslcd_dev = {
ANSLCD_MINOR,
"anslcd",
&anslcd_fops
};
const char anslcd_logo[] = "********************" /* Line #1 */
"* LINUX! *" /* Line #3 */
"* Welcome to *" /* Line #2 */
"********************"; /* Line #4 */
int __init
anslcd_init(void)
{
int a;
struct device_node* node;
node = find_devices("lcd");
if (!node || !node->parent)
return -ENODEV;
if (strcmp(node->parent->name, "gc"))
return -ENODEV;
anslcd_ptr = (volatile unsigned char*)ioremap(ANSLCD_ADDR, 0x20);
misc_register(&anslcd_dev);
#ifdef DEBUG
printk(KERN_DEBUG "LCD: init\n");
#endif
anslcd_write_byte_ctrl ( 0x38 );
anslcd_write_byte_ctrl ( 0x0c );
anslcd_write_byte_ctrl ( 0x06 );
anslcd_write_byte_ctrl ( 0x01 );
anslcd_write_byte_ctrl ( 0x02 );
for(a=0;a<80;a++) {
anslcd_write_byte_data(anslcd_logo[a]);
}
return 0;
}
__initcall(anslcd_init);
This diff is collapsed.
...@@ -200,15 +200,16 @@ static unsigned char e0_keys[128] = { ...@@ -200,15 +200,16 @@ static unsigned char e0_keys[128] = {
0, 0, 0, KEY_KPCOMMA, 0, KEY_INTL3, 0, 0, /* 0x00-0x07 */ 0, 0, 0, KEY_KPCOMMA, 0, KEY_INTL3, 0, 0, /* 0x00-0x07 */
0, 0, 0, 0, KEY_LANG1, KEY_LANG2, 0, 0, /* 0x08-0x0f */ 0, 0, 0, 0, KEY_LANG1, KEY_LANG2, 0, 0, /* 0x08-0x0f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, 0, 0, /* 0x18-0x1f */ 0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, KEY_VOLUMEUP, 0,/* 0x18-0x1f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */ 0, 0, 0, 0, 0, KEY_VOLUMEDOWN, KEY_MUTE, 0, /* 0x20-0x27 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
0, 0, 0, 0, 0, KEY_KPSLASH, 0, KEY_SYSRQ, /* 0x30-0x37 */ 0, 0, 0, 0, 0, KEY_KPSLASH, 0, KEY_SYSRQ, /* 0x30-0x37 */
KEY_RIGHTALT, 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f */ KEY_RIGHTALT, KEY_BRIGHTNESSUP, KEY_BRIGHTNESSDOWN,
KEY_EJECTCD, 0, 0, 0, 0, /* 0x38-0x3f */
0, 0, 0, 0, 0, 0, 0, KEY_HOME, /* 0x40-0x47 */ 0, 0, 0, 0, 0, 0, 0, KEY_HOME, /* 0x40-0x47 */
KEY_UP, KEY_PAGEUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, /* 0x48-0x4f */ KEY_UP, KEY_PAGEUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, /* 0x48-0x4f */
KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0, 0, 0, 0, /* 0x50-0x57 */ KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0, 0, 0, 0, /* 0x50-0x57 */
0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, 0, 0, /* 0x58-0x5f */ 0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, KEY_POWER, 0, /* 0x58-0x5f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
0, 0, 0, 0, 0, 0, 0, KEY_MACRO, /* 0x68-0x6f */ 0, 0, 0, 0, 0, 0, 0, KEY_MACRO, /* 0x68-0x6f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
......
This diff is collapsed.
...@@ -111,8 +111,8 @@ struct mac_serial { ...@@ -111,8 +111,8 @@ struct mac_serial {
char kgdb_channel; /* Kgdb is running on this channel */ char kgdb_channel; /* Kgdb is running on this channel */
char is_cons; /* Is this our console. */ char is_cons; /* Is this our console. */
char is_internal_modem; /* is connected to an internal modem */ char is_internal_modem; /* is connected to an internal modem */
char is_cobalt_modem; /* is a gatwick-based cobalt modem */
char is_irda; /* is connected to an IrDA codec */ char is_irda; /* is connected to an IrDA codec */
int port_type; /* Port type for pmac_feature */
unsigned char tx_active; /* character is being xmitted */ unsigned char tx_active; /* character is being xmitted */
unsigned char tx_stopped; /* output is suspended */ unsigned char tx_stopped; /* output is suspended */
unsigned char power_wait; /* waiting for power-up delay to expire */ unsigned char power_wait; /* waiting for power-up delay to expire */
......
This diff is collapsed.
...@@ -40,8 +40,7 @@ void get_rtc_time(struct rtc_time *t) ...@@ -40,8 +40,7 @@ void get_rtc_time(struct rtc_time *t)
to_tm(nowtime, t); to_tm(nowtime, t);
t->tm_year -= 1900; t->tm_year -= 1900;
t->tm_mon -= 1; t->tm_mon -= 1; /* Make sure userland has a 0-based month */
t->tm_wday -= 1;
} }
/* Set the current date and time in the real time clock. */ /* Set the current date and time in the real time clock. */
...@@ -49,7 +48,8 @@ void set_rtc_time(struct rtc_time *t) ...@@ -49,7 +48,8 @@ void set_rtc_time(struct rtc_time *t)
{ {
unsigned long nowtime; unsigned long nowtime;
nowtime = mktime(t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); nowtime = mktime(t->tm_year+1900, t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
(ppc_md.set_rtc_time)(nowtime); (ppc_md.set_rtc_time)(nowtime);
} }
......
...@@ -125,7 +125,7 @@ struct adb_driver via_cuda_driver = { ...@@ -125,7 +125,7 @@ struct adb_driver via_cuda_driver = {
#endif /* CONFIG_ADB */ #endif /* CONFIG_ADB */
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
int int __init
find_via_cuda(void) find_via_cuda(void)
{ {
int err; int err;
...@@ -186,11 +186,13 @@ find_via_cuda(void) ...@@ -186,11 +186,13 @@ find_via_cuda(void)
} }
#endif /* CONFIG_PPC */ #endif /* CONFIG_PPC */
int via_cuda_start(void) static int __init via_cuda_start(void)
{ {
if (via == NULL) if (via == NULL)
return -ENODEV; return -ENODEV;
request_OF_resource(vias, 0, NULL);
if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) { if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ); printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ);
return -EAGAIN; return -EAGAIN;
...@@ -202,6 +204,8 @@ int via_cuda_start(void) ...@@ -202,6 +204,8 @@ int via_cuda_start(void)
return 0; return 0;
} }
device_initcall(via_cuda_start);
#ifdef CONFIG_ADB #ifdef CONFIG_ADB
static int static int
cuda_probe() cuda_probe()
...@@ -217,7 +221,7 @@ cuda_probe() ...@@ -217,7 +221,7 @@ cuda_probe()
return 0; return 0;
} }
static int static int __init
cuda_init(void) cuda_init(void)
{ {
if (via == NULL) if (via == NULL)
......
This diff is collapsed.
...@@ -2079,7 +2079,6 @@ static int init_planb(struct planb *pb) ...@@ -2079,7 +2079,6 @@ static int init_planb(struct planb *pb)
#endif #endif
pb->tab_size = PLANB_MAXLINES + 40; pb->tab_size = PLANB_MAXLINES + 40;
pb->suspend = 0; pb->suspend = 0;
pb->lock = 0;
init_MUTEX(&pb->lock); init_MUTEX(&pb->lock);
pb->ch1_cmd = 0; pb->ch1_cmd = 0;
pb->ch2_cmd = 0; pb->ch2_cmd = 0;
......
This diff is collapsed.
...@@ -9,20 +9,21 @@ ...@@ -9,20 +9,21 @@
int mesh_detect(Scsi_Host_Template *); int mesh_detect(Scsi_Host_Template *);
int mesh_release(struct Scsi_Host *); int mesh_release(struct Scsi_Host *);
int mesh_command(Scsi_Cmnd *);
int mesh_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); int mesh_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int mesh_abort(Scsi_Cmnd *); int mesh_abort(Scsi_Cmnd *);
int mesh_reset(Scsi_Cmnd *, unsigned int); int mesh_host_reset(Scsi_Cmnd *);
#define SCSI_MESH { \ #define SCSI_MESH { \
proc_name: "mesh", \ proc_name: "mesh", \
name: "MESH", \ name: "MESH", \
detect: mesh_detect, \ detect: mesh_detect, \
release: mesh_release, \ release: mesh_release, \
command: mesh_command, \ command: NULL, \
queuecommand: mesh_queue, \ queuecommand: mesh_queue, \
abort: mesh_abort, \ eh_abort_handler: mesh_abort, \
reset: mesh_reset, \ eh_device_reset_handler: NULL, \
eh_bus_reset_handler: NULL, \
eh_host_reset_handler: mesh_host_reset, \
can_queue: 20, \ can_queue: 20, \
this_id: 7, \ this_id: 7, \
sg_tablesize: SG_ALL, \ sg_tablesize: SG_ALL, \
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
extern int find_via_cuda(void); extern int find_via_cuda(void);
extern int via_cuda_start(void);
extern int cuda_request(struct adb_request *req, extern int cuda_request(struct adb_request *req,
void (*done)(struct adb_request *), int nbytes, ...); void (*done)(struct adb_request *), int nbytes, ...);
extern void cuda_poll(void); extern void cuda_poll(void);
......
...@@ -325,6 +325,9 @@ struct input_event { ...@@ -325,6 +325,9 @@ struct input_event {
#define KEY_UNKNOWN 240 #define KEY_UNKNOWN 240
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define BTN_MISC 0x100 #define BTN_MISC 0x100
#define BTN_0 0x100 #define BTN_0 0x100
#define BTN_1 0x101 #define BTN_1 0x101
......
...@@ -113,11 +113,12 @@ enum { ...@@ -113,11 +113,12 @@ enum {
#define PMU_IOC_HAS_ADB _IOR('B', 4, sizeof(__u32*)) #define PMU_IOC_HAS_ADB _IOR('B', 4, sizeof(__u32*))
/* out param: u32* can_sleep: 0 or 1 */ /* out param: u32* can_sleep: 0 or 1 */
#define PMU_IOC_CAN_SLEEP _IOR('B', 5, sizeof(__u32*)) #define PMU_IOC_CAN_SLEEP _IOR('B', 5, sizeof(__u32*))
/* no param */
#define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, 0)
#ifdef __KERNEL__ #ifdef __KERNEL__
extern int find_via_pmu(void); extern int find_via_pmu(void);
extern int via_pmu_start(void);
extern int pmu_request(struct adb_request *req, extern int pmu_request(struct adb_request *req,
void (*done)(struct adb_request *), int nbytes, ...); void (*done)(struct adb_request *), int nbytes, ...);
...@@ -168,19 +169,41 @@ struct pmu_sleep_notifier ...@@ -168,19 +169,41 @@ struct pmu_sleep_notifier
/* priority levels in notifiers */ /* priority levels in notifiers */
#define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */ #define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */
#define SLEEP_LEVEL_SOUND 90 /* Sound driver */ #define SLEEP_LEVEL_MEDIABAY 90 /* Media bay driver */
#define SLEEP_LEVEL_MEDIABAY 80 /* Media bay driver */ #define SLEEP_LEVEL_BLOCK 80 /* IDE, SCSI */
#define SLEEP_LEVEL_BLOCK 70 /* IDE, SCSI */ #define SLEEP_LEVEL_NET 70 /* bmac, gmac */
#define SLEEP_LEVEL_NET 60 /* bmac */ #define SLEEP_LEVEL_MISC 60 /* Anything else */
#define SLEEP_LEVEL_ADB 50 /* ADB */ #define SLEEP_LEVEL_USERLAND 55 /* Reserved for apm_emu */
#define SLEEP_LEVEL_MISC 30 /* Anything */ #define SLEEP_LEVEL_ADB 50 /* ADB (async) */
#define SLEEP_LEVEL_LAST 0 /* Reserved for apm_emu */ #define SLEEP_LEVEL_SOUND 40 /* Sound driver (blocking) */
/* special register notifier functions */ /* special register notifier functions */
int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier); int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier); int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
#endif /* CONFIG_PMAC_PBOOK */ #define PMU_MAX_BATTERIES 2
/* values for pmu_power_flags */
#define PMU_PWR_AC_PRESENT 0x00000001
/* values for pmu_battery_info.flags */
#define PMU_BATT_PRESENT 0x00000001
#define PMU_BATT_CHARGING 0x00000002
struct pmu_battery_info
{
unsigned int flags;
unsigned int charge; /* current charge */
unsigned int max_charge; /* maximum charge */
signed int current; /* current, positive if charging */
unsigned int voltage; /* voltage */
unsigned int time_remaining; /* remaining time */
};
extern int pmu_battery_count;
extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
extern unsigned int pmu_power_flags;
#endif /* CONFIG_PMAC_PBOOK */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment