Add ZTE zx-irdec remote control driver
Subsystems (3)
v2 cover Add ZTE zx-irdec remote control driver
From: Shawn Guo <[email protected]>
The series adds dt-bindings and remote control driver for IRDEC block found on ZTE ZX family SoCs.
Changes for v2:
- Add one patch to move generic NEC scancode composing and protocol type detection code from ir_nec_decode() into an inline shared function, which can be reused by zx-irdec driver.
Shawn Guo (3):
rc: ir-nec-decoder: move scancode composing code into a shared
function
dt-bindings: add bindings document for zx-irdec
rc: add zx-irdec remote control driver
.../devicetree/bindings/media/zx-irdec.txt | 14 ++ drivers/media/rc/Kconfig | 11 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/ir-nec-decoder.c | 32 +--- drivers/media/rc/keymaps/Makefile | 3 +- drivers/media/rc/keymaps/rc-zx-irdec.c | 79 +++++++++ drivers/media/rc/zx-irdec.c | 183 +++++++++++++++++++++ include/media/rc-core.h | 31 ++++ include/media/rc-map.h | 1 + 9 files changed, 325 insertions(+), 30 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/zx-irdec.txt create mode 100644 drivers/media/rc/keymaps/rc-zx-irdec.c create mode 100644 drivers/media/rc/zx-irdec.c
Signature · 1 line
1.9.1
PATCH v2 1/3 rc: ir-nec-decoder: move scancode composing code into a shared function
From: Shawn Guo <[email protected]>
The NEC scancode composing and protocol type detection in ir_nec_decode() is generic enough to be a shared function. Let's create an inline function in rc-core.h, so that other remote control drivers can reuse this function to save some code.
--- drivers/media/rc/ir-nec-decoder.c | 32 +++----------------------------- include/media/rc-core.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 29 deletions(-)
drivers/media/rc/ir-nec-decoder.c +3 -29
@@ -51,7 +51,6 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)u32 scancode;enum rc_type rc_type;u8 address, not_address, command, not_command; -bool send_32bits = false;if (!is_timing_event (ev)) {if (ev.reset)
@@ -161,34 +160,9 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) command =bitrev8 ((data->bits >>8 ) &0xff ); not_command =bitrev8 ((data->bits >>0 ) &0xff ); -if ((command ^ not_command) !=0xff ) { -IR_dprintk (1 ,"NEC checksum error: received 0x%08x\n" , - data->bits); - send_32bits = true; - } - -if (send_32bits) { -/* NEC transport, but modified protocol, used by at -* least Apple and TiVo remotes */ - scancode = not_address <<24 | - address <<16 | - not_command <<8 | - command; -IR_dprintk (1 ,"NEC (modified) scancode 0x%08x\n" , scancode); - rc_type =RC_TYPE_NEC32 ; - }else if ((address ^ not_address) !=0xff ) { -/* Extended NEC */ - scancode = address <<16 | - not_address <<8 | - command; -IR_dprintk (1 ,"NEC (Ext) scancode 0x%06x\n" , scancode); - rc_type =RC_TYPE_NECX ; - }else { -/* Normal NEC */ - scancode = address <<8 | command; -IR_dprintk (1 ,"NEC scancode 0x%04x\n" , scancode); - rc_type =RC_TYPE_NEC ; - } + scancode =ir_nec_bytes_to_scancode (address, not_address, + command, not_command, + &rc_type);if (data->is_nec_x) data->necx_repeat = true;
include/media/rc-core.h +31 -0
@@ -340,4 +340,35 @@ static inline u32 ir_extract_bits(u32 data, u32 mask) return value; } +/* Get NEC scancode and protocol type from address and command bytes */ +static inline u32 ir_nec_bytes_to_scancode (u8 address,u8 not_address, +u8 command,u8 not_command, +enum rc_type *protocol) +{ +u32 scancode; + +if ((command ^ not_command) !=0xff ) { +/* NEC transport, but modified protocol, used by at +* least Apple and TiVo remotes +*/ + scancode = not_address <<24 | + address <<16 | + not_command <<8 | + command; + *protocol =RC_TYPE_NEC32 ; + }else if ((address ^ not_address) !=0xff ) { +/* Extended NEC */ + scancode = address <<16 | + not_address <<8 | + command; + *protocol =RC_TYPE_NECX ; + }else { +/* Normal NEC */ + scancode = address <<8 | command; + *protocol =RC_TYPE_NEC ; + } + +return scancode; +} +#endif /* _RC_CORE */
Signature · 1 line
1.9.1
PATCH v2 2/3 dt-bindings: add bindings document for zx-irdec
In reply to Shawn GuoFrom: Shawn Guo <[email protected]>
It adds the dt-bindings document for ZTE ZX IRDEC remote control block.
--- Documentation/devicetree/bindings/media/zx-irdec.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/zx-irdec.txt
Documentation/devicetree/bindings/media/zx-irdec.txt new file +14 -0
@@ -0,0 +1,14 @@ +IR Decoder (IRDEC) on ZTE ZX family SoCs + +Required properties: + - compatible: Should be "zte,zx296718-irdec". + - reg: Physical base address and length of IRDEC registers. + - interrupts: Interrupt number of IRDEC. + +Exmaples: + + irdec: ir-decoder at 111000 { + compatible = "zte,zx296718-irdec"; + reg = <0x111000 0x1000>; + interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
1.9.1
Rob Herring
maintainerPATCH v2 2/3 dt-bindings: add bindings document for zx-irdec
Quoted 10 lines · Shawn Guo
From: Shawn Guo <[email protected]>
It adds the dt-bindings document for ZTE ZX IRDEC remote control block.
Signed-off-by Shawn Guo <[email protected]>--- Documentation/devicetree/bindings/media/zx-irdec.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/zx-irdec.txt
PATCH v2 3/3 rc: add zx-irdec remote control driver
In reply to Shawn GuoFrom: Shawn Guo <[email protected]>
It adds the remote control driver and corresponding keymap file for IRDEC block found on ZTE ZX family SoCs.
--- drivers/media/rc/Kconfig | 11 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 3 +- drivers/media/rc/keymaps/rc-zx-irdec.c | 79 ++++++++++++++ drivers/media/rc/zx-irdec.c | 183 +++++++++++++++++++++++++++++++++ include/media/rc-map.h | 1 + 6 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 drivers/media/rc/keymaps/rc-zx-irdec.c create mode 100644 drivers/media/rc/zx-irdec.c
drivers/media/rc/Kconfig +11 -0
@@ -435,4 +435,15 @@ config IR_SIR To compile this driver as a module, choose M here: the module will be called sir-ir. +config IR_ZX + tristate "ZTE ZX IR remote control" + depends on RC_CORE + depends on ARCH_ZX || COMPILE_TEST + ---help--- + Say Y if you want to use the IR remote control available + on ZTE ZX family SoCs. + + To compile this driver as a module, choose M here: the + module will be called zx-irdec. + endif #RC_DEVICES
drivers/media/rc/Makefile +1 -0
@@ -41,3 +41,4 @@ obj-$(CONFIG_IR_IMG) += img-ir/ obj-$(CONFIG_IR_SERIAL) += serial_ir.o obj-$(CONFIG_IR_SIR) += sir_ir.o obj-$(CONFIG_IR_MTK) += mtk-cir.o +obj-$(CONFIG_IR_ZX) += zx-irdec.o
drivers/media/rc/keymaps/Makefile +2 -1
@@ -109,4 +109,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-videomate-tv-pvr.o \ rc-winfast.o \ rc-winfast-usbii-deluxe.o \ - rc-su3000.o + rc-su3000.o \ + rc-zx-irdec.o
drivers/media/rc/keymaps/rc-zx-irdec.c new file +79 -0
79 lines not on this page · raw message
drivers/media/rc/zx-irdec.c new file +183 -0
183 lines not on this page · raw message
include/media/rc-map.h +1 -0
@@ -313,6 +313,7 @@ struct rc_map_list {#define RC_MAP_WINFAST "rc-winfast"#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"#define RC_MAP_SU3000 "rc-su3000" +#define RC_MAP_ZX_IRDEC "rc-zx-irdec"/* * Please, do not just append newer Remote Controller names at the end.
Signature · 1 line
1.9.1
Sean Young
maintainerPATCH v2 3/3 rc: add zx-irdec remote control driver
Quoted 6 lines · Shawn Guo
From: Shawn Guo <[email protected]>
It adds the remote control driver and corresponding keymap file for IRDEC block found on ZTE ZX family SoCs.
Signed-off-by Shawn Guo <[email protected]>
Quoted 10 lines
--- drivers/media/rc/Kconfig | 11 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 3 +- drivers/media/rc/keymaps/rc-zx-irdec.c | 79 ++++++++++++++ drivers/media/rc/zx-irdec.c | 183 +++++++++++++++++++++++++++++++++ include/media/rc-map.h | 1 + 6 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 drivers/media/rc/keymaps/rc-zx-irdec.c create mode 100644 drivers/media/rc/zx-irdec.c
We're missing an MAINTAINERS entry for this driver. Could this be added please as a separate patch?
Thanks
Sean
PATCH v2 3/3 rc: add zx-irdec remote control driver
Hi Sean,
Quoted 18 lines · Sean Young
Quoted 6 lines · Shawn Guo
From: Shawn Guo <[email protected]>
It adds the remote control driver and corresponding keymap file for IRDEC block found on ZTE ZX family SoCs.
Signed-off-by Shawn Guo <[email protected]>Quoted 10 lines
--- drivers/media/rc/Kconfig | 11 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 3 +- drivers/media/rc/keymaps/rc-zx-irdec.c | 79 ++++++++++++++ drivers/media/rc/zx-irdec.c | 183 +++++++++++++++++++++++++++++++++ include/media/rc-map.h | 1 + 6 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 drivers/media/rc/keymaps/rc-zx-irdec.c create mode 100644 drivers/media/rc/zx-irdec.c
Quoted 2 lines
We're missing an
MAINTAINERSentry for this driver. Could this be added please as a separate patch?
We are using 'ARM/ZTE ARCHITECTURE' entry in MAINTAINERS for ZTE ZX drivers. I plan to send a separate patch going through arm-soc tree, updating MAINTAINERS for those new ZTE ZX drivers landed on mainline during 4.14 merge window. IRDEC will be covered by that patch. Is that okay?
Shawn
Sean Young
maintainerPATCH v2 3/3 rc: add zx-irdec remote control driver
Hi Shawn,
Quoted 19 lines · Shawn Guo
Quoted 18 lines · Sean Young
Quoted 16 lines · Shawn Guo
From: Shawn Guo <[email protected]>
It adds the remote control driver and corresponding keymap file for IRDEC block found on ZTE ZX family SoCs.
Signed-off-by Shawn Guo <[email protected]>--- drivers/media/rc/Kconfig | 11 ++ drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 3 +- drivers/media/rc/keymaps/rc-zx-irdec.c | 79 ++++++++++++++ drivers/media/rc/zx-irdec.c | 183 +++++++++++++++++++++++++++++++++ include/media/rc-map.h | 1 + 6 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 drivers/media/rc/keymaps/rc-zx-irdec.c create mode 100644 drivers/media/rc/zx-irdec.c
Quoted 8 lines
Quoted 2 lines
We're missing an
MAINTAINERSentry for this driver. Could this be added please as a separate patch?We are using 'ARM/ZTE ARCHITECTURE' entry in
MAINTAINERSfor ZTE ZX drivers. I plan to send a separate patch going through arm-soc tree, updatingMAINTAINERSfor those new ZTE ZX drivers landed on mainline during 4.14 merge window. IRDEC will be covered by that patch. Is that okay?
Of course.
Thanks,
Sean
v2 cover Add ZTE zx-irdec remote control driver
In reply to Shawn GuoQuoted 10 lines · Shawn Guo
From: Shawn Guo <[email protected]>
The series adds dt-bindings and remote control driver for IRDEC block found on ZTE ZX family SoCs.
Changes for v2:
- Add one patch to move generic NEC scancode composing and protocol type detection code fromir_nec_decode()into an inline shared function, which can be reused by zx-irdec driver.
Quoted 5 lines
Shawn Guo (3):
rc: ir-nec-decoder: move scancode composing code into a shared
function
dt-bindings: add bindings document for zx-irdec
rc: add zx-irdec remote control driver
Hi Sean,
We are getting close to 4.14 merge window. Can we get this into -next for a bit exposure, if you are fine with the patches?
Shawn
Sean Young
maintainerv2 cover Add ZTE zx-irdec remote control driver
Quoted 17 lines · Shawn Guo
Quoted 10 lines · Shawn Guo
From: Shawn Guo <[email protected]>
The series adds dt-bindings and remote control driver for IRDEC block found on ZTE ZX family SoCs.
Changes for v2:
- Add one patch to move generic NEC scancode composing and protocol type detection code fromir_nec_decode()into an inline shared function, which can be reused by zx-irdec driver.Quoted 5 lines
Shawn Guo (3):
rc: ir-nec-decoder: move scancode composing code into a shared
function
dt-bindings: add bindings document for zx-irdec
rc: add zx-irdec remote control driver
Quoted 4 lines
Hi Sean,
We are getting close to 4.14 merge window. Can we get this into -next for a bit exposure, if you are fine with the patches?
The rc pull requests have been merged into the media_tree, so they should now get exposure in linux-next.
https://git.linuxtv.org/media_tree.git/
Thanks,
Sean