diff --git a/packages/linux/linux-2.6.36.2-051_add_ite-cir_driver-0.2.patch b/packages/linux/linux-2.6.36.2-051_add_ite-cir_driver-0.2.patch deleted file mode 100644 index 307255ab74..0000000000 --- a/packages/linux/linux-2.6.36.2-051_add_ite-cir_driver-0.2.patch +++ /dev/null @@ -1,2992 +0,0 @@ -diff -Naur linux-2.6.36.2/drivers/media/IR/ite-cir.c linux-2.6.36.2.patch/drivers/media/IR/ite-cir.c ---- linux-2.6.36.2/drivers/media/IR/ite-cir.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/media/IR/ite-cir.c 2010-12-11 23:43:35.587999217 +0100 -@@ -0,0 +1,1334 @@ -+/* -+ * Driver for ITE Tech Inc. IT8712F/IT8512 CIR -+ * -+ * Copyright (C) 2010 Juan J. Garcia de Soria -+ * -+ * Based on nuvoton-cir and lirc_it87 drivers. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -+ * USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "ite-cir.h" -+ -+/* module parameters */ -+ -+/* debug level */ -+static int debug; -+module_param(debug, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(debug, "Enable debugging output"); -+ -+/* low limit for RX carrier freq, Hz, 0 for no RX demodulation */ -+static int rx_low_carrier_freq; -+module_param(rx_low_carrier_freq, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(rx_low_carrier_freq, "Override low RX carrier frequency, Hz, \ -+0 for no RX demodulation"); -+ -+/* high limit for RX carrier freq, Hz, 0 for no RX demodulation */ -+static int rx_high_carrier_freq; -+module_param(rx_high_carrier_freq, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(rx_high_carrier_freq, "Override high RX carrier frequency, \ -+Hz, 0 for no RX demodulation"); -+ -+/* override tx carrier frequency */ -+static int tx_carrier_freq; -+module_param(tx_carrier_freq, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(tx_carrier_freq, "Override TX carrier frequency, Hz"); -+ -+/* override tx duty cycle */ -+static int tx_duty_cycle; -+module_param(tx_duty_cycle, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(tx_duty_cycle, "Override TX duty cycle, 1-100"); -+ -+/* override default sample period */ -+static long sample_period; -+module_param(sample_period, long, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(sample_period, "Override carrier sample period, \ -+us"); -+ -+/* override detected model id */ -+static int model_number = -1; -+module_param(model_number, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(model_number, "Use this model number, don't \ -+autodetect"); -+ -+ -+/* forward declaration */ -+static void ite_set_carrier_params(struct ite_dev *dev); -+ -+ -+/* IT8712F HW-specific functions */ -+ -+/* retrieve a bitmask of the current causes for a pending interrupt; this may -+ * be composed of ITE_IRQ_TX_FIFO, ITE_IRQ_RX_FIFO and ITE_IRQ_RX_FIFO_OVERRUN -+ * */ -+static int it87_get_irq_causes(struct ite_dev *dev) -+{ -+ u8 iflags; -+ int ret = 0; -+ -+ /* read the interrupt flags */ -+ iflags = inb(dev->cir_addr + IT87_IIR) & IT87_II; -+ -+ switch (iflags) { -+ case IT87_II_RXDS: -+ ret = ITE_IRQ_RX_FIFO; -+ break; -+ case IT87_II_RXFO: -+ ret = ITE_IRQ_RX_FIFO_OVERRUN; -+ break; -+ case IT87_II_TXLDL: -+ ret = ITE_IRQ_TX_FIFO; -+ break; -+ } -+ -+ return ret; -+} -+ -+/* set the carrier parameters; to be called with the spinlock held */ -+static void it87_set_carrier_params(struct ite_dev *dev, bool high_freq, -+ bool use_demodulator, u8 carrier_freq_bits, u8 allowance_bits, -+ u8 pulse_width_bits) -+{ -+ u8 val; -+ -+ /* program the RCR register */ -+ val = inb(dev->cir_addr + IT87_RCR) -+ & ~(IT87_HCFS | IT87_RXEND | IT87_RXDCR); -+ -+ if (high_freq) -+ val |= IT87_HCFS; -+ -+ if (use_demodulator) -+ val |= IT87_RXEND; -+ -+ val |= allowance_bits; -+ -+ outb(val, dev->cir_addr + IT87_RCR); -+ -+ /* program the TCR2 register */ -+ outb((carrier_freq_bits << IT87_CFQ_SHIFT) | pulse_width_bits, -+ dev->cir_addr + IT87_TCR2); -+} -+ -+/* read up to buf_size bytes from the RX FIFO; to be called with the spinlock -+ * held */ -+static int it87_get_rx_bytes(struct ite_dev *dev, u8 *buf, int buf_size) -+{ -+ int fifo, read = 0; -+ -+ /* read how many bytes are still in the FIFO */ -+ fifo = inb(dev->cir_addr + IT87_RSR) & IT87_RXBFC; -+ -+ while (fifo > 0 && buf_size > 0) { -+ *(buf++) = inb(dev->cir_addr + IT87_DR); -+ fifo--; -+ read++; -+ buf_size--; -+ } -+ -+ return read; -+} -+ -+/* return how many bytes we can send through the FIFO; this will be called -+ * with the device spinlock NOT HELD while waiting for the TX FIFO to get -+ * empty; let's expect this won't be a problem */ -+static int it87_get_tx_free_slots(struct ite_dev *dev) -+{ -+ return inb(dev->cir_addr + IT87_TSR) & IT87_TXBFC; -+} -+ -+/* put a byte to the TX fifo; this should be called with the spinlock held */ -+static void it87_put_tx_byte(struct ite_dev *dev, u8 value) -+{ -+ outb(value, dev->cir_addr + IT87_DR); -+} -+ -+/* idle the receiver so that we won't receive samples until another -+ pulse is detected; this must be called with the device spinlock held */ -+static void it87_idle_rx(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable streaming by clearing RXACT writing it as 1 */ -+ outb(inb(dev->cir_addr + IT87_RCR) | IT87_RXACT, -+ dev->cir_addr + IT87_RCR); -+ -+ /* clear the FIFO */ -+ outb(inb(dev->cir_addr + IT87_TCR1) | IT87_FIFOCLR, -+ dev->cir_addr + IT87_TCR1); -+} -+ -+/* disable the receiver; this must be called with the device spinlock held */ -+static void it87_disable_rx(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable the receiver interrupts */ -+ outb(inb(dev->cir_addr + IT87_IER) & ~(IT87_RDAIE | IT87_RFOIE), -+ dev->cir_addr + IT87_IER); -+ -+ /* disable the receiver */ -+ outb(inb(dev->cir_addr + IT87_RCR) & ~IT87_RXEN, -+ dev->cir_addr + IT87_RCR); -+ -+ /* clear the FIFO and RXACT (actually RXACT should have been cleared -+ * in the previous outb() call) */ -+ it87_idle_rx(dev); -+} -+ -+/* enable the receiver; this must be called with the device spinlock held */ -+static void it87_enable_rx(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* enable the receiver by setting RXEN */ -+ outb(inb(dev->cir_addr + IT87_RCR) | IT87_RXEN, -+ dev->cir_addr + IT87_RCR); -+ -+ /* just prepare it to idle for the next reception */ -+ it87_idle_rx(dev); -+ -+ /* enable the receiver interrupts and master enable flag */ -+ outb(inb(dev->cir_addr + IT87_IER) -+ | IT87_RDAIE | IT87_RFOIE | IT87_IEC, -+ dev->cir_addr + IT87_IER); -+} -+ -+/* disable the transmitter interrupt; this must be called with the device -+ * spinlock held */ -+static void it87_disable_tx_interrupt(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable the transmitter interrupts */ -+ outb(inb(dev->cir_addr + IT87_IER) & ~IT87_TLDLIE, -+ dev->cir_addr + IT87_IER); -+} -+ -+/* enable the transmitter interrupt; this must be called with the device -+ * spinlock held */ -+static void it87_enable_tx_interrupt(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* enable the transmitter interrupts and master enable flag */ -+ outb(inb(dev->cir_addr + IT87_IER) -+ | IT87_TLDLIE | IT87_IEC, -+ dev->cir_addr + IT87_IER); -+} -+ -+/* disable the device; this must be called with the device spinlock held */ -+static void it87_disable(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* clear out all interrupt enable flags */ -+ outb(inb(dev->cir_addr + IT87_IER) & ~(IT87_IEC | IT87_RFOIE | -+ IT87_RDAIE | IT87_TLDLIE), dev->cir_addr + IT87_IER); -+ -+ /* disable the receiver */ -+ it87_disable_rx(dev); -+ -+ /* erase the FIFO */ -+ outb(IT87_FIFOCLR | inb(dev->cir_addr + IT87_TCR1), -+ dev->cir_addr + IT87_TCR1); -+} -+ -+/* initialize the hardware */ -+static void it87_init_hardware(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* enable just the baud rate divisor register, -+ disabling all the interrupts at the same time */ -+ outb((inb(dev->cir_addr + IT87_IER) & ~(IT87_IEC | IT87_RFOIE | -+ IT87_RDAIE | IT87_TLDLIE)) | IT87_BR, -+ dev->cir_addr + IT87_IER); -+ -+ /* write out the baud rate divisor */ -+ outb(ITE_BAUDRATE_DIVISOR & 0xff, dev->cir_addr + IT87_BDLR); -+ outb((ITE_BAUDRATE_DIVISOR >> 8) & 0xff, dev->cir_addr + IT87_BDHR); -+ -+ /* disable the baud rate divisor register again */ -+ outb(inb(dev->cir_addr + IT87_IER) & ~IT87_BR, -+ dev->cir_addr + IT87_IER); -+ -+ /* program the RCR register defaults */ -+ outb(ITE_RXDCR_DEFAULT, dev->cir_addr + IT87_RCR); -+ -+ /* program the TCR1 register */ -+ outb(IT87_TXMPM_DEFAULT -+ | IT87_TXENDF -+ | IT87_TXRLE -+ | IT87_FIFOTL_DEFAULT -+ | IT87_FIFOCLR, dev->cir_addr + IT87_TCR1); -+ -+ /* program the carrier parameters */ -+ ite_set_carrier_params(dev); -+} -+ -+/* IT8512F on ITE8708 HW-specific functions */ -+ -+/* retrieve a bitmask of the current causes for a pending interrupt; this may -+ * be composed of ITE_IRQ_TX_FIFO, ITE_IRQ_RX_FIFO and ITE_IRQ_RX_FIFO_OVERRUN -+ * */ -+static int it8708_get_irq_causes(struct ite_dev *dev) -+{ -+ u8 iflags; -+ int ret = 0; -+ -+ /* read the interrupt flags */ -+ iflags = inb(dev->cir_addr + IT8708_C0IIR); -+ -+ if (iflags & IT85_TLDLI) -+ ret |= ITE_IRQ_TX_FIFO; -+ if (iflags & IT85_RDAI) -+ ret |= ITE_IRQ_RX_FIFO; -+ if (iflags & IT85_RFOI) -+ ret |= ITE_IRQ_RX_FIFO_OVERRUN; -+ -+ return ret; -+} -+ -+/* set the carrier parameters; to be called with the spinlock held */ -+static void it8708_set_carrier_params(struct ite_dev *dev, bool high_freq, -+ bool use_demodulator, u8 carrier_freq_bits, u8 allowance_bits, -+ u8 pulse_width_bits) -+{ -+ u8 val; -+ -+ /* program the C0CFR register, with HRAE=1 */ -+ outb(inb(dev->cir_addr + IT8708_BANKSEL) | IT8708_HRAE, dev->cir_addr -+ + IT8708_BANKSEL); -+ -+ val = (inb(dev->cir_addr + IT8708_C0CFR) -+ & ~(IT85_HCFS | IT85_CFQ)) | carrier_freq_bits; -+ -+ if (high_freq) -+ val |= IT85_HCFS; -+ -+ outb(val, dev->cir_addr + IT8708_C0CFR); -+ -+ outb(inb(dev->cir_addr + IT8708_BANKSEL) & ~IT8708_HRAE, dev->cir_addr -+ + IT8708_BANKSEL); -+ -+ /* program the C0RCR register */ -+ val = inb(dev->cir_addr + IT8708_C0RCR) -+ & ~(IT85_RXEND | IT85_RXDCR); -+ -+ if (use_demodulator) -+ val |= IT85_RXEND; -+ -+ val |= allowance_bits; -+ -+ outb(val, dev->cir_addr + IT8708_C0RCR); -+ -+ /* program the C0TCR register */ -+ val = inb(dev->cir_addr + IT8708_C0TCR) & ~IT85_TXMPW; -+ val |= pulse_width_bits; -+ outb(val, dev->cir_addr + IT8708_C0TCR); -+} -+ -+/* read up to buf_size bytes from the RX FIFO; to be called with the spinlock -+ * held */ -+static int it8708_get_rx_bytes(struct ite_dev *dev, u8 *buf, int buf_size) -+{ -+ int fifo, read = 0; -+ -+ /* read how many bytes are still in the FIFO */ -+ fifo = inb(dev->cir_addr + IT8708_C0RFSR) & IT85_RXFBC; -+ -+ while (fifo > 0 && buf_size > 0) { -+ *(buf++) = inb(dev->cir_addr + IT8708_C0DR); -+ fifo--; -+ read++; -+ buf_size--; -+ } -+ -+ return read; -+} -+ -+/* return how many bytes we can send through the FIFO; this will be called -+ * with the device spinlock NOT HELD while waiting for the TX FIFO to get -+ * empty; let's expect this won't be a problem */ -+static int it8708_get_tx_free_slots(struct ite_dev *dev) -+{ -+ return inb(dev->cir_addr + IT8708_C0TFSR) & IT85_TXFBC; -+} -+ -+/* put a byte to the TX fifo; this should be called with the spinlock held */ -+static void it8708_put_tx_byte(struct ite_dev *dev, u8 value) -+{ -+ outb(value, dev->cir_addr + IT8708_C0DR); -+} -+ -+/* idle the receiver so that we won't receive samples until another -+ pulse is detected; this must be called with the device spinlock held */ -+static void it8708_idle_rx(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable streaming by clearing RXACT writing it as 1 */ -+ outb(inb(dev->cir_addr + IT8708_C0RCR) | IT85_RXACT, -+ dev->cir_addr + IT8708_C0RCR); -+ -+ /* clear the FIFO */ -+ outb(inb(dev->cir_addr + IT8708_C0MSTCR) | IT85_FIFOCLR, -+ dev->cir_addr + IT8708_C0MSTCR); -+} -+ -+/* disable the receiver; this must be called with the device spinlock held */ -+static void it8708_disable_rx(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable the receiver interrupts */ -+ outb(inb(dev->cir_addr + IT8708_C0IER) & ~(IT85_RDAIE | IT85_RFOIE), -+ dev->cir_addr + IT8708_C0IER); -+ -+ /* disable the receiver */ -+ outb(inb(dev->cir_addr + IT8708_C0RCR) & ~IT85_RXEN, -+ dev->cir_addr + IT8708_C0RCR); -+ -+ /* clear the FIFO and RXACT (actually RXACT should have been cleared -+ * in the previous outb() call) */ -+ it8708_idle_rx(dev); -+} -+ -+/* enable the receiver; this must be called with the device spinlock held */ -+static void it8708_enable_rx(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* enable the receiver by setting RXEN */ -+ outb(inb(dev->cir_addr + IT8708_C0RCR) | IT85_RXEN, -+ dev->cir_addr + IT8708_C0RCR); -+ -+ /* just prepare it to idle for the next reception */ -+ it8708_idle_rx(dev); -+ -+ /* enable the receiver interrupts and master enable flag */ -+ outb(inb(dev->cir_addr + IT8708_C0IER) -+ | IT85_RDAIE | IT85_RFOIE | IT85_IEC, -+ dev->cir_addr + IT8708_C0IER); -+} -+ -+/* disable the transmitter interrupt; this must be called with the device -+ * spinlock held */ -+static void it8708_disable_tx_interrupt(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable the transmitter interrupts */ -+ outb(inb(dev->cir_addr + IT8708_C0IER) & ~IT85_TLDLIE, -+ dev->cir_addr + IT8708_C0IER); -+} -+ -+/* enable the transmitter interrupt; this must be called with the device -+ * spinlock held */ -+static void it8708_enable_tx_interrupt(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* enable the transmitter interrupts and master enable flag */ -+ outb(inb(dev->cir_addr + IT8708_C0IER) -+ | IT85_TLDLIE | IT85_IEC, -+ dev->cir_addr + IT8708_C0IER); -+} -+ -+/* disable the device; this must be called with the device spinlock held */ -+static void it8708_disable(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* clear out all interrupt enable flags */ -+ outb(inb(dev->cir_addr + IT8708_C0IER) & ~(IT85_IEC | IT85_RFOIE | -+ IT85_RDAIE | IT85_TLDLIE), dev->cir_addr + IT8708_C0IER); -+ -+ /* disable the receiver */ -+ it8708_disable_rx(dev); -+ -+ /* erase the FIFO */ -+ outb(IT85_FIFOCLR | inb(dev->cir_addr + IT8708_C0MSTCR), -+ dev->cir_addr + IT8708_C0MSTCR); -+} -+ -+/* initialize the hardware */ -+static void it8708_init_hardware(struct ite_dev *dev) -+{ -+ ite_dbg("%s called", __func__); -+ -+ /* disable all the interrupts */ -+ outb(inb(dev->cir_addr + IT8708_C0IER) & ~(IT85_IEC | IT85_RFOIE | -+ IT85_RDAIE | IT85_TLDLIE), dev->cir_addr + IT8708_C0IER); -+ -+ /* program the baud rate divisor */ -+ outb(inb(dev->cir_addr + IT8708_BANKSEL) | IT8708_HRAE, dev->cir_addr -+ + IT8708_BANKSEL); -+ -+ outb(ITE_BAUDRATE_DIVISOR & 0xff, dev->cir_addr + IT8708_C0BDLR); -+ outb((ITE_BAUDRATE_DIVISOR >> 8) & 0xff, -+ dev->cir_addr + IT8708_C0BDHR); -+ -+ outb(inb(dev->cir_addr + IT8708_BANKSEL) & ~IT8708_HRAE, dev->cir_addr -+ + IT8708_BANKSEL); -+ -+ -+ /* program the C0MSTCR register defaults */ -+ outb((inb(dev->cir_addr + IT8708_C0MSTCR) & ~(IT85_ILSEL | IT85_ILE | -+ IT85_FIFOTL | IT85_FIFOCLR | IT85_RESET)) | -+ IT85_FIFOTL_DEFAULT, dev->cir_addr + IT8708_C0MSTCR); -+ -+ /* program the C0RCR register defaults */ -+ outb((inb(dev->cir_addr + IT8708_C0RCR) & ~(IT85_RXEN | IT85_RDWOS | -+ IT85_RXEND | IT85_RXACT | IT85_RXDCR)) | -+ ITE_RXDCR_DEFAULT, dev->cir_addr + IT8708_C0RCR); -+ -+ /* program the C0TCR register defaults */ -+ outb((inb(dev->cir_addr + IT8708_C0TCR) & ~(IT85_TXMPM | IT85_TXMPW)) -+ | IT85_TXRLE | IT85_TXENDF | IT85_TXMPM_DEFAULT | -+ IT85_TXMPW_DEFAULT, dev->cir_addr + IT8708_C0TCR); -+ -+ /* program the carrier parameters */ -+ ite_set_carrier_params(dev); -+} -+ -+ -+ -+ -+/* supported models and their parameters */ -+static const struct ite_dev_params ite_dev_descs[] = { -+ { /* 0: ITE8704, ITE8713 */ -+ .model = "ITE8704/ITE8713 CIR transceiver", -+ .io_region_size = IT87_IOREG_LENGTH, -+ .hw_tx_capable = true, -+ .sample_period = (u32)(1000000000ULL / 115200), -+ .tx_carrier_freq = 38000, -+ .tx_duty_cycle = 33, -+ .rx_low_carrier_freq = 0, -+ .rx_high_carrier_freq = 0, -+ -+ /* operations */ -+ .get_irq_causes = it87_get_irq_causes, -+ .enable_rx = it87_enable_rx, -+ .idle_rx = it87_idle_rx, -+ .disable_rx = it87_idle_rx, -+ .get_rx_bytes = it87_get_rx_bytes, -+ .enable_tx_interrupt = it87_enable_tx_interrupt, -+ .disable_tx_interrupt = it87_disable_tx_interrupt, -+ .get_tx_free_slots = it87_get_tx_free_slots, -+ .put_tx_byte = it87_put_tx_byte, -+ .disable = it87_disable, -+ .init_hardware = it87_init_hardware, -+ .set_carrier_params = it87_set_carrier_params, -+ }, -+ { /* 1: ITE8708 */ -+ .model = "ITE8708 CIR transceiver", -+ .io_region_size = IT8708_IOREG_LENGTH, -+ .hw_tx_capable = true, -+ .sample_period = (u32)(1000000000ULL / 115200), -+ .tx_carrier_freq = 38000, -+ .tx_duty_cycle = 33, -+ .rx_low_carrier_freq = 0, -+ .rx_high_carrier_freq = 0, -+ -+ /* operations */ -+ .get_irq_causes = it8708_get_irq_causes, -+ .enable_rx = it8708_enable_rx, -+ .idle_rx = it8708_idle_rx, -+ .disable_rx = it8708_idle_rx, -+ .get_rx_bytes = it8708_get_rx_bytes, -+ .enable_tx_interrupt = it8708_enable_tx_interrupt, -+ .disable_tx_interrupt = it8708_disable_tx_interrupt, -+ .get_tx_free_slots = it8708_get_tx_free_slots, -+ .put_tx_byte = it8708_put_tx_byte, -+ .disable = it8708_disable, -+ .init_hardware = it8708_init_hardware, -+ .set_carrier_params = it8708_set_carrier_params, -+ }, -+}; -+ -+/* HW-independent code functions */ -+ -+/* check whether carrier frequency is high frequency */ -+static inline bool ite_is_high_carrier_freq(unsigned int freq) -+{ -+ return freq >= ITE_HCF_MIN_CARRIER_FREQ; -+} -+ -+/* get the bits required to program the carrier frequency in CFQ bits, -+ * unshifted */ -+static u8 ite_get_carrier_freq_bits(unsigned int freq) -+{ -+ if (ite_is_high_carrier_freq(freq)) { -+ if (freq < 425000) -+ return ITE_CFQ_400; -+ else if (freq < 465000) -+ return ITE_CFQ_450; -+ else if (freq < 490000) -+ return ITE_CFQ_480; -+ else -+ return ITE_CFQ_500; -+ } else { -+ /* trim to limits */ -+ if (freq < ITE_LCF_MIN_CARRIER_FREQ) -+ freq = ITE_LCF_MIN_CARRIER_FREQ; -+ if (freq > ITE_LCF_MAX_CARRIER_FREQ) -+ freq = ITE_LCF_MAX_CARRIER_FREQ; -+ -+ /* convert to kHz and subtract the base freq */ -+ freq = DIV_ROUND_CLOSEST(freq - ITE_LCF_MIN_CARRIER_FREQ, -+ 1000); -+ -+ return (u8) freq; -+ } -+} -+ -+/* get the bits required to program the pulse with in TXMPW */ -+static u8 ite_get_pulse_width_bits(unsigned int freq, int duty_cycle) -+{ -+ unsigned long period_ns, on_ns; -+ -+ /* sanitize freq into range */ -+ if (freq < ITE_LCF_MIN_CARRIER_FREQ) -+ freq = ITE_LCF_MIN_CARRIER_FREQ; -+ if (freq > ITE_HCF_MAX_CARRIER_FREQ) -+ freq = ITE_HCF_MAX_CARRIER_FREQ; -+ -+ period_ns = 1000000000UL / freq; -+ on_ns = period_ns * duty_cycle / 100; -+ -+ if (ite_is_high_carrier_freq(freq)) { -+ if (on_ns < 750) -+ return ITE_TXMPW_A; -+ else if (on_ns < 850) -+ return ITE_TXMPW_B; -+ else if (on_ns < 950) -+ return ITE_TXMPW_C; -+ else if (on_ns < 1080) -+ return ITE_TXMPW_D; -+ else -+ return ITE_TXMPW_E; -+ } else { -+ if (on_ns < 6500) -+ return ITE_TXMPW_A; -+ else if (on_ns < 7850) -+ return ITE_TXMPW_B; -+ else if (on_ns < 9650) -+ return ITE_TXMPW_C; -+ else if (on_ns < 11950) -+ return ITE_TXMPW_D; -+ else -+ return ITE_TXMPW_E; -+ } -+} -+ -+/* set all the rx/tx carrier parameters; this must be called with the device -+ * spinlock held */ -+static void ite_set_carrier_params(struct ite_dev *dev) -+{ -+ unsigned int freq, low_freq, high_freq; -+ int allowance; -+ bool use_demodulator; -+ bool for_tx = dev->transmitting; -+ -+ ite_dbg("%s called", __func__); -+ -+ if (for_tx) { -+ /* we don't need no stinking calculations */ -+ freq = dev->params.tx_carrier_freq; -+ allowance = ITE_RXDCR_DEFAULT; -+ use_demodulator = false; -+ } else { -+ low_freq = dev->params.rx_low_carrier_freq; -+ high_freq = dev->params.rx_high_carrier_freq; -+ -+ if (low_freq == 0) { -+ /* don't demodulate */ -+ freq = ITE_DEFAULT_CARRIER_FREQ; -+ allowance = ITE_RXDCR_DEFAULT; -+ use_demodulator = false; -+ } else { -+ /* calculate the middle freq */ -+ freq = (low_freq + high_freq) / 2; -+ -+ /* calculate the allowance */ -+ allowance = DIV_ROUND_CLOSEST( -+ 10000 * (high_freq - low_freq), -+ ITE_RXDCR_PER_10000_STEP * -+ (high_freq + low_freq)); -+ -+ if (allowance < 1) -+ allowance = 1; -+ if (allowance > ITE_RXDCR_MAX) -+ allowance = ITE_RXDCR_MAX; -+ } -+ } -+ -+ /* set the carrier parameters in a device-dependent way */ -+ dev->params.set_carrier_params(dev, ite_is_high_carrier_freq(freq), -+ use_demodulator, ite_get_carrier_freq_bits(freq), allowance, -+ ite_get_pulse_width_bits(freq, dev->params.tx_duty_cycle)); -+} -+ -+/* decode raw bytes as received by the hardware, and push them to the ir-core -+ * layer */ -+static void ite_decode_bytes(struct ite_dev *dev, const u8 *data, int -+ length) -+{ -+ u32 sample_period; -+ unsigned long *ldata; -+ unsigned int next_one, next_zero, size; -+ DEFINE_IR_RAW_EVENT(ev); -+ -+ if (length == 0) -+ return; -+ -+ sample_period = dev->params.sample_period; -+ ldata = (unsigned long *) data; -+ size = length << 3; -+ next_one = generic_find_next_le_bit(ldata, size, 0); -+ if (next_one > 0) { -+ ev.pulse = true; -+ ev.duration = ITE_BITS_TO_NS(next_one, sample_period); -+ ir_raw_event_store_with_filter(dev->rdev, &ev); -+ } -+ -+ while (next_one < size) { -+ next_zero = generic_find_next_zero_le_bit(ldata, -+ size, next_one + 1); -+ ev.pulse = false; -+ ev.duration = ITE_BITS_TO_NS(next_zero - next_one, -+ sample_period); -+ ir_raw_event_store_with_filter(dev->rdev, &ev); -+ -+ if (next_zero < size) { -+ next_one = generic_find_next_le_bit(ldata, -+ size, next_zero + 1); -+ ev.pulse = true; -+ ev.duration = ITE_BITS_TO_NS(next_one - next_zero, -+ sample_period); -+ ir_raw_event_store_with_filter(dev->rdev, &ev); -+ } else -+ next_one = size; -+ } -+ -+ ir_raw_event_handle(dev->rdev); -+ -+ ite_dbg_verbose("decoded %d bytes.", length); -+} -+ -+/* interrupt service routine for incoming and outgoing CIR data */ -+static irqreturn_t ite_cir_isr(int irq, void *data) -+{ -+ struct ite_dev *dev = data; -+ unsigned long flags; -+ irqreturn_t ret = IRQ_RETVAL(IRQ_NONE); -+ u8 rx_buf[ITE_RX_FIFO_LEN]; -+ int rx_bytes; -+ int iflags; -+ -+ ite_dbg_verbose("%s firing", __func__); -+ -+ /* grab the spinlock */ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* read the interrupt flags */ -+ iflags = dev->params.get_irq_causes(dev); -+ -+ /* check for the receive interrupt */ -+ if (iflags & (ITE_IRQ_RX_FIFO | ITE_IRQ_RX_FIFO_OVERRUN)) { -+ /* read the FIFO bytes */ -+ rx_bytes = dev->params.get_rx_bytes(dev, rx_buf, -+ ITE_RX_FIFO_LEN); -+ -+ if (rx_bytes > 0) { -+ /* drop the spinlock, since the ir-core layer -+ * may call us back again through -+ * ite_s_idle() */ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ /* decode the data we've just received */ -+ ite_decode_bytes(dev, rx_buf, rx_bytes); -+ -+ /* reacquire the spinlock */ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* mark the interrupt as serviced */ -+ ret = IRQ_RETVAL(IRQ_HANDLED); -+ } -+ } else if (iflags & ITE_IRQ_TX_FIFO) { -+ /* FIFO space available interrupt */ -+ ite_dbg_verbose("got interrupt for TX FIFO"); -+ -+ /* wake any sleeping transmitter */ -+ wake_up_interruptible(&dev->tx_queue); -+ -+ /* mark the interrupt as serviced */ -+ ret = IRQ_RETVAL(IRQ_HANDLED); -+ } -+ -+ /* drop the spinlock */ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ ite_dbg_verbose("%s done returning %d", __func__, (int) ret); -+ -+ return ret; -+} -+ -+ -+/* set the rx carrier freq range, guess it's in Hz... */ -+static int ite_set_rx_carrier_range(struct ir_dev *rcdev, u32 carrier_low, u32 -+ carrier_high) -+{ -+ unsigned long flags; -+ struct ite_dev *dev = rcdev->priv; -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ dev->params.rx_low_carrier_freq = carrier_low; -+ dev->params.rx_high_carrier_freq = carrier_high; -+ ite_set_carrier_params(dev); -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return 0; -+} -+ -+ -+/* set the tx carrier freq, guess it's in Hz... */ -+static int ite_set_tx_carrier(struct ir_dev *rcdev, u32 carrier) -+{ -+ unsigned long flags; -+ struct ite_dev *dev = rcdev->priv; -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ dev->params.tx_carrier_freq = carrier; -+ ite_set_carrier_params(dev); -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return 0; -+} -+ -+/* set the tx duty cycle by controlling the pulse width */ -+static int ite_set_tx_duty_cycle(struct ir_dev *rcdev, u32 duty_cycle) -+{ -+ unsigned long flags; -+ struct ite_dev *dev = rcdev->priv; -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ dev->params.tx_duty_cycle = duty_cycle; -+ ite_set_carrier_params(dev); -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return 0; -+} -+ -+/* transmit out IR pulses; what you get here is a batch of alternating -+ * pulse/space/pulse/space lengths that we should write out completely through -+ * the FIFO, blocking on a full FIFO */ -+static int ite_tx_ir(struct ir_dev *rcdev, int *txbuf, u32 n) -+{ -+ unsigned long flags; -+ struct ite_dev *dev = rcdev->priv; -+ bool is_pulse = false; -+ int remaining_us, fifo_avail, fifo_remaining, last_idx = 0; -+ int max_rle_us, next_rle_us; -+ int ret = n; -+ u8 last_sent[ITE_TX_FIFO_LEN]; -+ u8 val; -+ -+ ite_dbg("%s called", __func__); -+ -+ /* clear the array just in case */ -+ memset(last_sent, 0, ARRAY_SIZE(last_sent)); -+ -+ /* n comes in bytes; convert to ints */ -+ n /= sizeof(int); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* let everybody know we're now transmitting */ -+ dev->transmitting = true; -+ -+ /* and set the carrier values for transmission */ -+ ite_set_carrier_params(dev); -+ -+ /* calculate how much time we can send in one byte */ -+ max_rle_us = (ITE_BAUDRATE_DIVISOR * dev->params.sample_period * -+ ITE_TX_MAX_RLE) / 1000; -+ -+ /* disable the receiver */ -+ dev->params.disable_rx(dev); -+ -+ /* this is where we'll begin filling in the FIFO, until it's full. -+ * then we'll just activate the interrupt, wait for it to wake us up -+ * again, disable it, continue filling the FIFO... until everything -+ * has been pushed out */ -+ fifo_avail = dev->params.get_tx_free_slots(dev); -+ -+ while (n > 0 && dev->in_use) { -+ /* transmit the next sample */ -+ is_pulse = !is_pulse; -+ remaining_us = *(txbuf++); -+ n--; -+ -+ /* repeat while the pulse is non-zero length */ -+ while (remaining_us > 0 && dev->in_use) { -+ if (remaining_us > max_rle_us) -+ next_rle_us = max_rle_us; -+ else -+ next_rle_us = remaining_us; -+ remaining_us -= next_rle_us; -+ -+ /* check what's the length we have to pump out */ -+ val = (ITE_TX_MAX_RLE * next_rle_us) / max_rle_us; -+ -+ /* put it into the sent buffer */ -+ last_sent[last_idx++] = val; -+ last_idx &= (ITE_TX_FIFO_LEN); -+ -+ /* encode it for 7 bits */ -+ val = (val - 1) & ITE_TX_RLE_MASK; -+ -+ /* take into account pulse/space prefix */ -+ if (is_pulse) -+ val |= ITE_TX_PULSE; -+ else -+ val |= ITE_TX_SPACE; -+ -+ /* if we get to 0 available, read again, just in case -+ * some other slot got freed */ -+ if (fifo_avail <= 0) { -+ fifo_avail = -+ dev->params.get_tx_free_slots(dev); -+ } -+ -+ /* if it's still full */ -+ if (fifo_avail <= 0) { -+ /* enable the tx interrupt */ -+ dev->params.enable_tx_interrupt(dev); -+ -+ /* drop the spinlock */ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ /* wait for the FIFO to empty enough */ -+ wait_event_interruptible(dev->tx_queue, -+ (fifo_avail = -+ dev->params.get_tx_free_slots(dev)) -+ >= 8); -+ -+ /* get the spinlock again */ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* disable the tx interrupt again. */ -+ dev->params.disable_tx_interrupt(dev); -+ } -+ -+ /* now send the byte through the FIFO */ -+ dev->params.put_tx_byte(dev, val); -+ fifo_avail--; -+ } -+ } -+ -+ /* wait and don't return until the whole FIFO has been sent out; -+ * otherwise we could configure the RX carrier params instead of the -+ * TX ones while the transmission is still being performed! */ -+ fifo_remaining = ITE_TX_FIFO_LEN - -+ dev->params.get_tx_free_slots(dev); -+ remaining_us = 0; -+ while (fifo_remaining > 0) { -+ fifo_remaining--; -+ last_idx--; -+ last_idx &= (ITE_TX_FIFO_LEN - 1); -+ remaining_us += last_sent[last_idx]; -+ } -+ remaining_us = (remaining_us * max_rle_us) / (ITE_TX_MAX_RLE); -+ -+ /* drop the spinlock while we sleep */ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ /* sleep remaining_us microseconds */ -+ mdelay(DIV_ROUND_UP(remaining_us, 1000)); -+ -+ /* reacquire the spinlock */ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* now we're not transmitting anymore */ -+ dev->transmitting = false; -+ -+ /* and set the carrier values for reception */ -+ ite_set_carrier_params(dev); -+ -+ /* reenable the receiver */ -+ if (dev->in_use) -+ dev->params.enable_rx(dev); -+ -+ /* notify transmission end */ -+ wake_up_interruptible(&dev->tx_ended); -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return ret; -+} -+ -+/* idle the receiver if needed */ -+static void ite_s_idle(struct ir_dev *rcdev, bool enable) -+{ -+ unsigned long flags; -+ struct ite_dev *dev = rcdev->priv; -+ -+ ite_dbg("%s called", __func__); -+ -+ if (enable) { -+ spin_lock_irqsave(&dev->lock, flags); -+ dev->params.idle_rx(dev); -+ spin_unlock_irqrestore(&dev->lock, flags); -+ } -+} -+ -+/* activate the device for use */ -+static int ite_open(struct ir_dev *rcdev) -+{ -+ struct ite_dev *dev = rcdev->priv; -+ unsigned long flags; -+ -+ ite_dbg("%s called", __func__); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ dev->in_use = true; -+ -+ /* enable the receiver */ -+ dev->params.enable_rx(dev); -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return 0; -+} -+ -+/* deactivate the device for use */ -+static void ite_close(struct ir_dev *rcdev) -+{ -+ struct ite_dev *dev = rcdev->priv; -+ unsigned long flags; -+ -+ ite_dbg("%s called", __func__); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ dev->in_use = false; -+ -+ /* wait for any transmission to end */ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ wait_event_interruptible(dev->tx_ended, !dev->transmitting); -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ dev->params.disable(dev); -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+} -+ -+/* allocate memory, probe hardware, and initialize everything */ -+static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id -+ *dev_id) -+{ -+ const struct ite_dev_params *dev_desc = NULL; -+ struct ite_dev *itdev = NULL; -+ struct ir_dev *rdev = NULL; -+ int ret = -ENOMEM; -+ int model_no; -+ -+ ite_dbg("%s called", __func__); -+ -+ itdev = kzalloc(sizeof(struct ite_dev), GFP_KERNEL); -+ if (!itdev) -+ return ret; -+ -+ /* input device for IR remote (and tx) */ -+ rdev = rc_allocate_device(); -+ if (!rdev) -+ goto failure; -+ -+ ret = -ENODEV; -+ -+ -+ /* get the model number */ -+ model_no = (int) dev_id->driver_data; -+ ite_pr(KERN_NOTICE, "Auto-detected model: %s\n", -+ ite_dev_descs[model_no].model); -+ -+ if (model_number >= 0 && model_number -+ < ARRAY_SIZE(ite_dev_descs)) { -+ model_no = model_number; -+ ite_pr(KERN_NOTICE, "The model has been fixed by a module \ -+parameter."); -+ } -+ -+ ite_pr(KERN_NOTICE, "Using model: %s\n", -+ ite_dev_descs[model_no].model); -+ -+ /* get the description for the device */ -+ dev_desc = &ite_dev_descs[model_no]; -+ -+ -+ /* validate pnp resources */ -+ if (!pnp_port_valid(pdev, 0) || -+ pnp_port_len(pdev, 0) != dev_desc->io_region_size) { -+ dev_err(&pdev->dev, "IR PNP Port not valid!\n"); -+ goto failure; -+ } -+ -+ if (!pnp_irq_valid(pdev, 0)) { -+ dev_err(&pdev->dev, "PNP IRQ not valid!\n"); -+ goto failure; -+ } -+ -+ /* store resource values */ -+ itdev->cir_addr = pnp_port_start(pdev, 0); -+ itdev->cir_irq = pnp_irq(pdev, 0); -+ -+ /* initialize spinlocks */ -+ spin_lock_init(&itdev->lock); -+ -+ /* initialize raw event */ -+ init_ir_raw_event(&itdev->rawir); -+ -+ ret = -EBUSY; -+ /* now claim resources */ -+ if (!request_region(itdev->cir_addr, -+ dev_desc->io_region_size, ITE_DRIVER_NAME)) -+ goto failure; -+ -+ if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED, -+ ITE_DRIVER_NAME, (void *)itdev)) -+ goto failure; -+ -+ /* set driver data into the pnp device */ -+ pnp_set_drvdata(pdev, itdev); -+ itdev->pdev = pdev; -+ -+ /* initialize waitqueues for transmission */ -+ init_waitqueue_head(&itdev->tx_queue); -+ init_waitqueue_head(&itdev->tx_ended); -+ -+ /* copy model-specific parameters */ -+ itdev->params = *dev_desc; -+ -+ /* apply any overrides */ -+ if (sample_period > 0) -+ itdev->params.sample_period = sample_period; -+ -+ if (tx_carrier_freq > 0) -+ itdev->params.tx_carrier_freq = tx_carrier_freq; -+ -+ if (tx_duty_cycle > 0 && tx_duty_cycle <= 100) -+ itdev->params.tx_duty_cycle = tx_duty_cycle; -+ -+ if (rx_low_carrier_freq > 0) -+ itdev->params.rx_low_carrier_freq = rx_low_carrier_freq; -+ -+ if (rx_high_carrier_freq > 0) -+ itdev->params.rx_high_carrier_freq = rx_high_carrier_freq; -+ -+ /* print out parameters */ -+ ite_pr(KERN_NOTICE, "TX-capable: %d\n", (int) -+ itdev->params.hw_tx_capable); -+ ite_pr(KERN_NOTICE, "Sample period (ns): %ld\n", (long) -+ itdev->params.sample_period); -+ ite_pr(KERN_NOTICE, "TX carrier frequency (Hz): %d\n", (int) -+ itdev->params.tx_carrier_freq); -+ ite_pr(KERN_NOTICE, "TX duty cycle (%%): %d\n", (int) -+ itdev->params.tx_duty_cycle); -+ ite_pr(KERN_NOTICE, "RX low carrier frequency (Hz): %d\n", (int) -+ itdev->params.rx_low_carrier_freq); -+ ite_pr(KERN_NOTICE, "RX high carrier frequency (Hz): %d\n", (int) -+ itdev->params.rx_high_carrier_freq); -+ -+ /* set up hardware initial state */ -+ itdev->params.init_hardware(itdev); -+ -+ /* set up ir-core props */ -+ rdev->priv = itdev; -+ rdev->driver_type = RC_DRIVER_IR_RAW; -+ rdev->allowed_protos = IR_TYPE_ALL; -+ rdev->open = ite_open; -+ rdev->close = ite_close; -+ rdev->s_idle = ite_s_idle; -+ rdev->s_rx_carrier_range = ite_set_rx_carrier_range; -+ rdev->min_timeout = ITE_MIN_IDLE_TIMEOUT; -+ rdev->max_timeout = ITE_MAX_IDLE_TIMEOUT; -+ rdev->timeout = ITE_IDLE_TIMEOUT; -+ rdev->rx_resolution = rdev->tx_resolution = ITE_BAUDRATE_DIVISOR * -+ itdev->params.sample_period; -+ -+ /* set up transmitter related values if needed */ -+ if (itdev->params.hw_tx_capable) { -+ rdev->tx_ir = ite_tx_ir; -+ rdev->s_tx_carrier = ite_set_tx_carrier; -+ rdev->s_tx_duty_cycle = ite_set_tx_duty_cycle; -+ } -+ -+ rdev->input_name = dev_desc->model; -+ rdev->input_id.bustype = BUS_HOST; -+ rdev->input_id.vendor = PCI_VENDOR_ID_ITE; -+ rdev->input_id.product = 0; -+ rdev->input_id.version = 0; -+ rdev->driver_name = ITE_DRIVER_NAME; -+ rdev->map_name = RC_MAP_RC6_MCE; -+ -+ ret = rc_register_device(rdev); -+ if (ret) -+ goto failure; -+ -+ itdev->rdev = rdev; -+ ite_pr(KERN_NOTICE, "driver has been successfully loaded\n"); -+ -+ return 0; -+ -+failure: -+ if (itdev->cir_irq) -+ free_irq(itdev->cir_irq, itdev); -+ if (itdev->cir_addr) -+ release_region(itdev->cir_addr, itdev->params.io_region_size); -+ -+ rc_free_device(rdev); -+ kfree(itdev); -+ -+ return ret; -+} -+ -+static void __devexit ite_remove(struct pnp_dev *pdev) -+{ -+ struct ite_dev *dev = pnp_get_drvdata(pdev); -+ unsigned long flags; -+ -+ ite_dbg("%s called", __func__); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* disable hardware */ -+ dev->params.disable(dev); -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ /* free resources */ -+ free_irq(dev->cir_irq, dev); -+ release_region(dev->cir_addr, dev->params.io_region_size); -+ -+ rc_unregister_device(dev->rdev); -+ -+ kfree(dev); -+} -+ -+static int ite_suspend(struct pnp_dev *pdev, pm_message_t state) -+{ -+ struct ite_dev *dev = pnp_get_drvdata(pdev); -+ unsigned long flags; -+ -+ ite_dbg("%s called", __func__); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* disable all interrupts */ -+ dev->params.disable(dev); -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return 0; -+} -+ -+static int ite_resume(struct pnp_dev *pdev) -+{ -+ int ret = 0; -+ struct ite_dev *dev = pnp_get_drvdata(pdev); -+ unsigned long flags; -+ -+ ite_dbg("%s called", __func__); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ if (dev->transmitting) { -+ /* wake up the transmitter */ -+ wake_up_interruptible(&dev->tx_queue); -+ } else { -+ /* enable the receiver */ -+ dev->params.enable_rx(dev); -+ } -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+ -+ return ret; -+} -+ -+static void ite_shutdown(struct pnp_dev *pdev) -+{ -+ struct ite_dev *dev = pnp_get_drvdata(pdev); -+ unsigned long flags; -+ -+ ite_dbg("%s called", __func__); -+ -+ spin_lock_irqsave(&dev->lock, flags); -+ -+ /* disable all interrupts */ -+ dev->params.disable(dev); -+ -+ spin_unlock_irqrestore(&dev->lock, flags); -+} -+ -+static const struct pnp_device_id ite_ids[] = { -+ { "ITE8704", 0 }, /* Default model */ -+ { "ITE8713", 0 }, /* CIR found in EEEBox 1501U */ -+ { "ITE8708", 1 }, /* Bridged IT8512 */ -+ { "", 0 }, -+}; -+ -+static struct pnp_driver ite_driver = { -+ .name = ITE_DRIVER_NAME, -+ .id_table = ite_ids, -+ .probe = ite_probe, -+ .remove = __devexit_p(ite_remove), -+ .suspend = ite_suspend, -+ .resume = ite_resume, -+ .shutdown = ite_shutdown, -+}; -+ -+int ite_init(void) -+{ -+ return pnp_register_driver(&ite_driver); -+} -+ -+void ite_exit(void) -+{ -+ pnp_unregister_driver(&ite_driver); -+} -+ -+MODULE_DEVICE_TABLE(pnp, ite_ids); -+MODULE_DESCRIPTION("ITE Tech Inc. IT8712F/ITE8512F CIR driver"); -+ -+MODULE_AUTHOR("Juan J. Garcia de Soria "); -+MODULE_LICENSE("GPL"); -+ -+module_init(ite_init); -+module_exit(ite_exit); -diff -Naur linux-2.6.36.2/drivers/media/IR/ite-cir.h linux-2.6.36.2.patch/drivers/media/IR/ite-cir.h ---- linux-2.6.36.2/drivers/media/IR/ite-cir.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/media/IR/ite-cir.h 2010-12-11 22:53:05.359095723 +0100 -@@ -0,0 +1,446 @@ -+/* -+ * Driver for ITE Tech Inc. IT8712F/IT8512F CIR -+ * -+ * Copyright (C) 2010 Juan J. Garcia de Soria -+ * -+ * Based on nuvoton-cir and lirc_it87 drivers. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -+ * USA -+ */ -+ -+/* platform driver name to register */ -+#define ITE_DRIVER_NAME "ite-cir" -+ -+/* logging macros */ -+#define ite_pr(level, text, ...) \ -+ printk(level KBUILD_MODNAME ": " text, ## __VA_ARGS__) -+ -+#define ite_dbg(text, ...) \ -+ if (debug) \ -+ printk(KERN_DEBUG \ -+ KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__) -+ -+#define ite_dbg_verbose(text, ...) \ -+ if (debug > 1) \ -+ printk(KERN_DEBUG \ -+ KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__) -+ -+/* FIFO sizes */ -+#define ITE_TX_FIFO_LEN 32 -+#define ITE_RX_FIFO_LEN 32 -+ -+/* interrupt types */ -+#define ITE_IRQ_TX_FIFO 1 -+#define ITE_IRQ_RX_FIFO 2 -+#define ITE_IRQ_RX_FIFO_OVERRUN 4 -+ -+/* forward declaration */ -+struct ite_dev; -+ -+/* struct for storing the parameters of different recognized devices */ -+struct ite_dev_params { -+ /* model of the device */ -+ const char *model; -+ -+ /* size of the I/O region */ -+ int io_region_size; -+ -+ /* true if the hardware supports transmission */ -+ bool hw_tx_capable; -+ -+ /* base sampling period, in ns */ -+ u32 sample_period; -+ -+ /* rx low carrier frequency, in Hz, 0 means no demodulation */ -+ unsigned int rx_low_carrier_freq; -+ -+ /* tx high carrier frequency, in Hz, 0 means no demodulation */ -+ unsigned int rx_high_carrier_freq; -+ -+ /* tx carrier frequency, in Hz */ -+ unsigned int tx_carrier_freq; -+ -+ /* duty cycle, 0-100 */ -+ int tx_duty_cycle; -+ -+ /* hw-specific operation function pointers; most of these must be -+ * called while holding the spin lock, except for the TX FIFO length -+ * one */ -+ -+ /* get pending interrupt causes */ -+ int (*get_irq_causes)(struct ite_dev *dev); -+ -+ /* enable rx */ -+ void (*enable_rx)(struct ite_dev *dev); -+ -+ /* make rx enter the idle state; keep listening for a pulse, but stop -+ * streaming space bytes */ -+ void (*idle_rx)(struct ite_dev *dev); -+ -+ /* disable rx completely */ -+ void (*disable_rx)(struct ite_dev *dev); -+ -+ /* read bytes from RX FIFO; return read count */ -+ int (*get_rx_bytes)(struct ite_dev *dev, u8 *buf, int buf_size); -+ -+ /* enable tx FIFO space available interrupt */ -+ void (*enable_tx_interrupt)(struct ite_dev *dev); -+ -+ /* disable tx FIFO space available interrupt */ -+ void (*disable_tx_interrupt)(struct ite_dev *dev); -+ -+ /* get number of available TX FIFO slots */ -+ int (*get_tx_free_slots)(struct ite_dev *dev); -+ -+ /* put a byte to the TX FIFO */ -+ void (*put_tx_byte)(struct ite_dev *dev, u8 value); -+ -+ /* disable hardware completely */ -+ void (*disable)(struct ite_dev *dev); -+ -+ /* initialize the hardware */ -+ void (*init_hardware)(struct ite_dev *dev); -+ -+ /* set the carrier parameters */ -+ void (*set_carrier_params)(struct ite_dev *dev, bool high_freq, -+ bool use_demodulator, u8 carrier_freq_bits, -+ u8 allowance_bits, u8 pulse_width_bits); -+}; -+ -+/* ITE CIR device structure */ -+struct ite_dev { -+ struct pnp_dev *pdev; -+ struct ir_dev *rdev; -+ struct ir_raw_event rawir; -+ -+ /* sync data */ -+ spinlock_t lock; -+ bool in_use, transmitting; -+ -+ /* transmit support */ -+ int tx_fifo_allowance; -+ wait_queue_head_t tx_queue, tx_ended; -+ -+ /* hardware I/O settings */ -+ unsigned long cir_addr; -+ int cir_irq; -+ -+ /* overridable copy of model parameters */ -+ struct ite_dev_params params; -+}; -+ -+ -+/* common values for all kinds of hardware */ -+ -+/* baud rate divisor default */ -+#define ITE_BAUDRATE_DIVISOR 1 -+ -+/* low-speed carrier frequency limits (Hz) */ -+#define ITE_LCF_MIN_CARRIER_FREQ 27000 -+#define ITE_LCF_MAX_CARRIER_FREQ 58000 -+ -+/* high-speed carrier frequency limits (Hz) */ -+#define ITE_HCF_MIN_CARRIER_FREQ 400000 -+#define ITE_HCF_MAX_CARRIER_FREQ 500000 -+ -+/* default carrier freq for when demodulator is off (Hz) */ -+#define ITE_DEFAULT_CARRIER_FREQ 38000 -+ -+/* default idling timeout in ns (0.2 seconds) */ -+#define ITE_IDLE_TIMEOUT 200000000UL -+ -+/* limit timeout values */ -+#define ITE_MIN_IDLE_TIMEOUT 100000000UL -+#define ITE_MAX_IDLE_TIMEOUT 1000000000UL -+ -+/* convert bits to us */ -+#define ITE_BITS_TO_NS(bits, sample_period) \ -+((u32) ((bits) * ITE_BAUDRATE_DIVISOR * sample_period)) -+ -+/* -+ * n in IT87_RDCR produces a tolerance of +/- n * 6.25% around the center -+ * carrier frequency... -+ * -+ * From two limit frequencies, L (low) and H (high), we can get both the -+ * center frequency F = (L + H) / 2 and the variation from the center -+ * frequency A = (H - L) / (H + L). We can use this in order to honor the -+ * s_rx_carrier_range() call in ir-core. We'll suppose that any request -+ * setting L=0 means we must shut down the demodulator. -+ */ -+#define ITE_RXDCR_PER_10000_STEP 625 -+ -+/* high speed carrier freq values */ -+#define ITE_CFQ_400 0x03 -+#define ITE_CFQ_450 0x08 -+#define ITE_CFQ_480 0x0b -+#define ITE_CFQ_500 0x0d -+ -+/* values for pulse widths */ -+#define ITE_TXMPW_A 0x02 -+#define ITE_TXMPW_B 0x03 -+#define ITE_TXMPW_C 0x04 -+#define ITE_TXMPW_D 0x05 -+#define ITE_TXMPW_E 0x06 -+ -+/* values for demodulator carrier range allowance */ -+#define ITE_RXDCR_DEFAULT 0x01 /* default carrier range */ -+#define ITE_RXDCR_MAX 0x07 /* default carrier range */ -+ -+/* DR TX bits */ -+#define ITE_TX_PULSE 0x00 -+#define ITE_TX_SPACE 0x80 -+#define ITE_TX_MAX_RLE 0x80 -+#define ITE_TX_RLE_MASK 0x7F -+ -+ -+/* -+ * IT8712F -+ * -+ * hardware data obtained from: -+ * -+ * IT8712F -+ * Environment Control – Low Pin Count Input / Output -+ * (EC - LPC I/O) -+ * Preliminary Specification V0. 81 -+ */ -+ -+/* register offsets */ -+#define IT87_DR 0x00 /* data register */ -+#define IT87_IER 0x01 /* interrupt enable register */ -+#define IT87_RCR 0x02 /* receiver control register */ -+#define IT87_TCR1 0x03 /* transmitter control register 1 */ -+#define IT87_TCR2 0x04 /* transmitter control register 2 */ -+#define IT87_TSR 0x05 /* transmitter status register */ -+#define IT87_RSR 0x06 /* receiver status register */ -+#define IT87_BDLR 0x05 /* baud rate divisor low byte register */ -+#define IT87_BDHR 0x06 /* baud rate divisor high byte register */ -+#define IT87_IIR 0x07 /* interrupt identification register */ -+ -+#define IT87_IOREG_LENGTH 0x08 /* length of register file */ -+ -+/* IER bits */ -+#define IT87_TLDLIE 0x01 /* transmitter low data interrupt enable */ -+#define IT87_RDAIE 0x02 /* receiver data available interrupt enable */ -+#define IT87_RFOIE 0x04 /* receiver FIFO overrun interrupt enable */ -+#define IT87_IEC 0x08 /* interrupt enable control */ -+#define IT87_BR 0x10 /* baud rate register enable */ -+#define IT87_RESET 0x20 /* reset */ -+ -+/* RCR bits */ -+#define IT87_RXDCR 0x07 /* receiver demodulation carrier range mask */ -+#define IT87_RXACT 0x08 /* receiver active */ -+#define IT87_RXEND 0x10 /* receiver demodulation enable */ -+#define IT87_RXEN 0x20 /* receiver enable */ -+#define IT87_HCFS 0x40 /* high-speed carrier frequency select */ -+#define IT87_RDWOS 0x80 /* receiver data without sync */ -+ -+/* TCR1 bits */ -+#define IT87_TXMPM 0x03 /* transmitter modulation pulse mode mask */ -+#define IT87_TXMPM_DEFAULT 0x00 /* modulation pulse mode default */ -+#define IT87_TXENDF 0x04 /* transmitter deferral */ -+#define IT87_TXRLE 0x08 /* transmitter run length enable */ -+#define IT87_FIFOTL 0x30 /* FIFO level threshold mask */ -+#define IT87_FIFOTL_DEFAULT 0x20 /* FIFO level threshold default -+ 0x00 -> 1, 0x10 -> 7, 0x20 -> 17, -+ 0x30 -> 25 */ -+#define IT87_ILE 0x40 /* internal loopback enable */ -+#define IT87_FIFOCLR 0x80 /* FIFO clear bit */ -+ -+/* TCR2 bits */ -+#define IT87_TXMPW 0x07 /* transmitter modulation pulse width mask */ -+#define IT87_TXMPW_DEFAULT 0x04 /* default modulation pulse width */ -+#define IT87_CFQ 0xf8 /* carrier frequency mask */ -+#define IT87_CFQ_SHIFT 3 /* carrier frequency bit shift */ -+ -+/* TSR bits */ -+#define IT87_TXBFC 0x3f /* transmitter FIFO byte count mask */ -+ -+/* RSR bits */ -+#define IT87_RXBFC 0x3f /* receiver FIFO byte count mask */ -+#define IT87_RXFTO 0x80 /* receiver FIFO time-out */ -+ -+/* IIR bits */ -+#define IT87_IP 0x01 /* interrupt pending */ -+#define IT87_II 0x06 /* interrupt identification mask */ -+#define IT87_II_NOINT 0x00 /* no interrupt */ -+#define IT87_II_TXLDL 0x02 /* transmitter low data level */ -+#define IT87_II_RXDS 0x04 /* receiver data stored */ -+#define IT87_II_RXFO 0x06 /* receiver FIFO overrun */ -+ -+ -+/* -+ * IT8512E/F -+ * -+ * Hardware data obtained from: -+ * -+ * IT8512E/F -+ * Embedded Controller -+ * Preliminary Specification V0.4.1 -+ * -+ * Note that the CIR registers are not directly available to the host, because -+ * they only are accessible to the integrated microcontroller. Thus, in order -+ * use it, some kind of bridging is required. As the bridging may depend on -+ * the controller firmware in use, we are going to use the PNP ID in order to -+ * determine the strategy and ports available. See after these generic -+ * IT8512E/F register definitions for register definitions for those -+ * strategies. -+ */ -+ -+/* register offsets */ -+#define IT85_C0DR 0x00 /* data register */ -+#define IT85_C0MSTCR 0x01 /* master control register */ -+#define IT85_C0IER 0x02 /* interrupt enable register */ -+#define IT85_C0IIR 0x03 /* interrupt identification register */ -+#define IT85_C0CFR 0x04 /* carrier frequency register */ -+#define IT85_C0RCR 0x05 /* receiver control register */ -+#define IT85_C0TCR 0x06 /* transmitter control register */ -+#define IT85_C0SCK 0x07 /* slow clock control register */ -+#define IT85_C0BDLR 0x08 /* baud rate divisor low byte register */ -+#define IT85_C0BDHR 0x09 /* baud rate divisor high byte register */ -+#define IT85_C0TFSR 0x0a /* transmitter FIFO status register */ -+#define IT85_C0RFSR 0x0b /* receiver FIFO status register */ -+#define IT85_C0WCL 0x0d /* wakeup code length register */ -+#define IT85_C0WCR 0x0e /* wakeup code read/write register */ -+#define IT85_C0WPS 0x0f /* wakeup power control/status register */ -+ -+#define IT85_IOREG_LENGTH 0x10 /* length of register file */ -+ -+/* C0MSTCR bits */ -+#define IT85_RESET 0x01 /* reset */ -+#define IT85_FIFOCLR 0x02 /* FIFO clear bit */ -+#define IT85_FIFOTL 0x0c /* FIFO level threshold mask */ -+#define IT85_FIFOTL_DEFAULT 0x08 /* FIFO level threshold default -+ 0x00 -> 1, 0x04 -> 7, 0x08 -> 17, -+ 0x0c -> 25 */ -+#define IT85_ILE 0x10 /* internal loopback enable */ -+#define IT85_ILSEL 0x20 /* internal loopback select */ -+ -+/* C0IER bits */ -+#define IT85_TLDLIE 0x01 /* TX low data level interrupt enable */ -+#define IT85_RDAIE 0x02 /* RX data available interrupt enable */ -+#define IT85_RFOIE 0x04 /* RX FIFO overrun interrupt enable */ -+#define IT85_IEC 0x80 /* interrupt enable function control */ -+ -+/* C0IIR bits */ -+#define IT85_TLDLI 0x01 /* transmitter low data level interrupt */ -+#define IT85_RDAI 0x02 /* receiver data available interrupt */ -+#define IT85_RFOI 0x04 /* receiver FIFO overrun interrupt */ -+#define IT85_NIP 0x80 /* no interrupt pending */ -+ -+/* C0CFR bits */ -+#define IT85_CFQ 0x1f /* carrier frequency mask */ -+#define IT85_HCFS 0x20 /* high speed carrier frequency select */ -+ -+/* C0RCR bits */ -+#define IT85_RXDCR 0x07 /* receiver demodulation carrier range mask */ -+#define IT85_RXACT 0x08 /* receiver active */ -+#define IT85_RXEND 0x10 /* receiver demodulation enable */ -+#define IT85_RDWOS 0x20 /* receiver data without sync */ -+#define IT85_RXEN 0x80 /* receiver enable */ -+ -+/* C0TCR bits */ -+#define IT85_TXMPW 0x07 /* transmitter modulation pulse width mask */ -+#define IT85_TXMPW_DEFAULT 0x04 /* default modulation pulse width */ -+#define IT85_TXMPM 0x18 /* transmitter modulation pulse mode mask */ -+#define IT85_TXMPM_DEFAULT 0x00 /* modulation pulse mode default */ -+#define IT85_TXENDF 0x20 /* transmitter deferral */ -+#define IT85_TXRLE 0x40 /* transmitter run length enable */ -+ -+/* C0SCK bits */ -+#define IT85_SCKS 0x01 /* slow clock select */ -+#define IT85_TXDCKG 0x02 /* TXD clock gating */ -+#define IT85_DLL1P8E 0x04 /* DLL 1.8432M enable */ -+#define IT85_DLLTE 0x08 /* DLL test enable */ -+#define IT85_BRCM 0x70 /* baud rate count mode */ -+#define IT85_DLLOCK 0x80 /* DLL lock */ -+ -+/* C0TFSR bits */ -+#define IT85_TXFBC 0x3f /* transmitter FIFO count mask */ -+ -+/* C0RFSR bits */ -+#define IT85_RXFBC 0x3f /* receiver FIFO count mask */ -+#define IT85_RXFTO 0x80 /* receiver FIFO time-out */ -+ -+/* C0WCL bits */ -+#define IT85_WCL 0x3f /* wakeup code length mask */ -+ -+/* C0WPS bits */ -+#define IT85_CIRPOSIE 0x01 /* power on/off status interrupt enable */ -+#define IT85_CIRPOIS 0x02 /* power on/off interrupt status */ -+#define IT85_CIRPOII 0x04 /* power on/off interrupt identification */ -+#define IT85_RCRST 0x10 /* wakeup code reading counter reset bit */ -+#define IT85_WCRST 0x20 /* wakeup code writing counter reset bit */ -+ -+ -+/* -+ * ITE8708 -+ * -+ * Hardware data obtained from hacked driver for IT8512 in this forum post: -+ * -+ * http://ubuntuforums.org/showthread.php?t=1028640 -+ * -+ * Although there's no official documentation for that driver, analysis would -+ * suggest that it maps the 16 registers of IT8512 onto two 8-register banks, -+ * selectable by a single bank-select bit that's mapped onto both banks. The -+ * IT8512 registers are mapped in a different order, so that the first bank -+ * maps the ones that are used more often, and two registers that share a -+ * reserved high-order bit are placed at the same offset in both banks in -+ * order to reuse the reserved bit as the bank select bit. -+ */ -+ -+/* register offsets */ -+ -+/* mapped onto both banks */ -+#define IT8708_BANKSEL 0x07 /* bank select register */ -+#define IT8708_HRAE 0x80 /* high registers access enable */ -+ -+/* mapped onto the low bank */ -+#define IT8708_C0DR 0x00 /* data register */ -+#define IT8708_C0MSTCR 0x01 /* master control register */ -+#define IT8708_C0IER 0x02 /* interrupt enable register */ -+#define IT8708_C0IIR 0x03 /* interrupt identification register */ -+#define IT8708_C0RFSR 0x04 /* receiver FIFO status register */ -+#define IT8708_C0RCR 0x05 /* receiver control register */ -+#define IT8708_C0TFSR 0x06 /* transmitter FIFO status register */ -+#define IT8708_C0TCR 0x07 /* transmitter control register */ -+ -+/* mapped onto the high bank */ -+#define IT8708_C0BDLR 0x01 /* baud rate divisor low byte register */ -+#define IT8708_C0BDHR 0x02 /* baud rate divisor high byte register */ -+#define IT8708_C0CFR 0x04 /* carrier frequency register */ -+ -+/* registers whose bank mapping we don't know, since they weren't being used -+ * in the hacked driver... most probably they belong to the high bank too, -+ * since they fit in the holes the other registers leave */ -+#define IT8708_C0SCK 0x03 /* slow clock control register */ -+#define IT8708_C0WCL 0x05 /* wakeup code length register */ -+#define IT8708_C0WCR 0x06 /* wakeup code read/write register */ -+#define IT8708_C0WPS 0x07 /* wakeup power control/status register */ -+ -+#define IT8708_IOREG_LENGTH 0x08 /* length of register file */ -+ -+/* two more registers that are defined in the hacked driver, but can't be -+ * found in the data sheets; no idea what they are or how they are accessed, -+ * since the hacked driver doesn't seem to use them */ -+#define IT8708_CSCRR 0x00 -+#define IT8708_CGPINTR 0x01 -+ -+/* CSCRR bits */ -+#define IT8708_CSCRR_SCRB 0x3f -+#define IT8708_CSCRR_PM 0x80 -+ -+/* CGPINTR bits */ -+#define IT8708_CGPINT 0x01 -diff -Naur linux-2.6.36.2/drivers/media/IR/Kconfig linux-2.6.36.2.patch/drivers/media/IR/Kconfig ---- linux-2.6.36.2/drivers/media/IR/Kconfig 2010-12-09 23:17:27.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/media/IR/Kconfig 2010-12-11 22:50:14.406094135 +0100 -@@ -127,6 +127,19 @@ - To compile this driver as a module, choose M here: the - module will be called ene_ir. - -+config IR_ITE_CIR -+ tristate "ITE Tech Inc. IT8712/IT8512 Consumer Infrared Transceiver" -+ depends on PNP -+ depends on IR_CORE -+ ---help--- -+ Say Y here to enable support for integrated infrared receivers -+ /transceivers made by ITE Tech Inc. These are found in -+ several ASUS devices, like the ASUS Digimatrix or the ASUS -+ EEEBox 1501U. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called ite-cir. -+ - config IR_STREAMZAP - tristate "Streamzap PC Remote IR Receiver" - depends on USB_ARCH_HAS_HCD -diff -Naur linux-2.6.36.2/drivers/media/IR/Makefile linux-2.6.36.2.patch/drivers/media/IR/Makefile ---- linux-2.6.36.2/drivers/media/IR/Makefile 2010-12-09 23:17:27.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/media/IR/Makefile 2010-12-11 22:25:05.388510013 +0100 -@@ -18,3 +18,4 @@ - obj-$(CONFIG_IR_MCEUSB) += mceusb.o - obj-$(CONFIG_IR_ENE) += ene_ir.o - obj-$(CONFIG_IR_STREAMZAP) += streamzap.o -+obj-$(CONFIG_IR_ITE_CIR) += ite-cir.o -diff -Naur linux-2.6.36.2/drivers/staging/lirc/Kconfig linux-2.6.36.2.patch/drivers/staging/lirc/Kconfig ---- linux-2.6.36.2/drivers/staging/lirc/Kconfig 2010-12-09 23:17:27.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/staging/lirc/Kconfig 2010-12-11 22:18:26.840935467 +0100 -@@ -39,12 +39,6 @@ - - Current generation iMON devices use the input layer imon driver. - --config LIRC_IT87 -- tristate "ITE IT87XX CIR Port Receiver" -- depends on LIRC_STAGING && PNP -- help -- Driver for the ITE IT87xx IR Receiver -- - config LIRC_ITE8709 - tristate "ITE8709 CIR Port Receiver" - depends on LIRC_STAGING && PNP -diff -Naur linux-2.6.36.2/drivers/staging/lirc/lirc_it87.c linux-2.6.36.2.patch/drivers/staging/lirc/lirc_it87.c ---- linux-2.6.36.2/drivers/staging/lirc/lirc_it87.c 2010-12-09 23:17:27.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/staging/lirc/lirc_it87.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,1022 +0,0 @@ --/* -- * LIRC driver for ITE IT8712/IT8705 CIR port -- * -- * Copyright (C) 2001 Hans-Gunter Lutke Uphues -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU General Public License as -- * published by the Free Software Foundation; either version 2 of the -- * License, or (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, but -- * WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * General Public License for more details. -- -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -- * USA -- * -- * ITE IT8705 and IT8712(not tested) and IT8720 CIR-port support for lirc based -- * via cut and paste from lirc_sir.c (C) 2000 Milan Pikula -- * -- * Attention: Sendmode only tested with debugging logs -- * -- * 2001/02/27 Christoph Bartelmus : -- * reimplemented read function -- * 2005/06/05 Andrew Calkin implemented support for Asus Digimatrix, -- * based on work of the following member of the Outertrack Digimatrix -- * Forum: Art103 -- * 2009/12/24 James Edwards implemeted support -- * for ITE8704/ITE8718, on my machine, the DSDT reports 8704, but the -- * chip identifies as 18. -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#include --#include -- --#include --#include -- --#include "lirc_it87.h" -- --#ifdef LIRC_IT87_DIGIMATRIX --static int digimatrix = 1; --static int it87_freq = 36; /* kHz */ --static int irq = 9; --#else --static int digimatrix; --static int it87_freq = 38; /* kHz */ --static int irq = IT87_CIR_DEFAULT_IRQ; --#endif -- --static unsigned long it87_bits_in_byte_out; --static unsigned long it87_send_counter; --static unsigned char it87_RXEN_mask = IT87_CIR_RCR_RXEN; -- --#define RBUF_LEN 1024 -- --#define LIRC_DRIVER_NAME "lirc_it87" -- --/* timeout for sequences in jiffies (=5/100s) */ --/* must be longer than TIME_CONST */ --#define IT87_TIMEOUT (HZ*5/100) -- --/* module parameters */ --static int debug; --#define dprintk(fmt, args...) \ -- do { \ -- if (debug) \ -- printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \ -- fmt, ## args); \ -- } while (0) -- --static int io = IT87_CIR_DEFAULT_IOBASE; --/* receiver demodulator default: off */ --static int it87_enable_demodulator; -- --static int timer_enabled; --static DEFINE_SPINLOCK(timer_lock); --static struct timer_list timerlist; --/* time of last signal change detected */ --static struct timeval last_tv = {0, 0}; --/* time of last UART data ready interrupt */ --static struct timeval last_intr_tv = {0, 0}; --static int last_value; -- --static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue); -- --static DEFINE_SPINLOCK(hardware_lock); --static DEFINE_SPINLOCK(dev_lock); --static bool device_open; -- --static int rx_buf[RBUF_LEN]; --unsigned int rx_tail, rx_head; -- --static struct pnp_driver it87_pnp_driver; -- --/* SECTION: Prototypes */ -- --/* Communication with user-space */ --static int lirc_open(struct inode *inode, struct file *file); --static int lirc_close(struct inode *inode, struct file *file); --static unsigned int lirc_poll(struct file *file, poll_table *wait); --static ssize_t lirc_read(struct file *file, char *buf, -- size_t count, loff_t *ppos); --static ssize_t lirc_write(struct file *file, const char *buf, -- size_t n, loff_t *pos); --static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); --static void add_read_queue(int flag, unsigned long val); --static int init_chrdev(void); --static void drop_chrdev(void); --/* Hardware */ --static irqreturn_t it87_interrupt(int irq, void *dev_id); --static void send_space(unsigned long len); --static void send_pulse(unsigned long len); --static void init_send(void); --static void terminate_send(unsigned long len); --static int init_hardware(void); --static void drop_hardware(void); --/* Initialisation */ --static int init_port(void); --static void drop_port(void); -- -- --/* SECTION: Communication with user-space */ -- --static int lirc_open(struct inode *inode, struct file *file) --{ -- spin_lock(&dev_lock); -- if (device_open) { -- spin_unlock(&dev_lock); -- return -EBUSY; -- } -- device_open = true; -- spin_unlock(&dev_lock); -- return 0; --} -- -- --static int lirc_close(struct inode *inode, struct file *file) --{ -- spin_lock(&dev_lock); -- device_open = false; -- spin_unlock(&dev_lock); -- return 0; --} -- -- --static unsigned int lirc_poll(struct file *file, poll_table *wait) --{ -- poll_wait(file, &lirc_read_queue, wait); -- if (rx_head != rx_tail) -- return POLLIN | POLLRDNORM; -- return 0; --} -- -- --static ssize_t lirc_read(struct file *file, char *buf, -- size_t count, loff_t *ppos) --{ -- int n = 0; -- int retval = 0; -- -- while (n < count) { -- if (file->f_flags & O_NONBLOCK && rx_head == rx_tail) { -- retval = -EAGAIN; -- break; -- } -- retval = wait_event_interruptible(lirc_read_queue, -- rx_head != rx_tail); -- if (retval) -- break; -- -- if (copy_to_user((void *) buf + n, (void *) (rx_buf + rx_head), -- sizeof(int))) { -- retval = -EFAULT; -- break; -- } -- rx_head = (rx_head + 1) & (RBUF_LEN - 1); -- n += sizeof(int); -- } -- if (n) -- return n; -- return retval; --} -- -- --static ssize_t lirc_write(struct file *file, const char *buf, -- size_t n, loff_t *pos) --{ -- int i = 0; -- int *tx_buf; -- -- if (n % sizeof(int)) -- return -EINVAL; -- tx_buf = memdup_user(buf, n); -- if (IS_ERR(tx_buf)) -- return PTR_ERR(tx_buf); -- n /= sizeof(int); -- init_send(); -- while (1) { -- if (i >= n) -- break; -- if (tx_buf[i]) -- send_pulse(tx_buf[i]); -- i++; -- if (i >= n) -- break; -- if (tx_buf[i]) -- send_space(tx_buf[i]); -- i++; -- } -- terminate_send(tx_buf[i - 1]); -- return n; --} -- -- --static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) --{ -- int retval = 0; -- unsigned long value = 0; -- unsigned int ivalue; -- unsigned long hw_flags; -- -- if (cmd == LIRC_GET_FEATURES) -- value = LIRC_CAN_SEND_PULSE | -- LIRC_CAN_SET_SEND_CARRIER | -- LIRC_CAN_REC_MODE2; -- else if (cmd == LIRC_GET_SEND_MODE) -- value = LIRC_MODE_PULSE; -- else if (cmd == LIRC_GET_REC_MODE) -- value = LIRC_MODE_MODE2; -- -- switch (cmd) { -- case LIRC_GET_FEATURES: -- case LIRC_GET_SEND_MODE: -- case LIRC_GET_REC_MODE: -- retval = put_user(value, (unsigned long *) arg); -- break; -- -- case LIRC_SET_SEND_MODE: -- case LIRC_SET_REC_MODE: -- retval = get_user(value, (unsigned long *) arg); -- break; -- -- case LIRC_SET_SEND_CARRIER: -- retval = get_user(ivalue, (unsigned int *) arg); -- if (retval) -- return retval; -- ivalue /= 1000; -- if (ivalue > IT87_CIR_FREQ_MAX || -- ivalue < IT87_CIR_FREQ_MIN) -- return -EINVAL; -- -- it87_freq = ivalue; -- -- spin_lock_irqsave(&hardware_lock, hw_flags); -- outb(((inb(io + IT87_CIR_TCR2) & IT87_CIR_TCR2_TXMPW) | -- (it87_freq - IT87_CIR_FREQ_MIN) << 3), -- io + IT87_CIR_TCR2); -- spin_unlock_irqrestore(&hardware_lock, hw_flags); -- dprintk("demodulation frequency: %d kHz\n", it87_freq); -- -- break; -- -- default: -- retval = -EINVAL; -- } -- -- if (retval) -- return retval; -- -- if (cmd == LIRC_SET_REC_MODE) { -- if (value != LIRC_MODE_MODE2) -- retval = -ENOSYS; -- } else if (cmd == LIRC_SET_SEND_MODE) { -- if (value != LIRC_MODE_PULSE) -- retval = -ENOSYS; -- } -- return retval; --} -- --static void add_read_queue(int flag, unsigned long val) --{ -- unsigned int new_rx_tail; -- int newval; -- -- dprintk("add flag %d with val %lu\n", flag, val); -- -- newval = val & PULSE_MASK; -- -- /* -- * statistically, pulses are ~TIME_CONST/2 too long. we could -- * maybe make this more exact, but this is good enough -- */ -- if (flag) { -- /* pulse */ -- if (newval > TIME_CONST / 2) -- newval -= TIME_CONST / 2; -- else /* should not ever happen */ -- newval = 1; -- newval |= PULSE_BIT; -- } else -- newval += TIME_CONST / 2; -- new_rx_tail = (rx_tail + 1) & (RBUF_LEN - 1); -- if (new_rx_tail == rx_head) { -- dprintk("Buffer overrun.\n"); -- return; -- } -- rx_buf[rx_tail] = newval; -- rx_tail = new_rx_tail; -- wake_up_interruptible(&lirc_read_queue); --} -- -- --static const struct file_operations lirc_fops = { -- .owner = THIS_MODULE, -- .read = lirc_read, -- .write = lirc_write, -- .poll = lirc_poll, -- .unlocked_ioctl = lirc_ioctl, -- .open = lirc_open, -- .release = lirc_close, --}; -- --static int set_use_inc(void *data) --{ -- return 0; --} -- --static void set_use_dec(void *data) --{ --} -- --static struct lirc_driver driver = { -- .name = LIRC_DRIVER_NAME, -- .minor = -1, -- .code_length = 1, -- .sample_rate = 0, -- .data = NULL, -- .add_to_buf = NULL, -- .set_use_inc = set_use_inc, -- .set_use_dec = set_use_dec, -- .fops = &lirc_fops, -- .dev = NULL, -- .owner = THIS_MODULE, --}; -- -- --static int init_chrdev(void) --{ -- driver.minor = lirc_register_driver(&driver); -- -- if (driver.minor < 0) { -- printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n"); -- return -EIO; -- } -- return 0; --} -- -- --static void drop_chrdev(void) --{ -- lirc_unregister_driver(driver.minor); --} -- -- --/* SECTION: Hardware */ --static long delta(struct timeval *tv1, struct timeval *tv2) --{ -- unsigned long deltv; -- -- deltv = tv2->tv_sec - tv1->tv_sec; -- if (deltv > 15) -- deltv = 0xFFFFFF; -- else -- deltv = deltv*1000000 + tv2->tv_usec - tv1->tv_usec; -- return deltv; --} -- --static void it87_timeout(unsigned long data) --{ -- unsigned long flags; -- -- /* avoid interference with interrupt */ -- spin_lock_irqsave(&timer_lock, flags); -- -- if (digimatrix) { -- /* We have timed out. Disable the RX mechanism. */ -- -- outb((inb(io + IT87_CIR_RCR) & ~IT87_CIR_RCR_RXEN) | -- IT87_CIR_RCR_RXACT, io + IT87_CIR_RCR); -- if (it87_RXEN_mask) -- outb(inb(io + IT87_CIR_RCR) | IT87_CIR_RCR_RXEN, -- io + IT87_CIR_RCR); -- dprintk(" TIMEOUT\n"); -- timer_enabled = 0; -- -- /* fifo clear */ -- outb(inb(io + IT87_CIR_TCR1) | IT87_CIR_TCR1_FIFOCLR, -- io+IT87_CIR_TCR1); -- -- } else { -- /* -- * if last received signal was a pulse, but receiving stopped -- * within the 9 bit frame, we need to finish this pulse and -- * simulate a signal change to from pulse to space. Otherwise -- * upper layers will receive two sequences next time. -- */ -- -- if (last_value) { -- unsigned long pulse_end; -- -- /* determine 'virtual' pulse end: */ -- pulse_end = delta(&last_tv, &last_intr_tv); -- dprintk("timeout add %d for %lu usec\n", -- last_value, pulse_end); -- add_read_queue(last_value, pulse_end); -- last_value = 0; -- last_tv = last_intr_tv; -- } -- } -- spin_unlock_irqrestore(&timer_lock, flags); --} -- --static irqreturn_t it87_interrupt(int irq, void *dev_id) --{ -- unsigned char data; -- struct timeval curr_tv; -- static unsigned long deltv; -- unsigned long deltintrtv; -- unsigned long flags, hw_flags; -- int iir, lsr; -- int fifo = 0; -- static char lastbit; -- char bit; -- -- /* Bit duration in microseconds */ -- const unsigned long bit_duration = 1000000ul / -- (115200 / IT87_CIR_BAUDRATE_DIVISOR); -- -- -- iir = inb(io + IT87_CIR_IIR); -- -- switch (iir & IT87_CIR_IIR_IID) { -- case 0x4: -- case 0x6: -- lsr = inb(io + IT87_CIR_RSR) & (IT87_CIR_RSR_RXFTO | -- IT87_CIR_RSR_RXFBC); -- fifo = lsr & IT87_CIR_RSR_RXFBC; -- dprintk("iir: 0x%x fifo: 0x%x\n", iir, lsr); -- -- /* avoid interference with timer */ -- spin_lock_irqsave(&timer_lock, flags); -- spin_lock_irqsave(&hardware_lock, hw_flags); -- if (digimatrix) { -- static unsigned long acc_pulse; -- static unsigned long acc_space; -- -- do { -- data = inb(io + IT87_CIR_DR); -- data = ~data; -- fifo--; -- if (data != 0x00) { -- if (timer_enabled) -- del_timer(&timerlist); -- /* -- * start timer for end of -- * sequence detection -- */ -- timerlist.expires = jiffies + -- IT87_TIMEOUT; -- add_timer(&timerlist); -- timer_enabled = 1; -- } -- /* Loop through */ -- for (bit = 0; bit < 8; ++bit) { -- if ((data >> bit) & 1) { -- ++acc_pulse; -- if (lastbit == 0) { -- add_read_queue(0, -- acc_space * -- bit_duration); -- acc_space = 0; -- } -- } else { -- ++acc_space; -- if (lastbit == 1) { -- add_read_queue(1, -- acc_pulse * -- bit_duration); -- acc_pulse = 0; -- } -- } -- lastbit = (data >> bit) & 1; -- } -- -- } while (fifo != 0); -- } else { /* Normal Operation */ -- do { -- del_timer(&timerlist); -- data = inb(io + IT87_CIR_DR); -- -- dprintk("data=%02x\n", data); -- do_gettimeofday(&curr_tv); -- deltv = delta(&last_tv, &curr_tv); -- deltintrtv = delta(&last_intr_tv, &curr_tv); -- -- dprintk("t %lu , d %d\n", -- deltintrtv, (int)data); -- -- /* -- * if nothing came in last 2 cycles, -- * it was gap -- */ -- if (deltintrtv > TIME_CONST * 2) { -- if (last_value) { -- dprintk("GAP\n"); -- -- /* simulate signal change */ -- add_read_queue(last_value, -- deltv - -- deltintrtv); -- last_value = 0; -- last_tv.tv_sec = -- last_intr_tv.tv_sec; -- last_tv.tv_usec = -- last_intr_tv.tv_usec; -- deltv = deltintrtv; -- } -- } -- data = 1; -- if (data ^ last_value) { -- /* -- * deltintrtv > 2*TIME_CONST, -- * remember ? the other case is -- * timeout -- */ -- add_read_queue(last_value, -- deltv-TIME_CONST); -- last_value = data; -- last_tv = curr_tv; -- if (last_tv.tv_usec >= TIME_CONST) -- last_tv.tv_usec -= TIME_CONST; -- else { -- last_tv.tv_sec--; -- last_tv.tv_usec += 1000000 - -- TIME_CONST; -- } -- } -- last_intr_tv = curr_tv; -- if (data) { -- /* -- * start timer for end of -- * sequence detection -- */ -- timerlist.expires = -- jiffies + IT87_TIMEOUT; -- add_timer(&timerlist); -- } -- outb((inb(io + IT87_CIR_RCR) & -- ~IT87_CIR_RCR_RXEN) | -- IT87_CIR_RCR_RXACT, -- io + IT87_CIR_RCR); -- if (it87_RXEN_mask) -- outb(inb(io + IT87_CIR_RCR) | -- IT87_CIR_RCR_RXEN, -- io + IT87_CIR_RCR); -- fifo--; -- } while (fifo != 0); -- } -- spin_unlock_irqrestore(&hardware_lock, hw_flags); -- spin_unlock_irqrestore(&timer_lock, flags); -- -- return IRQ_RETVAL(IRQ_HANDLED); -- -- default: -- /* not our irq */ -- dprintk("unknown IRQ (shouldn't happen) !!\n"); -- return IRQ_RETVAL(IRQ_NONE); -- } --} -- -- --static void send_it87(unsigned long len, unsigned long stime, -- unsigned char send_byte, unsigned int count_bits) --{ -- long count = len / stime; -- long time_left = 0; -- static unsigned char byte_out; -- unsigned long hw_flags; -- -- dprintk("%s: len=%ld, sb=%d\n", __func__, len, send_byte); -- -- time_left = (long)len - (long)count * (long)stime; -- count += ((2 * time_left) / stime); -- while (count) { -- long i = 0; -- for (i = 0; i < count_bits; i++) { -- byte_out = (byte_out << 1) | (send_byte & 1); -- it87_bits_in_byte_out++; -- } -- if (it87_bits_in_byte_out == 8) { -- dprintk("out=0x%x, tsr_txfbc: 0x%x\n", -- byte_out, -- inb(io + IT87_CIR_TSR) & -- IT87_CIR_TSR_TXFBC); -- -- while ((inb(io + IT87_CIR_TSR) & -- IT87_CIR_TSR_TXFBC) >= IT87_CIR_FIFO_SIZE) -- ; -- -- spin_lock_irqsave(&hardware_lock, hw_flags); -- outb(byte_out, io + IT87_CIR_DR); -- spin_unlock_irqrestore(&hardware_lock, hw_flags); -- -- it87_bits_in_byte_out = 0; -- it87_send_counter++; -- byte_out = 0; -- } -- count--; -- } --} -- -- --/*TODO: maybe exchange space and pulse because it8705 only modulates 0-bits */ -- --static void send_space(unsigned long len) --{ -- send_it87(len, TIME_CONST, IT87_CIR_SPACE, IT87_CIR_BAUDRATE_DIVISOR); --} -- --static void send_pulse(unsigned long len) --{ -- send_it87(len, TIME_CONST, IT87_CIR_PULSE, IT87_CIR_BAUDRATE_DIVISOR); --} -- -- --static void init_send() --{ -- unsigned long flags; -- -- spin_lock_irqsave(&hardware_lock, flags); -- /* RXEN=0: receiver disable */ -- it87_RXEN_mask = 0; -- outb(inb(io + IT87_CIR_RCR) & ~IT87_CIR_RCR_RXEN, -- io + IT87_CIR_RCR); -- spin_unlock_irqrestore(&hardware_lock, flags); -- it87_bits_in_byte_out = 0; -- it87_send_counter = 0; --} -- -- --static void terminate_send(unsigned long len) --{ -- unsigned long flags; -- unsigned long last = 0; -- -- last = it87_send_counter; -- /* make sure all necessary data has been sent */ -- while (last == it87_send_counter) -- send_space(len); -- /* wait until all data sent */ -- while ((inb(io + IT87_CIR_TSR) & IT87_CIR_TSR_TXFBC) != 0) -- ; -- /* then re-enable receiver */ -- spin_lock_irqsave(&hardware_lock, flags); -- it87_RXEN_mask = IT87_CIR_RCR_RXEN; -- outb(inb(io + IT87_CIR_RCR) | IT87_CIR_RCR_RXEN, -- io + IT87_CIR_RCR); -- spin_unlock_irqrestore(&hardware_lock, flags); --} -- -- --static int init_hardware(void) --{ -- unsigned long flags; -- unsigned char it87_rcr = 0; -- -- spin_lock_irqsave(&hardware_lock, flags); -- /* init cir-port */ -- /* enable r/w-access to Baudrate-Register */ -- outb(IT87_CIR_IER_BR, io + IT87_CIR_IER); -- outb(IT87_CIR_BAUDRATE_DIVISOR % 0x100, io+IT87_CIR_BDLR); -- outb(IT87_CIR_BAUDRATE_DIVISOR / 0x100, io+IT87_CIR_BDHR); -- /* Baudrate Register off, define IRQs: Input only */ -- if (digimatrix) { -- outb(IT87_CIR_IER_IEC | IT87_CIR_IER_RFOIE, io + IT87_CIR_IER); -- /* RX: HCFS=0, RXDCR = 001b (33,75..38,25 kHz), RXEN=1 */ -- } else { -- outb(IT87_CIR_IER_IEC | IT87_CIR_IER_RDAIE, io + IT87_CIR_IER); -- /* RX: HCFS=0, RXDCR = 001b (35,6..40,3 kHz), RXEN=1 */ -- } -- it87_rcr = (IT87_CIR_RCR_RXEN & it87_RXEN_mask) | 0x1; -- if (it87_enable_demodulator) -- it87_rcr |= IT87_CIR_RCR_RXEND; -- outb(it87_rcr, io + IT87_CIR_RCR); -- if (digimatrix) { -- /* Set FIFO depth to 1 byte, and disable TX */ -- outb(inb(io + IT87_CIR_TCR1) | 0x00, -- io + IT87_CIR_TCR1); -- -- /* -- * TX: it87_freq (36kHz), 'reserved' sensitivity -- * setting (0x00) -- */ -- outb(((it87_freq - IT87_CIR_FREQ_MIN) << 3) | 0x00, -- io + IT87_CIR_TCR2); -- } else { -- /* TX: 38kHz, 13,3us (pulse-width) */ -- outb(((it87_freq - IT87_CIR_FREQ_MIN) << 3) | 0x06, -- io + IT87_CIR_TCR2); -- } -- spin_unlock_irqrestore(&hardware_lock, flags); -- return 0; --} -- -- --static void drop_hardware(void) --{ -- unsigned long flags; -- -- spin_lock_irqsave(&hardware_lock, flags); -- disable_irq(irq); -- /* receiver disable */ -- it87_RXEN_mask = 0; -- outb(0x1, io + IT87_CIR_RCR); -- /* turn off irqs */ -- outb(0, io + IT87_CIR_IER); -- /* fifo clear */ -- outb(IT87_CIR_TCR1_FIFOCLR, io+IT87_CIR_TCR1); -- /* reset */ -- outb(IT87_CIR_IER_RESET, io+IT87_CIR_IER); -- enable_irq(irq); -- spin_unlock_irqrestore(&hardware_lock, flags); --} -- -- --static unsigned char it87_read(unsigned char port) --{ -- outb(port, IT87_ADRPORT); -- return inb(IT87_DATAPORT); --} -- -- --static void it87_write(unsigned char port, unsigned char data) --{ -- outb(port, IT87_ADRPORT); -- outb(data, IT87_DATAPORT); --} -- -- --/* SECTION: Initialisation */ -- --static int init_port(void) --{ -- unsigned long hw_flags; -- int retval = 0; -- -- unsigned char init_bytes[4] = IT87_INIT; -- unsigned char it87_chipid = 0; -- unsigned char ldn = 0; -- unsigned int it87_io = 0; -- unsigned int it87_irq = 0; -- -- /* Enter MB PnP Mode */ -- outb(init_bytes[0], IT87_ADRPORT); -- outb(init_bytes[1], IT87_ADRPORT); -- outb(init_bytes[2], IT87_ADRPORT); -- outb(init_bytes[3], IT87_ADRPORT); -- -- /* 8712 or 8705 ? */ -- it87_chipid = it87_read(IT87_CHIP_ID1); -- if (it87_chipid != 0x87) { -- retval = -ENXIO; -- return retval; -- } -- it87_chipid = it87_read(IT87_CHIP_ID2); -- if ((it87_chipid != 0x05) && -- (it87_chipid != 0x12) && -- (it87_chipid != 0x18) && -- (it87_chipid != 0x20)) { -- printk(KERN_INFO LIRC_DRIVER_NAME -- ": no IT8704/05/12/18/20 found (claimed IT87%02x), " -- "exiting..\n", it87_chipid); -- retval = -ENXIO; -- return retval; -- } -- printk(KERN_INFO LIRC_DRIVER_NAME -- ": found IT87%02x.\n", -- it87_chipid); -- -- /* get I/O-Port and IRQ */ -- if (it87_chipid == 0x12 || it87_chipid == 0x18) -- ldn = IT8712_CIR_LDN; -- else -- ldn = IT8705_CIR_LDN; -- it87_write(IT87_LDN, ldn); -- -- it87_io = it87_read(IT87_CIR_BASE_MSB) * 256 + -- it87_read(IT87_CIR_BASE_LSB); -- if (it87_io == 0) { -- if (io == 0) -- io = IT87_CIR_DEFAULT_IOBASE; -- printk(KERN_INFO LIRC_DRIVER_NAME -- ": set default io 0x%x\n", -- io); -- it87_write(IT87_CIR_BASE_MSB, io / 0x100); -- it87_write(IT87_CIR_BASE_LSB, io % 0x100); -- } else -- io = it87_io; -- -- it87_irq = it87_read(IT87_CIR_IRQ); -- if (digimatrix || it87_irq == 0) { -- if (irq == 0) -- irq = IT87_CIR_DEFAULT_IRQ; -- printk(KERN_INFO LIRC_DRIVER_NAME -- ": set default irq 0x%x\n", -- irq); -- it87_write(IT87_CIR_IRQ, irq); -- } else -- irq = it87_irq; -- -- spin_lock_irqsave(&hardware_lock, hw_flags); -- /* reset */ -- outb(IT87_CIR_IER_RESET, io+IT87_CIR_IER); -- /* fifo clear */ -- outb(IT87_CIR_TCR1_FIFOCLR | -- /* IT87_CIR_TCR1_ILE | */ -- IT87_CIR_TCR1_TXRLE | -- IT87_CIR_TCR1_TXENDF, io+IT87_CIR_TCR1); -- spin_unlock_irqrestore(&hardware_lock, hw_flags); -- -- /* get I/O port access and IRQ line */ -- if (request_region(io, 8, LIRC_DRIVER_NAME) == NULL) { -- printk(KERN_ERR LIRC_DRIVER_NAME -- ": i/o port 0x%.4x already in use.\n", io); -- /* Leaving MB PnP Mode */ -- it87_write(IT87_CFGCTRL, 0x2); -- return -EBUSY; -- } -- -- /* activate CIR-Device */ -- it87_write(IT87_CIR_ACT, 0x1); -- -- /* Leaving MB PnP Mode */ -- it87_write(IT87_CFGCTRL, 0x2); -- -- retval = request_irq(irq, it87_interrupt, 0 /*IRQF_DISABLED*/, -- LIRC_DRIVER_NAME, NULL); -- if (retval < 0) { -- printk(KERN_ERR LIRC_DRIVER_NAME -- ": IRQ %d already in use.\n", -- irq); -- release_region(io, 8); -- return retval; -- } -- -- printk(KERN_INFO LIRC_DRIVER_NAME -- ": I/O port 0x%.4x, IRQ %d.\n", io, irq); -- -- init_timer(&timerlist); -- timerlist.function = it87_timeout; -- timerlist.data = 0xabadcafe; -- -- return 0; --} -- -- --static void drop_port(void) --{ --#if 0 -- unsigned char init_bytes[4] = IT87_INIT; -- -- /* Enter MB PnP Mode */ -- outb(init_bytes[0], IT87_ADRPORT); -- outb(init_bytes[1], IT87_ADRPORT); -- outb(init_bytes[2], IT87_ADRPORT); -- outb(init_bytes[3], IT87_ADRPORT); -- -- /* deactivate CIR-Device */ -- it87_write(IT87_CIR_ACT, 0x0); -- -- /* Leaving MB PnP Mode */ -- it87_write(IT87_CFGCTRL, 0x2); --#endif -- -- del_timer_sync(&timerlist); -- free_irq(irq, NULL); -- release_region(io, 8); --} -- -- --static int init_lirc_it87(void) --{ -- int retval; -- -- init_waitqueue_head(&lirc_read_queue); -- retval = init_port(); -- if (retval < 0) -- return retval; -- init_hardware(); -- printk(KERN_INFO LIRC_DRIVER_NAME ": Installed.\n"); -- return 0; --} -- --static int it87_probe(struct pnp_dev *pnp_dev, -- const struct pnp_device_id *dev_id) --{ -- int retval; -- -- driver.dev = &pnp_dev->dev; -- -- retval = init_chrdev(); -- if (retval < 0) -- return retval; -- -- retval = init_lirc_it87(); -- if (retval) -- goto init_lirc_it87_failed; -- -- return 0; -- --init_lirc_it87_failed: -- drop_chrdev(); -- -- return retval; --} -- --static int __init lirc_it87_init(void) --{ -- return pnp_register_driver(&it87_pnp_driver); --} -- -- --static void __exit lirc_it87_exit(void) --{ -- drop_hardware(); -- drop_chrdev(); -- drop_port(); -- pnp_unregister_driver(&it87_pnp_driver); -- printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n"); --} -- --/* SECTION: PNP for ITE8704/18 */ -- --static const struct pnp_device_id pnp_dev_table[] = { -- {"ITE8704", 0}, -- {} --}; -- --MODULE_DEVICE_TABLE(pnp, pnp_dev_table); -- --static struct pnp_driver it87_pnp_driver = { -- .name = LIRC_DRIVER_NAME, -- .id_table = pnp_dev_table, -- .probe = it87_probe, --}; -- --module_init(lirc_it87_init); --module_exit(lirc_it87_exit); -- --MODULE_DESCRIPTION("LIRC driver for ITE IT8704/05/12/18/20 CIR port"); --MODULE_AUTHOR("Hans-Gunter Lutke Uphues"); --MODULE_LICENSE("GPL"); -- --module_param(io, int, S_IRUGO); --MODULE_PARM_DESC(io, "I/O base address (default: 0x310)"); -- --module_param(irq, int, S_IRUGO); --#ifdef LIRC_IT87_DIGIMATRIX --MODULE_PARM_DESC(irq, "Interrupt (1,3-12) (default: 9)"); --#else --MODULE_PARM_DESC(irq, "Interrupt (1,3-12) (default: 7)"); --#endif -- --module_param(it87_enable_demodulator, bool, S_IRUGO); --MODULE_PARM_DESC(it87_enable_demodulator, -- "Receiver demodulator enable/disable (1/0), default: 0"); -- --module_param(debug, bool, S_IRUGO | S_IWUSR); --MODULE_PARM_DESC(debug, "Enable debugging messages"); -- --module_param(digimatrix, bool, S_IRUGO | S_IWUSR); --#ifdef LIRC_IT87_DIGIMATRIX --MODULE_PARM_DESC(digimatrix, -- "Asus Digimatrix it87 compat. enable/disable (1/0), default: 1"); --#else --MODULE_PARM_DESC(digimatrix, -- "Asus Digimatrix it87 compat. enable/disable (1/0), default: 0"); --#endif -- -- --module_param(it87_freq, int, S_IRUGO); --#ifdef LIRC_IT87_DIGIMATRIX --MODULE_PARM_DESC(it87_freq, -- "Carrier demodulator frequency (kHz), (default: 36)"); --#else --MODULE_PARM_DESC(it87_freq, -- "Carrier demodulator frequency (kHz), (default: 38)"); --#endif -diff -Naur linux-2.6.36.2/drivers/staging/lirc/lirc_it87.h linux-2.6.36.2.patch/drivers/staging/lirc/lirc_it87.h ---- linux-2.6.36.2/drivers/staging/lirc/lirc_it87.h 2010-12-09 23:17:27.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/staging/lirc/lirc_it87.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,116 +0,0 @@ --/* lirc_it87.h */ --/* SECTION: Definitions */ -- --/********************************* ITE IT87xx ************************/ -- --/* based on the following documentation from ITE: -- a) IT8712F Preliminary CIR Programming Guide V0.1 -- b) IT8705F Simple LPC I/O Preliminary Specification V0.3 -- c) IT8712F EC-LPC I/O Preliminary Specification V0.5 --*/ -- --/* IT8712/05 Ports: */ --#define IT87_ADRPORT 0x2e --#define IT87_DATAPORT 0x2f --#define IT87_INIT {0x87, 0x01, 0x55, 0x55} -- --/* alternate Ports: */ --/* --#define IT87_ADRPORT 0x4e --#define IT87_DATAPORT 0x4f --#define IT87_INIT {0x87, 0x01, 0x55, 0xaa} -- */ -- --/* IT8712/05 Registers */ --#define IT87_CFGCTRL 0x2 --#define IT87_LDN 0x7 --#define IT87_CHIP_ID1 0x20 --#define IT87_CHIP_ID2 0x21 --#define IT87_CFG_VERSION 0x22 --#define IT87_SWSUSPEND 0x23 -- --#define IT8712_CIR_LDN 0xa --#define IT8705_CIR_LDN 0x7 -- --/* CIR Configuration Registers: */ --#define IT87_CIR_ACT 0x30 --#define IT87_CIR_BASE_MSB 0x60 --#define IT87_CIR_BASE_LSB 0x61 --#define IT87_CIR_IRQ 0x70 --#define IT87_CIR_CONFIG 0xf0 -- --/* List of IT87_CIR registers: offset to BaseAddr */ --#define IT87_CIR_DR 0 --#define IT87_CIR_IER 1 --#define IT87_CIR_RCR 2 --#define IT87_CIR_TCR1 3 --#define IT87_CIR_TCR2 4 --#define IT87_CIR_TSR 5 --#define IT87_CIR_RSR 6 --#define IT87_CIR_BDLR 5 --#define IT87_CIR_BDHR 6 --#define IT87_CIR_IIR 7 -- --/* Bit Definition */ --/* IER: */ --#define IT87_CIR_IER_TM_EN 0x80 --#define IT87_CIR_IER_RESEVED 0x40 --#define IT87_CIR_IER_RESET 0x20 --#define IT87_CIR_IER_BR 0x10 --#define IT87_CIR_IER_IEC 0x8 --#define IT87_CIR_IER_RFOIE 0x4 --#define IT87_CIR_IER_RDAIE 0x2 --#define IT87_CIR_IER_TLDLIE 0x1 -- --/* RCR: */ --#define IT87_CIR_RCR_RDWOS 0x80 --#define IT87_CIR_RCR_HCFS 0x40 --#define IT87_CIR_RCR_RXEN 0x20 --#define IT87_CIR_RCR_RXEND 0x10 --#define IT87_CIR_RCR_RXACT 0x8 --#define IT87_CIR_RCR_RXDCR 0x7 -- --/* TCR1: */ --#define IT87_CIR_TCR1_FIFOCLR 0x80 --#define IT87_CIR_TCR1_ILE 0x40 --#define IT87_CIR_TCR1_FIFOTL 0x30 --#define IT87_CIR_TCR1_TXRLE 0x8 --#define IT87_CIR_TCR1_TXENDF 0x4 --#define IT87_CIR_TCR1_TXMPM 0x3 -- --/* TCR2: */ --#define IT87_CIR_TCR2_CFQ 0xf8 --#define IT87_CIR_TCR2_TXMPW 0x7 -- --/* TSR: */ --#define IT87_CIR_TSR_RESERVED 0xc0 --#define IT87_CIR_TSR_TXFBC 0x3f -- --/* RSR: */ --#define IT87_CIR_RSR_RXFTO 0x80 --#define IT87_CIR_RSR_RESERVED 0x40 --#define IT87_CIR_RSR_RXFBC 0x3f -- --/* IIR: */ --#define IT87_CIR_IIR_RESERVED 0xf8 --#define IT87_CIR_IIR_IID 0x6 --#define IT87_CIR_IIR_IIP 0x1 -- --/* TM: */ --#define IT87_CIR_TM_IL_SEL 0x80 --#define IT87_CIR_TM_RESERVED 0x40 --#define IT87_CIR_TM_TM_REG 0x3f -- --#define IT87_CIR_FIFO_SIZE 32 -- --/* Baudratedivisor for IT87: power of 2: only 1,2,4 or 8) */ --#define IT87_CIR_BAUDRATE_DIVISOR 0x1 --#define IT87_CIR_DEFAULT_IOBASE 0x310 --#define IT87_CIR_DEFAULT_IRQ 0x7 --#define IT87_CIR_SPACE 0x00 --#define IT87_CIR_PULSE 0xff --#define IT87_CIR_FREQ_MIN 27 --#define IT87_CIR_FREQ_MAX 58 --#define TIME_CONST (IT87_CIR_BAUDRATE_DIVISOR * 8000000ul / 115200ul) -- --/********************************* ITE IT87xx ************************/ -diff -Naur linux-2.6.36.2/drivers/staging/lirc/Makefile linux-2.6.36.2.patch/drivers/staging/lirc/Makefile ---- linux-2.6.36.2/drivers/staging/lirc/Makefile 2010-12-09 23:17:27.000000000 +0100 -+++ linux-2.6.36.2.patch/drivers/staging/lirc/Makefile 2010-12-11 22:18:26.840935467 +0100 -@@ -7,7 +7,6 @@ - obj-$(CONFIG_LIRC_I2C) += lirc_i2c.o - obj-$(CONFIG_LIRC_IGORPLUGUSB) += lirc_igorplugusb.o - obj-$(CONFIG_LIRC_IMON) += lirc_imon.o --obj-$(CONFIG_LIRC_IT87) += lirc_it87.o - obj-$(CONFIG_LIRC_ITE8709) += lirc_ite8709.o - obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o - obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o diff --git a/packages/linux/meta b/packages/linux/meta index fdec60f27e..3610c37740 100644 --- a/packages/linux/meta +++ b/packages/linux/meta @@ -1,10 +1,11 @@ PKG_NAME="linux" -PKG_VERSION="2.6.36.2" +PKG_VERSION="2.6.37-rc5" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://www.kernel.org" -PKG_URL="http://www.kernel.org/pub/linux/kernel/v2.6/$PKG_NAME-$PKG_VERSION.tar.bz2" +#PKG_URL="http://www.kernel.org/pub/linux/kernel/v2.6/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_URL="http://www.kernel.org/pub/linux/kernel/v2.6/testing/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="busybox linux-drivers linux-firmware" PKG_BUILD_DEPENDS="toolchain busybox-hosttools" PKG_PRIORITY="optional" @@ -16,6 +17,6 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" if [ "$LINUX_NEXT" = "yes" ]; then - PKG_VERSION="2.6.37-rc3" + PKG_VERSION="2.6.37-rc5" PKG_URL="http://www.kernel.org/pub/linux/kernel/v2.6/testing/$PKG_NAME-$PKG_VERSION.tar.bz2" fi diff --git a/packages/linux/patches/linux-2.6.36.2-051-add_nuvoton_cir-0.2.patch b/packages/linux/patches/linux-2.6.36.2-051-add_nuvoton_cir-0.2.patch deleted file mode 100644 index c6d1509dd0..0000000000 --- a/packages/linux/patches/linux-2.6.36.2-051-add_nuvoton_cir-0.2.patch +++ /dev/null @@ -1,1724 +0,0 @@ -From 04515eb583b1651cb95bc7c34a00696fc91c4fa8 Mon Sep 17 00:00:00 2001 -From: Jarod Wilson -Date: Thu, 7 Oct 2010 16:50:34 -0400 -Subject: [PATCH 1/1] IR: add driver for Nuvoton w836x7hg integrated CIR - -This is a new ir-core pnp driver for the Nuvoton w836x7hg integrated CIR -function. The chip is found on at least the ASRock ION 330HT boxes and -apparently, on a number of Intel DP55-series motherboards: - -http://www.asrock.com/nettop/overview.asp?Model=ION%20330HT -http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=17685&lang=eng - -This driver was made possible by a hardware donation from Nuvoton, along -with sample code (in the form of an lirc driver) and datasheet, so huge -thanks to them for supporting this effort. Note that this driver -constitutes a massive rewrite, porting from the lirc interfaces to the -ir-core interfaces, and restructuring the driver to look more like Maxim -Levitsky's ene_ir driver (as well as generally making it look more like -kernel code). - -There's some work left to be done on this driver, to fully support the -range of functionality possible, but receive and IR power-on/wake are -both functional (may require setting wake key under another OS atm). The -hardware I've got (one of the ASRock boxes) only supports RX, so TX is -completely untested as of yet. Certain RX parameters, like sample -resolution and RX IRQ sample length trigger level could possibly stand -to be made tweakable via modparams or sysfs nodes, but the current -values work well enough for me w/an MCE RC6A remote. - -The original lirc driver carried support for the Windows MCE IR -keyboard/mouse device, which I plan to add back generically, in a way -that should be usable by any raw IR receiver (or at least by this driver -and the mceusb driver). - -Suspend and resume have also been tested, the power button on my remote -can be used to wake the machine, and CIR functionality resumes just -fine. Module unload/reload has also been tested, though not extensively -or repetitively. Also tested to work with the lirc bridge plugin for -userspace decoding. - -Signed-off-by: Jarod Wilson ---- - drivers/media/IR/Kconfig | 13 + - drivers/media/IR/Makefile | 1 + - drivers/media/IR/nuvoton-cir.c | 1216 ++++++++++++++++++++++++++++++++++++++++ - drivers/media/IR/nuvoton-cir.h | 408 ++++++++++++++ - 4 files changed, 1638 insertions(+), 0 deletions(-) - create mode 100644 drivers/media/IR/nuvoton-cir.c - create mode 100644 drivers/media/IR/nuvoton-cir.h - -diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig -index 152000d..364514a 100644 ---- a/drivers/media/IR/Kconfig -+++ b/drivers/media/IR/Kconfig -@@ -113,6 +113,19 @@ config IR_IMON - To compile this driver as a module, choose M here: the - module will be called imon. - -+config IR_NUVOTON -+ tristate "Nuvoton w836x7hg Consumer Infrared Transceiver" -+ depends on PNP -+ depends on IR_CORE -+ ---help--- -+ Say Y here to enable support for integrated infrared receiver -+ /transciever made by Nuvoton (formerly Winbond). This chip is -+ found in the ASRock ION 330HT, as well as assorted Intel -+ DP55-series motherboards (and of course, possibly others). -+ -+ To compile this driver as a module, choose M here: the -+ module will be called nuvoton-cir. -+ - config IR_MCEUSB - tristate "Windows Media Center Ed. eHome Infrared Transceiver" - depends on USB_ARCH_HAS_HCD -diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile -index 953c6c4..f9574ad 100644 ---- a/drivers/media/IR/Makefile -+++ b/drivers/media/IR/Makefile -@@ -17,5 +17,6 @@ obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o - # stand-alone IR receivers/transmitters - obj-$(CONFIG_IR_IMON) += imon.o - obj-$(CONFIG_IR_MCEUSB) += mceusb.o -+obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o - obj-$(CONFIG_IR_ENE) += ene_ir.o - obj-$(CONFIG_IR_STREAMZAP) += streamzap.o -diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c -new file mode 100644 -index 0000000..1ce9359 ---- /dev/null -+++ b/drivers/media/IR/nuvoton-cir.c -@@ -0,0 +1,1216 @@ -+/* -+ * Driver for Nuvoton Technology Corporation w83667hg/w83677hg-i CIR -+ * -+ * Copyright (C) 2010 Jarod Wilson -+ * Copyright (C) 2009 Nuvoton PS Team -+ * -+ * Special thanks to Nuvoton for providing hardware, spec sheets and -+ * sample code upon which portions of this driver are based. Indirect -+ * thanks also to Maxim Levitsky, whose ene_ir driver this driver is -+ * modeled after. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -+ * USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "nuvoton-cir.h" -+ -+static char *chip_id = "w836x7hg"; -+ -+/* write val to config reg */ -+static inline void nvt_cr_write(struct nvt_dev *nvt, u8 val, u8 reg) -+{ -+ outb(reg, nvt->cr_efir); -+ outb(val, nvt->cr_efdr); -+} -+ -+/* read val from config reg */ -+static inline u8 nvt_cr_read(struct nvt_dev *nvt, u8 reg) -+{ -+ outb(reg, nvt->cr_efir); -+ return inb(nvt->cr_efdr); -+} -+ -+/* update config register bit without changing other bits */ -+static inline void nvt_set_reg_bit(struct nvt_dev *nvt, u8 val, u8 reg) -+{ -+ u8 tmp = nvt_cr_read(nvt, reg) | val; -+ nvt_cr_write(nvt, tmp, reg); -+} -+ -+/* clear config register bit without changing other bits */ -+static inline void nvt_clear_reg_bit(struct nvt_dev *nvt, u8 val, u8 reg) -+{ -+ u8 tmp = nvt_cr_read(nvt, reg) & ~val; -+ nvt_cr_write(nvt, tmp, reg); -+} -+ -+/* enter extended function mode */ -+static inline void nvt_efm_enable(struct nvt_dev *nvt) -+{ -+ /* Enabling Extended Function Mode explicitly requires writing 2x */ -+ outb(EFER_EFM_ENABLE, nvt->cr_efir); -+ outb(EFER_EFM_ENABLE, nvt->cr_efir); -+} -+ -+/* exit extended function mode */ -+static inline void nvt_efm_disable(struct nvt_dev *nvt) -+{ -+ outb(EFER_EFM_DISABLE, nvt->cr_efir); -+} -+ -+/* -+ * When you want to address a specific logical device, write its logical -+ * device number to CR_LOGICAL_DEV_SEL, then enable/disable by writing -+ * 0x1/0x0 respectively to CR_LOGICAL_DEV_EN. -+ */ -+static inline void nvt_select_logical_dev(struct nvt_dev *nvt, u8 ldev) -+{ -+ outb(CR_LOGICAL_DEV_SEL, nvt->cr_efir); -+ outb(ldev, nvt->cr_efdr); -+} -+ -+/* write val to cir config register */ -+static inline void nvt_cir_reg_write(struct nvt_dev *nvt, u8 val, u8 offset) -+{ -+ outb(val, nvt->cir_addr + offset); -+} -+ -+/* read val from cir config register */ -+static u8 nvt_cir_reg_read(struct nvt_dev *nvt, u8 offset) -+{ -+ u8 val; -+ -+ val = inb(nvt->cir_addr + offset); -+ -+ return val; -+} -+ -+/* write val to cir wake register */ -+static inline void nvt_cir_wake_reg_write(struct nvt_dev *nvt, -+ u8 val, u8 offset) -+{ -+ outb(val, nvt->cir_wake_addr + offset); -+} -+ -+/* read val from cir wake config register */ -+static u8 nvt_cir_wake_reg_read(struct nvt_dev *nvt, u8 offset) -+{ -+ u8 val; -+ -+ val = inb(nvt->cir_wake_addr + offset); -+ -+ return val; -+} -+ -+/* dump current cir register contents */ -+static void cir_dump_regs(struct nvt_dev *nvt) -+{ -+ nvt_efm_enable(nvt); -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ -+ printk("%s: Dump CIR logical device registers:\n", NVT_DRIVER_NAME); -+ printk(" * CR CIR ACTIVE : 0x%x\n", -+ nvt_cr_read(nvt, CR_LOGICAL_DEV_EN)); -+ printk(" * CR CIR BASE ADDR: 0x%x\n", -+ (nvt_cr_read(nvt, CR_CIR_BASE_ADDR_HI) << 8) | -+ nvt_cr_read(nvt, CR_CIR_BASE_ADDR_LO)); -+ printk(" * CR CIR IRQ NUM: 0x%x\n", -+ nvt_cr_read(nvt, CR_CIR_IRQ_RSRC)); -+ -+ nvt_efm_disable(nvt); -+ -+ printk("%s: Dump CIR registers:\n", NVT_DRIVER_NAME); -+ printk(" * IRCON: 0x%x\n", nvt_cir_reg_read(nvt, CIR_IRCON)); -+ printk(" * IRSTS: 0x%x\n", nvt_cir_reg_read(nvt, CIR_IRSTS)); -+ printk(" * IREN: 0x%x\n", nvt_cir_reg_read(nvt, CIR_IREN)); -+ printk(" * RXFCONT: 0x%x\n", nvt_cir_reg_read(nvt, CIR_RXFCONT)); -+ printk(" * CP: 0x%x\n", nvt_cir_reg_read(nvt, CIR_CP)); -+ printk(" * CC: 0x%x\n", nvt_cir_reg_read(nvt, CIR_CC)); -+ printk(" * SLCH: 0x%x\n", nvt_cir_reg_read(nvt, CIR_SLCH)); -+ printk(" * SLCL: 0x%x\n", nvt_cir_reg_read(nvt, CIR_SLCL)); -+ printk(" * FIFOCON: 0x%x\n", nvt_cir_reg_read(nvt, CIR_FIFOCON)); -+ printk(" * IRFIFOSTS: 0x%x\n", nvt_cir_reg_read(nvt, CIR_IRFIFOSTS)); -+ printk(" * SRXFIFO: 0x%x\n", nvt_cir_reg_read(nvt, CIR_SRXFIFO)); -+ printk(" * TXFCONT: 0x%x\n", nvt_cir_reg_read(nvt, CIR_TXFCONT)); -+ printk(" * STXFIFO: 0x%x\n", nvt_cir_reg_read(nvt, CIR_STXFIFO)); -+ printk(" * FCCH: 0x%x\n", nvt_cir_reg_read(nvt, CIR_FCCH)); -+ printk(" * FCCL: 0x%x\n", nvt_cir_reg_read(nvt, CIR_FCCL)); -+ printk(" * IRFSM: 0x%x\n", nvt_cir_reg_read(nvt, CIR_IRFSM)); -+} -+ -+/* dump current cir wake register contents */ -+static void cir_wake_dump_regs(struct nvt_dev *nvt) -+{ -+ u8 i, fifo_len; -+ -+ nvt_efm_enable(nvt); -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE); -+ -+ printk("%s: Dump CIR WAKE logical device registers:\n", -+ NVT_DRIVER_NAME); -+ printk(" * CR CIR WAKE ACTIVE : 0x%x\n", -+ nvt_cr_read(nvt, CR_LOGICAL_DEV_EN)); -+ printk(" * CR CIR WAKE BASE ADDR: 0x%x\n", -+ (nvt_cr_read(nvt, CR_CIR_BASE_ADDR_HI) << 8) | -+ nvt_cr_read(nvt, CR_CIR_BASE_ADDR_LO)); -+ printk(" * CR CIR WAKE IRQ NUM: 0x%x\n", -+ nvt_cr_read(nvt, CR_CIR_IRQ_RSRC)); -+ -+ nvt_efm_disable(nvt); -+ -+ printk("%s: Dump CIR WAKE registers\n", NVT_DRIVER_NAME); -+ printk(" * IRCON: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON)); -+ printk(" * IRSTS: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRSTS)); -+ printk(" * IREN: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_IREN)); -+ printk(" * FIFO CMP DEEP: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_CMP_DEEP)); -+ printk(" * FIFO CMP TOL: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_CMP_TOL)); -+ printk(" * FIFO COUNT: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT)); -+ printk(" * SLCH: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_SLCH)); -+ printk(" * SLCL: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_SLCL)); -+ printk(" * FIFOCON: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFOCON)); -+ printk(" * SRXFSTS: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_SRXFSTS)); -+ printk(" * SAMPLE RX FIFO: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_SAMPLE_RX_FIFO)); -+ printk(" * WR FIFO DATA: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_WR_FIFO_DATA)); -+ printk(" * RD FIFO ONLY: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY)); -+ printk(" * RD FIFO ONLY IDX: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY_IDX)); -+ printk(" * FIFO IGNORE: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_IGNORE)); -+ printk(" * IRFSM: 0x%x\n", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRFSM)); -+ -+ fifo_len = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT); -+ printk("%s: Dump CIR WAKE FIFO (len %d)\n", NVT_DRIVER_NAME, fifo_len); -+ printk("* Contents = "); -+ for (i = 0; i < fifo_len; i++) -+ printk("%02x ", -+ nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY)); -+ printk("\n"); -+} -+ -+/* detect hardware features */ -+static int nvt_hw_detect(struct nvt_dev *nvt) -+{ -+ unsigned long flags; -+ u8 chip_major, chip_minor; -+ int ret = 0; -+ -+ nvt_efm_enable(nvt); -+ -+ /* Check if we're wired for the alternate EFER setup */ -+ chip_major = nvt_cr_read(nvt, CR_CHIP_ID_HI); -+ if (chip_major == 0xff) { -+ nvt->cr_efir = CR_EFIR2; -+ nvt->cr_efdr = CR_EFDR2; -+ nvt_efm_enable(nvt); -+ chip_major = nvt_cr_read(nvt, CR_CHIP_ID_HI); -+ } -+ -+ chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO); -+ nvt_dbg("%s: chip id: 0x%02x 0x%02x", chip_id, chip_major, chip_minor); -+ -+ if (chip_major != CHIP_ID_HIGH && -+ (chip_minor != CHIP_ID_LOW || chip_minor != CHIP_ID_LOW2)) -+ ret = -ENODEV; -+ -+ nvt_efm_disable(nvt); -+ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ nvt->chip_major = chip_major; -+ nvt->chip_minor = chip_minor; -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+ -+ return ret; -+} -+ -+static void nvt_cir_ldev_init(struct nvt_dev *nvt) -+{ -+ u8 val; -+ -+ /* output pin selection (Pin95=CIRRX, Pin96=CIRTX1, WB enabled */ -+ val = nvt_cr_read(nvt, CR_OUTPUT_PIN_SEL); -+ val &= OUTPUT_PIN_SEL_MASK; -+ val |= (OUTPUT_ENABLE_CIR | OUTPUT_ENABLE_CIRWB); -+ nvt_cr_write(nvt, val, CR_OUTPUT_PIN_SEL); -+ -+ /* Select CIR logical device and enable */ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_cr_write(nvt, nvt->cir_addr >> 8, CR_CIR_BASE_ADDR_HI); -+ nvt_cr_write(nvt, nvt->cir_addr & 0xff, CR_CIR_BASE_ADDR_LO); -+ -+ nvt_cr_write(nvt, nvt->cir_irq, CR_CIR_IRQ_RSRC); -+ -+ nvt_dbg("CIR initialized, base io port address: 0x%lx, irq: %d", -+ nvt->cir_addr, nvt->cir_irq); -+} -+ -+static void nvt_cir_wake_ldev_init(struct nvt_dev *nvt) -+{ -+ /* Select ACPI logical device, enable it and CIR Wake */ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI); -+ nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); -+ -+ /* Enable CIR Wake via PSOUT# (Pin60) */ -+ nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE); -+ -+ /* enable cir interrupt of mouse/keyboard IRQ event */ -+ nvt_set_reg_bit(nvt, CIR_INTR_MOUSE_IRQ_BIT, CR_ACPI_IRQ_EVENTS); -+ -+ /* enable pme interrupt of cir wakeup event */ -+ nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2); -+ -+ /* Select CIR Wake logical device and enable */ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE); -+ nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_cr_write(nvt, nvt->cir_wake_addr >> 8, CR_CIR_BASE_ADDR_HI); -+ nvt_cr_write(nvt, nvt->cir_wake_addr & 0xff, CR_CIR_BASE_ADDR_LO); -+ -+ nvt_cr_write(nvt, nvt->cir_wake_irq, CR_CIR_IRQ_RSRC); -+ -+ nvt_dbg("CIR Wake initialized, base io port address: 0x%lx, irq: %d", -+ nvt->cir_wake_addr, nvt->cir_wake_irq); -+} -+ -+/* clear out the hardware's cir rx fifo */ -+static void nvt_clear_cir_fifo(struct nvt_dev *nvt) -+{ -+ u8 val; -+ -+ val = nvt_cir_reg_read(nvt, CIR_FIFOCON); -+ nvt_cir_reg_write(nvt, val | CIR_FIFOCON_RXFIFOCLR, CIR_FIFOCON); -+} -+ -+/* clear out the hardware's cir wake rx fifo */ -+static void nvt_clear_cir_wake_fifo(struct nvt_dev *nvt) -+{ -+ u8 val; -+ -+ val = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFOCON); -+ nvt_cir_wake_reg_write(nvt, val | CIR_WAKE_FIFOCON_RXFIFOCLR, -+ CIR_WAKE_FIFOCON); -+} -+ -+/* clear out the hardware's cir tx fifo */ -+static void nvt_clear_tx_fifo(struct nvt_dev *nvt) -+{ -+ u8 val; -+ -+ val = nvt_cir_reg_read(nvt, CIR_FIFOCON); -+ nvt_cir_reg_write(nvt, val | CIR_FIFOCON_TXFIFOCLR, CIR_FIFOCON); -+} -+ -+static void nvt_cir_regs_init(struct nvt_dev *nvt) -+{ -+ /* set sample limit count (PE interrupt raised when reached) */ -+ nvt_cir_reg_write(nvt, CIR_RX_LIMIT_COUNT >> 8, CIR_SLCH); -+ nvt_cir_reg_write(nvt, CIR_RX_LIMIT_COUNT & 0xff, CIR_SLCL); -+ -+ /* set fifo irq trigger levels */ -+ nvt_cir_reg_write(nvt, CIR_FIFOCON_TX_TRIGGER_LEV | -+ CIR_FIFOCON_RX_TRIGGER_LEV, CIR_FIFOCON); -+ -+ /* -+ * Enable TX and RX, specify carrier on = low, off = high, and set -+ * sample period (currently 50us) -+ */ -+ nvt_cir_reg_write(nvt, CIR_IRCON_TXEN | CIR_IRCON_RXEN | CIR_IRCON_RXINV | -+ CIR_IRCON_SAMPLE_PERIOD_SEL, CIR_IRCON); -+ -+ /* clear hardware rx and tx fifos */ -+ nvt_clear_cir_fifo(nvt); -+ nvt_clear_tx_fifo(nvt); -+ -+ /* clear any and all stray interrupts */ -+ nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS); -+ -+ /* and finally, enable RX Trigger Level Read and Packet End interrupts */ -+ nvt_cir_reg_write(nvt, CIR_IREN_RTR | CIR_IREN_PE, CIR_IREN); -+} -+ -+static void nvt_cir_wake_regs_init(struct nvt_dev *nvt) -+{ -+ /* set number of bytes needed for wake key comparison (default 67) */ -+ nvt_cir_wake_reg_write(nvt, CIR_WAKE_FIFO_LEN, CIR_WAKE_FIFO_CMP_DEEP); -+ -+ /* set tolerance/variance allowed per byte during wake compare */ -+ nvt_cir_wake_reg_write(nvt, CIR_WAKE_CMP_TOLERANCE, -+ CIR_WAKE_FIFO_CMP_TOL); -+ -+ /* set sample limit count (PE interrupt raised when reached) */ -+ nvt_cir_wake_reg_write(nvt, CIR_RX_LIMIT_COUNT >> 8, CIR_WAKE_SLCH); -+ nvt_cir_wake_reg_write(nvt, CIR_RX_LIMIT_COUNT & 0xff, CIR_WAKE_SLCL); -+ -+ /* set cir wake fifo rx trigger level (currently 67) */ -+ nvt_cir_wake_reg_write(nvt, CIR_WAKE_FIFOCON_RX_TRIGGER_LEV, -+ CIR_WAKE_FIFOCON); -+ -+ /* -+ * Enable TX and RX, specific carrier on = low, off = high, and set -+ * sample period (currently 50us) -+ */ -+ nvt_cir_wake_reg_write(nvt, CIR_WAKE_IRCON_MODE0 | CIR_WAKE_IRCON_RXEN | -+ CIR_WAKE_IRCON_R | CIR_WAKE_IRCON_RXINV | -+ CIR_WAKE_IRCON_SAMPLE_PERIOD_SEL, -+ CIR_WAKE_IRCON); -+ -+ /* clear cir wake rx fifo */ -+ nvt_clear_cir_wake_fifo(nvt); -+ -+ /* clear any and all stray interrupts */ -+ nvt_cir_wake_reg_write(nvt, 0xff, CIR_WAKE_IRSTS); -+} -+ -+static void nvt_enable_wake(struct nvt_dev *nvt) -+{ -+ nvt_efm_enable(nvt); -+ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI); -+ nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE); -+ nvt_set_reg_bit(nvt, CIR_INTR_MOUSE_IRQ_BIT, CR_ACPI_IRQ_EVENTS); -+ nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2); -+ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE); -+ nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_efm_disable(nvt); -+ -+ nvt_cir_wake_reg_write(nvt, CIR_WAKE_IRCON_MODE0 | CIR_WAKE_IRCON_RXEN | -+ CIR_WAKE_IRCON_R | CIR_WAKE_IRCON_RXINV | -+ CIR_WAKE_IRCON_SAMPLE_PERIOD_SEL, CIR_WAKE_IRCON); -+ nvt_cir_wake_reg_write(nvt, 0xff, CIR_WAKE_IRSTS); -+ nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); -+} -+ -+/* rx carrier detect only works in learning mode, must be called w/nvt_lock */ -+static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) -+{ -+ u32 count, carrier, duration = 0; -+ int i; -+ -+ count = nvt_cir_reg_read(nvt, CIR_FCCL) | -+ nvt_cir_reg_read(nvt, CIR_FCCH) << 8; -+ -+ for (i = 0; i < nvt->pkts; i++) { -+ if (nvt->buf[i] & BUF_PULSE_BIT) -+ duration += nvt->buf[i] & BUF_LEN_MASK; -+ } -+ -+ duration *= SAMPLE_PERIOD; -+ -+ if (!count || !duration) { -+ nvt_pr(KERN_NOTICE, "Unable to determine carrier! (c:%u, d:%u)", -+ count, duration); -+ return 0; -+ } -+ -+ carrier = (count * 1000000) / duration; -+ -+ if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER)) -+ nvt_dbg("WTF? Carrier frequency out of range!"); -+ -+ nvt_dbg("Carrier frequency: %u (count %u, duration %u)", -+ carrier, count, duration); -+ -+ return carrier; -+} -+ -+/* -+ * set carrier frequency -+ * -+ * set carrier on 2 registers: CP & CC -+ * always set CP as 0x81 -+ * set CC by SPEC, CC = 3MHz/carrier - 1 -+ */ -+static int nvt_set_tx_carrier(void *data, u32 carrier) -+{ -+ struct nvt_dev *nvt = data; -+ u16 val; -+ -+ nvt_cir_reg_write(nvt, 1, CIR_CP); -+ val = 3000000 / (carrier) - 1; -+ nvt_cir_reg_write(nvt, val & 0xff, CIR_CC); -+ -+ nvt_dbg("cp: 0x%x cc: 0x%x\n", -+ nvt_cir_reg_read(nvt, CIR_CP), nvt_cir_reg_read(nvt, CIR_CC)); -+ -+ return 0; -+} -+ -+/* -+ * nvt_tx_ir -+ * -+ * 1) clean TX fifo first (handled by AP) -+ * 2) copy data from user space -+ * 3) disable RX interrupts, enable TX interrupts: TTR & TFU -+ * 4) send 9 packets to TX FIFO to open TTR -+ * in interrupt_handler: -+ * 5) send all data out -+ * go back to write(): -+ * 6) disable TX interrupts, re-enable RX interupts -+ * -+ * The key problem of this function is user space data may larger than -+ * driver's data buf length. So nvt_tx_ir() will only copy TX_BUF_LEN data to -+ * buf, and keep current copied data buf num in cur_buf_num. But driver's buf -+ * number may larger than TXFCONT (0xff). So in interrupt_handler, it has to -+ * set TXFCONT as 0xff, until buf_count less than 0xff. -+ */ -+static int nvt_tx_ir(void *priv, int *txbuf, u32 n) -+{ -+ struct nvt_dev *nvt = priv; -+ unsigned long flags; -+ size_t cur_count; -+ unsigned int i; -+ u8 iren; -+ int ret; -+ -+ spin_lock_irqsave(&nvt->tx.lock, flags); -+ -+ if (n >= TX_BUF_LEN) { -+ nvt->tx.buf_count = cur_count = TX_BUF_LEN; -+ ret = TX_BUF_LEN; -+ } else { -+ nvt->tx.buf_count = cur_count = n; -+ ret = n; -+ } -+ -+ memcpy(nvt->tx.buf, txbuf, nvt->tx.buf_count); -+ -+ nvt->tx.cur_buf_num = 0; -+ -+ /* save currently enabled interrupts */ -+ iren = nvt_cir_reg_read(nvt, CIR_IREN); -+ -+ /* now disable all interrupts, save TFU & TTR */ -+ nvt_cir_reg_write(nvt, CIR_IREN_TFU | CIR_IREN_TTR, CIR_IREN); -+ -+ nvt->tx.tx_state = ST_TX_REPLY; -+ -+ nvt_cir_reg_write(nvt, CIR_FIFOCON_TX_TRIGGER_LEV_8 | -+ CIR_FIFOCON_RXFIFOCLR, CIR_FIFOCON); -+ -+ /* trigger TTR interrupt by writing out ones, (yes, it's ugly) */ -+ for (i = 0; i < 9; i++) -+ nvt_cir_reg_write(nvt, 0x01, CIR_STXFIFO); -+ -+ spin_unlock_irqrestore(&nvt->tx.lock, flags); -+ -+ wait_event(nvt->tx.queue, nvt->tx.tx_state == ST_TX_REQUEST); -+ -+ spin_lock_irqsave(&nvt->tx.lock, flags); -+ nvt->tx.tx_state = ST_TX_NONE; -+ spin_unlock_irqrestore(&nvt->tx.lock, flags); -+ -+ /* restore enabled interrupts to prior state */ -+ nvt_cir_reg_write(nvt, iren, CIR_IREN); -+ -+ return ret; -+} -+ -+/* dump contents of the last rx buffer we got from the hw rx fifo */ -+static void nvt_dump_rx_buf(struct nvt_dev *nvt) -+{ -+ int i; -+ -+ printk("%s (len %d): ", __func__, nvt->pkts); -+ for (i = 0; (i < nvt->pkts) && (i < RX_BUF_LEN); i++) -+ printk("0x%02x ", nvt->buf[i]); -+ printk("\n"); -+} -+ -+/* -+ * Process raw data in rx driver buffer, store it in raw IR event kfifo, -+ * trigger decode when appropriate. -+ * -+ * We get IR data samples one byte at a time. If the msb is set, its a pulse, -+ * otherwise its a space. The lower 7 bits are the count of SAMPLE_PERIOD -+ * (default 50us) intervals for that pulse/space. A discrete signal is -+ * followed by a series of 0x7f packets, then either 0x7 or 0x80 -+ * to signal more IR coming (repeats) or end of IR, respectively. We store -+ * sample data in the raw event kfifo until we see 0x7 (except f) -+ * or 0x80, at which time, we trigger a decode operation. -+ */ -+static void nvt_process_rx_ir_data(struct nvt_dev *nvt) -+{ -+ struct ir_raw_event rawir = { .pulse = false, .duration = 0 }; -+ unsigned int count; -+ u32 carrier; -+ u8 sample; -+ int i; -+ -+ nvt_dbg_verbose("%s firing", __func__); -+ -+ if (debug) -+ nvt_dump_rx_buf(nvt); -+ -+ if (nvt->carrier_detect_enabled) -+ carrier = nvt_rx_carrier_detect(nvt); -+ -+ count = nvt->pkts; -+ nvt_dbg_verbose("Processing buffer of len %d", count); -+ -+ for (i = 0; i < count; i++) { -+ nvt->pkts--; -+ sample = nvt->buf[i]; -+ -+ rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); -+ rawir.duration = (sample & BUF_LEN_MASK) -+ * SAMPLE_PERIOD * 1000; -+ -+ if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { -+ if (nvt->rawir.pulse == rawir.pulse) -+ nvt->rawir.duration += rawir.duration; -+ else { -+ nvt->rawir.duration = rawir.duration; -+ nvt->rawir.pulse = rawir.pulse; -+ } -+ continue; -+ } -+ -+ rawir.duration += nvt->rawir.duration; -+ nvt->rawir.duration = 0; -+ nvt->rawir.pulse = rawir.pulse; -+ -+ if (sample == BUF_PULSE_BIT) -+ rawir.pulse = false; -+ -+ if (rawir.duration) { -+ nvt_dbg("Storing %s with duration %d", -+ rawir.pulse ? "pulse" : "space", -+ rawir.duration); -+ -+ ir_raw_event_store(nvt->rdev, &rawir); -+ } -+ -+ /* -+ * BUF_PULSE_BIT indicates end of IR data, BUF_REPEAT_BYTE -+ * indicates end of IR signal, but new data incoming. In both -+ * cases, it means we're ready to call ir_raw_event_handle -+ */ -+ if (sample == BUF_PULSE_BIT || ((sample != BUF_LEN_MASK) && -+ (sample & BUF_REPEAT_MASK) == BUF_REPEAT_BYTE)) -+ ir_raw_event_handle(nvt->rdev); -+ } -+ -+ if (nvt->pkts) { -+ nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts); -+ nvt->pkts = 0; -+ } -+ -+ nvt_dbg_verbose("%s done", __func__); -+} -+ -+/* copy data from hardware rx fifo into driver buffer */ -+static void nvt_get_rx_ir_data(struct nvt_dev *nvt) -+{ -+ unsigned long flags; -+ u8 fifocount, val; -+ unsigned int b_idx; -+ int i; -+ -+ /* Get count of how many bytes to read from RX FIFO */ -+ fifocount = nvt_cir_reg_read(nvt, CIR_RXFCONT); -+ /* if we get 0xff, probably means the logical dev is disabled */ -+ if (fifocount == 0xff) -+ return; -+ /* this would suggest a fifo overrun, not good... */ -+ else if (fifocount > RX_BUF_LEN) { -+ nvt_pr(KERN_WARNING, "fifocount %d over fifo len (%d)!", -+ fifocount, RX_BUF_LEN); -+ return; -+ } -+ -+ nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount); -+ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ -+ b_idx = nvt->pkts; -+ -+ /* This should never happen, but lets check anyway... */ -+ if (b_idx + fifocount > RX_BUF_LEN) { -+ nvt_process_rx_ir_data(nvt); -+ b_idx = 0; -+ } -+ -+ /* Read fifocount bytes from CIR Sample RX FIFO register */ -+ for (i = 0; i < fifocount; i++) { -+ val = nvt_cir_reg_read(nvt, CIR_SRXFIFO); -+ nvt->buf[b_idx + i] = val; -+ } -+ -+ nvt->pkts += fifocount; -+ nvt_dbg("%s: pkts now %d", __func__, nvt->pkts); -+ -+ nvt_process_rx_ir_data(nvt); -+ -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+} -+ -+static void nvt_cir_log_irqs(u8 status, u8 iren) -+{ -+ nvt_pr(KERN_INFO, "IRQ 0x%02x (IREN 0x%02x) :%s%s%s%s%s%s%s%s%s", -+ status, iren, -+ status & CIR_IRSTS_RDR ? " RDR" : "", -+ status & CIR_IRSTS_RTR ? " RTR" : "", -+ status & CIR_IRSTS_PE ? " PE" : "", -+ status & CIR_IRSTS_RFO ? " RFO" : "", -+ status & CIR_IRSTS_TE ? " TE" : "", -+ status & CIR_IRSTS_TTR ? " TTR" : "", -+ status & CIR_IRSTS_TFU ? " TFU" : "", -+ status & CIR_IRSTS_GH ? " GH" : "", -+ status & ~(CIR_IRSTS_RDR | CIR_IRSTS_RTR | CIR_IRSTS_PE | -+ CIR_IRSTS_RFO | CIR_IRSTS_TE | CIR_IRSTS_TTR | -+ CIR_IRSTS_TFU | CIR_IRSTS_GH) ? " ?" : ""); -+} -+ -+static bool nvt_cir_tx_inactive(struct nvt_dev *nvt) -+{ -+ unsigned long flags; -+ bool tx_inactive; -+ u8 tx_state; -+ -+ spin_lock_irqsave(&nvt->tx.lock, flags); -+ tx_state = nvt->tx.tx_state; -+ spin_unlock_irqrestore(&nvt->tx.lock, flags); -+ -+ tx_inactive = (tx_state == ST_TX_NONE); -+ -+ return tx_inactive; -+} -+ -+/* interrupt service routine for incoming and outgoing CIR data */ -+static irqreturn_t nvt_cir_isr(int irq, void *data) -+{ -+ struct nvt_dev *nvt = data; -+ u8 status, iren, cur_state; -+ unsigned long flags; -+ -+ nvt_dbg_verbose("%s firing", __func__); -+ -+ nvt_efm_enable(nvt); -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ nvt_efm_disable(nvt); -+ -+ /* -+ * Get IR Status register contents. Write 1 to ack/clear -+ * -+ * bit: reg name - description -+ * 7: CIR_IRSTS_RDR - RX Data Ready -+ * 6: CIR_IRSTS_RTR - RX FIFO Trigger Level Reach -+ * 5: CIR_IRSTS_PE - Packet End -+ * 4: CIR_IRSTS_RFO - RX FIFO Overrun (RDR will also be set) -+ * 3: CIR_IRSTS_TE - TX FIFO Empty -+ * 2: CIR_IRSTS_TTR - TX FIFO Trigger Level Reach -+ * 1: CIR_IRSTS_TFU - TX FIFO Underrun -+ * 0: CIR_IRSTS_GH - Min Length Detected -+ */ -+ status = nvt_cir_reg_read(nvt, CIR_IRSTS); -+ if (!status) { -+ nvt_dbg_verbose("%s exiting, IRSTS 0x0", __func__); -+ nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS); -+ return IRQ_RETVAL(IRQ_NONE); -+ } -+ -+ /* ack/clear all irq flags we've got */ -+ nvt_cir_reg_write(nvt, status, CIR_IRSTS); -+ nvt_cir_reg_write(nvt, 0, CIR_IRSTS); -+ -+ /* Interrupt may be shared with CIR Wake, bail if CIR not enabled */ -+ iren = nvt_cir_reg_read(nvt, CIR_IREN); -+ if (!iren) { -+ nvt_dbg_verbose("%s exiting, CIR not enabled", __func__); -+ return IRQ_RETVAL(IRQ_NONE); -+ } -+ -+ if (debug) -+ nvt_cir_log_irqs(status, iren); -+ -+ if (status & CIR_IRSTS_RTR) { -+ /* FIXME: add code for study/learn mode */ -+ /* We only do rx if not tx'ing */ -+ if (nvt_cir_tx_inactive(nvt)) -+ nvt_get_rx_ir_data(nvt); -+ } -+ -+ if (status & CIR_IRSTS_PE) { -+ if (nvt_cir_tx_inactive(nvt)) -+ nvt_get_rx_ir_data(nvt); -+ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ -+ cur_state = nvt->study_state; -+ -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+ -+ if (cur_state == ST_STUDY_NONE) -+ nvt_clear_cir_fifo(nvt); -+ } -+ -+ if (status & CIR_IRSTS_TE) -+ nvt_clear_tx_fifo(nvt); -+ -+ if (status & CIR_IRSTS_TTR) { -+ unsigned int pos, count; -+ u8 tmp; -+ -+ spin_lock_irqsave(&nvt->tx.lock, flags); -+ -+ pos = nvt->tx.cur_buf_num; -+ count = nvt->tx.buf_count; -+ -+ /* Write data into the hardware tx fifo while pos < count */ -+ if (pos < count) { -+ nvt_cir_reg_write(nvt, nvt->tx.buf[pos], CIR_STXFIFO); -+ nvt->tx.cur_buf_num++; -+ /* Disable TX FIFO Trigger Level Reach (TTR) interrupt */ -+ } else { -+ tmp = nvt_cir_reg_read(nvt, CIR_IREN); -+ nvt_cir_reg_write(nvt, tmp & ~CIR_IREN_TTR, CIR_IREN); -+ } -+ -+ spin_unlock_irqrestore(&nvt->tx.lock, flags); -+ -+ } -+ -+ if (status & CIR_IRSTS_TFU) { -+ spin_lock_irqsave(&nvt->tx.lock, flags); -+ if (nvt->tx.tx_state == ST_TX_REPLY) { -+ nvt->tx.tx_state = ST_TX_REQUEST; -+ wake_up(&nvt->tx.queue); -+ } -+ spin_unlock_irqrestore(&nvt->tx.lock, flags); -+ } -+ -+ nvt_dbg_verbose("%s done", __func__); -+ return IRQ_RETVAL(IRQ_HANDLED); -+} -+ -+/* Interrupt service routine for CIR Wake */ -+static irqreturn_t nvt_cir_wake_isr(int irq, void *data) -+{ -+ u8 status, iren, val; -+ struct nvt_dev *nvt = data; -+ unsigned long flags; -+ -+ nvt_dbg_wake("%s firing", __func__); -+ -+ status = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRSTS); -+ if (!status) -+ return IRQ_RETVAL(IRQ_NONE); -+ -+ if (status & CIR_WAKE_IRSTS_IR_PENDING) -+ nvt_clear_cir_wake_fifo(nvt); -+ -+ nvt_cir_wake_reg_write(nvt, status, CIR_WAKE_IRSTS); -+ nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IRSTS); -+ -+ /* Interrupt may be shared with CIR, bail if Wake not enabled */ -+ iren = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IREN); -+ if (!iren) { -+ nvt_dbg_wake("%s exiting, wake not enabled", __func__); -+ return IRQ_RETVAL(IRQ_HANDLED); -+ } -+ -+ if ((status & CIR_WAKE_IRSTS_PE) && -+ (nvt->wake_state == ST_WAKE_START)) { -+ while (nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY_IDX)) { -+ val = nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY); -+ nvt_dbg("setting wake up key: 0x%x", val); -+ } -+ -+ nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ nvt->wake_state = ST_WAKE_FINISH; -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+ } -+ -+ nvt_dbg_wake("%s done", __func__); -+ return IRQ_RETVAL(IRQ_HANDLED); -+} -+ -+static void nvt_enable_cir(struct nvt_dev *nvt) -+{ -+ /* set function enable flags */ -+ nvt_cir_reg_write(nvt, CIR_IRCON_TXEN | CIR_IRCON_RXEN | -+ CIR_IRCON_RXINV | CIR_IRCON_SAMPLE_PERIOD_SEL, -+ CIR_IRCON); -+ -+ nvt_efm_enable(nvt); -+ -+ /* enable the CIR logical device */ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_efm_disable(nvt); -+ -+ /* clear all pending interrupts */ -+ nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS); -+ -+ /* enable interrupts */ -+ nvt_cir_reg_write(nvt, CIR_IREN_RTR | CIR_IREN_PE, CIR_IREN); -+} -+ -+static void nvt_disable_cir(struct nvt_dev *nvt) -+{ -+ /* disable CIR interrupts */ -+ nvt_cir_reg_write(nvt, 0, CIR_IREN); -+ -+ /* clear any and all pending interrupts */ -+ nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS); -+ -+ /* clear all function enable flags */ -+ nvt_cir_reg_write(nvt, 0, CIR_IRCON); -+ -+ /* clear hardware rx and tx fifos */ -+ nvt_clear_cir_fifo(nvt); -+ nvt_clear_tx_fifo(nvt); -+ -+ nvt_efm_enable(nvt); -+ -+ /* disable the CIR logical device */ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ nvt_cr_write(nvt, LOGICAL_DEV_DISABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_efm_disable(nvt); -+} -+ -+static int nvt_open(void *data) -+{ -+ struct nvt_dev *nvt = (struct nvt_dev *)data; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ nvt->in_use = true; -+ nvt_enable_cir(nvt); -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+ -+ return 0; -+} -+ -+static void nvt_close(void *data) -+{ -+ struct nvt_dev *nvt = (struct nvt_dev *)data; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ nvt->in_use = false; -+ nvt_disable_cir(nvt); -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+} -+ -+/* Allocate memory, probe hardware, and initialize everything */ -+static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) -+{ -+ struct nvt_dev *nvt = NULL; -+ struct input_dev *rdev = NULL; -+ struct ir_dev_props *props = NULL; -+ int ret = -ENOMEM; -+ -+ nvt = kzalloc(sizeof(struct nvt_dev), GFP_KERNEL); -+ if (!nvt) -+ return ret; -+ -+ props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); -+ if (!props) -+ goto failure; -+ -+ /* input device for IR remote (and tx) */ -+ rdev = input_allocate_device(); -+ if (!rdev) -+ goto failure; -+ -+ ret = -ENODEV; -+ /* validate pnp resources */ -+ if (!pnp_port_valid(pdev, 0) || -+ pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) { -+ dev_err(&pdev->dev, "IR PNP Port not valid!\n"); -+ goto failure; -+ } -+ -+ if (!pnp_irq_valid(pdev, 0)) { -+ dev_err(&pdev->dev, "PNP IRQ not valid!\n"); -+ goto failure; -+ } -+ -+ if (!pnp_port_valid(pdev, 1) || -+ pnp_port_len(pdev, 1) < CIR_IOREG_LENGTH) { -+ dev_err(&pdev->dev, "Wake PNP Port not valid!\n"); -+ goto failure; -+ } -+ -+ nvt->cir_addr = pnp_port_start(pdev, 0); -+ nvt->cir_irq = pnp_irq(pdev, 0); -+ -+ nvt->cir_wake_addr = pnp_port_start(pdev, 1); -+ /* irq is always shared between cir and cir wake */ -+ nvt->cir_wake_irq = nvt->cir_irq; -+ -+ nvt->cr_efir = CR_EFIR; -+ nvt->cr_efdr = CR_EFDR; -+ -+ spin_lock_init(&nvt->nvt_lock); -+ spin_lock_init(&nvt->tx.lock); -+ -+ ret = -EBUSY; -+ /* now claim resources */ -+ if (!request_region(nvt->cir_addr, -+ CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) -+ goto failure; -+ -+ if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED, -+ NVT_DRIVER_NAME, (void *)nvt)) -+ goto failure; -+ -+ if (!request_region(nvt->cir_wake_addr, -+ CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) -+ goto failure; -+ -+ if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED, -+ NVT_DRIVER_NAME, (void *)nvt)) -+ goto failure; -+ -+ pnp_set_drvdata(pdev, nvt); -+ nvt->pdev = pdev; -+ -+ init_waitqueue_head(&nvt->tx.queue); -+ -+ ret = nvt_hw_detect(nvt); -+ if (ret) -+ goto failure; -+ -+ /* Initialize CIR & CIR Wake Logical Devices */ -+ nvt_efm_enable(nvt); -+ nvt_cir_ldev_init(nvt); -+ nvt_cir_wake_ldev_init(nvt); -+ nvt_efm_disable(nvt); -+ -+ /* Initialize CIR & CIR Wake Config Registers */ -+ nvt_cir_regs_init(nvt); -+ nvt_cir_wake_regs_init(nvt); -+ -+ /* Set up ir-core props */ -+ props->priv = nvt; -+ props->driver_type = RC_DRIVER_IR_RAW; -+ props->allowed_protos = IR_TYPE_ALL; -+ props->open = nvt_open; -+ props->close = nvt_close; -+#if 0 -+ props->min_timeout = XYZ; -+ props->max_timeout = XYZ; -+ props->timeout = XYZ; -+ /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ -+ props->rx_resolution = XYZ; -+ -+ /* tx bits */ -+ props->tx_resolution = XYZ; -+#endif -+ props->tx_ir = nvt_tx_ir; -+ props->s_tx_carrier = nvt_set_tx_carrier; -+ -+ rdev->name = "Nuvoton w836x7hg Infrared Remote Transceiver"; -+ rdev->id.bustype = BUS_HOST; -+ rdev->id.vendor = PCI_VENDOR_ID_WINBOND2; -+ rdev->id.product = nvt->chip_major; -+ rdev->id.version = nvt->chip_minor; -+ -+ nvt->props = props; -+ nvt->rdev = rdev; -+ -+ device_set_wakeup_capable(&pdev->dev, 1); -+ device_set_wakeup_enable(&pdev->dev, 1); -+ -+ ret = ir_input_register(rdev, RC_MAP_RC6_MCE, props, NVT_DRIVER_NAME); -+ if (ret) -+ goto failure; -+ -+ nvt_pr(KERN_NOTICE, "driver has been successfully loaded\n"); -+ if (debug) { -+ cir_dump_regs(nvt); -+ cir_wake_dump_regs(nvt); -+ } -+ -+ return 0; -+ -+failure: -+ if (nvt->cir_irq) -+ free_irq(nvt->cir_irq, nvt); -+ if (nvt->cir_addr) -+ release_region(nvt->cir_addr, CIR_IOREG_LENGTH); -+ -+ if (nvt->cir_wake_irq) -+ free_irq(nvt->cir_wake_irq, nvt); -+ if (nvt->cir_wake_addr) -+ release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); -+ -+ input_free_device(rdev); -+ kfree(props); -+ kfree(nvt); -+ -+ return ret; -+} -+ -+static void __devexit nvt_remove(struct pnp_dev *pdev) -+{ -+ struct nvt_dev *nvt = pnp_get_drvdata(pdev); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ /* disable CIR */ -+ nvt_cir_reg_write(nvt, 0, CIR_IREN); -+ nvt_disable_cir(nvt); -+ /* enable CIR Wake (for IR power-on) */ -+ nvt_enable_wake(nvt); -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+ -+ /* free resources */ -+ free_irq(nvt->cir_irq, nvt); -+ free_irq(nvt->cir_wake_irq, nvt); -+ release_region(nvt->cir_addr, CIR_IOREG_LENGTH); -+ release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); -+ -+ ir_input_unregister(nvt->rdev); -+ -+ kfree(nvt->props); -+ kfree(nvt); -+} -+ -+static int nvt_suspend(struct pnp_dev *pdev, pm_message_t state) -+{ -+ struct nvt_dev *nvt = pnp_get_drvdata(pdev); -+ unsigned long flags; -+ -+ nvt_dbg("%s called", __func__); -+ -+ /* zero out misc state tracking */ -+ spin_lock_irqsave(&nvt->nvt_lock, flags); -+ nvt->study_state = ST_STUDY_NONE; -+ nvt->wake_state = ST_WAKE_NONE; -+ spin_unlock_irqrestore(&nvt->nvt_lock, flags); -+ -+ spin_lock_irqsave(&nvt->tx.lock, flags); -+ nvt->tx.tx_state = ST_TX_NONE; -+ spin_unlock_irqrestore(&nvt->tx.lock, flags); -+ -+ /* disable all CIR interrupts */ -+ nvt_cir_reg_write(nvt, 0, CIR_IREN); -+ -+ nvt_efm_enable(nvt); -+ -+ /* disable cir logical dev */ -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ nvt_cr_write(nvt, LOGICAL_DEV_DISABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_efm_disable(nvt); -+ -+ /* make sure wake is enabled */ -+ nvt_enable_wake(nvt); -+ -+ return 0; -+} -+ -+static int nvt_resume(struct pnp_dev *pdev) -+{ -+ int ret = 0; -+ struct nvt_dev *nvt = pnp_get_drvdata(pdev); -+ -+ nvt_dbg("%s called", __func__); -+ -+ /* open interrupt */ -+ nvt_cir_reg_write(nvt, CIR_IREN_RTR | CIR_IREN_PE, CIR_IREN); -+ -+ /* Enable CIR logical device */ -+ nvt_efm_enable(nvt); -+ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); -+ nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); -+ -+ nvt_efm_disable(nvt); -+ -+ nvt_cir_regs_init(nvt); -+ nvt_cir_wake_regs_init(nvt); -+ -+ return ret; -+} -+ -+static void nvt_shutdown(struct pnp_dev *pdev) -+{ -+ struct nvt_dev *nvt = pnp_get_drvdata(pdev); -+ nvt_enable_wake(nvt); -+} -+ -+static const struct pnp_device_id nvt_ids[] = { -+ { "WEC0530", 0 }, /* CIR */ -+ { "NTN0530", 0 }, /* CIR for new chip's pnp id*/ -+ { "", 0 }, -+}; -+ -+static struct pnp_driver nvt_driver = { -+ .name = NVT_DRIVER_NAME, -+ .id_table = nvt_ids, -+ .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, -+ .probe = nvt_probe, -+ .remove = __devexit_p(nvt_remove), -+ .suspend = nvt_suspend, -+ .resume = nvt_resume, -+ .shutdown = nvt_shutdown, -+}; -+ -+int nvt_init(void) -+{ -+ return pnp_register_driver(&nvt_driver); -+} -+ -+void nvt_exit(void) -+{ -+ pnp_unregister_driver(&nvt_driver); -+} -+ -+module_param(debug, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(debug, "Enable debugging output"); -+ -+MODULE_DEVICE_TABLE(pnp, nvt_ids); -+MODULE_DESCRIPTION("Nuvoton W83667HG-A & W83677HG-I CIR driver"); -+ -+MODULE_AUTHOR("Jarod Wilson "); -+MODULE_LICENSE("GPL"); -+ -+module_init(nvt_init); -+module_exit(nvt_exit); -diff --git a/drivers/media/IR/nuvoton-cir.h b/drivers/media/IR/nuvoton-cir.h -new file mode 100644 -index 0000000..12bfe89 ---- /dev/null -+++ b/drivers/media/IR/nuvoton-cir.h -@@ -0,0 +1,408 @@ -+/* -+ * Driver for Nuvoton Technology Corporation w83667hg/w83677hg-i CIR -+ * -+ * Copyright (C) 2010 Jarod Wilson -+ * Copyright (C) 2009 Nuvoton PS Team -+ * -+ * Special thanks to Nuvoton for providing hardware, spec sheets and -+ * sample code upon which portions of this driver are based. Indirect -+ * thanks also to Maxim Levitsky, whose ene_ir driver this driver is -+ * modeled after. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -+ * USA -+ */ -+ -+#include -+#include -+ -+/* platform driver name to register */ -+#define NVT_DRIVER_NAME "nuvoton-cir" -+ -+/* debugging module parameter */ -+static int debug; -+ -+ -+#define nvt_pr(level, text, ...) \ -+ printk(level KBUILD_MODNAME ": " text, ## __VA_ARGS__) -+ -+#define nvt_dbg(text, ...) \ -+ if (debug) \ -+ printk(KERN_DEBUG \ -+ KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__) -+ -+#define nvt_dbg_verbose(text, ...) \ -+ if (debug > 1) \ -+ printk(KERN_DEBUG \ -+ KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__) -+ -+#define nvt_dbg_wake(text, ...) \ -+ if (debug > 2) \ -+ printk(KERN_DEBUG \ -+ KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__) -+ -+ -+/* -+ * Original lirc driver said min value of 76, and recommended value of 256 -+ * for the buffer length, but then used 2048. Never mind that the size of the -+ * RX FIFO is 32 bytes... So I'm using 32 for RX and 256 for TX atm, but I'm -+ * not sure if maybe that TX value is off by a factor of 8 (bits vs. bytes), -+ * and I don't have TX-capable hardware to test/debug on... -+ */ -+#define TX_BUF_LEN 256 -+#define RX_BUF_LEN 32 -+ -+struct nvt_dev { -+ struct pnp_dev *pdev; -+ struct input_dev *rdev; -+ struct ir_dev_props *props; -+ struct ir_raw_event rawir; -+ -+ spinlock_t nvt_lock; -+ bool in_use; -+ -+ /* for rx */ -+ u8 buf[RX_BUF_LEN]; -+ unsigned int pkts; -+ -+ struct { -+ spinlock_t lock; -+ u8 buf[TX_BUF_LEN]; -+ unsigned int buf_count; -+ unsigned int cur_buf_num; -+ wait_queue_head_t queue; -+ u8 tx_state; -+ } tx; -+ -+ /* EFER Config register index/data pair */ -+ u8 cr_efir; -+ u8 cr_efdr; -+ -+ /* hardware I/O settings */ -+ unsigned long cir_addr; -+ unsigned long cir_wake_addr; -+ int cir_irq; -+ int cir_wake_irq; -+ -+ /* hardware id */ -+ u8 chip_major; -+ u8 chip_minor; -+ -+ /* hardware features */ -+ bool hw_learning_capable; -+ bool hw_tx_capable; -+ -+ /* rx settings */ -+ bool learning_enabled; -+ bool carrier_detect_enabled; -+ -+ /* track cir wake state */ -+ u8 wake_state; -+ /* for study */ -+ u8 study_state; -+ /* carrier period = 1 / frequency */ -+ u32 carrier; -+}; -+ -+/* study states */ -+#define ST_STUDY_NONE 0x0 -+#define ST_STUDY_START 0x1 -+#define ST_STUDY_CARRIER 0x2 -+#define ST_STUDY_ALL_RECV 0x4 -+ -+/* wake states */ -+#define ST_WAKE_NONE 0x0 -+#define ST_WAKE_START 0x1 -+#define ST_WAKE_FINISH 0x2 -+ -+/* receive states */ -+#define ST_RX_WAIT_7F 0x1 -+#define ST_RX_WAIT_HEAD 0x2 -+#define ST_RX_WAIT_SILENT_END 0x4 -+ -+/* send states */ -+#define ST_TX_NONE 0x0 -+#define ST_TX_REQUEST 0x2 -+#define ST_TX_REPLY 0x4 -+ -+/* buffer packet constants */ -+#define BUF_PULSE_BIT 0x80 -+#define BUF_LEN_MASK 0x7f -+#define BUF_REPEAT_BYTE 0x70 -+#define BUF_REPEAT_MASK 0xf0 -+ -+/* CIR settings */ -+ -+/* total length of CIR and CIR WAKE */ -+#define CIR_IOREG_LENGTH 0x0f -+ -+/* RX limit length, 8 high bits for SLCH, 8 low bits for SLCL (0x7d0 = 2000) */ -+#define CIR_RX_LIMIT_COUNT 0x7d0 -+ -+/* CIR Regs */ -+#define CIR_IRCON 0x00 -+#define CIR_IRSTS 0x01 -+#define CIR_IREN 0x02 -+#define CIR_RXFCONT 0x03 -+#define CIR_CP 0x04 -+#define CIR_CC 0x05 -+#define CIR_SLCH 0x06 -+#define CIR_SLCL 0x07 -+#define CIR_FIFOCON 0x08 -+#define CIR_IRFIFOSTS 0x09 -+#define CIR_SRXFIFO 0x0a -+#define CIR_TXFCONT 0x0b -+#define CIR_STXFIFO 0x0c -+#define CIR_FCCH 0x0d -+#define CIR_FCCL 0x0e -+#define CIR_IRFSM 0x0f -+ -+/* CIR IRCON settings */ -+#define CIR_IRCON_RECV 0x80 -+#define CIR_IRCON_WIREN 0x40 -+#define CIR_IRCON_TXEN 0x20 -+#define CIR_IRCON_RXEN 0x10 -+#define CIR_IRCON_WRXINV 0x08 -+#define CIR_IRCON_RXINV 0x04 -+ -+#define CIR_IRCON_SAMPLE_PERIOD_SEL_1 0x00 -+#define CIR_IRCON_SAMPLE_PERIOD_SEL_25 0x01 -+#define CIR_IRCON_SAMPLE_PERIOD_SEL_50 0x02 -+#define CIR_IRCON_SAMPLE_PERIOD_SEL_100 0x03 -+ -+/* FIXME: make this a runtime option */ -+/* select sample period as 50us */ -+#define CIR_IRCON_SAMPLE_PERIOD_SEL CIR_IRCON_SAMPLE_PERIOD_SEL_50 -+ -+/* CIR IRSTS settings */ -+#define CIR_IRSTS_RDR 0x80 -+#define CIR_IRSTS_RTR 0x40 -+#define CIR_IRSTS_PE 0x20 -+#define CIR_IRSTS_RFO 0x10 -+#define CIR_IRSTS_TE 0x08 -+#define CIR_IRSTS_TTR 0x04 -+#define CIR_IRSTS_TFU 0x02 -+#define CIR_IRSTS_GH 0x01 -+ -+/* CIR IREN settings */ -+#define CIR_IREN_RDR 0x80 -+#define CIR_IREN_RTR 0x40 -+#define CIR_IREN_PE 0x20 -+#define CIR_IREN_RFO 0x10 -+#define CIR_IREN_TE 0x08 -+#define CIR_IREN_TTR 0x04 -+#define CIR_IREN_TFU 0x02 -+#define CIR_IREN_GH 0x01 -+ -+/* CIR FIFOCON settings */ -+#define CIR_FIFOCON_TXFIFOCLR 0x80 -+ -+#define CIR_FIFOCON_TX_TRIGGER_LEV_31 0x00 -+#define CIR_FIFOCON_TX_TRIGGER_LEV_24 0x10 -+#define CIR_FIFOCON_TX_TRIGGER_LEV_16 0x20 -+#define CIR_FIFOCON_TX_TRIGGER_LEV_8 0x30 -+ -+/* FIXME: make this a runtime option */ -+/* select TX trigger level as 16 */ -+#define CIR_FIFOCON_TX_TRIGGER_LEV CIR_FIFOCON_TX_TRIGGER_LEV_16 -+ -+#define CIR_FIFOCON_RXFIFOCLR 0x08 -+ -+#define CIR_FIFOCON_RX_TRIGGER_LEV_1 0x00 -+#define CIR_FIFOCON_RX_TRIGGER_LEV_8 0x01 -+#define CIR_FIFOCON_RX_TRIGGER_LEV_16 0x02 -+#define CIR_FIFOCON_RX_TRIGGER_LEV_24 0x03 -+ -+/* FIXME: make this a runtime option */ -+/* select RX trigger level as 24 */ -+#define CIR_FIFOCON_RX_TRIGGER_LEV CIR_FIFOCON_RX_TRIGGER_LEV_24 -+ -+/* CIR IRFIFOSTS settings */ -+#define CIR_IRFIFOSTS_IR_PENDING 0x80 -+#define CIR_IRFIFOSTS_RX_GS 0x40 -+#define CIR_IRFIFOSTS_RX_FTA 0x20 -+#define CIR_IRFIFOSTS_RX_EMPTY 0x10 -+#define CIR_IRFIFOSTS_RX_FULL 0x08 -+#define CIR_IRFIFOSTS_TX_FTA 0x04 -+#define CIR_IRFIFOSTS_TX_EMPTY 0x02 -+#define CIR_IRFIFOSTS_TX_FULL 0x01 -+ -+ -+/* CIR WAKE UP Regs */ -+#define CIR_WAKE_IRCON 0x00 -+#define CIR_WAKE_IRSTS 0x01 -+#define CIR_WAKE_IREN 0x02 -+#define CIR_WAKE_FIFO_CMP_DEEP 0x03 -+#define CIR_WAKE_FIFO_CMP_TOL 0x04 -+#define CIR_WAKE_FIFO_COUNT 0x05 -+#define CIR_WAKE_SLCH 0x06 -+#define CIR_WAKE_SLCL 0x07 -+#define CIR_WAKE_FIFOCON 0x08 -+#define CIR_WAKE_SRXFSTS 0x09 -+#define CIR_WAKE_SAMPLE_RX_FIFO 0x0a -+#define CIR_WAKE_WR_FIFO_DATA 0x0b -+#define CIR_WAKE_RD_FIFO_ONLY 0x0c -+#define CIR_WAKE_RD_FIFO_ONLY_IDX 0x0d -+#define CIR_WAKE_FIFO_IGNORE 0x0e -+#define CIR_WAKE_IRFSM 0x0f -+ -+/* CIR WAKE UP IRCON settings */ -+#define CIR_WAKE_IRCON_DEC_RST 0x80 -+#define CIR_WAKE_IRCON_MODE1 0x40 -+#define CIR_WAKE_IRCON_MODE0 0x20 -+#define CIR_WAKE_IRCON_RXEN 0x10 -+#define CIR_WAKE_IRCON_R 0x08 -+#define CIR_WAKE_IRCON_RXINV 0x04 -+ -+/* FIXME/jarod: make this a runtime option */ -+/* select a same sample period like cir register */ -+#define CIR_WAKE_IRCON_SAMPLE_PERIOD_SEL CIR_IRCON_SAMPLE_PERIOD_SEL_50 -+ -+/* CIR WAKE IRSTS Bits */ -+#define CIR_WAKE_IRSTS_RDR 0x80 -+#define CIR_WAKE_IRSTS_RTR 0x40 -+#define CIR_WAKE_IRSTS_PE 0x20 -+#define CIR_WAKE_IRSTS_RFO 0x10 -+#define CIR_WAKE_IRSTS_GH 0x08 -+#define CIR_WAKE_IRSTS_IR_PENDING 0x01 -+ -+/* CIR WAKE UP IREN Bits */ -+#define CIR_WAKE_IREN_RDR 0x80 -+#define CIR_WAKE_IREN_RTR 0x40 -+#define CIR_WAKE_IREN_PE 0x20 -+#define CIR_WAKE_IREN_RFO 0x10 -+#define CIR_WAKE_IREN_TE 0x08 -+#define CIR_WAKE_IREN_TTR 0x04 -+#define CIR_WAKE_IREN_TFU 0x02 -+#define CIR_WAKE_IREN_GH 0x01 -+ -+/* CIR WAKE FIFOCON settings */ -+#define CIR_WAKE_FIFOCON_RXFIFOCLR 0x08 -+ -+#define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_67 0x00 -+#define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_66 0x01 -+#define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_65 0x02 -+#define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_64 0x03 -+ -+/* FIXME: make this a runtime option */ -+/* select WAKE UP RX trigger level as 67 */ -+#define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_67 -+ -+/* CIR WAKE SRXFSTS settings */ -+#define CIR_WAKE_IRFIFOSTS_RX_GS 0x80 -+#define CIR_WAKE_IRFIFOSTS_RX_FTA 0x40 -+#define CIR_WAKE_IRFIFOSTS_RX_EMPTY 0x20 -+#define CIR_WAKE_IRFIFOSTS_RX_FULL 0x10 -+ -+/* CIR Wake FIFO buffer is 67 bytes long */ -+#define CIR_WAKE_FIFO_LEN 67 -+/* CIR Wake byte comparison tolerance */ -+#define CIR_WAKE_CMP_TOLERANCE 5 -+ -+/* -+ * Extended Function Enable Registers: -+ * Extended Function Index Register -+ * Extended Function Data Register -+ */ -+#define CR_EFIR 0x2e -+#define CR_EFDR 0x2f -+ -+/* Possible alternate EFER values, depends on how the chip is wired */ -+#define CR_EFIR2 0x4e -+#define CR_EFDR2 0x4f -+ -+/* Extended Function Mode enable/disable magic values */ -+#define EFER_EFM_ENABLE 0x87 -+#define EFER_EFM_DISABLE 0xaa -+ -+/* Chip IDs found in CR_CHIP_ID_{HI,LO} */ -+#define CHIP_ID_HIGH 0xb4 -+#define CHIP_ID_LOW 0x72 -+#define CHIP_ID_LOW2 0x73 -+ -+/* Config regs we need to care about */ -+#define CR_SOFTWARE_RESET 0x02 -+#define CR_LOGICAL_DEV_SEL 0x07 -+#define CR_CHIP_ID_HI 0x20 -+#define CR_CHIP_ID_LO 0x21 -+#define CR_DEV_POWER_DOWN 0x22 /* bit 2 is CIR power, default power on */ -+#define CR_OUTPUT_PIN_SEL 0x27 -+#define CR_LOGICAL_DEV_EN 0x30 /* valid for all logical devices */ -+/* next three regs valid for both the CIR and CIR_WAKE logical devices */ -+#define CR_CIR_BASE_ADDR_HI 0x60 -+#define CR_CIR_BASE_ADDR_LO 0x61 -+#define CR_CIR_IRQ_RSRC 0x70 -+/* next three regs valid only for ACPI logical dev */ -+#define CR_ACPI_CIR_WAKE 0xe0 -+#define CR_ACPI_IRQ_EVENTS 0xf6 -+#define CR_ACPI_IRQ_EVENTS2 0xf7 -+ -+/* Logical devices that we need to care about */ -+#define LOGICAL_DEV_LPT 0x01 -+#define LOGICAL_DEV_CIR 0x06 -+#define LOGICAL_DEV_ACPI 0x0a -+#define LOGICAL_DEV_CIR_WAKE 0x0e -+ -+#define LOGICAL_DEV_DISABLE 0x00 -+#define LOGICAL_DEV_ENABLE 0x01 -+ -+#define CIR_WAKE_ENABLE_BIT 0x08 -+#define CIR_INTR_MOUSE_IRQ_BIT 0x80 -+#define PME_INTR_CIR_PASS_BIT 0x08 -+ -+#define OUTPUT_PIN_SEL_MASK 0xbc -+#define OUTPUT_ENABLE_CIR 0x01 /* Pin95=CIRRX, Pin96=CIRTX1 */ -+#define OUTPUT_ENABLE_CIRWB 0x40 /* enable wide-band sensor */ -+ -+/* MCE CIR signal length, related on sample period */ -+ -+/* MCE CIR controller signal length: about 43ms -+ * 43ms / 50us (sample period) * 0.85 (inaccuracy) -+ */ -+#define CONTROLLER_BUF_LEN_MIN 830 -+ -+/* MCE CIR keyboard signal length: about 26ms -+ * 26ms / 50us (sample period) * 0.85 (inaccuracy) -+ */ -+#define KEYBOARD_BUF_LEN_MAX 650 -+#define KEYBOARD_BUF_LEN_MIN 610 -+ -+/* MCE CIR mouse signal length: about 24ms -+ * 24ms / 50us (sample period) * 0.85 (inaccuracy) -+ */ -+#define MOUSE_BUF_LEN_MIN 565 -+ -+#define CIR_SAMPLE_PERIOD 50 -+#define CIR_SAMPLE_LOW_INACCURACY 0.85 -+ -+/* MAX silence time that driver will sent to lirc */ -+#define MAX_SILENCE_TIME 60000 -+ -+#if CIR_IRCON_SAMPLE_PERIOD_SEL == CIR_IRCON_SAMPLE_PERIOD_SEL_100 -+#define SAMPLE_PERIOD 100 -+ -+#elif CIR_IRCON_SAMPLE_PERIOD_SEL == CIR_IRCON_SAMPLE_PERIOD_SEL_50 -+#define SAMPLE_PERIOD 50 -+ -+#elif CIR_IRCON_SAMPLE_PERIOD_SEL == CIR_IRCON_SAMPLE_PERIOD_SEL_25 -+#define SAMPLE_PERIOD 25 -+ -+#else -+#define SAMPLE_PERIOD 1 -+#endif -+ -+/* as VISTA MCE definition, valid carrier value */ -+#define MAX_CARRIER 60000 -+#define MIN_CARRIER 30000 --- -1.7.3.1 - diff --git a/packages/linux/patches/linux-2.6.36.2-201-drm_vmware_revert_abb295f3b3db602f91accf58b526b30b48673af1.patch b/packages/linux/patches/linux-2.6.36.2-201-drm_vmware_revert_abb295f3b3db602f91accf58b526b30b48673af1.patch deleted file mode 100644 index 7707c6144c..0000000000 --- a/packages/linux/patches/linux-2.6.36.2-201-drm_vmware_revert_abb295f3b3db602f91accf58b526b30b48673af1.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -Naur linux-2.6.36/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c linux-2.6.36.patch/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c ---- linux-2.6.36/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c 2010-10-20 22:30:22.000000000 +0200 -+++ linux-2.6.36.patch/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c 2010-11-09 00:40:07.000000000 +0100 -@@ -615,11 +615,6 @@ - if (unlikely(ret != 0)) - goto err_unlock; - -- if (bo->mem.mem_type == TTM_PL_VRAM && -- bo->mem.mm_node->start < bo->num_pages) -- (void) ttm_bo_validate(bo, &vmw_sys_placement, false, -- false, false); -- - ret = ttm_bo_validate(bo, &ne_placement, false, false, false); - - /* Could probably bug on */ diff --git a/packages/linux/patches/linux-2.6.37-rc3-000_crosscompile.patch b/packages/linux/patches/linux-2.6.37-rc3-000_crosscompile.patch deleted file mode 100644 index b4fc575828..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-000_crosscompile.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- linux-2.6.24-rc2.orig/arch/x86/boot/tools/build.c 2007-10-06 12:26:14.000000000 +0200 -+++ linux-2.6.24-rc2/arch/x86/boot/tools/build.c 2007-10-06 12:27:36.000000000 +0200 -@@ -29,7 +29,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -42,6 +41,11 @@ - #define DEFAULT_MAJOR_ROOT 0 - #define DEFAULT_MINOR_ROOT 0 - -+#undef major -+#define major(dev) ((int)(((dev) >> 8) & 0xff)) -+#undef minor -+#define minor(dev) ((int)((dev) & 0xff)) -+ - /* Minimal number of setup sectors */ - #define SETUP_SECT_MIN 5 - #define SETUP_SECT_MAX 64 diff --git a/packages/linux/patches/linux-2.6.37-rc3-000_fix_userspace_build_of_fs.h.patch b/packages/linux/patches/linux-2.6.37-rc3-000_fix_userspace_build_of_fs.h.patch deleted file mode 100644 index e529618383..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-000_fix_userspace_build_of_fs.h.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -Naur linux-2.6.37-rc1/include/linux/fs.h linux-2.6.37-rc1.patch/include/linux/fs.h ---- linux-2.6.37-rc1/include/linux/fs.h 2010-11-01 12:54:12.000000000 +0100 -+++ linux-2.6.37-rc1.patch/include/linux/fs.h 2010-11-15 19:06:11.732172159 +0100 -@@ -34,9 +34,9 @@ - #define SEEK_MAX SEEK_END - - struct fstrim_range { -- uint64_t start; -- uint64_t len; -- uint64_t minlen; -+ __u64 start; -+ __u64 len; -+ __u64 minlen; - }; - - /* And dynamically-tunable limits and defaults: */ diff --git a/packages/linux/patches/linux-2.6.37-rc3-002_bash_only_feature.patch b/packages/linux/patches/linux-2.6.37-rc3-002_bash_only_feature.patch deleted file mode 100644 index a1028d15aa..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-002_bash_only_feature.patch +++ /dev/null @@ -1,15 +0,0 @@ -Index: linux-2.6.16/scripts/gen_initramfs_list.sh -=================================================================== ---- linux-2.6.16.orig/scripts/gen_initramfs_list.sh 2006-03-20 18:41:34.000000000 +0100 -+++ linux-2.6.16/scripts/gen_initramfs_list.sh 2006-03-20 18:42:40.000000000 +0100 -@@ -56,9 +56,7 @@ - - parse() { - local location="$1" -- local name="${location/${srcdir}//}" -- # change '//' into '/' -- name="${name//\/\///}" -+ local name="$(echo "$location" | sed -e 's%$srcdir%%' -e 's%//*%/%g')" - local mode="$2" - local uid="$3" - local gid="$4" diff --git a/packages/linux/patches/linux-2.6.37-rc3-003-no_dev_console.patch b/packages/linux/patches/linux-2.6.37-rc3-003-no_dev_console.patch deleted file mode 100644 index 9b5e51437d..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-003-no_dev_console.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -Naur linux-2.6.34-rc7/init/main.c linux-2.6.34-rc7.patch/init/main.c ---- linux-2.6.34-rc7/init/main.c 2010-05-10 03:36:28.000000000 +0200 -+++ linux-2.6.34-rc7.patch/init/main.c 2010-05-15 12:28:34.767241760 +0200 -@@ -886,8 +886,14 @@ - do_basic_setup(); - - /* Open the /dev/console on the rootfs, this should never fail */ -- if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) -- printk(KERN_WARNING "Warning: unable to open an initial console.\n"); -+ char *console = "/dev_console"; -+ -+ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) { -+ sys_mknod(console, S_IFCHR|0600, (TTYAUX_MAJOR<<8)|1); -+ if (sys_open(console, O_RDWR, 0) < 0) -+ printk(KERN_WARNING "Warning: unable to open an initial console.\n"); -+ sys_unlink(console); -+ } - - (void) sys_dup(0); - (void) sys_dup(0); diff --git a/packages/linux/patches/linux-2.6.37-rc3-004_lower_undefined_mode_timeout.patch b/packages/linux/patches/linux-2.6.37-rc3-004_lower_undefined_mode_timeout.patch deleted file mode 100644 index a0aca61d23..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-004_lower_undefined_mode_timeout.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naur linux-2.6.23-rc9.orig/arch/i386/boot/tty.c linux-2.6.23-rc9/arch/i386/boot/tty.c ---- linux-2.6.23-rc9.orig/arch/x86/boot/tty.c 2007-10-06 12:26:14.000000000 +0200 -+++ linux-2.6.23-rc9/arch/x86/boot/tty.c 2007-10-06 12:37:47.000000000 +0200 -@@ -92,7 +92,7 @@ - - int getchar_timeout(void) - { -- int cnt = 30; -+ int cnt = 3; - int t0, t1; - - t0 = gettime(); -diff -Naur linux-2.6.23-rc9.orig/arch/i386/boot/video.c linux-2.6.23-rc9/arch/i386/boot/video.c ---- linux-2.6.23-rc9.orig/arch/x86/boot/video.c 2007-10-06 12:26:14.000000000 +0200 -+++ linux-2.6.23-rc9/arch/x86/boot/video.c 2007-10-06 12:36:05.000000000 +0200 -@@ -329,7 +329,7 @@ - unsigned int sel; - - puts("Press to see video modes available, " -- " to continue, or wait 30 sec\n"); -+ " to continue, or wait 3 sec\n"); - - kbd_flush(); - while (1) { diff --git a/packages/linux/patches/linux-2.6.37-rc3-005_kconfig_no_timestamp.patch b/packages/linux/patches/linux-2.6.37-rc3-005_kconfig_no_timestamp.patch deleted file mode 100644 index 332e553831..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-005_kconfig_no_timestamp.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: linux-2.6.16/scripts/kconfig/confdata.c -=================================================================== ---- linux-2.6.16.orig/scripts/kconfig/confdata.c 2006-03-20 06:53:29.000000000 +0100 -+++ linux-2.6.16/scripts/kconfig/confdata.c 2006-03-20 18:47:06.000000000 +0100 -@@ -340,7 +340,7 @@ - int type, l; - const char *str; - time_t now; -- int use_timestamp = 1; -+ int use_timestamp = 0; - char *env; - - dirname[0] = 0; diff --git a/packages/linux/patches/linux-2.6.37-rc3-006_enable_utf8.patch b/packages/linux/patches/linux-2.6.37-rc3-006_enable_utf8.patch deleted file mode 100644 index bee1cf3da8..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-006_enable_utf8.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Naur linux-2.6.31-rc4.orig/fs/fat/inode.c linux-2.6.31-rc4/fs/fat/inode.c ---- linux-2.6.31-rc4.orig/fs/fat/inode.c 2009-07-25 12:47:41.000000000 +0200 -+++ linux-2.6.31-rc4/fs/fat/inode.c 2009-07-25 13:38:18.000000000 +0200 -@@ -979,7 +979,8 @@ - } - opts->name_check = 'n'; - opts->quiet = opts->showexec = opts->sys_immutable = opts->dotsOK = 0; -- opts->utf8 = opts->unicode_xlate = 0; -+ opts->utf8 = 1; -+ opts->unicode_xlate = 0; - opts->numtail = 1; - opts->usefree = opts->nocase = 0; - opts->tz_utc = 0; -diff -Naur linux-2.6.31-rc4.orig/fs/isofs/inode.c linux-2.6.31-rc4/fs/isofs/inode.c ---- linux-2.6.31-rc4.orig/fs/isofs/inode.c 2009-07-25 12:47:41.000000000 +0200 -+++ linux-2.6.31-rc4/fs/isofs/inode.c 2009-07-25 13:38:49.000000000 +0200 -@@ -377,7 +377,7 @@ - popt->gid = 0; - popt->uid = 0; - popt->iocharset = NULL; -- popt->utf8 = 0; -+ popt->utf8 = 1; - popt->overriderockperm = 0; - popt->session=-1; - popt->sbsector=-1; diff --git a/packages/linux/patches/linux-2.6.37-rc3-007_die_floppy_die.patch b/packages/linux/patches/linux-2.6.37-rc3-007_die_floppy_die.patch deleted file mode 100644 index 76db312182..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-007_die_floppy_die.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 4ff58b642f80dedb20533978123d89b5ac9b1ed5 Mon Sep 17 00:00:00 2001 -From: Kyle McMartin -Date: Tue, 30 Mar 2010 00:04:29 -0400 -Subject: die-floppy-die - -Kill the floppy.ko pnp modalias. We were surviving just fine without -autoloading floppy drivers, tyvm. - -Please feel free to register all complaints in the wastepaper bin. ---- - drivers/block/floppy.c | 3 +-- - 1 files changed, 1 insertions(+), 2 deletions(-) - -diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c -index 90c4038..f4a0b90 100644 ---- a/drivers/block/floppy.c -+++ b/drivers/block/floppy.c -@@ -4619,8 +4619,7 @@ static const struct pnp_device_id floppy_pnpids[] = { - {"PNP0700", 0}, - {} - }; -- --MODULE_DEVICE_TABLE(pnp, floppy_pnpids); -+/* MODULE_DEVICE_TABLE(pnp, floppy_pnpids); */ - - #else - --- -1.7.0.1 - diff --git a/packages/linux/patches/linux-2.6.37-rc3-008-hda_intel_prealloc_4mb_dmabuffer.patch b/packages/linux/patches/linux-2.6.37-rc3-008-hda_intel_prealloc_4mb_dmabuffer.patch deleted file mode 100644 index 36e6aca4fa..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-008-hda_intel_prealloc_4mb_dmabuffer.patch +++ /dev/null @@ -1,47 +0,0 @@ -From c69fcbd1f60b0842f7c1ad2c95692ffd19c4932b Mon Sep 17 00:00:00 2001 -From: Kyle McMartin -Date: Mon, 29 Mar 2010 23:56:08 -0400 -Subject: hda_intel-prealloc-4mb-dmabuffer - ---- - sound/pci/hda/hda_intel.c | 14 +++++++++++++- - 1 files changed, 13 insertions(+), 1 deletions(-) - -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 4bb9067..37db515 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -1986,6 +1986,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, - struct azx_pcm *apcm; - int pcm_dev = cpcm->device; - int s, err; -+ size_t prealloc_min = 64*1024; /* 64KB */ - - if (pcm_dev >= HDA_MAX_PCMS) { - snd_printk(KERN_ERR SFX "Invalid PCM device number %d\n", -@@ -2019,10 +2020,21 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, - if (cpcm->stream[s].substreams) - snd_pcm_set_ops(pcm, s, &azx_pcm_ops); - } -+ - /* buffer pre-allocation */ -+ -+ /* subtle, don't allocate a big buffer for modems... -+ * also, don't just test 32BIT_MASK, since azx supports -+ * 64-bit DMA in some cases. -+ */ -+ /* lennart wants a 2.2MB buffer for 2sec of 48khz */ -+ if (pcm->dev_class == SNDRV_PCM_CLASS_GENERIC && -+ chip->pci->dma_mask >= DMA_32BIT_MASK) -+ prealloc_min = 4 * 1024 * 1024; /* 4MB */ -+ - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), -- 1024 * 64, 32 * 1024 * 1024); -+ prealloc_min, 32 * 1024 * 1024); - return 0; - } - --- -1.7.0.1 - diff --git a/packages/linux/patches/linux-2.6.37-rc3-009_disable_i8042_check_on_apple_mac.patch b/packages/linux/patches/linux-2.6.37-rc3-009_disable_i8042_check_on_apple_mac.patch deleted file mode 100644 index f99d0f900c..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-009_disable_i8042_check_on_apple_mac.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 2a79554c864ac58fa2ad982f0fcee2cc2aa33eb5 Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Thu, 20 May 2010 10:30:31 -0400 -Subject: Disable i8042 checks on Intel Apple Macs - -As those computers never had any i8042 controllers, and the -current lookup code could potentially lock up/hang/wait for -timeout for long periods of time. - -Fixes intermittent hangs on boot on a MacbookAir1,1 - -Signed-off-by: Bastien Nocera ---- - drivers/input/serio/i8042.c | 22 ++++++++++++++++++++++ - 1 files changed, 22 insertions(+), 0 deletions(-) - -diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c -index 6440a8f..4d7cf98 100644 ---- a/drivers/input/serio/i8042.c -+++ b/drivers/input/serio/i8042.c -@@ -1451,6 +1451,22 @@ static struct platform_driver i8042_driver = { - .shutdown = i8042_shutdown, - }; - -+#ifdef CONFIG_DMI -+static struct dmi_system_id __initdata dmi_system_table[] = { -+ { -+ .matches = { -+ DMI_MATCH(DMI_BIOS_VENDOR, "Apple Computer, Inc.") -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_BIOS_VENDOR, "Apple Inc.") -+ }, -+ }, -+ {} -+}; -+#endif /*CONFIG_DMI*/ -+ - static int __init i8042_init(void) - { - struct platform_device *pdev; -@@ -1458,6 +1474,12 @@ static int __init i8042_init(void) - - dbg_init(); - -+#ifdef CONFIG_DMI -+ /* Intel Apple Macs never have an i8042 controller */ -+ if (dmi_check_system(dmi_system_table) > 0) -+ return -ENODEV; -+#endif /*CONFIG_DMI*/ -+ - err = i8042_platform_init(); - if (err) - return err; --- -1.7.0.1 - diff --git a/packages/linux/patches/linux-2.6.37-rc3-050_add_appleir_usb_driver.patch b/packages/linux/patches/linux-2.6.37-rc3-050_add_appleir_usb_driver.patch deleted file mode 100644 index 61edb8061e..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-050_add_appleir_usb_driver.patch +++ /dev/null @@ -1,702 +0,0 @@ -From e11e9e78799a7641fe0dc5289f35f2604a4b71a3 Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Sun, 17 Jan 2010 00:40:15 +0000 -Subject: [PATCH] Input: add appleir USB driver - -This driver was originally written by James McKenzie, updated by -Greg Kroah-Hartman, further updated by myself, with suspend support -added. - -More recent versions of the IR receiver are also supported through -a patch by Alex Karpenko. The patch also adds support for the 2nd -and 5th generation of the controller, and the menu key on newer -brushed metal remotes. - -Tested on a MacbookAir1,1 - -Signed-off-by: Bastien Nocera ---- - Documentation/input/appleir.txt | 46 ++++ - drivers/hid/hid-apple.c | 4 - - drivers/hid/hid-core.c | 7 +- - drivers/hid/hid-ids.h | 5 +- - drivers/input/misc/Kconfig | 13 + - drivers/input/misc/Makefile | 1 + - drivers/input/misc/appleir.c | 519 +++++++++++++++++++++++++++++++++++++++ - 7 files changed, 588 insertions(+), 7 deletions(-) - create mode 100644 Documentation/input/appleir.txt - create mode 100644 drivers/input/misc/appleir.c - -diff --git a/Documentation/input/appleir.txt b/Documentation/input/appleir.txt -new file mode 100644 -index 0000000..db637fb ---- /dev/null -+++ b/Documentation/input/appleir.txt -@@ -0,0 +1,46 @@ -+Apple IR receiver Driver (appleir) -+---------------------------------- -+ Copyright (C) 2009 Bastien Nocera -+ -+The appleir driver is a kernel input driver to handle Apple's IR -+receivers (and associated remotes) in the kernel. -+ -+The driver is an input driver which only handles "official" remotes -+as built and sold by Apple. -+ -+Authors -+------- -+ -+James McKenzie (original driver) -+Alex Karpenko (05ac:8242 support) -+Greg Kroah-Hartman (cleanups and original submission) -+Bastien Nocera (further cleanups, brushed metal "enter" -+button support and suspend support) -+ -+Supported hardware -+------------------ -+ -+- All Apple laptops and desktops from 2005 onwards, except: -+ - the unibody Macbook (2009) -+ - Mac Pro (all versions) -+- Apple TV (all revisions prior to September 2010) -+ -+The remote will only support the 6 (old white) or 7 (brushed metal) buttons -+of the remotes as sold by Apple. See the next section if you want to use -+other remotes or want to use lirc with the device instead of the kernel driver. -+ -+Using lirc (native) instead of the kernel driver -+------------------------------------------------ -+ -+First, you will need to disable the kernel driver for the receiver. -+ -+This can be achieved by passing quirks to the usbhid driver. -+The quirk line would be: -+usbhid.quirks=0x05ac:0x8242:0x40000010 -+ -+With 0x05ac being the vendor ID (Apple, you shouldn't need to change this) -+With 0x8242 being the product ID (check the output of lsusb for your hardware) -+And 0x10 being "HID_QUIRK_HIDDEV_FORCE" and 0x40000000 being "HID_QUIRK_NO_IGNORE" -+ -+This should force the creation of a hiddev device for the receiver, and -+make it usable under lirc. -diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c -index bba05d0..0059d5a 100644 ---- a/drivers/hid/hid-apple.c -+++ b/drivers/hid/hid-apple.c -@@ -361,10 +361,6 @@ static void apple_remove(struct hid_device *hdev) - } - - static const struct hid_device_id apple_devices[] = { -- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL), -- .driver_data = APPLE_HIDDEV | APPLE_IGNORE_HIDINPUT }, -- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4), -- .driver_data = APPLE_HIDDEV | APPLE_IGNORE_HIDINPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE), - .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL }, - -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index baa25ad..abc5bd7 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1244,8 +1244,6 @@ static const struct hid_device_id hid_blacklist[] = { - #if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE) - { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, - #endif -- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, -- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, -@@ -1577,6 +1575,11 @@ static const struct hid_device_id hid_ignore_list[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, - { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, - { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, - { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 11af537..360a5ca 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -100,8 +100,11 @@ - #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b - #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a - #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b --#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241 -+#define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240 -+#define USB_DEVICE_ID_APPLE_IRCONTROL2 0x1440 -+#define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241 - #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 -+#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 - - #define USB_VENDOR_ID_ASUS 0x0486 - #define USB_DEVICE_ID_ASUS_T91MT 0x0185 -diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig -index 60de906..2f2f2e7 100644 ---- a/drivers/input/misc/Kconfig -+++ b/drivers/input/misc/Kconfig -@@ -209,6 +209,19 @@ config INPUT_KEYSPAN_REMOTE - To compile this driver as a module, choose M here: the module will - be called keyspan_remote. - -+config INPUT_APPLEIR -+ tristate "Apple infrared receiver (built in)" -+ depends on USB_ARCH_HAS_HCD -+ select USB -+ help -+ Say Y here if you want to use a Apple infrared remote control. All -+ the Apple computers from 2005 onwards include such a port, except -+ the unibody Macbook (2009), and Mac Pros. This receiver is also -+ used in the Apple TV set-top box prior to the 2010 model. -+ -+ To compile this driver as a module, choose M here: the module will -+ be called appleir. -+ - config INPUT_POWERMATE - tristate "Griffin PowerMate and Contour Jog support" - depends on USB_ARCH_HAS_HCD -diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile -index 1fe1f6c..d5ef2b9 100644 ---- a/drivers/input/misc/Makefile -+++ b/drivers/input/misc/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_INPUT_ADXL34X) += adxl34x.o - obj-$(CONFIG_INPUT_ADXL34X_I2C) += adxl34x-i2c.o - obj-$(CONFIG_INPUT_ADXL34X_SPI) += adxl34x-spi.o - obj-$(CONFIG_INPUT_APANEL) += apanel.o -+obj-$(CONFIG_INPUT_APPLEIR) += appleir.o - obj-$(CONFIG_INPUT_ATI_REMOTE) += ati_remote.o - obj-$(CONFIG_INPUT_ATI_REMOTE2) += ati_remote2.o - obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o -diff --git a/drivers/input/misc/appleir.c b/drivers/input/misc/appleir.c -new file mode 100644 -index 0000000..3817a3c ---- /dev/null -+++ b/drivers/input/misc/appleir.c -@@ -0,0 +1,519 @@ -+/* -+ * appleir: USB driver for the apple ir device -+ * -+ * Original driver written by James McKenzie -+ * Ported to recent 2.6 kernel versions by Greg Kroah-Hartman -+ * -+ * Copyright (C) 2006 James McKenzie -+ * Copyright (C) 2008 Greg Kroah-Hartman -+ * Copyright (C) 2008 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the Free -+ * Software Foundation, version 2. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_VERSION "v1.2" -+#define DRIVER_AUTHOR "James McKenzie" -+#define DRIVER_DESC "Apple infrared receiver driver" -+#define DRIVER_LICENSE "GPL" -+ -+MODULE_AUTHOR(DRIVER_AUTHOR); -+MODULE_DESCRIPTION(DRIVER_DESC); -+MODULE_LICENSE(DRIVER_LICENSE); -+ -+#define USB_VENDOR_ID_APPLE 0x05ac -+#define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240 -+#define USB_DEVICE_ID_APPLE_IRCONTROL2 0x1440 -+#define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241 -+#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 -+#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 -+ -+#define URB_SIZE 32 -+ -+#define MAX_KEYS 9 -+#define MAX_KEYS_MASK (MAX_KEYS - 1) -+ -+#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) -+ -+static int debug; -+module_param(debug, int, 0644); -+MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); -+ -+/* I have two devices both of which report the following */ -+/* 25 87 ee 83 0a + */ -+/* 25 87 ee 83 0c - */ -+/* 25 87 ee 83 09 << */ -+/* 25 87 ee 83 06 >> */ -+/* 25 87 ee 83 05 >" */ -+/* 25 87 ee 83 03 menu */ -+/* 26 00 00 00 00 for key repeat*/ -+ -+/* Thomas Glanzmann reports the following responses */ -+/* 25 87 ee ca 0b + */ -+/* 25 87 ee ca 0d - */ -+/* 25 87 ee ca 08 << */ -+/* 25 87 ee ca 07 >> */ -+/* 25 87 ee ca 04 >" */ -+/* 25 87 ee ca 02 menu */ -+/* 26 00 00 00 00 for key repeat*/ -+/* He also observes the following event sometimes */ -+/* sent after a key is release, which I interpret */ -+/* as a flat battery message */ -+/* 25 87 e0 ca 06 flat battery */ -+ -+/* Alexandre Karpenko reports the following responses for Device ID 0x8242 */ -+/* 25 87 ee 47 0b + */ -+/* 25 87 ee 47 0d - */ -+/* 25 87 ee 47 08 << */ -+/* 25 87 ee 47 07 >> */ -+/* 25 87 ee 47 04 >" */ -+/* 25 87 ee 47 02 menu */ -+/* 26 87 ee 47 ** for key repeat (** is the code of the key being held) */ -+ -+/* Bastien Nocera's "new" remote */ -+/* 25 87 ee 91 5f followed by -+ * 25 87 ee 91 05 gives you >" -+ * -+ * 25 87 ee 91 5c followed by -+ * 25 87 ee 91 05 gives you the middle button */ -+ -+static const unsigned short appleir_key_table[] = { -+ KEY_RESERVED, -+ KEY_MENU, -+ KEY_PLAYPAUSE, -+ KEY_FORWARD, -+ KEY_BACK, -+ KEY_VOLUMEUP, -+ KEY_VOLUMEDOWN, -+ KEY_ENTER, -+ KEY_RESERVED, -+}; -+ -+struct appleir { -+ struct input_dev *input_dev; -+ unsigned short keymap[ARRAY_SIZE(appleir_key_table)]; -+ u8 *data; -+ dma_addr_t dma_buf; -+ struct usb_device *usbdev; -+ unsigned int flags; -+ struct urb *urb; -+ struct timer_list key_up_timer; -+ int current_key; -+ int prev_key_idx; -+ char phys[32]; -+}; -+ -+static DEFINE_MUTEX(appleir_mutex); -+ -+enum { -+ APPLEIR_OPENED = 0x1, -+ APPLEIR_SUSPENDED = 0x2, -+}; -+ -+static struct usb_device_id appleir_ids[] = { -+ { USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, -+ { USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, -+ { USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, -+ { USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, -+ { USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, -+ {} -+}; -+MODULE_DEVICE_TABLE(usb, appleir_ids); -+ -+static void dump_packet(struct appleir *appleir, char *msg, u8 *data, int len) -+{ -+ int i; -+ -+ printk(KERN_ERR "appleir: %s (%d bytes)", msg, len); -+ -+ for (i = 0; i < len; ++i) -+ printk(" %02x", data[i]); -+ printk(" (should be command %d)\n", (data[4] >> 1) & MAX_KEYS_MASK); -+} -+ -+static int get_key(int data) -+{ -+ switch (data) { -+ case 0x02: -+ case 0x03: -+ /* menu */ -+ return 1; -+ case 0x04: -+ case 0x05: -+ /* >" */ -+ return 2; -+ case 0x06: -+ case 0x07: -+ /* >> */ -+ return 3; -+ case 0x08: -+ case 0x09: -+ /* << */ -+ return 4; -+ case 0x0a: -+ case 0x0b: -+ /* + */ -+ return 5; -+ case 0x0c: -+ case 0x0d: -+ /* - */ -+ return 6; -+ case 0x5c: -+ /* Middle button, on newer remotes, -+ * part of a 2 packet-command */ -+ return -7; -+ default: -+ return -1; -+ } -+} -+ -+static void key_up(struct appleir *appleir, int key) -+{ -+ dbginfo(&appleir->input_dev->dev, "key %d up\n", key); -+ input_report_key(appleir->input_dev, key, 0); -+ input_sync(appleir->input_dev); -+} -+ -+static void key_down(struct appleir *appleir, int key) -+{ -+ dbginfo(&appleir->input_dev->dev, "key %d down\n", key); -+ input_report_key(appleir->input_dev, key, 1); -+ input_sync(appleir->input_dev); -+} -+ -+static void battery_flat(struct appleir *appleir) -+{ -+ dev_err(&appleir->input_dev->dev, "possible flat battery?\n"); -+} -+ -+static void key_up_tick(unsigned long data) -+{ -+ struct appleir *appleir = (struct appleir *)data; -+ -+ if (appleir->current_key) { -+ key_up(appleir, appleir->current_key); -+ appleir->current_key = 0; -+ } -+} -+ -+static void new_data(struct appleir *appleir, u8 *data, int len) -+{ -+ static const u8 keydown[] = { 0x25, 0x87, 0xee }; -+ static const u8 keyrepeat[] = { 0x26, }; -+ static const u8 flatbattery[] = { 0x25, 0x87, 0xe0 }; -+ -+ if (debug) -+ dump_packet(appleir, "received", data, len); -+ -+ if (len != 5) -+ return; -+ -+ if (!memcmp(data, keydown, sizeof(keydown))) { -+ int index; -+ -+ /* If we already have a key down, take it up before marking -+ this one down */ -+ if (appleir->current_key) -+ key_up(appleir, appleir->current_key); -+ -+ /* Handle dual packet commands */ -+ if (appleir->prev_key_idx > 0) -+ index = appleir->prev_key_idx; -+ else -+ index = get_key(data[4]); -+ -+ if (index > 0) { -+ appleir->current_key = appleir->keymap[index]; -+ -+ key_down(appleir, appleir->current_key); -+ /* Remote doesn't do key up, either pull them up, in the test -+ above, or here set a timer which pulls them up after 1/8 s */ -+ mod_timer(&appleir->key_up_timer, jiffies + HZ / 8); -+ appleir->prev_key_idx = 0; -+ return; -+ } else if (index == -7) { -+ /* Remember key for next packet */ -+ appleir->prev_key_idx = 0 - index; -+ return; -+ } -+ } -+ -+ appleir->prev_key_idx = 0; -+ -+ if (!memcmp(data, keyrepeat, sizeof(keyrepeat))) { -+ key_down(appleir, appleir->current_key); -+ /* Remote doesn't do key up, either pull them up, in the test -+ above, or here set a timer which pulls them up after 1/8 s */ -+ mod_timer(&appleir->key_up_timer, jiffies + HZ / 8); -+ return; -+ } -+ -+ if (!memcmp(data, flatbattery, sizeof(flatbattery))) { -+ battery_flat(appleir); -+ /* Fall through */ -+ } -+ -+ dump_packet(appleir, "unknown packet", data, len); -+} -+ -+static void appleir_urb(struct urb *urb) -+{ -+ struct appleir *appleir = urb->context; -+ int status = urb->status; -+ int retval; -+ -+ switch (status) { -+ case 0: -+ new_data(appleir, urb->transfer_buffer, urb->actual_length); -+ break; -+ case -ECONNRESET: -+ case -ENOENT: -+ case -ESHUTDOWN: -+ /* This urb is terminated, clean up */ -+ dbginfo(&appleir->input_dev->dev, "%s - urb shutting down with status: %d", __func__, -+ urb->status); -+ return; -+ default: -+ dbginfo(&appleir->input_dev->dev, "%s - nonzero urb status received: %d", __func__, -+ urb->status); -+ } -+ -+ retval = usb_submit_urb(urb, GFP_ATOMIC); -+ if (retval) -+ err("%s - usb_submit_urb failed with result %d", __func__, -+ retval); -+} -+ -+static int appleir_open(struct input_dev *dev) -+{ -+ struct appleir *appleir = input_get_drvdata(dev); -+ struct usb_interface *intf = usb_ifnum_to_if(appleir->usbdev, 0); -+ int r; -+ -+ r = usb_autopm_get_interface(intf); -+ if (r) { -+ dev_err(&intf->dev, -+ "%s(): usb_autopm_get_interface() = %d\n", __func__, r); -+ return r; -+ } -+ -+ mutex_lock(&appleir_mutex); -+ -+ if (usb_submit_urb(appleir->urb, GFP_ATOMIC)) { -+ r = -EIO; -+ goto fail; -+ } -+ -+ appleir->flags |= APPLEIR_OPENED; -+ -+ mutex_unlock(&appleir_mutex); -+ -+ usb_autopm_put_interface(intf); -+ -+ return 0; -+fail: -+ mutex_unlock(&appleir_mutex); -+ usb_autopm_put_interface(intf); -+ return r; -+} -+ -+static void appleir_close(struct input_dev *dev) -+{ -+ struct appleir *appleir = input_get_drvdata(dev); -+ -+ mutex_lock(&appleir_mutex); -+ -+ if (!(appleir->flags & APPLEIR_SUSPENDED)) { -+ usb_kill_urb(appleir->urb); -+ del_timer_sync(&appleir->key_up_timer); -+ } -+ -+ appleir->flags &= ~APPLEIR_OPENED; -+ -+ mutex_unlock(&appleir_mutex); -+} -+ -+static int appleir_probe(struct usb_interface *intf, -+ const struct usb_device_id *id) -+{ -+ struct usb_device *dev = interface_to_usbdev(intf); -+ struct usb_endpoint_descriptor *endpoint; -+ struct appleir *appleir = NULL; -+ struct input_dev *input_dev; -+ int retval = -ENOMEM; -+ int i; -+ -+ appleir = kzalloc(sizeof(struct appleir), GFP_KERNEL); -+ if (!appleir) -+ goto allocfail; -+ -+ appleir->data = usb_alloc_coherent(dev, URB_SIZE, GFP_KERNEL, -+ &appleir->dma_buf); -+ if (!appleir->data) -+ goto usbfail; -+ -+ appleir->urb = usb_alloc_urb(0, GFP_KERNEL); -+ if (!appleir->urb) -+ goto urbfail; -+ -+ appleir->usbdev = dev; -+ -+ input_dev = input_allocate_device(); -+ if (!input_dev) -+ goto inputfail; -+ -+ appleir->input_dev = input_dev; -+ -+ usb_make_path(dev, appleir->phys, sizeof(appleir->phys)); -+ strlcpy(appleir->phys, "/input0", sizeof(appleir->phys)); -+ -+ input_dev->name = "Apple Infrared Remote Controller"; -+ input_dev->phys = appleir->phys; -+ usb_to_input_id(dev, &input_dev->id); -+ input_dev->dev.parent = &intf->dev; -+ input_dev->keycode = appleir->keymap; -+ input_dev->keycodesize = sizeof(unsigned short); -+ input_dev->keycodemax = ARRAY_SIZE(appleir->keymap); -+ -+ input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); -+ -+ memcpy(appleir->keymap, appleir_key_table, sizeof(appleir->keymap)); -+ for (i = 0; i < ARRAY_SIZE(appleir_key_table); i++) -+ set_bit(appleir->keymap[i], input_dev->keybit); -+ clear_bit(KEY_RESERVED, input_dev->keybit); -+ -+ input_set_drvdata(input_dev, appleir); -+ input_dev->open = appleir_open; -+ input_dev->close = appleir_close; -+ -+ endpoint = &intf->cur_altsetting->endpoint[0].desc; -+ -+ usb_fill_int_urb(appleir->urb, dev, -+ usb_rcvintpipe(dev, endpoint->bEndpointAddress), -+ appleir->data, 8, -+ appleir_urb, appleir, endpoint->bInterval); -+ -+ appleir->urb->transfer_dma = appleir->dma_buf; -+ appleir->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; -+ -+ setup_timer(&appleir->key_up_timer, -+ key_up_tick, (unsigned long) appleir); -+ -+ retval = input_register_device(appleir->input_dev); -+ if (retval) -+ goto inputfail; -+ -+ usb_set_intfdata(intf, appleir); -+ -+ return 0; -+ -+inputfail: -+ input_free_device(appleir->input_dev); -+ -+urbfail: -+ usb_free_urb(appleir->urb); -+ -+usbfail: -+ usb_free_coherent(dev, URB_SIZE, appleir->data, -+ appleir->dma_buf); -+ -+allocfail: -+ kfree(appleir); -+ -+ return retval; -+} -+ -+static void appleir_disconnect(struct usb_interface *intf) -+{ -+ struct appleir *appleir = usb_get_intfdata(intf); -+ -+ usb_set_intfdata(intf, NULL); -+ input_unregister_device(appleir->input_dev); -+ usb_free_urb(appleir->urb); -+ usb_free_coherent(interface_to_usbdev(intf), URB_SIZE, -+ appleir->data, appleir->dma_buf); -+ kfree(appleir); -+} -+ -+static int appleir_suspend(struct usb_interface *interface, -+ pm_message_t message) -+{ -+ struct appleir *appleir = usb_get_intfdata(interface); -+ -+ mutex_lock(&appleir_mutex); -+ if (appleir->flags & APPLEIR_OPENED) -+ usb_kill_urb(appleir->urb); -+ -+ appleir->flags |= APPLEIR_SUSPENDED; -+ -+ mutex_unlock(&appleir_mutex); -+ -+ return 0; -+} -+ -+static int appleir_resume(struct usb_interface *interface) -+{ -+ struct appleir *appleir; -+ int r = 0; -+ -+ appleir = usb_get_intfdata(interface); -+ -+ mutex_lock(&appleir_mutex); -+ if (appleir->flags & APPLEIR_OPENED) { -+ struct usb_endpoint_descriptor *endpoint; -+ -+ endpoint = &interface->cur_altsetting->endpoint[0].desc; -+ usb_fill_int_urb(appleir->urb, appleir->usbdev, -+ usb_rcvintpipe(appleir->usbdev, endpoint->bEndpointAddress), -+ appleir->data, 8, -+ appleir_urb, appleir, endpoint->bInterval); -+ appleir->urb->transfer_dma = appleir->dma_buf; -+ appleir->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; -+ -+ /* And reset the USB device */ -+ if (usb_submit_urb(appleir->urb, GFP_ATOMIC)) -+ r = -EIO; -+ } -+ -+ appleir->flags &= ~APPLEIR_SUSPENDED; -+ -+ mutex_unlock(&appleir_mutex); -+ -+ return r; -+} -+ -+static struct usb_driver appleir_driver = { -+ .name = "appleir", -+ .probe = appleir_probe, -+ .disconnect = appleir_disconnect, -+ .suspend = appleir_suspend, -+ .resume = appleir_resume, -+ .reset_resume = appleir_resume, -+ .id_table = appleir_ids, -+}; -+ -+static int __init appleir_init(void) -+{ -+ return usb_register(&appleir_driver); -+} -+ -+static void __exit appleir_exit(void) -+{ -+ usb_deregister(&appleir_driver); -+} -+ -+module_init(appleir_init); -+module_exit(appleir_exit); --- -1.7.2.2 - diff --git a/packages/linux/patches/linux-2.6.37-rc3-052-aureal_remote_quirk-0.1.patch b/packages/linux/patches/linux-2.6.37-rc3-052-aureal_remote_quirk-0.1.patch deleted file mode 100644 index 2cf266aac9..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-052-aureal_remote_quirk-0.1.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff -Naur linux-2.6.36-rc6/drivers/hid/hid-aureal.c linux-2.6.36-rc6.patch/drivers/hid/hid-aureal.c ---- linux-2.6.36-rc6/drivers/hid/hid-aureal.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.36-rc6.patch/drivers/hid/hid-aureal.c 2010-10-05 02:28:50.925421529 +0200 -@@ -0,0 +1,60 @@ -+/* -+ * HID driver for some sunplus "special" devices -+ * -+ * Copyright (c) 1999 Andreas Gal -+ * Copyright (c) 2000-2005 Vojtech Pavlik -+ * Copyright (c) 2005 Michael Haboustak for Concept2, Inc -+ * Copyright (c) 2006-2007 Jiri Kosina -+ * Copyright (c) 2007 Paul Walmsley -+ * Copyright (c) 2008 Jiri Slaby -+ * Copyright (c) 2010 Franco Catrin -+ */ -+ -+/* -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the Free -+ * Software Foundation; either version 2 of the License, or (at your option) -+ * any later version. -+ */ -+ -+#include -+#include -+#include -+ -+#include "hid-ids.h" -+ -+static void aureal_report_fixup(struct hid_device *hdev, __u8 *rdesc, -+ unsigned int rsize) -+{ -+ if (rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) { -+ dev_info(&hdev->dev, "fixing Aureal Cy se W-01RN USB_V3.1 " -+ "report descriptor. Keyboard Logical Maximum = 101\n"); -+ rdesc[53] = 0x65; -+ } -+} -+ -+static const struct hid_device_id aureal_devices[] = { -+ { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, -+ { } -+}; -+MODULE_DEVICE_TABLE(hid, aureal_devices); -+ -+static struct hid_driver aureal_driver = { -+ .name = "aureal", -+ .id_table = aureal_devices, -+ .report_fixup = aureal_report_fixup, -+}; -+ -+static int __init aureal_init(void) -+{ -+ return hid_register_driver(&aureal_driver); -+} -+ -+static void __exit aureal_exit(void) -+{ -+ hid_unregister_driver(&aureal_driver); -+} -+ -+module_init(aureal_init); -+module_exit(aureal_exit); -+MODULE_LICENSE("GPL"); -diff -Naur linux-2.6.36-rc6/drivers/hid/hid-ids.h linux-2.6.36-rc6.patch/drivers/hid/hid-ids.h ---- linux-2.6.36-rc6/drivers/hid/hid-ids.h 2010-09-29 03:01:22.000000000 +0200 -+++ linux-2.6.36-rc6.patch/drivers/hid/hid-ids.h 2010-10-05 02:30:00.651266940 +0200 -@@ -6,6 +6,7 @@ - * Copyright (c) 2005 Michael Haboustak for Concept2, Inc - * Copyright (c) 2006-2007 Jiri Kosina - * Copyright (c) 2007 Paul Walmsley -+ * Copyright (c) 2010 Franco Catrin - */ - - /* -@@ -316,6 +317,9 @@ - #define USB_DEVICE_ID_KYE_ERGO_525V 0x0087 - #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 - -+#define USB_VENDOR_ID_AUREAL 0x0755 -+#define USB_DEVICE_ID_AUREAL_W01RN 0x2626 -+ - #define USB_VENDOR_ID_LABTEC 0x1020 - #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 - -diff -Naur linux-2.6.36-rc6/drivers/hid/Kconfig linux-2.6.36-rc6.patch/drivers/hid/Kconfig ---- linux-2.6.36-rc6/drivers/hid/Kconfig 2010-09-29 03:01:22.000000000 +0200 -+++ linux-2.6.36-rc6.patch/drivers/hid/Kconfig 2010-10-05 02:28:50.936421663 +0200 -@@ -87,6 +87,13 @@ - Say Y here if you want support for keyboards of Apple iBooks, PowerBooks, - MacBooks, MacBook Pros and Apple Aluminum. - -+config HID_AUREAL -+ tristate "Aureal" if EMBEDDED -+ depends on USB_HID -+ default !EMBEDDED -+ ---help--- -+ Support for Aureal Cy se W-01RN Remote Controller -+ - config HID_BELKIN - tristate "Belkin" if EMBEDDED - depends on USB_HID -diff -Naur linux-2.6.36-rc6/drivers/hid/Makefile linux-2.6.36-rc6.patch/drivers/hid/Makefile ---- linux-2.6.36-rc6/drivers/hid/Makefile 2010-09-29 03:01:22.000000000 +0200 -+++ linux-2.6.36-rc6.patch/drivers/hid/Makefile 2010-10-05 02:28:50.938421687 +0200 -@@ -26,6 +26,7 @@ - obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o - obj-$(CONFIG_HID_ACRUX_FF) += hid-axff.o - obj-$(CONFIG_HID_APPLE) += hid-apple.o -+obj-$(CONFIG_HID_AUREAL) += hid-aureal.o - obj-$(CONFIG_HID_BELKIN) += hid-belkin.o - obj-$(CONFIG_HID_CANDO) += hid-cando.o - obj-$(CONFIG_HID_CHERRY) += hid-cherry.o diff --git a/packages/linux/patches/linux-2.6.37-rc3-120_RFC-RFT-v3-sched-automated-per-tty-task-groups.patch b/packages/linux/patches/linux-2.6.37-rc3-120_RFC-RFT-v3-sched-automated-per-tty-task-groups.patch deleted file mode 100644 index 25f948c4b8..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc3-120_RFC-RFT-v3-sched-automated-per-tty-task-groups.patch +++ /dev/null @@ -1,359 +0,0 @@ -Index: linux-2.6/include/linux/sched.h -=================================================================== ---- linux-2.6.orig/include/linux/sched.h -+++ linux-2.6/include/linux/sched.h -@@ -509,6 +509,8 @@ struct thread_group_cputimer { - spinlock_t lock; - }; - -+struct autogroup; -+ - /* - * NOTE! "signal_struct" does not have it's own - * locking, because a shared signal_struct always -@@ -576,6 +578,9 @@ struct signal_struct { - - struct tty_struct *tty; /* NULL if no tty */ - -+#ifdef CONFIG_SCHED_AUTOGROUP -+ struct autogroup *autogroup; -+#endif - /* - * Cumulative resource counters for dead threads in the group, - * and for reaped dead child processes forked by this group. -@@ -1931,6 +1936,20 @@ int sched_rt_handler(struct ctl_table *t - - extern unsigned int sysctl_sched_compat_yield; - -+#ifdef CONFIG_SCHED_AUTOGROUP -+extern unsigned int sysctl_sched_autogroup_enabled; -+ -+extern void sched_autogroup_create_attach(struct task_struct *p); -+extern void sched_autogroup_detach(struct task_struct *p); -+extern void sched_autogroup_fork(struct signal_struct *sig); -+extern void sched_autogroup_exit(struct signal_struct *sig); -+#else -+static inline void sched_autogroup_create_attach(struct task_struct *p) { } -+static inline void sched_autogroup_detach(struct task_struct *p) { } -+static inline void sched_autogroup_fork(struct signal_struct *sig) { } -+static inline void sched_autogroup_exit(struct signal_struct *sig) { } -+#endif -+ - #ifdef CONFIG_RT_MUTEXES - extern int rt_mutex_getprio(struct task_struct *p); - extern void rt_mutex_setprio(struct task_struct *p, int prio); -Index: linux-2.6/kernel/sched.c -=================================================================== ---- linux-2.6.orig/kernel/sched.c -+++ linux-2.6/kernel/sched.c -@@ -78,6 +78,7 @@ - - #include "sched_cpupri.h" - #include "workqueue_sched.h" -+#include "sched_autogroup.h" - - #define CREATE_TRACE_POINTS - #include -@@ -605,11 +606,14 @@ static inline int cpu_of(struct rq *rq) - */ - static inline struct task_group *task_group(struct task_struct *p) - { -+ struct task_group *tg; - struct cgroup_subsys_state *css; - - css = task_subsys_state_check(p, cpu_cgroup_subsys_id, - lockdep_is_held(&task_rq(p)->lock)); -- return container_of(css, struct task_group, css); -+ tg = container_of(css, struct task_group, css); -+ -+ return autogroup_task_group(p, tg); - } - - /* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */ -@@ -2006,6 +2010,7 @@ static void sched_irq_time_avg_update(st - #include "sched_idletask.c" - #include "sched_fair.c" - #include "sched_rt.c" -+#include "sched_autogroup.c" - #include "sched_stoptask.c" - #ifdef CONFIG_SCHED_DEBUG - # include "sched_debug.c" -@@ -7979,7 +7984,7 @@ void __init sched_init(void) - #ifdef CONFIG_CGROUP_SCHED - list_add(&init_task_group.list, &task_groups); - INIT_LIST_HEAD(&init_task_group.children); -- -+ autogroup_init(&init_task); - #endif /* CONFIG_CGROUP_SCHED */ - - #if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP -Index: linux-2.6/kernel/fork.c -=================================================================== ---- linux-2.6.orig/kernel/fork.c -+++ linux-2.6/kernel/fork.c -@@ -174,8 +174,10 @@ static inline void free_signal_struct(st - - static inline void put_signal_struct(struct signal_struct *sig) - { -- if (atomic_dec_and_test(&sig->sigcnt)) -+ if (atomic_dec_and_test(&sig->sigcnt)) { -+ sched_autogroup_exit(sig); - free_signal_struct(sig); -+ } - } - - void __put_task_struct(struct task_struct *tsk) -@@ -904,6 +906,7 @@ static int copy_signal(unsigned long clo - posix_cpu_timers_init_group(sig); - - tty_audit_fork(sig); -+ sched_autogroup_fork(sig); - - sig->oom_adj = current->signal->oom_adj; - sig->oom_score_adj = current->signal->oom_score_adj; -Index: linux-2.6/drivers/tty/tty_io.c -=================================================================== ---- linux-2.6.orig/drivers/tty/tty_io.c -+++ linux-2.6/drivers/tty/tty_io.c -@@ -3160,6 +3160,7 @@ static void __proc_set_tty(struct task_s - put_pid(tsk->signal->tty_old_pgrp); - tsk->signal->tty = tty_kref_get(tty); - tsk->signal->tty_old_pgrp = NULL; -+ sched_autogroup_create_attach(tsk); - } - - static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty) -Index: linux-2.6/kernel/sched_autogroup.h -=================================================================== ---- /dev/null -+++ linux-2.6/kernel/sched_autogroup.h -@@ -0,0 +1,16 @@ -+#ifdef CONFIG_SCHED_AUTOGROUP -+ -+static inline struct task_group * -+autogroup_task_group(struct task_struct *p, struct task_group *tg); -+ -+#else /* !CONFIG_SCHED_AUTOGROUP */ -+ -+static inline void autogroup_init(struct task_struct *init_task) { } -+ -+static inline struct task_group * -+autogroup_task_group(struct task_struct *p, struct task_group *tg) -+{ -+ return tg; -+} -+ -+#endif /* CONFIG_SCHED_AUTOGROUP */ -Index: linux-2.6/kernel/sched_autogroup.c -=================================================================== ---- /dev/null -+++ linux-2.6/kernel/sched_autogroup.c -@@ -0,0 +1,150 @@ -+#ifdef CONFIG_SCHED_AUTOGROUP -+ -+unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1; -+ -+struct autogroup { -+ struct kref kref; -+ struct task_group *tg; -+}; -+ -+static struct autogroup autogroup_default; -+ -+static void autogroup_init(struct task_struct *init_task) -+{ -+ autogroup_default.tg = &init_task_group; -+ kref_init(&autogroup_default.kref); -+ init_task->signal->autogroup = &autogroup_default; -+} -+ -+static inline void autogroup_destroy(struct kref *kref) -+{ -+ struct autogroup *ag = container_of(kref, struct autogroup, kref); -+ struct task_group *tg = ag->tg; -+ -+ kfree(ag); -+ sched_destroy_group(tg); -+} -+ -+static inline void autogroup_kref_put(struct autogroup *ag) -+{ -+ kref_put(&ag->kref, autogroup_destroy); -+} -+ -+static inline struct autogroup *autogroup_kref_get(struct autogroup *ag) -+{ -+ kref_get(&ag->kref); -+ return ag; -+} -+ -+static inline struct autogroup *autogroup_create(void) -+{ -+ struct autogroup *ag = kmalloc(sizeof(*ag), GFP_KERNEL); -+ -+ if (!ag) -+ goto out_fail; -+ -+ ag->tg = sched_create_group(&init_task_group); -+ kref_init(&ag->kref); -+ -+ if (!(IS_ERR(ag->tg))) -+ return ag; -+ -+out_fail: -+ if (ag) { -+ kfree(ag); -+ WARN_ON(1); -+ } else -+ WARN_ON(1); -+ -+ return autogroup_kref_get(&autogroup_default); -+} -+ -+static inline bool -+task_wants_autogroup(struct task_struct *p, struct task_group *tg) -+{ -+ if (tg != &root_task_group) -+ return false; -+ -+ if (p->sched_class != &fair_sched_class) -+ return false; -+ -+ if (p->flags & PF_EXITING) -+ return false; -+ -+ return true; -+} -+ -+static inline struct task_group * -+autogroup_task_group(struct task_struct *p, struct task_group *tg) -+{ -+ int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled); -+ -+ if (enabled && task_wants_autogroup(p, tg)) -+ return p->signal->autogroup->tg; -+ -+ return tg; -+} -+ -+static void -+autogroup_move_group(struct task_struct *p, struct autogroup *ag) -+{ -+ struct autogroup *prev; -+ struct task_struct *t; -+ -+ prev = p->signal->autogroup; -+ if (prev == ag) -+ return; -+ -+ p->signal->autogroup = autogroup_kref_get(ag); -+ sched_move_task(p); -+ -+ rcu_read_lock(); -+ list_for_each_entry_rcu(t, &p->thread_group, thread_group) { -+ sched_move_task(t); -+ } -+ rcu_read_unlock(); -+ -+ autogroup_kref_put(prev); -+} -+ -+/* Must be called with siglock held */ -+void sched_autogroup_create_attach(struct task_struct *p) -+{ -+ struct autogroup *ag = autogroup_create(); -+ -+ autogroup_move_group(p, ag); -+ /* drop extra refrence added by autogroup_create() */ -+ autogroup_kref_put(ag); -+} -+EXPORT_SYMBOL(sched_autogroup_create_attach); -+ -+/* Must be called with siglock held. Currently has no users */ -+void sched_autogroup_detach(struct task_struct *p) -+{ -+ autogroup_move_group(p, &autogroup_default); -+} -+EXPORT_SYMBOL(sched_autogroup_detach); -+ -+void sched_autogroup_fork(struct signal_struct *sig) -+{ -+ struct sighand_struct *sighand = current->sighand; -+ -+ spin_lock(&sighand->siglock); -+ sig->autogroup = autogroup_kref_get(current->signal->autogroup); -+ spin_unlock(&sighand->siglock); -+} -+ -+void sched_autogroup_exit(struct signal_struct *sig) -+{ -+ autogroup_kref_put(sig->autogroup); -+} -+ -+static int __init setup_autogroup(char *str) -+{ -+ sysctl_sched_autogroup_enabled = 0; -+ -+ return 1; -+} -+ -+__setup("noautogroup", setup_autogroup); -+#endif -Index: linux-2.6/kernel/sysctl.c -=================================================================== ---- linux-2.6.orig/kernel/sysctl.c -+++ linux-2.6/kernel/sysctl.c -@@ -382,6 +382,17 @@ static struct ctl_table kern_table[] = { - .mode = 0644, - .proc_handler = proc_dointvec, - }, -+#ifdef CONFIG_SCHED_AUTOGROUP -+ { -+ .procname = "sched_autogroup_enabled", -+ .data = &sysctl_sched_autogroup_enabled, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ .extra1 = &zero, -+ .extra2 = &one, -+ }, -+#endif - #ifdef CONFIG_PROVE_LOCKING - { - .procname = "prove_locking", -Index: linux-2.6/init/Kconfig -=================================================================== ---- linux-2.6.orig/init/Kconfig -+++ linux-2.6/init/Kconfig -@@ -728,6 +728,18 @@ config NET_NS - - endif # NAMESPACES - -+config SCHED_AUTOGROUP -+ bool "Automatic process group scheduling" -+ select CGROUPS -+ select CGROUP_SCHED -+ select FAIR_GROUP_SCHED -+ help -+ This option optimizes the scheduler for common desktop workloads by -+ automatically creating and populating task groups. This separation -+ of workloads isolates aggressive CPU burners (like build jobs) from -+ desktop applications. Task group autogeneration is currently based -+ upon task tty association. -+ - config MM_OWNER - bool - -Index: linux-2.6/Documentation/kernel-parameters.txt -=================================================================== ---- linux-2.6.orig/Documentation/kernel-parameters.txt -+++ linux-2.6/Documentation/kernel-parameters.txt -@@ -1622,6 +1622,8 @@ and is between 256 and 4096 characters. - noapic [SMP,APIC] Tells the kernel to not make use of any - IOAPICs that may be present in the system. - -+ noautogroup Disable scheduler automatic task group creation. -+ - nobats [PPC] Do not use BATs for mapping kernel lowmem - on "Classic" PPC cores. - diff --git a/packages/linux/patches/linux-2.6.36.2-000_crosscompile.patch b/packages/linux/patches/linux-2.6.37-rc5-000_crosscompile.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-000_crosscompile.patch rename to packages/linux/patches/linux-2.6.37-rc5-000_crosscompile.patch diff --git a/packages/linux/patches/linux-2.6.36.2-002_bash_only_feature.patch b/packages/linux/patches/linux-2.6.37-rc5-002_bash_only_feature.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-002_bash_only_feature.patch rename to packages/linux/patches/linux-2.6.37-rc5-002_bash_only_feature.patch diff --git a/packages/linux/patches/linux-2.6.36.2-003-no_dev_console.patch b/packages/linux/patches/linux-2.6.37-rc5-003-no_dev_console.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-003-no_dev_console.patch rename to packages/linux/patches/linux-2.6.37-rc5-003-no_dev_console.patch diff --git a/packages/linux/patches/linux-2.6.36.2-004_lower_undefined_mode_timeout.patch b/packages/linux/patches/linux-2.6.37-rc5-004_lower_undefined_mode_timeout.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-004_lower_undefined_mode_timeout.patch rename to packages/linux/patches/linux-2.6.37-rc5-004_lower_undefined_mode_timeout.patch diff --git a/packages/linux/patches/linux-2.6.36.2-005_kconfig_no_timestamp.patch b/packages/linux/patches/linux-2.6.37-rc5-005_kconfig_no_timestamp.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-005_kconfig_no_timestamp.patch rename to packages/linux/patches/linux-2.6.37-rc5-005_kconfig_no_timestamp.patch diff --git a/packages/linux/patches/linux-2.6.36.2-006_enable_utf8.patch b/packages/linux/patches/linux-2.6.37-rc5-006_enable_utf8.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-006_enable_utf8.patch rename to packages/linux/patches/linux-2.6.37-rc5-006_enable_utf8.patch diff --git a/packages/linux/patches/linux-2.6.36.2-007_die_floppy_die.patch b/packages/linux/patches/linux-2.6.37-rc5-007_die_floppy_die.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-007_die_floppy_die.patch rename to packages/linux/patches/linux-2.6.37-rc5-007_die_floppy_die.patch diff --git a/packages/linux/patches/linux-2.6.36.2-008-hda_intel_prealloc_4mb_dmabuffer.patch b/packages/linux/patches/linux-2.6.37-rc5-008-hda_intel_prealloc_4mb_dmabuffer.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-008-hda_intel_prealloc_4mb_dmabuffer.patch rename to packages/linux/patches/linux-2.6.37-rc5-008-hda_intel_prealloc_4mb_dmabuffer.patch diff --git a/packages/linux/patches/linux-2.6.36.2-009_disable_i8042_check_on_apple_mac.patch b/packages/linux/patches/linux-2.6.37-rc5-009_disable_i8042_check_on_apple_mac.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-009_disable_i8042_check_on_apple_mac.patch rename to packages/linux/patches/linux-2.6.37-rc5-009_disable_i8042_check_on_apple_mac.patch diff --git a/packages/linux/patches/linux-2.6.36.2-050_add_appleir_usb_driver.patch b/packages/linux/patches/linux-2.6.37-rc5-050_add_appleir_usb_driver.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-050_add_appleir_usb_driver.patch rename to packages/linux/patches/linux-2.6.37-rc5-050_add_appleir_usb_driver.patch diff --git a/packages/linux/patches/linux-2.6.36.2-052-aureal_remote_quirk-0.1.patch b/packages/linux/patches/linux-2.6.37-rc5-052-aureal_remote_quirk-0.1.patch similarity index 100% rename from packages/linux/patches/linux-2.6.36.2-052-aureal_remote_quirk-0.1.patch rename to packages/linux/patches/linux-2.6.37-rc5-052-aureal_remote_quirk-0.1.patch diff --git a/packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101205.patch b/packages/linux/patches/linux-2.6.37-rc5-110-drm_nouveau_upstream-20101205.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc3-110-drm_nouveau_upstream-20101205.patch rename to packages/linux/patches/linux-2.6.37-rc5-110-drm_nouveau_upstream-20101205.patch