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>
This commit is contained in:
Sean Young
2017-02-25 06:51:30 -05:00
committed by Mauro Carvalho Chehab
parent 9b6192589b
commit cdfaa01c1c
12 changed files with 58 additions and 11 deletions

View File

@@ -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
*/