data = (ircom >> 8) & 0x7f;
- ir_keydown(ir->dev, data, 0);
+ rc_keydown(ir->dev, data, 0);
}
/* work handler */
priv->rc_keycode = buf[12] << 16 |
buf[13] << 8 | buf[14];
}
- ir_keydown(d->rc_dev, priv->rc_keycode, 0);
+ rc_keydown(d->rc_dev, priv->rc_keycode, 0);
} else {
priv->rc_keycode = 0; /* clear just for sure */
}
} else if (priv->rc_repeat != buf[6] || buf[0]) {
deb_rc("%s: key repeated\n", __func__);
- ir_keydown(d->rc_dev, priv->rc_keycode, 0);
+ rc_keydown(d->rc_dev, priv->rc_keycode, 0);
} else {
deb_rc("%s: no key press\n", __func__);
}
if (ircode[0]) {
deb_rc("%s: key pressed %02x\n", __func__, ircode[1]);
- ir_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0);
+ rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0);
}
return 0;
goto resubmit;
}
- ir_keydown(d->rc_dev, keycode, toggle);
+ rc_keydown(d->rc_dev, keycode, toggle);
resubmit:
/* Clean the buffer before we requeue */
d->last_event = keycode;
}
- ir_keydown(d->rc_dev, keycode, 0);
+ rc_keydown(d->rc_dev, keycode, 0);
break;
default:
/* RC-5 protocol changes toggle bit on new keypress */
keycode = key[3-2] << 8 | key[3-3];
toggle = key[3-1];
- ir_keydown(d->rc_dev, keycode, toggle);
+ rc_keydown(d->rc_dev, keycode, toggle);
break;
}
deb_info(1, "INT Key Keypress =%04x", keypress);
if (keypress > 0)
- ir_keydown(d->rc_dev, keypress, 0);
+ rc_keydown(d->rc_dev, keypress, 0);
return 0;
}
budget_ci->ir.rc5_device != (command & 0x1f))
return;
- ir_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0);
+ rc_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0);
}
static int msp430_ir_init(struct budget_ci *budget_ci)
bool is_release_code = false;
/* Look for the initial press of a button */
- keycode = ir_g_keycode_from_table(ictx->rdev, scancode);
+ keycode = rc_g_keycode_from_table(ictx->rdev, scancode);
ictx->rc_toggle = 0x0;
ictx->rc_scancode = scancode;
/* Look for the release of a button */
if (keycode == KEY_RESERVED) {
release = scancode & ~0x4000;
- keycode = ir_g_keycode_from_table(ictx->rdev, release);
+ keycode = rc_g_keycode_from_table(ictx->rdev, release);
if (keycode != KEY_RESERVED)
is_release_code = true;
}
scancode = scancode | MCE_KEY_MASK | MCE_TOGGLE_BIT;
ictx->rc_scancode = scancode;
- keycode = ir_g_keycode_from_table(ictx->rdev, scancode);
+ keycode = rc_g_keycode_from_table(ictx->rdev, scancode);
/* not used in mce mode, but make sure we know its false */
ictx->release_code = false;
if (ktype != IMON_KEY_PANEL) {
if (press_type == 0)
- ir_keyup(ictx->rdev);
+ rc_keyup(ictx->rdev);
else {
- ir_keydown(ictx->rdev, ictx->rc_scancode, ictx->rc_toggle);
+ rc_keydown(ictx->rdev, ictx->rc_scancode, ictx->rc_toggle);
spin_lock_irqsave(&ictx->kc_lock, flags);
ictx->last_keycode = ictx->kc;
spin_unlock_irqrestore(&ictx->kc_lock, flags);
scancode = (bitrev8((data->bits >> 8) & 0xff) << 8) |
(bitrev8((data->bits >> 0) & 0xff) << 0);
IR_dprintk(1, "JVC scancode 0x%04x\n", scancode);
- ir_keydown(dev, scancode, data->toggle);
+ rc_keydown(dev, scancode, data->toggle);
data->first = false;
data->old_bits = data->bits;
} else if (data->bits == data->old_bits) {
IR_dprintk(1, "JVC repeat\n");
- ir_repeat(dev);
+ rc_repeat(dev);
} else {
IR_dprintk(1, "JVC invalid repeat msg\n");
break;
data->state = STATE_BIT_PULSE;
return 0;
} else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) {
- ir_repeat(dev);
+ rc_repeat(dev);
IR_dprintk(1, "Repeat last key\n");
data->state = STATE_TRAILER_PULSE;
return 0;
geq_margin(ev.duration,
NEC_TRAILER_SPACE, NEC_UNIT / 2)) {
IR_dprintk(1, "Repeat last key\n");
- ir_repeat(dev);
+ rc_repeat(dev);
data->state = STATE_INACTIVE;
return 0;
if (data->is_nec_x)
data->necx_repeat = true;
- ir_keydown(dev, scancode, 0);
+ rc_keydown(dev, scancode, 0);
data->state = STATE_INACTIVE;
return 0;
}
scancode, toggle);
}
- ir_keydown(dev, scancode, toggle);
+ rc_keydown(dev, scancode, toggle);
data->state = STATE_INACTIVE;
return 0;
}
IR_dprintk(1, "RC5-sz scancode 0x%04x (toggle: %u)\n",
scancode, toggle);
- ir_keydown(dev, scancode, toggle);
+ rc_keydown(dev, scancode, toggle);
data->state = STATE_INACTIVE;
return 0;
}
goto out;
}
- ir_keydown(dev, scancode, toggle);
+ rc_keydown(dev, scancode, toggle);
data->state = STATE_INACTIVE;
return 0;
}
scancode = device << 16 | subdevice << 8 | function;
IR_dprintk(1, "Sony(%u) scancode 0x%05x\n", data->count, scancode);
- ir_keydown(dev, scancode, 0);
+ rc_keydown(dev, scancode, 0);
data->state = STATE_INACTIVE;
return 0;
}
}
/**
- * ir_g_keycode_from_table() - gets the keycode that corresponds to a scancode
+ * rc_g_keycode_from_table() - gets the keycode that corresponds to a scancode
* @dev: the struct rc_dev descriptor of the device
* @scancode: the scancode to look for
* @return: the corresponding keycode, or KEY_RESERVED
* keycode. Normally it should not be used since drivers should have no
* interest in keycodes.
*/
-u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode)
+u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode)
{
struct ir_scancode_table *rc_tab = &dev->rc_tab;
unsigned int keycode;
return keycode;
}
-EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
+EXPORT_SYMBOL_GPL(rc_g_keycode_from_table);
/**
* ir_do_keyup() - internal function to signal the release of a keypress
}
/**
- * ir_keyup() - signals the release of a keypress
+ * rc_keyup() - signals the release of a keypress
* @dev: the struct rc_dev descriptor of the device
*
* This routine is used to signal that a key has been released on the
* remote control.
*/
-void ir_keyup(struct rc_dev *dev)
+void rc_keyup(struct rc_dev *dev)
{
unsigned long flags;
ir_do_keyup(dev);
spin_unlock_irqrestore(&dev->keylock, flags);
}
-EXPORT_SYMBOL_GPL(ir_keyup);
+EXPORT_SYMBOL_GPL(rc_keyup);
/**
* ir_timer_keyup() - generates a keyup event after a timeout
}
/**
- * ir_repeat() - signals that a key is still pressed
+ * rc_repeat() - signals that a key is still pressed
* @dev: the struct rc_dev descriptor of the device
*
* This routine is used by IR decoders when a repeat message which does
* not include the necessary bits to reproduce the scancode has been
* received.
*/
-void ir_repeat(struct rc_dev *dev)
+void rc_repeat(struct rc_dev *dev)
{
unsigned long flags;
out:
spin_unlock_irqrestore(&dev->keylock, flags);
}
-EXPORT_SYMBOL_GPL(ir_repeat);
+EXPORT_SYMBOL_GPL(rc_repeat);
/**
* ir_do_keydown() - internal function to process a keypress
}
/**
- * ir_keydown() - generates input event for a key press
+ * rc_keydown() - generates input event for a key press
* @dev: the struct rc_dev descriptor of the device
* @scancode: the scancode that we're seeking
* @toggle: the toggle value (protocol dependent, if the protocol doesn't
* This routine is used to signal that a key has been pressed on the
* remote control.
*/
-void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle)
+void rc_keydown(struct rc_dev *dev, int scancode, u8 toggle)
{
unsigned long flags;
- u32 keycode = ir_g_keycode_from_table(dev, scancode);
+ u32 keycode = rc_g_keycode_from_table(dev, scancode);
spin_lock_irqsave(&dev->keylock, flags);
ir_do_keydown(dev, scancode, keycode, toggle);
}
spin_unlock_irqrestore(&dev->keylock, flags);
}
-EXPORT_SYMBOL_GPL(ir_keydown);
+EXPORT_SYMBOL_GPL(rc_keydown);
/**
- * ir_keydown_notimeout() - generates input event for a key press without
+ * rc_keydown_notimeout() - generates input event for a key press without
* an automatic keyup event at a later time
* @dev: the struct rc_dev descriptor of the device
* @scancode: the scancode that we're seeking
* support toggle values, this should be set to zero)
*
* This routine is used to signal that a key has been pressed on the
- * remote control. The driver must manually call ir_keyup() at a later stage.
+ * remote control. The driver must manually call rc_keyup() at a later stage.
*/
-void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle)
+void rc_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle)
{
unsigned long flags;
- u32 keycode = ir_g_keycode_from_table(dev, scancode);
+ u32 keycode = rc_g_keycode_from_table(dev, scancode);
spin_lock_irqsave(&dev->keylock, flags);
ir_do_keydown(dev, scancode, keycode, toggle);
spin_unlock_irqrestore(&dev->keylock, flags);
}
-EXPORT_SYMBOL_GPL(ir_keydown_notimeout);
+EXPORT_SYMBOL_GPL(rc_keydown_notimeout);
static int ir_open(struct input_dev *idev)
{
if ((ir->mask_keydown && (gpio & ir->mask_keydown)) ||
(ir->mask_keyup && !(gpio & ir->mask_keyup))) {
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
} else {
/* HACK: Probably, ir->mask_keydown is missing
for this board */
if (btv->c.type == BTTV_BOARD_WINFAST2000)
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
}
}
gpio, data,
(gpio & ir->mask_keyup) ? " up" : "up/down");
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
if (keyup)
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
} else {
if ((ir->last_gpio & 1 << 31) == keyup)
return;
(gpio & ir->mask_keyup) ? " up" : "down");
if (keyup)
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
else
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
}
ir->last_gpio = data | keyup;
u32 instr = RC5_INSTR(rc5);
/* Good code */
- ir_keydown(ir->dev, instr, toggle);
+ rc_keydown(ir->dev, instr, toggle);
dprintk(KERN_INFO DEVNAME ":"
" instruction %x, toggle %x\n",
instr, toggle);
data = (data << 4) | ((gpio_key & 0xf0) >> 4);
- ir_keydown(ir->dev, data, 0);
+ rc_keydown(ir->dev, data, 0);
} else if (ir->mask_keydown) {
/* bit set on keydown */
if (gpio & ir->mask_keydown)
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
else
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
} else if (ir->mask_keyup) {
/* bit cleared on keydown */
if (0 == (gpio & ir->mask_keyup))
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
else
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
} else {
/* can't distinguish keydown/up :-/ */
- ir_keydown_notimeout(ir->dev, data, 0);
- ir_keyup(ir->dev);
+ rc_keydown_notimeout(ir->dev, data, 0);
+ rc_keyup(ir->dev);
}
}
poll_result.toggle_bit, poll_result.read_count,
poll_result.rc_address, poll_result.rc_data[0]);
if (ir->full_code)
- ir_keydown(ir->rc,
+ rc_keydown(ir->rc,
poll_result.rc_address << 8 |
poll_result.rc_data[0],
poll_result.toggle_bit);
else
- ir_keydown(ir->rc,
+ rc_keydown(ir->rc,
poll_result.rc_data[0],
poll_result.toggle_bit);
}
if (rc)
- ir_keydown(ir->rc, ir_key, 0);
+ rc_keydown(ir->rc, ir_key, 0);
}
static void ir_work(struct work_struct *work)
switch (dev->board) {
case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG:
if (data == ir->mask_keycode)
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
else
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
return 0;
}
if (ir->polling) {
if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
(ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
- ir_keydown_notimeout(ir->dev, data, 0);
+ rc_keydown_notimeout(ir->dev, data, 0);
} else {
- ir_keyup(ir->dev);
+ rc_keyup(ir->dev);
}
}
else { /* IRQ driven mode - handle key press and release in one go */
if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
(ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
- ir_keydown_notimeout(ir->dev, data, 0);
- ir_keyup(ir->dev);
+ rc_keydown_notimeout(ir->dev, data, 0);
+ rc_keyup(ir->dev);
}
}
dprintk("ir->get_key result data=%04x\n", poll_result.rc_data);
if (ir->key) {
- ir_keydown(ir->rc, poll_result.rc_data, 0);
+ rc_keydown(ir->rc, poll_result.rc_data, 0);
ir->key = 0;
}
return;
* GNU General Public License for more details.
*/
-#ifndef _IR_CORE
-#define _IR_CORE
+#ifndef _RC_CORE
+#define _RC_CORE
#include <linux/spinlock.h>
#include <linux/kfifo.h>
int (*s_carrier_report) (struct rc_dev *dev, int enable);
};
+#define to_rc_dev(d) container_of(d, struct rc_dev, dev)
+
+/*
+ * From rc-main.c
+ * Those functions can be used on any type of Remote Controller. They
+ * basically creates an input_dev and properly reports the device as a
+ * Remote Controller, at sys/class/rc.
+ */
+
+struct rc_dev *rc_allocate_device(void);
+void rc_free_device(struct rc_dev *dev);
+int rc_register_device(struct rc_dev *dev);
+void rc_unregister_device(struct rc_dev *dev);
+
+void rc_repeat(struct rc_dev *dev);
+void rc_keydown(struct rc_dev *dev, int scancode, u8 toggle);
+void rc_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle);
+void rc_keyup(struct rc_dev *dev);
+u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode);
+
+/*
+ * From rc-raw.c
+ * The Raw interface is specific to InfraRed. It may be a good idea to
+ * split it later into a separate header.
+ */
+
enum raw_event_type {
IR_SPACE = (1 << 0),
IR_PULSE = (1 << 1),
IR_STOP_EVENT = (1 << 3),
};
-#define to_rc_dev(d) container_of(d, struct rc_dev, dev)
-
-
-void ir_repeat(struct rc_dev *dev);
-void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle);
-void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle);
-void ir_keyup(struct rc_dev *dev);
-u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode);
-
-/* From ir-raw-event.c */
struct ir_raw_event {
union {
u32 duration;
#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */
-struct rc_dev *rc_allocate_device(void);
-void rc_free_device(struct rc_dev *dev);
-int rc_register_device(struct rc_dev *dev);
-void rc_unregister_device(struct rc_dev *dev);
-
void ir_raw_event_handle(struct rc_dev *dev);
int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev);
int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type);
ir_raw_event_handle(dev);
}
-
/* extract mask bits out of data and pack them into the result */
static inline u32 ir_extract_bits(u32 data, u32 mask)
{
return value;
}
-
-#endif /* _IR_CORE */
+#endif /* _RC_CORE */