rpms/kernel/devel config-generic, 1.316, 1.317 kernel.spec, 1.1721, 1.1722 linux-2.6.31-lirc.patch, 1.4, 1.5

Jarod Wilson jwilson at fedoraproject.org
Mon Aug 17 18:33:39 UTC 2009


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15550

Modified Files:
	config-generic kernel.spec linux-2.6.31-lirc.patch 
Log Message:
* Mon Aug 17 2009 Jarod Wilson <jarod at redhat.com>
- Add new lirc driver for built-in ENE0100 device on some laptops



Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-generic,v
retrieving revision 1.316
retrieving revision 1.317
diff -u -p -r1.316 -r1.317
--- config-generic	11 Aug 2009 21:55:35 -0000	1.316
+++ config-generic	17 Aug 2009 18:33:39 -0000	1.317
@@ -3787,6 +3787,7 @@ CONFIG_DEFAULT_RELATIME=y
 CONFIG_INPUT_LIRC=y
 CONFIG_LIRC_DEV=m
 CONFIG_LIRC_BT829=m
+CONFIG_LIRC_ENE0100=m
 CONFIG_LIRC_I2C=m
 CONFIG_LIRC_IGORPLUGUSB=m
 CONFIG_LIRC_IMON=m


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1721
retrieving revision 1.1722
diff -u -p -r1.1721 -r1.1722
--- kernel.spec	16 Aug 2009 22:09:02 -0000	1.1721
+++ kernel.spec	17 Aug 2009 18:33:39 -0000	1.1722
@@ -1969,6 +1969,9 @@ fi
 # and build.
 
 %changelog
+* Mon Aug 17 2009 Jarod Wilson <jarod at redhat.com>
+- Add new lirc driver for built-in ENE0100 device on some laptops
+
 * Sun Aug 16 2009 Kyle McMartin <kyle at redhat.com> 2.6.31-0.158.rc6
 - Improve the perf script so it prints something helpful if the
   perf binary doesn't exist.

linux-2.6.31-lirc.patch:
 MAINTAINERS                           |    9 
 drivers/input/Kconfig                 |    2 
 drivers/input/Makefile                |    2 
 drivers/input/lirc/Kconfig            |  119 +
 drivers/input/lirc/Makefile           |   21 
 drivers/input/lirc/lirc.h             |  100 +
 drivers/input/lirc/lirc_bt829.c       |  383 +++++
 drivers/input/lirc/lirc_dev.c         |  852 ++++++++++++
 drivers/input/lirc/lirc_dev.h         |  184 ++
 drivers/input/lirc/lirc_ene0100.c     |  450 ++++++
 drivers/input/lirc/lirc_ene0100.h     |  100 +
 drivers/input/lirc/lirc_i2c.c         |  537 +++++++
 drivers/input/lirc/lirc_igorplugusb.c |  556 ++++++++
 drivers/input/lirc/lirc_imon.c        | 2297 ++++++++++++++++++++++++++++++++++
 drivers/input/lirc/lirc_it87.c        |  986 ++++++++++++++
 drivers/input/lirc/lirc_it87.h        |  116 +
 drivers/input/lirc/lirc_ite8709.c     |  539 +++++++
 drivers/input/lirc/lirc_mceusb.c      | 1225 ++++++++++++++++++
 drivers/input/lirc/lirc_parallel.c    |  709 ++++++++++
 drivers/input/lirc/lirc_parallel.h    |   26 
 drivers/input/lirc/lirc_sasem.c       |  931 +++++++++++++
 drivers/input/lirc/lirc_serial.c      | 1316 +++++++++++++++++++
 drivers/input/lirc/lirc_sir.c         | 1283 ++++++++++++++++++
 drivers/input/lirc/lirc_streamzap.c   |  777 +++++++++++
 drivers/input/lirc/lirc_ttusbir.c     |  397 +++++
 drivers/input/lirc/lirc_zilog.c       | 1374 ++++++++++++++++++++
 26 files changed, 15291 insertions(+)

