Skip to contentSkip to conversation

ARM: sunxi: Add support for consumer infrared devices

PATCH Superseded Alexander Bersenev 6 participants 9 messages May 13, 2014 – May 14, 2014 1 message not in the archive

Subsystems (4)

v6 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v6 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)

Alexander Bersenev (3):
ARM: sunxi: Add documentation for sunxi consumer infrared devices
ARM: sunxi: Add driver for sunxi IR controller
ARM: sunxi: Add IR controller support in DT on A20

 .../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                   |  31 +++
 drivers/media/rc/Kconfig                           |  10 +
 drivers/media/rc/Makefile                          |   1 +
 drivers/media/rc/sunxi-ir.c                        | 309 +++++++++++++++++++++
 7 files changed, 386 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/sunxi-ir.txt
 create mode 100644 drivers/media/rc/sunxi-ir.c
Signature · 1 line
1.9.3
#1 lore raw

PATCH v6 1/3 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 file changed, 23 insertions(+)
 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.9.3
#2 lore raw

PATCH v6 2/3 ARM: sunxi: Add driver for sunxi IR controller

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-ir.c | 309 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 320 insertions(+)
 create mode 100644 drivers/media/rc/sunxi-ir.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..93cdbe9 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-ir.o
 obj-$(CONFIG_IR_IMG) += img-ir/
drivers/media/rc/sunxi-ir.c new file +309 -0

309 lines not on this page · raw message

Signature · 1 line
1.9.3
#4 lore raw

PATCH v6 3/3 ARM: sunxi: Add IR controller support in DT on A20

In reply to Alexander Bersenev

This patch adds IR controller in A20 Device-Tree:
- Two IR devices found in A20 user manual
- Pins for two devices
- 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 ++++++
 arch/arm/boot/dts/sun7i-a20.dtsi            | 31 +++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6 -0
index feeff64..2564e8c 100644
@@ -164,6 +164,12 @@
 				reg = <1>;
 			};
 		};
+
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
 	};
 
 	leds {
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +6 -0
index e288562..e375e89 100644
@@ -232,6 +232,12 @@
 				reg = <1>;
 			};
 		};
+
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
 	};
 
 	leds {
arch/arm/boot/dts/sun7i-a20.dtsi +31 -0
index 0ae2b77..40ded74 100644
@@ -724,6 +724,19 @@
 				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 {
@@ -937,5 +950,23 @@
 			#interrupt-cells = <3>;
 			interrupts = <1 9 0xf04>;
 		};
+
+		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";
+		};
 	};
 };
Signature · 1 line
1.9.3
#6 lore raw

Re: [PATCH v6 3/3] ARM: sunxi: Add IR controller support in DT on A20

In reply to a message not in the archive

I've added this to my to-do list.najsjs On May 13, 2014 at 1:39:02 PM CDT, Alexander Bersenev <bay-d8LqKIyZzER6k2ZkT/[email protected]> wrote:This patch adds IR controller in A20 Device-Tree:- Two IR devices found in A20 user manual- Pins for two devices- One IR device physically found on Cubieboard 2- One IR device physically found on CubietruckSigned-off-by: Alexander Bersenev Signed-off-by: Alexsey Shestacov --- 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 | 31 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+)diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dtsindex feeff64..2564e8c 100644--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts@@ -164,6 +164,12 @@ reg = ; }; };++ ir0: ir@01c21800 {+ pinctrl-names = "default";+ pinctrl-0 = ;+ status = "okay";+ }; }; leds {diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dtsindex e288562..e375e89 100644--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts@@ -232,6 +232,12 @@ reg = ; }; };++ ir0: ir@01c21800 {+ pinctrl-names = "default";+ pinctrl-0 = ;+ status = "okay";+ }; }; leds {diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsiindex 0ae2b77..40ded74 100644--- a/arch/arm/boot/dts/sun7i-a20.dtsi+++ b/arch/arm/boot/dts/sun7i-a20.dtsi@@ -724,6 +724,19 @@ allwinner,drive = ; allwinner,pull = ; };++ ir0_pins_a: ir0@0 {+ allwinner,pins = "PB3","PB4";+ allwinner,function = "ir0";+ allwinner,drive = ;+ allwinner,pull = ;+ };+ ir1_pins_a: ir1@0 {+ allwinner,pins = "PB22","PB23";+ allwinner,function = "ir1";+ allwinner,drive = ;+ allwinner,pull = ;+ }; }; timer@01c20c00 {@@ -937,5 +950,23 @@ #interrupt-cells = ; interrupts = ; };++ ir0: ir@01c21800 {+ compatible = "allwinner,sun7i-a20-ir";+ clocks = , ;+ clock-names = "apb", "ir";+ interrupts = ;+ reg = ;+ status = "disabled";+ };++ ir1: ir@01c21c00 {+ compatible = "allwinner,sun7i-a20-ir";+ clocks = , ;+ clock-names = "apb", "ir";+ interrupts = ;+ reg = ;+ status = "disabled";+ }; }; };-- 1.9.3--To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to [email protected] majordomo info at http://vger.kernel.org/majordomo-info.htmlPlease read the FAQ at http://www.tux.org/lkml/

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.
#3 lore raw

