summaryrefslogtreecommitdiff
path: root/drivers/media/rc/rc-ir-raw.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-02-25 06:51:30 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-14 10:35:15 -0500
commitcdfaa01c1cfeb828e6d3c0c5e4f54375fc3ccb95 (patch)
tree345883c562e041080b6f48b04f5b379a4c7692af /drivers/media/rc/rc-ir-raw.c
parent9b6192589be788dec73a0e99fe49b8f8ddaf825e (diff)
media: lirc: use the correct carrier for scancode transmit
If the lirc device supports it, set the carrier for the protocol. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/rc-ir-raw.c')
-rw-r--r--drivers/media/rc/rc-ir-raw.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 0616eee564a8..208db8a5adff 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -484,6 +484,36 @@ static void edge_handle(struct timer_list *t)
ir_raw_event_handle(dev);
}
+/**
+ * ir_raw_encode_carrier() - Get carrier used for protocol
+ *
+ * @protocol: protocol
+ *
+ * Attempts to find the carrier for the specified protocol
+ *
+ * Returns: The carrier in Hz
+ * -EINVAL if the protocol is invalid, or if no
+ * compatible encoder was found.
+ */
+int ir_raw_encode_carrier(enum rc_proto protocol)
+{
+ struct ir_raw_handler *handler;
+ int ret = -EINVAL;
+ u64 mask = BIT_ULL(protocol);
+
+ mutex_lock(&ir_raw_handler_lock);
+ list_for_each_entry(handler, &ir_raw_handler_list, list) {
+ if (handler->protocols & mask && handler->encode) {
+ ret = handler->carrier;
+ break;
+ }
+ }
+ mutex_unlock(&ir_raw_handler_lock);
+
+ return ret;
+}
+EXPORT_SYMBOL(ir_raw_encode_carrier);
+
/*
* Used to (un)register raw event clients
*/