Index: linux-2.6.31-lirc.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6.31-lirc.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- linux-2.6.31-lirc.patch	10 Aug 2009 20:30:10 -0000	1.4
+++ linux-2.6.31-lirc.patch	17 Aug 2009 18:33:39 -0000	1.5
@@ -1,6 +1,6 @@
 Linux Infrared Remote Control drivers -- http://www.lirc.org
 
-Last updated: Monday, August 10, 2009
+Last updated: Monday, August 17, 2009
 
 From http://git.wilsonet.com/linux-2.6-lirc.git/
 
@@ -10,15 +10,17 @@ Signed-off-by: Jarod Wilson <jarod at redha
  MAINTAINERS                           |    9 +
  drivers/input/Kconfig                 |    2 +
  drivers/input/Makefile                |    2 +
- drivers/input/lirc/Kconfig            |  112 ++
- drivers/input/lirc/Makefile           |   20 +
+ drivers/input/lirc/Kconfig            |  119 ++
+ drivers/input/lirc/Makefile           |   21 +
  drivers/input/lirc/lirc.h             |  100 ++
  drivers/input/lirc/lirc_bt829.c       |  383 ++++++
- drivers/input/lirc/lirc_dev.c         |  851 ++++++++++++
+ drivers/input/lirc/lirc_dev.c         |  852 ++++++++++++
  drivers/input/lirc/lirc_dev.h         |  184 +++
+ drivers/input/lirc/lirc_ene0100.c     |  450 +++++++
+ drivers/input/lirc/lirc_ene0100.h     |  100 ++
  drivers/input/lirc/lirc_i2c.c         |  537 ++++++++
  drivers/input/lirc/lirc_igorplugusb.c |  556 ++++++++
- drivers/input/lirc/lirc_imon.c        | 2298 +++++++++++++++++++++++++++++++++
+ drivers/input/lirc/lirc_imon.c        | 2297 +++++++++++++++++++++++++++++++++
  drivers/input/lirc/lirc_it87.c        |  986 ++++++++++++++
  drivers/input/lirc/lirc_it87.h        |  116 ++
  drivers/input/lirc/lirc_ite8709.c     |  539 ++++++++
@@ -31,13 +33,13 @@ Signed-off-by: Jarod Wilson <jarod at redha
  drivers/input/lirc/lirc_streamzap.c   |  777 +++++++++++
  drivers/input/lirc/lirc_ttusbir.c     |  397 ++++++
  drivers/input/lirc/lirc_zilog.c       | 1374 ++++++++++++++++++++
- 24 files changed, 14733 insertions(+), 0 deletions(-)
+ 26 files changed, 15291 insertions(+), 0 deletions(-)
 
 diff --git a/MAINTAINERS b/MAINTAINERS
-index b1114cf..eb86f8e 100644
+index 2c4326c..15d1ac5 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
-@@ -3122,6 +3122,15 @@ W:	http://www.pasemi.com/
+@@ -3130,6 +3130,15 @@ W:	http://www.pasemi.com/
  L:	linuxppc-dev at ozlabs.org
  S:	Supported
  
@@ -78,10 +80,10 @@ index 4c9c745..99e2b5e 100644
 +obj-$(CONFIG_INPUT_LIRC)       += lirc/
 diff --git a/drivers/input/lirc/Kconfig b/drivers/input/lirc/Kconfig
 new file mode 100644
-index 0000000..6ef8622
+index 0000000..ab13cfe
 --- /dev/null
 +++ b/drivers/input/lirc/Kconfig
-@@ -0,0 +1,112 @@
+@@ -0,0 +1,119 @@
 +#
 +# LIRC driver(s) configuration
 +#
@@ -106,6 +108,14 @@ index 0000000..6ef8622
 +	help
 +	  Driver for the IR interface on BT829-based hardware
 +
