Skip to contentSkip to conversation

media: rc: sunxi-cir: support the A523/H728/T527 IR receiver

PATCH Applied Justin Suess 2 participants 6 messages Jul 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover media: rc: sunxi-cir: support the A523/H728/T527 IR receiver

Hi,

This series adds support for the CIR receiver on the Allwinner A523/T527/H728 family (sun55i).

Apologies for the hasty v3 respin.

Tested again on my X96Q Pro+ (H728) TV box with the Google TV remote that came in the box (using NEC keymap). Was able to press buttons and get readings from lirc / ir-keytable again.

Changes since v3:
- 1/4: picked up Krzysztof's Acked-by, no other changes
- 2/4: add /omit-if-no-ref/ and rename the PL11 node to r-ir-rx-pl-pin (Chen-Yu)
- 2/4: take the PI8 pinmux node from Andre's Avaota patch, named ir-rx-pi-pin (Chen-Yu). Added Co-developed-by for Andre, and his Reviewed-by is dropped, as the patch gained a hunk and a node rename.
- 4/4: drop the moved hunk. Andre stays the author, with a bracketed note for the move and my Signed-off-by added (Chen-Yu, Andre)

Based on v7.2-rc1.

v3: https://lore.kernel.org/linux-sunxi/[email protected]/
v2: https://lore.kernel.org/linux-sunxi/[email protected]/
v1: https://lore.kernel.org/linux-sunxi/[email protected]/

Andre Przywara (1):
arm64: dts: allwinner: a523: enable IR on the Avaota A1

Justin Suess (3):
media: dt-bindings: allwinner,sun4i-a10-ir: add A523 compatible
arm64: dts: allwinner: a523: add IR receiver nodes
arm64: dts: allwinner: a523: enable IR receiver on the X96Q Pro+

 .../media/allwinner,sun4i-a10-ir.yaml         |  8 +++--
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 36 +++++++++++++++++++
 .../dts/allwinner/sun55i-h728-x96qpro+.dts    |  6 ++++
 .../dts/allwinner/sun55i-t527-avaota-a1.dts   |  6 ++++
 4 files changed, 53 insertions(+), 3 deletions(-)

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482

Signature · 1 line
2.54.0
#1 lore raw

PATCH v4 1/4 media: dt-bindings: allwinner,sun4i-a10-ir: add A523 compatible

The A523 (sun55i) contains a newer revision of the sunxi CIR receiver. The reset defaults match the fixed behaviour of the older IP, so the device works fine when driven as an A31 CIR receiver.

Add the A523 compatible, with allwinner,sun6i-a31-ir as the fallback.

While at it, merge the standalone compatible entries into a single enum.

---
 .../devicetree/bindings/media/allwinner,sun4i-a10-ir.yaml | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/media/allwinner,sun4i-a10-ir.yaml +5 -3
index 42dfe22ad5f1..18b28feacf83 100644
@@ -16,9 +16,10 @@ allOf:
 properties:
   compatible:
     oneOf:
-      - const: allwinner,sun4i-a10-ir
-      - const: allwinner,sun5i-a13-ir
-      - const: allwinner,sun6i-a31-ir
+      - enum:
+          - allwinner,sun4i-a10-ir
+          - allwinner,sun5i-a13-ir
+          - allwinner,sun6i-a31-ir
       - items:
           - enum:
               - allwinner,suniv-f1c100s-ir
@@ -27,6 +28,7 @@ properties:
               - allwinner,sun50i-a64-ir
               - allwinner,sun50i-h6-ir
               - allwinner,sun50i-h616-ir
+              - allwinner,sun55i-a523-ir
           - const: allwinner,sun6i-a31-ir
 
   reg:
Signature · 1 line
2.54.0
#2 lore raw

PATCH v4 2/4 arm64: dts: allwinner: a523: add IR receiver nodes

In reply to Justin Suess

The A523 has two CIR receivers, both compatible with the A31 CIR: one in the CPUX domain, clocked from the main CCU, and one in the RTC power domain, clocked from the R-CCU.

The RTC domain instance's RX signal is typically muxed to PL11, as on the X96Q Pro+. The CPUX instance's can be muxed to PI8, which is what the Avaota A1 uses.

Add nodes for both instances, disabled by default. Since the RX signal of each instance can be routed to more than one pin, boards with an IR receiver are expected to add the pinctrl properties next to where they enable the node.

Add pinmux nodes for both pins: PL11 for the RTC domain instance, and PI8 for the CPUX one.

---

Notes:

v4:
- add /omit-if-no-ref/ and rename to r-ir-rx-pl-pin (Chen-Yu)
- take the PI8 pinmux node from Andre's Avaota patch, named ir-rx-pi-pin (Chen-Yu); Co-developed-by added and Andre's Reviewed-by dropped, since the patch has a new hunk plus pinmux node name change.

 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +36 -0
index ca6a16807049..f0b74693da7f 100644
@@ -155,6 +155,13 @@ i2s2_pi_pins: i2s2-pi-pins {
 				bias-disable;
 			};
 
