Skip to contentSkip to conversation

ARM: sunxi: Add support for consumer infrared devices

PATCH Applied Alexander Bersenev 3 participants 9 messages Jun 21, 2014 – Jun 23, 2014

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

v10 cover ARM: sunxi: Add support for consumer infrared devices

This patch introduces Consumer IR(CIR) support for sunxi boards.

This is based on Alexsey Shestacov's work based on the original driver supplied by Allwinner.

---
Changes since version 1:
- Fix timer memory leaks
- Fix race condition when driver unloads while interrupt handler is active
- Support Cubieboard 2(need testing)

Changes since version 2:
- More reliable keydown events
- Documentation fixes
- Rename registers accurding to A20 user manual
- Remove some includes, order includes alphabetically
- Use BIT macro
- Typo fixes

Changes since version 3:
- Split the patch on smaller parts
- More documentation fixes
- Add clock-names in DT
- Use devm_clk_get function to get the clocks
- Removed gpios property from ir's DT
- Changed compatible from allwinner,sunxi-ir to allwinner,sun7i-a20-ir in DT
- Use spin_lock_irq instead spin_lock_irqsave in interrupt handler
- Add myself in the copyright ;)
- Coding style and indentation fixes

Changes since version 4:
- Try to fix indentation errors by sending patches with git send-mail

Changes since version 5:
- More indentation fixes
- Make patches pass checkpatch with --strict option
- Replaced magic numbers with defines(patch by Priit Laes)
- Fixed oops on loading(patch by Hans de Goede)

Changes since version 6:
- Removed constants from code
- Better errrors handling on loading
- Renamed sunxi-ir.c to sunxi-cir.c
- Changed description of second commit
- Order entries in dts and dtsi by register address
- Code style fixes

Changes since version 7:
- Removed a couple of blank lines in code
- Delay interrupts init until we are ready to handle them
- Increased the reported duration of each pulse by one
- Refactored defines

Changes since version 8:
- Split the DT patch to three
- Code style fixes

Changes since version 9:
- Rebase patches on 3.16-rc1

Alexander Bersenev (5):
ARM: sunxi: Add documentation for sunxi consumer infrared devices [media] rc: add sunxi-ir driver
ARM: sunxi: Add pins for IR controller on A20 to dtsi
ARM: sunxi: Add IR controllers on A20 to dtsi
ARM: sunxi: Enable IR controller on cubieboard 2 and cubietruck in
dts

 .../devicetree/bindings/media/sunxi-ir.txt         |   23 ++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts        |    6 +
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts         |    6 +
 arch/arm/boot/dts/sun7i-a20.dtsi                   |   32 ++
 drivers/media/rc/Kconfig                           |   10 +
 drivers/media/rc/Makefile                          |    1 +
 drivers/media/rc/sunxi-cir.c                       |  318 ++++++++++++++++++++
 7 files changed, 396 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/sunxi-ir.txt
 create mode 100644 drivers/media/rc/sunxi-cir.c
#1 lore raw

PATCH v10 1/5 ARM: sunxi: Add documentation for sunxi consumer infrared devices

This patch adds documentation for Device-Tree bindings for sunxi IR controller.

---
 .../devicetree/bindings/media/sunxi-ir.txt         |   23 ++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/sunxi-ir.txt
Documentation/devicetree/bindings/media/sunxi-ir.txt new file +23 -0
new file mode 100644
index 0000000..014dd8b
@@ -0,0 +1,23 @@
+Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
+
+Required properties:
+- compatible	    : should be "allwinner,sun7i-a20-ir";
+- clocks	    : list of clock specifiers, corresponding to
+		      entries in clock-names property;
+- clock-names	    : should contain "apb" and "ir" entries;
+- interrupts	    : should contain IR IRQ number;
+- reg		    : should contain IO map address for IR.
+
+Optional properties:
+- linux,rc-map-name : Remote control map name.
+
+Example:
+
+ir0: ir at 01c21800 {
+	compatible = "allwinner,sun7i-a20-ir";
+	clocks = <&apb0_gates 6>, <&ir0_clk>;
+	clock-names = "apb", "ir";
+	interrupts = <0 5 1>;
+	reg = <0x01C21800 0x40>;
+	linux,rc-map-name = "rc-rc6-mce";
+};
Signature · 1 line
1.7.1
#2 lore raw

PATCH v10 2/5 rc: add sunxi-ir driver

In reply to Alexander Bersenev

This patch adds driver for sunxi IR controller.
It is based on Alexsey Shestacov's work based on the original driver supplied by Allwinner.

---
 drivers/media/rc/Kconfig     |   10 ++
 drivers/media/rc/Makefile    |    1 +
 drivers/media/rc/sunxi-cir.c |  318 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 329 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/rc/sunxi-cir.c
drivers/media/rc/Kconfig +10 -0
index 8fbd377..9427fad 100644
@@ -343,4 +343,14 @@ config RC_ST
 
 	 If you're not sure, select N here.
 
+config IR_SUNXI
+    tristate "SUNXI IR remote control"
+    depends on RC_CORE
+    depends on ARCH_SUNXI
+    ---help---
+      Say Y if you want to use sunXi internal IR Controller
+
+      To compile this driver as a module, choose M here: the module will
+      be called sunxi-ir.
+
 endif #RC_DEVICES
