summaryrefslogtreecommitdiff
path: root/drivers/media/rc/rc-ir-raw.c
diff options
context:
space:
mode:
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
*/