+			/omit-if-no-ref/
+			ir_rx_pin: ir-rx-pi-pin {
+				pins = "PI8";
+				allwinner,pinmux = <3>;
+				function = "cir_rx";
+			};
+
 			/omit-if-no-ref/
 			ledc_ph_pin: ledc-ph-pin {
 				pins = "PH19";
@@ -327,6 +334,17 @@ ccu: clock-controller@2001000 {
 			#reset-cells = <1>;
 		};
 
+		ir: ir@2005000 {
+			compatible = "allwinner,sun55i-a523-ir",
+				     "allwinner,sun6i-a31-ir";
+			reg = <0x02005000 0x400>;
+			interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_IR_RX>, <&ccu CLK_IR_RX>;
+			clock-names = "apb", "ir";
+			resets = <&ccu RST_BUS_IR_RX>;
+			status = "disabled";
+		};
+
 		ledc: led-controller@2008000 {
 			compatible = "allwinner,sun55i-a523-ledc",
 				     "allwinner,sun50i-a100-ledc";
@@ -927,6 +945,24 @@ r_i2c_pins: r-i2c-pins {
 				allwinner,pinmux = <2>;
 				function = "r_i2c0";
 			};
+
+			/omit-if-no-ref/
+			r_ir_rx_pin: r-ir-rx-pl-pin {
+				pins = "PL11";
+				allwinner,pinmux = <2>;
+				function = "s_cir_rx";
+			};
+		};
+
+		r_ir: ir@7040000 {
+			compatible = "allwinner,sun55i-a523-ir",
+				     "allwinner,sun6i-a31-ir";
+			reg = <0x07040000 0x400>;
+			interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&r_ccu CLK_BUS_R_IR_RX>, <&r_ccu CLK_R_IR_RX>;
+			clock-names = "apb", "ir";
+			resets = <&r_ccu RST_BUS_R_IR_RX>;
+			status = "disabled";
 		};
 
 		pck600: power-controller@7060000 {
Signature · 1 line
2.54.0
#3 lore raw

PATCH v4 3/4 arm64: dts: allwinner: a523: enable IR receiver on the X96Q Pro+

In reply to Justin Suess

The X96Q Pro+ TV box has an IR receiver window on the front panel, wired to the SoC CIR input on PL11.

Enable the CIR receiver in the RTC power domain and mux its RX signal to PL11.

Tested on an X96Q Pro+ with ir-keytable and nec keybindings with the remote that it came with in the box.

---
 arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-h728-x96qpro+.dts +6 -0
index a96927fbdadd..1eaee20acaab 100644
@@ -266,6 +266,12 @@ reg_dcdc3_323: dcdc3 {
 	};
 };
 
+&r_ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&r_ir_rx_pin>;
+	status = "okay";
+};
+
 &r_pio {
 /*
  * Specifying the supply would create a circular dependency.
Signature · 1 line
2.54.0
#4 lore raw

PATCH v4 4/4 arm64: dts: allwinner: a523: enable IR on the Avaota A1

In reply to Justin Suess

From: Andre Przywara <[email protected]>

The Avaota A1 board has an IR receiver chip on the PCB (next to the Ethernet jacks), wired to the PI8 pin on the SoC.

Enable the CIR receiver in the main power domain.

Tested on the board with evtest and some random TV remote control.

[justin: move the PI8 pinmux node into the dtsi patch]

---

Notes:

v4:
- move the PI8 pinmux node into the dtsi patch (Chen-Yu)
- add my Signed-off-by (Chen-Yu, Andre)

 arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts +6 -0
index 474354fbfcec..994f1e4f0ce7 100644
@@ -100,6 +100,12 @@ &gpu {
 	status = "okay";
 };
 
+&ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ir_rx_pin>;
+	status = "okay";
+};
+
 &ledc {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ledc_ph_pin>;
Signature · 1 line
2.54.0
maintainer Applied
#5 lore raw
In reply to Justin Suess
Quoted 10 lines · Justin Suess

This series adds support for the CIR receiver on the Allwinner A523/T527/H728 family (sun55i).

Apologies for the hasty v3 respin.

Tested again on my X96Q Pro+ (H728) TV box with the Google TV remote that came in the box (using NEC keymap). Was able to press buttons and get readings from lirc / ir-keytable again.

[...]

Applied to sunxi/dt-for-7.3 in sunxi, thanks!

[1/4] media: dt-bindings: allwinner,sun4i-a10-ir: add A523 compatible

      https://git.kernel.org/sunxi/linux/c/96cd41eac1f5
[2/4] arm64: dts: allwinner: a523: add IR receiver nodes
      https://git.kernel.org/sunxi/linux/c/2b24f5386528
[3/4] arm64: dts: allwinner: a523: enable IR receiver on the X96Q Pro+
      https://git.kernel.org/sunxi/linux/c/a3bd47e62cb2
[4/4] arm64: dts: allwinner: a523: enable IR on the Avaota A1
      https://git.kernel.org/sunxi/linux/c/75dc83d420aa

Best regards,

Signature · 1 line
Chen-Yu Tsai <[email protected]>