sonypi_device
val8 = sonypi_device.bluetooth_power;
mutex_unlock(&sonypi_device.lock);
switch (sonypi_device.model) {
switch (sonypi_device.model) {
sonypi_device.input_jog_dev = jog_dev = input_allocate_device();
sonypi_device.input_key_dev = key_dev = input_allocate_device();
sonypi_device.input_key_dev = NULL;
sonypi_device.input_jog_dev = NULL;
static int sonypi_setup_ioports(struct sonypi_device *dev,
sonypi_device.region_size,
release_region(check->port1, sonypi_device.region_size);
sonypi_device.region_size,
static int sonypi_setup_irq(struct sonypi_device *dev,
sonypi_device.model,
sonypi_device.irq,
sonypi_device.ioport1, sonypi_device.ioport2);
spin_lock_init(&sonypi_device.fifo_lock);
error = kfifo_alloc(&sonypi_device.fifo, SONYPI_BUF_SIZE, GFP_KERNEL);
init_waitqueue_head(&sonypi_device.fifo_proc_list);
mutex_init(&sonypi_device.lock);
sonypi_device.bluetooth_power = -1;
sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE1;
sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3;
sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3;
sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2;
sonypi_device.dev = pcidev;
if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) {
sonypi_device.region_size = SONYPI_TYPE1_REGION_SIZE;
sonypi_device.evtype_offset = SONYPI_TYPE1_EVTYPE_OFFSET;
} else if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2) {
sonypi_device.region_size = SONYPI_TYPE2_REGION_SIZE;
sonypi_device.evtype_offset = SONYPI_TYPE2_EVTYPE_OFFSET;
sonypi_device.region_size = SONYPI_TYPE3_REGION_SIZE;
sonypi_device.evtype_offset = SONYPI_TYPE3_EVTYPE_OFFSET;
error = sonypi_setup_ioports(&sonypi_device, ioport_list);
error = sonypi_setup_irq(&sonypi_device, irq_list);
spin_lock_init(&sonypi_device.input_fifo_lock);
error = kfifo_alloc(&sonypi_device.input_fifo, SONYPI_BUF_SIZE,
INIT_WORK(&sonypi_device.input_work, input_keyrelease);
input_unregister_device(sonypi_device.input_key_dev);
input_unregister_device(sonypi_device.input_jog_dev);
free_irq(sonypi_device.irq, sonypi_irq);
release_region(sonypi_device.ioport1, sonypi_device.region_size);
kfifo_free(&sonypi_device.fifo);
synchronize_irq(sonypi_device.irq);
flush_work(&sonypi_device.input_work);
input_unregister_device(sonypi_device.input_key_dev);
input_unregister_device(sonypi_device.input_jog_dev);
kfifo_free(&sonypi_device.input_fifo);
free_irq(sonypi_device.irq, sonypi_irq);
release_region(sonypi_device.ioport1, sonypi_device.region_size);
if (sonypi_device.dev) {
pci_disable_device(sonypi_device.dev);
pci_dev_put(sonypi_device.dev);
kfifo_free(&sonypi_device.fifo);
old_camera_power = sonypi_device.camera_power;
} sonypi_device;
pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v);
v = (v & 0xFFFF0000) | ((u32) sonypi_device.ioport1);
pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v);
pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v);
(((u32) sonypi_device.ioport1 ^ sonypi_device.ioport2) << 16);
pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v);
v |= (((u32) sonypi_device.bits) << SONYPI_IRQ_SHIFT);
pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v);
pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v);
if (sonypi_ec_write(SONYPI_SHIB, (sonypi_device.ioport1 & 0xFF00) >> 8))
if (sonypi_ec_write(SONYPI_SLOB, sonypi_device.ioport1 & 0x00FF))
if (sonypi_ec_write(SONYPI_SIRQ, sonypi_device.bits))
v16 = (sonypi_device.ioport1 & 0xFFF0) | 0x01;
pci_write_config_word(sonypi_device.dev, SONYPI_TYPE3_GID2, v16);
pci_read_config_byte(sonypi_device.dev, SONYPI_TYPE3_MISC, &v8);
pci_write_config_byte(sonypi_device.dev, SONYPI_TYPE3_MISC, v8);
pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v);
pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v);
pci_write_config_word(sonypi_device.dev, SONYPI_TYPE3_GID2, 0);
wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG);
outb(dev, sonypi_device.ioport2);
v1 = inb_p(sonypi_device.ioport2);
v2 = inb_p(sonypi_device.ioport1);
wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG);
outb(dev, sonypi_device.ioport2);
wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG);
outb(fn, sonypi_device.ioport1);
v1 = inb_p(sonypi_device.ioport1);
wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG);
outb(dev, sonypi_device.ioport2);
wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG);
outb(fn, sonypi_device.ioport1);
wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG);
outb(v, sonypi_device.ioport1);
v1 = inb_p(sonypi_device.ioport1);
if (!sonypi_device.camera_power)
sonypi_device.camera_power = 0;
if (sonypi_device.camera_power)
sonypi_device.camera_power = 1;
if (sonypi_device.bluetooth_power == state)
sonypi_device.bluetooth_power = state;
while (kfifo_out_locked(&sonypi_device.input_fifo, (unsigned char *)&kp,
sizeof(kp), &sonypi_device.input_fifo_lock)
struct input_dev *jog_dev = sonypi_device.input_jog_dev;
struct input_dev *key_dev = sonypi_device.input_key_dev;
kfifo_in_locked(&sonypi_device.input_fifo,
&sonypi_device.input_fifo_lock);
schedule_work(&sonypi_device.input_work);
v1 = inb_p(sonypi_device.ioport1);
v2 = inb_p(sonypi_device.ioport1 + sonypi_device.evtype_offset);
if (sonypi_device.model != sonypi_eventtypes[i].model)
kfifo_in_locked(&sonypi_device.fifo, (unsigned char *)&event,
sizeof(event), &sonypi_device.fifo_lock);
kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
wake_up_interruptible(&sonypi_device.fifo_proc_list);
return fasync_helper(fd, filp, on, &sonypi_device.fifo_async);
mutex_lock(&sonypi_device.lock);
sonypi_device.open_count--;
mutex_unlock(&sonypi_device.lock);
mutex_lock(&sonypi_device.lock);
if (!sonypi_device.open_count)
kfifo_reset(&sonypi_device.fifo);
sonypi_device.open_count++;
mutex_unlock(&sonypi_device.lock);
if ((kfifo_len(&sonypi_device.fifo) == 0) &&
ret = wait_event_interruptible(sonypi_device.fifo_proc_list,
kfifo_len(&sonypi_device.fifo) != 0);
(kfifo_out_locked(&sonypi_device.fifo, &c, sizeof(c),
&sonypi_device.fifo_lock) == sizeof(c))) {
poll_wait(file, &sonypi_device.fifo_proc_list, wait);
if (kfifo_len(&sonypi_device.fifo))
mutex_lock(&sonypi_device.lock);