* [PATCH 0/9 v1] IR: few fixes, additions and ENE driver
@ 2010-07-28 15:14 Maxim Levitsky
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
` (8 more replies)
0 siblings, 9 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list; +Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab
Hi,
This is first version of ported ENE driver to ir-core
In meanwhile I fixed few bugs, added few things.
Comments are welcome!
Best regards,
Maxim Levitsky
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 1/9] IR: Kconfig fixes
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 17:36 ` Randy Dunlap
2010-07-28 15:14 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
` (7 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Move IR drives below separate menu.
This allows to disable them.
Also correct a typo.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/Kconfig | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig
index e557ae0..99ea9cd 100644
--- a/drivers/media/IR/Kconfig
+++ b/drivers/media/IR/Kconfig
@@ -1,8 +1,10 @@
-config IR_CORE
- tristate
+menuconfig IR_CORE
+ tristate "Infrared remote controller adapters"
depends on INPUT
default INPUT
+if IR_CORE
+
config VIDEO_IR
tristate
depends on IR_CORE
@@ -16,7 +18,7 @@ config LIRC
Enable this option to build the Linux Infrared Remote
Control (LIRC) core device interface driver. The LIRC
interface passes raw IR to and from userspace, where the
- LIRC daemon handles protocol decoding for IR reception ann
+ LIRC daemon handles protocol decoding for IR reception and
encoding for IR transmitting (aka "blasting").
source "drivers/media/IR/keymaps/Kconfig"
@@ -102,3 +104,9 @@ config IR_MCEUSB
To compile this driver as a module, choose M here: the
module will be called mceusb.
+
+
+
+
+
+endif #IR_CORE
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 2/9] IR: minor fixes:
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 16:01 ` Mauro Carvalho Chehab
2010-07-28 17:23 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 3/9] IR: replace spinlock with mutex Maxim Levitsky
` (6 subsequent siblings)
8 siblings, 2 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
* lirc: Don't propagate reset event to userspace
* lirc: Remove strange logic from lirc that would make first sample always be pulse
* Make TO_US macro actualy print what it should.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-core-priv.h | 3 +--
drivers/media/IR/ir-lirc-codec.c | 14 ++++++++------
drivers/media/IR/ir-raw-event.c | 3 +++
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
index babd520..8ce80e4 100644
--- a/drivers/media/IR/ir-core-priv.h
+++ b/drivers/media/IR/ir-core-priv.h
@@ -76,7 +76,6 @@ struct ir_raw_event_ctrl {
struct lirc_codec {
struct ir_input_dev *ir_dev;
struct lirc_driver *drv;
- int lircdata;
} lirc;
};
@@ -104,7 +103,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration)
ev->duration -= duration;
}
-#define TO_US(duration) (((duration) + 500) / 1000)
+#define TO_US(duration) ((duration) / 1000)
#define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space")
#define IS_RESET(ev) (ev.duration == 0)
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c
index 3ba482d..8ca01fd 100644
--- a/drivers/media/IR/ir-lirc-codec.c
+++ b/drivers/media/IR/ir-lirc-codec.c
@@ -32,6 +32,7 @@
static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
{
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
+ int sample;
if (!(ir_dev->raw->enabled_protocols & IR_TYPE_LIRC))
return 0;
@@ -39,18 +40,21 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf)
return -EINVAL;
+ if (IS_RESET(ev))
+ return 0;
+
IR_dprintk(2, "LIRC data transfer started (%uus %s)\n",
TO_US(ev.duration), TO_STR(ev.pulse));
- ir_dev->raw->lirc.lircdata += ev.duration / 1000;
+
+ sample = ev.duration / 1000;
if (ev.pulse)
- ir_dev->raw->lirc.lircdata |= PULSE_BIT;
+ sample |= PULSE_BIT;
lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf,
- (unsigned char *) &ir_dev->raw->lirc.lircdata);
+ (unsigned char *) &sample);
wake_up(&ir_dev->raw->lirc.drv->rbuf->wait_poll);
- ir_dev->raw->lirc.lircdata = 0;
return 0;
}
@@ -224,8 +228,6 @@ static int ir_lirc_register(struct input_dev *input_dev)
ir_dev->raw->lirc.drv = drv;
ir_dev->raw->lirc.ir_dev = ir_dev;
- ir_dev->raw->lirc.lircdata = PULSE_MASK;
-
return 0;
lirc_register_failed:
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index 6f192ef..ab9c4da 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -66,6 +66,9 @@ int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev)
if (!ir->raw)
return -EINVAL;
+ IR_dprintk(2, "sample: (05%dus %s)\n", TO_US(ev->duration),
+ TO_STR(ev->pulse));
+
if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev))
return -ENOMEM;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 3/9] IR: replace spinlock with mutex.
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
2010-07-28 15:14 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 16:03 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
` (5 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Some handlers (lirc for example) allocates memory on initialization,
doing so in atomic context is cumbersome.
Fixes warning about sleeping function in atomic context.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-raw-event.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index ab9c4da..c6a80b3 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -13,7 +13,7 @@
*/
#include <linux/workqueue.h>
-#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <linux/sched.h>
#include "ir-core-priv.h"
@@ -24,7 +24,7 @@
static LIST_HEAD(ir_raw_client_list);
/* Used to handle IR raw handler extensions */
-static DEFINE_SPINLOCK(ir_raw_handler_lock);
+static DEFINE_MUTEX(ir_raw_handler_lock);
static LIST_HEAD(ir_raw_handler_list);
static u64 available_protocols;
@@ -41,10 +41,10 @@ static void ir_raw_event_work(struct work_struct *work)
container_of(work, struct ir_raw_event_ctrl, rx_work);
while (kfifo_out(&raw->kfifo, &ev, sizeof(ev)) == sizeof(ev)) {
- spin_lock(&ir_raw_handler_lock);
+ mutex_lock(&ir_raw_handler_lock);
list_for_each_entry(handler, &ir_raw_handler_list, list)
handler->decode(raw->input_dev, ev);
- spin_unlock(&ir_raw_handler_lock);
+ mutex_unlock(&ir_raw_handler_lock);
raw->prev_ev = ev;
}
}
@@ -150,9 +150,9 @@ u64
ir_raw_get_allowed_protocols()
{
u64 protocols;
- spin_lock(&ir_raw_handler_lock);
+ mutex_lock(&ir_raw_handler_lock);
protocols = available_protocols;
- spin_unlock(&ir_raw_handler_lock);
+ mutex_unlock(&ir_raw_handler_lock);
return protocols;
}
@@ -180,12 +180,12 @@ int ir_raw_event_register(struct input_dev *input_dev)
return rc;
}
- spin_lock(&ir_raw_handler_lock);
+ mutex_lock(&ir_raw_handler_lock);
list_add_tail(&ir->raw->list, &ir_raw_client_list);
list_for_each_entry(handler, &ir_raw_handler_list, list)
if (handler->raw_register)
handler->raw_register(ir->raw->input_dev);
- spin_unlock(&ir_raw_handler_lock);
+ mutex_unlock(&ir_raw_handler_lock);
return 0;
}
@@ -200,12 +200,12 @@ void ir_raw_event_unregister(struct input_dev *input_dev)
cancel_work_sync(&ir->raw->rx_work);
- spin_lock(&ir_raw_handler_lock);
+ mutex_lock(&ir_raw_handler_lock);
list_del(&ir->raw->list);
list_for_each_entry(handler, &ir_raw_handler_list, list)
if (handler->raw_unregister)
handler->raw_unregister(ir->raw->input_dev);
- spin_unlock(&ir_raw_handler_lock);
+ mutex_unlock(&ir_raw_handler_lock);
kfifo_free(&ir->raw->kfifo);
kfree(ir->raw);
@@ -220,13 +220,13 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler)
{
struct ir_raw_event_ctrl *raw;
- spin_lock(&ir_raw_handler_lock);
+ mutex_lock(&ir_raw_handler_lock);
list_add_tail(&ir_raw_handler->list, &ir_raw_handler_list);
if (ir_raw_handler->raw_register)
list_for_each_entry(raw, &ir_raw_client_list, list)
ir_raw_handler->raw_register(raw->input_dev);
available_protocols |= ir_raw_handler->protocols;
- spin_unlock(&ir_raw_handler_lock);
+ mutex_unlock(&ir_raw_handler_lock);
return 0;
}
@@ -236,13 +236,13 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler)
{
struct ir_raw_event_ctrl *raw;
- spin_lock(&ir_raw_handler_lock);
+ mutex_lock(&ir_raw_handler_lock);
list_del(&ir_raw_handler->list);
if (ir_raw_handler->raw_unregister)
list_for_each_entry(raw, &ir_raw_client_list, list)
ir_raw_handler->raw_unregister(raw->input_dev);
available_protocols &= ~ir_raw_handler->protocols;
- spin_unlock(&ir_raw_handler_lock);
+ mutex_unlock(&ir_raw_handler_lock);
}
EXPORT_SYMBOL(ir_raw_handler_unregister);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed.
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
` (2 preceding siblings ...)
2010-07-28 15:14 ` [PATCH 3/9] IR: replace spinlock with mutex Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 16:09 ` Mauro Carvalho Chehab
2010-07-28 17:46 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
` (4 subsequent siblings)
8 siblings, 2 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-core-priv.h | 1 +
drivers/media/IR/ir-keytable.c | 2 +-
drivers/media/IR/ir-raw-event.c | 86 +++++++++++++++++++++++++++++++++++++++
include/media/ir-core.h | 24 +++++++++-
4 files changed, 109 insertions(+), 4 deletions(-)
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
index 8ce80e4..3eafdb7 100644
--- a/drivers/media/IR/ir-core-priv.h
+++ b/drivers/media/IR/ir-core-priv.h
@@ -36,6 +36,7 @@ struct ir_raw_event_ctrl {
struct kfifo kfifo; /* fifo for the pulse/space durations */
ktime_t last_event; /* when last event occurred */
enum raw_event_type last_type; /* last event type */
+ struct ir_raw_event current_sample; /* sample that is not yet pushed to fifo */
struct input_dev *input_dev; /* pointer to the parent input_dev */
u64 enabled_protocols; /* enabled raw protocol decoders */
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 94a8577..34b9c07 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -428,7 +428,7 @@ static void ir_close(struct input_dev *input_dev)
*/
int __ir_input_register(struct input_dev *input_dev,
const struct ir_scancode_table *rc_tab,
- const struct ir_dev_props *props,
+ struct ir_dev_props *props,
const char *driver_name)
{
struct ir_input_dev *ir_dev;
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index c6a80b3..bdf2ed8 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -129,6 +129,92 @@ int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type typ
EXPORT_SYMBOL_GPL(ir_raw_event_store_edge);
/**
+ * ir_raw_event_store_with_filter() - pass next pulse/space to decoders with some processing
+ * @input_dev: the struct input_dev device descriptor
+ * @type: the type of the event that has occurred
+ *
+ * This routine (which may be called from an interrupt context) is used to
+ * store the beginning of an ir pulse or space (or the start/end of ir
+ * reception) for the raw ir decoding state machines.\
+ * This routine is intended for devices with limited internal buffer
+ * It automerges samples of same type, and handles timeouts
+ */
+int ir_raw_event_store_with_filter(struct input_dev *input_dev,
+ struct ir_raw_event *ev)
+{
+ struct ir_input_dev *ir = input_get_drvdata(input_dev);
+ struct ir_raw_event_ctrl *raw = ir->raw;
+
+ if (!ir->raw || !ir->props)
+ return -EINVAL;
+
+ /* Ignore spaces in idle mode */
+ if (ir->idle && !ev->pulse)
+ return 0;
+ else if (ir->idle)
+ ir_raw_event_set_idle(input_dev, 0);
+
+ if (!raw->current_sample.duration) {
+ raw->current_sample = *ev;
+ } else if (ev->pulse == raw->current_sample.pulse) {
+ raw->current_sample.duration += ev->duration;
+ } else {
+ ir_raw_event_store(input_dev, &raw->current_sample);
+ raw->current_sample = *ev;
+ }
+
+ /* Enter idle mode if nessesary */
+ if (!ev->pulse && ir->props->timeout &&
+ raw->current_sample.duration >= ir->props->timeout)
+ ir_raw_event_set_idle(input_dev, 1);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter);
+
+
+void ir_raw_event_set_idle(struct input_dev *input_dev, int idle)
+{
+ struct ir_input_dev *ir = input_get_drvdata(input_dev);
+ struct ir_raw_event_ctrl *raw = ir->raw;
+ ktime_t now;
+ u64 delta;
+
+ if (!ir->props)
+ return;
+
+ if (!ir->raw)
+ goto out;
+
+ if (idle) {
+ IR_dprintk(2, "enter idle mode\n");
+ raw->last_event = ktime_get();
+ } else {
+ IR_dprintk(2, "exit idle mode\n");
+
+ now = ktime_get();
+ delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event));
+
+ WARN_ON(raw->current_sample.pulse);
+
+ raw->current_sample.duration =
+ min(raw->current_sample.duration + delta,
+ (u64)IR_MAX_DURATION);
+
+ ir_raw_event_store(input_dev, &raw->current_sample);
+
+ if (raw->current_sample.duration == IR_MAX_DURATION)
+ ir_raw_event_reset(input_dev);
+
+ raw->current_sample.duration = 0;
+ }
+out:
+ if (ir->props->s_idle)
+ ir->props->s_idle(ir->props->priv, idle);
+ ir->idle = idle;
+}
+EXPORT_SYMBOL_GPL(ir_raw_event_set_idle);
+
+/**
* ir_raw_event_handle() - schedules the decoding of stored ir data
* @input_dev: the struct input_dev device descriptor
*
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 513e60d..53ce966 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -41,6 +41,9 @@ enum rc_driver_type {
* anything with it. Yet, as the same keycode table can be used with other
* devices, a mask is provided to allow its usage. Drivers should generally
* leave this field in blank
+ * @timeout: optional time after which device stops sending data
+ * @min_timeout: minimum timeout supported by device
+ * @max_timeout: maximum timeout supported by device
* @priv: driver-specific data, to be used on the callbacks
* @change_protocol: allow changing the protocol used on hardware decoders
* @open: callback to allow drivers to enable polling/irq when IR input device
@@ -50,11 +53,19 @@ enum rc_driver_type {
* @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
* @s_tx_carrier: set transmit carrier frequency
* @tx_ir: transmit IR
+ * @s_idle: optional: enable/disable hardware idle mode, upon which,
+ device doesn't interrupt host untill it sees IR data
*/
struct ir_dev_props {
enum rc_driver_type driver_type;
unsigned long allowed_protos;
u32 scanmask;
+
+ u64 timeout;
+ u64 min_timeout;
+ u64 max_timeout;
+
+
void *priv;
int (*change_protocol)(void *priv, u64 ir_type);
int (*open)(void *priv);
@@ -62,6 +73,7 @@ struct ir_dev_props {
int (*s_tx_mask)(void *priv, u32 mask);
int (*s_tx_carrier)(void *priv, u32 carrier);
int (*tx_ir)(void *priv, int *txbuf, u32 n);
+ void (*s_idle) (void *priv, int enable);
};
struct ir_input_dev {
@@ -69,9 +81,10 @@ struct ir_input_dev {
char *driver_name; /* Name of the driver module */
struct ir_scancode_table rc_tab; /* scan/key table */
unsigned long devno; /* device number */
- const struct ir_dev_props *props; /* Device properties */
+ struct ir_dev_props *props; /* Device properties */
struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
struct input_dev *input_dev; /* the input device associated with this device */
+ int idle;
/* key info - needed by IR keycode handlers */
spinlock_t keylock; /* protects the below members */
@@ -95,12 +108,12 @@ enum raw_event_type {
/* From ir-keytable.c */
int __ir_input_register(struct input_dev *dev,
const struct ir_scancode_table *ir_codes,
- const struct ir_dev_props *props,
+ struct ir_dev_props *props,
const char *driver_name);
static inline int ir_input_register(struct input_dev *dev,
const char *map_name,
- const struct ir_dev_props *props,
+ struct ir_dev_props *props,
const char *driver_name) {
struct ir_scancode_table *ir_codes;
struct ir_input_dev *ir_dev;
@@ -144,6 +157,11 @@ struct ir_raw_event {
void ir_raw_event_handle(struct input_dev *input_dev);
int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
+int ir_raw_event_store_with_filter(struct input_dev *input_dev,
+ struct ir_raw_event *ev);
+
+void ir_raw_event_set_idle(struct input_dev *input_dev, int idle);
+
static inline void ir_raw_event_reset(struct input_dev *input_dev)
{
struct ir_raw_event ev = { .pulse = false, .duration = 0 };
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 5/9] IR: extend interfaces to support more device settings
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
` (3 preceding siblings ...)
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 17:00 ` Mauro Carvalho Chehab
2010-07-28 20:47 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 6/9] IR: actually allow not to compile keymaps in Maxim Levitsky
` (3 subsequent siblings)
8 siblings, 2 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Also reuse LIRC_SET_MEASURE_CARRIER_MODE as LIRC_SET_LEARN_MODE
(LIRC_SET_LEARN_MODE will start carrier reports if possible, and
tune receiver to wide band mode)
This IOCTL isn't yet used by lirc, so this won't break userspace.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-core-priv.h | 2 +
drivers/media/IR/ir-lirc-codec.c | 100 ++++++++++++++++++++++++++++++++++----
include/media/ir-core.h | 11 ++++
include/media/lirc.h | 4 +-
4 files changed, 105 insertions(+), 12 deletions(-)
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
index 3eafdb7..4ed170d 100644
--- a/drivers/media/IR/ir-core-priv.h
+++ b/drivers/media/IR/ir-core-priv.h
@@ -77,6 +77,8 @@ struct ir_raw_event_ctrl {
struct lirc_codec {
struct ir_input_dev *ir_dev;
struct lirc_driver *drv;
+ int timeout_report;
+ int carrier_low;
} lirc;
};
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c
index 8ca01fd..0f3969c 100644
--- a/drivers/media/IR/ir-lirc-codec.c
+++ b/drivers/media/IR/ir-lirc-codec.c
@@ -96,13 +96,13 @@ out:
return ret;
}
-static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
+static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long __user arg)
{
struct lirc_codec *lirc;
struct ir_input_dev *ir_dev;
int ret = 0;
void *drv_data;
- unsigned long val;
+ unsigned long val = 0;
lirc = lirc_get_pdata(filep);
if (!lirc)
@@ -116,10 +116,21 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long ar
switch (cmd) {
case LIRC_SET_TRANSMITTER_MASK:
+ case LIRC_SET_SEND_CARRIER:
+ case LIRC_SET_SEND_MODE:
+ case LIRC_SET_REC_TIMEOUT:
+ case LIRC_SET_REC_TIMEOUT_REPORTS:
+ case LIRC_SET_LEARN_MODE:
+ case LIRC_SET_REC_CARRIER:
+ case LIRC_SET_REC_CARRIER_RANGE:
+ case LIRC_SET_SEND_DUTY_CYCLE:
ret = get_user(val, (unsigned long *)arg);
if (ret)
return ret;
+ }
+ switch (cmd) {
+ case LIRC_SET_TRANSMITTER_MASK:
if (ir_dev->props && ir_dev->props->s_tx_mask)
ret = ir_dev->props->s_tx_mask(drv_data, (u32)val);
else
@@ -127,10 +138,6 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long ar
break;
case LIRC_SET_SEND_CARRIER:
- ret = get_user(val, (unsigned long *)arg);
- if (ret)
- return ret;
-
if (ir_dev->props && ir_dev->props->s_tx_carrier)
ir_dev->props->s_tx_carrier(drv_data, (u32)val);
else
@@ -143,14 +150,75 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long ar
break;
case LIRC_SET_SEND_MODE:
- ret = get_user(val, (unsigned long *)arg);
- if (ret)
- return ret;
-
if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK))
return -EINVAL;
break;
+ case LIRC_GET_REC_RESOLUTION:
+ val = ir_dev->props->rx_resolution;
+ ret = put_user(val, (unsigned long *)arg);
+ break;
+
+ case LIRC_SET_REC_TIMEOUT:
+ if (val < ir_dev->props->min_timeout ||
+ val > ir_dev->props->max_timeout)
+ return -EINVAL;
+
+ ir_dev->props->timeout = val;
+ break;
+
+ case LIRC_SET_REC_TIMEOUT_REPORTS:
+ ir_dev->raw->lirc.timeout_report = !!val;
+ return 0;
+
+ case LIRC_GET_MIN_TIMEOUT:
+
+ if (!ir_dev->props->max_timeout)
+ return -ENOSYS;
+
+ ret = put_user(ir_dev->props->min_timeout, (unsigned long *)arg);
+ break;
+ case LIRC_GET_MAX_TIMEOUT:
+ if (!ir_dev->props->max_timeout)
+ return -ENOSYS;
+
+ ret = put_user(ir_dev->props->max_timeout, (unsigned long *)arg);
+ break;
+
+ case LIRC_SET_LEARN_MODE:
+ if (ir_dev->props->s_learning_mode)
+ return ir_dev->props->s_learning_mode(
+ ir_dev->props->priv, !!val);
+ else
+ return -ENOSYS;
+
+ case LIRC_SET_REC_CARRIER:
+ if (ir_dev->props->s_rx_carrier_range)
+ ret = ir_dev->props->s_rx_carrier_range(
+ ir_dev->props->priv,
+ ir_dev->raw->lirc.carrier_low, val);
+ else
+ return -ENOSYS;
+
+ if (!ret)
+ ir_dev->raw->lirc.carrier_low = 0;
+ break;
+
+ case LIRC_SET_REC_CARRIER_RANGE:
+ if (val >= 0)
+ ir_dev->raw->lirc.carrier_low = val;
+ break;
+ case LIRC_SET_SEND_DUTY_CYCLE:
+
+ if (!ir_dev->props->s_tx_duty_cycle)
+ return -ENOSYS;
+
+ if (val <= 0 || val >= 100)
+ return -EINVAL;
+
+ ir_dev->props->s_tx_duty_cycle(ir_dev->props->priv, val);
+ break;
+
default:
return lirc_dev_fop_ioctl(filep, cmd, arg);
}
@@ -200,13 +268,25 @@ static int ir_lirc_register(struct input_dev *input_dev)
features = LIRC_CAN_REC_MODE2;
if (ir_dev->props->tx_ir) {
+
features |= LIRC_CAN_SEND_PULSE;
if (ir_dev->props->s_tx_mask)
features |= LIRC_CAN_SET_TRANSMITTER_MASK;
if (ir_dev->props->s_tx_carrier)
features |= LIRC_CAN_SET_SEND_CARRIER;
+
+ if (ir_dev->props->s_tx_duty_cycle)
+ features |= LIRC_CAN_SET_REC_DUTY_CYCLE;
}
+ if (ir_dev->props->s_rx_carrier_range)
+ features |= LIRC_CAN_SET_REC_CARRIER |
+ LIRC_CAN_SET_REC_CARRIER_RANGE;
+
+ if (ir_dev->props->s_learning_mode)
+ features |= LIRC_CAN_LEARN_MODE;
+
+
snprintf(drv->name, sizeof(drv->name), "ir-lirc-codec (%s)",
ir_dev->driver_name);
drv->minor = -1;
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 53ce966..46cc6c5 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -44,6 +44,8 @@ enum rc_driver_type {
* @timeout: optional time after which device stops sending data
* @min_timeout: minimum timeout supported by device
* @max_timeout: maximum timeout supported by device
+ * @rx_resolution : resolution (in ns) of input sampler
+ * @tx_resolution: resolution (in ns) of output sampler
* @priv: driver-specific data, to be used on the callbacks
* @change_protocol: allow changing the protocol used on hardware decoders
* @open: callback to allow drivers to enable polling/irq when IR input device
@@ -52,9 +54,12 @@ enum rc_driver_type {
* is opened.
* @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
* @s_tx_carrier: set transmit carrier frequency
+ * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%)
+ * @s_rx_carrier: inform driver about carrier it is expected to handle
* @tx_ir: transmit IR
* @s_idle: optional: enable/disable hardware idle mode, upon which,
device doesn't interrupt host untill it sees IR data
+ * @s_learning_mode: enable learning mode
*/
struct ir_dev_props {
enum rc_driver_type driver_type;
@@ -65,6 +70,8 @@ struct ir_dev_props {
u64 min_timeout;
u64 max_timeout;
+ u32 rx_resolution;
+ u32 tx_resolution;
void *priv;
int (*change_protocol)(void *priv, u64 ir_type);
@@ -72,8 +79,12 @@ struct ir_dev_props {
void (*close)(void *priv);
int (*s_tx_mask)(void *priv, u32 mask);
int (*s_tx_carrier)(void *priv, u32 carrier);
+ int (*s_tx_duty_cycle) (void *priv, u32 duty_cycle);
+ int (*s_rx_carrier_range) (void *priv, u32 min, u32 max);
int (*tx_ir)(void *priv, int *txbuf, u32 n);
void (*s_idle) (void *priv, int enable);
+ int (*s_learning_mode) (void *priv, int enable);
+
};
struct ir_input_dev {
diff --git a/include/media/lirc.h b/include/media/lirc.h
index 42c467c..09a9753 100644
--- a/include/media/lirc.h
+++ b/include/media/lirc.h
@@ -76,7 +76,7 @@
#define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
#define LIRC_CAN_SET_REC_FILTER 0x08000000
-#define LIRC_CAN_MEASURE_CARRIER 0x02000000
+#define LIRC_CAN_LEARN_MODE 0x02000000
#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
@@ -145,7 +145,7 @@
* if enabled from the next key press on the driver will send
* LIRC_MODE2_FREQUENCY packets
*/
-#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
+#define LIRC_SET_LEARN_MODE _IOW('i', 0x0000001d, __u32)
/*
* to set a range use
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 6/9] IR: actually allow not to compile keymaps in..
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
` (4 preceding siblings ...)
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 17:58 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 7/9] IR: actualy report unknown scancodes the in-kernel decoders found Maxim Levitsky
` (2 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Currntly, ir device registration fails if keymap requested by driver is not found...
Fix that by always compiling in the empty keymap, and using it as a failback
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-core-priv.h | 3 +-
drivers/media/IR/ir-sysfs.c | 2 +
drivers/media/IR/keymaps/Makefile | 1 -
drivers/media/IR/keymaps/rc-empty.c | 44 -----------------------------------
drivers/media/IR/rc-map.c | 23 ++++++++++++++++++
include/media/ir-core.h | 8 ++++-
6 files changed, 33 insertions(+), 48 deletions(-)
delete mode 100644 drivers/media/IR/keymaps/rc-empty.c
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
index 4ed170d..9206b76 100644
--- a/drivers/media/IR/ir-core-priv.h
+++ b/drivers/media/IR/ir-core-priv.h
@@ -128,7 +128,8 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
void ir_raw_init(void);
-
+int ir_rcmap_init(void);
+void ir_rcmap_cleanup(void);
/*
* Decoder initialization code
*
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index a841e51..936dff8 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -341,6 +341,7 @@ static int __init ir_core_init(void)
/* Initialize/load the decoders/keymap code that will be used */
ir_raw_init();
+ ir_rcmap_init();
return 0;
}
@@ -348,6 +349,7 @@ static int __init ir_core_init(void)
static void __exit ir_core_exit(void)
{
class_unregister(&ir_input_class);
+ ir_rcmap_cleanup();
}
module_init(ir_core_init);
diff --git a/drivers/media/IR/keymaps/Makefile b/drivers/media/IR/keymaps/Makefile
index 86d3d1f..24992cd 100644
--- a/drivers/media/IR/keymaps/Makefile
+++ b/drivers/media/IR/keymaps/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-dm1105-nec.o \
rc-dntv-live-dvb-t.o \
rc-dntv-live-dvbt-pro.o \
- rc-empty.o \
rc-em-terratec.o \
rc-encore-enltv2.o \
rc-encore-enltv.o \
diff --git a/drivers/media/IR/keymaps/rc-empty.c b/drivers/media/IR/keymaps/rc-empty.c
deleted file mode 100644
index 3b338d8..0000000
--- a/drivers/media/IR/keymaps/rc-empty.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* empty.h - Keytable for empty Remote Controller
- *
- * keymap imported from ir-keymaps.c
- *
- * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.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.
- */
-
-#include <media/rc-map.h>
-
-/* empty keytable, can be used as placeholder for not-yet created keytables */
-
-static struct ir_scancode empty[] = {
- { 0x2a, KEY_COFFEE },
-};
-
-static struct rc_keymap empty_map = {
- .map = {
- .scan = empty,
- .size = ARRAY_SIZE(empty),
- .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */
- .name = RC_MAP_EMPTY,
- }
-};
-
-static int __init init_rc_map_empty(void)
-{
- return ir_register_map(&empty_map);
-}
-
-static void __exit exit_rc_map_empty(void)
-{
- ir_unregister_map(&empty_map);
-}
-
-module_init(init_rc_map_empty)
-module_exit(exit_rc_map_empty)
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c
index 46a8f15..689143f 100644
--- a/drivers/media/IR/rc-map.c
+++ b/drivers/media/IR/rc-map.c
@@ -82,3 +82,26 @@ void ir_unregister_map(struct rc_keymap *map)
}
EXPORT_SYMBOL_GPL(ir_unregister_map);
+
+static struct ir_scancode empty[] = {
+ { 0x2a, KEY_COFFEE },
+};
+
+static struct rc_keymap empty_map = {
+ .map = {
+ .scan = empty,
+ .size = ARRAY_SIZE(empty),
+ .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */
+ .name = RC_MAP_EMPTY,
+ }
+};
+
+int ir_rcmap_init(void)
+{
+ return ir_register_map(&empty_map);
+}
+
+void ir_rcmap_cleanup(void)
+{
+ ir_unregister_map(&empty_map);
+}
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 46cc6c5..1e0abfd 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -134,8 +134,12 @@ static inline int ir_input_register(struct input_dev *dev,
return -EINVAL;
ir_codes = get_rc_map(map_name);
- if (!ir_codes)
- return -EINVAL;
+ if (!ir_codes) {
+ ir_codes = get_rc_map(RC_MAP_EMPTY);
+
+ if (!ir_codes)
+ return -EINVAL;
+ }
rc = __ir_input_register(dev, ir_codes, props, driver_name);
if (rc < 0)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 7/9] IR: actualy report unknown scancodes the in-kernel decoders found.
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
` (5 preceding siblings ...)
2010-07-28 15:14 ` [PATCH 6/9] IR: actually allow not to compile keymaps in Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 15:14 ` [PATCH 8/9] IR: Add ENE input driver Maxim Levitsky
2010-07-28 15:14 ` [PATCH 9/9] STAGING: remove ENE driver Maxim Levitsky
8 siblings, 0 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
This way it is possible to use evtest to create keymap for unknown remote.
(Providing that in-kernel decoding understands remote's protocol. Hint: it doesn't....)
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/ir-keytable.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 34b9c07..1504a3b 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -383,9 +383,12 @@ void ir_keydown(struct input_dev *dev, int scancode, u8 toggle)
ir->last_toggle = toggle;
ir->last_keycode = keycode;
+ input_event(dev, EV_MSC, MSC_SCAN, scancode);
+
if (keycode == KEY_RESERVED)
goto out;
+
/* Register a keypress */
ir->keypressed = true;
IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n",
@@ -480,6 +483,8 @@ int __ir_input_register(struct input_dev *input_dev,
set_bit(EV_KEY, input_dev->evbit);
set_bit(EV_REP, input_dev->evbit);
+ set_bit(EV_MSC, input_dev->evbit);
+ set_bit(MSC_SCAN, input_dev->mscbit);
if (ir_setkeytable(input_dev, &ir_dev->rc_tab, rc_tab)) {
rc = -ENOMEM;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 8/9] IR: Add ENE input driver.
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
` (6 preceding siblings ...)
2010-07-28 15:14 ` [PATCH 7/9] IR: actualy report unknown scancodes the in-kernel decoders found Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
2010-07-28 17:10 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 9/9] STAGING: remove ENE driver Maxim Levitsky
8 siblings, 1 reply; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/Kconfig | 11 +
drivers/media/IR/Makefile | 1 +
drivers/media/IR/ene_ir.c | 1019 +++++++++++++++++++++++++++++++++++++++++++++
drivers/media/IR/ene_ir.h | 228 ++++++++++
4 files changed, 1259 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/IR/ene_ir.c
create mode 100644 drivers/media/IR/ene_ir.h
diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig
index 99ea9cd..8390d3c 100644
--- a/drivers/media/IR/Kconfig
+++ b/drivers/media/IR/Kconfig
@@ -105,8 +105,19 @@ config IR_MCEUSB
To compile this driver as a module, choose M here: the
module will be called mceusb.
+config IR_ENE
+ tristate "ENE eHome Receiver/Transciever (pnp id: ENE0100/ENE02xxx)"
+ depends on PNP
+ depends on IR_CORE
+ ---help---
+ Say Y here to enable support for integrated infrared receiver
+ /transciever made by ENE.
+ You can see if you have it by looking at lspnp output.
+ Output should include ENE0100 ENE0200 or something similiar.
+ To compile this driver as a module, choose M here: the
+ module will be called ene_ir.
endif #IR_CORE
diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile
index 2ae4f3a..3262a68 100644
--- a/drivers/media/IR/Makefile
+++ b/drivers/media/IR/Makefile
@@ -16,3 +16,4 @@ 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_ENE) += ene_ir.o
diff --git a/drivers/media/IR/ene_ir.c b/drivers/media/IR/ene_ir.c
new file mode 100644
index 0000000..8b88dbd
--- /dev/null
+++ b/drivers/media/IR/ene_ir.c
@@ -0,0 +1,1019 @@
+/*
+ * driver for ENE KB3926 B/C/D CIR (pnp id: ENE0XXX)
+ *
+ * Copyright (C) 2010 Maxim Levitsky <maximlevitsky@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 <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <media/ir-core.h>
+#include <media/ir-common.h>
+#include "ene_ir.h"
+
+
+static int sample_period = -1;
+static int enable_idle = 1;
+static int error_adjustment = 4;
+static int input = 1;
+static int debug;
+static int txsim;
+
+static int ene_irq_status(struct ene_device *dev);
+
+/* read a hardware register */
+static u8 ene_hw_read_reg(struct ene_device *dev, u16 reg)
+{
+ u8 retval;
+ outb(reg >> 8, dev->hw_io + ENE_ADDR_HI);
+ outb(reg & 0xFF, dev->hw_io + ENE_ADDR_LO);
+ retval = inb(dev->hw_io + ENE_IO);
+
+ ene_dbg_verbose("reg %04x == %02x", reg, retval);
+ return retval;
+}
+
+/* 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);
+
+ ene_dbg_verbose("reg %04x <- %02x", reg, value);
+}
+
+/* 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);
+
+ ene_dbg_verbose("reg %04x <- %02x (mask=%02x)", reg, value, mask);
+}
+
+/* detect hardware features */
+static int ene_hw_detect(struct ene_device *dev)
+{
+ u8 chip_major, chip_minor;
+ u8 hw_revision, old_ver;
+ u8 tmp;
+ u8 fw_capabilities;
+
+ tmp = ene_hw_read_reg(dev, ENE_HW_UNK);
+ ene_hw_write_reg(dev, ENE_HW_UNK, tmp & ~ENE_HW_UNK_CLR);
+
+ chip_major = ene_hw_read_reg(dev, ENE_HW_VER_MAJOR);
+ chip_minor = ene_hw_read_reg(dev, ENE_HW_VER_MINOR);
+
+ ene_hw_write_reg(dev, ENE_HW_UNK, tmp);
+ hw_revision = ene_hw_read_reg(dev, ENE_HW_VERSION);
+ old_ver = ene_hw_read_reg(dev, ENE_HW_VER_OLD);
+
+ if (hw_revision == 0xFF) {
+
+ ene_printk(KERN_WARNING, "device seems to be disabled\n");
+ ene_printk(KERN_WARNING,
+ "send a mail to lirc-list@lists.sourceforge.net\n");
+ ene_printk(KERN_WARNING, "please attach output of acpidump\n");
+ return -ENODEV;
+ }
+
+ if (chip_major == 0x33) {
+ ene_printk(KERN_WARNING, "chips 0x33xx aren't supported\n");
+ return -ENODEV;
+ }
+
+ if (chip_major == 0x39 && chip_minor == 0x26 && hw_revision == 0xC0) {
+ dev->hw_revision = ENE_HW_C;
+ } else if (old_ver == 0x24 && hw_revision == 0xC0) {
+ dev->hw_revision = ENE_HW_B;
+ ene_printk(KERN_NOTICE, "KB3926B detected\n");
+ } else {
+ dev->hw_revision = ENE_HW_D;
+ ene_printk(KERN_WARNING,
+ "unknown ENE chip detected, assuming KB3926D\n");
+ ene_printk(KERN_WARNING,
+ "driver support might be not complete");
+
+ }
+
+ ene_printk(KERN_DEBUG,
+ "chip is 0x%02x%02x - kbver = 0x%02x, rev = 0x%02x\n",
+ chip_major, chip_minor, old_ver, hw_revision);
+
+ /* detect features hardware supports */
+ if (dev->hw_revision < ENE_HW_C)
+ return 0;
+
+ fw_capabilities = ene_hw_read_reg(dev, ENE_FW2);
+ ene_dbg("Firmware capabilities: %02x", fw_capabilities);
+
+ dev->hw_gpio40_learning = fw_capabilities & ENE_FW2_GP40_AS_LEARN;
+ dev->hw_learning_and_tx_capable = fw_capabilities & ENE_FW2_LEARNING;
+
+ dev->hw_fan_as_normal_input = dev->hw_learning_and_tx_capable &&
+ (fw_capabilities & ENE_FW2_FAN_AS_NRML_IN);
+
+ ene_printk(KERN_NOTICE, "hardware features:\n");
+ ene_printk(KERN_NOTICE,
+ "learning and transmit %s, gpio40_learn %s, fan_in %s\n",
+ dev->hw_learning_and_tx_capable ? "on" : "off",
+ dev->hw_gpio40_learning ? "on" : "off",
+ dev->hw_fan_as_normal_input ? "on" : "off");
+
+ if (dev->hw_learning_and_tx_capable) {
+ ene_printk(KERN_WARNING,
+ "Device supports transmitting, but that support is\n");
+ ene_printk(KERN_WARNING,
+ "lightly tested. Please test it and mail\n");
+ ene_printk(KERN_WARNING,
+ "lirc-list@lists.sourceforge.net\n");
+ }
+ return 0;
+}
+
+/* this enables/disables IR input via gpio40*/
+static void ene_enable_gpio40_receive(struct ene_device *dev, int enable)
+{
+ ene_hw_write_reg_mask(dev, ENE_CIR_CONF2, enable ?
+ 0 : ENE_CIR_CONF2_GPIO40DIS,
+ ENE_CIR_CONF2_GPIO40DIS);
+}
+
+/* this enables/disables IR via standard input */
+static void ene_enable_normal_receive(struct ene_device *dev, int enable)
+{
+ ene_hw_write_reg(dev, ENE_CIR_CONF1, enable ? ENE_CIR_CONF1_RX_ON : 0);
+}
+
+/* this enables/disables IR input via unused fan tachtometer input */
+static void ene_enable_fan_receive(struct ene_device *dev, int enable)
+{
+ if (!enable)
+ ene_hw_write_reg(dev, ENE_FAN_AS_IN1, 0);
+ else {
+ ene_hw_write_reg(dev, ENE_FAN_AS_IN1, ENE_FAN_AS_IN1_EN);
+ ene_hw_write_reg(dev, ENE_FAN_AS_IN2, ENE_FAN_AS_IN2_EN);
+ }
+ dev->rx_fan_input_inuse = enable;
+}
+
+
+/* Sense current received carrier */
+static int ene_rx_sense_carrier(struct ene_device *dev)
+{
+ int period = ene_hw_read_reg(dev, ENE_RX_CARRIER);
+ int carrier;
+ ene_dbg("RX: hardware carrier period = %02x", period);
+
+ if (!(period & ENE_RX_CARRIER_VALID))
+ return 0;
+
+ period &= ~ENE_RX_CARRIER_VALID;
+
+ if (!period)
+ return 0;
+
+ carrier = 2000000 / period;
+ ene_dbg("RX: sensed carrier = %d Hz", carrier);
+ return carrier;
+}
+
+/* determine which input to use*/
+static void ene_rx_set_inputs(struct ene_device *dev)
+{
+ int learning_mode = dev->learning_enabled;
+
+ ene_dbg("RX: setup receiver, learning mode = %d", learning_mode);
+
+ ene_enable_normal_receive(dev, 1);
+
+ /* old hardware doesn't support learning mode for sure */
+ if (dev->hw_revision <= ENE_HW_B)
+ return;
+
+ /* receiver not learning capable, still set gpio40 correctly */
+ if (!dev->hw_learning_and_tx_capable) {
+ ene_enable_gpio40_receive(dev, !dev->hw_gpio40_learning);
+ return;
+ }
+
+ /* enable learning mode */
+ if (learning_mode) {
+ ene_enable_gpio40_receive(dev, dev->hw_gpio40_learning);
+
+ /* fan input is not used for learning */
+ if (dev->hw_fan_as_normal_input)
+ ene_enable_fan_receive(dev, 0);
+
+ /* disable learning mode */
+ } else {
+ if (dev->hw_fan_as_normal_input) {
+ ene_enable_fan_receive(dev, 1);
+ ene_enable_normal_receive(dev, 0);
+ } else
+ ene_enable_gpio40_receive(dev,
+ !dev->hw_gpio40_learning);
+ }
+
+ /* set few additional settings for this mode */
+ ene_hw_write_reg_mask(dev, ENE_CIR_CONF1, learning_mode ?
+ ENE_CIR_CONF1_LEARN1 : 0, ENE_CIR_CONF1_LEARN1);
+
+ ene_hw_write_reg_mask(dev, ENE_CIR_CONF2, learning_mode ?
+ ENE_CIR_CONF2_LEARN2 : 0, ENE_CIR_CONF2_LEARN2);
+
+ if (dev->rx_fan_input_inuse) {
+ dev->props->rx_resolution = ENE_SAMPLE_PERIOD_FAN * 1000;
+
+ dev->props->timeout =
+ ENE_FAN_VALUE_MASK * ENE_SAMPLE_PERIOD_FAN * 1000;
+ } else {
+ dev->props->rx_resolution = sample_period * 1000;
+ dev->props->timeout = ENE_MAXGAP * 1000;
+ }
+}
+
+/* Enable the device for receive */
+static void ene_rx_enable(struct ene_device *dev)
+{
+ u8 reg_value;
+
+ if (dev->hw_revision < ENE_HW_C) {
+ ene_hw_write_reg(dev, ENEB_IRQ, dev->irq << 1);
+ ene_hw_write_reg(dev, ENEB_IRQ_UNK1, 0x01);
+ } else {
+ reg_value = ene_hw_read_reg(dev, ENEC_IRQ) & 0xF0;
+ reg_value |= ENEC_IRQ_UNK_EN;
+ reg_value &= ~ENEC_IRQ_STATUS;
+ reg_value |= (dev->irq & ENEC_IRQ_MASK);
+ ene_hw_write_reg(dev, ENEC_IRQ, reg_value);
+ ene_hw_write_reg(dev, ENE_TX_UNK1, 0x63);
+ }
+
+ ene_hw_write_reg(dev, ENE_CIR_CONF2, 0x00);
+ ene_rx_set_inputs(dev);
+
+ /* set sampling period */
+ ene_hw_write_reg(dev, ENE_CIR_SAMPLE_PERIOD, sample_period);
+
+ /* ack any pending irqs - just in case */
+ ene_irq_status(dev);
+
+ /* enable firmware bits */
+ ene_hw_write_reg_mask(dev, ENE_FW1,
+ ENE_FW1_ENABLE | ENE_FW1_IRQ,
+ ENE_FW1_ENABLE | ENE_FW1_IRQ);
+
+ /* enter idle mode */
+ ir_raw_event_set_idle(dev->idev, 1);
+ ir_raw_event_reset(dev->idev);
+
+}
+
+/* Disable the device receiver */
+static void ene_rx_disable(struct ene_device *dev)
+{
+ /* disable inputs */
+ ene_enable_normal_receive(dev, 0);
+
+ if (dev->hw_fan_as_normal_input)
+ ene_enable_fan_receive(dev, 0);
+
+ /* disable hardware IRQ and firmware flag */
+ ene_hw_write_reg_mask(dev, ENE_FW1, 0, ENE_FW1_ENABLE | ENE_FW1_IRQ);
+
+ ir_raw_event_set_idle(dev->idev, 1);
+ ir_raw_event_reset(dev->idev);
+}
+
+
+/* prepare transmission */
+static void ene_tx_prepare(struct ene_device *dev)
+{
+ u8 conf1;
+
+ conf1 = ene_hw_read_reg(dev, ENE_CIR_CONF1);
+ dev->saved_conf1 = conf1;
+
+ if (dev->hw_revision == ENE_HW_C)
+ conf1 &= ~ENE_CIR_CONF1_TX_CLEAR;
+
+ /* Enable TX engine */
+ conf1 |= ENE_CIR_CONF1_TX_ON;
+
+ /* Set carrier */
+ if (dev->tx_period) {
+
+ /* NOTE: duty cycle handling is just a guess, it might
+ not be aviable. Default values were tested */
+ int tx_period_in500ns = dev->tx_period * 2;
+
+ int tx_pulse_width_in_500ns =
+ tx_period_in500ns / (100 / dev->tx_duty_cycle);
+
+ if (!tx_pulse_width_in_500ns)
+ tx_pulse_width_in_500ns = 1;
+
+ ene_dbg("TX: pulse distance = %d * 500 ns", tx_period_in500ns);
+ ene_dbg("TX: pulse width = %d * 500 ns",
+ tx_pulse_width_in_500ns);
+
+ ene_hw_write_reg(dev, ENE_TX_PERIOD, ENE_TX_PERIOD_UNKBIT |
+ tx_period_in500ns);
+
+ ene_hw_write_reg(dev, ENE_TX_PERIOD_PULSE,
+ tx_pulse_width_in_500ns);
+
+ conf1 |= ENE_CIR_CONF1_TX_CARR;
+ } else
+ conf1 &= ~ENE_CIR_CONF1_TX_CARR;
+
+ ene_hw_write_reg(dev, ENE_CIR_CONF1, conf1);
+
+}
+
+/* end transmission */
+static void ene_tx_complete(struct ene_device *dev)
+{
+ ene_hw_write_reg(dev, ENE_CIR_CONF1, dev->saved_conf1);
+ dev->tx_buffer = NULL;
+}
+
+/* set transmit mask */
+static void ene_tx_hw_set_transmiter_mask(struct ene_device *dev)
+{
+ u8 txport1 = ene_hw_read_reg(dev, ENE_TX_PORT1) & ~ENE_TX_PORT1_EN;
+ u8 txport2 = ene_hw_read_reg(dev, ENE_TX_PORT2) & ~ENE_TX_PORT2_EN;
+
+ if (dev->transmitter_mask & 0x01)
+ txport1 |= ENE_TX_PORT1_EN;
+
+ if (dev->transmitter_mask & 0x02)
+ txport2 |= ENE_TX_PORT2_EN;
+
+ ene_hw_write_reg(dev, ENE_TX_PORT1, txport1);
+ ene_hw_write_reg(dev, ENE_TX_PORT2, txport2);
+}
+
+/* TX one sample - must be called with dev->hw_lock*/
+static void ene_tx_sample(struct ene_device *dev)
+{
+ u8 raw_tx;
+ u32 sample;
+
+ if (!dev->tx_buffer) {
+ ene_dbg("TX: attempt to transmit NULL buffer");
+ return;
+ }
+
+ /* Grab next TX sample */
+ if (!dev->tx_sample) {
+again:
+ if (dev->tx_pos == dev->tx_len + 1) {
+ if (!dev->tx_done) {
+ ene_dbg("TX: no more data to send");
+ dev->tx_done = 1;
+ goto exit;
+ } else {
+ ene_dbg("TX: last sample sent by hardware");
+ ene_tx_complete(dev);
+ complete(&dev->tx_complete);
+ return;
+ }
+ }
+
+ sample = dev->tx_buffer[dev->tx_pos++];
+ dev->tx_sample_pulse = !dev->tx_sample_pulse;
+
+ ene_dbg("TX: sample %8d (%s)", sample, dev->tx_sample_pulse ?
+ "pulse" : "space");
+
+ dev->tx_sample = DIV_ROUND_CLOSEST(sample, ENE_TX_SMPL_PERIOD);
+
+ /* guard against too short samples */
+ if (!dev->tx_sample)
+ goto again;
+ }
+
+ raw_tx = min(dev->tx_sample , (unsigned int)ENE_TX_SMLP_MASK);
+ dev->tx_sample -= raw_tx;
+
+ if (dev->tx_sample_pulse)
+ raw_tx |= ENE_TX_PULSE_MASK;
+
+ ene_hw_write_reg(dev, ENE_TX_INPUT1 + dev->tx_reg, raw_tx);
+ dev->tx_reg = !dev->tx_reg;
+exit:
+ /* simulate TX done interrupt */
+ if (txsim)
+ mod_timer(&dev->tx_sim_timer, jiffies + HZ / 500);
+}
+
+/* timer to simulate tx done interrupt */
+static void ene_tx_irqsim(unsigned long data)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ ene_tx_sample(dev);
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+
+/* read irq status and ack it */
+static int ene_irq_status(struct ene_device *dev)
+{
+ u8 irq_status;
+ u8 fw_flags1, fw_flags2;
+ int cur_rx_pointer;
+ int retval = 0;
+
+ fw_flags2 = ene_hw_read_reg(dev, ENE_FW2);
+ cur_rx_pointer = !!(fw_flags2 & ENE_FW2_BUF_HIGH);
+
+ if (dev->hw_revision < ENE_HW_C) {
+ irq_status = ene_hw_read_reg(dev, ENEB_IRQ_STATUS);
+
+ if (!(irq_status & ENEB_IRQ_STATUS_IR))
+ return 0;
+
+ ene_hw_write_reg(dev, ENEB_IRQ_STATUS,
+ irq_status & ~ENEB_IRQ_STATUS_IR);
+ dev->rx_pointer = cur_rx_pointer;
+ return ENE_IRQ_RX;
+ }
+
+ irq_status = ene_hw_read_reg(dev, ENEC_IRQ);
+
+ if (!(irq_status & ENEC_IRQ_STATUS))
+ return 0;
+
+ /* original driver does that twice - a workaround ? */
+ ene_hw_write_reg(dev, ENEC_IRQ, irq_status & ~ENEC_IRQ_STATUS);
+ ene_hw_write_reg(dev, ENEC_IRQ, irq_status & ~ENEC_IRQ_STATUS);
+
+ /* clear unknown flag in F8F9 */
+ if (fw_flags2 & ENE_FW2_IRQ_CLR)
+ ene_hw_write_reg(dev, ENE_FW2, fw_flags2 & ~ENE_FW2_IRQ_CLR);
+
+ /* check if this is a TX interrupt */
+ fw_flags1 = ene_hw_read_reg(dev, ENE_FW1);
+ if (fw_flags1 & ENE_FW1_TXIRQ) {
+ ene_hw_write_reg(dev, ENE_FW1, fw_flags1 & ~ENE_FW1_TXIRQ);
+ retval |= ENE_IRQ_TX;
+ }
+
+ /* Check if this is RX interrupt */
+ if (dev->rx_pointer != cur_rx_pointer) {
+ retval |= ENE_IRQ_RX;
+ dev->rx_pointer = cur_rx_pointer;
+
+ } else if (!(retval & ENE_IRQ_TX)) {
+ ene_dbg("RX: interrupt without change in RX pointer(%d)",
+ dev->rx_pointer);
+ retval |= ENE_IRQ_RX;
+ }
+
+ if ((retval & ENE_IRQ_RX) && (retval & ENE_IRQ_TX))
+ ene_dbg("both RX and TX interrupt at same time");
+
+ return retval;
+}
+
+/* interrupt handler */
+static irqreturn_t ene_isr(int irq, void *data)
+{
+ u16 hw_value;
+ int i, hw_sample;
+ int pulse;
+ int irq_status;
+ unsigned long flags;
+ int carrier = 0;
+ irqreturn_t retval = IRQ_NONE;
+ struct ene_device *dev = (struct ene_device *)data;
+ struct ir_raw_event ev;
+
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ irq_status = ene_irq_status(dev);
+
+ if (!irq_status)
+ goto unlock;
+
+ retval = IRQ_HANDLED;
+
+ if (irq_status & ENE_IRQ_TX) {
+
+ if (!dev->hw_learning_and_tx_capable) {
+ ene_dbg("TX interrupt on unsupported device!");
+ goto unlock;
+ }
+ ene_tx_sample(dev);
+ }
+
+ if (!(irq_status & ENE_IRQ_RX))
+ goto unlock;
+
+
+ if (dev->learning_enabled)
+ carrier = ene_rx_sense_carrier(dev);
+#if 0
+ /* TODO */
+ if (dev->learning_enabled && carrier)
+ ir_raw_event_report_frequency(dev->idev, carrier);
+#endif
+
+ for (i = 0; i < ENE_SAMPLES_SIZE; i++) {
+ hw_value = ene_hw_read_reg(dev,
+ ENE_SAMPLE_BUFFER + dev->rx_pointer * 4 + i);
+
+ if (dev->rx_fan_input_inuse) {
+ /* read high part of the sample */
+ hw_value |= ene_hw_read_reg(dev,
+ ENE_SAMPLE_BUFFER_FAN +
+ dev->rx_pointer * 4 + i) << 8;
+ pulse = hw_value & ENE_FAN_SMPL_PULS_MSK;
+
+ /* clear space bit, and other unused bits */
+ hw_value &= ENE_FAN_VALUE_MASK;
+ hw_sample = hw_value * ENE_SAMPLE_PERIOD_FAN;
+
+ } else {
+ pulse = !(hw_value & ENE_SAMPLE_SPC_MASK);
+ hw_value &= ENE_SAMPLE_VALUE_MASK;
+ hw_sample = hw_value * sample_period;
+
+ if (error_adjustment && error_adjustment < 100) {
+ hw_sample *= (100 - error_adjustment);
+ hw_sample /= 100;
+ }
+ }
+ /* no more data */
+ if (!(hw_value))
+ break;
+
+ ene_dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space");
+
+
+ ev.duration = hw_sample * 1000;
+ ev.pulse = pulse;
+ ir_raw_event_store_with_filter(dev->idev, &ev);
+ }
+
+ ir_raw_event_handle(dev->idev);
+unlock:
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+ return retval;
+}
+
+/* Initialize default settings */
+static void ene_setup_settings(struct ene_device *dev)
+{
+ dev->tx_period = 32;
+ dev->tx_duty_cycle = 25; /*%*/
+ dev->transmitter_mask = 3;
+
+ /* Force learning mode if (input == 2), otherwise
+ let user set it with LIRC_SET_REC_CARRIER */
+ dev->learning_enabled =
+ (input == 2 && dev->hw_learning_and_tx_capable);
+
+ dev->rx_pointer = -1;
+
+}
+
+/* outside interface: called on first open*/
+static int ene_open(void *data)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ dev->in_use = 1;
+ ene_setup_settings(dev);
+ ene_rx_enable(dev);
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+ return 0;
+}
+
+/* outside interface: called on device close*/
+static void ene_close(void *data)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+ spin_lock_irqsave(&dev->hw_lock, flags);
+
+ ene_rx_disable(dev);
+ dev->in_use = 0;
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+/* outside interface: set transmitter mask */
+static int ene_set_tx_mask(void *data, u32 tx_mask)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+ ene_dbg("TX: attempt to set transmitter mask %02x", tx_mask);
+
+ /* invalid txmask */
+ if (!tx_mask || tx_mask & ~0x3) {
+ ene_dbg("TX: invalid mask");
+ /* return count of transmitters */
+ return 2;
+ }
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ dev->transmitter_mask = tx_mask;
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+ return 0;
+}
+
+/* outside interface : set tx carrier */
+static int ene_set_tx_carrier(void *data, u32 carrier)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+ u32 period = 1000000 / carrier; /* (1 / freq) (* # usec in 1 sec) */
+
+ ene_dbg("TX: attempt to set tx carrier to %d kHz", carrier);
+
+ if (period && (period > ENE_TX_PERIOD_MAX ||
+ period < ENE_TX_PERIOD_MIN)) {
+
+ ene_dbg("TX: out of range %d-%d carrier, "
+ "falling back to 32 kHz",
+ 1000 / ENE_TX_PERIOD_MIN,
+ 1000 / ENE_TX_PERIOD_MAX);
+
+ period = 32; /* this is just a coincidence!!! */
+ }
+ ene_dbg("TX: set carrier to %d kHz", carrier);
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ dev->tx_period = period;
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+ return 0;
+}
+
+
+/* outside interface: enable learning mode */
+static int ene_set_learning_mode(void *data, int enable)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+ if (enable == dev->learning_enabled)
+ return 0;
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ dev->learning_enabled = enable;
+ ene_rx_set_inputs(dev);
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+ return 0;
+}
+
+/* outside interface: set rec carrier */
+static int ene_set_rec_carrier(void *data, u32 min, u32 max)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ ene_set_learning_mode(dev,
+ max > ENE_NORMAL_RX_HI || min < ENE_NORMAL_RX_LOW);
+ return 0;
+}
+
+/* outside interface: enable or disable idle mode */
+static void ene_rx_set_idle(void *data, int idle)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ ene_dbg("%sabling idle mode", idle ? "en" : "dis");
+
+ ene_hw_write_reg_mask(dev, ENE_CIR_SAMPLE_PERIOD,
+ (enable_idle && idle) ? 0 : ENE_CIR_SAMPLE_OVERFLOW,
+ ENE_CIR_SAMPLE_OVERFLOW);
+}
+
+
+/* outside interface: transmit */
+static int ene_transmit(void *data, int *buf, u32 n)
+{
+ struct ene_device *dev = (struct ene_device *)data;
+ unsigned long flags;
+
+ dev->tx_buffer = buf;
+ dev->tx_len = n / sizeof(int);
+ dev->tx_pos = 0;
+ dev->tx_reg = 0;
+ dev->tx_done = 0;
+ dev->tx_sample = 0;
+ dev->tx_sample_pulse = 0;
+
+ ene_dbg("TX: %d samples", dev->tx_len);
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+
+ ene_tx_hw_set_transmiter_mask(dev);
+ ene_tx_prepare(dev);
+
+ /* Transmit first two samples */
+ ene_tx_sample(dev);
+ ene_tx_sample(dev);
+
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+
+ if (wait_for_completion_timeout(&dev->tx_complete, 2 * HZ) == 0) {
+ ene_dbg("TX: timeout");
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ ene_tx_complete(dev);
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+ } else
+ ene_dbg("TX: done");
+ return n;
+}
+
+
+/* probe entry */
+static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
+{
+ int error = -ENOMEM;
+ struct ir_dev_props *ir_props;
+ struct input_dev *input_dev;
+ struct ene_device *dev;
+
+ /* allocate memory */
+ input_dev = input_allocate_device();
+ ir_props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL);
+ dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);
+
+ if (!input_dev || !ir_props || !dev)
+ goto error;
+
+ /* validate resources */
+ error = -ENODEV;
+
+ if (!pnp_port_valid(pnp_dev, 0) ||
+ pnp_port_len(pnp_dev, 0) < ENE_MAX_IO)
+ goto error;
+
+ if (!pnp_irq_valid(pnp_dev, 0))
+ goto error;
+
+ dev->hw_io = pnp_port_start(pnp_dev, 0);
+ dev->irq = pnp_irq(pnp_dev, 0);
+ spin_lock_init(&dev->hw_lock);
+
+ /* claim the resources */
+ error = -EBUSY;
+ if (!request_region(dev->hw_io, ENE_MAX_IO, ENE_DRIVER_NAME))
+ goto error;
+
+ if (request_irq(dev->irq, ene_isr,
+ IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev))
+ goto error;
+
+ pnp_set_drvdata(pnp_dev, dev);
+ dev->pnp_dev = pnp_dev;
+
+ /* detect hardware version and features */
+ error = ene_hw_detect(dev);
+ if (error)
+ goto error;
+
+ ene_setup_settings(dev);
+
+ if (!dev->hw_learning_and_tx_capable && txsim) {
+ dev->hw_learning_and_tx_capable = 1;
+ setup_timer(&dev->tx_sim_timer, ene_tx_irqsim,
+ (long unsigned int)dev);
+ ene_printk(KERN_WARNING,
+ "Simulation of TX activated\n");
+ }
+
+ ir_props->driver_type = RC_DRIVER_IR_RAW;
+ ir_props->allowed_protos = IR_TYPE_ALL;
+ ir_props->priv = dev;
+ ir_props->open = ene_open;
+ ir_props->close = ene_close;
+ ir_props->min_timeout = ENE_MINGAP * 1000;
+ ir_props->max_timeout = ENE_MAXGAP * 1000;
+ ir_props->timeout = ENE_MAXGAP * 1000;
+
+ if (dev->hw_revision == ENE_HW_B)
+ ir_props->s_idle = ene_rx_set_idle;
+
+
+ dev->props = ir_props;
+ dev->idev = input_dev;
+
+ /* don't allow too short/long sample periods */
+ if (sample_period < 5 || sample_period > 0x7F)
+ sample_period = -1;
+
+ /* choose default sample period */
+ if (sample_period == -1) {
+
+ sample_period = 50;
+
+ /* on revB, hardware idle mode eats first sample
+ if we set too low sample period */
+ if (dev->hw_revision == ENE_HW_B && enable_idle)
+ sample_period = 75;
+ }
+
+ ir_props->rx_resolution = sample_period * 1000;
+
+ if (dev->hw_learning_and_tx_capable) {
+
+ ir_props->s_learning_mode = ene_set_learning_mode;
+
+ if (input == 0)
+ ir_props->s_rx_carrier_range = ene_set_rec_carrier;
+
+ init_completion(&dev->tx_complete);
+ ir_props->tx_ir = ene_transmit;
+ ir_props->s_tx_mask = ene_set_tx_mask;
+ ir_props->s_tx_carrier = ene_set_tx_carrier;
+ ir_props->tx_resolution = ENE_TX_SMPL_PERIOD * 1000;
+ }
+
+
+ device_set_wakeup_capable(&pnp_dev->dev, 1);
+ device_set_wakeup_enable(&pnp_dev->dev, 1);
+
+ if (dev->hw_learning_and_tx_capable)
+ input_dev->name = "ENE eHome Infrared Remote Transceiver";
+ else
+ input_dev->name = "ENE eHome Infrared Remote Receiver";
+
+
+ error = -ENODEV;
+ if (ir_input_register(input_dev, RC_MAP_RC6_MCE, ir_props,
+ ENE_DRIVER_NAME))
+ goto error;
+
+
+ ene_printk(KERN_NOTICE, "driver has been succesfully loaded\n");
+ return 0;
+error:
+ if (dev->irq)
+ free_irq(dev->irq, dev);
+ if (dev->hw_io)
+ release_region(dev->hw_io, ENE_MAX_IO);
+
+ input_free_device(input_dev);
+ kfree(ir_props);
+ kfree(dev);
+ return error;
+}
+
+/* main unload function */
+static void ene_remove(struct pnp_dev *pnp_dev)
+{
+ struct ene_device *dev = pnp_get_drvdata(pnp_dev);
+ unsigned long flags;
+
+ spin_lock_irqsave(&dev->hw_lock, flags);
+ ene_rx_disable(dev);
+ spin_unlock_irqrestore(&dev->hw_lock, flags);
+
+ free_irq(dev->irq, dev);
+ release_region(dev->hw_io, ENE_MAX_IO);
+ ir_input_unregister(dev->idev);
+ kfree(dev->props);
+ kfree(dev);
+}
+
+/* enable wake on IR (wakes on specific button on original remote) */
+static void ene_enable_wake(struct ene_device *dev, int enable)
+{
+ enable = enable && device_may_wakeup(&dev->pnp_dev->dev);
+
+ ene_dbg("wake on IR %s", enable ? "enabled" : "disabled");
+
+ ene_hw_write_reg_mask(dev, ENE_FW1, enable ?
+ ENE_FW1_WAKE : 0, ENE_FW1_WAKE);
+}
+
+#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_enable_wake(dev, 1);
+ 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_rx_enable(dev);
+
+ ene_enable_wake(dev, 0);
+ return 0;
+}
+#endif
+
+static void ene_shutdown(struct pnp_dev *pnp_dev)
+{
+ struct ene_device *dev = pnp_get_drvdata(pnp_dev);
+ ene_enable_wake(dev, 1);
+}
+
+static const struct pnp_device_id ene_ids[] = {
+ {.id = "ENE0100",},
+ {.id = "ENE0200",},
+ {.id = "ENE0201",},
+ {},
+};
+
+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
+ .shutdown = ene_shutdown,
+};
+
+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,
+ "Enables turning off signal sampling after long inactivity time; "
+ "if disabled might help detecting input signal (default: enabled)"
+ " (KB3926B only)");
+
+module_param(input, bool, S_IRUGO);
+MODULE_PARM_DESC(input, "select which input to use "
+ "0 - auto, 1 - standard, 2 - wideband(KB3926C+)");
+
+module_param(debug, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(debug, "Enable debug (debug=2 verbose debug output)");
+
+module_param(txsim, bool, S_IRUGO);
+MODULE_PARM_DESC(txsim,
+ "Simulate TX features on unsupported hardware (dangerous)");
+
+
+module_param(error_adjustment, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(error_adjustment,
+ "Correct incoming samples by error_adjustment percent\n"
+ "A default value of 4% seems to help with signal decoding");
+
+
+
+
+MODULE_DEVICE_TABLE(pnp, ene_ids);
+MODULE_DESCRIPTION
+ ("Infrared input driver for KB3926B/KB3926C/KB3926D "
+ "(aka ENE0100/ENE0200/ENE0201) CIR port");
+
+MODULE_AUTHOR("Maxim Levitsky");
+MODULE_LICENSE("GPL");
+
+module_init(ene_init);
+module_exit(ene_exit);
diff --git a/drivers/media/IR/ene_ir.h b/drivers/media/IR/ene_ir.h
new file mode 100644
index 0000000..63e5138
--- /dev/null
+++ b/drivers/media/IR/ene_ir.h
@@ -0,0 +1,228 @@
+/*
+ * driver for ENE KB3926 B/C/D CIR (also known as ENE0XXX)
+ *
+ * Copyright (C) 2010 Maxim Levitsky <maximlevitsky@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/spinlock.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 4
+
+/* 8 bytes of samples, divided in 2 halfs*/
+#define ENE_SAMPLE_BUFFER 0xF8F0 /* regular sample buffer */
+#define ENE_SAMPLE_SPC_MASK 0x80 /* sample is space */
+#define ENE_SAMPLE_VALUE_MASK 0x7F
+#define ENE_SAMPLE_OVERFLOW 0x7F
+#define ENE_SAMPLES_SIZE 4
+
+/* fan input sample buffer */
+#define ENE_SAMPLE_BUFFER_FAN 0xF8FB /* this buffer holds high byte of */
+ /* each sample of normal buffer */
+#define ENE_FAN_SMPL_PULS_MSK 0x8000 /* this bit of combined sample */
+ /* if set, says that sample is pulse */
+#define ENE_FAN_VALUE_MASK 0x0FFF /* mask for valid bits of the value */
+
+/* first firmware register */
+#define ENE_FW1 0xF8F8
+#define ENE_FW1_ENABLE 0x01 /* enable fw processing */
+#define ENE_FW1_TXIRQ 0x02 /* TX interrupt pending */
+#define ENE_FW1_WAKE 0x40 /* enable wake from S3 */
+#define ENE_FW1_IRQ 0x80 /* enable interrupt */
+
+/* second firmware register */
+#define ENE_FW2 0xF8F9
+#define ENE_FW2_BUF_HIGH 0x01 /* which half of the buffer to read */
+#define ENE_FW2_IRQ_CLR 0x04 /* clear this on IRQ */
+#define ENE_FW2_GP40_AS_LEARN 0x08 /* normal input is used as */
+ /* learning input */
+#define ENE_FW2_FAN_AS_NRML_IN 0x40 /* fan is used as normal input */
+#define ENE_FW2_LEARNING 0x80 /* hardware supports learning and TX */
+
+/* transmitter ports */
+#define ENE_TX_PORT2 0xFC01 /* this enables one or both */
+#define ENE_TX_PORT2_EN 0x20 /* TX ports */
+#define ENE_TX_PORT1 0xFC08
+#define ENE_TX_PORT1_EN 0x02
+
+/* IRQ registers block (for revision B) */
+#define ENEB_IRQ 0xFD09 /* IRQ number */
+#define ENEB_IRQ_UNK1 0xFD17 /* unknown setting = 1 */
+#define ENEB_IRQ_STATUS 0xFD80 /* irq status */
+#define ENEB_IRQ_STATUS_IR 0x20 /* IR irq */
+
+/* fan as input settings - only if learning capable */
+#define ENE_FAN_AS_IN1 0xFE30 /* fan init reg 1 */
+#define ENE_FAN_AS_IN1_EN 0xCD
+#define ENE_FAN_AS_IN2 0xFE31 /* fan init reg 2 */
+#define ENE_FAN_AS_IN2_EN 0x03
+#define ENE_SAMPLE_PERIOD_FAN 61 /* fan input has fixed sample period */
+
+/* IRQ registers block (for revision C,D) */
+#define ENEC_IRQ 0xFE9B /* new irq settings register */
+#define ENEC_IRQ_MASK 0x0F /* irq number mask */
+#define ENEC_IRQ_UNK_EN 0x10 /* always enabled */
+#define ENEC_IRQ_STATUS 0x20 /* irq status and ACK */
+
+/* CIR block settings */
+#define ENE_CIR_CONF1 0xFEC0
+#define ENE_CIR_CONF1_TX_CLEAR 0x01 /* clear that on revC */
+ /* while transmitting */
+#define ENE_CIR_CONF1_RX_ON 0x07 /* normal receiver enabled */
+#define ENE_CIR_CONF1_LEARN1 0x08 /* enabled on learning mode */
+#define ENE_CIR_CONF1_TX_ON 0x30 /* enabled on transmit */
+#define ENE_CIR_CONF1_TX_CARR 0x80 /* send TX carrier or not */
+
+#define ENE_CIR_CONF2 0xFEC1 /* unknown setting = 0 */
+#define ENE_CIR_CONF2_LEARN2 0x10 /* set on enable learning */
+#define ENE_CIR_CONF2_GPIO40DIS 0x20 /* disable input via gpio40 */
+
+#define ENE_CIR_SAMPLE_PERIOD 0xFEC8 /* sample period in us */
+#define ENE_CIR_SAMPLE_OVERFLOW 0x80 /* interrupt on overflows if set */
+
+
+/* Two byte tx buffer */
+#define ENE_TX_INPUT1 0xFEC9
+#define ENE_TX_INPUT2 0xFECA
+#define ENE_TX_PULSE_MASK 0x80 /* Transmitted sample is pulse */
+#define ENE_TX_SMLP_MASK 0x7F
+#define ENE_TX_SMPL_PERIOD 50 /* transmit sample period - fixed */
+
+
+/* Unknown TX setting - TX sample period ??? */
+#define ENE_TX_UNK1 0xFECB /* set to 0x63 */
+
+/* Current received carrier period */
+#define ENE_RX_CARRIER 0xFECC /* RX period (500 ns) */
+#define ENE_RX_CARRIER_VALID 0x80 /* Register content valid */
+
+
+/* TX period (1/carrier) */
+#define ENE_TX_PERIOD 0xFECE /* TX period (500 ns) */
+#define ENE_TX_PERIOD_UNKBIT 0x80 /* This bit set on transmit*/
+#define ENE_TX_PERIOD_PULSE 0xFECF /* TX pulse period (500 ns)*/
+
+/* Hardware versions */
+#define ENE_HW_VERSION 0xFF00 /* hardware revision */
+#define ENE_HW_UNK 0xFF1D
+#define ENE_HW_UNK_CLR 0x04
+#define ENE_HW_VER_MAJOR 0xFF1E /* chip version */
+#define ENE_HW_VER_MINOR 0xFF1F
+#define ENE_HW_VER_OLD 0xFD00
+
+/* Normal/Learning carrier ranges - only valid if we have learning input*/
+/* TODO: test */
+#define ENE_NORMAL_RX_LOW 34
+#define ENE_NORMAL_RX_HI 38
+
+/* Tx carrier range */
+/* Hardware might be able to do more, but this range is enough for
+ all purposes */
+#define ENE_TX_PERIOD_MAX 32 /* corresponds to 29.4 kHz */
+#define ENE_TX_PERIOD_MIN 16 /* corrsponds to 62.5 kHz */
+
+
+
+/* Minimal and maximal gaps */
+
+/* Normal case:
+ Minimal gap is 0x7F * sample period
+ Maximum gap depends on hardware.
+ For KB3926B, it is unlimited, for newer models its around
+ 250000, after which HW stops sending samples, and that is
+ not possible to change */
+
+/* Fan case:
+ Both minimal and maximal gaps are same, and equal to 0xFFF * 0x61
+ And there is nothing to change this setting
+*/
+
+#define ENE_MAXGAP 250000
+#define ENE_MINGAP (127 * sample_period)
+
+/******************************************************************************/
+
+#define ENE_DRIVER_NAME "ene_ir"
+
+#define ENE_IRQ_RX 1
+#define ENE_IRQ_TX 2
+
+#define ENE_HW_B 1 /* 3926B */
+#define ENE_HW_C 2 /* 3926C */
+#define ENE_HW_D 3 /* 3926D */
+
+#define ene_printk(level, text, ...) \
+ printk(level ENE_DRIVER_NAME ": " text, ## __VA_ARGS__)
+
+#define ene_dbg(text, ...) \
+ if (debug) \
+ printk(KERN_DEBUG \
+ ENE_DRIVER_NAME ": " text "\n" , ## __VA_ARGS__)
+
+#define ene_dbg_verbose(text, ...) \
+ if (debug > 1) \
+ printk(KERN_DEBUG \
+ ENE_DRIVER_NAME ": " text "\n" , ## __VA_ARGS__)
+
+
+struct ene_device {
+ struct pnp_dev *pnp_dev;
+ struct input_dev *idev;
+ struct ir_dev_props *props;
+ int in_use;
+
+ /* hw IO settings */
+ unsigned long hw_io;
+ int irq;
+ spinlock_t hw_lock;
+
+ /* HW features */
+ int hw_revision; /* hardware revision */
+ int hw_learning_and_tx_capable; /* learning capable */
+ int hw_gpio40_learning; /* gpio40 is learning */
+ int hw_fan_as_normal_input; /* fan input is used as */
+ /* regular input */
+ /* HW state*/
+ int rx_pointer; /* hw pointer to rx buffer */
+ int rx_fan_input_inuse; /* is fan input in use for rx*/
+ int tx_reg; /* current reg used for TX */
+ u8 saved_conf1; /* saved FEC0 reg */
+ int learning_enabled; /* learning input enabled */
+
+ /* TX sample handling */
+ unsigned int tx_sample; /* current sample for TX */
+ int tx_sample_pulse; /* current sample is pulse */
+
+ /* TX buffer */
+ int *tx_buffer; /* input samples buffer*/
+ int tx_pos; /* position in that bufer */
+ int tx_len; /* current len of tx buffer */
+ int tx_done; /* done transmitting */
+ /* one more sample pending*/
+ struct completion tx_complete; /* TX completion */
+ struct timer_list tx_sim_timer;
+
+ /*settings */
+ int tx_period;
+ int tx_duty_cycle;
+ int transmitter_mask;
+};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 9/9] STAGING: remove ENE driver.
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
` (7 preceding siblings ...)
2010-07-28 15:14 ` [PATCH 8/9] IR: Add ENE input driver Maxim Levitsky
@ 2010-07-28 15:14 ` Maxim Levitsky
8 siblings, 0 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 15:14 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Maxim Levitsky
Now there is ported version of this driver, staging version is redundand and obsolete
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/staging/lirc/Kconfig | 8 -
drivers/staging/lirc/Makefile | 1 -
drivers/staging/lirc/lirc_ene0100.c | 646 -----------------------------------
drivers/staging/lirc/lirc_ene0100.h | 169 ---------
4 files changed, 0 insertions(+), 824 deletions(-)
delete mode 100644 drivers/staging/lirc/lirc_ene0100.c
delete mode 100644 drivers/staging/lirc/lirc_ene0100.h
diff --git a/drivers/staging/lirc/Kconfig b/drivers/staging/lirc/Kconfig
index 968c2ad..d199165 100644
--- a/drivers/staging/lirc/Kconfig
+++ b/drivers/staging/lirc/Kconfig
@@ -17,14 +17,6 @@ config LIRC_BT829
help
Driver for the IR interface on BT829-based hardware
-config LIRC_ENE0100
- tristate "ENE KB3924/ENE0100 CIR Port Reciever"
- depends on LIRC_STAGING
- 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_STAGING
diff --git a/drivers/staging/lirc/Makefile b/drivers/staging/lirc/Makefile
index a019182..7011d6c 100644
--- a/drivers/staging/lirc/Makefile
+++ b/drivers/staging/lirc/Makefile
@@ -4,7 +4,6 @@
# Each configuration option enables a list of files.
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
diff --git a/drivers/staging/lirc/lirc_ene0100.c b/drivers/staging/lirc/lirc_ene0100.c
deleted file mode 100644
index a152c52..0000000
--- a/drivers/staging/lirc/lirc_ene0100.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * driver for ENE KB3926 B/C/D CIR (also known as ENE0100)
- *
- * Copyright (C) 2009 Maxim Levitsky <maximlevitsky@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 <linux/sched.h>
-#include "lirc_ene0100.h"
-
-static int sample_period = 75;
-static int enable_idle = 1;
-static int enable_learning;
-
-static void ene_set_idle(struct ene_device *dev, int idle);
-static void ene_set_inputs(struct ene_device *dev, int enable);
-
-/* 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);
-}
-
-/* read irq status and ack it */
-static int ene_hw_irq_status(struct ene_device *dev, int *buffer_pointer)
-{
- u8 irq_status;
- u8 fw_flags1, fw_flags2;
-
- fw_flags2 = ene_hw_read_reg(dev, ENE_FW2);
-
- if (buffer_pointer)
- *buffer_pointer = 4 * (fw_flags2 & ENE_FW2_BUF_HIGH);
-
- if (dev->hw_revision < ENE_HW_C) {
- irq_status = ene_hw_read_reg(dev, ENEB_IRQ_STATUS);
-
- if (!(irq_status & ENEB_IRQ_STATUS_IR))
- return 0;
- ene_hw_write_reg(dev, ENEB_IRQ_STATUS,
- irq_status & ~ENEB_IRQ_STATUS_IR);
-
- /* rev B support only recieving */
- return ENE_IRQ_RX;
- }
-
- irq_status = ene_hw_read_reg(dev, ENEC_IRQ);
-
- if (!(irq_status & ENEC_IRQ_STATUS))
- return 0;
-
- /* original driver does that twice - a workaround ? */
- ene_hw_write_reg(dev, ENEC_IRQ, irq_status & ~ENEC_IRQ_STATUS);
- ene_hw_write_reg(dev, ENEC_IRQ, irq_status & ~ENEC_IRQ_STATUS);
-
- /* clear unknown flag in F8F9 */
- if (fw_flags2 & ENE_FW2_IRQ_CLR)
- ene_hw_write_reg(dev, ENE_FW2, fw_flags2 & ~ENE_FW2_IRQ_CLR);
-
- /* check if this is a TX interrupt */
- fw_flags1 = ene_hw_read_reg(dev, ENE_FW1);
-
- if (fw_flags1 & ENE_FW1_TXIRQ) {
- ene_hw_write_reg(dev, ENE_FW1, fw_flags1 & ~ENE_FW1_TXIRQ);
- return ENE_IRQ_TX;
- } else
- return ENE_IRQ_RX;
-}
-
-static int ene_hw_detect(struct ene_device *dev)
-{
- u8 chip_major, chip_minor;
- u8 hw_revision, old_ver;
- u8 tmp;
- u8 fw_capabilities;
-
- tmp = ene_hw_read_reg(dev, ENE_HW_UNK);
- ene_hw_write_reg(dev, ENE_HW_UNK, tmp & ~ENE_HW_UNK_CLR);
-
- chip_major = ene_hw_read_reg(dev, ENE_HW_VER_MAJOR);
- chip_minor = ene_hw_read_reg(dev, ENE_HW_VER_MINOR);
-
- ene_hw_write_reg(dev, ENE_HW_UNK, tmp);
- hw_revision = ene_hw_read_reg(dev, ENE_HW_VERSION);
- old_ver = ene_hw_read_reg(dev, ENE_HW_VER_OLD);
-
- if (hw_revision == 0xFF) {
-
- ene_printk(KERN_WARNING, "device seems to be disabled\n");
- ene_printk(KERN_WARNING,
- "send a mail to lirc-list@lists.sourceforge.net\n");
- ene_printk(KERN_WARNING, "please attach output of acpidump\n");
-
- return -ENODEV;
- }
-
- if (chip_major == 0x33) {
- ene_printk(KERN_WARNING, "chips 0x33xx aren't supported yet\n");
- return -ENODEV;
- }
-
- if (chip_major == 0x39 && chip_minor == 0x26 && hw_revision == 0xC0) {
- dev->hw_revision = ENE_HW_C;
- ene_printk(KERN_WARNING,
- "KB3926C detected, driver support is not complete!\n");
-
- } else if (old_ver == 0x24 && hw_revision == 0xC0) {
- dev->hw_revision = ENE_HW_B;
- ene_printk(KERN_NOTICE, "KB3926B detected\n");
- } else {
- dev->hw_revision = ENE_HW_D;
- ene_printk(KERN_WARNING,
- "unknown ENE chip detected, assuming KB3926D\n");
- ene_printk(KERN_WARNING, "driver support incomplete");
-
- }
-
- ene_printk(KERN_DEBUG, "chip is 0x%02x%02x - 0x%02x, 0x%02x\n",
- chip_major, chip_minor, old_ver, hw_revision);
-
-
- /* detect features hardware supports */
-
- if (dev->hw_revision < ENE_HW_C)
- return 0;
-
- fw_capabilities = ene_hw_read_reg(dev, ENE_FW2);
-
- dev->hw_gpio40_learning = fw_capabilities & ENE_FW2_GP40_AS_LEARN;
- dev->hw_learning_and_tx_capable = fw_capabilities & ENE_FW2_LEARNING;
-
- dev->hw_fan_as_normal_input = dev->hw_learning_and_tx_capable &&
- fw_capabilities & ENE_FW2_FAN_AS_NRML_IN;
-
- ene_printk(KERN_NOTICE, "hardware features:\n");
- ene_printk(KERN_NOTICE,
- "learning and tx %s, gpio40_learn %s, fan_in %s\n",
- dev->hw_learning_and_tx_capable ? "on" : "off",
- dev->hw_gpio40_learning ? "on" : "off",
- dev->hw_fan_as_normal_input ? "on" : "off");
-
- if (!dev->hw_learning_and_tx_capable && enable_learning)
- enable_learning = 0;
-
- if (dev->hw_learning_and_tx_capable) {
- ene_printk(KERN_WARNING,
- "Device supports transmitting, but the driver doesn't\n");
- ene_printk(KERN_WARNING,
- "due to lack of hardware to test against.\n");
- ene_printk(KERN_WARNING,
- "Send a mail to: lirc-list@lists.sourceforge.net\n");
- }
- return 0;
-}
-
-/* hardware initialization */
-static int ene_hw_init(void *data)
-{
- u8 reg_value;
- struct ene_device *dev = (struct ene_device *)data;
- dev->in_use = 1;
-
- if (dev->hw_revision < ENE_HW_C) {
- ene_hw_write_reg(dev, ENEB_IRQ, dev->irq << 1);
- ene_hw_write_reg(dev, ENEB_IRQ_UNK1, 0x01);
- } else {
- reg_value = ene_hw_read_reg(dev, ENEC_IRQ) & 0xF0;
- reg_value |= ENEC_IRQ_UNK_EN;
- reg_value &= ~ENEC_IRQ_STATUS;
- reg_value |= (dev->irq & ENEC_IRQ_MASK);
- ene_hw_write_reg(dev, ENEC_IRQ, reg_value);
- ene_hw_write_reg(dev, ENE_TX_UNK1, 0x63);
- }
-
- ene_hw_write_reg(dev, ENE_CIR_CONF2, 0x00);
- ene_set_inputs(dev, enable_learning);
-
- /* set sampling period */
- ene_hw_write_reg(dev, ENE_CIR_SAMPLE_PERIOD, sample_period);
-
- /* ack any pending irqs - just in case */
- ene_hw_irq_status(dev, NULL);
-
- /* enter idle mode */
- ene_set_idle(dev, 1);
-
- /* enable firmware bits */
- ene_hw_write_reg_mask(dev, ENE_FW1,
- ENE_FW1_ENABLE | ENE_FW1_IRQ,
- ENE_FW1_ENABLE | ENE_FW1_IRQ);
- /* clear stats */
- dev->sample = 0;
- return 0;
-}
-
-/* this enables gpio40 signal, used if connected to wide band input*/
-static void ene_enable_gpio40(struct ene_device *dev, int enable)
-{
- ene_hw_write_reg_mask(dev, ENE_CIR_CONF1, enable ?
- 0 : ENE_CIR_CONF2_GPIO40DIS,
- ENE_CIR_CONF2_GPIO40DIS);
-}
-
-/* this enables the classic sampler */
-static void ene_enable_normal_recieve(struct ene_device *dev, int enable)
-{
- ene_hw_write_reg(dev, ENE_CIR_CONF1, enable ? ENE_CIR_CONF1_ADC_ON : 0);
-}
-
-/* this enables recieve via fan input */
-static void ene_enable_fan_recieve(struct ene_device *dev, int enable)
-{
- if (!enable)
- ene_hw_write_reg(dev, ENE_FAN_AS_IN1, 0);
- else {
- ene_hw_write_reg(dev, ENE_FAN_AS_IN1, ENE_FAN_AS_IN1_EN);
- ene_hw_write_reg(dev, ENE_FAN_AS_IN2, ENE_FAN_AS_IN2_EN);
- }
- dev->fan_input_inuse = enable;
-}
-
-/* determine which input to use*/
-static void ene_set_inputs(struct ene_device *dev, int learning_enable)
-{
- ene_enable_normal_recieve(dev, 1);
-
- /* old hardware doesn't support learning mode for sure */
- if (dev->hw_revision <= ENE_HW_B)
- return;
-
- /* reciever not learning capable, still set gpio40 correctly */
- if (!dev->hw_learning_and_tx_capable) {
- ene_enable_gpio40(dev, !dev->hw_gpio40_learning);
- return;
- }
-
- /* enable learning mode */
- if (learning_enable) {
- ene_enable_gpio40(dev, dev->hw_gpio40_learning);
-
- /* fan input is not used for learning */
- if (dev->hw_fan_as_normal_input)
- ene_enable_fan_recieve(dev, 0);
-
- /* disable learning mode */
- } else {
- if (dev->hw_fan_as_normal_input) {
- ene_enable_fan_recieve(dev, 1);
- ene_enable_normal_recieve(dev, 0);
- } else
- ene_enable_gpio40(dev, !dev->hw_gpio40_learning);
- }
-
- /* set few additional settings for this mode */
- ene_hw_write_reg_mask(dev, ENE_CIR_CONF1, learning_enable ?
- ENE_CIR_CONF1_LEARN1 : 0, ENE_CIR_CONF1_LEARN1);
-
- ene_hw_write_reg_mask(dev, ENE_CIR_CONF2, learning_enable ?
- ENE_CIR_CONF2_LEARN2 : 0, ENE_CIR_CONF2_LEARN2);
-}
-
-/* deinitialization */
-static void ene_hw_deinit(void *data)
-{
- struct ene_device *dev = (struct ene_device *)data;
-
- /* disable samplers */
- ene_enable_normal_recieve(dev, 0);
-
- if (dev->hw_fan_as_normal_input)
- ene_enable_fan_recieve(dev, 0);
-
- /* disable hardware IRQ and firmware flag */
- ene_hw_write_reg_mask(dev, ENE_FW1, 0, ENE_FW1_ENABLE | ENE_FW1_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;
- int disable = idle && enable_idle && (dev->hw_revision < ENE_HW_C);
-
- ene_hw_write_reg_mask(dev, ENE_CIR_SAMPLE_PERIOD,
- disable ? 0 : ENE_CIR_SAMPLE_OVERFLOW,
- ENE_CIR_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_value;
- int i, hw_sample;
- int space;
- int buffer_pointer;
- int irq_status;
-
- struct ene_device *dev = (struct ene_device *)data;
- irq_status = ene_hw_irq_status(dev, &buffer_pointer);
-
- if (!irq_status)
- return IRQ_NONE;
-
- /* TODO: only RX for now */
- if (irq_status == ENE_IRQ_TX)
- return IRQ_HANDLED;
-
- for (i = 0; i < ENE_SAMPLES_SIZE; i++) {
-
- hw_value = ene_hw_read_reg(dev,
- ENE_SAMPLE_BUFFER + buffer_pointer + i);
-
- if (dev->fan_input_inuse) {
- /* read high part of the sample */
- hw_value |= ene_hw_read_reg(dev,
- ENE_SAMPLE_BUFFER_FAN + buffer_pointer + i) << 8;
-
- /* test for _space_ bit */
- space = !(hw_value & ENE_FAN_SMPL_PULS_MSK);
-
- /* clear space bit, and other unused bits */
- hw_value &= ENE_FAN_VALUE_MASK;
- hw_sample = hw_value * ENE_SAMPLE_PERIOD_FAN;
-
- } else {
- space = hw_value & ENE_SAMPLE_SPC_MASK;
- hw_value &= ENE_SAMPLE_VALUE_MASK;
- hw_sample = hw_value * sample_period;
- }
-
- /* no more data */
- if (!(hw_value))
- break;
-
- if (space)
- hw_sample *= -1;
-
- /* overflow sample recieved, handle it */
-
- if (!dev->fan_input_inuse && 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->fan_input_inuse && 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 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);
-
-
- /* 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;
-
- /* validate resources */
- if (!pnp_port_valid(pnp_dev, 0) ||
- pnp_port_len(pnp_dev, 0) < ENE_MAX_IO)
- goto err6;
-
- if (!pnp_irq_valid(pnp_dev, 0))
- goto err6;
-
- dev->hw_io = pnp_port_start(pnp_dev, 0);
- dev->irq = pnp_irq(pnp_dev, 0);
-
- /* 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;
-
- /* detect hardware version and features */
- error = ene_hw_detect(dev);
- if (error)
- goto err8;
-
- ene_printk(KERN_NOTICE, "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
-
-/* TODO: make 'wake on IR' configurable and add .shutdown */
-/* currently impossible due to lack of kernel support */
-
-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_FW1, ENE_FW1_WAKE, ENE_FW1_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_FW1, 0, ENE_FW1_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)
-{
- if (sample_period < 5) {
- ene_printk(KERN_ERR, "sample period must be at\n");
- ene_printk(KERN_ERR, "least 5 us, (at least 30 recommended)\n");
- return -EINVAL;
- }
- 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 (75 us default)");
-
-module_param(enable_idle, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(enable_idle,
- "Enables turning off signal sampling after long inactivity time; "
- "if disabled might help detecting input signal (default: enabled)");
-
-module_param(enable_learning, bool, S_IRUGO);
-MODULE_PARM_DESC(enable_learning, "Use wide band (learning) reciever");
-
-MODULE_DEVICE_TABLE(pnp, ene_ids);
-MODULE_DESCRIPTION
- ("LIRC driver for KB3926B/KB3926C/KB3926D (aka ENE0100) CIR port");
-MODULE_AUTHOR("Maxim Levitsky");
-MODULE_LICENSE("GPL");
-
-module_init(ene_init);
-module_exit(ene_exit);
diff --git a/drivers/staging/lirc/lirc_ene0100.h b/drivers/staging/lirc/lirc_ene0100.h
deleted file mode 100644
index 825045d..0000000
--- a/drivers/staging/lirc/lirc_ene0100.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * driver for ENE KB3926 B/C/D CIR (also known as ENE0100)
- *
- * Copyright (C) 2009 Maxim Levitsky <maximlevitsky@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 <media/lirc.h>
-#include <media/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 4
-
-/* 8 bytes of samples, divided in 2 halfs*/
-#define ENE_SAMPLE_BUFFER 0xF8F0 /* regular sample buffer */
-#define ENE_SAMPLE_SPC_MASK (1 << 7) /* sample is space */
-#define ENE_SAMPLE_VALUE_MASK 0x7F
-#define ENE_SAMPLE_OVERFLOW 0x7F
-#define ENE_SAMPLES_SIZE 4
-
-/* fan input sample buffer */
-#define ENE_SAMPLE_BUFFER_FAN 0xF8FB /* this buffer holds high byte of */
- /* each sample of normal buffer */
-
-#define ENE_FAN_SMPL_PULS_MSK 0x8000 /* this bit of combined sample */
- /* if set, says that sample is pulse */
-#define ENE_FAN_VALUE_MASK 0x0FFF /* mask for valid bits of the value */
-
-/* first firmware register */
-#define ENE_FW1 0xF8F8
-#define ENE_FW1_ENABLE (1 << 0) /* enable fw processing */
-#define ENE_FW1_TXIRQ (1 << 1) /* TX interrupt pending */
-#define ENE_FW1_WAKE (1 << 6) /* enable wake from S3 */
-#define ENE_FW1_IRQ (1 << 7) /* enable interrupt */
-
-/* second firmware register */
-#define ENE_FW2 0xF8F9
-#define ENE_FW2_BUF_HIGH (1 << 0) /* which half of the buffer to read */
-#define ENE_FW2_IRQ_CLR (1 << 2) /* clear this on IRQ */
-#define ENE_FW2_GP40_AS_LEARN (1 << 4) /* normal input is used as */
- /* learning input */
-#define ENE_FW2_FAN_AS_NRML_IN (1 << 6) /* fan is used as normal input */
-#define ENE_FW2_LEARNING (1 << 7) /* hardware supports learning and TX */
-
-/* fan as input settings - only if learning capable */
-#define ENE_FAN_AS_IN1 0xFE30 /* fan init reg 1 */
-#define ENE_FAN_AS_IN1_EN 0xCD
-#define ENE_FAN_AS_IN2 0xFE31 /* fan init reg 2 */
-#define ENE_FAN_AS_IN2_EN 0x03
-#define ENE_SAMPLE_PERIOD_FAN 61 /* fan input has fixed sample period */
-
-/* IRQ registers block (for revision B) */
-#define ENEB_IRQ 0xFD09 /* IRQ number */
-#define ENEB_IRQ_UNK1 0xFD17 /* unknown setting = 1 */
-#define ENEB_IRQ_STATUS 0xFD80 /* irq status */
-#define ENEB_IRQ_STATUS_IR (1 << 5) /* IR irq */
-
-/* IRQ registers block (for revision C,D) */
-#define ENEC_IRQ 0xFE9B /* new irq settings register */
-#define ENEC_IRQ_MASK 0x0F /* irq number mask */
-#define ENEC_IRQ_UNK_EN (1 << 4) /* always enabled */
-#define ENEC_IRQ_STATUS (1 << 5) /* irq status and ACK */
-
-/* CIR block settings */
-#define ENE_CIR_CONF1 0xFEC0
-#define ENE_CIR_CONF1_ADC_ON 0x7 /* reciever on gpio40 enabled */
-#define ENE_CIR_CONF1_LEARN1 (1 << 3) /* enabled on learning mode */
-#define ENE_CIR_CONF1_TX_ON 0x30 /* enabled on transmit */
-#define ENE_CIR_CONF1_TX_CARR (1 << 7) /* send TX carrier or not */
-
-#define ENE_CIR_CONF2 0xFEC1 /* unknown setting = 0 */
-#define ENE_CIR_CONF2_LEARN2 (1 << 4) /* set on enable learning */
-#define ENE_CIR_CONF2_GPIO40DIS (1 << 5) /* disable normal input via gpio40 */
-
-#define ENE_CIR_SAMPLE_PERIOD 0xFEC8 /* sample period in us */
-#define ENE_CIR_SAMPLE_OVERFLOW (1 << 7) /* interrupt on overflows if set */
-
-
-/* transmitter - not implemented yet */
-/* KB3926C and higher */
-/* transmission is very similiar to recieving, a byte is written to */
-/* ENE_TX_INPUT, in same manner as it is read from sample buffer */
-/* sample period is fixed*/
-
-
-/* transmitter ports */
-#define ENE_TX_PORT1 0xFC01 /* this enables one or both */
-#define ENE_TX_PORT1_EN (1 << 5) /* TX ports */
-#define ENE_TX_PORT2 0xFC08
-#define ENE_TX_PORT2_EN (1 << 1)
-
-#define ENE_TX_INPUT 0xFEC9 /* next byte to transmit */
-#define ENE_TX_SPC_MASK (1 << 7) /* Transmitted sample is space */
-#define ENE_TX_UNK1 0xFECB /* set to 0x63 */
-#define ENE_TX_SMPL_PERIOD 50 /* transmit sample period */
-
-
-#define ENE_TX_CARRIER 0xFECE /* TX carrier * 2 (khz) */
-#define ENE_TX_CARRIER_UNKBIT 0x80 /* This bit set on transmit */
-#define ENE_TX_CARRIER_LOW 0xFECF /* TX carrier / 2 */
-
-/* Hardware versions */
-#define ENE_HW_VERSION 0xFF00 /* hardware revision */
-#define ENE_HW_UNK 0xFF1D
-#define ENE_HW_UNK_CLR (1 << 2)
-#define ENE_HW_VER_MAJOR 0xFF1E /* chip version */
-#define ENE_HW_VER_MINOR 0xFF1F
-#define ENE_HW_VER_OLD 0xFD00
-
-#define same_sign(a, b) ((((a) > 0) && (b) > 0) || ((a) < 0 && (b) < 0))
-
-#define ENE_DRIVER_NAME "enecir"
-#define ENE_MAXGAP 250000 /* this is amount of time we wait
- before turning the sampler, chosen
- arbitry */
-
-#define space(len) (-(len)) /* add a space */
-
-/* software defines */
-#define ENE_IRQ_RX 1
-#define ENE_IRQ_TX 2
-
-#define ENE_HW_B 1 /* 3926B */
-#define ENE_HW_C 2 /* 3926C */
-#define ENE_HW_D 3 /* 3926D */
-
-#define ene_printk(level, text, ...) \
- printk(level ENE_DRIVER_NAME ": " text, ## __VA_ARGS__)
-
-struct ene_device {
- struct pnp_dev *pnp_dev;
- struct lirc_driver *lirc_driver;
-
- /* hw settings */
- unsigned long hw_io;
- int irq;
-
- int hw_revision; /* hardware revision */
- int hw_learning_and_tx_capable; /* learning capable */
- int hw_gpio40_learning; /* gpio40 is learning */
- int hw_fan_as_normal_input; /* fan input is used as regular input */
-
- /* device data */
- int idle;
- int fan_input_inuse;
-
- int sample;
- int in_use;
-
- struct timeval gap_start;
-};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [PATCH 2/9] IR: minor fixes:
2010-07-28 15:14 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
@ 2010-07-28 16:01 ` Mauro Carvalho Chehab
2010-07-28 16:38 ` Maxim Levitsky
2010-07-28 17:23 ` Jarod Wilson
1 sibling, 1 reply; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 16:01 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> * lirc: Don't propagate reset event to userspace
> * lirc: Remove strange logic from lirc that would make first sample always be pulse
> * Make TO_US macro actualy print what it should.
>
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> ---
> drivers/media/IR/ir-core-priv.h | 3 +--
> drivers/media/IR/ir-lirc-codec.c | 14 ++++++++------
> drivers/media/IR/ir-raw-event.c | 3 +++
> 3 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
> index babd520..8ce80e4 100644
> --- a/drivers/media/IR/ir-core-priv.h
> +++ b/drivers/media/IR/ir-core-priv.h
> @@ -76,7 +76,6 @@ struct ir_raw_event_ctrl {
> struct lirc_codec {
> struct ir_input_dev *ir_dev;
> struct lirc_driver *drv;
> - int lircdata;
> } lirc;
> };
>
> @@ -104,7 +103,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration)
> ev->duration -= duration;
> }
>
> -#define TO_US(duration) (((duration) + 500) / 1000)
> +#define TO_US(duration) ((duration) / 1000)
It is better to keep rounding the duration to its closest value.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/9] IR: replace spinlock with mutex.
2010-07-28 15:14 ` [PATCH 3/9] IR: replace spinlock with mutex Maxim Levitsky
@ 2010-07-28 16:03 ` Mauro Carvalho Chehab
2010-07-28 16:32 ` Maxim Levitsky
0 siblings, 1 reply; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 16:03 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> Some handlers (lirc for example) allocates memory on initialization,
> doing so in atomic context is cumbersome.
> Fixes warning about sleeping function in atomic context.
You should not replace it by a mutex, as the decoding code may happen during
IRQ time on several drivers.
If lirc is allocating memory, it should be using GFP_ATOMIC to avoid sleeping.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed.
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
@ 2010-07-28 16:09 ` Mauro Carvalho Chehab
2010-07-28 16:29 ` Maxim Levitsky
2010-07-28 17:46 ` Jarod Wilson
1 sibling, 1 reply; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 16:09 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 12:14, Maxim Levitsky escreveu:
Please provide a smaller subject. Feel free to add a more detailed description, but
subjects longer then 74 bytes end by causing some troubles when using git commands.
It would be nice to have a good description on this patch, as it provides a method
for working around troubles found on problematic devices.
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> ---
> drivers/media/IR/ir-core-priv.h | 1 +
> drivers/media/IR/ir-keytable.c | 2 +-
> drivers/media/IR/ir-raw-event.c | 86 +++++++++++++++++++++++++++++++++++++++
> include/media/ir-core.h | 24 +++++++++-
> 4 files changed, 109 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
> index 8ce80e4..3eafdb7 100644
> --- a/drivers/media/IR/ir-core-priv.h
> +++ b/drivers/media/IR/ir-core-priv.h
> @@ -36,6 +36,7 @@ struct ir_raw_event_ctrl {
> struct kfifo kfifo; /* fifo for the pulse/space durations */
> ktime_t last_event; /* when last event occurred */
> enum raw_event_type last_type; /* last event type */
> + struct ir_raw_event current_sample; /* sample that is not yet pushed to fifo */
> struct input_dev *input_dev; /* pointer to the parent input_dev */
> u64 enabled_protocols; /* enabled raw protocol decoders */
>
> diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
> index 94a8577..34b9c07 100644
> --- a/drivers/media/IR/ir-keytable.c
> +++ b/drivers/media/IR/ir-keytable.c
> @@ -428,7 +428,7 @@ static void ir_close(struct input_dev *input_dev)
> */
> int __ir_input_register(struct input_dev *input_dev,
> const struct ir_scancode_table *rc_tab,
> - const struct ir_dev_props *props,
> + struct ir_dev_props *props,
> const char *driver_name)
> {
> struct ir_input_dev *ir_dev;
Hmm... why are you removing "const" from ir_dev_props? This change seems unrelated
with the patch description.
> diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
> index c6a80b3..bdf2ed8 100644
> --- a/drivers/media/IR/ir-raw-event.c
> +++ b/drivers/media/IR/ir-raw-event.c
> @@ -129,6 +129,92 @@ int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type typ
> EXPORT_SYMBOL_GPL(ir_raw_event_store_edge);
>
> /**
> + * ir_raw_event_store_with_filter() - pass next pulse/space to decoders with some processing
> + * @input_dev: the struct input_dev device descriptor
> + * @type: the type of the event that has occurred
> + *
> + * This routine (which may be called from an interrupt context) is used to
> + * store the beginning of an ir pulse or space (or the start/end of ir
> + * reception) for the raw ir decoding state machines.\
> + * This routine is intended for devices with limited internal buffer
> + * It automerges samples of same type, and handles timeouts
> + */
> +int ir_raw_event_store_with_filter(struct input_dev *input_dev,
> + struct ir_raw_event *ev)
> +{
> + struct ir_input_dev *ir = input_get_drvdata(input_dev);
> + struct ir_raw_event_ctrl *raw = ir->raw;
> +
> + if (!ir->raw || !ir->props)
> + return -EINVAL;
> +
> + /* Ignore spaces in idle mode */
> + if (ir->idle && !ev->pulse)
> + return 0;
> + else if (ir->idle)
> + ir_raw_event_set_idle(input_dev, 0);
> +
> + if (!raw->current_sample.duration) {
> + raw->current_sample = *ev;
> + } else if (ev->pulse == raw->current_sample.pulse) {
> + raw->current_sample.duration += ev->duration;
> + } else {
> + ir_raw_event_store(input_dev, &raw->current_sample);
> + raw->current_sample = *ev;
> + }
> +
> + /* Enter idle mode if nessesary */
> + if (!ev->pulse && ir->props->timeout &&
> + raw->current_sample.duration >= ir->props->timeout)
> + ir_raw_event_set_idle(input_dev, 1);
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter);
> +
> +
> +void ir_raw_event_set_idle(struct input_dev *input_dev, int idle)
> +{
> + struct ir_input_dev *ir = input_get_drvdata(input_dev);
> + struct ir_raw_event_ctrl *raw = ir->raw;
> + ktime_t now;
> + u64 delta;
> +
> + if (!ir->props)
> + return;
> +
> + if (!ir->raw)
> + goto out;
> +
> + if (idle) {
> + IR_dprintk(2, "enter idle mode\n");
> + raw->last_event = ktime_get();
> + } else {
> + IR_dprintk(2, "exit idle mode\n");
> +
> + now = ktime_get();
> + delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event));
> +
> + WARN_ON(raw->current_sample.pulse);
> +
> + raw->current_sample.duration =
> + min(raw->current_sample.duration + delta,
> + (u64)IR_MAX_DURATION);
> +
> + ir_raw_event_store(input_dev, &raw->current_sample);
> +
> + if (raw->current_sample.duration == IR_MAX_DURATION)
> + ir_raw_event_reset(input_dev);
> +
> + raw->current_sample.duration = 0;
> + }
> +out:
> + if (ir->props->s_idle)
> + ir->props->s_idle(ir->props->priv, idle);
> + ir->idle = idle;
> +}
> +EXPORT_SYMBOL_GPL(ir_raw_event_set_idle);
> +
> +/**
> * ir_raw_event_handle() - schedules the decoding of stored ir data
> * @input_dev: the struct input_dev device descriptor
> *
> diff --git a/include/media/ir-core.h b/include/media/ir-core.h
> index 513e60d..53ce966 100644
> --- a/include/media/ir-core.h
> +++ b/include/media/ir-core.h
> @@ -41,6 +41,9 @@ enum rc_driver_type {
> * anything with it. Yet, as the same keycode table can be used with other
> * devices, a mask is provided to allow its usage. Drivers should generally
> * leave this field in blank
> + * @timeout: optional time after which device stops sending data
> + * @min_timeout: minimum timeout supported by device
> + * @max_timeout: maximum timeout supported by device
> * @priv: driver-specific data, to be used on the callbacks
> * @change_protocol: allow changing the protocol used on hardware decoders
> * @open: callback to allow drivers to enable polling/irq when IR input device
> @@ -50,11 +53,19 @@ enum rc_driver_type {
> * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
> * @s_tx_carrier: set transmit carrier frequency
> * @tx_ir: transmit IR
> + * @s_idle: optional: enable/disable hardware idle mode, upon which,
> + device doesn't interrupt host untill it sees IR data
> */
> struct ir_dev_props {
> enum rc_driver_type driver_type;
> unsigned long allowed_protos;
> u32 scanmask;
> +
> + u64 timeout;
> + u64 min_timeout;
> + u64 max_timeout;
> +
> +
> void *priv;
> int (*change_protocol)(void *priv, u64 ir_type);
> int (*open)(void *priv);
> @@ -62,6 +73,7 @@ struct ir_dev_props {
> int (*s_tx_mask)(void *priv, u32 mask);
> int (*s_tx_carrier)(void *priv, u32 carrier);
> int (*tx_ir)(void *priv, int *txbuf, u32 n);
> + void (*s_idle) (void *priv, int enable);
> };
>
> struct ir_input_dev {
> @@ -69,9 +81,10 @@ struct ir_input_dev {
> char *driver_name; /* Name of the driver module */
> struct ir_scancode_table rc_tab; /* scan/key table */
> unsigned long devno; /* device number */
> - const struct ir_dev_props *props; /* Device properties */
> + struct ir_dev_props *props; /* Device properties */
> struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
> struct input_dev *input_dev; /* the input device associated with this device */
> + int idle;
>
> /* key info - needed by IR keycode handlers */
> spinlock_t keylock; /* protects the below members */
> @@ -95,12 +108,12 @@ enum raw_event_type {
> /* From ir-keytable.c */
> int __ir_input_register(struct input_dev *dev,
> const struct ir_scancode_table *ir_codes,
> - const struct ir_dev_props *props,
> + struct ir_dev_props *props,
> const char *driver_name);
>
> static inline int ir_input_register(struct input_dev *dev,
> const char *map_name,
> - const struct ir_dev_props *props,
> + struct ir_dev_props *props,
> const char *driver_name) {
> struct ir_scancode_table *ir_codes;
> struct ir_input_dev *ir_dev;
> @@ -144,6 +157,11 @@ struct ir_raw_event {
> void ir_raw_event_handle(struct input_dev *input_dev);
> int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
> int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
> +int ir_raw_event_store_with_filter(struct input_dev *input_dev,
> + struct ir_raw_event *ev);
> +
> +void ir_raw_event_set_idle(struct input_dev *input_dev, int idle);
> +
> static inline void ir_raw_event_reset(struct input_dev *input_dev)
> {
> struct ir_raw_event ev = { .pulse = false, .duration = 0 };
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed.
2010-07-28 16:09 ` Mauro Carvalho Chehab
@ 2010-07-28 16:29 ` Maxim Levitsky
0 siblings, 0 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 16:29 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
On Wed, 2010-07-28 at 13:09 -0300, Mauro Carvalho Chehab wrote:
> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
>
> Please provide a smaller subject. Feel free to add a more detailed description, but
> subjects longer then 74 bytes end by causing some troubles when using git commands.
I didn't intend that, I just keep forgetting to add a newline between
subject and description..
>
> It would be nice to have a good description on this patch, as it provides a method
> for working around troubles found on problematic devices.
>
> > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> > ---
> > drivers/media/IR/ir-core-priv.h | 1 +
> > drivers/media/IR/ir-keytable.c | 2 +-
> > drivers/media/IR/ir-raw-event.c | 86 +++++++++++++++++++++++++++++++++++++++
> > include/media/ir-core.h | 24 +++++++++-
> > 4 files changed, 109 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
> > index 8ce80e4..3eafdb7 100644
> > --- a/drivers/media/IR/ir-core-priv.h
> > +++ b/drivers/media/IR/ir-core-priv.h
> > @@ -36,6 +36,7 @@ struct ir_raw_event_ctrl {
> > struct kfifo kfifo; /* fifo for the pulse/space durations */
> > ktime_t last_event; /* when last event occurred */
> > enum raw_event_type last_type; /* last event type */
> > + struct ir_raw_event current_sample; /* sample that is not yet pushed to fifo */
> > struct input_dev *input_dev; /* pointer to the parent input_dev */
> > u64 enabled_protocols; /* enabled raw protocol decoders */
> >
> > diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
> > index 94a8577..34b9c07 100644
> > --- a/drivers/media/IR/ir-keytable.c
> > +++ b/drivers/media/IR/ir-keytable.c
> > @@ -428,7 +428,7 @@ static void ir_close(struct input_dev *input_dev)
> > */
> > int __ir_input_register(struct input_dev *input_dev,
> > const struct ir_scancode_table *rc_tab,
> > - const struct ir_dev_props *props,
> > + struct ir_dev_props *props,
> > const char *driver_name)
> > {
> > struct ir_input_dev *ir_dev;
>
> Hmm... why are you removing "const" from ir_dev_props? This change seems unrelated
> with the patch description.
Because I add new field 'timeout' I intend to change it in runtime by
the driver.
Best regards,
Maxim Levitsky
>
> > diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
> > index c6a80b3..bdf2ed8 100644
> > --- a/drivers/media/IR/ir-raw-event.c
> > +++ b/drivers/media/IR/ir-raw-event.c
> > @@ -129,6 +129,92 @@ int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type typ
> > EXPORT_SYMBOL_GPL(ir_raw_event_store_edge);
> >
> > /**
> > + * ir_raw_event_store_with_filter() - pass next pulse/space to decoders with some processing
> > + * @input_dev: the struct input_dev device descriptor
> > + * @type: the type of the event that has occurred
> > + *
> > + * This routine (which may be called from an interrupt context) is used to
> > + * store the beginning of an ir pulse or space (or the start/end of ir
> > + * reception) for the raw ir decoding state machines.\
> > + * This routine is intended for devices with limited internal buffer
> > + * It automerges samples of same type, and handles timeouts
> > + */
> > +int ir_raw_event_store_with_filter(struct input_dev *input_dev,
> > + struct ir_raw_event *ev)
> > +{
> > + struct ir_input_dev *ir = input_get_drvdata(input_dev);
> > + struct ir_raw_event_ctrl *raw = ir->raw;
> > +
> > + if (!ir->raw || !ir->props)
> > + return -EINVAL;
> > +
> > + /* Ignore spaces in idle mode */
> > + if (ir->idle && !ev->pulse)
> > + return 0;
> > + else if (ir->idle)
> > + ir_raw_event_set_idle(input_dev, 0);
> > +
> > + if (!raw->current_sample.duration) {
> > + raw->current_sample = *ev;
> > + } else if (ev->pulse == raw->current_sample.pulse) {
> > + raw->current_sample.duration += ev->duration;
> > + } else {
> > + ir_raw_event_store(input_dev, &raw->current_sample);
> > + raw->current_sample = *ev;
> > + }
> > +
> > + /* Enter idle mode if nessesary */
> > + if (!ev->pulse && ir->props->timeout &&
> > + raw->current_sample.duration >= ir->props->timeout)
> > + ir_raw_event_set_idle(input_dev, 1);
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter);
> > +
> > +
> > +void ir_raw_event_set_idle(struct input_dev *input_dev, int idle)
> > +{
> > + struct ir_input_dev *ir = input_get_drvdata(input_dev);
> > + struct ir_raw_event_ctrl *raw = ir->raw;
> > + ktime_t now;
> > + u64 delta;
> > +
> > + if (!ir->props)
> > + return;
> > +
> > + if (!ir->raw)
> > + goto out;
> > +
> > + if (idle) {
> > + IR_dprintk(2, "enter idle mode\n");
> > + raw->last_event = ktime_get();
> > + } else {
> > + IR_dprintk(2, "exit idle mode\n");
> > +
> > + now = ktime_get();
> > + delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event));
> > +
> > + WARN_ON(raw->current_sample.pulse);
> > +
> > + raw->current_sample.duration =
> > + min(raw->current_sample.duration + delta,
> > + (u64)IR_MAX_DURATION);
> > +
> > + ir_raw_event_store(input_dev, &raw->current_sample);
> > +
> > + if (raw->current_sample.duration == IR_MAX_DURATION)
> > + ir_raw_event_reset(input_dev);
> > +
> > + raw->current_sample.duration = 0;
> > + }
> > +out:
> > + if (ir->props->s_idle)
> > + ir->props->s_idle(ir->props->priv, idle);
> > + ir->idle = idle;
> > +}
> > +EXPORT_SYMBOL_GPL(ir_raw_event_set_idle);
> > +
> > +/**
> > * ir_raw_event_handle() - schedules the decoding of stored ir data
> > * @input_dev: the struct input_dev device descriptor
> > *
> > diff --git a/include/media/ir-core.h b/include/media/ir-core.h
> > index 513e60d..53ce966 100644
> > --- a/include/media/ir-core.h
> > +++ b/include/media/ir-core.h
> > @@ -41,6 +41,9 @@ enum rc_driver_type {
> > * anything with it. Yet, as the same keycode table can be used with other
> > * devices, a mask is provided to allow its usage. Drivers should generally
> > * leave this field in blank
> > + * @timeout: optional time after which device stops sending data
> > + * @min_timeout: minimum timeout supported by device
> > + * @max_timeout: maximum timeout supported by device
> > * @priv: driver-specific data, to be used on the callbacks
> > * @change_protocol: allow changing the protocol used on hardware decoders
> > * @open: callback to allow drivers to enable polling/irq when IR input device
> > @@ -50,11 +53,19 @@ enum rc_driver_type {
> > * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
> > * @s_tx_carrier: set transmit carrier frequency
> > * @tx_ir: transmit IR
> > + * @s_idle: optional: enable/disable hardware idle mode, upon which,
> > + device doesn't interrupt host untill it sees IR data
> > */
> > struct ir_dev_props {
> > enum rc_driver_type driver_type;
> > unsigned long allowed_protos;
> > u32 scanmask;
> > +
> > + u64 timeout;
> > + u64 min_timeout;
> > + u64 max_timeout;
> > +
> > +
> > void *priv;
> > int (*change_protocol)(void *priv, u64 ir_type);
> > int (*open)(void *priv);
> > @@ -62,6 +73,7 @@ struct ir_dev_props {
> > int (*s_tx_mask)(void *priv, u32 mask);
> > int (*s_tx_carrier)(void *priv, u32 carrier);
> > int (*tx_ir)(void *priv, int *txbuf, u32 n);
> > + void (*s_idle) (void *priv, int enable);
> > };
> >
> > struct ir_input_dev {
> > @@ -69,9 +81,10 @@ struct ir_input_dev {
> > char *driver_name; /* Name of the driver module */
> > struct ir_scancode_table rc_tab; /* scan/key table */
> > unsigned long devno; /* device number */
> > - const struct ir_dev_props *props; /* Device properties */
> > + struct ir_dev_props *props; /* Device properties */
> > struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
> > struct input_dev *input_dev; /* the input device associated with this device */
> > + int idle;
> >
> > /* key info - needed by IR keycode handlers */
> > spinlock_t keylock; /* protects the below members */
> > @@ -95,12 +108,12 @@ enum raw_event_type {
> > /* From ir-keytable.c */
> > int __ir_input_register(struct input_dev *dev,
> > const struct ir_scancode_table *ir_codes,
> > - const struct ir_dev_props *props,
> > + struct ir_dev_props *props,
> > const char *driver_name);
> >
> > static inline int ir_input_register(struct input_dev *dev,
> > const char *map_name,
> > - const struct ir_dev_props *props,
> > + struct ir_dev_props *props,
> > const char *driver_name) {
> > struct ir_scancode_table *ir_codes;
> > struct ir_input_dev *ir_dev;
> > @@ -144,6 +157,11 @@ struct ir_raw_event {
> > void ir_raw_event_handle(struct input_dev *input_dev);
> > int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
> > int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
> > +int ir_raw_event_store_with_filter(struct input_dev *input_dev,
> > + struct ir_raw_event *ev);
> > +
> > +void ir_raw_event_set_idle(struct input_dev *input_dev, int idle);
> > +
> > static inline void ir_raw_event_reset(struct input_dev *input_dev)
> > {
> > struct ir_raw_event ev = { .pulse = false, .duration = 0 };
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/9] IR: replace spinlock with mutex.
2010-07-28 16:03 ` Mauro Carvalho Chehab
@ 2010-07-28 16:32 ` Maxim Levitsky
2010-07-28 17:43 ` Jarod Wilson
0 siblings, 1 reply; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 16:32 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
On Wed, 2010-07-28 at 13:03 -0300, Mauro Carvalho Chehab wrote:
> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> > Some handlers (lirc for example) allocates memory on initialization,
> > doing so in atomic context is cumbersome.
> > Fixes warning about sleeping function in atomic context.
>
> You should not replace it by a mutex, as the decoding code may happen during
> IRQ time on several drivers.
I though decoding code is run by a work queue?
I don't see any atomic codepath here...
>
> If lirc is allocating memory, it should be using GFP_ATOMIC to avoid sleeping.
If its really not possible, I can make lirc use GFP_ATOMIC. a bit ugly,
but should work.
Best regards,
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 2/9] IR: minor fixes:
2010-07-28 16:01 ` Mauro Carvalho Chehab
@ 2010-07-28 16:38 ` Maxim Levitsky
2010-07-28 17:59 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 16:38 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
On Wed, 2010-07-28 at 13:01 -0300, Mauro Carvalho Chehab wrote:
> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> > * lirc: Don't propagate reset event to userspace
> > * lirc: Remove strange logic from lirc that would make first sample always be pulse
> > * Make TO_US macro actualy print what it should.
> >
> > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> > ---
> > drivers/media/IR/ir-core-priv.h | 3 +--
> > drivers/media/IR/ir-lirc-codec.c | 14 ++++++++------
> > drivers/media/IR/ir-raw-event.c | 3 +++
> > 3 files changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
> > index babd520..8ce80e4 100644
> > --- a/drivers/media/IR/ir-core-priv.h
> > +++ b/drivers/media/IR/ir-core-priv.h
> > @@ -76,7 +76,6 @@ struct ir_raw_event_ctrl {
> > struct lirc_codec {
> > struct ir_input_dev *ir_dev;
> > struct lirc_driver *drv;
> > - int lircdata;
> > } lirc;
> > };
> >
> > @@ -104,7 +103,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration)
> > ev->duration -= duration;
> > }
> >
> > -#define TO_US(duration) (((duration) + 500) / 1000)
> > +#define TO_US(duration) ((duration) / 1000)
>
> It is better to keep rounding the duration to its closest value.
But that breaks if duration is already at maximum. At that case,
you see usual signed int wrap from positive to negative, and abnormally
large space...
I didn't notice though that you do rounding here.
I replace that with something better.
Best regards,
Maxim Levitsky
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 5/9] IR: extend interfaces to support more device settings
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
@ 2010-07-28 17:00 ` Mauro Carvalho Chehab
2010-07-28 20:47 ` Jarod Wilson
1 sibling, 0 replies; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 17:00 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> Also reuse LIRC_SET_MEASURE_CARRIER_MODE as LIRC_SET_LEARN_MODE
> (LIRC_SET_LEARN_MODE will start carrier reports if possible, and
> tune receiver to wide band mode)
>
> This IOCTL isn't yet used by lirc, so this won't break userspace.
>
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> ---
> drivers/media/IR/ir-core-priv.h | 2 +
> drivers/media/IR/ir-lirc-codec.c | 100 ++++++++++++++++++++++++++++++++++----
> include/media/ir-core.h | 11 ++++
> include/media/lirc.h | 4 +-
> 4 files changed, 105 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
> index 3eafdb7..4ed170d 100644
> --- a/drivers/media/IR/ir-core-priv.h
> +++ b/drivers/media/IR/ir-core-priv.h
> @@ -77,6 +77,8 @@ struct ir_raw_event_ctrl {
> struct lirc_codec {
> struct ir_input_dev *ir_dev;
> struct lirc_driver *drv;
> + int timeout_report;
> + int carrier_low;
> } lirc;
> };
>
> diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c
> index 8ca01fd..0f3969c 100644
> --- a/drivers/media/IR/ir-lirc-codec.c
> +++ b/drivers/media/IR/ir-lirc-codec.c
> @@ -96,13 +96,13 @@ out:
> return ret;
> }
>
> -static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
> +static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long __user arg)
> {
> struct lirc_codec *lirc;
> struct ir_input_dev *ir_dev;
> int ret = 0;
> void *drv_data;
> - unsigned long val;
> + unsigned long val = 0;
>
> lirc = lirc_get_pdata(filep);
> if (!lirc)
> @@ -116,10 +116,21 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long ar
>
> switch (cmd) {
> case LIRC_SET_TRANSMITTER_MASK:
> + case LIRC_SET_SEND_CARRIER:
> + case LIRC_SET_SEND_MODE:
> + case LIRC_SET_REC_TIMEOUT:
> + case LIRC_SET_REC_TIMEOUT_REPORTS:
> + case LIRC_SET_LEARN_MODE:
> + case LIRC_SET_REC_CARRIER:
> + case LIRC_SET_REC_CARRIER_RANGE:
> + case LIRC_SET_SEND_DUTY_CYCLE:
> ret = get_user(val, (unsigned long *)arg);
> if (ret)
> return ret;
> + }
As, in all cases, the argument is an __u32, you can just use this, to get
the arguments for all LIRC_SET_* cases:
if (_IOC_DIR(cmd) & _IOC_WRITE) {
ret = get_user(val, (unsigned long *)arg);
if (ret)
return ret;
}
> + switch (cmd) {
> + case LIRC_SET_TRANSMITTER_MASK:
> if (ir_dev->props && ir_dev->props->s_tx_mask)
> ret = ir_dev->props->s_tx_mask(drv_data, (u32)val);
> else
> @@ -127,10 +138,6 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long ar
> break;
>
> case LIRC_SET_SEND_CARRIER:
> - ret = get_user(val, (unsigned long *)arg);
> - if (ret)
> - return ret;
> -
> if (ir_dev->props && ir_dev->props->s_tx_carrier)
> ir_dev->props->s_tx_carrier(drv_data, (u32)val);
> else
> @@ -143,14 +150,75 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long ar
> break;
>
> case LIRC_SET_SEND_MODE:
> - ret = get_user(val, (unsigned long *)arg);
> - if (ret)
> - return ret;
> -
> if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK))
> return -EINVAL;
> break;
>
> + case LIRC_GET_REC_RESOLUTION:
> + val = ir_dev->props->rx_resolution;
> + ret = put_user(val, (unsigned long *)arg);
> + break;
You can use something like this, to handle the LIRC_GET* cases:
switch (cmd) {
...
case LIRC_GET_REC_RESOLUTION:
val = ir_dev->props->rx_resolution;
break;
...
}
if (_IOC_DIR(cmd) & _IOC_READ) {
ret = put_user(val, (unsigned long *)arg);
if (ret)
return ret;
}
> +
> + case LIRC_SET_REC_TIMEOUT:
> + if (val < ir_dev->props->min_timeout ||
> + val > ir_dev->props->max_timeout)
> + return -EINVAL;
> +
> + ir_dev->props->timeout = val;
> + break;
> +
> + case LIRC_SET_REC_TIMEOUT_REPORTS:
> + ir_dev->raw->lirc.timeout_report = !!val;
> + return 0;
> +
> + case LIRC_GET_MIN_TIMEOUT:
> +
> + if (!ir_dev->props->max_timeout)
> + return -ENOSYS;
> +
> + ret = put_user(ir_dev->props->min_timeout, (unsigned long *)arg);
> + break;
> + case LIRC_GET_MAX_TIMEOUT:
> + if (!ir_dev->props->max_timeout)
> + return -ENOSYS;
> +
> + ret = put_user(ir_dev->props->max_timeout, (unsigned long *)arg);
> + break;
> +
> + case LIRC_SET_LEARN_MODE:
> + if (ir_dev->props->s_learning_mode)
> + return ir_dev->props->s_learning_mode(
> + ir_dev->props->priv, !!val);
> + else
> + return -ENOSYS;
> +
> + case LIRC_SET_REC_CARRIER:
> + if (ir_dev->props->s_rx_carrier_range)
> + ret = ir_dev->props->s_rx_carrier_range(
> + ir_dev->props->priv,
> + ir_dev->raw->lirc.carrier_low, val);
> + else
> + return -ENOSYS;
> +
> + if (!ret)
> + ir_dev->raw->lirc.carrier_low = 0;
> + break;
> +
> + case LIRC_SET_REC_CARRIER_RANGE:
> + if (val >= 0)
> + ir_dev->raw->lirc.carrier_low = val;
> + break;
> + case LIRC_SET_SEND_DUTY_CYCLE:
> +
> + if (!ir_dev->props->s_tx_duty_cycle)
> + return -ENOSYS;
> +
> + if (val <= 0 || val >= 100)
> + return -EINVAL;
> +
> + ir_dev->props->s_tx_duty_cycle(ir_dev->props->priv, val);
> + break;
> +
> default:
> return lirc_dev_fop_ioctl(filep, cmd, arg);
> }
> @@ -200,13 +268,25 @@ static int ir_lirc_register(struct input_dev *input_dev)
>
> features = LIRC_CAN_REC_MODE2;
> if (ir_dev->props->tx_ir) {
> +
> features |= LIRC_CAN_SEND_PULSE;
> if (ir_dev->props->s_tx_mask)
> features |= LIRC_CAN_SET_TRANSMITTER_MASK;
> if (ir_dev->props->s_tx_carrier)
> features |= LIRC_CAN_SET_SEND_CARRIER;
> +
> + if (ir_dev->props->s_tx_duty_cycle)
> + features |= LIRC_CAN_SET_REC_DUTY_CYCLE;
> }
>
> + if (ir_dev->props->s_rx_carrier_range)
> + features |= LIRC_CAN_SET_REC_CARRIER |
> + LIRC_CAN_SET_REC_CARRIER_RANGE;
> +
> + if (ir_dev->props->s_learning_mode)
> + features |= LIRC_CAN_LEARN_MODE;
> +
> +
> snprintf(drv->name, sizeof(drv->name), "ir-lirc-codec (%s)",
> ir_dev->driver_name);
> drv->minor = -1;
> diff --git a/include/media/ir-core.h b/include/media/ir-core.h
> index 53ce966..46cc6c5 100644
> --- a/include/media/ir-core.h
> +++ b/include/media/ir-core.h
> @@ -44,6 +44,8 @@ enum rc_driver_type {
> * @timeout: optional time after which device stops sending data
> * @min_timeout: minimum timeout supported by device
> * @max_timeout: maximum timeout supported by device
> + * @rx_resolution : resolution (in ns) of input sampler
> + * @tx_resolution: resolution (in ns) of output sampler
> * @priv: driver-specific data, to be used on the callbacks
> * @change_protocol: allow changing the protocol used on hardware decoders
> * @open: callback to allow drivers to enable polling/irq when IR input device
> @@ -52,9 +54,12 @@ enum rc_driver_type {
> * is opened.
> * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
> * @s_tx_carrier: set transmit carrier frequency
> + * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%)
> + * @s_rx_carrier: inform driver about carrier it is expected to handle
> * @tx_ir: transmit IR
> * @s_idle: optional: enable/disable hardware idle mode, upon which,
> device doesn't interrupt host untill it sees IR data
> + * @s_learning_mode: enable learning mode
> */
> struct ir_dev_props {
> enum rc_driver_type driver_type;
> @@ -65,6 +70,8 @@ struct ir_dev_props {
> u64 min_timeout;
> u64 max_timeout;
>
> + u32 rx_resolution;
> + u32 tx_resolution;
>
> void *priv;
> int (*change_protocol)(void *priv, u64 ir_type);
> @@ -72,8 +79,12 @@ struct ir_dev_props {
> void (*close)(void *priv);
> int (*s_tx_mask)(void *priv, u32 mask);
> int (*s_tx_carrier)(void *priv, u32 carrier);
> + int (*s_tx_duty_cycle) (void *priv, u32 duty_cycle);
> + int (*s_rx_carrier_range) (void *priv, u32 min, u32 max);
> int (*tx_ir)(void *priv, int *txbuf, u32 n);
> void (*s_idle) (void *priv, int enable);
> + int (*s_learning_mode) (void *priv, int enable);
> +
> };
>
> struct ir_input_dev {
> diff --git a/include/media/lirc.h b/include/media/lirc.h
> index 42c467c..09a9753 100644
> --- a/include/media/lirc.h
> +++ b/include/media/lirc.h
> @@ -76,7 +76,7 @@
> #define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
> #define LIRC_CAN_SET_REC_FILTER 0x08000000
>
> -#define LIRC_CAN_MEASURE_CARRIER 0x02000000
> +#define LIRC_CAN_LEARN_MODE 0x02000000
>
> #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
> #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
> @@ -145,7 +145,7 @@
> * if enabled from the next key press on the driver will send
> * LIRC_MODE2_FREQUENCY packets
> */
> -#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
> +#define LIRC_SET_LEARN_MODE _IOW('i', 0x0000001d, __u32)
>
> /*
> * to set a range use
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 8/9] IR: Add ENE input driver.
2010-07-28 15:14 ` [PATCH 8/9] IR: Add ENE input driver Maxim Levitsky
@ 2010-07-28 17:10 ` Mauro Carvalho Chehab
2010-07-28 17:13 ` Maxim Levitsky
0 siblings, 1 reply; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 17:10 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Please, instead of patch 9/9, do a patch moving ENE driver from staging into
drivers/media/IR, and then a patch porting it into rc-core. This will allow us
to better understand what were done to convert it to rc-core, being an example
for others that may work on porting the other drivers to rc-core.
Cheers,
Mauro.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 8/9] IR: Add ENE input driver.
2010-07-28 17:10 ` Mauro Carvalho Chehab
@ 2010-07-28 17:13 ` Maxim Levitsky
2010-07-28 17:17 ` Jarod Wilson
2010-07-28 18:13 ` Mauro Carvalho Chehab
0 siblings, 2 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 17:13 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
On Wed, 2010-07-28 at 14:10 -0300, Mauro Carvalho Chehab wrote:
> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
>
> Please, instead of patch 9/9, do a patch moving ENE driver from staging into
> drivers/media/IR, and then a patch porting it into rc-core. This will allow us
> to better understand what were done to convert it to rc-core, being an example
> for others that may work on porting the other drivers to rc-core.
The version in staging is outdated.
Should I first update it, and then move?
Best regards,
Maxim Levitsky
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 8/9] IR: Add ENE input driver.
2010-07-28 17:13 ` Maxim Levitsky
@ 2010-07-28 17:17 ` Jarod Wilson
2010-07-28 18:13 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 17:17 UTC (permalink / raw)
To: Maxim Levitsky
Cc: Mauro Carvalho Chehab, lirc-list, Jarod Wilson, linux-input,
linux-media
On Wed, Jul 28, 2010 at 08:13:35PM +0300, Maxim Levitsky wrote:
> On Wed, 2010-07-28 at 14:10 -0300, Mauro Carvalho Chehab wrote:
> > Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> >
> > Please, instead of patch 9/9, do a patch moving ENE driver from staging into
> > drivers/media/IR, and then a patch porting it into rc-core. This will allow us
> > to better understand what were done to convert it to rc-core, being an example
> > for others that may work on porting the other drivers to rc-core.
>
> The version in staging is outdated.
D'oh, sorry about that.
> Should I first update it, and then move?
Yeah, that sounds sane to me.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 2/9] IR: minor fixes:
2010-07-28 15:14 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
2010-07-28 16:01 ` Mauro Carvalho Chehab
@ 2010-07-28 17:23 ` Jarod Wilson
1 sibling, 0 replies; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 17:23 UTC (permalink / raw)
To: Maxim Levitsky
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, Jul 28, 2010 at 06:14:04PM +0300, Maxim Levitsky wrote:
> * lirc: Don't propagate reset event to userspace
> * lirc: Remove strange logic from lirc that would make first sample always be pulse
> * Make TO_US macro actualy print what it should.
>
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
For the ir-lirc-codec-specific bits:
Acked-by: Jarod Wilson <jarod@redhat.com>
I'm inclined to pull them into my tree now, and the IR_dprintk and TO_US
portions can be handled separately.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 1/9] IR: Kconfig fixes
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
@ 2010-07-28 17:36 ` Randy Dunlap
2010-07-28 20:31 ` Maxim Levitsky
0 siblings, 1 reply; 33+ messages in thread
From: Randy Dunlap @ 2010-07-28 17:36 UTC (permalink / raw)
To: Maxim Levitsky
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, 28 Jul 2010 18:14:03 +0300 Maxim Levitsky wrote:
> Move IR drives below separate menu.
> This allows to disable them.
> Also correct a typo.
>
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> ---
> drivers/media/IR/Kconfig | 14 +++++++++++---
> 1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig
> index e557ae0..99ea9cd 100644
> --- a/drivers/media/IR/Kconfig
> +++ b/drivers/media/IR/Kconfig
> @@ -1,8 +1,10 @@
> -config IR_CORE
> - tristate
> +menuconfig IR_CORE
> + tristate "Infrared remote controller adapters"
> depends on INPUT
> default INPUT
>
> +if IR_CORE
> +
> config VIDEO_IR
> tristate
> depends on IR_CORE
> @@ -16,7 +18,7 @@ config LIRC
> Enable this option to build the Linux Infrared Remote
> Control (LIRC) core device interface driver. The LIRC
> interface passes raw IR to and from userspace, where the
> - LIRC daemon handles protocol decoding for IR reception ann
> + LIRC daemon handles protocol decoding for IR reception and
> encoding for IR transmitting (aka "blasting").
>
> source "drivers/media/IR/keymaps/Kconfig"
> @@ -102,3 +104,9 @@ config IR_MCEUSB
>
> To compile this driver as a module, choose M here: the
> module will be called mceusb.
> +
> +
> +
> +
> +
> +endif #IR_CORE
I don't think that those extra blank lines are a fix...
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/9] IR: replace spinlock with mutex.
2010-07-28 16:32 ` Maxim Levitsky
@ 2010-07-28 17:43 ` Jarod Wilson
2010-07-28 18:37 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 17:43 UTC (permalink / raw)
To: Maxim Levitsky
Cc: Mauro Carvalho Chehab, lirc-list, Jarod Wilson, linux-input,
linux-media
On Wed, Jul 28, 2010 at 07:32:58PM +0300, Maxim Levitsky wrote:
> On Wed, 2010-07-28 at 13:03 -0300, Mauro Carvalho Chehab wrote:
> > Em 28-07-2010 12:14, Maxim Levitsky escreveu:
> > > Some handlers (lirc for example) allocates memory on initialization,
> > > doing so in atomic context is cumbersome.
> > > Fixes warning about sleeping function in atomic context.
> >
> > You should not replace it by a mutex, as the decoding code may happen during
> > IRQ time on several drivers.
> I though decoding code is run by a work queue?
Yeah, it is. (INIT_WORK(&ir->raw->rx_work, ir_raw_event_work); in
ir_raw_event_register).
> I don't see any atomic codepath here...
I think the ir_raw_event_store variants are the only things that are run
from an interrupt context, and none of them touch ir_raw_handler_lock.
That lock is advertised as being for the protection of ir_raw_handler_list
and ir_raw_client_list, which are primarily manipulated by
register/unregister functions, and we just lock them when doing actual IR
decode work (via said work queue) so we don't feed raw IR somewhere that
we shouldn't. I think Maxim is correct here, we should be okay with
changing this to a mutex, unless I'm missing something else.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed.
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
2010-07-28 16:09 ` Mauro Carvalho Chehab
@ 2010-07-28 17:46 ` Jarod Wilson
2010-07-28 20:57 ` Jarod Wilson
1 sibling, 1 reply; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 17:46 UTC (permalink / raw)
To: Maxim Levitsky
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, Jul 28, 2010 at 06:14:06PM +0300, Maxim Levitsky wrote:
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
With the caveat of requiring an improved changelog, per Mauro's suggestion:
Acked-by: Jarod Wilson <jarod@redhat.com>
I suspect at least some of this code may be of use to the streamzap driver
as well (which I started looking at porting last night, despite my
insistence that I was going to work on lirc_zilog first...).
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 6/9] IR: actually allow not to compile keymaps in..
2010-07-28 15:14 ` [PATCH 6/9] IR: actually allow not to compile keymaps in Maxim Levitsky
@ 2010-07-28 17:58 ` Jarod Wilson
0 siblings, 0 replies; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 17:58 UTC (permalink / raw)
To: Maxim Levitsky
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, Jul 28, 2010 at 06:14:08PM +0300, Maxim Levitsky wrote:
> Currntly, ir device registration fails if keymap requested by driver is not found...
> Fix that by always compiling in the empty keymap, and using it as a failback
>
> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
I like this one, useful improvement, I think. We even get meaningful
output logged as well -- get_rc_map() will let us know the initially
requested keymap failed to load, and then will let us know whether or not
the empty keymap loaded.
Acked-by: Jarod Wilson <jarod@redhat.com>
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 2/9] IR: minor fixes:
2010-07-28 16:38 ` Maxim Levitsky
@ 2010-07-28 17:59 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 17:59 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 13:38, Maxim Levitsky escreveu:
> On Wed, 2010-07-28 at 13:01 -0300, Mauro Carvalho Chehab wrote:
>> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
>>> * lirc: Don't propagate reset event to userspace
>>> * lirc: Remove strange logic from lirc that would make first sample always be pulse
>>> * Make TO_US macro actualy print what it should.
>>>
>>> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
>>> ---
>>> drivers/media/IR/ir-core-priv.h | 3 +--
>>> drivers/media/IR/ir-lirc-codec.c | 14 ++++++++------
>>> drivers/media/IR/ir-raw-event.c | 3 +++
>>> 3 files changed, 12 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h
>>> index babd520..8ce80e4 100644
>>> --- a/drivers/media/IR/ir-core-priv.h
>>> +++ b/drivers/media/IR/ir-core-priv.h
>>> @@ -76,7 +76,6 @@ struct ir_raw_event_ctrl {
>>> struct lirc_codec {
>>> struct ir_input_dev *ir_dev;
>>> struct lirc_driver *drv;
>>> - int lircdata;
>>> } lirc;
>>> };
>>>
>>> @@ -104,7 +103,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration)
>>> ev->duration -= duration;
>>> }
>>>
>>> -#define TO_US(duration) (((duration) + 500) / 1000)
>>> +#define TO_US(duration) ((duration) / 1000)
>>
>> It is better to keep rounding the duration to its closest value.
>
> But that breaks if duration is already at maximum. At that case,
> you see usual signed int wrap from positive to negative, and abnormally
> large space...
>
> I didn't notice though that you do rounding here.
> I replace that with something better.
There's a function for rounding at kernel. The better is to use it, as it should already
solve the signal wrap.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 8/9] IR: Add ENE input driver.
2010-07-28 17:13 ` Maxim Levitsky
2010-07-28 17:17 ` Jarod Wilson
@ 2010-07-28 18:13 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 18:13 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 14:13, Maxim Levitsky escreveu:
> On Wed, 2010-07-28 at 14:10 -0300, Mauro Carvalho Chehab wrote:
>> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
>>> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
>>
>> Please, instead of patch 9/9, do a patch moving ENE driver from staging into
>> drivers/media/IR, and then a patch porting it into rc-core. This will allow us
>> to better understand what were done to convert it to rc-core, being an example
>> for others that may work on porting the other drivers to rc-core.
>
> The version in staging is outdated.
> Should I first update it, and then move?
Yes, please. It shouldn't be hard to produce such patches, and this will help
other developers when porting the other drivers. So, it may result on a some gain
at the speed for the other ports.
>
> Best regards,
> Maxim Levitsky
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/9] IR: replace spinlock with mutex.
2010-07-28 17:43 ` Jarod Wilson
@ 2010-07-28 18:37 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 33+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-28 18:37 UTC (permalink / raw)
To: Jarod Wilson
Cc: Maxim Levitsky, lirc-list, Jarod Wilson, linux-input, linux-media
Em 28-07-2010 14:43, Jarod Wilson escreveu:
> On Wed, Jul 28, 2010 at 07:32:58PM +0300, Maxim Levitsky wrote:
>> On Wed, 2010-07-28 at 13:03 -0300, Mauro Carvalho Chehab wrote:
>>> Em 28-07-2010 12:14, Maxim Levitsky escreveu:
>>>> Some handlers (lirc for example) allocates memory on initialization,
>>>> doing so in atomic context is cumbersome.
>>>> Fixes warning about sleeping function in atomic context.
>>>
>>> You should not replace it by a mutex, as the decoding code may happen during
>>> IRQ time on several drivers.
>> I though decoding code is run by a work queue?
>
> Yeah, it is. (INIT_WORK(&ir->raw->rx_work, ir_raw_event_work); in
> ir_raw_event_register).
>
>> I don't see any atomic codepath here...
>
> I think the ir_raw_event_store variants are the only things that are run
> from an interrupt context, and none of them touch ir_raw_handler_lock.
> That lock is advertised as being for the protection of ir_raw_handler_list
> and ir_raw_client_list, which are primarily manipulated by
> register/unregister functions, and we just lock them when doing actual IR
> decode work (via said work queue) so we don't feed raw IR somewhere that
> we shouldn't. I think Maxim is correct here, we should be okay with
> changing this to a mutex, unless I'm missing something else.
You're probably right. The previous code used to do this at IRQ time, but a latter
patch changed it to happen via a workqueue.
So, I'm OK with this patch.
Cheers,
Mauro.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 1/9] IR: Kconfig fixes
2010-07-28 17:36 ` Randy Dunlap
@ 2010-07-28 20:31 ` Maxim Levitsky
0 siblings, 0 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 20:31 UTC (permalink / raw)
To: Randy Dunlap
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, 2010-07-28 at 10:36 -0700, Randy Dunlap wrote:
> On Wed, 28 Jul 2010 18:14:03 +0300 Maxim Levitsky wrote:
>
> > Move IR drives below separate menu.
> > This allows to disable them.
> > Also correct a typo.
> >
> > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> > ---
> > drivers/media/IR/Kconfig | 14 +++++++++++---
> > 1 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig
> > index e557ae0..99ea9cd 100644
> > --- a/drivers/media/IR/Kconfig
> > +++ b/drivers/media/IR/Kconfig
> > @@ -1,8 +1,10 @@
> > -config IR_CORE
> > - tristate
> > +menuconfig IR_CORE
> > + tristate "Infrared remote controller adapters"
> > depends on INPUT
> > default INPUT
> >
> > +if IR_CORE
> > +
> > config VIDEO_IR
> > tristate
> > depends on IR_CORE
> > @@ -16,7 +18,7 @@ config LIRC
> > Enable this option to build the Linux Infrared Remote
> > Control (LIRC) core device interface driver. The LIRC
> > interface passes raw IR to and from userspace, where the
> > - LIRC daemon handles protocol decoding for IR reception ann
> > + LIRC daemon handles protocol decoding for IR reception and
> > encoding for IR transmitting (aka "blasting").
> >
> > source "drivers/media/IR/keymaps/Kconfig"
> > @@ -102,3 +104,9 @@ config IR_MCEUSB
> >
> > To compile this driver as a module, choose M here: the
> > module will be called mceusb.
> > +
> > +
> > +
> > +
> > +
> > +endif #IR_CORE
>
> I don't think that those extra blank lines are a fix...
Sure.
This patch series wasn't meant to be prefect, I rushed it a bit out of
dour.
When I split the patches, I forgot to remove that whitespace.
Other that that, any more comments?
Best regards,
Maxim Levitsky
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 5/9] IR: extend interfaces to support more device settings
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
2010-07-28 17:00 ` Mauro Carvalho Chehab
@ 2010-07-28 20:47 ` Jarod Wilson
1 sibling, 0 replies; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 20:47 UTC (permalink / raw)
To: Maxim Levitsky
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, Jul 28, 2010 at 06:14:07PM +0300, Maxim Levitsky wrote:
> Also reuse LIRC_SET_MEASURE_CARRIER_MODE as LIRC_SET_LEARN_MODE
> (LIRC_SET_LEARN_MODE will start carrier reports if possible, and
> tune receiver to wide band mode)
>
> This IOCTL isn't yet used by lirc, so this won't break userspace.
Plus, once lirc 0.8.7 is released (Real Soon Now), we'll start working on
lirc 0.9.0 with the express goal of it being built against lirc.h as
provided by the kernel.
These all generally look good and sane to me, and I'll make use of the
LEARN_MODE bits for mceusb after something along these lines is committed.
I like the simplifications Mauro suggested for the ioctl handling. In
addition to those, there's a bit of whitespace damage in lirc.h that I'd
like to see cleaned up for v2.
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed.
2010-07-28 17:46 ` Jarod Wilson
@ 2010-07-28 20:57 ` Jarod Wilson
2010-07-28 21:16 ` Maxim Levitsky
0 siblings, 1 reply; 33+ messages in thread
From: Jarod Wilson @ 2010-07-28 20:57 UTC (permalink / raw)
To: Maxim Levitsky
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, Jul 28, 2010 at 01:46:27PM -0400, Jarod Wilson wrote:
> On Wed, Jul 28, 2010 at 06:14:06PM +0300, Maxim Levitsky wrote:
> > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
>
> With the caveat of requiring an improved changelog, per Mauro's suggestion:
>
> Acked-by: Jarod Wilson <jarod@redhat.com>
>
> I suspect at least some of this code may be of use to the streamzap driver
> as well (which I started looking at porting last night, despite my
> insistence that I was going to work on lirc_zilog first...).
One other note: idle looks like it can happily exist as a bool instead of
as an int, no?
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed.
2010-07-28 20:57 ` Jarod Wilson
@ 2010-07-28 21:16 ` Maxim Levitsky
0 siblings, 0 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 21:16 UTC (permalink / raw)
To: Jarod Wilson
Cc: lirc-list, Jarod Wilson, linux-input, linux-media,
Mauro Carvalho Chehab
On Wed, 2010-07-28 at 16:57 -0400, Jarod Wilson wrote:
> On Wed, Jul 28, 2010 at 01:46:27PM -0400, Jarod Wilson wrote:
> > On Wed, Jul 28, 2010 at 06:14:06PM +0300, Maxim Levitsky wrote:
> > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> >
> > With the caveat of requiring an improved changelog, per Mauro's suggestion:
> >
> > Acked-by: Jarod Wilson <jarod@redhat.com>
> >
> > I suspect at least some of this code may be of use to the streamzap driver
> > as well (which I started looking at porting last night, despite my
> > insistence that I was going to work on lirc_zilog first...).
>
> One other note: idle looks like it can happily exist as a bool instead of
> as an int, no?
>
sure.
I have a problem with this code however, I just discovered.
I pretty much don't know how to solve it currently...
I just posted a mail about it.
Best regards,
Maxim Levitsky
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 1/9] IR: Kconfig fixes
2010-07-28 23:40 (unknown), Maxim Levitsky
@ 2010-07-28 23:40 ` Maxim Levitsky
0 siblings, 0 replies; 33+ messages in thread
From: Maxim Levitsky @ 2010-07-28 23:40 UTC (permalink / raw)
To: lirc-list
Cc: Jarod Wilson, linux-input, linux-media, Mauro Carvalho Chehab,
Christoph Bartelmus, Maxim Levitsky
Move IR drives below separate menu.
This allows to disable them.
Also correct a typo.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/media/IR/Kconfig | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig
index e557ae0..fc48a3f 100644
--- a/drivers/media/IR/Kconfig
+++ b/drivers/media/IR/Kconfig
@@ -1,8 +1,10 @@
-config IR_CORE
- tristate
+menuconfig IR_CORE
+ tristate "Infrared remote controller adapters"
depends on INPUT
default INPUT
+if IR_CORE
+
config VIDEO_IR
tristate
depends on IR_CORE
@@ -16,7 +18,7 @@ config LIRC
Enable this option to build the Linux Infrared Remote
Control (LIRC) core device interface driver. The LIRC
interface passes raw IR to and from userspace, where the
- LIRC daemon handles protocol decoding for IR reception ann
+ LIRC daemon handles protocol decoding for IR reception and
encoding for IR transmitting (aka "blasting").
source "drivers/media/IR/keymaps/Kconfig"
@@ -102,3 +104,5 @@ config IR_MCEUSB
To compile this driver as a module, choose M here: the
module will be called mceusb.
+
+endif #IR_CORE
--
1.7.0.4
^ permalink raw reply related [flat|nested] 33+ messages in thread
end of thread, other threads:[~2010-07-28 23:40 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28 15:14 [PATCH 0/9 v1] IR: few fixes, additions and ENE driver Maxim Levitsky
2010-07-28 15:14 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
2010-07-28 17:36 ` Randy Dunlap
2010-07-28 20:31 ` Maxim Levitsky
2010-07-28 15:14 ` [PATCH 2/9] IR: minor fixes: Maxim Levitsky
2010-07-28 16:01 ` Mauro Carvalho Chehab
2010-07-28 16:38 ` Maxim Levitsky
2010-07-28 17:59 ` Mauro Carvalho Chehab
2010-07-28 17:23 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 3/9] IR: replace spinlock with mutex Maxim Levitsky
2010-07-28 16:03 ` Mauro Carvalho Chehab
2010-07-28 16:32 ` Maxim Levitsky
2010-07-28 17:43 ` Jarod Wilson
2010-07-28 18:37 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 4/9] IR: add helper functions for ir input devices that send ir timing data in small chunks, and alternation between pulses and spaces isn't guaranteed Maxim Levitsky
2010-07-28 16:09 ` Mauro Carvalho Chehab
2010-07-28 16:29 ` Maxim Levitsky
2010-07-28 17:46 ` Jarod Wilson
2010-07-28 20:57 ` Jarod Wilson
2010-07-28 21:16 ` Maxim Levitsky
2010-07-28 15:14 ` [PATCH 5/9] IR: extend interfaces to support more device settings Maxim Levitsky
2010-07-28 17:00 ` Mauro Carvalho Chehab
2010-07-28 20:47 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 6/9] IR: actually allow not to compile keymaps in Maxim Levitsky
2010-07-28 17:58 ` Jarod Wilson
2010-07-28 15:14 ` [PATCH 7/9] IR: actualy report unknown scancodes the in-kernel decoders found Maxim Levitsky
2010-07-28 15:14 ` [PATCH 8/9] IR: Add ENE input driver Maxim Levitsky
2010-07-28 17:10 ` Mauro Carvalho Chehab
2010-07-28 17:13 ` Maxim Levitsky
2010-07-28 17:17 ` Jarod Wilson
2010-07-28 18:13 ` Mauro Carvalho Chehab
2010-07-28 15:14 ` [PATCH 9/9] STAGING: remove ENE driver Maxim Levitsky
-- strict thread matches above, loose matches on Subject: below --
2010-07-28 23:40 (unknown), Maxim Levitsky
2010-07-28 23:40 ` [PATCH 1/9] IR: Kconfig fixes Maxim Levitsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).