aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-ir-raw.c
diff options
context:
space:
mode:
authorJames Hogan <james@albanarts.com>2015-03-31 14:48:10 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-05-14 14:34:53 -0300
commit0d830b2d1295fee82546d57185da5a6604f11ae2 (patch)
treeb0add410d25c1a8b80127f82c7a056b30f491edd /drivers/media/rc/rc-ir-raw.c
parent[media] rc: ir-rc6-decoder: Add encode capability (diff)
downloadlinux-dev-0d830b2d1295fee82546d57185da5a6604f11ae2.tar.xz
linux-dev-0d830b2d1295fee82546d57185da5a6604f11ae2.zip
[media] rc: rc-core: Add support for encode_wakeup drivers
Add support in rc-core for drivers which implement the wakeup scancode filter by encoding the scancode using the raw IR encoders. This is by way of rc_dev::encode_wakeup which should be set to true to make the allowed wakeup protocols the same as the set of raw IR encoders. As well as updating the sysfs interface to know which wakeup protocols are allowed for encode_wakeup drivers, also ensure that the IR decoders/encoders are loaded when an encode_wakeup driver is registered. Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/rc/rc-ir-raw.c')
-rw-r--r--drivers/media/rc/rc-ir-raw.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 6c9580e4cac5..b9e4645c731c 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -30,6 +30,7 @@ static LIST_HEAD(ir_raw_client_list);
static DEFINE_MUTEX(ir_raw_handler_lock);
static LIST_HEAD(ir_raw_handler_list);
static u64 available_protocols;
+static u64 encode_protocols;
static int ir_raw_event_thread(void *data)
{
@@ -240,6 +241,18 @@ ir_raw_get_allowed_protocols(void)
return protocols;
}
+/* used internally by the sysfs interface */
+u64
+ir_raw_get_encode_protocols(void)
+{
+ u64 protocols;
+
+ mutex_lock(&ir_raw_handler_lock);
+ protocols = encode_protocols;
+ mutex_unlock(&ir_raw_handler_lock);
+ return protocols;
+}
+
static int change_protocol(struct rc_dev *dev, u64 *rc_type)
{
/* the caller will update dev->enabled_protocols */
@@ -450,6 +463,8 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler)
list_for_each_entry(raw, &ir_raw_client_list, list)
ir_raw_handler->raw_register(raw->dev);
available_protocols |= ir_raw_handler->protocols;
+ if (ir_raw_handler->encode)
+ encode_protocols |= ir_raw_handler->protocols;
mutex_unlock(&ir_raw_handler_lock);
return 0;
@@ -466,6 +481,8 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler)
list_for_each_entry(raw, &ir_raw_client_list, list)
ir_raw_handler->raw_unregister(raw->dev);
available_protocols &= ~ir_raw_handler->protocols;
+ if (ir_raw_handler->encode)
+ encode_protocols &= ~ir_raw_handler->protocols;
mutex_unlock(&ir_raw_handler_lock);
}
EXPORT_SYMBOL(ir_raw_handler_unregister);