media: lirc: lirc interface should not be a raw decoder

The lirc user interface exists as a raw decoder, which does not make
much sense for transmit-only devices.

In addition, we want to have lirc char devices for devices which do not
use raw IR, i.e. scancode only devices.

Note that rc-code, lirc_dev, ir-lirc-codec are now calling functions of
each other, so they've been merged into one module rc-core to avoid
circular dependencies.

Since ir-lirc-codec no longer exists as separate codec module, there is no
need for RC_DRIVER_IR_RAW_TX type drivers to call ir_raw_event_register().

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Sean Young
2017-09-23 10:41:13 -04:00
committed by Mauro Carvalho Chehab
parent 0d39ab0b62
commit a60d64b15c
10 changed files with 144 additions and 244 deletions

View File

@@ -846,7 +846,6 @@ int rc_open(struct rc_dev *rdev)
return rval;
}
EXPORT_SYMBOL_GPL(rc_open);
static int ir_open(struct input_dev *idev)
{
@@ -866,7 +865,6 @@ void rc_close(struct rc_dev *rdev)
mutex_unlock(&rdev->lock);
}
}
EXPORT_SYMBOL_GPL(rc_close);
static void ir_close(struct input_dev *idev)
{
@@ -941,23 +939,6 @@ struct rc_filter_attribute {
.mask = (_mask), \
}
static bool lirc_is_present(void)
{
#if defined(CONFIG_LIRC_MODULE)
struct module *lirc;
mutex_lock(&module_mutex);
lirc = find_module("lirc_dev");
mutex_unlock(&module_mutex);
return lirc ? true : false;
#elif defined(CONFIG_LIRC)
return true;
#else
return false;
#endif
}
/**
* show_protocols() - shows the current IR protocol(s)
* @device: the device descriptor
@@ -1002,8 +983,10 @@ static ssize_t show_protocols(struct device *device,
allowed &= ~proto_names[i].type;
}
if (dev->driver_type == RC_DRIVER_IR_RAW && lirc_is_present())
#ifdef CONFIG_LIRC
if (dev->driver_type == RC_DRIVER_IR_RAW)
tmp += sprintf(tmp, "[lirc] ");
#endif
if (tmp != buf)
tmp--;
@@ -1759,8 +1742,7 @@ int rc_register_device(struct rc_dev *dev)
dev->sysfs_groups[attr++] = &rc_dev_wakeup_filter_attr_grp;
dev->sysfs_groups[attr++] = NULL;
if (dev->driver_type == RC_DRIVER_IR_RAW ||
dev->driver_type == RC_DRIVER_IR_RAW_TX) {
if (dev->driver_type == RC_DRIVER_IR_RAW) {
rc = ir_raw_event_prepare(dev);
if (rc < 0)
goto out_minor;
@@ -1787,19 +1769,28 @@ int rc_register_device(struct rc_dev *dev)
goto out_dev;
}
if (dev->driver_type == RC_DRIVER_IR_RAW ||
dev->driver_type == RC_DRIVER_IR_RAW_TX) {
rc = ir_raw_event_register(dev);
/* Ensure that the lirc kfifo is setup before we start the thread */
if (dev->driver_type != RC_DRIVER_SCANCODE) {
rc = ir_lirc_register(dev);
if (rc < 0)
goto out_rx;
}
if (dev->driver_type == RC_DRIVER_IR_RAW) {
rc = ir_raw_event_register(dev);
if (rc < 0)
goto out_lirc;
}
IR_dprintk(1, "Registered rc%u (driver: %s)\n",
dev->minor,
dev->driver_name ? dev->driver_name : "unknown");
return 0;
out_lirc:
if (dev->driver_type != RC_DRIVER_SCANCODE)
ir_lirc_unregister(dev);
out_rx:
rc_free_rx_device(dev);
out_dev:
@@ -1853,6 +1844,9 @@ void rc_unregister_device(struct rc_dev *dev)
rc_free_rx_device(dev);
if (dev->driver_type != RC_DRIVER_SCANCODE)
ir_lirc_unregister(dev);
device_del(&dev->dev);
ida_simple_remove(&rc_ida, dev->minor);
@@ -1875,6 +1869,13 @@ static int __init rc_core_init(void)
return rc;
}
rc = lirc_dev_init();
if (rc) {
pr_err("rc_core: unable to init lirc\n");
class_unregister(&rc_class);
return 0;
}
led_trigger_register_simple("rc-feedback", &led_feedback);
rc_map_register(&empty_map);
@@ -1883,6 +1884,7 @@ static int __init rc_core_init(void)
static void __exit rc_core_exit(void)
{
lirc_dev_exit();
class_unregister(&rc_class);
led_trigger_unregister_simple(led_feedback);
rc_map_unregister(&empty_map);