++config LIRC_ENE0100
++	tristate "ENE KB3924/ENE0100 CIR Port Reciever"
++	depends on LIRC_DEV
++	help
++	  This is a driver for CIR port handled by ENE KB3924 embedded
++	  controller found on some notebooks.
++	  It appears on PNP list as ENE0100.
++
 +config LIRC_I2C
 +	tristate "I2C Based IR Receivers"
 +	depends on LIRC_DEV
@@ -192,14 +202,13 @@ index 0000000..6ef8622
 +	help
 +	  Driver for the Zilog/Hauppauge IR Transmitter, found on
 +	  PVR-150/500, HVR-1200/1250/1700/1800, HD-PVR and other cards
-+
 +endif
 diff --git a/drivers/input/lirc/Makefile b/drivers/input/lirc/Makefile
 new file mode 100644
-index 0000000..7b1386e
+index 0000000..8da7aa9
 --- /dev/null
 +++ b/drivers/input/lirc/Makefile
-@@ -0,0 +1,20 @@
+@@ -0,0 +1,21 @@
 +# Makefile for the lirc drivers.
 +#
 +
@@ -207,6 +216,7 @@ index 0000000..7b1386e
 +
 +obj-$(CONFIG_LIRC_DEV)		+= lirc_dev.o
 +obj-$(CONFIG_LIRC_BT829)	+= lirc_bt829.o
++obj-$(CONFIG_LIRC_ENE0100)	+= lirc_ene0100.o
 +obj-$(CONFIG_LIRC_I2C)		+= lirc_i2c.o
 +obj-$(CONFIG_LIRC_IGORPLUGUSB)	+= lirc_igorplugusb.o
 +obj-$(CONFIG_LIRC_IMON)		+= lirc_imon.o
@@ -717,10 +727,10 @@ index 0000000..0485884
 +MODULE_PARM_DESC(debug, "Debug enabled or not");
 diff --git a/drivers/input/lirc/lirc_dev.c b/drivers/input/lirc/lirc_dev.c
 new file mode 100644