Re: [PATCH v6 2/3] ARM: sunxi: Add driver for sunxi IR controller

In reply to Alexander Bersenev

Hi Alexander,

Just a few probe error handling suggestions...

Quoted 9 lines · Alexander Bersenev
drivers/media/rc/sunxi-ir.c new file +9 -0
+static int sunxi_ir_probe(struct platform_device *pdev)
+{
+	int ret = 0;
+	unsigned long tmp = 0;
+
+	struct device *dev = &pdev->dev;
+	struct device_node *dn = dev->of_node;
+	struct resource *res;
+	struct sunxi_ir *ir;

drivers/media/rc/sunxi-ir.c line 144

Quoted 10 lines
drivers/media/rc/sunxi-ir.c new file +10 -0
+
+	ir = devm_kzalloc(dev, sizeof(struct sunxi_ir), GFP_KERNEL);
+	if (!ir)
+		return -ENOMEM;
+
+	/* Clock */
+	ir->apb_clk = devm_clk_get(dev, "apb");
+	if (IS_ERR(ir->apb_clk)) {
+		dev_err(dev, "failed to get a apb clock.\n");
+		return -EINVAL;

Does it make sense to return PTR_ERR(ir->apb_clk) here?

drivers/media/rc/sunxi-ir.c line 149

Quoted 5 lines
drivers/media/rc/sunxi-ir.c new file +5 -0
+	}
+	ir->clk = devm_clk_get(dev, "ir");
+	if (IS_ERR(ir->clk)) {
+		dev_err(dev, "failed to get a ir clock.\n");
+		return -EINVAL;

and here

drivers/media/rc/sunxi-ir.c line 155

Quoted 6 lines
drivers/media/rc/sunxi-ir.c new file +6 -0
+	}
+
+	ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK);
+	if (ret) {
+		dev_err(dev, "set ir base clock failed!\n");
+		return -EINVAL;

return ret?

Quoted 10 lines
drivers/media/rc/sunxi-ir.c new file +10 -0
+	}
+
+	if (clk_prepare_enable(ir->apb_clk)) {
+		dev_err(dev, "try to enable apb_ir_clk failed\n");
+		return -EINVAL;
+	}
+
+	if (clk_prepare_enable(ir->clk)) {
+		dev_err(dev, "try to enable ir_clk failed\n");
+		ret = -EINVAL;

drivers/media/rc/sunxi-ir.c line 175

Quoted 10 lines
drivers/media/rc/sunxi-ir.c new file +10 -0
+		goto exit_clkdisable_apb_clk;
+	}
+
+	/* IO */
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+	ir->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(ir->base)) {
+		dev_err(dev, "failed to map registers\n");
+		ret = -ENOMEM;

PTR_ERR again?

drivers/media/rc/sunxi-ir.c line 183

Quoted 8 lines
drivers/media/rc/sunxi-ir.c new file +8 -0
+		goto exit_clkdisable_clk;
+	}
+
+	/* IRQ */
+	ir->irq = platform_get_irq(pdev, 0);
+	if (ir->irq < 0) {
+		dev_err(dev, "no irq resource\n");
+		ret = -EINVAL;

ret = ir->irq?

drivers/media/rc/sunxi-ir.c line 190

Quoted 7 lines
drivers/media/rc/sunxi-ir.c new file +7 -0
+		goto exit_clkdisable_clk;
+	}
+
+	ret = devm_request_irq(dev, ir->irq, sunxi_ir_irq, 0, SUNXI_IR_DEV, ir);
+	if (ret) {
+		dev_err(dev, "failed request irq\n");
+		ret = -EINVAL;

necessary?

Quoted 21 lines
drivers/media/rc/sunxi-ir.c new file +21 -0
+		goto exit_clkdisable_clk;
+	}
+
+	ir->rc = rc_allocate_device();
+
+	if (!ir->rc) {
+		dev_err(dev, "failed to allocate device\n");
+		ret = -ENOMEM;
+		goto exit_clkdisable_clk;
+	}
+
+	ir->rc->priv = ir;
+	ir->rc->input_name = SUNXI_IR_DEV;
+	ir->rc->input_phys = "sunxi-ir/input0";
+	ir->rc->input_id.bustype = BUS_HOST;
+	ir->rc->input_id.vendor = 0x0001;
+	ir->rc->input_id.product = 0x0001;
+	ir->rc->input_id.version = 0x0100;
+	ir->map_name = of_get_property(dn, "linux,rc-map-name", NULL);
+	ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
+	ir->rc->dev.parent = dev;

