mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
4c7b355df6
commit
d8b4b5822f
@@ -26,7 +26,6 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/slab.h>
|
||||
#include <media/ir-core.h>
|
||||
|
||||
@@ -266,7 +265,7 @@ static void dm1105_card_list(struct pci_dev *pci)
|
||||
|
||||
/* infrared remote control */
|
||||
struct infrared {
|
||||
struct input_dev *input_dev;
|
||||
struct rc_dev *dev;
|
||||
char input_phys[32];
|
||||
struct work_struct work;
|
||||
u32 ir_command;
|
||||
@@ -532,7 +531,7 @@ static void dm1105_emit_key(struct work_struct *work)
|
||||
|
||||
data = (ircom >> 8) & 0x7f;
|
||||
|
||||
ir_keydown(ir->input_dev, data, 0);
|
||||
ir_keydown(ir->dev, data, 0);
|
||||
}
|
||||
|
||||
/* work handler */
|
||||
@@ -593,46 +592,47 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id)
|
||||
|
||||
int __devinit dm1105_ir_init(struct dm1105_dev *dm1105)
|
||||
{
|
||||
struct input_dev *input_dev;
|
||||
char *ir_codes = RC_MAP_DM1105_NEC;
|
||||
struct rc_dev *dev;
|
||||
int err = -ENOMEM;
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev)
|
||||
dev = rc_allocate_device();
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
dm1105->ir.input_dev = input_dev;
|
||||
snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys),
|
||||
"pci-%s/ir0", pci_name(dm1105->pdev));
|
||||
|
||||
input_dev->name = "DVB on-card IR receiver";
|
||||
input_dev->phys = dm1105->ir.input_phys;
|
||||
input_dev->id.bustype = BUS_PCI;
|
||||
input_dev->id.version = 1;
|
||||
dev->driver_name = MODULE_NAME;
|
||||
dev->map_name = RC_MAP_DM1105_NEC;
|
||||
dev->driver_type = RC_DRIVER_SCANCODE;
|
||||
dev->input_name = "DVB on-card IR receiver";
|
||||
dev->input_phys = dm1105->ir.input_phys;
|
||||
dev->input_id.bustype = BUS_PCI;
|
||||
dev->input_id.version = 1;
|
||||
if (dm1105->pdev->subsystem_vendor) {
|
||||
input_dev->id.vendor = dm1105->pdev->subsystem_vendor;
|
||||
input_dev->id.product = dm1105->pdev->subsystem_device;
|
||||
dev->input_id.vendor = dm1105->pdev->subsystem_vendor;
|
||||
dev->input_id.product = dm1105->pdev->subsystem_device;
|
||||
} else {
|
||||
input_dev->id.vendor = dm1105->pdev->vendor;
|
||||
input_dev->id.product = dm1105->pdev->device;
|
||||
dev->input_id.vendor = dm1105->pdev->vendor;
|
||||
dev->input_id.product = dm1105->pdev->device;
|
||||
}
|
||||
|
||||
input_dev->dev.parent = &dm1105->pdev->dev;
|
||||
dev->dev.parent = &dm1105->pdev->dev;
|
||||
|
||||
INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
|
||||
|
||||
err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME);
|
||||
err = rc_register_device(dev);
|
||||
if (err < 0) {
|
||||
input_free_device(input_dev);
|
||||
rc_free_device(dev);
|
||||
return err;
|
||||
}
|
||||
|
||||
dm1105->ir.dev = dev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105)
|
||||
{
|
||||
ir_input_unregister(dm1105->ir.input_dev);
|
||||
rc_unregister_device(dm1105->ir.dev);
|
||||
}
|
||||
|
||||
static int __devinit dm1105_hw_init(struct dm1105_dev *dev)
|
||||
|
||||
@@ -1041,13 +1041,13 @@ static int af9015_rc_query(struct dvb_usb_device *d)
|
||||
priv->rc_keycode = buf[12] << 16 |
|
||||
buf[13] << 8 | buf[14];
|
||||
}
|
||||
ir_keydown(d->rc_input_dev, priv->rc_keycode, 0);
|
||||
ir_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_input_dev, priv->rc_keycode, 0);
|
||||
ir_keydown(d->rc_dev, priv->rc_keycode, 0);
|
||||
} else {
|
||||
deb_rc("%s: no key press\n", __func__);
|
||||
}
|
||||
@@ -1348,9 +1348,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
|
||||
.module_name = "af9015",
|
||||
.rc_query = af9015_rc_query,
|
||||
.rc_interval = AF9015_RC_INTERVAL,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_NEC,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_NEC,
|
||||
},
|
||||
|
||||
.i2c_algo = &af9015_i2c_algo,
|
||||
@@ -1478,9 +1476,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
|
||||
.module_name = "af9015",
|
||||
.rc_query = af9015_rc_query,
|
||||
.rc_interval = AF9015_RC_INTERVAL,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_NEC,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_NEC,
|
||||
},
|
||||
|
||||
.i2c_algo = &af9015_i2c_algo,
|
||||
@@ -1592,9 +1588,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
|
||||
.module_name = "af9015",
|
||||
.rc_query = af9015_rc_query,
|
||||
.rc_interval = AF9015_RC_INTERVAL,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_NEC,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_NEC,
|
||||
},
|
||||
|
||||
.i2c_algo = &af9015_i2c_algo,
|
||||
|
||||
@@ -394,7 +394,7 @@ static int anysee_rc_query(struct dvb_usb_device *d)
|
||||
|
||||
if (ircode[0]) {
|
||||
deb_rc("%s: key pressed %02x\n", __func__, ircode[1]);
|
||||
ir_keydown(d->rc_input_dev, 0x08 << 8 | ircode[1], 0);
|
||||
ir_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -60,7 +60,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
|
||||
extern struct i2c_algorithm dib0700_i2c_algo;
|
||||
extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
|
||||
struct dvb_usb_device_description **desc, int *cold);
|
||||
extern int dib0700_change_protocol(void *priv, u64 ir_type);
|
||||
extern int dib0700_change_protocol(struct rc_dev *dev, u64 ir_type);
|
||||
|
||||
extern int dib0700_device_count;
|
||||
extern int dvb_usb_dib0700_ir_proto;
|
||||
|
||||
@@ -471,9 +471,9 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
||||
return dib0700_ctrl_wr(adap->dev, b, 4);
|
||||
}
|
||||
|
||||
int dib0700_change_protocol(void *priv, u64 ir_type)
|
||||
int dib0700_change_protocol(struct rc_dev *rc, u64 ir_type)
|
||||
{
|
||||
struct dvb_usb_device *d = priv;
|
||||
struct dvb_usb_device *d = rc->priv;
|
||||
struct dib0700_state *st = d->priv;
|
||||
u8 rc_setup[3] = { REQUEST_SET_RC, 0, 0 };
|
||||
int new_proto, ret;
|
||||
@@ -535,7 +535,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
|
||||
if (d == NULL)
|
||||
return;
|
||||
|
||||
if (d->rc_input_dev == NULL) {
|
||||
if (d->rc_dev == NULL) {
|
||||
/* This will occur if disable_rc_polling=1 */
|
||||
usb_free_urb(purb);
|
||||
return;
|
||||
@@ -600,7 +600,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
|
||||
goto resubmit;
|
||||
}
|
||||
|
||||
ir_keydown(d->rc_input_dev, keycode, toggle);
|
||||
ir_keydown(d->rc_dev, keycode, toggle);
|
||||
|
||||
resubmit:
|
||||
/* Clean the buffer before we requeue */
|
||||
|
||||
@@ -520,13 +520,13 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
|
||||
d->last_event = keycode;
|
||||
}
|
||||
|
||||
ir_keydown(d->rc_input_dev, keycode, 0);
|
||||
ir_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_input_dev, keycode, toggle);
|
||||
ir_keydown(d->rc_dev, keycode, toggle);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1924,12 +1924,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_interval = DEFAULT_RC_INTERVAL,
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -1960,12 +1958,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_interval = DEFAULT_RC_INTERVAL,
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2021,12 +2017,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_interval = DEFAULT_RC_INTERVAL,
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2065,12 +2059,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2143,12 +2135,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2189,12 +2179,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2259,12 +2247,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2308,12 +2294,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_NEC_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
|
||||
@@ -2379,12 +2363,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
.num_adapters = 1,
|
||||
@@ -2417,12 +2399,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
.num_adapters = 1,
|
||||
@@ -2487,12 +2467,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
.num_adapters = 1,
|
||||
@@ -2533,12 +2511,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_NEC_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
.num_adapters = 2,
|
||||
@@ -2584,12 +2560,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
|
||||
.num_adapters = 1,
|
||||
@@ -2623,12 +2597,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
|
||||
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
|
||||
.module_name = "dib0700",
|
||||
.rc_query = dib0700_rc_query_old_firmware,
|
||||
.rc_props = {
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
.allowed_protos = IR_TYPE_RC5 |
|
||||
IR_TYPE_RC6 |
|
||||
IR_TYPE_NEC,
|
||||
.change_protocol = dib0700_change_protocol,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -106,10 +106,10 @@ static void legacy_dvb_usb_read_remote_control(struct work_struct *work)
|
||||
d->last_event = event;
|
||||
case REMOTE_KEY_REPEAT:
|
||||
deb_rc("key repeated\n");
|
||||
input_event(d->rc_input_dev, EV_KEY, event, 1);
|
||||
input_sync(d->rc_input_dev);
|
||||
input_event(d->rc_input_dev, EV_KEY, d->last_event, 0);
|
||||
input_sync(d->rc_input_dev);
|
||||
input_event(d->input_dev, EV_KEY, event, 1);
|
||||
input_sync(d->input_dev);
|
||||
input_event(d->input_dev, EV_KEY, d->last_event, 0);
|
||||
input_sync(d->input_dev);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -154,10 +154,22 @@ schedule:
|
||||
schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval));
|
||||
}
|
||||
|
||||
static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d,
|
||||
struct input_dev *input_dev)
|
||||
static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d)
|
||||
{
|
||||
int i, err, rc_interval;
|
||||
struct input_dev *input_dev;
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
input_dev->evbit[0] = BIT_MASK(EV_KEY);
|
||||
input_dev->name = "IR-receiver inside an USB DVB receiver";
|
||||
input_dev->phys = d->rc_phys;
|
||||
usb_to_input_id(d->udev, &input_dev->id);
|
||||
input_dev->dev.parent = &d->udev->dev;
|
||||
d->input_dev = input_dev;
|
||||
d->rc_dev = NULL;
|
||||
|
||||
input_dev->getkeycode = legacy_dvb_usb_getkeycode;
|
||||
input_dev->setkeycode = legacy_dvb_usb_setkeycode;
|
||||
@@ -221,18 +233,34 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
|
||||
msecs_to_jiffies(d->props.rc.core.rc_interval));
|
||||
}
|
||||
|
||||
static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d,
|
||||
struct input_dev *input_dev)
|
||||
static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
|
||||
{
|
||||
int err, rc_interval;
|
||||
struct rc_dev *dev;
|
||||
|
||||
d->props.rc.core.rc_props.priv = d;
|
||||
err = ir_input_register(input_dev,
|
||||
d->props.rc.core.rc_codes,
|
||||
&d->props.rc.core.rc_props,
|
||||
d->props.rc.core.module_name);
|
||||
if (err < 0)
|
||||
dev = rc_allocate_device();
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
dev->driver_name = d->props.rc.core.module_name;
|
||||
dev->map_name = d->props.rc.core.rc_codes;
|
||||
dev->change_protocol = d->props.rc.core.change_protocol;
|
||||
dev->allowed_protos = d->props.rc.core.allowed_protos;
|
||||
dev->driver_type = RC_DRIVER_SCANCODE;
|
||||
usb_to_input_id(d->udev, &dev->input_id);
|
||||
dev->input_name = "IR-receiver inside an USB DVB receiver";
|
||||
dev->input_phys = d->rc_phys;
|
||||
dev->dev.parent = &d->udev->dev;
|
||||
dev->priv = d;
|
||||
|
||||
err = rc_register_device(dev);
|
||||
if (err < 0) {
|
||||
rc_free_device(dev);
|
||||
return err;
|
||||
}
|
||||
|
||||
d->input_dev = NULL;
|
||||
d->rc_dev = dev;
|
||||
|
||||
if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode)
|
||||
return 0;
|
||||
@@ -251,7 +279,6 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d,
|
||||
|
||||
int dvb_usb_remote_init(struct dvb_usb_device *d)
|
||||
{
|
||||
struct input_dev *input_dev;
|
||||
int err;
|
||||
|
||||
if (dvb_usb_disable_rc_polling)
|
||||
@@ -267,26 +294,14 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
|
||||
usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
|
||||
strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
input_dev->evbit[0] = BIT_MASK(EV_KEY);
|
||||
input_dev->name = "IR-receiver inside an USB DVB receiver";
|
||||
input_dev->phys = d->rc_phys;
|
||||
usb_to_input_id(d->udev, &input_dev->id);
|
||||
input_dev->dev.parent = &d->udev->dev;
|
||||
|
||||
/* Start the remote-control polling. */
|
||||
if (d->props.rc.legacy.rc_interval < 40)
|
||||
d->props.rc.legacy.rc_interval = 100; /* default */
|
||||
|
||||
d->rc_input_dev = input_dev;
|
||||
|
||||
if (d->props.rc.mode == DVB_RC_LEGACY)
|
||||
err = legacy_dvb_usb_remote_init(d, input_dev);
|
||||
err = legacy_dvb_usb_remote_init(d);
|
||||
else
|
||||
err = rc_core_dvb_usb_remote_init(d, input_dev);
|
||||
err = rc_core_dvb_usb_remote_init(d);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -301,9 +316,9 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d)
|
||||
cancel_rearming_delayed_work(&d->rc_query_work);
|
||||
flush_scheduled_work();
|
||||
if (d->props.rc.mode == DVB_RC_LEGACY)
|
||||
input_unregister_device(d->rc_input_dev);
|
||||
input_unregister_device(d->input_dev);
|
||||
else
|
||||
ir_input_unregister(d->rc_input_dev);
|
||||
rc_unregister_device(d->rc_dev);
|
||||
}
|
||||
d->state &= ~DVB_USB_STATE_REMOTE;
|
||||
return 0;
|
||||
|
||||
@@ -180,18 +180,20 @@ struct dvb_rc_legacy {
|
||||
* struct dvb_rc properties of remote controller, using rc-core
|
||||
* @rc_codes: name of rc codes table
|
||||
* @protocol: type of protocol(s) currently used by the driver
|
||||
* @allowed_protos: protocol(s) supported by the driver
|
||||
* @change_protocol: callback to change protocol
|
||||
* @rc_query: called to query an event event.
|
||||
* @rc_interval: time in ms between two queries.
|
||||
* @rc_props: remote controller properties
|
||||
* @bulk_mode: device supports bulk mode for RC (disable polling mode)
|
||||
*/
|
||||
struct dvb_rc {
|
||||
char *rc_codes;
|
||||
u64 protocol;
|
||||
u64 allowed_protos;
|
||||
int (*change_protocol)(struct rc_dev *dev, u64 ir_type);
|
||||
char *module_name;
|
||||
int (*rc_query) (struct dvb_usb_device *d);
|
||||
int rc_interval;
|
||||
struct ir_dev_props rc_props;
|
||||
bool bulk_mode; /* uses bulk mode */
|
||||
};
|
||||
|
||||
@@ -385,7 +387,8 @@ struct dvb_usb_adapter {
|
||||
*
|
||||
* @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
|
||||
*
|
||||
* @rc_input_dev: input device for the remote control.
|
||||
* @rc_dev: rc device for the remote control (rc-core mode)
|
||||
* @input_dev: input device for the remote control (legacy mode)
|
||||
* @rc_query_work: struct work_struct frequent rc queries
|
||||
* @last_event: last triggered event
|
||||
* @last_state: last state (no, pressed, repeat)
|
||||
@@ -418,7 +421,8 @@ struct dvb_usb_device {
|
||||
struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
|
||||
|
||||
/* remote control */
|
||||
struct input_dev *rc_input_dev;
|
||||
struct rc_dev *rc_dev;
|
||||
struct input_dev *input_dev;
|
||||
char rc_phys[64];
|
||||
struct delayed_work rc_query_work;
|
||||
u32 last_event;
|
||||
|
||||
@@ -198,7 +198,7 @@ static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u16 keypress)
|
||||
deb_info(1, "INT Key Keypress =%04x", keypress);
|
||||
|
||||
if (keypress > 0)
|
||||
ir_keydown(d->rc_input_dev, keypress, 0);
|
||||
ir_keydown(d->rc_dev, keypress, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -555,42 +555,39 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
||||
static int lme2510_int_service(struct dvb_usb_adapter *adap)
|
||||
{
|
||||
struct dvb_usb_device *d = adap->dev;
|
||||
struct input_dev *input_dev;
|
||||
char *ir_codes = RC_MAP_LME2510;
|
||||
int ret = 0;
|
||||
struct rc_dev *rc;
|
||||
int ret;
|
||||
|
||||
info("STA Configuring Remote");
|
||||
|
||||
usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
|
||||
|
||||
strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
|
||||
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev)
|
||||
rc = rc_allocate_device();
|
||||
if (!rc)
|
||||
return -ENOMEM;
|
||||
|
||||
input_dev->name = "LME2510 Remote Control";
|
||||
input_dev->phys = d->rc_phys;
|
||||
usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
|
||||
strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
|
||||
|
||||
usb_to_input_id(d->udev, &input_dev->id);
|
||||
|
||||
ret |= ir_input_register(input_dev, ir_codes, NULL, "LME 2510");
|
||||
rc->input_name = "LME2510 Remote Control";
|
||||
rc->input_phys = d->rc_phys;
|
||||
rc->map_name = RC_MAP_LME2510;
|
||||
rc->driver_name = "LME 2510";
|
||||
usb_to_input_id(d->udev, &rc->input_id);
|
||||
|
||||
ret = rc_register_device(rc);
|
||||
if (ret) {
|
||||
input_free_device(input_dev);
|
||||
rc_free_device(rc);
|
||||
return ret;
|
||||
}
|
||||
d->rc_dev = rc;
|
||||
|
||||
d->rc_input_dev = input_dev;
|
||||
/* Start the Interupt */
|
||||
ret = lme2510_int_read(adap);
|
||||
|
||||
if (ret < 0) {
|
||||
ir_input_unregister(input_dev);
|
||||
input_free_device(input_dev);
|
||||
rc_unregister_device(rc);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return (ret < 0) ? -ENODEV : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 check_sum(u8 *p, u8 len)
|
||||
@@ -1025,7 +1022,7 @@ void *lme2510_exit_int(struct dvb_usb_device *d)
|
||||
usb_free_coherent(d->udev, 5000, st->buffer,
|
||||
st->lme_urb->transfer_dma);
|
||||
info("Interupt Service Stopped");
|
||||
ir_input_unregister(d->rc_input_dev);
|
||||
rc_unregister_device(d->rc_dev);
|
||||
info("Remote Stopped");
|
||||
}
|
||||
return buffer;
|
||||
|
||||
@@ -171,7 +171,9 @@ struct mantis_pci {
|
||||
struct work_struct uart_work;
|
||||
spinlock_t uart_lock;
|
||||
|
||||
struct input_dev *rc;
|
||||
struct rc_dev *rc;
|
||||
char input_name[80];
|
||||
char input_phys[80];
|
||||
};
|
||||
|
||||
#define MANTIS_HIF_STATUS (mantis->gpio_status)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/input.h>
|
||||
#include <media/ir-core.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
@@ -33,6 +32,7 @@
|
||||
#include "mantis_uart.h"
|
||||
|
||||
#define MODULE_NAME "mantis_core"
|
||||
#define RC_MAP_MANTIS "rc-mantis"
|
||||
|
||||
static struct ir_scancode mantis_ir_table[] = {
|
||||
{ 0x29, KEY_POWER },
|
||||
@@ -95,53 +95,65 @@ static struct ir_scancode mantis_ir_table[] = {
|
||||
{ 0x00, KEY_BLUE },
|
||||
};
|
||||
|
||||
struct ir_scancode_table ir_mantis = {
|
||||
.scan = mantis_ir_table,
|
||||
.size = ARRAY_SIZE(mantis_ir_table),
|
||||
static struct rc_keymap ir_mantis_map = {
|
||||
.map = {
|
||||
.scan = mantis_ir_table,
|
||||
.size = ARRAY_SIZE(mantis_ir_table),
|
||||
.ir_type = IR_TYPE_UNKNOWN,
|
||||
.name = RC_MAP_MANTIS,
|
||||
}
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(ir_mantis);
|
||||
|
||||
int mantis_input_init(struct mantis_pci *mantis)
|
||||
{
|
||||
struct input_dev *rc;
|
||||
char name[80], dev[80];
|
||||
struct rc_dev *dev;
|
||||
int err;
|
||||
|
||||
rc = input_allocate_device();
|
||||
if (!rc) {
|
||||
dprintk(MANTIS_ERROR, 1, "Input device allocate failed");
|
||||
return -ENOMEM;
|
||||
err = ir_register_map(&ir_mantis_map);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
dev = rc_allocate_device();
|
||||
if (!dev) {
|
||||
dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
|
||||
err = -ENOMEM;
|
||||
goto out_map;
|
||||
}
|
||||
|
||||
sprintf(name, "Mantis %s IR receiver", mantis->hwconfig->model_name);
|
||||
sprintf(dev, "pci-%s/ir0", pci_name(mantis->pdev));
|
||||
sprintf(mantis->input_name, "Mantis %s IR receiver", mantis->hwconfig->model_name);
|
||||
sprintf(mantis->input_phys, "pci-%s/ir0", pci_name(mantis->pdev));
|
||||
|
||||
rc->name = name;
|
||||
rc->phys = dev;
|
||||
dev->input_name = mantis->input_name;
|
||||
dev->input_phys = mantis->input_phys;
|
||||
dev->input_id.bustype = BUS_PCI;
|
||||
dev->input_id.vendor = mantis->vendor_id;
|
||||
dev->input_id.product = mantis->device_id;
|
||||
dev->input_id.version = 1;
|
||||
dev->driver_name = MODULE_NAME;
|
||||
dev->map_name = RC_MAP_MANTIS;
|
||||
dev->dev.parent = &mantis->pdev->dev;
|
||||
|
||||
rc->id.bustype = BUS_PCI;
|
||||
rc->id.vendor = mantis->vendor_id;
|
||||
rc->id.product = mantis->device_id;
|
||||
rc->id.version = 1;
|
||||
rc->dev = mantis->pdev->dev;
|
||||
|
||||
err = __ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME);
|
||||
err = rc_register_device(dev);
|
||||
if (err) {
|
||||
dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
|
||||
input_free_device(rc);
|
||||
return -ENODEV;
|
||||
goto out_dev;
|
||||
}
|
||||
|
||||
mantis->rc = rc;
|
||||
|
||||
mantis->rc = dev;
|
||||
return 0;
|
||||
|
||||
out_dev:
|
||||
rc_free_device(dev);
|
||||
out_map:
|
||||
ir_unregister_map(&ir_mantis_map);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
int mantis_exit(struct mantis_pci *mantis)
|
||||
{
|
||||
struct input_dev *rc = mantis->rc;
|
||||
|
||||
ir_input_unregister(rc);
|
||||
|
||||
rc_unregister_device(mantis->rc);
|
||||
ir_unregister_map(&ir_mantis_map);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ static int smscore_init_ir(struct smscore_device_t *coredev)
|
||||
int rc;
|
||||
void *buffer;
|
||||
|
||||
coredev->ir.input_dev = NULL;
|
||||
coredev->ir.dev = NULL;
|
||||
ir_io = sms_get_board(smscore_get_board_id(coredev))->board_cfg.ir;
|
||||
if (ir_io) {/* only if IR port exist we use IR sub-module */
|
||||
sms_info("IR loading");
|
||||
|
||||
@@ -45,25 +45,24 @@ void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len)
|
||||
ev.duration = abs(samples[i]) * 1000; /* Convert to ns */
|
||||
ev.pulse = (samples[i] > 0) ? false : true;
|
||||
|
||||
ir_raw_event_store(coredev->ir.input_dev, &ev);
|
||||
ir_raw_event_store(coredev->ir.dev, &ev);
|
||||
}
|
||||
ir_raw_event_handle(coredev->ir.input_dev);
|
||||
ir_raw_event_handle(coredev->ir.dev);
|
||||
}
|
||||
|
||||
int sms_ir_init(struct smscore_device_t *coredev)
|
||||
{
|
||||
struct input_dev *input_dev;
|
||||
int err;
|
||||
int board_id = smscore_get_board_id(coredev);
|
||||
struct rc_dev *dev;
|
||||
|
||||
sms_log("Allocating input device");
|
||||
input_dev = input_allocate_device();
|
||||
if (!input_dev) {
|
||||
sms_log("Allocating rc device");
|
||||
dev = rc_allocate_device();
|
||||
if (!dev) {
|
||||
sms_err("Not enough memory");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
coredev->ir.input_dev = input_dev;
|
||||
|
||||
coredev->ir.controller = 0; /* Todo: vega/nova SPI number */
|
||||
coredev->ir.timeout = IR_DEFAULT_TIMEOUT;
|
||||
sms_log("IR port %d, timeout %d ms",
|
||||
@@ -75,38 +74,41 @@ int sms_ir_init(struct smscore_device_t *coredev)
|
||||
strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys));
|
||||
strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys));
|
||||
|
||||
input_dev->name = coredev->ir.name;
|
||||
input_dev->phys = coredev->ir.phys;
|
||||
input_dev->dev.parent = coredev->device;
|
||||
dev->input_name = coredev->ir.name;
|
||||
dev->input_phys = coredev->ir.phys;
|
||||
dev->dev.parent = coredev->device;
|
||||
|
||||
#if 0
|
||||
/* TODO: properly initialize the parameters bellow */
|
||||
input_dev->id.bustype = BUS_USB;
|
||||
input_dev->id.version = 1;
|
||||
input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
|
||||
input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
|
||||
dev->input_id.bustype = BUS_USB;
|
||||
dev->input_id.version = 1;
|
||||
dev->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
|
||||
dev->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
|
||||
#endif
|
||||
|
||||
coredev->ir.props.priv = coredev;
|
||||
coredev->ir.props.driver_type = RC_DRIVER_IR_RAW;
|
||||
coredev->ir.props.allowed_protos = IR_TYPE_ALL;
|
||||
dev->priv = coredev;
|
||||
dev->driver_type = RC_DRIVER_IR_RAW;
|
||||
dev->allowed_protos = IR_TYPE_ALL;
|
||||
dev->map_name = sms_get_board(board_id)->rc_codes;
|
||||
dev->driver_name = MODULE_NAME;
|
||||
|
||||
sms_log("Input device (IR) %s is set for key events", input_dev->name);
|
||||
sms_log("Input device (IR) %s is set for key events", dev->input_name);
|
||||
|
||||
if (ir_input_register(input_dev, sms_get_board(board_id)->rc_codes,
|
||||
&coredev->ir.props, MODULE_NAME)) {
|
||||
err = rc_register_device(dev);
|
||||
if (err < 0) {
|
||||
sms_err("Failed to register device");
|
||||
input_free_device(input_dev);
|
||||
return -EACCES;
|
||||
rc_free_device(dev);
|
||||
return err;
|
||||
}
|
||||
|
||||
coredev->ir.dev = dev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sms_ir_exit(struct smscore_device_t *coredev)
|
||||
{
|
||||
if (coredev->ir.input_dev)
|
||||
ir_input_unregister(coredev->ir.input_dev);
|
||||
if (coredev->ir.dev)
|
||||
rc_unregister_device(coredev->ir.dev);
|
||||
|
||||
sms_log("");
|
||||
}
|
||||
|
||||
@@ -35,13 +35,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
struct smscore_device_t;
|
||||
|
||||
struct ir_t {
|
||||
struct input_dev *input_dev;
|
||||
struct rc_dev *dev;
|
||||
char name[40];
|
||||
char phys[32];
|
||||
|
||||
char *rc_codes;
|
||||
u64 protocol;
|
||||
struct ir_dev_props props;
|
||||
|
||||
u32 timeout;
|
||||
u32 controller;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <media/ir-core.h>
|
||||
|
||||
@@ -96,7 +95,7 @@ MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding");
|
||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||
|
||||
struct budget_ci_ir {
|
||||
struct input_dev *dev;
|
||||
struct rc_dev *dev;
|
||||
struct tasklet_struct msp430_irq_tasklet;
|
||||
char name[72]; /* 40 + 32 for (struct saa7146_dev).name */
|
||||
char phys[32];
|
||||
@@ -118,7 +117,7 @@ struct budget_ci {
|
||||
static void msp430_ir_interrupt(unsigned long data)
|
||||
{
|
||||
struct budget_ci *budget_ci = (struct budget_ci *) data;
|
||||
struct input_dev *dev = budget_ci->ir.dev;
|
||||
struct rc_dev *dev = budget_ci->ir.dev;
|
||||
u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8;
|
||||
|
||||
/*
|
||||
@@ -166,13 +165,11 @@ static void msp430_ir_interrupt(unsigned long data)
|
||||
static int msp430_ir_init(struct budget_ci *budget_ci)
|
||||
{
|
||||
struct saa7146_dev *saa = budget_ci->budget.dev;
|
||||
struct input_dev *input_dev = budget_ci->ir.dev;
|
||||
struct rc_dev *dev;
|
||||
int error;
|
||||
char *ir_codes = NULL;
|
||||
|
||||
|
||||
budget_ci->ir.dev = input_dev = input_allocate_device();
|
||||
if (!input_dev) {
|
||||
dev = rc_allocate_device();
|
||||
if (!dev) {
|
||||
printk(KERN_ERR "budget_ci: IR interface initialisation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -182,19 +179,19 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
|
||||
snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys),
|
||||
"pci-%s/ir0", pci_name(saa->pci));
|
||||
|
||||
input_dev->name = budget_ci->ir.name;
|
||||
|
||||
input_dev->phys = budget_ci->ir.phys;
|
||||
input_dev->id.bustype = BUS_PCI;
|
||||
input_dev->id.version = 1;
|
||||
dev->driver_name = MODULE_NAME;
|
||||
dev->input_name = budget_ci->ir.name;
|
||||
dev->input_phys = budget_ci->ir.phys;
|
||||
dev->input_id.bustype = BUS_PCI;
|
||||
dev->input_id.version = 1;
|
||||
if (saa->pci->subsystem_vendor) {
|
||||
input_dev->id.vendor = saa->pci->subsystem_vendor;
|
||||
input_dev->id.product = saa->pci->subsystem_device;
|
||||
dev->input_id.vendor = saa->pci->subsystem_vendor;
|
||||
dev->input_id.product = saa->pci->subsystem_device;
|
||||
} else {
|
||||
input_dev->id.vendor = saa->pci->vendor;
|
||||
input_dev->id.product = saa->pci->device;
|
||||
dev->input_id.vendor = saa->pci->vendor;
|
||||
dev->input_id.product = saa->pci->device;
|
||||
}
|
||||
input_dev->dev.parent = &saa->pci->dev;
|
||||
dev->dev.parent = &saa->pci->dev;
|
||||
|
||||
if (rc5_device < 0)
|
||||
budget_ci->ir.rc5_device = IR_DEVICE_ANY;
|
||||
@@ -208,7 +205,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
|
||||
case 0x1011:
|
||||
case 0x1012:
|
||||
/* The hauppauge keymap is a superset of these remotes */
|
||||
ir_codes = RC_MAP_HAUPPAUGE_NEW;
|
||||
dev->map_name = RC_MAP_HAUPPAUGE_NEW;
|
||||
|
||||
if (rc5_device < 0)
|
||||
budget_ci->ir.rc5_device = 0x1f;
|
||||
@@ -218,23 +215,22 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
|
||||
case 0x1019:
|
||||
case 0x101a:
|
||||
/* for the Technotrend 1500 bundled remote */
|
||||
ir_codes = RC_MAP_TT_1500;
|
||||
dev->map_name = RC_MAP_TT_1500;
|
||||
break;
|
||||
default:
|
||||
/* unknown remote */
|
||||
ir_codes = RC_MAP_BUDGET_CI_OLD;
|
||||
dev->map_name = RC_MAP_BUDGET_CI_OLD;
|
||||
break;
|
||||
}
|
||||
|
||||
error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME);
|
||||
error = rc_register_device(dev);
|
||||
if (error) {
|
||||
printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
|
||||
rc_free_device(dev);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* note: these must be after input_register_device */
|
||||
input_dev->rep[REP_DELAY] = 400;
|
||||
input_dev->rep[REP_PERIOD] = 250;
|
||||
budget_ci->ir.dev = dev;
|
||||
|
||||
tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt,
|
||||
(unsigned long) budget_ci);
|
||||
@@ -248,13 +244,12 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
|
||||
static void msp430_ir_deinit(struct budget_ci *budget_ci)
|
||||
{
|
||||
struct saa7146_dev *saa = budget_ci->budget.dev;
|
||||
struct input_dev *dev = budget_ci->ir.dev;
|
||||
|
||||
SAA7146_IER_DISABLE(saa, MASK_06);
|
||||
saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT);
|
||||
tasklet_kill(&budget_ci->ir.msp430_irq_tasklet);
|
||||
|
||||
ir_input_unregister(dev);
|
||||
rc_unregister_device(budget_ci->ir.dev);
|
||||
}
|
||||
|
||||
static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address)
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
#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;
|
||||
@@ -357,7 +355,7 @@ void ene_rx_sense_carrier(struct ene_device *dev)
|
||||
ev.carrier_report = true;
|
||||
ev.carrier = carrier;
|
||||
ev.duty_cycle = duty_cycle;
|
||||
ir_raw_event_store(dev->idev, &ev);
|
||||
ir_raw_event_store(dev->rdev, &ev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,32 +446,32 @@ static void ene_rx_setup(struct ene_device *dev)
|
||||
|
||||
select_timeout:
|
||||
if (dev->rx_fan_input_inuse) {
|
||||
dev->props->rx_resolution = MS_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN);
|
||||
dev->rdev->rx_resolution = MS_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN);
|
||||
|
||||
/* Fan input doesn't support timeouts, it just ends the
|
||||
input with a maximum sample */
|
||||
dev->props->min_timeout = dev->props->max_timeout =
|
||||
dev->rdev->min_timeout = dev->rdev->max_timeout =
|
||||
MS_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK *
|
||||
ENE_FW_SAMPLE_PERIOD_FAN);
|
||||
} else {
|
||||
dev->props->rx_resolution = MS_TO_NS(sample_period);
|
||||
dev->rdev->rx_resolution = MS_TO_NS(sample_period);
|
||||
|
||||
/* Theoreticly timeout is unlimited, but we cap it
|
||||
* because it was seen that on one device, it
|
||||
* would stop sending spaces after around 250 msec.
|
||||
* Besides, this is close to 2^32 anyway and timeout is u32.
|
||||
*/
|
||||
dev->props->min_timeout = MS_TO_NS(127 * sample_period);
|
||||
dev->props->max_timeout = MS_TO_NS(200000);
|
||||
dev->rdev->min_timeout = MS_TO_NS(127 * sample_period);
|
||||
dev->rdev->max_timeout = MS_TO_NS(200000);
|
||||
}
|
||||
|
||||
if (dev->hw_learning_and_tx_capable)
|
||||
dev->props->tx_resolution = MS_TO_NS(sample_period);
|
||||
dev->rdev->tx_resolution = MS_TO_NS(sample_period);
|
||||
|
||||
if (dev->props->timeout > dev->props->max_timeout)
|
||||
dev->props->timeout = dev->props->max_timeout;
|
||||
if (dev->props->timeout < dev->props->min_timeout)
|
||||
dev->props->timeout = dev->props->min_timeout;
|
||||
if (dev->rdev->timeout > dev->rdev->max_timeout)
|
||||
dev->rdev->timeout = dev->rdev->max_timeout;
|
||||
if (dev->rdev->timeout < dev->rdev->min_timeout)
|
||||
dev->rdev->timeout = dev->rdev->min_timeout;
|
||||
}
|
||||
|
||||
/* Enable the device for receive */
|
||||
@@ -504,7 +502,7 @@ static void ene_rx_enable(struct ene_device *dev)
|
||||
ene_set_reg_mask(dev, ENE_FW1, ENE_FW1_ENABLE | ENE_FW1_IRQ);
|
||||
|
||||
/* enter idle mode */
|
||||
ir_raw_event_set_idle(dev->idev, true);
|
||||
ir_raw_event_set_idle(dev->rdev, true);
|
||||
dev->rx_enabled = true;
|
||||
}
|
||||
|
||||
@@ -518,7 +516,7 @@ static void ene_rx_disable(struct ene_device *dev)
|
||||
/* disable hardware IRQ and firmware flag */
|
||||
ene_clear_reg_mask(dev, ENE_FW1, ENE_FW1_ENABLE | ENE_FW1_IRQ);
|
||||
|
||||
ir_raw_event_set_idle(dev->idev, true);
|
||||
ir_raw_event_set_idle(dev->rdev, true);
|
||||
dev->rx_enabled = false;
|
||||
}
|
||||
|
||||
@@ -805,10 +803,10 @@ static irqreturn_t ene_isr(int irq, void *data)
|
||||
|
||||
ev.duration = MS_TO_NS(hw_sample);
|
||||
ev.pulse = pulse;
|
||||
ir_raw_event_store_with_filter(dev->idev, &ev);
|
||||
ir_raw_event_store_with_filter(dev->rdev, &ev);
|
||||
}
|
||||
|
||||
ir_raw_event_handle(dev->idev);
|
||||
ir_raw_event_handle(dev->rdev);
|
||||
unlock:
|
||||
spin_unlock_irqrestore(&dev->hw_lock, flags);
|
||||
return retval;
|
||||
@@ -823,7 +821,7 @@ static void ene_setup_default_settings(struct ene_device *dev)
|
||||
dev->learning_mode_enabled = learning_mode_force;
|
||||
|
||||
/* Set reasonable default timeout */
|
||||
dev->props->timeout = MS_TO_NS(150000);
|
||||
dev->rdev->timeout = MS_TO_NS(150000);
|
||||
}
|
||||
|
||||
/* Upload all hardware settings at once. Used at load and resume time */
|
||||
@@ -838,9 +836,9 @@ static void ene_setup_hw_settings(struct ene_device *dev)
|
||||
}
|
||||
|
||||
/* outside interface: called on first open*/
|
||||
static int ene_open(void *data)
|
||||
static int ene_open(struct rc_dev *rdev)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&dev->hw_lock, flags);
|
||||
@@ -850,9 +848,9 @@ static int ene_open(void *data)
|
||||
}
|
||||
|
||||
/* outside interface: called on device close*/
|
||||
static void ene_close(void *data)
|
||||
static void ene_close(struct rc_dev *rdev)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&dev->hw_lock, flags);
|
||||
|
||||
@@ -861,9 +859,9 @@ static void ene_close(void *data)
|
||||
}
|
||||
|
||||
/* outside interface: set transmitter mask */
|
||||
static int ene_set_tx_mask(void *data, u32 tx_mask)
|
||||
static int ene_set_tx_mask(struct rc_dev *rdev, u32 tx_mask)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
dbg("TX: attempt to set transmitter mask %02x", tx_mask);
|
||||
|
||||
/* invalid txmask */
|
||||
@@ -879,9 +877,9 @@ static int ene_set_tx_mask(void *data, u32 tx_mask)
|
||||
}
|
||||
|
||||
/* outside interface : set tx carrier */
|
||||
static int ene_set_tx_carrier(void *data, u32 carrier)
|
||||
static int ene_set_tx_carrier(struct rc_dev *rdev, u32 carrier)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
u32 period = 2000000 / carrier;
|
||||
|
||||
dbg("TX: attempt to set tx carrier to %d kHz", carrier);
|
||||
@@ -900,9 +898,9 @@ static int ene_set_tx_carrier(void *data, u32 carrier)
|
||||
}
|
||||
|
||||
/*outside interface : set tx duty cycle */
|
||||
static int ene_set_tx_duty_cycle(void *data, u32 duty_cycle)
|
||||
static int ene_set_tx_duty_cycle(struct rc_dev *rdev, u32 duty_cycle)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
dbg("TX: setting duty cycle to %d%%", duty_cycle);
|
||||
dev->tx_duty_cycle = duty_cycle;
|
||||
ene_tx_set_carrier(dev);
|
||||
@@ -910,9 +908,9 @@ static int ene_set_tx_duty_cycle(void *data, u32 duty_cycle)
|
||||
}
|
||||
|
||||
/* outside interface: enable learning mode */
|
||||
static int ene_set_learning_mode(void *data, int enable)
|
||||
static int ene_set_learning_mode(struct rc_dev *rdev, int enable)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
unsigned long flags;
|
||||
if (enable == dev->learning_mode_enabled)
|
||||
return 0;
|
||||
@@ -926,9 +924,9 @@ static int ene_set_learning_mode(void *data, int enable)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ene_set_carrier_report(void *data, int enable)
|
||||
static int ene_set_carrier_report(struct rc_dev *rdev, int enable)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
unsigned long flags;
|
||||
|
||||
if (enable == dev->carrier_detect_enabled)
|
||||
@@ -944,18 +942,20 @@ static int ene_set_carrier_report(void *data, int enable)
|
||||
}
|
||||
|
||||
/* outside interface: enable or disable idle mode */
|
||||
static void ene_set_idle(void *data, bool idle)
|
||||
static void ene_set_idle(struct rc_dev *rdev, bool idle)
|
||||
{
|
||||
struct ene_device *dev = rdev->priv;
|
||||
|
||||
if (idle) {
|
||||
ene_rx_reset((struct ene_device *)data);
|
||||
ene_rx_reset(dev);
|
||||
dbg("RX: end of data");
|
||||
}
|
||||
}
|
||||
|
||||
/* outside interface: transmit */
|
||||
static int ene_transmit(void *data, int *buf, u32 n)
|
||||
static int ene_transmit(struct rc_dev *rdev, int *buf, u32 n)
|
||||
{
|
||||
struct ene_device *dev = (struct ene_device *)data;
|
||||
struct ene_device *dev = rdev->priv;
|
||||
unsigned long flags;
|
||||
|
||||
dev->tx_buffer = buf;
|
||||
@@ -992,16 +992,13 @@ static int ene_transmit(void *data, int *buf, u32 n)
|
||||
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 rc_dev *rdev;
|
||||
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)
|
||||
rdev = rc_allocate_device();
|
||||
if (!dev || !rdev)
|
||||
goto error1;
|
||||
|
||||
/* validate resources */
|
||||
@@ -1054,24 +1051,25 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
|
||||
if (!dev->hw_learning_and_tx_capable)
|
||||
learning_mode_force = false;
|
||||
|
||||
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->s_idle = ene_set_idle;
|
||||
|
||||
dev->props = ir_props;
|
||||
dev->idev = input_dev;
|
||||
rdev->driver_type = RC_DRIVER_IR_RAW;
|
||||
rdev->allowed_protos = IR_TYPE_ALL;
|
||||
rdev->priv = dev;
|
||||
rdev->open = ene_open;
|
||||
rdev->close = ene_close;
|
||||
rdev->s_idle = ene_set_idle;
|
||||
rdev->driver_name = ENE_DRIVER_NAME;
|
||||
rdev->map_name = RC_MAP_RC6_MCE;
|
||||
rdev->input_name = "ENE eHome Infrared Remote Receiver";
|
||||
|
||||
if (dev->hw_learning_and_tx_capable) {
|
||||
ir_props->s_learning_mode = ene_set_learning_mode;
|
||||
rdev->s_learning_mode = ene_set_learning_mode;
|
||||
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->s_tx_duty_cycle = ene_set_tx_duty_cycle;
|
||||
ir_props->s_carrier_report = ene_set_carrier_report;
|
||||
rdev->tx_ir = ene_transmit;
|
||||
rdev->s_tx_mask = ene_set_tx_mask;
|
||||
rdev->s_tx_carrier = ene_set_tx_carrier;
|
||||
rdev->s_tx_duty_cycle = ene_set_tx_duty_cycle;
|
||||
rdev->s_carrier_report = ene_set_carrier_report;
|
||||
rdev->input_name = "ENE eHome Infrared Remote Transceiver";
|
||||
}
|
||||
|
||||
ene_rx_setup_hw_buffer(dev);
|
||||
@@ -1081,16 +1079,11 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
|
||||
device_set_wakeup_capable(&pnp_dev->dev, true);
|
||||
device_set_wakeup_enable(&pnp_dev->dev, true);
|
||||
|
||||
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))
|
||||
error = rc_register_device(rdev);
|
||||
if (error < 0)
|
||||
goto error;
|
||||
|
||||
dev->rdev = rdev;
|
||||
ene_notice("driver has been succesfully loaded");
|
||||
return 0;
|
||||
error:
|
||||
@@ -1099,8 +1092,7 @@ error:
|
||||
if (dev && dev->hw_io >= 0)
|
||||
release_region(dev->hw_io, ENE_IO_SIZE);
|
||||
error1:
|
||||
input_free_device(input_dev);
|
||||
kfree(ir_props);
|
||||
rc_free_device(rdev);
|
||||
kfree(dev);
|
||||
return error;
|
||||
}
|
||||
@@ -1118,8 +1110,7 @@ static void ene_remove(struct pnp_dev *pnp_dev)
|
||||
|
||||
free_irq(dev->irq, dev);
|
||||
release_region(dev->hw_io, ENE_IO_SIZE);
|
||||
ir_input_unregister(dev->idev);
|
||||
kfree(dev->props);
|
||||
rc_unregister_device(dev->rdev);
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,8 +205,7 @@
|
||||
|
||||
struct ene_device {
|
||||
struct pnp_dev *pnp_dev;
|
||||
struct input_dev *idev;
|
||||
struct ir_dev_props *props;
|
||||
struct rc_dev *rdev;
|
||||
|
||||
/* hw IO settings */
|
||||
long hw_io;
|
||||
|
||||
@@ -88,7 +88,6 @@ static ssize_t lcd_write(struct file *file, const char *buf,
|
||||
|
||||
struct imon_context {
|
||||
struct device *dev;
|
||||
struct ir_dev_props *props;
|
||||
/* Newer devices have two interfaces */
|
||||
struct usb_device *usbdev_intf0;
|
||||
struct usb_device *usbdev_intf1;
|
||||
@@ -123,7 +122,7 @@ struct imon_context {
|
||||
u16 vendor; /* usb vendor ID */
|
||||
u16 product; /* usb product ID */
|
||||
|
||||
struct input_dev *rdev; /* input device for remote */
|
||||
struct rc_dev *rdev; /* rc-core device for remote */
|
||||
struct input_dev *idev; /* input device for panel & IR mouse */
|
||||
struct input_dev *touch; /* input device for touchscreen */
|
||||
|
||||
@@ -984,16 +983,16 @@ static void imon_touch_display_timeout(unsigned long data)
|
||||
* really just RC-6), but only one or the other at a time, as the signals
|
||||
* are decoded onboard the receiver.
|
||||
*/
|
||||
int imon_ir_change_protocol(void *priv, u64 ir_type)
|
||||
static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type)
|
||||
{
|
||||
int retval;
|
||||
struct imon_context *ictx = priv;
|
||||
struct imon_context *ictx = rc->priv;
|
||||
struct device *dev = ictx->dev;
|
||||
bool pad_mouse;
|
||||
unsigned char ir_proto_packet[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
|
||||
|
||||
if (ir_type && !(ir_type & ictx->props->allowed_protos))
|
||||
if (ir_type && !(ir_type & rc->allowed_protos))
|
||||
dev_warn(dev, "Looks like you're trying to use an IR protocol "
|
||||
"this device does not support\n");
|
||||
|
||||
@@ -1757,7 +1756,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
|
||||
printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
|
||||
|
||||
ictx->display_type = detected_display_type;
|
||||
ictx->props->allowed_protos = allowed_protos;
|
||||
ictx->rdev->allowed_protos = allowed_protos;
|
||||
ictx->ir_type = allowed_protos;
|
||||
}
|
||||
|
||||
@@ -1811,18 +1810,15 @@ static void imon_set_display_type(struct imon_context *ictx)
|
||||
ictx->display_type = configured_display_type;
|
||||
}
|
||||
|
||||
static struct input_dev *imon_init_rdev(struct imon_context *ictx)
|
||||
static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
|
||||
{
|
||||
struct input_dev *rdev;
|
||||
struct ir_dev_props *props;
|
||||
struct rc_dev *rdev;
|
||||
int ret;
|
||||
char *ir_codes = NULL;
|
||||
const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x88 };
|
||||
|
||||
rdev = input_allocate_device();
|
||||
props = kzalloc(sizeof(*props), GFP_KERNEL);
|
||||
if (!rdev || !props) {
|
||||
rdev = rc_allocate_device();
|
||||
if (!rdev) {
|
||||
dev_err(ictx->dev, "remote control dev allocation failed\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -1833,18 +1829,20 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
|
||||
sizeof(ictx->phys_rdev));
|
||||
strlcat(ictx->phys_rdev, "/input0", sizeof(ictx->phys_rdev));
|
||||
|
||||
rdev->name = ictx->name_rdev;
|
||||
rdev->phys = ictx->phys_rdev;
|
||||
usb_to_input_id(ictx->usbdev_intf0, &rdev->id);
|
||||
rdev->input_name = ictx->name_rdev;
|
||||
rdev->input_phys = ictx->phys_rdev;
|
||||
usb_to_input_id(ictx->usbdev_intf0, &rdev->input_id);
|
||||
rdev->dev.parent = ictx->dev;
|
||||
rdev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
|
||||
input_set_drvdata(rdev, ictx);
|
||||
|
||||
props->priv = ictx;
|
||||
props->driver_type = RC_DRIVER_SCANCODE;
|
||||
props->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */
|
||||
props->change_protocol = imon_ir_change_protocol;
|
||||
ictx->props = props;
|
||||
rdev->priv = ictx;
|
||||
rdev->driver_type = RC_DRIVER_SCANCODE;
|
||||
rdev->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */
|
||||
rdev->change_protocol = imon_ir_change_protocol;
|
||||
rdev->driver_name = MOD_NAME;
|
||||
if (ictx->ir_type == IR_TYPE_RC6)
|
||||
rdev->map_name = RC_MAP_IMON_MCE;
|
||||
else
|
||||
rdev->map_name = RC_MAP_IMON_PAD;
|
||||
|
||||
/* Enable front-panel buttons and/or knobs */
|
||||
memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
|
||||
@@ -1858,12 +1856,7 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
|
||||
|
||||
imon_set_display_type(ictx);
|
||||
|
||||
if (ictx->ir_type == IR_TYPE_RC6)
|
||||
ir_codes = RC_MAP_IMON_MCE;
|
||||
else
|
||||
ir_codes = RC_MAP_IMON_PAD;
|
||||
|
||||
ret = ir_input_register(rdev, ir_codes, props, MOD_NAME);
|
||||
ret = rc_register_device(rdev);
|
||||
if (ret < 0) {
|
||||
dev_err(ictx->dev, "remote input dev register failed\n");
|
||||
goto out;
|
||||
@@ -1872,8 +1865,7 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
|
||||
return rdev;
|
||||
|
||||
out:
|
||||
kfree(props);
|
||||
input_free_device(rdev);
|
||||
rc_free_device(rdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2144,7 +2136,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
|
||||
return ictx;
|
||||
|
||||
urb_submit_failed:
|
||||
ir_input_unregister(ictx->rdev);
|
||||
rc_unregister_device(ictx->rdev);
|
||||
rdev_setup_failed:
|
||||
input_unregister_device(ictx->idev);
|
||||
idev_setup_failed:
|
||||
@@ -2371,7 +2363,7 @@ static void __devexit imon_disconnect(struct usb_interface *interface)
|
||||
ictx->dev_present_intf0 = false;
|
||||
usb_kill_urb(ictx->rx_urb_intf0);
|
||||
input_unregister_device(ictx->idev);
|
||||
ir_input_unregister(ictx->rdev);
|
||||
rc_unregister_device(ictx->rdev);
|
||||
if (ictx->display_supported) {
|
||||
if (ictx->display_type == IMON_DISPLAY_TYPE_LCD)
|
||||
usb_deregister_dev(interface, &imon_lcd_class);
|
||||
|
||||
@@ -37,17 +37,16 @@ enum jvc_state {
|
||||
|
||||
/**
|
||||
* ir_jvc_decode() - Decode one JVC pulse or space
|
||||
* @input_dev: the struct input_dev descriptor of the device
|
||||
* @dev: the struct rc_dev descriptor of the device
|
||||
* @duration: the struct ir_raw_event descriptor of the pulse/space
|
||||
*
|
||||
* This function returns -EINVAL if the pulse violates the state machine
|
||||
*/
|
||||
static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
|
||||
static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
|
||||
{
|
||||
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
|
||||
struct jvc_dec *data = &ir_dev->raw->jvc;
|
||||
struct jvc_dec *data = &dev->raw->jvc;
|
||||
|
||||
if (!(ir_dev->raw->enabled_protocols & IR_TYPE_JVC))
|
||||
if (!(dev->raw->enabled_protocols & IR_TYPE_JVC))
|
||||
return 0;
|
||||
|
||||
if (!is_timing_event(ev)) {
|
||||
@@ -140,12 +139,12 @@ again:
|
||||
scancode = (bitrev8((data->bits >> 8) & 0xff) << 8) |
|
||||
(bitrev8((data->bits >> 0) & 0xff) << 0);
|
||||
IR_dprintk(1, "JVC scancode 0x%04x\n", scancode);
|
||||
ir_keydown(input_dev, scancode, data->toggle);
|
||||
ir_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(input_dev);
|
||||
ir_repeat(dev);
|
||||
} else {
|
||||
IR_dprintk(1, "JVC invalid repeat msg\n");
|
||||
break;
|
||||
|
||||
@@ -24,21 +24,20 @@
|
||||
/**
|
||||
* ir_lirc_decode() - Send raw IR data to lirc_dev to be relayed to the
|
||||
* lircd userspace daemon for decoding.
|
||||
* @input_dev: the struct input_dev descriptor of the device
|
||||
* @input_dev: the struct rc_dev descriptor of the device
|
||||
* @duration: the struct ir_raw_event descriptor of the pulse/space
|
||||
*
|
||||
* This function returns -EINVAL if the lirc interfaces aren't wired up.
|
||||
*/
|
||||
static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
|
||||
static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
|
||||
{
|
||||
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
|
||||
struct lirc_codec *lirc = &ir_dev->raw->lirc;
|
||||
struct lirc_codec *lirc = &dev->raw->lirc;
|
||||
int sample;
|
||||
|
||||
if (!(ir_dev->raw->enabled_protocols & IR_TYPE_LIRC))
|
||||
if (!(dev->raw->enabled_protocols & IR_TYPE_LIRC))
|
||||
return 0;
|
||||
|
||||
if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf)
|
||||
if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
|
||||
return -EINVAL;
|
||||
|
||||
/* Packet start */
|
||||
@@ -79,7 +78,7 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
|
||||
(u64)LIRC_VALUE_MASK);
|
||||
|
||||
gap_sample = LIRC_SPACE(lirc->gap_duration);
|
||||
lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf,
|
||||
lirc_buffer_write(dev->raw->lirc.drv->rbuf,
|
||||
(unsigned char *) &gap_sample);
|
||||
lirc->gap = false;
|
||||
}
|
||||
@@ -88,9 +87,9 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)
|
||||
LIRC_SPACE(ev.duration / 1000);
|
||||
}
|
||||
|
||||
lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf,
|
||||
lirc_buffer_write(dev->raw->lirc.drv->rbuf,
|
||||
(unsigned char *) &sample);
|
||||
wake_up(&ir_dev->raw->lirc.drv->rbuf->wait_poll);
|
||||
wake_up(&dev->raw->lirc.drv->rbuf->wait_poll);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -99,7 +98,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
|
||||
size_t n, loff_t *ppos)
|
||||
{
|
||||
struct lirc_codec *lirc;
|
||||
struct ir_input_dev *ir_dev;
|
||||
struct rc_dev *dev;
|
||||
int *txbuf; /* buffer with values to transmit */
|
||||
int ret = 0, count;
|
||||
|
||||
@@ -118,14 +117,14 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
|
||||
if (IS_ERR(txbuf))
|
||||
return PTR_ERR(txbuf);
|
||||
|
||||
ir_dev = lirc->ir_dev;
|
||||
if (!ir_dev) {
|
||||
dev = lirc->dev;
|
||||
if (!dev) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (ir_dev->props && ir_dev->props->tx_ir)
|
||||
ret = ir_dev->props->tx_ir(ir_dev->props->priv, txbuf, (u32)n);
|
||||
if (dev->tx_ir)
|
||||
ret = dev->tx_ir(dev, txbuf, (u32)n);
|
||||
|
||||
out:
|
||||
kfree(txbuf);
|
||||
@@ -136,21 +135,18 @@ 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;
|
||||
struct rc_dev *dev;
|
||||
int ret = 0;
|
||||
void *drv_data;
|
||||
__u32 val = 0, tmp;
|
||||
|
||||
lirc = lirc_get_pdata(filep);
|
||||
if (!lirc)
|
||||
return -EFAULT;
|
||||
|
||||
ir_dev = lirc->ir_dev;
|
||||
if (!ir_dev || !ir_dev->props || !ir_dev->props->priv)
|
||||
dev = lirc->dev;
|
||||
if (!dev)
|
||||
return -EFAULT;
|
||||
|
||||
drv_data = ir_dev->props->priv;
|
||||
|
||||
if (_IOC_DIR(cmd) & _IOC_WRITE) {
|
||||
ret = get_user(val, (__u32 *)arg);
|
||||
if (ret)
|
||||
@@ -171,84 +167,85 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
|
||||
|
||||
/* TX settings */
|
||||
case LIRC_SET_TRANSMITTER_MASK:
|
||||
if (!ir_dev->props->s_tx_mask)
|
||||
if (!dev->s_tx_mask)
|
||||
return -EINVAL;
|
||||
|
||||
return ir_dev->props->s_tx_mask(drv_data, val);
|
||||
return dev->s_tx_mask(dev, val);
|
||||
|
||||
case LIRC_SET_SEND_CARRIER:
|
||||
if (!ir_dev->props->s_tx_carrier)
|
||||
if (!dev->s_tx_carrier)
|
||||
return -EINVAL;
|
||||
|
||||
return ir_dev->props->s_tx_carrier(drv_data, val);
|
||||
return dev->s_tx_carrier(dev, val);
|
||||
|
||||
case LIRC_SET_SEND_DUTY_CYCLE:
|
||||
if (!ir_dev->props->s_tx_duty_cycle)
|
||||
if (!dev->s_tx_duty_cycle)
|
||||
return -ENOSYS;
|
||||
|
||||
if (val <= 0 || val >= 100)
|
||||
return -EINVAL;
|
||||
|
||||
return ir_dev->props->s_tx_duty_cycle(drv_data, val);
|
||||
return dev->s_tx_duty_cycle(dev, val);
|
||||
|
||||
/* RX settings */
|
||||
case LIRC_SET_REC_CARRIER:
|
||||
if (!ir_dev->props->s_rx_carrier_range)
|
||||
if (!dev->s_rx_carrier_range)
|
||||
return -ENOSYS;
|
||||
|
||||
if (val <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
return ir_dev->props->s_rx_carrier_range(drv_data,
|
||||
ir_dev->raw->lirc.carrier_low, val);
|
||||
return dev->s_rx_carrier_range(dev,
|
||||
dev->raw->lirc.carrier_low,
|
||||
val);
|
||||
|
||||
case LIRC_SET_REC_CARRIER_RANGE:
|
||||
if (val <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
ir_dev->raw->lirc.carrier_low = val;
|
||||
dev->raw->lirc.carrier_low = val;
|
||||
return 0;
|
||||
|
||||
case LIRC_GET_REC_RESOLUTION:
|
||||
val = ir_dev->props->rx_resolution;
|
||||
val = dev->rx_resolution;
|
||||
break;
|
||||
|
||||
case LIRC_SET_WIDEBAND_RECEIVER:
|
||||
if (!ir_dev->props->s_learning_mode)
|
||||
if (!dev->s_learning_mode)
|
||||
return -ENOSYS;
|
||||
|
||||
return ir_dev->props->s_learning_mode(drv_data, !!val);
|
||||
return dev->s_learning_mode(dev, !!val);
|
||||
|
||||
case LIRC_SET_MEASURE_CARRIER_MODE:
|
||||
if (!ir_dev->props->s_carrier_report)
|
||||
if (!dev->s_carrier_report)
|
||||
return -ENOSYS;
|
||||
|
||||
return ir_dev->props->s_carrier_report(drv_data, !!val);
|
||||
return dev->s_carrier_report(dev, !!val);
|
||||
|
||||
/* Generic timeout support */
|
||||
case LIRC_GET_MIN_TIMEOUT:
|
||||
if (!ir_dev->props->max_timeout)
|
||||
if (!dev->max_timeout)
|
||||
return -ENOSYS;
|
||||
val = ir_dev->props->min_timeout / 1000;
|
||||
val = dev->min_timeout / 1000;
|
||||
break;
|
||||
|
||||
case LIRC_GET_MAX_TIMEOUT:
|
||||
if (!ir_dev->props->max_timeout)
|
||||
if (!dev->max_timeout)
|
||||
return -ENOSYS;
|
||||
val = ir_dev->props->max_timeout / 1000;
|
||||
val = dev->max_timeout / 1000;
|
||||
break;
|
||||
|
||||
case LIRC_SET_REC_TIMEOUT:
|
||||
if (!ir_dev->props->max_timeout)
|
||||
if (!dev->max_timeout)
|
||||
return -ENOSYS;
|
||||
|
||||
tmp = val * 1000;
|
||||
|
||||
if (tmp < ir_dev->props->min_timeout ||
|
||||
tmp > ir_dev->props->max_timeout)
|
||||
if (tmp < dev->min_timeout ||
|
||||
tmp > dev->max_timeout)
|
||||
return -EINVAL;
|
||||
|
||||
ir_dev->props->timeout = tmp;
|
||||
dev->timeout = tmp;
|
||||
break;
|
||||
|
||||
case LIRC_SET_REC_TIMEOUT_REPORTS:
|
||||
@@ -289,9 +286,8 @@ static struct file_operations lirc_fops = {
|
||||
.llseek = no_llseek,
|
||||
};
|
||||
|
||||
static int ir_lirc_register(struct input_dev *input_dev)
|
||||
static int ir_lirc_register(struct rc_dev *dev)
|
||||
{
|
||||
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
|
||||
struct lirc_driver *drv;
|
||||
struct lirc_buffer *rbuf;
|
||||
int rc = -ENOMEM;
|
||||
@@ -310,44 +306,40 @@ static int ir_lirc_register(struct input_dev *input_dev)
|
||||
goto rbuf_init_failed;
|
||||
|
||||
features = LIRC_CAN_REC_MODE2;
|
||||
if (ir_dev->props->tx_ir) {
|
||||
|
||||
if (dev->tx_ir) {
|
||||
features |= LIRC_CAN_SEND_PULSE;
|
||||
if (ir_dev->props->s_tx_mask)
|
||||
if (dev->s_tx_mask)
|
||||
features |= LIRC_CAN_SET_TRANSMITTER_MASK;
|
||||
if (ir_dev->props->s_tx_carrier)
|
||||
if (dev->s_tx_carrier)
|
||||
features |= LIRC_CAN_SET_SEND_CARRIER;
|
||||
|
||||
if (ir_dev->props->s_tx_duty_cycle)
|
||||
if (dev->s_tx_duty_cycle)
|
||||
features |= LIRC_CAN_SET_SEND_DUTY_CYCLE;
|
||||
}
|
||||
|
||||
if (ir_dev->props->s_rx_carrier_range)
|
||||
if (dev->s_rx_carrier_range)
|
||||
features |= LIRC_CAN_SET_REC_CARRIER |
|
||||
LIRC_CAN_SET_REC_CARRIER_RANGE;
|
||||
|
||||
if (ir_dev->props->s_learning_mode)
|
||||
if (dev->s_learning_mode)
|
||||
features |= LIRC_CAN_USE_WIDEBAND_RECEIVER;
|
||||
|
||||
if (ir_dev->props->s_carrier_report)
|
||||
if (dev->s_carrier_report)
|
||||
features |= LIRC_CAN_MEASURE_CARRIER;
|
||||
|
||||
|
||||
if (ir_dev->props->max_timeout)
|
||||
if (dev->max_timeout)
|
||||
features |= LIRC_CAN_SET_REC_TIMEOUT;
|
||||
|
||||
|
||||
snprintf(drv->name, sizeof(drv->name), "ir-lirc-codec (%s)",
|
||||
ir_dev->driver_name);
|
||||
dev->driver_name);
|
||||
drv->minor = -1;
|
||||
drv->features = features;
|
||||
drv->data = &ir_dev->raw->lirc;
|
||||
drv->data = &dev->raw->lirc;
|
||||
drv->rbuf = rbuf;
|
||||
drv->set_use_inc = &ir_lirc_open;
|
||||
drv->set_use_dec = &ir_lirc_close;
|
||||
drv->code_length = sizeof(struct ir_raw_event) * 8;
|
||||
drv->fops = &lirc_fops;
|
||||
drv->dev = &ir_dev->dev;
|
||||
drv->dev = &dev->dev;
|
||||
drv->owner = THIS_MODULE;
|
||||
|
||||
drv->minor = lirc_register_driver(drv);
|
||||
@@ -356,8 +348,8 @@ static int ir_lirc_register(struct input_dev *input_dev)
|
||||
goto lirc_register_failed;
|
||||
}
|
||||
|
||||
ir_dev->raw->lirc.drv = drv;
|
||||
ir_dev->raw->lirc.ir_dev = ir_dev;
|
||||
dev->raw->lirc.drv = drv;
|
||||
dev->raw->lirc.dev = dev;
|
||||
return 0;
|
||||
|
||||
lirc_register_failed:
|
||||
@@ -369,10 +361,9 @@ rbuf_alloc_failed:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int ir_lirc_unregister(struct input_dev *input_dev)
|
||||
static int ir_lirc_unregister(struct rc_dev *dev)
|
||||
{
|
||||
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
|
||||
struct lirc_codec *lirc = &ir_dev->raw->lirc;
|
||||
struct lirc_codec *lirc = &dev->raw->lirc;
|
||||
|
||||
lirc_unregister_driver(lirc->drv->minor);
|
||||
lirc_buffer_free(lirc->drv->rbuf);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user