drivers/media/rc/Makefile +1 -0
index f8b54ff..9ee9ee7 100644
@@ -32,4 +32,5 @@ obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o
 obj-$(CONFIG_IR_IGUANA) += iguanair.o
 obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o
 obj-$(CONFIG_RC_ST) += st_rc.o
+obj-$(CONFIG_IR_SUNXI) += sunxi-cir.o
 obj-$(CONFIG_IR_IMG) += img-ir/
drivers/media/rc/sunxi-cir.c new file +318 -0

318 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH v10 3/5 ARM: sunxi: Add pins for IR controller on A20 to dtsi

In reply to Alexander Bersenev

This patch adds pins for two IR controllers on A20

---
 arch/arm/boot/dts/sun7i-a20.dtsi |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/boot/dts/sun7i-a20.dtsi +14 -0
index 01e9466..656d7d3 100644
@@ -738,6 +738,20 @@
 				allwinner,drive = <2>;
 				allwinner,pull = <0>;
 			};
+
+			ir0_pins_a: ir0 at 0 {
+				    allwinner,pins = "PB3","PB4";
+				    allwinner,function = "ir0";
+				    allwinner,drive = <0>;
+				    allwinner,pull = <0>;
+			};
+
+			ir1_pins_a: ir1 at 0 {
+				    allwinner,pins = "PB22","PB23";
+				    allwinner,function = "ir1";
+				    allwinner,drive = <0>;
+				    allwinner,pull = <0>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
1.7.1
#4 lore raw

PATCH v10 4/5 ARM: sunxi: Add IR controllers on A20 to dtsi

In reply to Alexander Bersenev

This patch adds records for two IR controllers on A20

---
 arch/arm/boot/dts/sun7i-a20.dtsi |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/sun7i-a20.dtsi +18 -0
index 656d7d3..1782375 100644
@@ -785,6 +785,24 @@
 			status = "disabled";
 		};
 
+		ir0: ir at 01c21800 {
+			compatible = "allwinner,sun7i-a20-ir";
+			clocks = <&apb0_gates 6>, <&ir0_clk>;
+			clock-names = "apb", "ir";
+			interrupts = <0 5 4>;
+			reg = <0x01c21800 0x40>;
+			status = "disabled";
+		};
+
+		ir1: ir at 01c21c00 {
+			compatible = "allwinner,sun7i-a20-ir";
+			clocks = <&apb0_gates 7>, <&ir1_clk>;
+			clock-names = "apb", "ir";
+			interrupts = <0 6 4>;
+			reg = <0x01c21c00 0x40>;
+			status = "disabled";
+		};
+
 		sid: eeprom at 01c23800 {
 			compatible = "allwinner,sun7i-a20-sid";
 			reg = <0x01c23800 0x200>;
Signature · 1 line
1.7.1
#5 lore raw

Re: [PATCH v10 4/5] ARM: sunxi: Add IR controllers on A20 to dtsi

Quoted 4 lines · Alexander Bersenev

This patch adds records for two IR controllers on A20

Applied, thanks.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140623/f6c3fd2c/attachment.sig>
#6 lore raw

Re: [PATCH v10 4/5] ARM: sunxi: Add IR controllers on A20 to dtsi

Thanks,

Should I send applied patches in the further versions of this patch set?

Best,
Alexander Bersenev

понедельник, 23 июня 2014 г., 19:10:45 UTC+6 пользователь Maxime Ripard написал:

Quoted 16 lines · Alexander Bersenev
Quoted 4 lines

This patch adds records for two IR controllers on A20

Signed-off-by Alexander Bersenev <b...-d8LqKIyZzER6k2ZkT/[email protected] <javascript:>>
Signed-off-by Alexsey Shestacov <[email protected] <javascript:>>

Applied, thanks.

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons 
Embedded Linux, Kernel and Android engineering 
http://free-electrons.com 
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
#7 lore raw

Re: [linux-sunxi] Re: [PATCH v10 4/5] ARM: sunxi: Add IR controllers on A20 to dtsi

Quoted 3 lines · ????????? ????????

Thanks,

Should I send applied patches in the further versions of this patch set?

No, you don't have to.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140623/2f658f2e/attachment.sig>
#8 lore raw

PATCH v10 5/5 ARM: sunxi: Enable IR controller on cubieboard 2 and cubietruck in dts

In reply to Alexander Bersenev

This patch enables two IR devices in dts:
- One IR device physically found on Cubieboard 2
- One IR device physically found on Cubietruck

---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts |    6 ++++++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts  |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6 -0
index a5ad945..a70f0b4 100644
@@ -66,6 +66,12 @@
 			};
 		};
 
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
+
 		uart0: serial at 01c28000 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&uart0_pins_a>;
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +6 -0
index b87fea9..96639d5 100644
@@ -100,6 +100,12 @@
 			status = "okay";
 		};
 
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
+
 		uart0: serial at 01c28000 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&uart0_pins_a>;
Signature · 1 line
1.7.1