Skip to contentSkip to conversation

IR support for A83T

PATCH Superseded Philipp Rossak 2 participants 8 messages Jul 31, 2018 – Aug 1, 2018

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover IR support for A83T

This patch series adds support for the sunxi A83T ir module and enhances the sunxi-ir driver. Right now the base clock frequency for the ir driver is a hard coded define and is set to 8 MHz.
This works for the most common ir receivers. On the Sinovoip Bananapi M3 the ir receiver needs, a 3 MHz base clock frequency to work without problems with this driver.

This patch series adds support for an optinal property that makes it able to override the default base clock frequency and enables the ir interface on the a83t and the Bananapi M3.

changes since v5:
* removed already merged patches
* adapt patch 2 to be applyable to current rc-1

changes since v4:
* rename cir pin from cir_pins to r_cir_pin
* drop unit-address from r_cir_pin
* add a83t compatible to the cir node
* move muxing options to dtsi
* rename cir label and reorder it in the bananpim3.dts file

changes since v3:
* collecting all acks & reviewd by
* fixed typos

changes since v2:
* reorder cir pin (alphabetical)
* fix typo in documentation

changes since v1:
* fix typos, reword Documentation
* initialize 'b_clk_freq' to 'SUNXI_IR_BASE_CLK' & remove if statement
* change dev_info() to dev_dbg()
* change naming to cir* in dts/dtsi
* Added acked Ackedi-by to related patch
* use whole memory block instead of registers needed + fix for h3/h5

changes since rfc:
* The property is now optinal. If the property is not available in the dtb the driver uses the default base clock frequency.
* the driver prints out the the selected base clock frequency.
* changed devicetree property from base-clk-frequency to clock-frequency

Regards,
Philipp

Philipp Rossak (4):
ARM: dts: sun8i: a83t: Add the cir pin for the A83T
ARM: dts: sun8i: a83t: Add support for the cir interface
ARM: dts: sun8i: a83t: bananapi-m3: Enable IR controller
ARM: dts: sun8i: h3-h5: ir register size should be the whole memory
block

 arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts |  5 +++++
 arch/arm/boot/dts/sun8i-a83t.dtsi            | 18 ++++++++++++++++++
 arch/arm/boot/dts/sunxi-h3-h5.dtsi           |  2 +-
 3 files changed, 24 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v6 1/4 ARM: dts: sun8i: a83t: Add the cir pin for the A83T

The CIR Pin of the A83T is located at PL12.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +5 -0
index 2be23d600957..afed6c0dea6f 100644
@@ -1004,6 +1004,11 @@
 			interrupt-controller;
 			#interrupt-cells = <3>;
 
+			r_cir_pin: r-cir-pin {
+				pins = "PL12";
+				function = "s_cir_rx";
+			};
+
 			r_rsb_pins: r-rsb-pins {
 				pins = "PL0", "PL1";
 				function = "s_rsb";
Signature · 1 line
2.11.0
#2 lore raw

PATCH v6 2/4 ARM: dts: sun8i: a83t: Add support for the cir interface

In reply to Philipp Rossak

The cir interface is like on the H3 located at 0x01f02000 and is exactly the same. This patch adds support for the ir interface on the A83T.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +12 -0
index afed6c0dea6f..31222a05a8f1 100644
@@ -992,6 +992,18 @@
 			reg = <0x1f01c00 0x400>;
 		};
 
+		r_cir: ir at 1f02000 {
+			compatible = "allwinner,sun5i-a13-ir";
+			clocks = <&r_ccu CLK_APB0_IR>, <&r_ccu CLK_IR>;
+			clock-names = "apb", "ir";
+			resets = <&r_ccu RST_APB0_IR>;
+			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+			reg = <0x01f02000 0x400>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&r_cir_pin>;
+			status = "disabled";
+		};
+
 		r_pio: pinctrl at 1f02c00 {
 			compatible = "allwinner,sun8i-a83t-r-pinctrl";
 			reg = <0x01f02c00 0x400>;
Signature · 1 line
2.11.0
#4 lore raw

PATCH v6 3/4 ARM: dts: sun8i: a83t: bananapi-m3: Enable IR controller

In reply to Philipp Rossak

The Bananapi M3 has an onboard IR receiver.
This enables the onboard IR receiver subnode.
Unlike the other IR receivers this one needs a base clock frequency of 3000000 Hz (3 MHz), to be able to work.

---
 arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts +5 -0
index 3b579d7567c8..ea23ff821166 100644
@@ -183,6 +183,11 @@
 	status = "okay";
 };
 
+&r_cir {
+	clock-frequency = <3000000>;
+	status = "okay";
+};
+
 &r_rsb {
 	status = "okay";
 
Signature · 1 line
2.11.0
#5 lore raw

PATCH v6 4/4 ARM: dts: sun8i: h3-h5: ir register size should be the whole memory block

In reply to Philipp Rossak

The size of the register should be the size of the whole memory block, not just the registers, that are needed.

---
 arch/arm/boot/dts/sunxi-h3-h5.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sunxi-h3-h5.dtsi +1 -1
index c3bff1105e5d..2f4d93de836e 100644
@@ -818,7 +818,7 @@
 			clock-names = "apb", "ir";
 			resets = <&r_ccu RST_APB0_IR>;
 			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
-			reg = <0x01f02000 0x40>;
+			reg = <0x01f02000 0x400>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.11.0
#3 lore raw

Re: [PATCH v6 2/4] ARM: dts: sun8i: a83t: Add support for the cir interface

In reply to Philipp Rossak
Quoted 13 lines · Philipp Rossak

The cir interface is like on the H3 located at 0x01f02000 and is exactly the same. This patch adds support for the ir interface on the A83T.

---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +0 -0
index afed6c0dea6f..31222a05a8f1 100644

arch/arm/boot/dts/sun8i-a83t.dtsi line 996

Quoted 5 lines
arch/arm/boot/dts/sun8i-a83t.dtsi +2 -0
@@ -992,6 +992,18 @@
 			reg = <0x1f01c00 0x400>;
 		};
 
+		r_cir: ir at 1f02000 {
+			compatible = "allwinner,sun5i-a13-ir";

You should have an a83t compatile in addition here.

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
Acked-by on the v6 series
#6 lore raw
In reply to Philipp Rossak
Quoted 10 lines · Philipp Rossak

This patch series adds support for the sunxi A83T ir module and enhances the sunxi-ir driver. Right now the base clock frequency for the ir driver is a hard coded define and is set to 8 MHz.
This works for the most common ir receivers. On the Sinovoip Bananapi M3 the ir receiver needs, a 3 MHz base clock frequency to work without problems with this driver.

This patch series adds support for an optinal property that makes it able to override the default base clock frequency and enables the ir interface on the a83t and the Bananapi M3.

Once the minor comment on patch 2 has been fixed,

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

Thanks,
I will fix this today.

Philipp

Quoted 17 lines · Maxime Ripard
Quoted 10 lines · Philipp Rossak

This patch series adds support for the sunxi A83T ir module and enhances the sunxi-ir driver. Right now the base clock frequency for the ir driver is a hard coded define and is set to 8 MHz.
This works for the most common ir receivers. On the Sinovoip Bananapi M3 the ir receiver needs, a 3 MHz base clock frequency to work without problems with this driver.

This patch series adds support for an optinal property that makes it able to override the default base clock frequency and enables the ir interface on the a83t and the Bananapi M3.

Once the minor comment on patch 2 has been fixed,

Maxime