sonypi.c (e21e696edb498c7f7eed42ba3096f6bbe13927b6) sonypi.c (8950d89acaa8c353869e681772479d7955ae6f7a)
1/*
2 * Sony Programmable I/O Control Device driver for VAIO
3 *
4 * Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
5 *
6 * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
7 *
8 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>

--- 509 unchanged lines hidden (view full) ---

518
519#ifdef CONFIG_ACPI
520static struct acpi_device *sonypi_acpi_device;
521static int acpi_driver_registered;
522#endif
523
524static int sonypi_ec_write(u8 addr, u8 value)
525{
1/*
2 * Sony Programmable I/O Control Device driver for VAIO
3 *
4 * Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
5 *
6 * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
7 *
8 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>

--- 509 unchanged lines hidden (view full) ---

518
519#ifdef CONFIG_ACPI
520static struct acpi_device *sonypi_acpi_device;
521static int acpi_driver_registered;
522#endif
523
524static int sonypi_ec_write(u8 addr, u8 value)
525{
526#ifdef CONFIG_ACPI_EC
526#ifdef CONFIG_ACPI
527 if (SONYPI_ACPI_ACTIVE)
528 return ec_write(addr, value);
529#endif
530 wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
531 outb_p(0x81, SONYPI_CST_IOPORT);
532 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
533 outb_p(addr, SONYPI_DATA_IOPORT);
534 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
535 outb_p(value, SONYPI_DATA_IOPORT);
536 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
537 return 0;
538}
539
540static int sonypi_ec_read(u8 addr, u8 *value)
541{
527 if (SONYPI_ACPI_ACTIVE)
528 return ec_write(addr, value);
529#endif
530 wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
531 outb_p(0x81, SONYPI_CST_IOPORT);
532 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
533 outb_p(addr, SONYPI_DATA_IOPORT);
534 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
535 outb_p(value, SONYPI_DATA_IOPORT);
536 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
537 return 0;
538}
539
540static int sonypi_ec_read(u8 addr, u8 *value)
541{
542#ifdef CONFIG_ACPI_EC
542#ifdef CONFIG_ACPI
543 if (SONYPI_ACPI_ACTIVE)
544 return ec_read(addr, value);
545#endif
546 wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
547 outb_p(0x80, SONYPI_CST_IOPORT);
548 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
549 outb_p(addr, SONYPI_DATA_IOPORT);
550 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);

--- 342 unchanged lines hidden (view full) ---

893 retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async);
894 if (retval < 0)
895 return retval;
896 return 0;
897}
898
899static int sonypi_misc_release(struct inode *inode, struct file *file)
900{
543 if (SONYPI_ACPI_ACTIVE)
544 return ec_read(addr, value);
545#endif
546 wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
547 outb_p(0x80, SONYPI_CST_IOPORT);
548 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
549 outb_p(addr, SONYPI_DATA_IOPORT);
550 wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);

--- 342 unchanged lines hidden (view full) ---

893 retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async);
894 if (retval < 0)
895 return retval;
896 return 0;
897}
898
899static int sonypi_misc_release(struct inode *inode, struct file *file)
900{
901 sonypi_misc_fasync(-1, file, 0);
901 mutex_lock(&sonypi_device.lock);
902 sonypi_device.open_count--;
903 mutex_unlock(&sonypi_device.lock);
904 return 0;
905}
906
907static int sonypi_misc_open(struct inode *inode, struct file *file)
908{

--- 664 unchanged lines hidden ---
902 mutex_lock(&sonypi_device.lock);
903 sonypi_device.open_count--;
904 mutex_unlock(&sonypi_device.lock);
905 return 0;
906}
907
908static int sonypi_misc_open(struct inode *inode, struct file *file)
909{

--- 664 unchanged lines hidden ---