Lines Matching refs:sonypi_device

464 static struct sonypi_device {  struct
486 } sonypi_device; argument
557 pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v); in sonypi_type1_srs()
558 v = (v & 0xFFFF0000) | ((u32) sonypi_device.ioport1); in sonypi_type1_srs()
559 pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v); in sonypi_type1_srs()
561 pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v); in sonypi_type1_srs()
563 (((u32) sonypi_device.ioport1 ^ sonypi_device.ioport2) << 16); in sonypi_type1_srs()
564 pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v); in sonypi_type1_srs()
568 v |= (((u32) sonypi_device.bits) << SONYPI_IRQ_SHIFT); in sonypi_type1_srs()
571 pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v); in sonypi_type1_srs()
573 pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v); in sonypi_type1_srs()
578 if (sonypi_ec_write(SONYPI_SHIB, (sonypi_device.ioport1 & 0xFF00) >> 8)) in sonypi_type2_srs()
580 if (sonypi_ec_write(SONYPI_SLOB, sonypi_device.ioport1 & 0x00FF)) in sonypi_type2_srs()
582 if (sonypi_ec_write(SONYPI_SIRQ, sonypi_device.bits)) in sonypi_type2_srs()
597 v16 = (sonypi_device.ioport1 & 0xFFF0) | 0x01; in sonypi_type3_srs()
598 pci_write_config_word(sonypi_device.dev, SONYPI_TYPE3_GID2, v16); in sonypi_type3_srs()
599 pci_read_config_byte(sonypi_device.dev, SONYPI_TYPE3_MISC, &v8); in sonypi_type3_srs()
601 pci_write_config_byte(sonypi_device.dev, SONYPI_TYPE3_MISC, v8); in sonypi_type3_srs()
609 pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v); in sonypi_type1_dis()
611 pci_write_config_dword(sonypi_device.dev, SONYPI_G10A, v); in sonypi_type1_dis()
632 pci_write_config_word(sonypi_device.dev, SONYPI_TYPE3_GID2, 0); in sonypi_type3_dis()
639 wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG); in sonypi_call1()
640 outb(dev, sonypi_device.ioport2); in sonypi_call1()
641 v1 = inb_p(sonypi_device.ioport2); in sonypi_call1()
642 v2 = inb_p(sonypi_device.ioport1); in sonypi_call1()
650 wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG); in sonypi_call2()
651 outb(dev, sonypi_device.ioport2); in sonypi_call2()
652 wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG); in sonypi_call2()
653 outb(fn, sonypi_device.ioport1); in sonypi_call2()
654 v1 = inb_p(sonypi_device.ioport1); in sonypi_call2()
662 wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG); in sonypi_call3()
663 outb(dev, sonypi_device.ioport2); in sonypi_call3()
664 wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG); in sonypi_call3()
665 outb(fn, sonypi_device.ioport1); in sonypi_call3()
666 wait_on_command(0, inb_p(sonypi_device.ioport2) & 2, ITERATIONS_LONG); in sonypi_call3()
667 outb(v, sonypi_device.ioport1); in sonypi_call3()
668 v1 = inb_p(sonypi_device.ioport1); in sonypi_call3()
709 if (!sonypi_device.camera_power) in sonypi_camera_off()
713 sonypi_device.camera_power = 0; in sonypi_camera_off()
721 if (sonypi_device.camera_power) in sonypi_camera_on()
745 sonypi_device.camera_power = 1; in sonypi_camera_on()
753 if (sonypi_device.bluetooth_power == state) in sonypi_setbluetoothpower()
758 sonypi_device.bluetooth_power = state; in sonypi_setbluetoothpower()
765 while (kfifo_out_locked(&sonypi_device.input_fifo, (unsigned char *)&kp, in input_keyrelease()
766 sizeof(kp), &sonypi_device.input_fifo_lock) in input_keyrelease()
776 struct input_dev *jog_dev = sonypi_device.input_jog_dev; in sonypi_report_input_event()
777 struct input_dev *key_dev = sonypi_device.input_key_dev; in sonypi_report_input_event()
816 kfifo_in_locked(&sonypi_device.input_fifo, in sonypi_report_input_event()
818 &sonypi_device.input_fifo_lock); in sonypi_report_input_event()
819 schedule_work(&sonypi_device.input_work); in sonypi_report_input_event()
829 v1 = inb_p(sonypi_device.ioport1); in sonypi_irq()
830 v2 = inb_p(sonypi_device.ioport1 + sonypi_device.evtype_offset); in sonypi_irq()
833 if (sonypi_device.model != sonypi_eventtypes[i].model) in sonypi_irq()
865 kfifo_in_locked(&sonypi_device.fifo, (unsigned char *)&event, in sonypi_irq()
866 sizeof(event), &sonypi_device.fifo_lock); in sonypi_irq()
867 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); in sonypi_irq()
868 wake_up_interruptible(&sonypi_device.fifo_proc_list); in sonypi_irq()
875 return fasync_helper(fd, filp, on, &sonypi_device.fifo_async); in sonypi_misc_fasync()
880 mutex_lock(&sonypi_device.lock); in sonypi_misc_release()
881 sonypi_device.open_count--; in sonypi_misc_release()
882 mutex_unlock(&sonypi_device.lock); in sonypi_misc_release()
888 mutex_lock(&sonypi_device.lock); in sonypi_misc_open()
890 if (!sonypi_device.open_count) in sonypi_misc_open()
891 kfifo_reset(&sonypi_device.fifo); in sonypi_misc_open()
892 sonypi_device.open_count++; in sonypi_misc_open()
893 mutex_unlock(&sonypi_device.lock); in sonypi_misc_open()
904 if ((kfifo_len(&sonypi_device.fifo) == 0) && in sonypi_misc_read()
908 ret = wait_event_interruptible(sonypi_device.fifo_proc_list, in sonypi_misc_read()
909 kfifo_len(&sonypi_device.fifo) != 0); in sonypi_misc_read()
914 (kfifo_out_locked(&sonypi_device.fifo, &c, sizeof(c), in sonypi_misc_read()
915 &sonypi_device.fifo_lock) == sizeof(c))) { in sonypi_misc_read()
931 poll_wait(file, &sonypi_device.fifo_proc_list, wait); in sonypi_misc_poll()
932 if (kfifo_len(&sonypi_device.fifo)) in sonypi_misc_poll()
945 mutex_lock(&sonypi_device.lock); in sonypi_misc_ioctl()
1005 val8 = sonypi_device.bluetooth_power; in sonypi_misc_ioctl()
1045 mutex_unlock(&sonypi_device.lock); in sonypi_misc_ioctl()
1068 switch (sonypi_device.model) { in sonypi_enable()
1102 switch (sonypi_device.model) { in sonypi_disable()
1154 sonypi_device.input_jog_dev = jog_dev = input_allocate_device(); in sonypi_create_input_devices()
1167 sonypi_device.input_key_dev = key_dev = input_allocate_device(); in sonypi_create_input_devices()
1200 sonypi_device.input_key_dev = NULL; in sonypi_create_input_devices()
1203 sonypi_device.input_jog_dev = NULL; in sonypi_create_input_devices()
1208 static int sonypi_setup_ioports(struct sonypi_device *dev, in sonypi_setup_ioports()
1222 sonypi_device.region_size, in sonypi_setup_ioports()
1229 release_region(check->port1, sonypi_device.region_size); in sonypi_setup_ioports()
1236 sonypi_device.region_size, in sonypi_setup_ioports()
1248 static int sonypi_setup_irq(struct sonypi_device *dev, in sonypi_setup_irq()
1270 sonypi_device.model, in sonypi_display_info()
1279 sonypi_device.irq, in sonypi_display_info()
1280 sonypi_device.ioport1, sonypi_device.ioport2); in sonypi_display_info()
1298 spin_lock_init(&sonypi_device.fifo_lock); in sonypi_probe()
1299 error = kfifo_alloc(&sonypi_device.fifo, SONYPI_BUF_SIZE, GFP_KERNEL); in sonypi_probe()
1305 init_waitqueue_head(&sonypi_device.fifo_proc_list); in sonypi_probe()
1306 mutex_init(&sonypi_device.lock); in sonypi_probe()
1307 sonypi_device.bluetooth_power = -1; in sonypi_probe()
1311 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE1; in sonypi_probe()
1314 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3; in sonypi_probe()
1317 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3; in sonypi_probe()
1319 sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2; in sonypi_probe()
1327 sonypi_device.dev = pcidev; in sonypi_probe()
1329 if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) { in sonypi_probe()
1331 sonypi_device.region_size = SONYPI_TYPE1_REGION_SIZE; in sonypi_probe()
1332 sonypi_device.evtype_offset = SONYPI_TYPE1_EVTYPE_OFFSET; in sonypi_probe()
1334 } else if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2) { in sonypi_probe()
1336 sonypi_device.region_size = SONYPI_TYPE2_REGION_SIZE; in sonypi_probe()
1337 sonypi_device.evtype_offset = SONYPI_TYPE2_EVTYPE_OFFSET; in sonypi_probe()
1341 sonypi_device.region_size = SONYPI_TYPE3_REGION_SIZE; in sonypi_probe()
1342 sonypi_device.evtype_offset = SONYPI_TYPE3_EVTYPE_OFFSET; in sonypi_probe()
1346 error = sonypi_setup_ioports(&sonypi_device, ioport_list); in sonypi_probe()
1352 error = sonypi_setup_irq(&sonypi_device, irq_list); in sonypi_probe()
1377 spin_lock_init(&sonypi_device.input_fifo_lock); in sonypi_probe()
1378 error = kfifo_alloc(&sonypi_device.input_fifo, SONYPI_BUF_SIZE, in sonypi_probe()
1385 INIT_WORK(&sonypi_device.input_work, input_keyrelease); in sonypi_probe()
1393 input_unregister_device(sonypi_device.input_key_dev); in sonypi_probe()
1394 input_unregister_device(sonypi_device.input_jog_dev); in sonypi_probe()
1398 free_irq(sonypi_device.irq, sonypi_irq); in sonypi_probe()
1400 release_region(sonypi_device.ioport1, sonypi_device.region_size); in sonypi_probe()
1406 kfifo_free(&sonypi_device.fifo); in sonypi_probe()
1415 synchronize_irq(sonypi_device.irq); in sonypi_remove()
1416 flush_work(&sonypi_device.input_work); in sonypi_remove()
1419 input_unregister_device(sonypi_device.input_key_dev); in sonypi_remove()
1420 input_unregister_device(sonypi_device.input_jog_dev); in sonypi_remove()
1421 kfifo_free(&sonypi_device.input_fifo); in sonypi_remove()
1426 free_irq(sonypi_device.irq, sonypi_irq); in sonypi_remove()
1427 release_region(sonypi_device.ioport1, sonypi_device.region_size); in sonypi_remove()
1429 if (sonypi_device.dev) { in sonypi_remove()
1430 pci_disable_device(sonypi_device.dev); in sonypi_remove()
1431 pci_dev_put(sonypi_device.dev); in sonypi_remove()
1434 kfifo_free(&sonypi_device.fifo); in sonypi_remove()
1444 old_camera_power = sonypi_device.camera_power; in sonypi_suspend()