rcmm with minor tweaks and selftest
Sean Young
maintainercover rcmm with minor tweaks and selftest
Hi Patrick,
I've made some very minor/cosmetic changes and added rcmm to the selftest; I didn't want to just add them to the tree without showing to you first.
Let me know what you think.
Thanks
Sean
Patrick Lerda (1):
media: rc: rcmm decoder and encoder
Sean Young (1):
selftests: Use lirc.h from kernel tree, not from system
MAINTAINERS | 5 + drivers/media/rc/Kconfig | 13 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/ir-rcmm-decoder.c | 254 +++++++++++++++++++++++ drivers/media/rc/rc-core-priv.h | 5 + drivers/media/rc/rc-main.c | 9 + include/media/rc-map.h | 14 +- include/uapi/linux/lirc.h | 6 + tools/include/uapi/linux/lirc.h | 12 ++ tools/testing/selftests/ir/Makefile | 2 + tools/testing/selftests/ir/ir_loopback.c | 9 + 11 files changed, 327 insertions(+), 3 deletions(-) create mode 100644 drivers/media/rc/ir-rcmm-decoder.c
Signature · 1 line
2.20.1
Sean Young
maintainerPATCH 1/2 selftests: Use lirc.h from kernel tree, not from system
When the system lirc.h is older than v4.16, you will get errors like:
ir_loopback.c:32:16: error: field ‘proto’ has incomplete type
enum rc_proto proto;
--- tools/testing/selftests/ir/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/ir/Makefile +2 -0
@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 TEST_PROGS := ir_loopback.sh TEST_GEN_PROGS_EXTENDED := ir_loopback +APIDIR := ../../../include/uapi +CFLAGS += -Wall -O2 -I$(APIDIR) include ../lib.mk
Signature · 1 line
2.20.1
shuah
maintainerRe: [PATCH 1/2] selftests: Use lirc.h from kernel tree, not from system
Quoted 17 lines · Sean Young
When the system
lirc.his older than v4.16, you will get errors like:ir_loopback.c:32:16: error: field ‘proto’ has incomplete type
enumrc_protoproto;Cc Shuah Khan <[email protected]>Signed-off-by Sean Young <[email protected]>--- tools/testing/selftests/ir/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/ir/Makefile +0
-0
tools/testing/selftests/ir/Makefile line 7
Quoted 7 lines
tools/testing/selftests/ir/Makefile +2
-0@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 TEST_PROGS := ir_loopback.sh TEST_GEN_PROGS_EXTENDED := ir_loopback +APIDIR := ../../../include/uapi +CFLAGS += -Wall -O2 -I$(APIDIR) include ../lib.mk
Thanks for the fix. I can take this through kselftest tree if there are no dependencies on any media patches. It looks that way, just confirming. It will be very likely for rc5.
thanks,
-- Shuah
Sean Young
maintainerRe: [PATCH 1/2] selftests: Use lirc.h from kernel tree, not from system
Quoted 12 lines · shuah
Quoted 11 lines · Sean Young
When the system
lirc.his older than v4.16, you will get errors like:ir_loopback.c:32:16: error: field ‘proto’ has incomplete type
enumrc_protoproto;Cc Shuah Khan <[email protected]>Signed-off-by Sean Young <[email protected]>--- tools/testing/selftests/ir/Makefile | 2 ++ 1 file changed, 2 insertions(+)
Quoted 16 lines
tools/testing/selftests/ir/Makefile line 7
Quoted 12 lines
tools/testing/selftests/ir/Makefile +2
-0@@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 TEST_PROGS := ir_loopback.sh TEST_GEN_PROGS_EXTENDED := ir_loopback +APIDIR := ../../../include/uapi +CFLAGS += -Wall -O2 -I$(APIDIR) include ../lib.mkThanks for the fix. I can take this through kselftest tree if there are no dependencies on any media patches. It looks that way, just confirming. It will be very likely for rc5.
There are no dependencies on media patches. Thank you very much!
Sean
Sean Young
maintainerPATCH 2/2 media: rc: rcmm decoder and encoder
In reply to Sean YoungFrom: Patrick Lerda <[email protected]>
media: add support for RCMM infrared remote controls.
--- MAINTAINERS | 5 + drivers/media/rc/Kconfig | 13 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/ir-rcmm-decoder.c | 254 +++++++++++++++++++++++ drivers/media/rc/rc-core-priv.h | 5 + drivers/media/rc/rc-main.c | 9 + include/media/rc-map.h | 14 +- include/uapi/linux/lirc.h | 6 + tools/include/uapi/linux/lirc.h | 12 ++ tools/testing/selftests/ir/ir_loopback.c | 9 + 10 files changed, 325 insertions(+), 3 deletions(-) create mode 100644 drivers/media/rc/ir-rcmm-decoder.c
MAINTAINERS +5 -0
@@ -16496,6 +16496,11 @@ M: David Härdeman <[email protected]> S: Maintained F: drivers/media/rc/winbond-cir.c +RCMM REMOTE CONTROLS DECODER +M: Patrick Lerda <[email protected]> +S: Maintained +F: drivers/media/rc/ir-rcmm-decoder.c + WINSYSTEMS EBC-C384 WATCHDOG DRIVER M: William Breathitt Gray <[email protected]> L: [email protected]
drivers/media/rc/Kconfig +13 -0
@@ -133,6 +133,19 @@ config IR_IMON_DECODER remote control and you would like to use it with a raw IR receiver, or if you wish to use an encoder to transmit this IR. +config IR_RCMM_DECODER + tristate "Enable IR raw decoder for the RC-MM protocol" + depends on RC_CORE + help + Enable this option when you have IR with RC-MM protocol, and + you need the software decoder. The driver supports 32, + 24 and 12 bits RC-MM variants. You can enable or disable the + different modes using the following RC protocol keywords: + 'rcmm-32', 'rcmm-24' and 'rcmm-12'. + + To compile this driver as a module, choose M here: the module + will be called ir-rcmm-decoder. + endif #RC_DECODERS menuconfig RC_DEVICES
drivers/media/rc/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_IR_SHARP_DECODER) += ir-sharp-decoder.o obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o obj-$(CONFIG_IR_XMP_DECODER) += ir-xmp-decoder.o obj-$(CONFIG_IR_IMON_DECODER) += ir-imon-decoder.o +obj-$(CONFIG_IR_RCMM_DECODER) += ir-rcmm-decoder.o # stand-alone IR receivers/transmitters obj-$(CONFIG_RC_ATI_REMOTE) += ati_remote.o
drivers/media/rc/ir-rcmm-decoder.c new file +254 -0
254 lines not on this page · raw message
drivers/media/rc/rc-core-priv.h +5 -0
@@ -131,6 +131,11 @@ struct ir_raw_event_ctrl {unsigned int bits;bool stick_keyboard; } imon; +struct rcmm_dec { +int state; +unsigned int count; +u32 bits; + } rcmm; };/* Mutex for locking raw IR processing and handler change */
drivers/media/rc/rc-main.c +9 -0
@@ -70,6 +70,12 @@ static const struct { [RC_PROTO_CEC] = { .name = "cec", .repeat_period = 0 }, [RC_PROTO_IMON ] = { .name ="imon" , .scancode_bits = 0x7fffffff, .repeat_period = 114 }, + [RC_PROTO_RCMM12 ] = { .name ="rcmm-12" , + .scancode_bits = 0x00000fff, .repeat_period = 114 }, + [RC_PROTO_RCMM24 ] = { .name ="rcmm-24" , + .scancode_bits = 0x00ffffff, .repeat_period = 114 }, + [RC_PROTO_RCMM32 ] = { .name ="rcmm-32" , + .scancode_bits = 0xffffffff, .repeat_period = 114 }, };/* Used to keep track of known keymaps */
@@ -1006,6 +1012,9 @@ static const struct { { RC_PROTO_BIT_XMP, "xmp", "ir-xmp-decoder" }, { RC_PROTO_BIT_CEC, "cec", NULL }, { RC_PROTO_BIT_IMON, "imon", "ir-imon-decoder" }, + { RC_PROTO_BIT_RCMM12 | +RC_PROTO_BIT_RCMM24 | + RC_PROTO_BIT_RCMM32, "rcmm", "ir-rcmm-decoder" }, };/**
include/media/rc-map.h +11 -3
@@ -37,6 +37,9 @@#define RC_PROTO_BIT_XMP BIT_ULL(RC_PROTO_XMP)#define RC_PROTO_BIT_CEC BIT_ULL(RC_PROTO_CEC)#define RC_PROTO_BIT_IMON BIT_ULL(RC_PROTO_IMON) +#define RC_PROTO_BIT_RCMM12 BIT_ULL(RC_PROTO_RCMM12) +#define RC_PROTO_BIT_RCMM24 BIT_ULL(RC_PROTO_RCMM24) +#define RC_PROTO_BIT_RCMM32 BIT_ULL(RC_PROTO_RCMM32)#define RC_PROTO_BIT_ALL \ (RC_PROTO_BIT_UNKNOWN | RC_PROTO_BIT_OTHER | \
@@ -51,7 +54,8 @@ RC_PROTO_BIT_RC6_6A_24 | RC_PROTO_BIT_RC6_6A_32 | \ RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_SHARP | \ RC_PROTO_BIT_XMP | RC_PROTO_BIT_CEC | \ - RC_PROTO_BIT_IMON) + RC_PROTO_BIT_IMON | RC_PROTO_BIT_RCMM12 | \ + RC_PROTO_BIT_RCMM24 | RC_PROTO_BIT_RCMM32)/* All rc protocols for which we have decoders */ #define RC_PROTO_BIT_ALL_IR_DECODER \ (RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \
@@ -64,7 +68,9 @@ RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \ RC_PROTO_BIT_RC6_6A_24 | RC_PROTO_BIT_RC6_6A_32 | \ RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_SHARP | \ - RC_PROTO_BIT_XMP | RC_PROTO_BIT_IMON) + RC_PROTO_BIT_XMP | RC_PROTO_BIT_IMON | \ + RC_PROTO_BIT_RCMM12 | RC_PROTO_BIT_RCMM24 | \ + RC_PROTO_BIT_RCMM32)#define RC_PROTO_BIT_ALL_IR_ENCODER \ (RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \
@@ -77,7 +83,9 @@ RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \ RC_PROTO_BIT_RC6_6A_24 | \ RC_PROTO_BIT_RC6_6A_32 | RC_PROTO_BIT_RC6_MCE | \ - RC_PROTO_BIT_SHARP | RC_PROTO_BIT_IMON) + RC_PROTO_BIT_SHARP | RC_PROTO_BIT_IMON | \ + RC_PROTO_BIT_RCMM32 | RC_PROTO_BIT_RCMM24 | \ + RC_PROTO_BIT_RCMM12)#define RC_SCANCODE_UNKNOWN (x) (x)#define RC_SCANCODE_OTHER (x) (x)
include/uapi/linux/lirc.h +6 -0
@@ -192,6 +192,9 @@ struct lirc_scancode {* @RC_PROTO_XMP: XMP protocol * @RC_PROTO_CEC: CEC protocol * @RC_PROTO_IMON: iMon Pad protocol +* @RC_PROTO_RCMM12: RC-MM protocol 12 bits +* @RC_PROTO_RCMM24: RC-MM protocol 24 bits +* @RC_PROTO_RCMM32: RC-MM protocol 32 bits */ enum rc_proto {RC_PROTO_UNKNOWN =0 ,
@@ -218,6 +221,9 @@ enum rc_proto {RC_PROTO_XMP =21 ,RC_PROTO_CEC =22 ,RC_PROTO_IMON =23 , +RC_PROTO_RCMM12 =24 , +RC_PROTO_RCMM24 =25 , + RC_PROTO_RCMM32 = 26, };#endif
tools/include/uapi/linux/lirc.h +12 -0
@@ -133,6 +133,12 @@#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) +/* +* Return the recording timeout, which is either set by +* the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols. +*/ +#define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32) +/* * struct lirc_scancode - decoded scancode with protocol for use with * LIRC_MODE_SCANCODE
@@ -186,6 +192,9 @@ struct lirc_scancode {* @RC_PROTO_XMP: XMP protocol * @RC_PROTO_CEC: CEC protocol * @RC_PROTO_IMON: iMon Pad protocol +* @RC_PROTO_RCMM12: RC-MM protocol 12 bits +* @RC_PROTO_RCMM24: RC-MM protocol 24 bits +* @RC_PROTO_RCMM32: RC-MM protocol 32 bits */ enum rc_proto {RC_PROTO_UNKNOWN =0 ,
@@ -212,6 +221,9 @@ enum rc_proto {RC_PROTO_XMP =21 ,RC_PROTO_CEC =22 ,RC_PROTO_IMON =23 , +RC_PROTO_RCMM12 =24 , +RC_PROTO_RCMM24 =25 , + RC_PROTO_RCMM32 = 26, };#endif
tools/testing/selftests/ir/ir_loopback.c +9 -0
@@ -51,6 +51,10 @@ static const struct { { RC_PROTO_RC6_6A_32, "rc-6-6a-32", 0xffffffff, "rc-6" }, { RC_PROTO_RC6_MCE, "rc-6-mce", 0x00007fff, "rc-6" }, { RC_PROTO_SHARP, "sharp", 0x1fff, "sharp" }, + { RC_PROTO_IMON, "imon", 0x7fffffff, "imon" }, + { RC_PROTO_RCMM12, "rcmm-12", 0x00000fff, "rcmm" }, + { RC_PROTO_RCMM24, "rcmm-24", 0x00ffffff, "rcmm" }, + { RC_PROTO_RCMM32, "rcmm-32", 0xffffffff, "rcmm" }, };int lirc_open (const char *rc)
@@ -139,6 +143,11 @@ int main(int argc, char **argv) (((scancode >> 8) ^ ~scancode) & 0xff) == 0)continue ; +if (rc_proto ==RC_PROTO_RCMM32 && + (scancode &0x000c0000 ) !=0x000c0000 && + scancode &0x00008000 ) +continue ; +struct lirc_scancode lsc = { .rc_proto = rc_proto, .scancode = scancode
Signature · 1 line
2.20.1
Patrick Lerda
maintainercover description update
In reply to Sean YoungHi Sean,
Your update is fine, and everything is working perfectly on my machine. We need just now to update the description; 'rcmm' is now the global keyword. The warning triggered by the v5 was just: 'if' badly interpreted as a keyword by the perl script.
Best Regards,
Patric Lerda.
Patrick Lerda (1):
description update.
drivers/media/rc/Kconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
2.20.1
Patrick Lerda
maintainerPATCH 1/1 description update
--- drivers/media/rc/Kconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/rc/Kconfig +1 -3
@@ -139,9 +139,7 @@ config IR_RCMM_DECODER help Enable this option when you have IR with RC-MM protocol, and you need the software decoder. The driver supports 32, - 24 and 12 bits RC-MM variants. You can enable or disable the - different modes using the following RC protocol keywords: - 'rcmm-32', 'rcmm-24' and 'rcmm-12'. + 24 and 12 bits RC-MM variants. To compile this driver as a module, choose M here: the module will be called ir-rcmm-decoder.
Signature · 1 line
2.20.1