-index 0000000..0510b4e
+index 0000000..fa0d169
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_dev.c
-@@ -0,0 +1,851 @@
+@@ -0,0 +1,852 @@
 +/*
 + * LIRC base driver
 + *
@@ -1019,6 +1029,7 @@ index 0000000..0510b4e
 +	}
 +	init_irctl(ir);
 +	irctls[minor] = ir;
++	d->minor = minor;
 +
 +	if (d->sample_rate) {
 +		ir->jiffies_to_wait = HZ / d->sample_rate;
@@ -1100,8 +1111,8 @@ index 0000000..0510b4e
 +
 +	if (minor < 0 || minor >= MAX_IRCTL_DEVICES) {
 +		printk(KERN_ERR "lirc_dev: lirc_unregister_driver: "
-+		       "\"minor\" must be between 0 and %d!\n",
-+		       MAX_IRCTL_DEVICES-1);
++		       "\"minor (%d)\" must be between 0 and %d!\n",
++		       minor, MAX_IRCTL_DEVICES-1);
 +		return -EBADRQC;
 +	}
 +
@@ -1762,6 +1773,568 @@ index 0000000..8eeffa2
 +			       unsigned long arg);
 +
 +#endif
+diff --git a/drivers/input/lirc/lirc_ene0100.c b/drivers/input/lirc/lirc_ene0100.c
+new file mode 100644
+index 0000000..e6f1617
+--- /dev/null
++++ b/drivers/input/lirc/lirc_ene0100.c
+@@ -0,0 +1,450 @@
++/*
++ * driver for ENE KB3924 CIR (also known as ENE0100)
++ *
++ * Copyright (C) 2009 Maxim Levitsky <maximlevitsky at gmail.com>
++ *
++ * 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 <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/pnp.h>
++#include <linux/io.h>
++#include <linux/interrupt.h>
++#include "lirc_ene0100.h"
++
++
++static int sample_period = 50;
++static int enable_idle = 1;
++
++static void ene_set_idle(struct ene_device *dev, int idle);
++
++/* read a hardware register */
++static u8 ene_hw_read_reg(struct ene_device *dev, u16 reg)
++{
++	outb(reg >> 8   , dev->hw_io + ENE_ADDR_HI);
++	outb(reg & 0xFF , dev->hw_io + ENE_ADDR_LO);
++	return inb(dev->hw_io + ENE_IO);
++}
++
++/* write a hardware register */
++static void ene_hw_write_reg(struct ene_device *dev, u16 reg, u8 value)
++{
++	outb(reg >> 8   , dev->hw_io + ENE_ADDR_HI);
++	outb(reg & 0xFF , dev->hw_io + ENE_ADDR_LO);
++	outb(value, dev->hw_io + ENE_IO);
++}
++
++/* change specific bits in hardware register */
++static void ene_hw_write_reg_mask(struct ene_device *dev,
++						u16 reg, u8 value, u8 mask)
++{
++	u8 regvalue;
++
++	outb(reg >> 8   , dev->hw_io + ENE_ADDR_HI);
++	outb(reg & 0xFF , dev->hw_io + ENE_ADDR_LO);
++
++	regvalue = inb(dev->hw_io + ENE_IO) & ~mask;
++	regvalue |= (value & mask);
++	outb(regvalue, dev->hw_io + ENE_IO);
++}
++
++
++/* which half of hardware buffer we read now ?*/
++static int hw_get_buf_pointer(struct ene_device *dev)
++{
++	return 4 * (ene_hw_read_reg(dev, ENE_FW_BUFFER_POINTER)
++				& ENE_FW_BUFFER_POINTER_HIGH);
++}
++
++
++/* read irq status and ack it */
++static int ene_hw_irq_status(struct ene_device *dev)
++{
++	u8 irq_status = ene_hw_read_reg(dev, ENE_IRQ_STATUS);
++
++	if (!irq_status & ENE_IRQ_STATUS_IR)
++		return 0;
++
++	ene_hw_write_reg(dev, ENE_IRQ_STATUS, irq_status & ~ENE_IRQ_STATUS_IR);
++	return 1;
++}
++
++
++/* hardware initialization */
++static int ene_hw_init(void *data)
++{
++	struct ene_device *dev = (struct ene_device *)data;
++	dev->in_use = 1;
++
++	ene_hw_write_reg(dev, ENE_IRQ, dev->irq << 1);
++	ene_hw_write_reg(dev, ENE_ADC_UNK2, 0x00);
++	ene_hw_write_reg(dev, ENE_ADC_SAMPLE_PERIOD, sample_period);
++	ene_hw_write_reg(dev, ENE_ADC_UNK1, 0x07);
++	ene_hw_write_reg(dev, ENE_UNK1, 0x01);
++	ene_hw_write_reg_mask(dev, ENE_FW_SETTINGS, ENE_FW_ENABLE | ENE_FW_IRQ,
++		ENE_FW_ENABLE | ENE_FW_IRQ);
++
++	/* ack any pending irqs - just in case */
++	ene_hw_irq_status(dev);
++
++	/* enter idle mode */
++	ene_set_idle(dev, 1);
++
++	/* clear stats */
++	dev->sample = 0;
++	return 0;
++}
++
++/* deinitialization */
++static void ene_hw_deinit(void *data)
++{
++	struct ene_device *dev = (struct ene_device *)data;
++
++	/* disable hardware IRQ and firmware flag */
++	ene_hw_write_reg_mask(dev, ENE_FW_SETTINGS, 0,
++		ENE_FW_ENABLE | ENE_FW_IRQ);
++
++	ene_set_idle(dev, 1);
++	dev->in_use = 0;
++}
++
++/*  sends current sample to userspace */
++static void send_sample(struct ene_device *dev)
++{
++	int value = abs(dev->sample) & PULSE_MASK;
++
++	if (dev->sample > 0)
++		value |= PULSE_BIT;
++
++	if (!lirc_buffer_full(dev->lirc_driver->rbuf)) {
++		lirc_buffer_write(dev->lirc_driver->rbuf, (void *) &value);
++		wake_up(&dev->lirc_driver->rbuf->wait_poll);
++	}
++	dev->sample = 0;
++}
++
++/*  this updates current sample */
++static void update_sample(struct ene_device *dev, int sample)
++{
++	if (!dev->sample)
++		dev->sample = sample;
++	else if (same_sign(dev->sample, sample))
++		dev->sample += sample;
++	else {
++		send_sample(dev);
++		dev->sample = sample;
++	}
++}
++
++/* enable or disable idle mode */
++static void ene_set_idle(struct ene_device *dev, int idle)
++{
++	struct timeval now;
++
++	ene_hw_write_reg_mask(dev, ENE_ADC_SAMPLE_PERIOD,
++		idle & enable_idle ? 0 : ENE_ADC_SAMPLE_OVERFLOW,
++		ENE_ADC_SAMPLE_OVERFLOW);
++
++	dev->idle = idle;
++
++
++	/* remember when we have entered the idle mode */
++	if (idle) {
++		do_gettimeofday(&dev->gap_start);
++		return;
++	}
++
++	/* send the gap between keypresses now */
++	do_gettimeofday(&now);
++
++	if (now.tv_sec - dev->gap_start.tv_sec > 16)
++		dev->sample = space(PULSE_MASK);
++	else
++		dev->sample = dev->sample + 
++			space(1000000ull * (now.tv_sec - dev->gap_start.tv_sec))
++				+ space(now.tv_usec - dev->gap_start.tv_usec);
++
++	if (abs(dev->sample) > PULSE_MASK)
++		dev->sample = space(PULSE_MASK);
++	send_sample(dev);
++}
++
++
++/* interrupt handler */
++static irqreturn_t ene_hw_irq(int irq, void *data)
++{
++	u16 hw_address;
++	u8 hw_value;
++	int i, hw_sample;
++	int space;
++
++	struct ene_device *dev = (struct ene_device *)data;
++
++	if (!ene_hw_irq_status(dev))
++		return IRQ_NONE;
++
++	hw_address = ENE_SAMPLE_BUFFER + hw_get_buf_pointer(dev);
++
++	for (i = 0 ; i < ENE_SAMPLES_SIZE ; i++) {
++
++		hw_value = ene_hw_read_reg(dev, hw_address + i);
++		space = hw_value & ENE_SAMPLE_LOW_MASK;
++		hw_value &= ~ENE_SAMPLE_LOW_MASK;
++
++		/* no more data */
++		if (!(hw_value))
++			break;
++
++		/* calculate hw sample */
++		hw_sample = hw_value * sample_period;
++
++		if (space)
++			hw_sample *= -1;
++
++		/* overflow sample recieved, handle it */
++		if (hw_value == ENE_SAMPLE_OVERFLOW) {
++
++			if (dev->idle)
++				continue;
++
++			if (dev->sample > 0 || abs(dev->sample) <= ENE_MAXGAP)
++				update_sample(dev, hw_sample);
++			else
++				ene_set_idle(dev, 1);
++
++			continue;
++		}
++
++		/* normal first sample recieved*/
++		if (dev->idle) {
++			ene_set_idle(dev, 0);
++
++			/* discard first recieved value, its random
++			   since its the time signal was off before
++			   first pulse if idle mode is enabled, HW
++			   does that for us */
++
++			if (!enable_idle)
++				continue;
++		}
++
++		update_sample(dev, hw_sample);
++		send_sample(dev);
++	}
++	return IRQ_HANDLED;
++}
++
++static int ene_probe(struct pnp_dev *pnp_dev,
++					const struct pnp_device_id *dev_id)
++{
++	struct resource *res;
++	struct ene_device *dev;
++	struct lirc_driver *lirc_driver;
++	int error = -ENOMEM;
++
++	dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);
++
++	if (!dev)
++		goto err1;
++
++	dev->pnp_dev = pnp_dev;
++	pnp_set_drvdata(pnp_dev, dev);
++
++	error = -EINVAL;
++	if (sample_period < 5) {
++
++		printk(KERN_ERR ENE_DRIVER_NAME ": sample period must be at "
++		       "least 5 ms, (at least 30 recommended)\n");
++
++		goto err1;
++	}
++
++	/* validate and read resources */
++	error = -ENODEV;
++	res = pnp_get_resource(pnp_dev, IORESOURCE_IO, 0);
++	if (!pnp_resource_valid(res))
++		goto err2;
++
++	dev->hw_io = res->start;
++
++	if (pnp_resource_len(res) < ENE_MAX_IO)
++		goto err2;
++
++
++	res = pnp_get_resource(pnp_dev, IORESOURCE_IRQ, 0);
++	if (!pnp_resource_valid(res))
++		goto err2;
++
++	dev->irq = res->start;
++
++	/* prepare lirc interface */
++	error = -ENOMEM;
++	lirc_driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
++
++	if (!lirc_driver)
++		goto err2;
++
++	dev->lirc_driver = lirc_driver;
++
++	strcpy(lirc_driver->name, ENE_DRIVER_NAME);
++	lirc_driver->minor = -1;
++	lirc_driver->code_length = sizeof(int) * 8;
++	lirc_driver->features = LIRC_CAN_REC_MODE2;
++	lirc_driver->data = dev;
++	lirc_driver->set_use_inc = ene_hw_init;
++	lirc_driver->set_use_dec = ene_hw_deinit;
++	lirc_driver->dev = &pnp_dev->dev;
++	lirc_driver->owner = THIS_MODULE;
++
++	lirc_driver->rbuf = kzalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
++
++	if (!lirc_driver->rbuf)
++		goto err3;
++
++	if (lirc_buffer_init(lirc_driver->rbuf,
++					sizeof(int), sizeof(int) * 256))
++		goto err4;
++
++	error = -ENODEV;
++	if (lirc_register_driver(lirc_driver))
++		goto err5;
++
++	/* claim the resources */
++	error = -EBUSY;
++	if (!request_region(dev->hw_io, ENE_MAX_IO, ENE_DRIVER_NAME))
++		goto err6;
++
++	if (request_irq(dev->irq, ene_hw_irq,
++			IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev))
++		goto err7;
++
++
++	/* check firmware version */
++	error = -ENODEV;
++	if (ene_hw_read_reg(dev, ENE_FW_VERSION) != ENE_FW_VER_SUPP) {
++		printk(KERN_WARNING ENE_DRIVER_NAME ": "
++		       "unsupported firmware found, aborting\n");
++		goto err8;
++	}
++
++	printk(KERN_NOTICE ENE_DRIVER_NAME ": "
++	       "driver has been succesfully loaded\n");
++	return 0;
++
++err8:
++	free_irq(dev->irq, dev);
++err7:
++	release_region(dev->hw_io, ENE_MAX_IO);
++err6:
++	lirc_unregister_driver(lirc_driver->minor);
++err5:
++	lirc_buffer_free(lirc_driver->rbuf);
++err4:
++	kfree(lirc_driver->rbuf);
++err3:
++	kfree(lirc_driver);
++err2:
++	kfree(dev);
++err1:
++	return error;
++}
++
++
++static void ene_remove(struct pnp_dev *pnp_dev)
++{
++	struct ene_device *dev = pnp_get_drvdata(pnp_dev);
++	ene_hw_deinit(dev);
++	free_irq(dev->irq, dev);
++	release_region(dev->hw_io, ENE_MAX_IO);
++	lirc_unregister_driver(dev->lirc_driver->minor);
++	lirc_buffer_free(dev->lirc_driver->rbuf);
++	kfree(dev->lirc_driver);
++	kfree(dev);
++}
++
++
++#ifdef CONFIG_PM
++static int ene_suspend(struct pnp_dev *pnp_dev, pm_message_t state)
++{
++	struct ene_device *dev = pnp_get_drvdata(pnp_dev);
++	ene_hw_write_reg_mask(dev, ENE_FW_SETTINGS, ENE_FW_WAKE, ENE_FW_WAKE);
++	return 0;
++}
++
++
++static int ene_resume(struct pnp_dev *pnp_dev)
++{
++	struct ene_device *dev = pnp_get_drvdata(pnp_dev);
++	if (dev->in_use)
++		ene_hw_init(dev);
++
++	ene_hw_write_reg_mask(dev, ENE_FW_SETTINGS, 0, ENE_FW_WAKE);
++	return 0;
++}
++
++#endif
++
++
++static const struct pnp_device_id ene_ids[] = {
++	{ .id = "ENE0100", },
++	{ },
++};
++
++static struct pnp_driver ene_driver = {
++	.name = ENE_DRIVER_NAME,
++	.id_table = ene_ids,
++	.flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
++
++	.probe = ene_probe,
++	.remove = __devexit_p(ene_remove),
++
++#ifdef CONFIG_PM
++	.suspend = ene_suspend,
++	.resume = ene_resume,
++#endif
++};
++
++
++static int __init ene_init(void)
++{
++	return pnp_register_driver(&ene_driver);
++}
++
++static void ene_exit(void)
++{
++	pnp_unregister_driver(&ene_driver);
++}
++
++
++module_param(sample_period, int, S_IRUGO);
++MODULE_PARM_DESC(sample_period, "Hardware sample period (50 us default)");
++
++
++module_param(enable_idle, bool, S_IRUGO | S_IWUSR);
++MODULE_PARM_DESC(enable_idle,
++"Allow hardware to signal when IR pulse starts, disable if your remote"
++"doesn't send a sync pulse");
++
++
++MODULE_DEVICE_TABLE(pnp, ene_ids);
++MODULE_DESCRIPTION("LIRC driver for KB3924/ENE0100 CIR port");
++MODULE_AUTHOR("Maxim Levitsky");
++MODULE_LICENSE("GPL");
++
++module_init(ene_init);
++module_exit(ene_exit);
+diff --git a/drivers/input/lirc/lirc_ene0100.h b/drivers/input/lirc/lirc_ene0100.h
+new file mode 100644
+index 0000000..7db3545
+--- /dev/null
++++ b/drivers/input/lirc/lirc_ene0100.h
+@@ -0,0 +1,100 @@
++/*
++ * driver for ENE KB3924 CIR (also known as ENE0100)
++ *
++ * Copyright (C) 2009 Maxim Levitsky <maximlevitsky at gmail.com>
++ *
++ * 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 "lirc.h"
++#include "lirc_dev.h"
++
++/* hardware address */
++#define ENE_STATUS		0	/* hardware status - unused */
++#define ENE_ADDR_HI		1	/* hi byte of register address */
++#define ENE_ADDR_LO		2	/* low byte of register address */
++#define ENE_IO			3	/* read/write window */
++#define ENE_MAX_IO		3
++
++
++/* 8 bytes of samples, divided in 2 halfs*/
++#define ENE_SAMPLE_BUFFER		0xF8F0
++#define ENE_SAMPLE_LOW_MASK		(1 << 7)
++#define ENE_SAMPLE_VALUE_MASK		0x7F
++#define ENE_SAMPLE_OVERFLOW		0x7F
++#define ENE_SAMPLES_SIZE		4
++
++
++/* firmware settings */
++#define ENE_FW_SETTINGS			0xF8F8
++#define	ENE_FW_ENABLE			(1 << 0) /* enable fw processing */
++#define ENE_FW_WAKE			(1 << 6) /* enable wake from S3 */
++#define ENE_FW_IRQ			(1 << 7) /* enable interrupt */
++
++
++/* buffer pointer, tells which half of ENE_SAMPLE_BUFFER to read */
++#define ENE_FW_BUFFER_POINTER		0xF8F9
++#define ENE_FW_BUFFER_POINTER_HIGH	(1 << 0)
++
++
++/* IRQ registers block */
++#define ENE_IRQ				0xFD09	 /* IRQ number */
++#define ENE_UNK1			0xFD17   /* unknown setting = 1 */
++#define ENE_IRQ_STATUS			0xFD80   /* irq status */
++#define ENE_IRQ_STATUS_IR		(1 << 5) /* IR irq */
++
++
++/* ADC settings */
++#define ENE_ADC_UNK1			0xFEC0	 /* unknown setting = 7 */
++#define ENE_ADC_UNK2			0xFEC1   /* unknown setting = 0 */
++#define ENE_ADC_SAMPLE_PERIOD		0xFEC8   /* sample period in us */
++#define ENE_ADC_SAMPLE_OVERFLOW		(1 << 7) /* interrupt on
++						    overflows if set */
++
++/* fimware version */
++#define ENE_FW_VERSION			0xFF00
++#define ENE_FW_VER_SUPP			0xC0
++
++
++#define same_sign(a, b) ((((a) > 0) && (b) > 0) || ((a) < 0 && (b) < 0))
++
++#define ENE_DRIVER_NAME			"enecir"
++
++#define ENE_MAXGAP			5000000	/* this is amount of
++						   time we wait before
++						   turning the
++						   sampler, chosen
++						   arbitry */
++
++#define space(len)			(-(len))   /* add a space */
++
++
++struct ene_device {
++	struct pnp_dev *pnp_dev;
++	struct lirc_driver *lirc_driver;
++
++	/* hw settings */
++	unsigned long hw_io;
++	int irq;
++
++	/* device data */
++	int idle;
++	int sample;
++	int in_use;
++
++	struct timeval gap_start;
++};
++
 diff --git a/drivers/input/lirc/lirc_i2c.c b/drivers/input/lirc/lirc_i2c.c
 new file mode 100644
 index 0000000..e27d937