drivers/media/rc/sunxi-ir.c line 221

Quoted 10 lines
drivers/media/rc/sunxi-ir.c new file +10 -0
+	ir->rc->driver_type = RC_DRIVER_IR_RAW;
+	rc_set_allowed_protocols(ir->rc, RC_BIT_ALL);
+	ir->rc->rx_resolution = SUNXI_IR_SAMPLE;
+	ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT);
+	ir->rc->driver_name = SUNXI_IR_DEV;
+
+	ret = rc_register_device(ir->rc);
+	if (ret) {
+		dev_err(dev, "failed to register rc device\n");
+		ret = -EINVAL;

same again

drivers/media/rc/sunxi-ir.c line 224

Quoted 3 lines
drivers/media/rc/sunxi-ir.c new file +3 -0
+		goto exit_free_dev;
+	}
+

Cheers
James

#7 lore raw

Re: [PATCH v6 3/3] ARM: sunxi: Add IR controller support in DT on A20

In reply to Alexander Bersenev
Quoted 38 lines · Alexander Bersenev

This patch adds IR controller in A20 Device-Tree:
- Two IR devices found in A20 user manual
- Pins for two devices
- 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 ++++++
 arch/arm/boot/dts/sun7i-a20.dtsi            | 31 +++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6 -0
index feeff64..2564e8c 100644
@@ -164,6 +164,12 @@
 				reg = <1>;
 			};
 		};
+
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
 	};
 
 	leds {
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +0 -0
index e288562..e375e89 100644
@@ -232,6 +232,12 @@
 				reg = <1>;
 			};

arch/arm/boot/dts/sun7i-a20-cubietruck.dts line 243

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +6 -0
 		};
+
+		ir0: ir at 01c21800 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&ir0_pins_a>;
+			status = "okay";
+		};
 	};
 
 	leds {

Please make these two changes a separate patch.

Quoted 5 lines
arch/arm/boot/dts/sun7i-a20.dtsi +0 -0
index 0ae2b77..40ded74 100644

arch/arm/boot/dts/sun7i-a20.dtsi line 733

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +7 -0
@@ -724,6 +724,19 @@
 				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>;
+			};

Extra line

arch/arm/boot/dts/sun7i-a20.dtsi line 740

Quoted 7 lines
arch/arm/boot/dts/sun7i-a20.dtsi +6 -0
+			ir1_pins_a: ir1 at 0 {
+				    allwinner,pins = "PB22","PB23";
+				    allwinner,function = "ir1";
+				    allwinner,drive = <0>;
+				    allwinner,pull = <0>;
+			};
 		};

Do you use ir1_pins_a at all?

I also prefer whenever such additions are in a patch of their own.

Quoted 11 lines
arch/arm/boot/dts/sun7i-a20.dtsi +6 -0
 		timer at 01c20c00 {
@@ -937,5 +950,23 @@
 			#interrupt-cells = <3>;
 			interrupts = <1 9 0xf04>;
 		};
+
+		ir0: ir at 01c21800 {
+			compatible = "allwinner,sun7i-a20-ir";
+			clocks = <&apb0_gates 6>, <&ir0_clk>;
+			clock-names = "apb", "ir";
+			interrupts = <0 5 4>;

arch/arm/boot/dts/sun7i-a20.dtsi line 968

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +10 -0
+			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>;

You're mixing upper and lower case letters here, please make it lower case.

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/20140514/b6ddd821/attachment.sig>
#9 lore raw

Re: [PATCH v6 3/3] ARM: sunxi: Add IR controller support in DT on A20

In reply to Alexander Bersenev

Hi,

<snip>

Quoted 39 lines · Alexander Bersenev
arch/arm/boot/dts/sun7i-a20.dtsi +23 -0
index 0ae2b77..40ded74 100644
@@ -724,6 +724,19 @@
 				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 {
@@ -937,5 +950,23 @@
 			#interrupt-cells = <3>;
 			interrupts = <1 9 0xf04>;
 		};
+
+		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";
+		};
+

arch/arm/boot/dts/sun7i-a20.dtsi line 972

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +8 -0
+		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";
+		};
 	};
 };

The entries in the soc block are sorted by register address, so please don't add these at the end, instead keep things sorted.

Regards,

Hans

#8 lore raw

Re: [PATCH v6 3/3] ARM: sunxi: Add IR controller support in DT on A20

In reply to Maxime Ripard

Sending two changes as the patch.
I am not using ir1_pins_a because cubietruck has only one ir port, but other A20 devices may have up to 2 ir ports.

(quoted diff) +0 -0

b/arch/arm/boot/dts/sun7i-a20.dtsi
index 40ded74..53a9ab1 100644