@@ -2869,10 +3442,10 @@ index 0000000..ff49bdd
 +
 diff --git a/drivers/input/lirc/lirc_imon.c b/drivers/input/lirc/lirc_imon.c
 new file mode 100644
-index 0000000..3c87d94
+index 0000000..05fe0c7
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_imon.c
-@@ -0,0 +1,2298 @@
+@@ -0,0 +1,2297 @@
 +/*
 + *   lirc_imon.c:  LIRC/VFD/LCD driver for SoundGraph iMON IR/VFD/LCD
 + *		   including the iMON PAD model
@@ -3273,8 +3846,7 @@ index 0000000..3c87d94
 +		 "open. 0=don't disable, 1=disable. (default: don't disable)");
 +module_param(pad_thresh, int, S_IRUGO | S_IWUSR);
 +MODULE_PARM_DESC(pad_thresh, "Threshold at which a pad push registers as an "
-+		 "arrow key in kbd mode (default 80 on newer devices, 15 on "
-+		 "older devices)");
++		 "arrow key in kbd mode (default: 28)");
 +
 +static void free_imon_context(struct imon_context *context)
 +{
@@ -4288,7 +4860,7 @@ index 0000000..3c87d94
 +		len = 8;
 +		timeout = 500;	/* in msecs */
 +		/* (2*threshold) x (2*threshold) square */
-+		threshold = pad_thresh ? pad_thresh : 80;
++		threshold = pad_thresh ? pad_thresh : 28;
 +		rel_x = buf[2];
 +		rel_y = buf[3];
 +




More information about the fedora-extras-commits mailing list