arch/arm/boot/dts/sun7i-a20.dtsi +2 -1
@@ -731,6 +731,7 @@
                                    allwinner,drive = <0>;
                                    allwinner,pull = <0>;
                        };
+
                        ir1_pins_a: ir1@0 {
                                    allwinner,pins = "PB22","PB23";
                                    allwinner,function = "ir1";
@@ -965,7 +966,7 @@
                        clocks = <&apb0_gates 7>, <&ir1_clk>;
                        clock-names = "apb", "ir";
                        interrupts = <0 6 4>;
-                       reg = <0x01C21c00 0x40>;
+                       reg = <0x01c21c00 0x40>;
                        status = "disabled";
                };
        };

среда, 14 мая 2014 г., 13:50:17 UTC+6 пользователь Maxime Ripard написал:

Quoted 121 lines · Alexander Bersenev
Quoted 6 lines

This patch adds IR controller in A20 Device-Tree:
- Two IR devices found in A20 user manual
- Pins for two devices
- One IR device physically found on Cubieboard 2
- One IR device physically found on Cubietruck

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

---

 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            | 31 

+++++++++++++++++++++++++++++

Review

Quoted 3 lines
 3 files changed, 43 insertions(+) 
(quoted diff) +0 -0

b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts

Review

Quoted 17 lines

index feeff64..2564e8c 100644

arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +6 -0
@@ -164,6 +164,12 @@ 
                                 reg = <1>; 
                         }; 
                 }; 
+ 
+                ir0: ir@01c21800 { 
+                        pinctrl-names = "default"; 
+                        pinctrl-0 = <&ir0_pins_a>; 
+                        status = "okay"; 
+                }; 
         }; 
 
         leds { 
(quoted diff) +0 -0

b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts

Quoted 6 lines

index e288562..e375e89 100644

arch/arm/boot/dts/sun7i-a20-cubietruck.dts +0 -0
@@ -232,6 +232,12 @@ 
                                 reg = <1>; 
                         }; 

arch/arm/boot/dts/sun7i-a20-cubietruck.dts line 243

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +6 -0
                 }; 
+ 
+                ir0: ir@01c21800 { 
+                        pinctrl-names = "default"; 
+                        pinctrl-0 = <&ir0_pins_a>; 
+                        status = "okay"; 
+                }; 
         }; 
 
         leds { 

Please make these two changes a separate patch.

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/boot/dts/sun7i-a20.dtsi

Quoted 4 lines

index 0ae2b77..40ded74 100644

arch/arm/boot/dts/sun7i-a20.dtsi line 733

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +7 -0
@@ -724,6 +724,19 @@ 
                                 allwinner,drive = <2>; 
                                 allwinner,pull = <0>; 
                         }; 
+ 
+                        ir0_pins_a: ir0@0 { 
+                                    allwinner,pins = "PB3","PB4"; 
+                                    allwinner,function = "ir0"; 
+                                    allwinner,drive = <0>; 
+                                    allwinner,pull = <0>; 
+                        }; 

Extra line

arch/arm/boot/dts/sun7i-a20.dtsi line 740

Quoted 7 lines
arch/arm/boot/dts/sun7i-a20.dtsi +6 -0
+                        ir1_pins_a: ir1@0 { 
+                                    allwinner,pins = "PB22","PB23"; 
+                                    allwinner,function = "ir1"; 
+                                    allwinner,drive = <0>; 
+                                    allwinner,pull = <0>; 
+                        }; 
                 }; 

Do you use ir1_pins_a at all?

I also prefer whenever such additions are in a patch of their own.

Quoted 11 lines
arch/arm/boot/dts/sun7i-a20.dtsi +6 -0
                 timer@01c20c00 { 
@@ -937,5 +950,23 @@ 
                         #interrupt-cells = <3>; 
                         interrupts = <1 9 0xf04>; 
                 }; 
+ 
+                ir0: ir@01c21800 { 
+                        compatible = "allwinner,sun7i-a20-ir"; 
+                        clocks = <&apb0_gates 6>, <&ir0_clk>; 
+                        clock-names = "apb", "ir"; 
+                        interrupts = <0 5 4>; 

arch/arm/boot/dts/sun7i-a20.dtsi line 968

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +10 -0
+                        reg = <0x01c21800 0x40>; 
+                        status = "disabled"; 
+                }; 
+ 
+                ir1: ir@01c21c00 { 
+                        compatible = "allwinner,sun7i-a20-ir"; 
+                        clocks = <&apb0_gates 7>, <&ir1_clk>; 
+                        clock-names = "apb", "ir"; 
+                        interrupts = <0 6 4>; 
+                        reg = <0x01C21c00 0x40>; 

You're mixing upper and lower case letters here, please make it lower case.

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.