Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] mfd: axp20x: Add bindings documentation
From: Maxime Ripard @ 2014-02-10 20:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1391875428-6281-4-git-send-email-carlo@caione.org>

Hi Carlo,

On Sat, Feb 08, 2014 at 05:03:48PM +0100, Carlo Caione wrote:
> Bindings documentation for the axp20x driver. In this file also two
> sub-nodes (PEK and regulators) are documented.
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 87 ++++++++++++++++++++++++
>  1 file changed, 87 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> new file mode 100644
> index 0000000..ccea6b8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,87 @@
> +* axp20x device tree bindings
> +
> +The axp20x family current members :-
> +axp202 (x-powers)
> +axp209 (x-powers)
> +
> +Required properties:
> +- compatible : Should be "x-powers,axp20x" (for axp202 and axp209)

"Generic" compatibles are usually a bad thing, for several reasons,
mostly because there's no way to actually differentiate the two
without keeping adding DT properties (and hence, being unable to
actually fix something or add a quirk for one single of these devices
without having to modify the DT too.)

Please use the "real" compatibles.

> +- interrupt-controller : axp20x has its own internal IRQs
> +- #interrupt-cells : should be set to 1
> +- interrupt-parent : The parent interrupt controller

Is this really required? It was not in your DTSI.

> +- interrupts : Specifies the list of interrupt lines which are handled by
> +	       the device in the parent controller's notation

Hmmm, I'm not sure what you mean here.

> +- reg : Specifies base physical address and size of the registers

Base physical address? Isn't it a I2C device?

> +
> +Sub-nodes
> +* regulators : Contain the regulator nodes. The regulators are bound using
> +	       their name as listed here: dcdc2, dcdc3, ldo1, ldo2, ldo3,
> +	       ldo4, ldo5.
> +	       The bindings details of individual regulator device can be found in:
> +	       Documentation/devicetree/bindings/regulator/regulator.txt with the
> +	       exception of:

I'm guessing this is where you differentiate between AXP202 and
AXP209?

> +
> +	- dcdc-freq : defines the work frequency of DC-DC where
> +		      F=(1+dcdc-freq*5%)*1.5MHz

I'd very much prefer this DCDC frequency to be in Hz, or a similar
unit, and let the driver do the conversion.

> +
> +* axp20x-pek : Power Enable Key
> +	- compatible : should be "x-powers,axp20x-pek"
> +	- interrupts : two interrupt numbers with order defined by interrupt-names
> +		       (one irq number for rising transition of the power key, the
> +		       other one for falling transition)
> +	- interrupt-names : should be "PEK_DBR" and "PEK_DBF"

Is this actually needed since you declare the resources in your driver?

> +
> +Example:
> +
> +axp {
> +	compatible = "x-powers,axp20x";
> +	interrupt-controller;
> +	#interrupt-cells = <1>;

No reg property ?

> +
> +	axp20x-pek {
> +		compatible = "x-powers,axp20x-pek";
> +		interrupts = <33>,  <34>;
> +		interrupt-names = "PEK_DBR", "PEK_DBF";
> +	};
> +
> +	regulators {
> +		dcdc-freq = "8";
> +
> +		axp_dcdc2: dcdc2 {
> +			regulator-min-microvolt = <700000>;
> +			regulator-max-microvolt = <2275000>;
> +			dcdc-workmode = <0>;

And what is this dcdc-workmode property about?


> +		};
> +
> +		axp_dcdc3: dcdc3 {
> +			regulator-min-microvolt = <700000>;
> +			regulator-max-microvolt = <3500000>;
> +			dcdc-workmode = <0>;
> +		};
> +
> +		axp_ldo1: ldo1 {
> +			regulator-min-microvolt = <1300000>;
> +			regulator-max-microvolt = <1300000>;
> +		};
> +
> +		axp_ldo2: ldo2 {
> +			regulator-min-microvolt = <1800000>;
> +			regulator-max-microvolt = <3300000>;
> +		};
> +
> +		axp_ldo3: ldo3 {
> +			regulator-min-microvolt = <700000>;
> +			regulator-max-microvolt = <3500000>;
> +		};
> +
> +		axp_ldo4: ldo4 {
> +			regulator-min-microvolt = <1250000>;
> +			regulator-max-microvolt = <3300000>;
> +		};
> +
> +		axp_ldo5: ldo5 {
> +			regulator-min-microvolt = <1800000>;
> +			regulator-max-microvolt = <3300000>;
> +		};
> +	};
> +};
> -- 
> 1.8.5.3
> 

Thanks for working on this!
Maxime

-- 
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: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140210/03fc1689/attachment.sig>

^ permalink raw reply

* [PATCH v2] ARM: asm: rename logical shift macros push pull into lspush lspull
From: Victor Kamensky @ 2014-02-10 20:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guys,

This patch renames 'push' and 'pull' logical shift macros in arm 
assembler.h, so it could be included into .S file that use 'push' 
as instruction. That was discussed on [1]. Will Deacon suggested
the idea of the patch.

As far as code change concerned - the change is really only macros
rename and change in all places where macros are used. Even if diff
may seem big it is very simple change.

Changes from previous version:
   - Now instead of changing kvm .S files that use push instruction
   patch rename push and pull
   - This patch is submitted separately from ARM V7 BE KVM series

Testing:
   - Was tested on rmk/for-next branch. TC2 LE and BE images were built
   and run
   - Verified build of all 118 images under arch/arm/configs and 
   with objdump dump verified that images text segment do not change
   compared with base line (modulo buildid (disabled), some initramfs
   addresses)

Will, I added your name under 'Suggested-by:', please let me know if
you object to this.

Thanks,
Victor

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-January/227318.html

Victor Kamensky (1):
  ARM: asm: rename logical shift macros push pull into lspush lspull

 arch/arm/include/asm/assembler.h      |   8 +-
 arch/arm/lib/copy_template.S          |  36 +++----
 arch/arm/lib/csumpartialcopygeneric.S |  96 ++++++++---------
 arch/arm/lib/io-readsl.S              |  12 +--
 arch/arm/lib/io-writesl.S             |  12 +--
 arch/arm/lib/memmove.S                |  36 +++----
 arch/arm/lib/uaccess.S                | 192 +++++++++++++++++-----------------
 7 files changed, 196 insertions(+), 196 deletions(-)

-- 
1.8.1.4

^ permalink raw reply

* [PATCH v2] ARM: asm: rename logical shift macros push pull into lspush lspull
From: Victor Kamensky @ 2014-02-10 20:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392063589-24111-1-git-send-email-victor.kamensky@linaro.org>

Renames logical shift macros, 'push' and 'pull', defined in
arch/arm/include/asm/assembler.h, into 'lspush' and 'lspull'.
That eliminates name conflict between 'push' logical shift macro
and 'push' instruction mnemonic. That allows assembler.h to be
included in .S files that use 'push' instruction.

Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
---
 arch/arm/include/asm/assembler.h      |   8 +-
 arch/arm/lib/copy_template.S          |  36 +++----
 arch/arm/lib/csumpartialcopygeneric.S |  96 ++++++++---------
 arch/arm/lib/io-readsl.S              |  12 +--
 arch/arm/lib/io-writesl.S             |  12 +--
 arch/arm/lib/memmove.S                |  36 +++----
 arch/arm/lib/uaccess.S                | 192 +++++++++++++++++-----------------
 7 files changed, 196 insertions(+), 196 deletions(-)

diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 5c22851..380ac4f 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -30,8 +30,8 @@
  * Endian independent macros for shifting bytes within registers.
  */
 #ifndef __ARMEB__
-#define pull            lsr
-#define push            lsl
+#define lspull          lsr
+#define lspush          lsl
 #define get_byte_0      lsl #0
 #define get_byte_1	lsr #8
 #define get_byte_2	lsr #16
@@ -41,8 +41,8 @@
 #define put_byte_2	lsl #16
 #define put_byte_3	lsl #24
 #else
-#define pull            lsl
-#define push            lsr
+#define lspull          lsl
+#define lspush          lsr
 #define get_byte_0	lsr #24
 #define get_byte_1	lsr #16
 #define get_byte_2	lsr #8
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 805e3f8..3bc8eb8 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -197,24 +197,24 @@
 
 12:	PLD(	pld	[r1, #124]		)
 13:		ldr4w	r1, r4, r5, r6, r7, abort=19f
-		mov	r3, lr, pull #\pull
+		mov	r3, lr, lspull #\pull
 		subs	r2, r2, #32
 		ldr4w	r1, r8, r9, ip, lr, abort=19f
-		orr	r3, r3, r4, push #\push
-		mov	r4, r4, pull #\pull
-		orr	r4, r4, r5, push #\push
-		mov	r5, r5, pull #\pull
-		orr	r5, r5, r6, push #\push
-		mov	r6, r6, pull #\pull
-		orr	r6, r6, r7, push #\push
-		mov	r7, r7, pull #\pull
-		orr	r7, r7, r8, push #\push
-		mov	r8, r8, pull #\pull
-		orr	r8, r8, r9, push #\push
-		mov	r9, r9, pull #\pull
-		orr	r9, r9, ip, push #\push
-		mov	ip, ip, pull #\pull
-		orr	ip, ip, lr, push #\push
+		orr	r3, r3, r4, lspush #\push
+		mov	r4, r4, lspull #\pull
+		orr	r4, r4, r5, lspush #\push
+		mov	r5, r5, lspull #\pull
+		orr	r5, r5, r6, lspush #\push
+		mov	r6, r6, lspull #\pull
+		orr	r6, r6, r7, lspush #\push
+		mov	r7, r7, lspull #\pull
+		orr	r7, r7, r8, lspush #\push
+		mov	r8, r8, lspull #\pull
+		orr	r8, r8, r9, lspush #\push
+		mov	r9, r9, lspull #\pull
+		orr	r9, r9, ip, lspush #\push
+		mov	ip, ip, lspull #\pull
+		orr	ip, ip, lr, lspush #\push
 		str8w	r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
 		bge	12b
 	PLD(	cmn	r2, #96			)
@@ -225,10 +225,10 @@
 14:		ands	ip, r2, #28
 		beq	16f
 
-15:		mov	r3, lr, pull #\pull
+15:		mov	r3, lr, lspull #\pull
 		ldr1w	r1, lr, abort=21f
 		subs	ip, ip, #4
-		orr	r3, r3, lr, push #\push
+		orr	r3, r3, lr, lspush #\push
 		str1w	r0, r3, abort=21f
 		bgt	15b
 	CALGN(	cmp	r2, #0			)
diff --git a/arch/arm/lib/csumpartialcopygeneric.S b/arch/arm/lib/csumpartialcopygeneric.S
index d620a5f..d6e742d 100644
--- a/arch/arm/lib/csumpartialcopygeneric.S
+++ b/arch/arm/lib/csumpartialcopygeneric.S
@@ -141,7 +141,7 @@ FN_ENTRY
 		tst	len, #2
 		mov	r5, r4, get_byte_0
 		beq	.Lexit
-		adcs	sum, sum, r4, push #16
+		adcs	sum, sum, r4, lspush #16
 		strb	r5, [dst], #1
 		mov	r5, r4, get_byte_1
 		strb	r5, [dst], #1
@@ -171,23 +171,23 @@ FN_ENTRY
 		cmp	ip, #2
 		beq	.Lsrc2_aligned
 		bhi	.Lsrc3_aligned
-		mov	r4, r5, pull #8		@ C = 0
+		mov	r4, r5, lspull #8		@ C = 0
 		bics	ip, len, #15
 		beq	2f
 1:		load4l	r5, r6, r7, r8
-		orr	r4, r4, r5, push #24
-		mov	r5, r5, pull #8
-		orr	r5, r5, r6, push #24
-		mov	r6, r6, pull #8
-		orr	r6, r6, r7, push #24
-		mov	r7, r7, pull #8
-		orr	r7, r7, r8, push #24
+		orr	r4, r4, r5, lspush #24
+		mov	r5, r5, lspull #8
+		orr	r5, r5, r6, lspush #24
+		mov	r6, r6, lspull #8
+		orr	r6, r6, r7, lspush #24
+		mov	r7, r7, lspull #8
+		orr	r7, r7, r8, lspush #24
 		stmia	dst!, {r4, r5, r6, r7}
 		adcs	sum, sum, r4
 		adcs	sum, sum, r5
 		adcs	sum, sum, r6
 		adcs	sum, sum, r7
-		mov	r4, r8, pull #8
+		mov	r4, r8, lspull #8
 		sub	ip, ip, #16
 		teq	ip, #0
 		bne	1b
@@ -196,50 +196,50 @@ FN_ENTRY
 		tst	ip, #8
 		beq	3f
 		load2l	r5, r6
-		orr	r4, r4, r5, push #24
-		mov	r5, r5, pull #8
-		orr	r5, r5, r6, push #24
+		orr	r4, r4, r5, lspush #24
+		mov	r5, r5, lspull #8
+		orr	r5, r5, r6, lspush #24
 		stmia	dst!, {r4, r5}
 		adcs	sum, sum, r4
 		adcs	sum, sum, r5
-		mov	r4, r6, pull #8
+		mov	r4, r6, lspull #8
 		tst	ip, #4
 		beq	4f
 3:		load1l	r5
-		orr	r4, r4, r5, push #24
+		orr	r4, r4, r5, lspush #24
 		str	r4, [dst], #4
 		adcs	sum, sum, r4
-		mov	r4, r5, pull #8
+		mov	r4, r5, lspull #8
 4:		ands	len, len, #3
 		beq	.Ldone
 		mov	r5, r4, get_byte_0
 		tst	len, #2
 		beq	.Lexit
-		adcs	sum, sum, r4, push #16
+		adcs	sum, sum, r4, lspush #16
 		strb	r5, [dst], #1
 		mov	r5, r4, get_byte_1
 		strb	r5, [dst], #1
 		mov	r5, r4, get_byte_2
 		b	.Lexit
 
-.Lsrc2_aligned:	mov	r4, r5, pull #16
+.Lsrc2_aligned:	mov	r4, r5, lspull #16
 		adds	sum, sum, #0
 		bics	ip, len, #15
 		beq	2f
 1:		load4l	r5, r6, r7, r8
-		orr	r4, r4, r5, push #16
-		mov	r5, r5, pull #16
-		orr	r5, r5, r6, push #16
-		mov	r6, r6, pull #16
-		orr	r6, r6, r7, push #16
-		mov	r7, r7, pull #16
-		orr	r7, r7, r8, push #16
+		orr	r4, r4, r5, lspush #16
+		mov	r5, r5, lspull #16
+		orr	r5, r5, r6, lspush #16
+		mov	r6, r6, lspull #16
+		orr	r6, r6, r7, lspush #16
+		mov	r7, r7, lspull #16
+		orr	r7, r7, r8, lspush #16
 		stmia	dst!, {r4, r5, r6, r7}
 		adcs	sum, sum, r4
 		adcs	sum, sum, r5
 		adcs	sum, sum, r6
 		adcs	sum, sum, r7
-		mov	r4, r8, pull #16
+		mov	r4, r8, lspull #16
 		sub	ip, ip, #16
 		teq	ip, #0
 		bne	1b
@@ -248,20 +248,20 @@ FN_ENTRY
 		tst	ip, #8
 		beq	3f
 		load2l	r5, r6
-		orr	r4, r4, r5, push #16
-		mov	r5, r5, pull #16
-		orr	r5, r5, r6, push #16
+		orr	r4, r4, r5, lspush #16
+		mov	r5, r5, lspull #16
+		orr	r5, r5, r6, lspush #16
 		stmia	dst!, {r4, r5}
 		adcs	sum, sum, r4
 		adcs	sum, sum, r5
-		mov	r4, r6, pull #16
+		mov	r4, r6, lspull #16
 		tst	ip, #4
 		beq	4f
 3:		load1l	r5
-		orr	r4, r4, r5, push #16
+		orr	r4, r4, r5, lspush #16
 		str	r4, [dst], #4
 		adcs	sum, sum, r4
-		mov	r4, r5, pull #16
+		mov	r4, r5, lspull #16
 4:		ands	len, len, #3
 		beq	.Ldone
 		mov	r5, r4, get_byte_0
@@ -276,24 +276,24 @@ FN_ENTRY
 		load1b	r5
 		b	.Lexit
 
-.Lsrc3_aligned:	mov	r4, r5, pull #24
+.Lsrc3_aligned:	mov	r4, r5, lspull #24
 		adds	sum, sum, #0
 		bics	ip, len, #15
 		beq	2f
 1:		load4l	r5, r6, r7, r8
-		orr	r4, r4, r5, push #8
-		mov	r5, r5, pull #24
-		orr	r5, r5, r6, push #8
-		mov	r6, r6, pull #24
-		orr	r6, r6, r7, push #8
-		mov	r7, r7, pull #24
-		orr	r7, r7, r8, push #8
+		orr	r4, r4, r5, lspush #8
+		mov	r5, r5, lspull #24
+		orr	r5, r5, r6, lspush #8
+		mov	r6, r6, lspull #24
+		orr	r6, r6, r7, lspush #8
+		mov	r7, r7, lspull #24
+		orr	r7, r7, r8, lspush #8
 		stmia	dst!, {r4, r5, r6, r7}
 		adcs	sum, sum, r4
 		adcs	sum, sum, r5
 		adcs	sum, sum, r6
 		adcs	sum, sum, r7
-		mov	r4, r8, pull #24
+		mov	r4, r8, lspull #24
 		sub	ip, ip, #16
 		teq	ip, #0
 		bne	1b
@@ -302,20 +302,20 @@ FN_ENTRY
 		tst	ip, #8
 		beq	3f
 		load2l	r5, r6
-		orr	r4, r4, r5, push #8
-		mov	r5, r5, pull #24
-		orr	r5, r5, r6, push #8
+		orr	r4, r4, r5, lspush #8
+		mov	r5, r5, lspull #24
+		orr	r5, r5, r6, lspush #8
 		stmia	dst!, {r4, r5}
 		adcs	sum, sum, r4
 		adcs	sum, sum, r5
-		mov	r4, r6, pull #24
+		mov	r4, r6, lspull #24
 		tst	ip, #4
 		beq	4f
 3:		load1l	r5
-		orr	r4, r4, r5, push #8
+		orr	r4, r4, r5, lspush #8
 		str	r4, [dst], #4
 		adcs	sum, sum, r4
-		mov	r4, r5, pull #24
+		mov	r4, r5, lspull #24
 4:		ands	len, len, #3
 		beq	.Ldone
 		mov	r5, r4, get_byte_0
@@ -326,7 +326,7 @@ FN_ENTRY
 		load1l	r4
 		mov	r5, r4, get_byte_0
 		strb	r5, [dst], #1
-		adcs	sum, sum, r4, push #24
+		adcs	sum, sum, r4, lspush #24
 		mov	r5, r4, get_byte_1
 		b	.Lexit
 FN_EXIT
diff --git a/arch/arm/lib/io-readsl.S b/arch/arm/lib/io-readsl.S
index 5fb97e7..7a74309 100644
--- a/arch/arm/lib/io-readsl.S
+++ b/arch/arm/lib/io-readsl.S
@@ -47,25 +47,25 @@ ENTRY(__raw_readsl)
 		strb	ip, [r1], #1
 
 4:		subs	r2, r2, #1
-		mov	ip, r3, pull #24
+		mov	ip, r3, lspull #24
 		ldrne	r3, [r0]
-		orrne	ip, ip, r3, push #8
+		orrne	ip, ip, r3, lspush #8
 		strne	ip, [r1], #4
 		bne	4b
 		b	8f
 
 5:		subs	r2, r2, #1
-		mov	ip, r3, pull #16
+		mov	ip, r3, lspull #16
 		ldrne	r3, [r0]
-		orrne	ip, ip, r3, push #16
+		orrne	ip, ip, r3, lspush #16
 		strne	ip, [r1], #4
 		bne	5b
 		b	7f
 
 6:		subs	r2, r2, #1
-		mov	ip, r3, pull #8
+		mov	ip, r3, lspull #8
 		ldrne	r3, [r0]
-		orrne	ip, ip, r3, push #24
+		orrne	ip, ip, r3, lspush #24
 		strne	ip, [r1], #4
 		bne	6b
 
diff --git a/arch/arm/lib/io-writesl.S b/arch/arm/lib/io-writesl.S
index 8d3b781..d0d104a 100644
--- a/arch/arm/lib/io-writesl.S
+++ b/arch/arm/lib/io-writesl.S
@@ -41,26 +41,26 @@ ENTRY(__raw_writesl)
 		blt	5f
 		bgt	6f
 
-4:		mov	ip, r3, pull #16
+4:		mov	ip, r3, lspull #16
 		ldr	r3, [r1], #4
 		subs	r2, r2, #1
-		orr	ip, ip, r3, push #16
+		orr	ip, ip, r3, lspush #16
 		str	ip, [r0]
 		bne	4b
 		mov	pc, lr
 
-5:		mov	ip, r3, pull #8
+5:		mov	ip, r3, lspull #8
 		ldr	r3, [r1], #4
 		subs	r2, r2, #1
-		orr	ip, ip, r3, push #24
+		orr	ip, ip, r3, lspush #24
 		str	ip, [r0]
 		bne	5b
 		mov	pc, lr
 
-6:		mov	ip, r3, pull #24
+6:		mov	ip, r3, lspull #24
 		ldr	r3, [r1], #4
 		subs	r2, r2, #1
-		orr	ip, ip, r3, push #8
+		orr	ip, ip, r3, lspush #8
 		str	ip, [r0]
 		bne	6b
 		mov	pc, lr
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index 938fc14..d1fc0c0 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -147,24 +147,24 @@ ENTRY(memmove)
 
 12:	PLD(	pld	[r1, #-128]		)
 13:		ldmdb   r1!, {r7, r8, r9, ip}
-		mov     lr, r3, push #\push
+		mov     lr, r3, lspush #\push
 		subs    r2, r2, #32
 		ldmdb   r1!, {r3, r4, r5, r6}
-		orr     lr, lr, ip, pull #\pull
-		mov     ip, ip, push #\push
-		orr     ip, ip, r9, pull #\pull
-		mov     r9, r9, push #\push
-		orr     r9, r9, r8, pull #\pull
-		mov     r8, r8, push #\push
-		orr     r8, r8, r7, pull #\pull
-		mov     r7, r7, push #\push
-		orr     r7, r7, r6, pull #\pull
-		mov     r6, r6, push #\push
-		orr     r6, r6, r5, pull #\pull
-		mov     r5, r5, push #\push
-		orr     r5, r5, r4, pull #\pull
-		mov     r4, r4, push #\push
-		orr     r4, r4, r3, pull #\pull
+		orr     lr, lr, ip, lspull #\pull
+		mov     ip, ip, lspush #\push
+		orr     ip, ip, r9, lspull #\pull
+		mov     r9, r9, lspush #\push
+		orr     r9, r9, r8, lspull #\pull
+		mov     r8, r8, lspush #\push
+		orr     r8, r8, r7, lspull #\pull
+		mov     r7, r7, lspush #\push
+		orr     r7, r7, r6, lspull #\pull
+		mov     r6, r6, lspush #\push
+		orr     r6, r6, r5, lspull #\pull
+		mov     r5, r5, lspush #\push
+		orr     r5, r5, r4, lspull #\pull
+		mov     r4, r4, lspush #\push
+		orr     r4, r4, r3, lspull #\pull
 		stmdb   r0!, {r4 - r9, ip, lr}
 		bge	12b
 	PLD(	cmn	r2, #96			)
@@ -175,10 +175,10 @@ ENTRY(memmove)
 14:		ands	ip, r2, #28
 		beq	16f
 
-15:		mov     lr, r3, push #\push
+15:		mov     lr, r3, lspush #\push
 		ldr	r3, [r1, #-4]!
 		subs	ip, ip, #4
-		orr	lr, lr, r3, pull #\pull
+		orr	lr, lr, r3, lspull #\pull
 		str	lr, [r0, #-4]!
 		bgt	15b
 	CALGN(	cmp	r2, #0			)
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S
index 5c908b1..e505209 100644
--- a/arch/arm/lib/uaccess.S
+++ b/arch/arm/lib/uaccess.S
@@ -117,9 +117,9 @@ USER(	TUSER(	strgtb) r3, [r0], #1)			@ May fault
 .Lc2u_1fupi:	subs	r2, r2, #4
 		addmi	ip, r2, #4
 		bmi	.Lc2u_1nowords
-		mov	r3, r7, pull #8
+		mov	r3, r7, lspull #8
 		ldr	r7, [r1], #4
-		orr	r3, r3, r7, push #24
+		orr	r3, r3, r7, lspush #24
 USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
 		mov	ip, r0, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
@@ -131,30 +131,30 @@ USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
 		subs	ip, ip, #16
 		blt	.Lc2u_1rem8lp
 
-.Lc2u_1cpy8lp:	mov	r3, r7, pull #8
+.Lc2u_1cpy8lp:	mov	r3, r7, lspull #8
 		ldmia	r1!, {r4 - r7}
 		subs	ip, ip, #16
-		orr	r3, r3, r4, push #24
-		mov	r4, r4, pull #8
-		orr	r4, r4, r5, push #24
-		mov	r5, r5, pull #8
-		orr	r5, r5, r6, push #24
-		mov	r6, r6, pull #8
-		orr	r6, r6, r7, push #24
+		orr	r3, r3, r4, lspush #24
+		mov	r4, r4, lspull #8
+		orr	r4, r4, r5, lspush #24
+		mov	r5, r5, lspull #8
+		orr	r5, r5, r6, lspush #24
+		mov	r6, r6, lspull #8
+		orr	r6, r6, r7, lspush #24
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
 		bpl	.Lc2u_1cpy8lp
 
 .Lc2u_1rem8lp:	tst	ip, #8
-		movne	r3, r7, pull #8
+		movne	r3, r7, lspull #8
 		ldmneia	r1!, {r4, r7}
-		orrne	r3, r3, r4, push #24
-		movne	r4, r4, pull #8
-		orrne	r4, r4, r7, push #24
+		orrne	r3, r3, r4, lspush #24
+		movne	r4, r4, lspull #8
+		orrne	r4, r4, r7, lspush #24
 		stmneia	r0!, {r3 - r4}			@ Shouldnt fault
 		tst	ip, #4
-		movne	r3, r7, pull #8
+		movne	r3, r7, lspull #8
 		ldrne	r7, [r1], #4
-		orrne	r3, r3, r7, push #24
+		orrne	r3, r3, r7, lspush #24
 	TUSER(	strne) r3, [r0], #4			@ Shouldnt fault
 		ands	ip, ip, #3
 		beq	.Lc2u_1fupi
@@ -172,9 +172,9 @@ USER(	TUSER(	strgtb) r3, [r0], #1)			@ May fault
 .Lc2u_2fupi:	subs	r2, r2, #4
 		addmi	ip, r2, #4
 		bmi	.Lc2u_2nowords
-		mov	r3, r7, pull #16
+		mov	r3, r7, lspull #16
 		ldr	r7, [r1], #4
-		orr	r3, r3, r7, push #16
+		orr	r3, r3, r7, lspush #16
 USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
 		mov	ip, r0, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
@@ -186,30 +186,30 @@ USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
 		subs	ip, ip, #16
 		blt	.Lc2u_2rem8lp
 
-.Lc2u_2cpy8lp:	mov	r3, r7, pull #16
+.Lc2u_2cpy8lp:	mov	r3, r7, lspull #16
 		ldmia	r1!, {r4 - r7}
 		subs	ip, ip, #16
-		orr	r3, r3, r4, push #16
-		mov	r4, r4, pull #16
-		orr	r4, r4, r5, push #16
-		mov	r5, r5, pull #16
-		orr	r5, r5, r6, push #16
-		mov	r6, r6, pull #16
-		orr	r6, r6, r7, push #16
+		orr	r3, r3, r4, lspush #16
+		mov	r4, r4, lspull #16
+		orr	r4, r4, r5, lspush #16
+		mov	r5, r5, lspull #16
+		orr	r5, r5, r6, lspush #16
+		mov	r6, r6, lspull #16
+		orr	r6, r6, r7, lspush #16
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
 		bpl	.Lc2u_2cpy8lp
 
 .Lc2u_2rem8lp:	tst	ip, #8
-		movne	r3, r7, pull #16
+		movne	r3, r7, lspull #16
 		ldmneia	r1!, {r4, r7}
-		orrne	r3, r3, r4, push #16
-		movne	r4, r4, pull #16
-		orrne	r4, r4, r7, push #16
+		orrne	r3, r3, r4, lspush #16
+		movne	r4, r4, lspull #16
+		orrne	r4, r4, r7, lspush #16
 		stmneia	r0!, {r3 - r4}			@ Shouldnt fault
 		tst	ip, #4
-		movne	r3, r7, pull #16
+		movne	r3, r7, lspull #16
 		ldrne	r7, [r1], #4
-		orrne	r3, r3, r7, push #16
+		orrne	r3, r3, r7, lspush #16
 	TUSER(	strne) r3, [r0], #4			@ Shouldnt fault
 		ands	ip, ip, #3
 		beq	.Lc2u_2fupi
@@ -227,9 +227,9 @@ USER(	TUSER(	strgtb) r3, [r0], #1)			@ May fault
 .Lc2u_3fupi:	subs	r2, r2, #4
 		addmi	ip, r2, #4
 		bmi	.Lc2u_3nowords
-		mov	r3, r7, pull #24
+		mov	r3, r7, lspull #24
 		ldr	r7, [r1], #4
-		orr	r3, r3, r7, push #8
+		orr	r3, r3, r7, lspush #8
 USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
 		mov	ip, r0, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
@@ -241,30 +241,30 @@ USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
 		subs	ip, ip, #16
 		blt	.Lc2u_3rem8lp
 
-.Lc2u_3cpy8lp:	mov	r3, r7, pull #24
+.Lc2u_3cpy8lp:	mov	r3, r7, lspull #24
 		ldmia	r1!, {r4 - r7}
 		subs	ip, ip, #16
-		orr	r3, r3, r4, push #8
-		mov	r4, r4, pull #24
-		orr	r4, r4, r5, push #8
-		mov	r5, r5, pull #24
-		orr	r5, r5, r6, push #8
-		mov	r6, r6, pull #24
-		orr	r6, r6, r7, push #8
+		orr	r3, r3, r4, lspush #8
+		mov	r4, r4, lspull #24
+		orr	r4, r4, r5, lspush #8
+		mov	r5, r5, lspull #24
+		orr	r5, r5, r6, lspush #8
+		mov	r6, r6, lspull #24
+		orr	r6, r6, r7, lspush #8
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
 		bpl	.Lc2u_3cpy8lp
 
 .Lc2u_3rem8lp:	tst	ip, #8
-		movne	r3, r7, pull #24
+		movne	r3, r7, lspull #24
 		ldmneia	r1!, {r4, r7}
-		orrne	r3, r3, r4, push #8
-		movne	r4, r4, pull #24
-		orrne	r4, r4, r7, push #8
+		orrne	r3, r3, r4, lspush #8
+		movne	r4, r4, lspull #24
+		orrne	r4, r4, r7, lspush #8
 		stmneia	r0!, {r3 - r4}			@ Shouldnt fault
 		tst	ip, #4
-		movne	r3, r7, pull #24
+		movne	r3, r7, lspull #24
 		ldrne	r7, [r1], #4
-		orrne	r3, r3, r7, push #8
+		orrne	r3, r3, r7, lspush #8
 	TUSER(	strne) r3, [r0], #4			@ Shouldnt fault
 		ands	ip, ip, #3
 		beq	.Lc2u_3fupi
@@ -382,9 +382,9 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
 .Lcfu_1fupi:	subs	r2, r2, #4
 		addmi	ip, r2, #4
 		bmi	.Lcfu_1nowords
-		mov	r3, r7, pull #8
+		mov	r3, r7, lspull #8
 USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
-		orr	r3, r3, r7, push #24
+		orr	r3, r3, r7, lspush #24
 		str	r3, [r0], #4
 		mov	ip, r1, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
@@ -396,30 +396,30 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
 		subs	ip, ip, #16
 		blt	.Lcfu_1rem8lp
 
-.Lcfu_1cpy8lp:	mov	r3, r7, pull #8
+.Lcfu_1cpy8lp:	mov	r3, r7, lspull #8
 		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
 		subs	ip, ip, #16
-		orr	r3, r3, r4, push #24
-		mov	r4, r4, pull #8
-		orr	r4, r4, r5, push #24
-		mov	r5, r5, pull #8
-		orr	r5, r5, r6, push #24
-		mov	r6, r6, pull #8
-		orr	r6, r6, r7, push #24
+		orr	r3, r3, r4, lspush #24
+		mov	r4, r4, lspull #8
+		orr	r4, r4, r5, lspush #24
+		mov	r5, r5, lspull #8
+		orr	r5, r5, r6, lspush #24
+		mov	r6, r6, lspull #8
+		orr	r6, r6, r7, lspush #24
 		stmia	r0!, {r3 - r6}
 		bpl	.Lcfu_1cpy8lp
 
 .Lcfu_1rem8lp:	tst	ip, #8
-		movne	r3, r7, pull #8
+		movne	r3, r7, lspull #8
 		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
-		orrne	r3, r3, r4, push #24
-		movne	r4, r4, pull #8
-		orrne	r4, r4, r7, push #24
+		orrne	r3, r3, r4, lspush #24
+		movne	r4, r4, lspull #8
+		orrne	r4, r4, r7, lspush #24
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
-		movne	r3, r7, pull #8
+		movne	r3, r7, lspull #8
 USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
-		orrne	r3, r3, r7, push #24
+		orrne	r3, r3, r7, lspush #24
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
 		beq	.Lcfu_1fupi
@@ -437,9 +437,9 @@ USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
 .Lcfu_2fupi:	subs	r2, r2, #4
 		addmi	ip, r2, #4
 		bmi	.Lcfu_2nowords
-		mov	r3, r7, pull #16
+		mov	r3, r7, lspull #16
 USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
-		orr	r3, r3, r7, push #16
+		orr	r3, r3, r7, lspush #16
 		str	r3, [r0], #4
 		mov	ip, r1, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
@@ -452,30 +452,30 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
 		blt	.Lcfu_2rem8lp
 
 
-.Lcfu_2cpy8lp:	mov	r3, r7, pull #16
+.Lcfu_2cpy8lp:	mov	r3, r7, lspull #16
 		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
 		subs	ip, ip, #16
-		orr	r3, r3, r4, push #16
-		mov	r4, r4, pull #16
-		orr	r4, r4, r5, push #16
-		mov	r5, r5, pull #16
-		orr	r5, r5, r6, push #16
-		mov	r6, r6, pull #16
-		orr	r6, r6, r7, push #16
+		orr	r3, r3, r4, lspush #16
+		mov	r4, r4, lspull #16
+		orr	r4, r4, r5, lspush #16
+		mov	r5, r5, lspull #16
+		orr	r5, r5, r6, lspush #16
+		mov	r6, r6, lspull #16
+		orr	r6, r6, r7, lspush #16
 		stmia	r0!, {r3 - r6}
 		bpl	.Lcfu_2cpy8lp
 
 .Lcfu_2rem8lp:	tst	ip, #8
-		movne	r3, r7, pull #16
+		movne	r3, r7, lspull #16
 		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
-		orrne	r3, r3, r4, push #16
-		movne	r4, r4, pull #16
-		orrne	r4, r4, r7, push #16
+		orrne	r3, r3, r4, lspush #16
+		movne	r4, r4, lspull #16
+		orrne	r4, r4, r7, lspush #16
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
-		movne	r3, r7, pull #16
+		movne	r3, r7, lspull #16
 USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
-		orrne	r3, r3, r7, push #16
+		orrne	r3, r3, r7, lspush #16
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
 		beq	.Lcfu_2fupi
@@ -493,9 +493,9 @@ USER(	TUSER(	ldrgtb) r3, [r1], #0)			@ May fault
 .Lcfu_3fupi:	subs	r2, r2, #4
 		addmi	ip, r2, #4
 		bmi	.Lcfu_3nowords
-		mov	r3, r7, pull #24
+		mov	r3, r7, lspull #24
 USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
-		orr	r3, r3, r7, push #8
+		orr	r3, r3, r7, lspush #8
 		str	r3, [r0], #4
 		mov	ip, r1, lsl #32 - PAGE_SHIFT
 		rsb	ip, ip, #0
@@ -507,30 +507,30 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
 		subs	ip, ip, #16
 		blt	.Lcfu_3rem8lp
 
-.Lcfu_3cpy8lp:	mov	r3, r7, pull #24
+.Lcfu_3cpy8lp:	mov	r3, r7, lspull #24
 		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
-		orr	r3, r3, r4, push #8
-		mov	r4, r4, pull #24
-		orr	r4, r4, r5, push #8
-		mov	r5, r5, pull #24
-		orr	r5, r5, r6, push #8
-		mov	r6, r6, pull #24
-		orr	r6, r6, r7, push #8
+		orr	r3, r3, r4, lspush #8
+		mov	r4, r4, lspull #24
+		orr	r4, r4, r5, lspush #8
+		mov	r5, r5, lspull #24
+		orr	r5, r5, r6, lspush #8
+		mov	r6, r6, lspull #24
+		orr	r6, r6, r7, lspush #8
 		stmia	r0!, {r3 - r6}
 		subs	ip, ip, #16
 		bpl	.Lcfu_3cpy8lp
 
 .Lcfu_3rem8lp:	tst	ip, #8
-		movne	r3, r7, pull #24
+		movne	r3, r7, lspull #24
 		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
-		orrne	r3, r3, r4, push #8
-		movne	r4, r4, pull #24
-		orrne	r4, r4, r7, push #8
+		orrne	r3, r3, r4, lspush #8
+		movne	r4, r4, lspull #24
+		orrne	r4, r4, r7, lspush #8
 		stmneia	r0!, {r3 - r4}
 		tst	ip, #4
-		movne	r3, r7, pull #24
+		movne	r3, r7, lspull #24
 USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
-		orrne	r3, r3, r7, push #8
+		orrne	r3, r3, r7, lspush #8
 		strne	r3, [r0], #4
 		ands	ip, ip, #3
 		beq	.Lcfu_3fupi
-- 
1.8.1.4

^ permalink raw reply related

* [linux-sunxi] Re: [PATCH 1/3] mfd: axp20x: Add mfd driver for axp20x PMIC
From: Carlo Caione @ 2014-02-10 20:25 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140210200232.GB3192@lukather>

On Mon, Feb 10, 2014 at 9:02 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
>> +static struct resource axp20x_pek_resources[] = {
>> +     {
>> +             .name   = "PEK_DBR",
>> +             .start  = AXP20X_IRQ_PEK_RIS_EDGE,
>> +             .end    = AXP20X_IRQ_PEK_RIS_EDGE,
>> +             .flags  = IORESOURCE_IRQ,
>> +     },
>> +     {
>> +             .name   = "PEK_DBF",
>> +             .start  = AXP20X_IRQ_PEK_FAL_EDGE,
>> +             .end    = AXP20X_IRQ_PEK_FAL_EDGE,
>> +             .flags  = IORESOURCE_IRQ,
>> +     },
>> +
>> +};
>
> From your documentation, it seems like you want to declare them in the
> DT too. Why do you need to declare the resources in both locations?

It's not really a need, I thought it was a bit "clearer" also to have
them in DT.
But I agree it is redundant. I'll fix in v2.

Thank you,

-- 
Carlo Caione

^ permalink raw reply

* [PATCH 0/2] clk: keystone: Couple of fixes for 3.14-rcx
From: Santosh Shilimkar @ 2014-02-10 20:26 UTC (permalink / raw)
  To: linux-arm-kernel

Mike,

Can you please look at these couple of keystone clock fixes ?
Without these, we have seen some random kernel crashes. I
have included the dts fix since both fixes are related. Do
let me know if you prefer dts patch to be sent it via arm-soc tree.

The following changes since commit 38dbfb59d1175ef458d006556061adeaa8751b72:

  Linus 3.14-rc1 (2014-02-02 16:42:13 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git for_3.14-rcx/clk-fixes

for you to fetch changes up to 565bbdcd3b91523b4142587c00206302e091a23e:

  ARM: keystone: dts: fix clkvcp3 control register address (2014-02-10 15:17:43 -0500)

----------------------------------------------------------------
Ivan Khoronzhuk (2):
      clk: keystone: gate: fix clk_init_data initialization
      ARM: keystone: dts: fix clkvcp3 control register address

 arch/arm/boot/dts/keystone-clocks.dtsi |    2 +-
 drivers/clk/keystone/gate.c            |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Regards,
Santosh

-- 
1.7.9.5

^ permalink raw reply

* [PATCH 1/2] clk: keystone: gate: fix clk_init_data initialization
From: Santosh Shilimkar @ 2014-02-10 20:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392064011-11986-1-git-send-email-santosh.shilimkar@ti.com>

From: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>

The clk_init_data struct is allocated in the stack. All members of
this struct should be initialized before using otherwise it will
lead to unpredictable situation as it can contain garbage.

Ultimately the clk->flag field contains garbage. In my case it leads
that flag CLK_IGNORE_UNUSED is set for most of clocks. As result a
bunch of unused clocks cannot be disabled.

So initialize flags in this structure too.

Cc: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 drivers/clk/keystone/gate.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
index 17a5983..86f1e36 100644
--- a/drivers/clk/keystone/gate.c
+++ b/drivers/clk/keystone/gate.c
@@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev,
 
 	init.name = name;
 	init.ops = &clk_psc_ops;
+	init.flags = 0;
 	init.parent_names = (parent_name ? &parent_name : NULL);
 	init.num_parents = (parent_name ? 1 : 0);
 
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 2/2] ARM: keystone: dts: fix clkvcp3 control register address
From: Santosh Shilimkar @ 2014-02-10 20:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392064011-11986-1-git-send-email-santosh.shilimkar@ti.com>

From: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>

The address for control regs in clkvcp3 node is not correct and should
be 0x023500a8 instead of 0x0235000a8.

This lead to few unexpected behaviors while clocks were turned
of in absence of clk_ignore_unused

Mike Turquette <mturquette@linaro.org>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 arch/arm/boot/dts/keystone-clocks.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index 2363593..ef58d1c 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -612,7 +612,7 @@ clocks {
 		compatible = "ti,keystone,psc-clock";
 		clocks = <&chipclk13>;
 		clock-output-names = "vcp-3";
-		reg = <0x0235000a8 0xb00>, <0x02350060 0x400>;
+		reg = <0x023500a8 0xb00>, <0x02350060 0x400>;
 		reg-names = "control", "domain";
 		domain-id = <24>;
 	};
-- 
1.7.9.5

^ permalink raw reply related

* [linux-sunxi] Re: [PATCH 3/3] mfd: axp20x: Add bindings documentation
From: Carlo Caione @ 2014-02-10 20:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140210201215.GC3192@lukather>

On Mon, Feb 10, 2014 at 9:12 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi Carlo,
>
> On Sat, Feb 08, 2014 at 05:03:48PM +0100, Carlo Caione wrote:
>> Bindings documentation for the axp20x driver. In this file also two
>> sub-nodes (PEK and regulators) are documented.
>>
>> Signed-off-by: Carlo Caione <carlo@caione.org>
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 87 ++++++++++++++++++++++++
>>  1 file changed, 87 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> new file mode 100644
>> index 0000000..ccea6b8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -0,0 +1,87 @@
>> +* axp20x device tree bindings
>> +
>> +The axp20x family current members :-
>> +axp202 (x-powers)
>> +axp209 (x-powers)
>> +
>> +Required properties:
>> +- compatible : Should be "x-powers,axp20x" (for axp202 and axp209)
>
> "Generic" compatibles are usually a bad thing, for several reasons,
> mostly because there's no way to actually differentiate the two
> without keeping adding DT properties (and hence, being unable to
> actually fix something or add a quirk for one single of these devices
> without having to modify the DT too.)
>
> Please use the "real" compatibles.

Ok

>> +- interrupt-controller : axp20x has its own internal IRQs
>> +- #interrupt-cells : should be set to 1
>> +- interrupt-parent : The parent interrupt controller
>
> Is this really required? It was not in your DTSI.

It wasn't in my DTSI since it was supposed to be used by DTS importing
this DTSI.
I'll fix it in v2.

>> +- interrupts : Specifies the list of interrupt lines which are handled by
>> +            the device in the parent controller's notation
>
> Hmmm, I'm not sure what you mean here.

It means that the notation used to indicate the interrupt for this
device has to follow the notation of the parent controller (i.e. in
terms of number of interrupt cells).
I'll rewrite the statement in v2.

>> +- reg : Specifies base physical address and size of the registers
>
> Base physical address? Isn't it a I2C device?

Right. cut&paste error.

>> +
>> +Sub-nodes
>> +* regulators : Contain the regulator nodes. The regulators are bound using
>> +            their name as listed here: dcdc2, dcdc3, ldo1, ldo2, ldo3,
>> +            ldo4, ldo5.
>> +            The bindings details of individual regulator device can be found in:
>> +            Documentation/devicetree/bindings/regulator/regulator.txt with the
>> +            exception of:
>
> I'm guessing this is where you differentiate between AXP202 and
> AXP209?

Not really. AXP202 and AXP209 have the same regulators (with the same
constrains)

>> +
>> +     - dcdc-freq : defines the work frequency of DC-DC where
>> +                   F=(1+dcdc-freq*5%)*1.5MHz
>
> I'd very much prefer this DCDC frequency to be in Hz, or a similar
> unit, and let the driver do the conversion.

Ok. Fix in v2.

>> +
>> +* axp20x-pek : Power Enable Key
>> +     - compatible : should be "x-powers,axp20x-pek"
>> +     - interrupts : two interrupt numbers with order defined by interrupt-names
>> +                    (one irq number for rising transition of the power key, the
>> +                    other one for falling transition)
>> +     - interrupt-names : should be "PEK_DBR" and "PEK_DBF"
>
> Is this actually needed since you declare the resources in your driver?

Not needed.

>> +
>> +Example:
>> +
>> +axp {
>> +     compatible = "x-powers,axp20x";
>> +     interrupt-controller;
>> +     #interrupt-cells = <1>;
>
> No reg property ?

Also the reg property was supposed to be used in the DTS. I'll fix it.

>> +
>> +     axp20x-pek {
>> +             compatible = "x-powers,axp20x-pek";
>> +             interrupts = <33>,  <34>;
>> +             interrupt-names = "PEK_DBR", "PEK_DBF";
>> +     };
>> +
>> +     regulators {
>> +             dcdc-freq = "8";
>> +
>> +             axp_dcdc2: dcdc2 {
>> +                     regulator-min-microvolt = <700000>;
>> +                     regulator-max-microvolt = <2275000>;
>> +                     dcdc-workmode = <0>;
>
> And what is this dcdc-workmode property about?

Oh. I missed that, sorry.

>> +             };
>> +
>> +             axp_dcdc3: dcdc3 {
>> +                     regulator-min-microvolt = <700000>;
>> +                     regulator-max-microvolt = <3500000>;
>> +                     dcdc-workmode = <0>;
>> +             };
>> +
>> +             axp_ldo1: ldo1 {
>> +                     regulator-min-microvolt = <1300000>;
>> +                     regulator-max-microvolt = <1300000>;
>> +             };
>> +
>> +             axp_ldo2: ldo2 {
>> +                     regulator-min-microvolt = <1800000>;
>> +                     regulator-max-microvolt = <3300000>;
>> +             };
>> +
>> +             axp_ldo3: ldo3 {
>> +                     regulator-min-microvolt = <700000>;
>> +                     regulator-max-microvolt = <3500000>;
>> +             };
>> +
>> +             axp_ldo4: ldo4 {
>> +                     regulator-min-microvolt = <1250000>;
>> +                     regulator-max-microvolt = <3300000>;
>> +             };
>> +
>> +             axp_ldo5: ldo5 {
>> +                     regulator-min-microvolt = <1800000>;
>> +                     regulator-max-microvolt = <3300000>;
>> +             };
>> +     };
>> +};
>> --
>> 1.8.5.3
>>
>
> Thanks for working on this!

Thank you,

-- 
Carlo Caione

^ permalink raw reply

* [PATCH v2] ARM: sunxi: Add driver for sunxi usb phy
From: Maxime Ripard @ 2014-02-10 20:43 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <52F56BEE.8070703@redhat.com>

Hi,

On Sat, Feb 08, 2014 at 12:27:42AM +0100, Hans de Goede wrote:
> Hi,
> 
> On 02/07/2014 11:36 PM, Maxime Ripard wrote:
> >Hi Hans,
> >
> >It looks very nice, I just have a few comments below though.
> >
> >On Fri, Feb 07, 2014 at 05:33:21PM +0100, Hans de Goede wrote:
> >>The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed
> >>through a single set of registers. Besides this there are also some other
> >>phy related bits which need poking, which are per phy, but shared between the
> >>ohci and ehci controllers, so these are also controlled from this new phy
> >>driver.
> >>
> >>Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >>---
> >>  .../devicetree/bindings/phy/sun4i-usb-phy.txt      |  28 ++
> >>  drivers/phy/Kconfig                                |  11 +
> >>  drivers/phy/Makefile                               |   1 +
> >>  drivers/phy/phy-sun4i-usb.c                        | 326 +++++++++++++++++++++
> >>  4 files changed, 366 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> >>  create mode 100644 drivers/phy/phy-sun4i-usb.c
> >>
> >>diff --git a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> >>new file mode 100644
> >>index 0000000..f7eccb2
> >>--- /dev/null
> >>+++ b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
> >>@@ -0,0 +1,28 @@
> >>+Allwinner sun4i USB PHY
> >>+-----------------------
> >>+
> >>+Required properties:
> >>+- compatible : should be one of "allwinner,sun4i-a10-usb-phy",
> >>+  "allwinner,sun5i-a13-usb-phy" or "allwinner,sun7i-a20-usb-phy"
> >>+- reg : a list of offset + length pairs, the 1st list entry should point to
> >>+  the phy base regs, the 2nd entry to the pmu reg for phy1, and the 3th
> >>+  entry to the pmu reg of phy2 (for devices which have a phy2).
> >
> >I'm concerned about devices that would only have a phy2 for some
> >reason.
> 
> phy1 and phy2 are identical, so in that case we would just call the phy
> phy1 I guess, and specify its register where ever it lives and be done with
> it.
> 
> >Using reg-names would be much more robust, and is quite painless to
> >use. Just use platform_get_resource_by_name instead of
> >platform_get_resource, and that's pretty much it.
> 
> The above argument does not really help to convince me to use
> register-names, I don't really see them as useful / necessary,
> adding support for them will just grow the driver-code, as well
> as the devicetree bindings docs, as well as the dts files.
> 
> But if you really really want me to use register-names, just say so
> and I'll modify the patch.

Yep, overall, whenever there's several resources involved, I very much
prefer to differentiate them by name, rather than by index, which is
much more fragile.

And the overhead is of one single line in the DT, one single line in
the doc, and a few of them in the driver. It doesn't look like it
bloats the code that much...

> 
> 
> >
> >>+- #phy-cells : from the generic phy bindings, must be 1
> >>+
> >>+Optional properties:
> >>+- clocks : phandle + clock specifier for the phy clock
> >>+- clock-names : "usb_phy"
> >>+- resets : a list of phandle + reset specifier pairs
> >>+- reset-names : "usb0_reset", "usb1_reset", and / or "usb2_reset"
> >>+
> >>+Example:
> >>+	usbphy: phy at 0x01c13400 {
> >>+		#phy-cells = <1>;
> >>+		compatible = "allwinner,sun4i-a10-usb-phy";
> >>+		/* phy base regs, phy1 pmu reg, phy2 pmu reg */
> >>+		reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>;
> >>+		clocks = <&usb_clk 8>;
> >>+		clock-names = "usb_phy";
> >>+		resets = <&usb_clk 1>, <&usb_clk 2>;
> >>+		reset-names = "usb1_reset", "usb2_reset";
> >>+	};
> >>diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> >>index afa2354..6070c99 100644
> >>--- a/drivers/phy/Kconfig
> >>+++ b/drivers/phy/Kconfig
> >>@@ -64,4 +64,15 @@ config BCM_KONA_USB2_PHY
> >>  	help
> >>  	  Enable this to support the Broadcom Kona USB 2.0 PHY.
> >>
> >>+config PHY_SUN4I_USB
> >>+	tristate "Allwinner sunxi SoC USB PHY driver"
> >>+	depends on ARCH_SUNXI
> >>+	select GENERIC_PHY
> >>+	help
> >>+	  Enable this to support the transceiver that is part of Allwinner
> >>+	  sunxi SoCs.
> >>+
> >>+	  This driver controls the entire USB PHY block, both the USB OTG
> >>+	  parts, as well as the 2 regular USB 2 host PHYs.
> >>+
> >>  endmenu
> >>diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> >>index b57c253..9d4f8bb 100644
> >>--- a/drivers/phy/Makefile
> >>+++ b/drivers/phy/Makefile
> >>@@ -9,3 +9,4 @@ obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)	+= phy-exynos-mipi-video.o
> >>  obj-$(CONFIG_PHY_MVEBU_SATA)		+= phy-mvebu-sata.o
> >>  obj-$(CONFIG_OMAP_USB2)			+= phy-omap-usb2.o
> >>  obj-$(CONFIG_TWL4030_USB)		+= phy-twl4030-usb.o
> >>+obj-$(CONFIG_PHY_SUN4I_USB)		+= phy-sun4i-usb.o
> >>diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
> >>new file mode 100644
> >>index 0000000..bd9cb7fa
> >>--- /dev/null
> >>+++ b/drivers/phy/phy-sun4i-usb.c
> >>@@ -0,0 +1,326 @@
> >>+/*
> >>+ * Allwinner sun4i USB phy driver
> >>+ *
> >>+ * Copyright (C) 2014 Hans de Goede <hdegoede@redhat.com>
> >>+ *
> >>+ * Based on code from
> >>+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
> >>+ *
> >>+ * Modelled after: Samsung S5P/EXYNOS SoC series MIPI CSIS/DSIM DPHY driver
> >>+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
> >>+ * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
> >>+ *
> >>+ * This program is free software; you can redistribute it and/or modify
> >>+ * it under the terms of the GNU General Public License as published by
> >>+ * the Free Software Foundation; either version 2 of the License, or
> >>+ * (at your option) any later version.
> >>+ *
> >>+ * This program is distributed in the hope that it will be useful,
> >>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >>+ * GNU General Public License for more details.
> >>+ */
> >>+
> >>+#include <linux/clk.h>
> >>+#include <linux/io.h>
> >>+#include <linux/kernel.h>
> >>+#include <linux/module.h>
> >>+#include <linux/mutex.h>
> >>+#include <linux/of.h>
> >>+#include <linux/of_address.h>
> >>+#include <linux/phy/phy.h>
> >>+#include <linux/platform_device.h>
> >>+#include <linux/regulator/consumer.h>
> >>+#include <linux/reset.h>
> >>+
> >>+#define REG_ISCR			0x00
> >>+#define REG_PHYCTL			0x04
> >>+#define REG_PHYBIST			0x08
> >>+#define REG_PHYTUNE			0x0c
> >>+
> >>+#define SUNXI_AHB_ICHR8_EN		BIT(10)
> >>+#define SUNXI_AHB_INCR4_BURST_EN	BIT(9)
> >>+#define SUNXI_AHB_INCRX_ALIGN_EN	BIT(8)
> >>+#define SUNXI_ULPI_BYPASS_EN		BIT(0)
> >>+
> >>+/* Common Control Bits for Both PHYs */
> >>+#define PHY_PLL_BW			0x03
> >>+#define PHY_RES45_CAL_EN		0x0c
> >>+
> >>+/* Private Control Bits for Each PHY */
> >>+#define PHY_TX_AMPLITUDE_TUNE		0x20
> >>+#define PHY_TX_SLEWRATE_TUNE		0x22
> >>+#define PHY_VBUSVALID_TH_SEL		0x25
> >>+#define PHY_PULLUP_RES_SEL		0x27
> >>+#define PHY_OTG_FUNC_EN			0x28
> >>+#define PHY_VBUS_DET_EN			0x29
> >>+#define PHY_DISCON_TH_SEL		0x2a
> >>+
> >>+#define MAX_PHYS			3
> >>+
> >>+struct sun4i_usb_phy_data {
> >>+	struct clk *clk;
> >>+	void __iomem *base;
> >>+	struct mutex mutex;
> >>+	int num_phys;
> >>+	u32 disc_thresh;
> >>+	struct sun4i_usb_phy {
> >>+		struct phy *phy;
> >>+		void __iomem *pmu;
> >>+		struct regulator *vbus;
> >>+		struct reset_control *reset;
> >>+		int index;
> >>+	} phys[MAX_PHYS];
> >>+};
> >>+
> >>+#define to_sun4i_usb_phy_data(phy) \
> >>+	container_of((phy), struct sun4i_usb_phy_data, phys[(phy)->index])
> >>+
> >>+static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data,
> >>+				int len)
> >>+{
> >>+	struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy);
> >>+	u32 temp, usbc_bit = BIT(phy->index * 2);
> >>+	int i;
> >>+
> >>+	mutex_lock(&phy_data->mutex);
> >>+
> >>+	for (i = 0; i < len; i++) {
> >>+		temp = readl(phy_data->base + REG_PHYCTL);
> >>+
> >>+		/* clear the address portion */
> >>+		temp &= ~(0xff << 8);
> >>+
> >>+		/* set the address */
> >>+		temp |= ((addr + i) << 8);
> >>+		writel(temp, phy_data->base + REG_PHYCTL);
> >>+
> >>+		/* set the data bit and clear usbc bit*/
> >>+		temp = readb(phy_data->base + REG_PHYCTL);
> >>+		if (data & 0x1)
> >>+			temp |= BIT(7);
> >>+		else
> >>+			temp &= ~BIT(7);
> >>+		temp &= ~usbc_bit;
> >>+		writeb(temp, phy_data->base + REG_PHYCTL);
> >>+
> >>+		/* pulse usbc_bit */
> >>+		temp = readb(phy_data->base + REG_PHYCTL);
> >>+		temp |= usbc_bit;
> >>+		writeb(temp, phy_data->base + REG_PHYCTL);
> >>+
> >>+		temp = readb(phy_data->base + REG_PHYCTL);
> >>+		temp &= ~usbc_bit;
> >>+		writeb(temp, phy_data->base + REG_PHYCTL);
> >>+
> >>+		data >>= 1;
> >>+	}
> >>+	mutex_unlock(&phy_data->mutex);
> >>+}
> >>+
> >>+static void sun4i_usb_phy_passby(struct sun4i_usb_phy *phy, int enable)
> >>+{
> >>+	u32 bits, reg_value;
> >>+
> >>+	if (!phy->pmu)
> >>+		return;
> >>+
> >>+	bits = SUNXI_AHB_ICHR8_EN | SUNXI_AHB_INCR4_BURST_EN |
> >>+		SUNXI_AHB_INCRX_ALIGN_EN | SUNXI_ULPI_BYPASS_EN;
> >>+
> >>+	reg_value = readl(phy->pmu);
> >>+
> >>+	if (enable)
> >>+		reg_value |= bits;
> >>+	else
> >>+		reg_value &= ~bits;
> >>+
> >>+	writel(reg_value, phy->pmu);
> >>+}
> >>+
> >>+static int sun4i_usb_phy_init(struct phy *_phy)
> >>+{
> >>+	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
> >>+	struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
> >>+	int ret;
> >>+
> >>+	ret = clk_prepare_enable(data->clk);
> >>+	if (ret)
> >>+		return ret;
> >>+
> >>+	ret = reset_control_deassert(phy->reset);
> >>+	if (ret) {
> >>+		clk_disable_unprepare(data->clk);
> >>+		return ret;
> >>+	}
> >>+
> >>+	/* Adjust PHY's magnitude and rate */
> >>+	sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE, 0x14, 5);
> >>+
> >>+	/* Disconnect threshold adjustment */
> >>+	sun4i_usb_phy_write(phy, PHY_DISCON_TH_SEL, data->disc_thresh, 2);
> >>+
> >>+	sun4i_usb_phy_passby(phy, 1);
> >>+
> >>+	return 0;
> >>+}
> >>+
> >>+static int sun4i_usb_phy_exit(struct phy *_phy)
> >>+{
> >>+	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
> >>+	struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
> >>+
> >>+	sun4i_usb_phy_passby(phy, 0);
> >>+	reset_control_assert(phy->reset);
> >>+	clk_disable_unprepare(data->clk);
> >>+
> >>+	return 0;
> >>+}
> >>+
> >>+static int sun4i_usb_phy_power_on(struct phy *_phy)
> >>+{
> >>+	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
> >>+	int ret = 0;
> >>+
> >>+	if (phy->vbus)
> >>+		ret = regulator_enable(phy->vbus);
> >>+
> >>+	return ret;
> >>+}
> >>+
> >>+static int sun4i_usb_phy_power_off(struct phy *_phy)
> >>+{
> >>+	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
> >>+
> >>+	if (phy->vbus)
> >>+		regulator_disable(phy->vbus);
> >>+
> >>+	return 0;
> >>+}
> >>+
> >>+static struct phy_ops sun4i_usb_phy_ops = {
> >>+	.init		= sun4i_usb_phy_init,
> >>+	.exit		= sun4i_usb_phy_exit,
> >>+	.power_on	= sun4i_usb_phy_power_on,
> >>+	.power_off	= sun4i_usb_phy_power_off,
> >>+	.owner		= THIS_MODULE,
> >>+};
> >>+
> >>+static struct phy *sun4i_usb_phy_xlate(struct device *dev,
> >>+					struct of_phandle_args *args)
> >>+{
> >>+	struct sun4i_usb_phy_data *data = dev_get_drvdata(dev);
> >>+
> >>+	if (WARN_ON(args->args[0] == 0 || args->args[0] >= data->num_phys))
> >>+		return ERR_PTR(-ENODEV);
> >>+
> >>+	return data->phys[args->args[0]].phy;
> >>+}
> >>+
> >>+static int sun4i_usb_phy_probe(struct platform_device *pdev)
> >>+{
> >>+	struct sun4i_usb_phy_data *data;
> >>+	struct device *dev = &pdev->dev;
> >>+	struct device_node *np = dev->of_node;
> >>+	void __iomem *pmu = NULL;
> >>+	struct phy_provider *phy_provider;
> >>+	struct reset_control *reset;
> >>+	struct regulator *vbus;
> >>+	struct phy *phy;
> >>+	char name[16];
> >>+	int i;
> >>+
> >>+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> >>+	if (!data)
> >>+		return -ENOMEM;
> >>+
> >>+	mutex_init(&data->mutex);
> >>+
> >>+	if (of_device_is_compatible(np, "allwinner,sun5i-a13-usb-phy"))
> >>+		data->num_phys = 2;
> >>+	else
> >>+		data->num_phys = 3;
> >>+
> >>+	if (of_device_is_compatible(np, "allwinner,sun4i-a10-usb-phy"))
> >>+		data->disc_thresh = 3;
> >>+	else
> >>+		data->disc_thresh = 2;
> >
> >I'd still prefer to pass this through the .data field of of_device_id,
> >but it looks much cleaner already :)
> 
> The problem with using the .data field is that I can only store a single
> integer there. To store 2 I need to: define a struct, create an array
> of these structs with initialization. Create an enum for indexing the
> array which must be kept in sync with the initializers manually, store
> either the index, or a direct pointer to the correct array entry into
> the .data field, add code to get the of_device_id from the compatible
> string, and then finally extract the settings from the struct again.
> 
> See IE how this is done in drivers/ata/ahci_platform.c, I've tried
> to come up with a simpler way and failed, for ahci_platform.c the
> struct with per compatible-string data is quite big so it makes some
> sense to use this construction. Here however not so much, this adds a
> whole lot of unnecessary extra code + indirection. I esp. object against
> the indirection as that unnecessarily makes it harder to follow whats
> going on.

Ok, thanks!
Maxime

-- 
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: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140210/03b2d275/attachment.sig>

^ permalink raw reply

* [RFC PATCH 2/3] staging: imx-drm-core: Use graph to find connection between crtc and encoder
From: Philipp Zabel @ 2014-02-10 20:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140210162631.GC26684@n2100.arm.linux.org.uk>

On Mon, Feb 10, 2014 at 04:26:31PM +0000, Russell King - ARM Linux wrote:
[...]
> Why is this loop soo complicated?  Why do you need to mess around with
> this "last_ep" stuff - you don't actually end up using it.

The last_ep dance is necessary because v4l2_of_get_next_endpoint(node,prev)
does not decrement the reference count of its prev argument.
To make the loop as simple as you propose, I'd either have to change
the get_next_endpoint library function or wrap it to release the prev
node:

static struct device_node *imx_drm_of_get_next_endpoint(
		struct device_node *node, struct device_node *prev)
{
	node = v4l2_of_get_next_endpoint(node, prev);
	of_node_put(prev);
	return node;
}
 
> The loop reduces down to this without comments:
> 
>  	for (i = 0; !ret; i++) {
>  		uint32_t mask;
> 
> 		ep = v4l2_of_get_next_endpoint(np, last_ep);
> 		if (!ep)
> 			break;
> 
> 		/* CSI */
> 		mask = imx_drm_find_crtc_mask(imxdrm, ep);
> 		of_node_put(ep);
> 
> 		if (mask == 0)
> 			return -EPROBE_DEFER;
> 
> 		crtc_mask |= mask;
> 	}

Yes, that is easier to read.

> Now, here's the big question: why do we want to use v4l2_* here?  We
> may want to use this functionality, but if this functionality is going
> to be used outside of v4l2, it needs to become something generic, not
> v4l2 specific.
> 
> Let's think about this for a moment... if we want to build imx-drm into
> the kernel, can we do it with modular videodev, or with videodev
> completely unconfigured.  We may wish to do this because we have no
> videodev requirement on a platform.  Should the build fail because the
> v4l2 function isn't there?
> 
> So, before we can change this, I think we first need to get agreement
> from Mauro to move this function out of V4L2, so that it can be
> available independently of V4L2.

Either that, or we add a temporary copy of the v4l2_of_get_next_endpoint
and v4l2_of_get_remote_port functions while doing the same.

regards
Philipp

^ permalink raw reply

* [PATCH 1/3] mfd: axp20x: Add mfd driver for axp20x PMIC
From: Lee Jones @ 2014-02-10 21:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1391875428-6281-2-git-send-email-carlo@caione.org>

> This patch introduces the preliminary support for PMICs X-Powers AXP202
> and AXP209. The core contains support only for two sub-modules (PEK
> and regulators) that will be added with two different patch-sets.
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
>  drivers/mfd/Kconfig        |  12 +++
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x.c       | 251 +++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 178 ++++++++++++++++++++++++++++++++
>  4 files changed, 442 insertions(+)
>  create mode 100644 drivers/mfd/axp20x.c
>  create mode 100644 include/linux/mfd/axp20x.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index dd67158..33d38c4 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -59,6 +59,18 @@ config MFD_AAT2870_CORE
>  	  additional drivers must be enabled in order to use the
>  	  functionality of the device.

<snip>

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> new file mode 100644
> index 0000000..efd0cb3
> --- /dev/null
> +++ b/drivers/mfd/axp20x.c
> @@ -0,0 +1,251 @@
> +/*

A nice descriptive title here would be good.

> + * Author: Carlo Caione <carlo@caione.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/mfd/axp20x.h>
> +#include <linux/mfd/core.h>
> +#include <linux/of_device.h>
> +#include <linux/of_irq.h>
> +
> +static const struct regmap_range axp20x_writeable_ranges[] = {
> +	{
> +		.range_min = AXP20X_DATA(0),
> +		.range_max = AXP20X_IRQ5_STATE,
> +	}, {
> +		.range_min = AXP20X_DCDC_MODE,
> +		.range_max = AXP20X_FG_RES,
> +	},
> +};
> +
> +static const struct regmap_range axp20x_volatile_ranges[] = {
> +	{
> +		.range_min = AXP20X_IRQ1_EN,
> +		.range_max = AXP20X_IRQ5_STATE,
> +	},
> +};
> +
> +static const struct regmap_access_table axp20x_writeable_table = {
> +	.yes_ranges	= axp20x_writeable_ranges,
> +	.n_yes_ranges	= ARRAY_SIZE(axp20x_writeable_ranges),
> +};
> +
> +static const struct regmap_access_table axp20x_volatile_table = {
> +	.yes_ranges	= axp20x_volatile_ranges,
> +	.n_yes_ranges	= ARRAY_SIZE(axp20x_volatile_ranges),
> +};
> +
> +static struct resource axp20x_pek_resources[] = {
> +	{
> +		.name	= "PEK_DBR",
> +		.start	= AXP20X_IRQ_PEK_RIS_EDGE,
> +		.end	= AXP20X_IRQ_PEK_RIS_EDGE,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +	{
> +		.name	= "PEK_DBF",
> +		.start	= AXP20X_IRQ_PEK_FAL_EDGE,
> +		.end	= AXP20X_IRQ_PEK_FAL_EDGE,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +

Superfluous new line.

> +};
> +
> +static const struct regmap_config axp20x_regmap_config = {
> +	.reg_bits	= 8,
> +	.val_bits	= 8,
> +	.wr_table	= &axp20x_writeable_table,
> +	.volatile_table	= &axp20x_volatile_table,
> +	.max_register	= AXP20X_FG_RES,
> +	.cache_type	= REGCACHE_RBTREE,
> +};
> +
> +#define AXP20X_IRQ(_irq, _off, _mask) \
> +	[AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
> +
> +static const struct regmap_irq axp20x_regmap_irqs[] = {
> +	AXP20X_IRQ(ACIN_OVER_V,		0, 7),
> +	AXP20X_IRQ(ACIN_PLUGIN,		0, 6),
> +	AXP20X_IRQ(ACIN_REMOVAL,	0, 5),
> +	AXP20X_IRQ(VBUS_OVER_V,		0, 4),
> +	AXP20X_IRQ(VBUS_PLUGIN,		0, 3),
> +	AXP20X_IRQ(VBUS_REMOVAL,	0, 2),
> +	AXP20X_IRQ(VBUS_V_LOW,		0, 1),
> +	AXP20X_IRQ(BATT_PLUGIN,		1, 7),
> +	AXP20X_IRQ(BATT_REMOVAL,	1, 6),
> +	AXP20X_IRQ(BATT_ENT_ACT_MODE,	1, 5),
> +	AXP20X_IRQ(BATT_EXIT_ACT_MODE,	1, 4),
> +	AXP20X_IRQ(CHARG,		1, 3),
> +	AXP20X_IRQ(CHARG_DONE,		1, 2),
> +	AXP20X_IRQ(BATT_TEMP_HIGH,	1, 1),
> +	AXP20X_IRQ(BATT_TEMP_LOW,	1, 0),
> +	AXP20X_IRQ(DIE_TEMP_HIGH,	2, 7),
> +	AXP20X_IRQ(CHARG_I_LOW,		2, 6),
> +	AXP20X_IRQ(DCDC1_V_LONG,	2, 5),
> +	AXP20X_IRQ(DCDC2_V_LONG,	2, 4),
> +	AXP20X_IRQ(DCDC3_V_LONG,	2, 3),
> +	AXP20X_IRQ(PEK_SHORT,		2, 1),
> +	AXP20X_IRQ(PEK_LONG,		2, 0),
> +	AXP20X_IRQ(N_OE_PWR_ON,		3, 7),
> +	AXP20X_IRQ(N_OE_PWR_OFF,	3, 6),
> +	AXP20X_IRQ(VBUS_VALID,		3, 5),
> +	AXP20X_IRQ(VBUS_NOT_VALID,	3, 4),
> +	AXP20X_IRQ(VBUS_SESS_VALID,	3, 3),
> +	AXP20X_IRQ(VBUS_SESS_END,	3, 2),
> +	AXP20X_IRQ(LOW_PWR_LVL1,	3, 1),
> +	AXP20X_IRQ(LOW_PWR_LVL2,	3, 0),
> +	AXP20X_IRQ(TIMER,		4, 7),
> +	AXP20X_IRQ(PEK_RIS_EDGE,	4, 6),
> +	AXP20X_IRQ(PEK_FAL_EDGE,	4, 5),
> +	AXP20X_IRQ(GPIO3_INPUT,		4, 3),
> +	AXP20X_IRQ(GPIO2_INPUT,		4, 2),
> +	AXP20X_IRQ(GPIO1_INPUT,		4, 1),
> +	AXP20X_IRQ(GPIO0_INPUT,		4, 0),
> +};

Where are these handled i.e. where is the irq_handler located?

> +static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
> +	.name			= "axp20x_irq_chip",
> +	.status_base		= AXP20X_IRQ1_STATE,
> +	.ack_base		= AXP20X_IRQ1_STATE,
> +	.mask_base		= AXP20X_IRQ1_EN,
> +	.num_regs		= 5,
> +	.irqs			= axp20x_regmap_irqs,
> +	.num_irqs		= ARRAY_SIZE(axp20x_regmap_irqs),
> +	.mask_invert		= 1,

This is a bool; true or false please.

> +	.init_ack_masked	= 1,

Same here.

> +};
> +
> +static struct mfd_cell axp20x_cells[] = {
> +	{
> +		.name		= "axp20x-pek",
> +		.of_compatible	= "x-powers,axp20x-pek",
> +		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
> +		.resources	= axp20x_pek_resources,

I already saw the comments about these.

> +	}, {
> +		.name		= "axp20x-regulator",
> +	},
> +};
> +
> +const struct of_device_id axp20x_of_match[] = {
> +	{ .compatible = "x-powers,axp20x", .data = (void *)AXP20X },

There's no need to add device IDs if you only support one device.

> +	{ },
> +};
> +
> +static struct axp20x_dev *axp20x_pm_power_off;

This looks pretty unconventional. What's the point of it?

> +static void axp20x_power_off(void)
> +{
> +	regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, 0x80);

What does the 0x80 do exactly? Think about #defining.

> +}
> +
> +static int axp20x_i2c_probe(struct i2c_client *i2c,
> +			 const struct i2c_device_id *id)
> +{
> +	struct axp20x_dev *axp20x;
> +	const struct of_device_id *of_id;
> +	int ret;
> +
> +	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
> +	if (!axp20x)
> +		return -ENOMEM;
> +
> +	of_id = of_match_device(axp20x_of_match, &i2c->dev);
> +	if (!of_id) {
> +		dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
> +		return -ENODEV;
> +	}
> +	axp20x->variant = (int) of_id->data;

Lots of code here surrounding added device support, but only one
device is supported. Why so?

> +	axp20x->i2c_client = i2c;
> +	i2c_set_clientdata(i2c, axp20x);
> +
> +	axp20x->dev = &i2c->dev;
> +	dev_set_drvdata(axp20x->dev, axp20x);

Do you make use of all this saving of the device container?

If so, where?

Also:
  i2c_set_clientdata(i2c) 

and:
  dev_set_drvdata(i2c->dev);

... do exactly the same thing i.e. set i2c->dev->p->device_data.

> +	axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
> +	if (IS_ERR(axp20x->regmap)) {
> +		ret = PTR_ERR(axp20x->regmap);
> +		dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	axp20x->irq = i2c->irq;
> +	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
> +				  IRQF_ONESHOT | IRQF_SHARED, -1,
> +				  &axp20x_regmap_irq_chip,
> +				  &axp20x->regmap_irqc);
> +	if (ret != 0) {

It's more succinct to say:
  if (!ret)

> +		dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
> +			      ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
> +	if (ret != 0) {
> +		dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
> +		goto mfd_err;
> +	}
> +
> +	if (!pm_power_off) {
> +		axp20x_pm_power_off = axp20x;
> +		pm_power_off = axp20x_power_off;
> +	}

Can you describe to me what you're using the pm_power_off call-back
for please?

> +	dev_info(&i2c->dev, "AXP20X driver loaded\n");
> +
> +	return 0;
> +
> +mfd_err:
> +	regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
> +
> +	return ret;
> +}
> +
> +static int axp20x_i2c_remove(struct i2c_client *i2c)
> +{
> +	struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
> +
> +	if (axp20x == axp20x_pm_power_off) {
> +		axp20x_pm_power_off = NULL;
> +		pm_power_off = NULL;
> +	}
> +
> +	mfd_remove_devices(axp20x->dev);
> +	regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc);
> +
> +	return 0;
> +}
> +
> +static const struct i2c_device_id axp20x_i2c_id[] = {
> +	{ "axp20x", AXP20X },

It doesn't look like you're using this ID either?

> +	{ }
> +};
> +MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
> +
> +static struct i2c_driver axp20x_i2c_driver = {
> +	.driver = {
> +		.name	= "axp20x",
> +		.owner	= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(axp20x_of_match),
> +	},
> +	.probe		= axp20x_i2c_probe,
> +	.remove		= axp20x_i2c_remove,
> +	.id_table	= axp20x_i2c_id,
> +};
> +
> +module_i2c_driver(axp20x_i2c_driver);
> +
> +MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
> +MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
> +MODULE_LICENSE("GPL");
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> new file mode 100644
> index 0000000..94d99fd
> --- /dev/null
> +++ b/include/linux/mfd/axp20x.h
> @@ -0,0 +1,178 @@
> +/*
> + * Functions to access AXP20X power management chip.
> + *
> + * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef __LINUX_MFD_AXP20X_H
> +#define __LINUX_MFD_AXP20X_H
> +
> +#define AXP20X				0
> +
> +#define AXP20X_DATA(m)			(0x04 + (m))

This is not a great name for a macro.  'data' and 'value' seldom make
for good names for variables/macros.  Please replace it with something
more descriptive.

In fact, on closer inspection it appears as though you only use this
once while defining writable registers.  What happened to registers
0x00 to 0x03, and why have the top registers below been omitted from
the range(s)?

> +
> +/* Power supply */
> +#define AXP20X_PWR_INPUT_STATUS		0x00
> +#define AXP20X_PWR_OP_MODE		0x01
> +#define AXP20X_USB_OTG_STATUS		0x02
> +#define AXP20X_PWR_OUT_CTRL		0x12
> +#define AXP20X_DCDC2_V_OUT		0x23
> +#define AXP20X_DCDC2_LDO3_V_SCAL	0x25
> +#define AXP20X_DCDC3_V_OUT		0x27
> +#define AXP20X_LDO24_V_OUT		0x28
> +#define AXP20X_LDO3_V_OUT		0x29
> +#define AXP20X_VBUS_IPSOUT_MGMT		0x30
> +#define AXP20X_V_OFF			0x31
> +#define AXP20X_OFF_CTRL			0x32
> +#define AXP20X_CHRG_CTRL1		0x33
> +#define AXP20X_CHRG_CTRL2		0x34
> +#define AXP20X_CHRG_BAK_CTRL		0x35
> +#define AXP20X_PEK_KEY			0x36
> +#define AXP20X_DCDC_FREQ		0x37
> +#define AXP20X_V_LTF_CHRG		0x38
> +#define AXP20X_V_HTF_CHRG		0x39
> +#define AXP20X_APS_WARN_L1		0x3a
> +#define AXP20X_APS_WARN_L2		0x3b
> +#define AXP20X_V_LTF_DISCHRG		0x3c
> +#define AXP20X_V_HTF_DISCHRG		0x3d
> +
> +/* Interrupt */
> +#define AXP20X_IRQ1_EN			0x40
> +#define AXP20X_IRQ2_EN			0x41
> +#define AXP20X_IRQ3_EN			0x42
> +#define AXP20X_IRQ4_EN			0x43
> +#define AXP20X_IRQ5_EN			0x44
> +#define AXP20X_IRQ1_STATE		0x48
> +#define AXP20X_IRQ2_STATE		0x49
> +#define AXP20X_IRQ3_STATE		0x4a
> +#define AXP20X_IRQ4_STATE		0x4b
> +#define AXP20X_IRQ5_STATE		0x4c
> +
> +/* ADC */
> +#define AXP20X_ACIN_V_ADC_H		0x56
> +#define AXP20X_ACIN_V_ADC_L		0x57
> +#define AXP20X_ACIN_I_ADC_H		0x58
> +#define AXP20X_ACIN_I_ADC_L		0x59
> +#define AXP20X_VBUS_V_ADC_H		0x5a
> +#define AXP20X_VBUS_V_ADC_L		0x5b
> +#define AXP20X_VBUS_I_ADC_H		0x5c
> +#define AXP20X_VBUS_I_ADC_L		0x5d
> +#define AXP20X_TEMP_ADC_H		0x5e
> +#define AXP20X_TEMP_ADC_L		0x5f
> +#define AXP20X_TS_IN_H			0x62
> +#define AXP20X_TS_IN_L			0x63
> +#define AXP20X_GPIO0_V_ADC_H		0x64
> +#define AXP20X_GPIO0_V_ADC_L		0x65
> +#define AXP20X_GPIO1_V_ADC_H		0x66
> +#define AXP20X_GPIO1_V_ADC_L		0x67
> +#define AXP20X_PWR_BATT_H		0x70
> +#define AXP20X_PWR_BATT_M		0x71
> +#define AXP20X_PWR_BATT_L		0x72
> +#define AXP20X_BATT_V_H			0x78
> +#define AXP20X_BATT_V_L			0x79
> +#define AXP20X_BATT_CHRG_I_H		0x7a
> +#define AXP20X_BATT_CHRG_I_L		0x7b
> +#define AXP20X_BATT_DISCHRG_I_H		0x7c
> +#define AXP20X_BATT_DISCHRG_I_L		0x7d
> +#define AXP20X_IPSOUT_V_HIGH_H		0x7e
> +#define AXP20X_IPSOUT_V_HIGH_L		0x7f
> +
> +/* Power supply */
> +#define AXP20X_DCDC_MODE		0x80
> +#define AXP20X_ADC_EN1			0x82
> +#define AXP20X_ADC_EN2			0x83
> +#define AXP20X_ADC_RATE			0x84
> +#define AXP20X_GPIO10_IN_RANGE		0x85
> +#define AXP20X_GPIO1_ADC_IRQ_RIS	0x86
> +#define AXP20X_GPIO1_ADC_IRQ_FAL	0x87
> +#define AXP20X_TIMER_CTRL		0x8a
> +#define AXP20X_VBUS_MON			0x8b
> +#define AXP20X_OVER_TMP			0x8f
> +
> +/* GPIO */
> +#define AXP20X_GPIO0_CTRL		0x90
> +#define AXP20X_LDO5_V_OUT		0x91
> +#define AXP20X_GPIO1_CTRL		0x92
> +#define AXP20X_GPIO2_CTRL		0x93
> +#define AXP20X_GPIO20_SS		0x94
> +#define AXP20X_GPIO3_CTRL		0x95
> +
> +/* Battery */
> +#define AXP20X_CHRG_CC_31_24		0xb0
> +#define AXP20X_CHRG_CC_23_16		0xb1
> +#define AXP20X_CHRG_CC_15_8		0xb2
> +#define AXP20X_CHRG_CC_7_0		0xb3
> +#define AXP20X_DISCHRG_CC_31_24		0xb4
> +#define AXP20X_DISCHRG_CC_23_16		0xb5
> +#define AXP20X_DISCHRG_CC_15_8		0xb6
> +#define AXP20X_DISCHRG_CC_7_0		0xb7
> +#define AXP20X_CC_CTRL			0xb8
> +#define AXP20X_FG_RES			0xb9
> +
> +/* Regulators IDs */
> +enum {
> +	AXP20X_LDO1 = 0,
> +	AXP20X_LDO2,
> +	AXP20X_LDO3,
> +	AXP20X_LDO4,
> +	AXP20X_LDO5,
> +	AXP20X_DCDC2,
> +	AXP20X_DCDC3,
> +	AXP20X_REG_ID_MAX,
> +};
> +
> +/* IRQs */
> +enum {
> +	AXP20X_IRQ_ACIN_OVER_V = 1,
> +	AXP20X_IRQ_ACIN_PLUGIN,
> +	AXP20X_IRQ_ACIN_REMOVAL,
> +	AXP20X_IRQ_VBUS_OVER_V,
> +	AXP20X_IRQ_VBUS_PLUGIN,
> +	AXP20X_IRQ_VBUS_REMOVAL,
> +	AXP20X_IRQ_VBUS_V_LOW,
> +	AXP20X_IRQ_BATT_PLUGIN,
> +	AXP20X_IRQ_BATT_REMOVAL,
> +	AXP20X_IRQ_BATT_ENT_ACT_MODE,
> +	AXP20X_IRQ_BATT_EXIT_ACT_MODE,
> +	AXP20X_IRQ_CHARG,
> +	AXP20X_IRQ_CHARG_DONE,
> +	AXP20X_IRQ_BATT_TEMP_HIGH,
> +	AXP20X_IRQ_BATT_TEMP_LOW,
> +	AXP20X_IRQ_DIE_TEMP_HIGH,
> +	AXP20X_IRQ_CHARG_I_LOW,
> +	AXP20X_IRQ_DCDC1_V_LONG,
> +	AXP20X_IRQ_DCDC2_V_LONG,
> +	AXP20X_IRQ_DCDC3_V_LONG,
> +	AXP20X_IRQ_PEK_SHORT = 22,
> +	AXP20X_IRQ_PEK_LONG,
> +	AXP20X_IRQ_N_OE_PWR_ON,
> +	AXP20X_IRQ_N_OE_PWR_OFF,
> +	AXP20X_IRQ_VBUS_VALID,
> +	AXP20X_IRQ_VBUS_NOT_VALID,
> +	AXP20X_IRQ_VBUS_SESS_VALID,
> +	AXP20X_IRQ_VBUS_SESS_END,
> +	AXP20X_IRQ_LOW_PWR_LVL1,
> +	AXP20X_IRQ_LOW_PWR_LVL2,
> +	AXP20X_IRQ_TIMER,
> +	AXP20X_IRQ_PEK_RIS_EDGE,
> +	AXP20X_IRQ_PEK_FAL_EDGE,
> +	AXP20X_IRQ_GPIO3_INPUT,
> +	AXP20X_IRQ_GPIO2_INPUT,
> +	AXP20X_IRQ_GPIO1_INPUT,
> +	AXP20X_IRQ_GPIO0_INPUT,
> +};
> +
> +struct axp20x_dev {
> +	struct device			*dev;
> +	struct i2c_client		*i2c_client;
> +	struct regmap			*regmap;
> +	struct regmap_irq_chip_data	*regmap_irqc;
> +	int				variant;
> +	int				irq;
> +};

Is this used anywhere else except in the MFD driver?

If not, consider moving it into the *.c file.

> +#endif /* __LINUX_MFD_AXP20X_H */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* [PATCH] ASoC: smdk_wm8994: Fix typo "wm8894"
From: Paul Bolle @ 2014-02-10 21:25 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) This typo was introduced in commit 0d47acc4ffaa ("ASoC: smdk_wm8994:
Make driver name more unique").

1) So currently there's a difference between platform_drive.driver.name
and the (sub)string used in MODULE_ALIAS(). If I'd understand the
platform_driver interface I might have been able to say whether that
difference is only cosmetic or might actually break stuff. But I don't
understand it so I can't say. I can't even say whether this typo shows
up in some interface to user space.

2) Entirely untested.

 sound/soc/samsung/smdk_wm8994.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index d38ae98..682eb4f 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -202,7 +202,7 @@ static int smdk_audio_probe(struct platform_device *pdev)
 
 static struct platform_driver smdk_audio_driver = {
 	.driver		= {
-		.name	= "smdk-audio-wm8894",
+		.name	= "smdk-audio-wm8994",
 		.owner	= THIS_MODULE,
 		.of_match_table = of_match_ptr(samsung_wm8994_of_match),
 		.pm	= &snd_soc_pm_ops,
-- 
1.8.5.3

^ permalink raw reply related

* [PATCH v2] ARM: asm: rename logical shift macros push pull into lspush lspull
From: Nicolas Pitre @ 2014-02-10 21:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392063589-24111-2-git-send-email-victor.kamensky@linaro.org>

On Mon, 10 Feb 2014, Victor Kamensky wrote:

> Renames logical shift macros, 'push' and 'pull', defined in
> arch/arm/include/asm/assembler.h, into 'lspush' and 'lspull'.

I don't have any fundamental objection to the idea, except maybe for the 
actual names.  I just can't come up with anything better though.  
Therefore...

Acked-by: Nicolas Pitre <nico@linaro.org>

> That eliminates name conflict between 'push' logical shift macro
> and 'push' instruction mnemonic. That allows assembler.h to be
> included in .S files that use 'push' instruction.
> 
> Suggested-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
> ---
>  arch/arm/include/asm/assembler.h      |   8 +-
>  arch/arm/lib/copy_template.S          |  36 +++----
>  arch/arm/lib/csumpartialcopygeneric.S |  96 ++++++++---------
>  arch/arm/lib/io-readsl.S              |  12 +--
>  arch/arm/lib/io-writesl.S             |  12 +--
>  arch/arm/lib/memmove.S                |  36 +++----
>  arch/arm/lib/uaccess.S                | 192 +++++++++++++++++-----------------
>  7 files changed, 196 insertions(+), 196 deletions(-)
> 
> diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
> index 5c22851..380ac4f 100644
> --- a/arch/arm/include/asm/assembler.h
> +++ b/arch/arm/include/asm/assembler.h
> @@ -30,8 +30,8 @@
>   * Endian independent macros for shifting bytes within registers.
>   */
>  #ifndef __ARMEB__
> -#define pull            lsr
> -#define push            lsl
> +#define lspull          lsr
> +#define lspush          lsl
>  #define get_byte_0      lsl #0
>  #define get_byte_1	lsr #8
>  #define get_byte_2	lsr #16
> @@ -41,8 +41,8 @@
>  #define put_byte_2	lsl #16
>  #define put_byte_3	lsl #24
>  #else
> -#define pull            lsl
> -#define push            lsr
> +#define lspull          lsl
> +#define lspush          lsr
>  #define get_byte_0	lsr #24
>  #define get_byte_1	lsr #16
>  #define get_byte_2	lsr #8
> diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
> index 805e3f8..3bc8eb8 100644
> --- a/arch/arm/lib/copy_template.S
> +++ b/arch/arm/lib/copy_template.S
> @@ -197,24 +197,24 @@
>  
>  12:	PLD(	pld	[r1, #124]		)
>  13:		ldr4w	r1, r4, r5, r6, r7, abort=19f
> -		mov	r3, lr, pull #\pull
> +		mov	r3, lr, lspull #\pull
>  		subs	r2, r2, #32
>  		ldr4w	r1, r8, r9, ip, lr, abort=19f
> -		orr	r3, r3, r4, push #\push
> -		mov	r4, r4, pull #\pull
> -		orr	r4, r4, r5, push #\push
> -		mov	r5, r5, pull #\pull
> -		orr	r5, r5, r6, push #\push
> -		mov	r6, r6, pull #\pull
> -		orr	r6, r6, r7, push #\push
> -		mov	r7, r7, pull #\pull
> -		orr	r7, r7, r8, push #\push
> -		mov	r8, r8, pull #\pull
> -		orr	r8, r8, r9, push #\push
> -		mov	r9, r9, pull #\pull
> -		orr	r9, r9, ip, push #\push
> -		mov	ip, ip, pull #\pull
> -		orr	ip, ip, lr, push #\push
> +		orr	r3, r3, r4, lspush #\push
> +		mov	r4, r4, lspull #\pull
> +		orr	r4, r4, r5, lspush #\push
> +		mov	r5, r5, lspull #\pull
> +		orr	r5, r5, r6, lspush #\push
> +		mov	r6, r6, lspull #\pull
> +		orr	r6, r6, r7, lspush #\push
> +		mov	r7, r7, lspull #\pull
> +		orr	r7, r7, r8, lspush #\push
> +		mov	r8, r8, lspull #\pull
> +		orr	r8, r8, r9, lspush #\push
> +		mov	r9, r9, lspull #\pull
> +		orr	r9, r9, ip, lspush #\push
> +		mov	ip, ip, lspull #\pull
> +		orr	ip, ip, lr, lspush #\push
>  		str8w	r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
>  		bge	12b
>  	PLD(	cmn	r2, #96			)
> @@ -225,10 +225,10 @@
>  14:		ands	ip, r2, #28
>  		beq	16f
>  
> -15:		mov	r3, lr, pull #\pull
> +15:		mov	r3, lr, lspull #\pull
>  		ldr1w	r1, lr, abort=21f
>  		subs	ip, ip, #4
> -		orr	r3, r3, lr, push #\push
> +		orr	r3, r3, lr, lspush #\push
>  		str1w	r0, r3, abort=21f
>  		bgt	15b
>  	CALGN(	cmp	r2, #0			)
> diff --git a/arch/arm/lib/csumpartialcopygeneric.S b/arch/arm/lib/csumpartialcopygeneric.S
> index d620a5f..d6e742d 100644
> --- a/arch/arm/lib/csumpartialcopygeneric.S
> +++ b/arch/arm/lib/csumpartialcopygeneric.S
> @@ -141,7 +141,7 @@ FN_ENTRY
>  		tst	len, #2
>  		mov	r5, r4, get_byte_0
>  		beq	.Lexit
> -		adcs	sum, sum, r4, push #16
> +		adcs	sum, sum, r4, lspush #16
>  		strb	r5, [dst], #1
>  		mov	r5, r4, get_byte_1
>  		strb	r5, [dst], #1
> @@ -171,23 +171,23 @@ FN_ENTRY
>  		cmp	ip, #2
>  		beq	.Lsrc2_aligned
>  		bhi	.Lsrc3_aligned
> -		mov	r4, r5, pull #8		@ C = 0
> +		mov	r4, r5, lspull #8		@ C = 0
>  		bics	ip, len, #15
>  		beq	2f
>  1:		load4l	r5, r6, r7, r8
> -		orr	r4, r4, r5, push #24
> -		mov	r5, r5, pull #8
> -		orr	r5, r5, r6, push #24
> -		mov	r6, r6, pull #8
> -		orr	r6, r6, r7, push #24
> -		mov	r7, r7, pull #8
> -		orr	r7, r7, r8, push #24
> +		orr	r4, r4, r5, lspush #24
> +		mov	r5, r5, lspull #8
> +		orr	r5, r5, r6, lspush #24
> +		mov	r6, r6, lspull #8
> +		orr	r6, r6, r7, lspush #24
> +		mov	r7, r7, lspull #8
> +		orr	r7, r7, r8, lspush #24
>  		stmia	dst!, {r4, r5, r6, r7}
>  		adcs	sum, sum, r4
>  		adcs	sum, sum, r5
>  		adcs	sum, sum, r6
>  		adcs	sum, sum, r7
> -		mov	r4, r8, pull #8
> +		mov	r4, r8, lspull #8
>  		sub	ip, ip, #16
>  		teq	ip, #0
>  		bne	1b
> @@ -196,50 +196,50 @@ FN_ENTRY
>  		tst	ip, #8
>  		beq	3f
>  		load2l	r5, r6
> -		orr	r4, r4, r5, push #24
> -		mov	r5, r5, pull #8
> -		orr	r5, r5, r6, push #24
> +		orr	r4, r4, r5, lspush #24
> +		mov	r5, r5, lspull #8
> +		orr	r5, r5, r6, lspush #24
>  		stmia	dst!, {r4, r5}
>  		adcs	sum, sum, r4
>  		adcs	sum, sum, r5
> -		mov	r4, r6, pull #8
> +		mov	r4, r6, lspull #8
>  		tst	ip, #4
>  		beq	4f
>  3:		load1l	r5
> -		orr	r4, r4, r5, push #24
> +		orr	r4, r4, r5, lspush #24
>  		str	r4, [dst], #4
>  		adcs	sum, sum, r4
> -		mov	r4, r5, pull #8
> +		mov	r4, r5, lspull #8
>  4:		ands	len, len, #3
>  		beq	.Ldone
>  		mov	r5, r4, get_byte_0
>  		tst	len, #2
>  		beq	.Lexit
> -		adcs	sum, sum, r4, push #16
> +		adcs	sum, sum, r4, lspush #16
>  		strb	r5, [dst], #1
>  		mov	r5, r4, get_byte_1
>  		strb	r5, [dst], #1
>  		mov	r5, r4, get_byte_2
>  		b	.Lexit
>  
> -.Lsrc2_aligned:	mov	r4, r5, pull #16
> +.Lsrc2_aligned:	mov	r4, r5, lspull #16
>  		adds	sum, sum, #0
>  		bics	ip, len, #15
>  		beq	2f
>  1:		load4l	r5, r6, r7, r8
> -		orr	r4, r4, r5, push #16
> -		mov	r5, r5, pull #16
> -		orr	r5, r5, r6, push #16
> -		mov	r6, r6, pull #16
> -		orr	r6, r6, r7, push #16
> -		mov	r7, r7, pull #16
> -		orr	r7, r7, r8, push #16
> +		orr	r4, r4, r5, lspush #16
> +		mov	r5, r5, lspull #16
> +		orr	r5, r5, r6, lspush #16
> +		mov	r6, r6, lspull #16
> +		orr	r6, r6, r7, lspush #16
> +		mov	r7, r7, lspull #16
> +		orr	r7, r7, r8, lspush #16
>  		stmia	dst!, {r4, r5, r6, r7}
>  		adcs	sum, sum, r4
>  		adcs	sum, sum, r5
>  		adcs	sum, sum, r6
>  		adcs	sum, sum, r7
> -		mov	r4, r8, pull #16
> +		mov	r4, r8, lspull #16
>  		sub	ip, ip, #16
>  		teq	ip, #0
>  		bne	1b
> @@ -248,20 +248,20 @@ FN_ENTRY
>  		tst	ip, #8
>  		beq	3f
>  		load2l	r5, r6
> -		orr	r4, r4, r5, push #16
> -		mov	r5, r5, pull #16
> -		orr	r5, r5, r6, push #16
> +		orr	r4, r4, r5, lspush #16
> +		mov	r5, r5, lspull #16
> +		orr	r5, r5, r6, lspush #16
>  		stmia	dst!, {r4, r5}
>  		adcs	sum, sum, r4
>  		adcs	sum, sum, r5
> -		mov	r4, r6, pull #16
> +		mov	r4, r6, lspull #16
>  		tst	ip, #4
>  		beq	4f
>  3:		load1l	r5
> -		orr	r4, r4, r5, push #16
> +		orr	r4, r4, r5, lspush #16
>  		str	r4, [dst], #4
>  		adcs	sum, sum, r4
> -		mov	r4, r5, pull #16
> +		mov	r4, r5, lspull #16
>  4:		ands	len, len, #3
>  		beq	.Ldone
>  		mov	r5, r4, get_byte_0
> @@ -276,24 +276,24 @@ FN_ENTRY
>  		load1b	r5
>  		b	.Lexit
>  
> -.Lsrc3_aligned:	mov	r4, r5, pull #24
> +.Lsrc3_aligned:	mov	r4, r5, lspull #24
>  		adds	sum, sum, #0
>  		bics	ip, len, #15
>  		beq	2f
>  1:		load4l	r5, r6, r7, r8
> -		orr	r4, r4, r5, push #8
> -		mov	r5, r5, pull #24
> -		orr	r5, r5, r6, push #8
> -		mov	r6, r6, pull #24
> -		orr	r6, r6, r7, push #8
> -		mov	r7, r7, pull #24
> -		orr	r7, r7, r8, push #8
> +		orr	r4, r4, r5, lspush #8
> +		mov	r5, r5, lspull #24
> +		orr	r5, r5, r6, lspush #8
> +		mov	r6, r6, lspull #24
> +		orr	r6, r6, r7, lspush #8
> +		mov	r7, r7, lspull #24
> +		orr	r7, r7, r8, lspush #8
>  		stmia	dst!, {r4, r5, r6, r7}
>  		adcs	sum, sum, r4
>  		adcs	sum, sum, r5
>  		adcs	sum, sum, r6
>  		adcs	sum, sum, r7
> -		mov	r4, r8, pull #24
> +		mov	r4, r8, lspull #24
>  		sub	ip, ip, #16
>  		teq	ip, #0
>  		bne	1b
> @@ -302,20 +302,20 @@ FN_ENTRY
>  		tst	ip, #8
>  		beq	3f
>  		load2l	r5, r6
> -		orr	r4, r4, r5, push #8
> -		mov	r5, r5, pull #24
> -		orr	r5, r5, r6, push #8
> +		orr	r4, r4, r5, lspush #8
> +		mov	r5, r5, lspull #24
> +		orr	r5, r5, r6, lspush #8
>  		stmia	dst!, {r4, r5}
>  		adcs	sum, sum, r4
>  		adcs	sum, sum, r5
> -		mov	r4, r6, pull #24
> +		mov	r4, r6, lspull #24
>  		tst	ip, #4
>  		beq	4f
>  3:		load1l	r5
> -		orr	r4, r4, r5, push #8
> +		orr	r4, r4, r5, lspush #8
>  		str	r4, [dst], #4
>  		adcs	sum, sum, r4
> -		mov	r4, r5, pull #24
> +		mov	r4, r5, lspull #24
>  4:		ands	len, len, #3
>  		beq	.Ldone
>  		mov	r5, r4, get_byte_0
> @@ -326,7 +326,7 @@ FN_ENTRY
>  		load1l	r4
>  		mov	r5, r4, get_byte_0
>  		strb	r5, [dst], #1
> -		adcs	sum, sum, r4, push #24
> +		adcs	sum, sum, r4, lspush #24
>  		mov	r5, r4, get_byte_1
>  		b	.Lexit
>  FN_EXIT
> diff --git a/arch/arm/lib/io-readsl.S b/arch/arm/lib/io-readsl.S
> index 5fb97e7..7a74309 100644
> --- a/arch/arm/lib/io-readsl.S
> +++ b/arch/arm/lib/io-readsl.S
> @@ -47,25 +47,25 @@ ENTRY(__raw_readsl)
>  		strb	ip, [r1], #1
>  
>  4:		subs	r2, r2, #1
> -		mov	ip, r3, pull #24
> +		mov	ip, r3, lspull #24
>  		ldrne	r3, [r0]
> -		orrne	ip, ip, r3, push #8
> +		orrne	ip, ip, r3, lspush #8
>  		strne	ip, [r1], #4
>  		bne	4b
>  		b	8f
>  
>  5:		subs	r2, r2, #1
> -		mov	ip, r3, pull #16
> +		mov	ip, r3, lspull #16
>  		ldrne	r3, [r0]
> -		orrne	ip, ip, r3, push #16
> +		orrne	ip, ip, r3, lspush #16
>  		strne	ip, [r1], #4
>  		bne	5b
>  		b	7f
>  
>  6:		subs	r2, r2, #1
> -		mov	ip, r3, pull #8
> +		mov	ip, r3, lspull #8
>  		ldrne	r3, [r0]
> -		orrne	ip, ip, r3, push #24
> +		orrne	ip, ip, r3, lspush #24
>  		strne	ip, [r1], #4
>  		bne	6b
>  
> diff --git a/arch/arm/lib/io-writesl.S b/arch/arm/lib/io-writesl.S
> index 8d3b781..d0d104a 100644
> --- a/arch/arm/lib/io-writesl.S
> +++ b/arch/arm/lib/io-writesl.S
> @@ -41,26 +41,26 @@ ENTRY(__raw_writesl)
>  		blt	5f
>  		bgt	6f
>  
> -4:		mov	ip, r3, pull #16
> +4:		mov	ip, r3, lspull #16
>  		ldr	r3, [r1], #4
>  		subs	r2, r2, #1
> -		orr	ip, ip, r3, push #16
> +		orr	ip, ip, r3, lspush #16
>  		str	ip, [r0]
>  		bne	4b
>  		mov	pc, lr
>  
> -5:		mov	ip, r3, pull #8
> +5:		mov	ip, r3, lspull #8
>  		ldr	r3, [r1], #4
>  		subs	r2, r2, #1
> -		orr	ip, ip, r3, push #24
> +		orr	ip, ip, r3, lspush #24
>  		str	ip, [r0]
>  		bne	5b
>  		mov	pc, lr
>  
> -6:		mov	ip, r3, pull #24
> +6:		mov	ip, r3, lspull #24
>  		ldr	r3, [r1], #4
>  		subs	r2, r2, #1
> -		orr	ip, ip, r3, push #8
> +		orr	ip, ip, r3, lspush #8
>  		str	ip, [r0]
>  		bne	6b
>  		mov	pc, lr
> diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
> index 938fc14..d1fc0c0 100644
> --- a/arch/arm/lib/memmove.S
> +++ b/arch/arm/lib/memmove.S
> @@ -147,24 +147,24 @@ ENTRY(memmove)
>  
>  12:	PLD(	pld	[r1, #-128]		)
>  13:		ldmdb   r1!, {r7, r8, r9, ip}
> -		mov     lr, r3, push #\push
> +		mov     lr, r3, lspush #\push
>  		subs    r2, r2, #32
>  		ldmdb   r1!, {r3, r4, r5, r6}
> -		orr     lr, lr, ip, pull #\pull
> -		mov     ip, ip, push #\push
> -		orr     ip, ip, r9, pull #\pull
> -		mov     r9, r9, push #\push
> -		orr     r9, r9, r8, pull #\pull
> -		mov     r8, r8, push #\push
> -		orr     r8, r8, r7, pull #\pull
> -		mov     r7, r7, push #\push
> -		orr     r7, r7, r6, pull #\pull
> -		mov     r6, r6, push #\push
> -		orr     r6, r6, r5, pull #\pull
> -		mov     r5, r5, push #\push
> -		orr     r5, r5, r4, pull #\pull
> -		mov     r4, r4, push #\push
> -		orr     r4, r4, r3, pull #\pull
> +		orr     lr, lr, ip, lspull #\pull
> +		mov     ip, ip, lspush #\push
> +		orr     ip, ip, r9, lspull #\pull
> +		mov     r9, r9, lspush #\push
> +		orr     r9, r9, r8, lspull #\pull
> +		mov     r8, r8, lspush #\push
> +		orr     r8, r8, r7, lspull #\pull
> +		mov     r7, r7, lspush #\push
> +		orr     r7, r7, r6, lspull #\pull
> +		mov     r6, r6, lspush #\push
> +		orr     r6, r6, r5, lspull #\pull
> +		mov     r5, r5, lspush #\push
> +		orr     r5, r5, r4, lspull #\pull
> +		mov     r4, r4, lspush #\push
> +		orr     r4, r4, r3, lspull #\pull
>  		stmdb   r0!, {r4 - r9, ip, lr}
>  		bge	12b
>  	PLD(	cmn	r2, #96			)
> @@ -175,10 +175,10 @@ ENTRY(memmove)
>  14:		ands	ip, r2, #28
>  		beq	16f
>  
> -15:		mov     lr, r3, push #\push
> +15:		mov     lr, r3, lspush #\push
>  		ldr	r3, [r1, #-4]!
>  		subs	ip, ip, #4
> -		orr	lr, lr, r3, pull #\pull
> +		orr	lr, lr, r3, lspull #\pull
>  		str	lr, [r0, #-4]!
>  		bgt	15b
>  	CALGN(	cmp	r2, #0			)
> diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S
> index 5c908b1..e505209 100644
> --- a/arch/arm/lib/uaccess.S
> +++ b/arch/arm/lib/uaccess.S
> @@ -117,9 +117,9 @@ USER(	TUSER(	strgtb) r3, [r0], #1)			@ May fault
>  .Lc2u_1fupi:	subs	r2, r2, #4
>  		addmi	ip, r2, #4
>  		bmi	.Lc2u_1nowords
> -		mov	r3, r7, pull #8
> +		mov	r3, r7, lspull #8
>  		ldr	r7, [r1], #4
> -		orr	r3, r3, r7, push #24
> +		orr	r3, r3, r7, lspush #24
>  USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
>  		mov	ip, r0, lsl #32 - PAGE_SHIFT
>  		rsb	ip, ip, #0
> @@ -131,30 +131,30 @@ USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
>  		subs	ip, ip, #16
>  		blt	.Lc2u_1rem8lp
>  
> -.Lc2u_1cpy8lp:	mov	r3, r7, pull #8
> +.Lc2u_1cpy8lp:	mov	r3, r7, lspull #8
>  		ldmia	r1!, {r4 - r7}
>  		subs	ip, ip, #16
> -		orr	r3, r3, r4, push #24
> -		mov	r4, r4, pull #8
> -		orr	r4, r4, r5, push #24
> -		mov	r5, r5, pull #8
> -		orr	r5, r5, r6, push #24
> -		mov	r6, r6, pull #8
> -		orr	r6, r6, r7, push #24
> +		orr	r3, r3, r4, lspush #24
> +		mov	r4, r4, lspull #8
> +		orr	r4, r4, r5, lspush #24
> +		mov	r5, r5, lspull #8
> +		orr	r5, r5, r6, lspush #24
> +		mov	r6, r6, lspull #8
> +		orr	r6, r6, r7, lspush #24
>  		stmia	r0!, {r3 - r6}			@ Shouldnt fault
>  		bpl	.Lc2u_1cpy8lp
>  
>  .Lc2u_1rem8lp:	tst	ip, #8
> -		movne	r3, r7, pull #8
> +		movne	r3, r7, lspull #8
>  		ldmneia	r1!, {r4, r7}
> -		orrne	r3, r3, r4, push #24
> -		movne	r4, r4, pull #8
> -		orrne	r4, r4, r7, push #24
> +		orrne	r3, r3, r4, lspush #24
> +		movne	r4, r4, lspull #8
> +		orrne	r4, r4, r7, lspush #24
>  		stmneia	r0!, {r3 - r4}			@ Shouldnt fault
>  		tst	ip, #4
> -		movne	r3, r7, pull #8
> +		movne	r3, r7, lspull #8
>  		ldrne	r7, [r1], #4
> -		orrne	r3, r3, r7, push #24
> +		orrne	r3, r3, r7, lspush #24
>  	TUSER(	strne) r3, [r0], #4			@ Shouldnt fault
>  		ands	ip, ip, #3
>  		beq	.Lc2u_1fupi
> @@ -172,9 +172,9 @@ USER(	TUSER(	strgtb) r3, [r0], #1)			@ May fault
>  .Lc2u_2fupi:	subs	r2, r2, #4
>  		addmi	ip, r2, #4
>  		bmi	.Lc2u_2nowords
> -		mov	r3, r7, pull #16
> +		mov	r3, r7, lspull #16
>  		ldr	r7, [r1], #4
> -		orr	r3, r3, r7, push #16
> +		orr	r3, r3, r7, lspush #16
>  USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
>  		mov	ip, r0, lsl #32 - PAGE_SHIFT
>  		rsb	ip, ip, #0
> @@ -186,30 +186,30 @@ USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
>  		subs	ip, ip, #16
>  		blt	.Lc2u_2rem8lp
>  
> -.Lc2u_2cpy8lp:	mov	r3, r7, pull #16
> +.Lc2u_2cpy8lp:	mov	r3, r7, lspull #16
>  		ldmia	r1!, {r4 - r7}
>  		subs	ip, ip, #16
> -		orr	r3, r3, r4, push #16
> -		mov	r4, r4, pull #16
> -		orr	r4, r4, r5, push #16
> -		mov	r5, r5, pull #16
> -		orr	r5, r5, r6, push #16
> -		mov	r6, r6, pull #16
> -		orr	r6, r6, r7, push #16
> +		orr	r3, r3, r4, lspush #16
> +		mov	r4, r4, lspull #16
> +		orr	r4, r4, r5, lspush #16
> +		mov	r5, r5, lspull #16
> +		orr	r5, r5, r6, lspush #16
> +		mov	r6, r6, lspull #16
> +		orr	r6, r6, r7, lspush #16
>  		stmia	r0!, {r3 - r6}			@ Shouldnt fault
>  		bpl	.Lc2u_2cpy8lp
>  
>  .Lc2u_2rem8lp:	tst	ip, #8
> -		movne	r3, r7, pull #16
> +		movne	r3, r7, lspull #16
>  		ldmneia	r1!, {r4, r7}
> -		orrne	r3, r3, r4, push #16
> -		movne	r4, r4, pull #16
> -		orrne	r4, r4, r7, push #16
> +		orrne	r3, r3, r4, lspush #16
> +		movne	r4, r4, lspull #16
> +		orrne	r4, r4, r7, lspush #16
>  		stmneia	r0!, {r3 - r4}			@ Shouldnt fault
>  		tst	ip, #4
> -		movne	r3, r7, pull #16
> +		movne	r3, r7, lspull #16
>  		ldrne	r7, [r1], #4
> -		orrne	r3, r3, r7, push #16
> +		orrne	r3, r3, r7, lspush #16
>  	TUSER(	strne) r3, [r0], #4			@ Shouldnt fault
>  		ands	ip, ip, #3
>  		beq	.Lc2u_2fupi
> @@ -227,9 +227,9 @@ USER(	TUSER(	strgtb) r3, [r0], #1)			@ May fault
>  .Lc2u_3fupi:	subs	r2, r2, #4
>  		addmi	ip, r2, #4
>  		bmi	.Lc2u_3nowords
> -		mov	r3, r7, pull #24
> +		mov	r3, r7, lspull #24
>  		ldr	r7, [r1], #4
> -		orr	r3, r3, r7, push #8
> +		orr	r3, r3, r7, lspush #8
>  USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
>  		mov	ip, r0, lsl #32 - PAGE_SHIFT
>  		rsb	ip, ip, #0
> @@ -241,30 +241,30 @@ USER(	TUSER(	str)	r3, [r0], #4)			@ May fault
>  		subs	ip, ip, #16
>  		blt	.Lc2u_3rem8lp
>  
> -.Lc2u_3cpy8lp:	mov	r3, r7, pull #24
> +.Lc2u_3cpy8lp:	mov	r3, r7, lspull #24
>  		ldmia	r1!, {r4 - r7}
>  		subs	ip, ip, #16
> -		orr	r3, r3, r4, push #8
> -		mov	r4, r4, pull #24
> -		orr	r4, r4, r5, push #8
> -		mov	r5, r5, pull #24
> -		orr	r5, r5, r6, push #8
> -		mov	r6, r6, pull #24
> -		orr	r6, r6, r7, push #8
> +		orr	r3, r3, r4, lspush #8
> +		mov	r4, r4, lspull #24
> +		orr	r4, r4, r5, lspush #8
> +		mov	r5, r5, lspull #24
> +		orr	r5, r5, r6, lspush #8
> +		mov	r6, r6, lspull #24
> +		orr	r6, r6, r7, lspush #8
>  		stmia	r0!, {r3 - r6}			@ Shouldnt fault
>  		bpl	.Lc2u_3cpy8lp
>  
>  .Lc2u_3rem8lp:	tst	ip, #8
> -		movne	r3, r7, pull #24
> +		movne	r3, r7, lspull #24
>  		ldmneia	r1!, {r4, r7}
> -		orrne	r3, r3, r4, push #8
> -		movne	r4, r4, pull #24
> -		orrne	r4, r4, r7, push #8
> +		orrne	r3, r3, r4, lspush #8
> +		movne	r4, r4, lspull #24
> +		orrne	r4, r4, r7, lspush #8
>  		stmneia	r0!, {r3 - r4}			@ Shouldnt fault
>  		tst	ip, #4
> -		movne	r3, r7, pull #24
> +		movne	r3, r7, lspull #24
>  		ldrne	r7, [r1], #4
> -		orrne	r3, r3, r7, push #8
> +		orrne	r3, r3, r7, lspush #8
>  	TUSER(	strne) r3, [r0], #4			@ Shouldnt fault
>  		ands	ip, ip, #3
>  		beq	.Lc2u_3fupi
> @@ -382,9 +382,9 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
>  .Lcfu_1fupi:	subs	r2, r2, #4
>  		addmi	ip, r2, #4
>  		bmi	.Lcfu_1nowords
> -		mov	r3, r7, pull #8
> +		mov	r3, r7, lspull #8
>  USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
> -		orr	r3, r3, r7, push #24
> +		orr	r3, r3, r7, lspush #24
>  		str	r3, [r0], #4
>  		mov	ip, r1, lsl #32 - PAGE_SHIFT
>  		rsb	ip, ip, #0
> @@ -396,30 +396,30 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
>  		subs	ip, ip, #16
>  		blt	.Lcfu_1rem8lp
>  
> -.Lcfu_1cpy8lp:	mov	r3, r7, pull #8
> +.Lcfu_1cpy8lp:	mov	r3, r7, lspull #8
>  		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
>  		subs	ip, ip, #16
> -		orr	r3, r3, r4, push #24
> -		mov	r4, r4, pull #8
> -		orr	r4, r4, r5, push #24
> -		mov	r5, r5, pull #8
> -		orr	r5, r5, r6, push #24
> -		mov	r6, r6, pull #8
> -		orr	r6, r6, r7, push #24
> +		orr	r3, r3, r4, lspush #24
> +		mov	r4, r4, lspull #8
> +		orr	r4, r4, r5, lspush #24
> +		mov	r5, r5, lspull #8
> +		orr	r5, r5, r6, lspush #24
> +		mov	r6, r6, lspull #8
> +		orr	r6, r6, r7, lspush #24
>  		stmia	r0!, {r3 - r6}
>  		bpl	.Lcfu_1cpy8lp
>  
>  .Lcfu_1rem8lp:	tst	ip, #8
> -		movne	r3, r7, pull #8
> +		movne	r3, r7, lspull #8
>  		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
> -		orrne	r3, r3, r4, push #24
> -		movne	r4, r4, pull #8
> -		orrne	r4, r4, r7, push #24
> +		orrne	r3, r3, r4, lspush #24
> +		movne	r4, r4, lspull #8
> +		orrne	r4, r4, r7, lspush #24
>  		stmneia	r0!, {r3 - r4}
>  		tst	ip, #4
> -		movne	r3, r7, pull #8
> +		movne	r3, r7, lspull #8
>  USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
> -		orrne	r3, r3, r7, push #24
> +		orrne	r3, r3, r7, lspush #24
>  		strne	r3, [r0], #4
>  		ands	ip, ip, #3
>  		beq	.Lcfu_1fupi
> @@ -437,9 +437,9 @@ USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
>  .Lcfu_2fupi:	subs	r2, r2, #4
>  		addmi	ip, r2, #4
>  		bmi	.Lcfu_2nowords
> -		mov	r3, r7, pull #16
> +		mov	r3, r7, lspull #16
>  USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
> -		orr	r3, r3, r7, push #16
> +		orr	r3, r3, r7, lspush #16
>  		str	r3, [r0], #4
>  		mov	ip, r1, lsl #32 - PAGE_SHIFT
>  		rsb	ip, ip, #0
> @@ -452,30 +452,30 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
>  		blt	.Lcfu_2rem8lp
>  
>  
> -.Lcfu_2cpy8lp:	mov	r3, r7, pull #16
> +.Lcfu_2cpy8lp:	mov	r3, r7, lspull #16
>  		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
>  		subs	ip, ip, #16
> -		orr	r3, r3, r4, push #16
> -		mov	r4, r4, pull #16
> -		orr	r4, r4, r5, push #16
> -		mov	r5, r5, pull #16
> -		orr	r5, r5, r6, push #16
> -		mov	r6, r6, pull #16
> -		orr	r6, r6, r7, push #16
> +		orr	r3, r3, r4, lspush #16
> +		mov	r4, r4, lspull #16
> +		orr	r4, r4, r5, lspush #16
> +		mov	r5, r5, lspull #16
> +		orr	r5, r5, r6, lspush #16
> +		mov	r6, r6, lspull #16
> +		orr	r6, r6, r7, lspush #16
>  		stmia	r0!, {r3 - r6}
>  		bpl	.Lcfu_2cpy8lp
>  
>  .Lcfu_2rem8lp:	tst	ip, #8
> -		movne	r3, r7, pull #16
> +		movne	r3, r7, lspull #16
>  		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
> -		orrne	r3, r3, r4, push #16
> -		movne	r4, r4, pull #16
> -		orrne	r4, r4, r7, push #16
> +		orrne	r3, r3, r4, lspush #16
> +		movne	r4, r4, lspull #16
> +		orrne	r4, r4, r7, lspush #16
>  		stmneia	r0!, {r3 - r4}
>  		tst	ip, #4
> -		movne	r3, r7, pull #16
> +		movne	r3, r7, lspull #16
>  USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
> -		orrne	r3, r3, r7, push #16
> +		orrne	r3, r3, r7, lspush #16
>  		strne	r3, [r0], #4
>  		ands	ip, ip, #3
>  		beq	.Lcfu_2fupi
> @@ -493,9 +493,9 @@ USER(	TUSER(	ldrgtb) r3, [r1], #0)			@ May fault
>  .Lcfu_3fupi:	subs	r2, r2, #4
>  		addmi	ip, r2, #4
>  		bmi	.Lcfu_3nowords
> -		mov	r3, r7, pull #24
> +		mov	r3, r7, lspull #24
>  USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
> -		orr	r3, r3, r7, push #8
> +		orr	r3, r3, r7, lspush #8
>  		str	r3, [r0], #4
>  		mov	ip, r1, lsl #32 - PAGE_SHIFT
>  		rsb	ip, ip, #0
> @@ -507,30 +507,30 @@ USER(	TUSER(	ldr)	r7, [r1], #4)			@ May fault
>  		subs	ip, ip, #16
>  		blt	.Lcfu_3rem8lp
>  
> -.Lcfu_3cpy8lp:	mov	r3, r7, pull #24
> +.Lcfu_3cpy8lp:	mov	r3, r7, lspull #24
>  		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
> -		orr	r3, r3, r4, push #8
> -		mov	r4, r4, pull #24
> -		orr	r4, r4, r5, push #8
> -		mov	r5, r5, pull #24
> -		orr	r5, r5, r6, push #8
> -		mov	r6, r6, pull #24
> -		orr	r6, r6, r7, push #8
> +		orr	r3, r3, r4, lspush #8
> +		mov	r4, r4, lspull #24
> +		orr	r4, r4, r5, lspush #8
> +		mov	r5, r5, lspull #24
> +		orr	r5, r5, r6, lspush #8
> +		mov	r6, r6, lspull #24
> +		orr	r6, r6, r7, lspush #8
>  		stmia	r0!, {r3 - r6}
>  		subs	ip, ip, #16
>  		bpl	.Lcfu_3cpy8lp
>  
>  .Lcfu_3rem8lp:	tst	ip, #8
> -		movne	r3, r7, pull #24
> +		movne	r3, r7, lspull #24
>  		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
> -		orrne	r3, r3, r4, push #8
> -		movne	r4, r4, pull #24
> -		orrne	r4, r4, r7, push #8
> +		orrne	r3, r3, r4, lspush #8
> +		movne	r4, r4, lspull #24
> +		orrne	r4, r4, r7, lspush #8
>  		stmneia	r0!, {r3 - r4}
>  		tst	ip, #4
> -		movne	r3, r7, pull #24
> +		movne	r3, r7, lspull #24
>  USER(	TUSER(	ldrne) r7, [r1], #4)			@ May fault
> -		orrne	r3, r3, r7, push #8
> +		orrne	r3, r3, r7, lspush #8
>  		strne	r3, [r0], #4
>  		ands	ip, ip, #3
>  		beq	.Lcfu_3fupi
> -- 
> 1.8.1.4
> 

^ permalink raw reply

* [PATCH 0/5] mt9t001 and mt9p031 sensors drivers patches
From: Laurent Pinchart @ 2014-02-10 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This is a set of miscellaneous patches for the mt9t001 and mt9p031 sensors
drivers. Please see individual commit messages for details.

The mt9t001 driver receives support for regulators and clocks. As a
prerequisite, patch 1/5 registers a fixed rate clock and two fixed voltage
regulators for the CM-T35 board camera sensor.

Laurent Pinchart (5):
  ARM: omap2: cm-t35: Add regulators and clock for camera sensor
  mt9t001: Add regulator support
  mt9t001: Add clock support
  mt9p031: Fix typo in comment
  mt9p031: Add support for PLL bypass

 arch/arm/mach-omap2/board-cm-t35.c |  16 +++
 drivers/media/i2c/mt9p031.c        |  34 +++++-
 drivers/media/i2c/mt9t001.c        | 229 +++++++++++++++++++++++++++++--------
 3 files changed, 228 insertions(+), 51 deletions(-)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply

* [PATCH 1/5] ARM: omap2: cm-t35: Add regulators and clock for camera sensor
From: Laurent Pinchart @ 2014-02-10 21:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392069284-18024-1-git-send-email-laurent.pinchart@ideasonboard.com>

The camera sensor will soon require regulators and clocks. Register
fixed regulators for its VAA and VDD power supplies and a fixed rate
clock for its master clock.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 arch/arm/mach-omap2/board-cm-t35.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 8dd0ec8..018353d 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -16,6 +16,8 @@
  *
  */
 
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -542,8 +544,22 @@ static struct isp_platform_data cm_t35_isp_pdata = {
 	.subdevs = cm_t35_isp_subdevs,
 };
 
+static struct regulator_consumer_supply cm_t35_camera_supplies[] = {
+	REGULATOR_SUPPLY("vaa", "3-005d"),
+	REGULATOR_SUPPLY("vdd", "3-005d"),
+};
+
 static void __init cm_t35_init_camera(void)
 {
+	struct clk *clk;
+
+	clk = clk_register_fixed_rate(NULL, "mt9t001-clkin", NULL, CLK_IS_ROOT,
+				      48000000);
+	clk_register_clkdev(clk, NULL, "3-005d");
+
+	regulator_register_fixed(2, cm_t35_camera_supplies,
+				 ARRAY_SIZE(cm_t35_camera_supplies));
+
 	if (omap3_init_camera(&cm_t35_isp_pdata) < 0)
 		pr_warn("CM-T3x: Failed registering camera device!\n");
 }
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 2/5] mt9t001: Add regulator support
From: Laurent Pinchart @ 2014-02-10 21:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392069284-18024-1-git-send-email-laurent.pinchart@ideasonboard.com>

The sensor needs two power supplies, VAA and VDD. Require a regulator
for each of them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9t001.c | 206 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 156 insertions(+), 50 deletions(-)

diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index d41c70e..9a0bb06 100644
--- a/drivers/media/i2c/mt9t001.c
+++ b/drivers/media/i2c/mt9t001.c
@@ -13,8 +13,9 @@
  */
 
 #include <linux/i2c.h>
-#include <linux/module.h>
 #include <linux/log2.h>
+#include <linux/module.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/videodev2.h>
 #include <linux/v4l2-mediabus.h>
@@ -55,6 +56,7 @@
 #define		MT9T001_OUTPUT_CONTROL_SYNC		(1 << 0)
 #define		MT9T001_OUTPUT_CONTROL_CHIP_ENABLE	(1 << 1)
 #define		MT9T001_OUTPUT_CONTROL_TEST_DATA	(1 << 6)
+#define		MT9T001_OUTPUT_CONTROL_DEF		0x0002
 #define MT9T001_SHUTTER_WIDTH_HIGH			0x08
 #define MT9T001_SHUTTER_WIDTH_LOW			0x09
 #define		MT9T001_SHUTTER_WIDTH_MIN		1
@@ -116,6 +118,11 @@ struct mt9t001 {
 	struct v4l2_subdev subdev;
 	struct media_pad pad;
 
+	struct regulator_bulk_data regulators[2];
+
+	struct mutex power_lock; /* lock to protect power_count */
+	int power_count;
+
 	struct v4l2_mbus_framefmt format;
 	struct v4l2_rect crop;
 
@@ -159,6 +166,62 @@ static int mt9t001_set_output_control(struct mt9t001 *mt9t001, u16 clear,
 	return 0;
 }
 
+static int mt9t001_reset(struct mt9t001 *mt9t001)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(&mt9t001->subdev);
+	int ret;
+
+	/* Reset the chip and stop data read out */
+	ret = mt9t001_write(client, MT9T001_RESET, 1);
+	if (ret < 0)
+		return ret;
+
+	ret = mt9t001_write(client, MT9T001_RESET, 0);
+	if (ret < 0)
+		return ret;
+
+	mt9t001->output_control = MT9T001_OUTPUT_CONTROL_DEF;
+
+	return mt9t001_set_output_control(mt9t001,
+					  MT9T001_OUTPUT_CONTROL_CHIP_ENABLE,
+					  0);
+}
+
+static int mt9t001_power_on(struct mt9t001 *mt9t001)
+{
+	/* Bring up the supplies */
+	return regulator_bulk_enable(ARRAY_SIZE(mt9t001->regulators),
+				     mt9t001->regulators);
+}
+
+static void mt9t001_power_off(struct mt9t001 *mt9t001)
+{
+	regulator_bulk_disable(ARRAY_SIZE(mt9t001->regulators),
+			       mt9t001->regulators);
+
+static int __mt9t001_set_power(struct mt9t001 *mt9t001, bool on)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(&mt9t001->subdev);
+	int ret;
+
+	if (!on) {
+		mt9t001_power_off(mt9t001);
+		return 0;
+	}
+
+	ret = mt9t001_power_on(mt9t001);
+	if (ret < 0)
+		return ret;
+
+	ret = mt9t001_reset(mt9t001);
+	if (ret < 0) {
+		dev_err(&client->dev, "Failed to reset the camera\n");
+		return ret;
+	}
+
+	return v4l2_ctrl_handler_setup(&mt9t001->ctrls);
+}
+
 /* -----------------------------------------------------------------------------
  * V4L2 subdev video operations
  */
@@ -195,6 +258,7 @@ static int mt9t001_s_stream(struct v4l2_subdev *subdev, int enable)
 {
 	const u16 mode = MT9T001_OUTPUT_CONTROL_CHIP_ENABLE;
 	struct i2c_client *client = v4l2_get_subdevdata(subdev);
+	struct mt9t001_platform_data *pdata = client->dev.platform_data;
 	struct mt9t001 *mt9t001 = to_mt9t001(subdev);
 	struct v4l2_mbus_framefmt *format = &mt9t001->format;
 	struct v4l2_rect *crop = &mt9t001->crop;
@@ -205,6 +269,14 @@ static int mt9t001_s_stream(struct v4l2_subdev *subdev, int enable)
 	if (!enable)
 		return mt9t001_set_output_control(mt9t001, mode, 0);
 
+	/* Configure the pixel clock polarity */
+	if (pdata->clk_pol) {
+		ret  = mt9t001_write(client, MT9T001_PIXEL_CLOCK,
+				     MT9T001_PIXEL_CLOCK_INVERT);
+		if (ret < 0)
+			return ret;
+	}
+
 	/* Configure the window size and row/column bin */
 	hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
 	vratio = DIV_ROUND_CLOSEST(crop->height, format->height);
@@ -630,9 +702,67 @@ static const struct v4l2_ctrl_config mt9t001_gains[] = {
 };
 
 /* -----------------------------------------------------------------------------
+ * V4L2 subdev core operations
+ */
+
+static int mt9t001_set_power(struct v4l2_subdev *subdev, int on)
+{
+	struct mt9t001 *mt9t001 = to_mt9t001(subdev);
+	int ret = 0;
+
+	mutex_lock(&mt9t001->power_lock);
+
+	/* If the power count is modified from 0 to != 0 or from != 0 to 0,
+	 * update the power state.
+	 */
+	if (mt9t001->power_count == !on) {
+		ret = __mt9t001_set_power(mt9t001, !!on);
+		if (ret < 0)
+			goto out;
+	}
+
+	/* Update the power count. */
+	mt9t001->power_count += on ? 1 : -1;
+	WARN_ON(mt9t001->power_count < 0);
+
+out:
+	mutex_unlock(&mt9t001->power_lock);
+	return ret;
+}
+
+/* -----------------------------------------------------------------------------
  * V4L2 subdev internal operations
  */
 
+static int mt9t001_registered(struct v4l2_subdev *subdev)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(subdev);
+	struct mt9t001 *mt9t001 = to_mt9t001(subdev);
+	s32 data;
+	int ret;
+
+	ret = mt9t001_power_on(mt9t001);
+	if (ret < 0) {
+		dev_err(&client->dev, "MT9T001 power up failed\n");
+		return ret;
+	}
+
+	/* Read out the chip version register */
+	data = mt9t001_read(client, MT9T001_CHIP_VERSION);
+	mt9t001_power_off(mt9t001);
+
+	if (data != MT9T001_CHIP_ID) {
+		dev_err(&client->dev,
+			"MT9T001 not detected, wrong version 0x%04x\n", data);
+		return -ENODEV;
+	}
+
+	dev_info(&client->dev, "MT9T001 detected at address 0x%02x\n",
+		 client->addr);
+
+	return 0;
+}
+
 static int mt9t001_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
 {
 	struct v4l2_mbus_framefmt *format;
@@ -651,9 +781,18 @@ static int mt9t001_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
 	format->field = V4L2_FIELD_NONE;
 	format->colorspace = V4L2_COLORSPACE_SRGB;
 
-	return 0;
+	return mt9t001_set_power(subdev, 1);
 }
 
+static int mt9t001_close(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
+{
+	return mt9t001_set_power(subdev, 0);
+}
+
+static struct v4l2_subdev_core_ops mt9t001_subdev_core_ops = {
+	.s_power = mt9t001_set_power,
+};
+
 static struct v4l2_subdev_video_ops mt9t001_subdev_video_ops = {
 	.s_stream = mt9t001_s_stream,
 };
@@ -668,58 +807,17 @@ static struct v4l2_subdev_pad_ops mt9t001_subdev_pad_ops = {
 };
 
 static struct v4l2_subdev_ops mt9t001_subdev_ops = {
+	.core = &mt9t001_subdev_core_ops,
 	.video = &mt9t001_subdev_video_ops,
 	.pad = &mt9t001_subdev_pad_ops,
 };
 
 static struct v4l2_subdev_internal_ops mt9t001_subdev_internal_ops = {
+	.registered = mt9t001_registered,
 	.open = mt9t001_open,
+	.close = mt9t001_close,
 };
 
-static int mt9t001_video_probe(struct i2c_client *client)
-{
-	struct mt9t001_platform_data *pdata = client->dev.platform_data;
-	s32 data;
-	int ret;
-
-	dev_info(&client->dev, "Probing MT9T001 at address 0x%02x\n",
-		 client->addr);
-
-	/* Reset the chip and stop data read out */
-	ret = mt9t001_write(client, MT9T001_RESET, 1);
-	if (ret < 0)
-		return ret;
-
-	ret = mt9t001_write(client, MT9T001_RESET, 0);
-	if (ret < 0)
-		return ret;
-
-	ret  = mt9t001_write(client, MT9T001_OUTPUT_CONTROL, 0);
-	if (ret < 0)
-		return ret;
-
-	/* Configure the pixel clock polarity */
-	if (pdata->clk_pol) {
-		ret  = mt9t001_write(client, MT9T001_PIXEL_CLOCK,
-				     MT9T001_PIXEL_CLOCK_INVERT);
-		if (ret < 0)
-			return ret;
-	}
-
-	/* Read and check the sensor version */
-	data = mt9t001_read(client, MT9T001_CHIP_VERSION);
-	if (data != MT9T001_CHIP_ID) {
-		dev_err(&client->dev, "MT9T001 not detected, wrong version "
-			"0x%04x\n", data);
-		return -ENODEV;
-	}
-
-	dev_info(&client->dev, "MT9T001 detected at address 0x%02x\n",
-		 client->addr);
-
-	return ret;
-}
-
 static int mt9t001_probe(struct i2c_client *client,
 			 const struct i2c_device_id *did)
 {
@@ -740,14 +838,22 @@ static int mt9t001_probe(struct i2c_client *client,
 		return -EIO;
 	}
 
-	ret = mt9t001_video_probe(client);
-	if (ret < 0)
-		return ret;
-
 	mt9t001 = devm_kzalloc(&client->dev, sizeof(*mt9t001), GFP_KERNEL);
 	if (!mt9t001)
 		return -ENOMEM;
 
+	mutex_init(&mt9t001->power_lock);
+	mt9t001->output_control = MT9T001_OUTPUT_CONTROL_DEF;
+
+	mt9t001->regulators[0].supply = "vdd";
+	mt9t001->regulators[1].supply = "vaa";
+
+	ret = devm_regulator_bulk_get(&client->dev, 2, mt9t001->regulators);
+	if (ret < 0) {
+		dev_err(&client->dev, "Unable to get regulators\n");
+		return ret;
+	}
+
 	v4l2_ctrl_handler_init(&mt9t001->ctrls, ARRAY_SIZE(mt9t001_ctrls) +
 						ARRAY_SIZE(mt9t001_gains) + 4);
 
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 3/5] mt9t001: Add clock support
From: Laurent Pinchart @ 2014-02-10 21:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392069284-18024-1-git-send-email-laurent.pinchart@ideasonboard.com>

The sensor needs a master clock, handle it explictly in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9t001.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index 9a0bb06..422e068 100644
--- a/drivers/media/i2c/mt9t001.c
+++ b/drivers/media/i2c/mt9t001.c
@@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/clk.h>
 #include <linux/i2c.h>
 #include <linux/log2.h>
 #include <linux/module.h>
@@ -118,6 +119,7 @@ struct mt9t001 {
 	struct v4l2_subdev subdev;
 	struct media_pad pad;
 
+	struct clk *clk;
 	struct regulator_bulk_data regulators[2];
 
 	struct mutex power_lock; /* lock to protect power_count */
@@ -189,9 +191,21 @@ static int mt9t001_reset(struct mt9t001 *mt9t001)
 
 static int mt9t001_power_on(struct mt9t001 *mt9t001)
 {
+	int ret;
+
 	/* Bring up the supplies */
-	return regulator_bulk_enable(ARRAY_SIZE(mt9t001->regulators),
-				     mt9t001->regulators);
+	ret = regulator_bulk_enable(ARRAY_SIZE(mt9t001->regulators),
+				   mt9t001->regulators);
+	if (ret < 0)
+		return ret;
+
+	/* Enable clock */
+	ret = clk_prepare_enable(mt9t001->clk);
+	if (ret < 0)
+		regulator_bulk_disable(ARRAY_SIZE(mt9t001->regulators),
+				       mt9t001->regulators);
+
+	return ret;
 }
 
 static void mt9t001_power_off(struct mt9t001 *mt9t001)
@@ -199,6 +213,9 @@ static void mt9t001_power_off(struct mt9t001 *mt9t001)
 	regulator_bulk_disable(ARRAY_SIZE(mt9t001->regulators),
 			       mt9t001->regulators);
 
+	clk_disable_unprepare(mt9t001->clk);
+}
+
 static int __mt9t001_set_power(struct mt9t001 *mt9t001, bool on)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&mt9t001->subdev);
@@ -854,6 +871,12 @@ static int mt9t001_probe(struct i2c_client *client,
 		return ret;
 	}
 
+	mt9t001->clk = devm_clk_get(&client->dev, NULL);
+	if (IS_ERR(mt9t001->clk)) {
+		dev_err(&client->dev, "Unable to get clock\n");
+		return PTR_ERR(mt9t001->clk);
+	}
+
 	v4l2_ctrl_handler_init(&mt9t001->ctrls, ARRAY_SIZE(mt9t001_ctrls) +
 						ARRAY_SIZE(mt9t001_gains) + 4);
 
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 4/5] mt9p031: Fix typo in comment
From: Laurent Pinchart @ 2014-02-10 21:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392069284-18024-1-git-send-email-laurent.pinchart@ideasonboard.com>

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9p031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 05278f5..14a616e 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -288,7 +288,7 @@ static int mt9p031_power_on(struct mt9p031 *mt9p031)
 	if (ret < 0)
 		return ret;
 
-	/* Emable clock */
+	/* Enable clock */
 	if (mt9p031->clk) {
 		ret = clk_prepare_enable(mt9p031->clk);
 		if (ret) {
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH 5/5] mt9p031: Add support for PLL bypass
From: Laurent Pinchart @ 2014-02-10 21:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392069284-18024-1-git-send-email-laurent.pinchart@ideasonboard.com>

When the input clock frequency is out of bounds for the PLL, bypass the
PLL and just divide the input clock to achieve the requested output
frequency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9p031.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 14a616e..5483ab2 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -78,6 +78,9 @@
 #define	MT9P031_PLL_CONFIG_1				0x11
 #define	MT9P031_PLL_CONFIG_2				0x12
 #define MT9P031_PIXEL_CLOCK_CONTROL			0x0a
+#define		MT9P031_PIXEL_CLOCK_INVERT		(1 << 15)
+#define		MT9P031_PIXEL_CLOCK_SHIFT(n)		((n) << 8)
+#define		MT9P031_PIXEL_CLOCK_DIVIDE(n)		((n) << 0)
 #define MT9P031_FRAME_RESTART				0x0b
 #define MT9P031_SHUTTER_DELAY				0x0c
 #define MT9P031_RST					0x0d
@@ -130,6 +133,8 @@ struct mt9p031 {
 
 	enum mt9p031_model model;
 	struct aptina_pll pll;
+	unsigned int clk_div;
+	bool use_pll;
 	int reset;
 
 	struct v4l2_ctrl_handler ctrls;
@@ -198,6 +203,11 @@ static int mt9p031_reset(struct mt9p031 *mt9p031)
 	if (ret < 0)
 		return ret;
 
+	ret = mt9p031_write(client, MT9P031_PIXEL_CLOCK_CONTROL,
+			    MT9P031_PIXEL_CLOCK_DIVIDE(mt9p031->clk_div));
+	if (ret < 0)
+		return ret;
+
 	return mt9p031_set_output_control(mt9p031, MT9P031_OUTPUT_CONTROL_CEN,
 					  0);
 }
@@ -232,8 +242,24 @@ static int mt9p031_clk_setup(struct mt9p031 *mt9p031)
 	if (ret < 0)
 		return ret;
 
+	/* If the external clock frequency is out of bounds for the PLL use the
+	 * pixel clock divider only and disable the PLL.
+	 */
+	if (pdata->ext_freq > limits.ext_clock_max) {
+		unsigned int div;
+
+		div = DIV_ROUND_UP(pdata->ext_freq, pdata->target_freq);
+		div = roundup_pow_of_two(div) / 2;
+
+		mt9p031->clk_div = max_t(unsigned int, div, 64);
+		mt9p031->use_pll = false;
+
+		return 0;
+	}
+
 	mt9p031->pll.ext_clock = pdata->ext_freq;
 	mt9p031->pll.pix_clock = pdata->target_freq;
+	mt9p031->use_pll = true;
 
 	return aptina_pll_calculate(&client->dev, &limits, &mt9p031->pll);
 }
@@ -243,6 +269,9 @@ static int mt9p031_pll_enable(struct mt9p031 *mt9p031)
 	struct i2c_client *client = v4l2_get_subdevdata(&mt9p031->subdev);
 	int ret;
 
+	if (!mt9p031->use_pll)
+		return 0;
+
 	ret = mt9p031_write(client, MT9P031_PLL_CONTROL,
 			    MT9P031_PLL_CONTROL_PWRON);
 	if (ret < 0)
@@ -268,6 +297,9 @@ static inline int mt9p031_pll_disable(struct mt9p031 *mt9p031)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&mt9p031->subdev);
 
+	if (!mt9p031->use_pll)
+		return 0;
+
 	return mt9p031_write(client, MT9P031_PLL_CONTROL,
 			     MT9P031_PLL_CONTROL_PWROFF);
 }
-- 
1.8.3.2

^ permalink raw reply related

* [PATCHv2 2/2] arm: Get rid of meminfo
From: Grant Likely @ 2014-02-10 21:58 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1391558551-31395-3-git-send-email-lauraa@codeaurora.org>

On Wed, Feb 5, 2014 at 12:02 AM, Laura Abbott <lauraa@codeaurora.org> wrote:
> memblock is now fully integrated into the kernel and is the prefered
> method for tracking memory. Rather than reinvent the wheel with
> meminfo, migrate to using memblock directly instead of meminfo as
> an intermediate.
>
> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
> ---
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index b0df976..b6de661 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -625,15 +625,8 @@ void __init dump_machine_table(void)
>
>  int __init arm_add_memory(u64 start, u64 size)
>  {
> -       struct membank *bank = &meminfo.bank[meminfo.nr_banks];
>         u64 aligned_start;

With the changes to this function, I think you can outright remove
early_init_dt_add_memory_arch() from arch/arm/kernel/devtree.c. The
default implementation (__weak) in drivers/of/fdt.c uses memblock
directly.

g.

^ permalink raw reply

* [PATCH v2 4/5] ARM: init: add support for reserved memory defined by device tree
From: Grant Likely @ 2014-02-10 21:59 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <52F38D75.4030704@samsung.com>

On Thu, 06 Feb 2014 14:26:13 +0100, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> Hello,
> 
> On 2014-02-05 11:15, Grant Likely wrote:
> > On Tue, 04 Feb 2014 13:09:32 +0100, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> > > Enable reserved memory initialization from device tree.
> > >
> > > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > > Cc: Laura Abbott <lauraa@codeaurora.org>
> > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > > ---
> > >  arch/arm/mm/init.c |    3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> > > index 804d61566a53..ebafdb479410 100644
> > > --- a/arch/arm/mm/init.c
> > > +++ b/arch/arm/mm/init.c
> > > @@ -17,6 +17,7 @@
> > >  #include <linux/nodemask.h>
> > >  #include <linux/initrd.h>
> > >  #include <linux/of_fdt.h>
> > > +#include <linux/of_reserved_mem.h>
> > >  #include <linux/highmem.h>
> > >  #include <linux/gfp.h>
> > >  #include <linux/memblock.h>
> > > @@ -323,6 +324,8 @@ void __init arm_memblock_init(struct meminfo *mi,
> > >  	if (mdesc->reserve)
> > >  		mdesc->reserve();
> > >
> > > +	early_init_dt_scan_reserved_mem();
> > > +
> >
> > The new binding is being made fundamental. If the reserved-memory node
> > is present, then it needs to be honored, even if the kernel doesn't know
> > how to use the regions. Therefore, This needs to be unconditional for
> > all architectures. The hook should be called in early_init_dt_scan()
> > (drivers/of/fdt.c) immediately after the early_init_dt_scan_memory()
> > hook.
> 
> In theory this will be the best solution, but it practice there is a
> problem. early_init_dt_scan() is called as the first function from kernel
> booting code. That time there is no memory yet added to the system, so it
> would be really hard to reserve anything. Memory nodes are being added
> later either with memblock_add() or by some other arch specific way.

Hmmm, depends on the architecture. On ARM the memory is loaded into the
meminfo structure first, and it isn't until arm_memblock_init() that
memblock_add() gets called on all the regions. Some architectures do the
memblock_add() directly from early_init_dt_add_memory_arch() function.

The default early_init_dt_add_memory_arch() in drivers/of/fdt.c is
overridden by ARM and a number of other architectures. However...

> Finally, once all memory has been added to the system we can parse and
> reserve all regions defined in the device tree. This really requires
> creating another function which will be called by arch specific code.

...Or it means getting rid of meminfo entirely so that memblock is
available earlier. Laura Abbott has just posted v2 of her series to do
exactly that. If you base on that then you should be able to do exactly
what I suggested.

g.

^ permalink raw reply

* [PATCHv2 2/2] arm: Get rid of meminfo
From: Laura Abbott @ 2014-02-10 21:59 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140210172808.GS1706@sonymobile.com>

On 2/10/2014 9:28 AM, Courtney Cavin wrote:
> On Mon, Feb 10, 2014 at 04:25:34AM +0100, Laura Abbott wrote:
>> On 2/6/2014 6:09 PM, Courtney Cavin wrote:
>>> On Wed, Feb 05, 2014 at 01:02:31AM +0100, Laura Abbott wrote:
>>>> memblock is now fully integrated into the kernel and is the prefered
>>>> method for tracking memory. Rather than reinvent the wheel with
>>>> meminfo, migrate to using memblock directly instead of meminfo as
>>>> an intermediate.
>>>>
>>>> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
>>> [...]
>>>> diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
>>>> index 0b11c1a..51d814e 100644
>>>> --- a/arch/arm/mach-pxa/spitz.c
>>>> +++ b/arch/arm/mach-pxa/spitz.c
>>>> @@ -32,6 +32,7 @@
>>>>    #include <linux/io.h>
>>>>    #include <linux/module.h>
>>>>    #include <linux/reboot.h>
>>>> +#include <linux/memblock.h>
>>>>
>>>>    #include <asm/setup.h>
>>>>    #include <asm/mach-types.h>
>>>> @@ -971,13 +972,9 @@ static void __init spitz_init(void)
>>>>           spitz_i2c_init();
>>>>    }
>>>>
>>>> -static void __init spitz_fixup(struct tag *tags, char **cmdline,
>>>> -                              struct meminfo *mi)
>>>> +static void __init spitz_fixup(struct tag *tags, char **cmdline)
>>>>    {
>>>> -       sharpsl_save_param();
>>>> -       mi->nr_banks = 1;
>>>> -       mi->bank[0].start = 0xa0000000;
>>>> -       mi->bank[0].size = (64*1024*1024);
>>>> +       memblock_addr(0xa0000000, SZ_64M);
>>>
>>> memblock_add() ?
>> Yes, that was a typo on my part. I'll send out a v3 with collected acks.
>>
>
> So, I also just noticed that you specifically remove the call to
> sharpsl_save_param() here.  I'm presuming that this is also an error, as
> you haven't removed it from any of the other pxa fixups, and it seems
> unrelated to the change.
>
> -Courtney

Clearly not my finest hour at all. Thanks for reviewing.

Laura


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply

* [linux-sunxi] Re: [PATCH 3/3] mfd: axp20x: Add bindings documentation
From: Maxime Ripard @ 2014-02-10 22:01 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAOQ7t2YBhUuVQuDhkCux4ogb8_W2Ja1RMn4+UtcUpYrR84Boug@mail.gmail.com>

On Mon, Feb 10, 2014 at 09:37:37PM +0100, Carlo Caione wrote:
> >> +Sub-nodes
> >> +* regulators : Contain the regulator nodes. The regulators are bound using
> >> +            their name as listed here: dcdc2, dcdc3, ldo1, ldo2, ldo3,
> >> +            ldo4, ldo5.
> >> +            The bindings details of individual regulator device can be found in:
> >> +            Documentation/devicetree/bindings/regulator/regulator.txt with the
> >> +            exception of:
> >
> > I'm guessing this is where you differentiate between AXP202 and
> > AXP209?
> 
> Not really. AXP202 and AXP209 have the same regulators (with the same
> constrains)

Ok. What's the difference between the two then?

Thanks,

-- 
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: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140210/7fcfc338/attachment.sig>

^ permalink raw reply

* [PATCH 14/28] Remove MACH_SMDKC210
From: Paul Bolle @ 2014-02-10 22:09 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140210163621.GA13533@sirena.org.uk>

On Mon, 2014-02-10 at 16:36 +0000, Mark Brown wrote:
> On Mon, Feb 10, 2014 at 04:30:42PM +0100, Paul Bolle wrote:
> > So, next step: the Kconfig symbols MACH_SMDKV310 and MACH_SMDKC210 were
> > removed in commit 383ffda2fa ("ARM: EXYNOS: no more support non-DT for
> > EXYNOS SoCs"). That commit was part of v3.11. Correct?
> 
> Indeed, so we can see that these platforms were converted to use DT and
> the symbols were removed as a result.  This means that a good fix here
> is to ensure that the driver can be used with DT platforms.

One of the problems I face is that I find it hard to understand how this
stuff works in v3.10 (ie, before MACH_SMDKV310 and MACH_SMDKC210 were
dropped).

See, if you scan v3.10:arch/arm/mach-exynos/mach-smdkv310.c you'll
notice the string "smdk-audio". If you grep that string you get a few
hits. But none in v3.10:sound/soc/samsung/smdk_wm9713.c. And if you scan
v3.10:sound/soc/samsung/smdk_wm9713.c for strings you'll find stuff like
"wm9713-hifi",  "wm9713-codec", and "soc-audio". But these don't show up
in v3.10:arch/arm/mach-exynos/mach-smdkv310.c. So it's not obvious how
these two files relate.

And I'm left wondering why SND_SOC_SAMSUNG_SMDK_WM9713 actually depends
on (among other symbols) MACH_SMDKV310 and MACH_SMDKC210 in v3.10.


Paul Bolle

^ permalink raw reply

* [linux-sunxi] Re: [PATCH 1/3] mfd: axp20x: Add mfd driver for axp20x PMIC
From: Carlo Caione @ 2014-02-10 22:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140210211900.GC32042@lee--X1>

On Mon, Feb 10, 2014 at 10:19 PM, Lee Jones <lee.jones@linaro.org> wrote:
>> This patch introduces the preliminary support for PMICs X-Powers AXP202
>> and AXP209. The core contains support only for two sub-modules (PEK
>> and regulators) that will be added with two different patch-sets.
>>
>> Signed-off-by: Carlo Caione <carlo@caione.org>
>> ---
>>  drivers/mfd/Kconfig        |  12 +++
>>  drivers/mfd/Makefile       |   1 +
>>  drivers/mfd/axp20x.c       | 251 +++++++++++++++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h | 178 ++++++++++++++++++++++++++++++++
>>  4 files changed, 442 insertions(+)
>>  create mode 100644 drivers/mfd/axp20x.c
>>  create mode 100644 include/linux/mfd/axp20x.h
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index dd67158..33d38c4 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -59,6 +59,18 @@ config MFD_AAT2870_CORE
>>         additional drivers must be enabled in order to use the
>>         functionality of the device.
>
> <snip>
>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> new file mode 100644
>> index 0000000..efd0cb3
>> --- /dev/null
>> +++ b/drivers/mfd/axp20x.c
>> @@ -0,0 +1,251 @@
>> +/*
>
> A nice descriptive title here would be good.

Agree.

>> + * Author: Carlo Caione <carlo@caione.org>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/i2c.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/pm_runtime.h>
>> +#include <linux/regmap.h>
>> +#include <linux/slab.h>
>> +#include <linux/regulator/consumer.h>
>> +#include <linux/mfd/axp20x.h>
>> +#include <linux/mfd/core.h>
>> +#include <linux/of_device.h>
>> +#include <linux/of_irq.h>
>> +
>> +static const struct regmap_range axp20x_writeable_ranges[] = {
>> +     {
>> +             .range_min = AXP20X_DATA(0),
>> +             .range_max = AXP20X_IRQ5_STATE,
>> +     }, {
>> +             .range_min = AXP20X_DCDC_MODE,
>> +             .range_max = AXP20X_FG_RES,
>> +     },
>> +};
>> +
>> +static const struct regmap_range axp20x_volatile_ranges[] = {
>> +     {
>> +             .range_min = AXP20X_IRQ1_EN,
>> +             .range_max = AXP20X_IRQ5_STATE,
>> +     },
>> +};
>> +
>> +static const struct regmap_access_table axp20x_writeable_table = {
>> +     .yes_ranges     = axp20x_writeable_ranges,
>> +     .n_yes_ranges   = ARRAY_SIZE(axp20x_writeable_ranges),
>> +};
>> +
>> +static const struct regmap_access_table axp20x_volatile_table = {
>> +     .yes_ranges     = axp20x_volatile_ranges,
>> +     .n_yes_ranges   = ARRAY_SIZE(axp20x_volatile_ranges),
>> +};
>> +
>> +static struct resource axp20x_pek_resources[] = {
>> +     {
>> +             .name   = "PEK_DBR",
>> +             .start  = AXP20X_IRQ_PEK_RIS_EDGE,
>> +             .end    = AXP20X_IRQ_PEK_RIS_EDGE,
>> +             .flags  = IORESOURCE_IRQ,
>> +     },
>> +     {
>> +             .name   = "PEK_DBF",
>> +             .start  = AXP20X_IRQ_PEK_FAL_EDGE,
>> +             .end    = AXP20X_IRQ_PEK_FAL_EDGE,
>> +             .flags  = IORESOURCE_IRQ,
>> +     },
>> +
>
> Superfluous new line.
>
>> +};
>> +
>> +static const struct regmap_config axp20x_regmap_config = {
>> +     .reg_bits       = 8,
>> +     .val_bits       = 8,
>> +     .wr_table       = &axp20x_writeable_table,
>> +     .volatile_table = &axp20x_volatile_table,
>> +     .max_register   = AXP20X_FG_RES,
>> +     .cache_type     = REGCACHE_RBTREE,
>> +};
>> +
>> +#define AXP20X_IRQ(_irq, _off, _mask) \
>> +     [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
>> +
>> +static const struct regmap_irq axp20x_regmap_irqs[] = {
>> +     AXP20X_IRQ(ACIN_OVER_V,         0, 7),
>> +     AXP20X_IRQ(ACIN_PLUGIN,         0, 6),
>> +     AXP20X_IRQ(ACIN_REMOVAL,        0, 5),
>> +     AXP20X_IRQ(VBUS_OVER_V,         0, 4),
>> +     AXP20X_IRQ(VBUS_PLUGIN,         0, 3),
>> +     AXP20X_IRQ(VBUS_REMOVAL,        0, 2),
>> +     AXP20X_IRQ(VBUS_V_LOW,          0, 1),
>> +     AXP20X_IRQ(BATT_PLUGIN,         1, 7),
>> +     AXP20X_IRQ(BATT_REMOVAL,        1, 6),
>> +     AXP20X_IRQ(BATT_ENT_ACT_MODE,   1, 5),
>> +     AXP20X_IRQ(BATT_EXIT_ACT_MODE,  1, 4),
>> +     AXP20X_IRQ(CHARG,               1, 3),
>> +     AXP20X_IRQ(CHARG_DONE,          1, 2),
>> +     AXP20X_IRQ(BATT_TEMP_HIGH,      1, 1),
>> +     AXP20X_IRQ(BATT_TEMP_LOW,       1, 0),
>> +     AXP20X_IRQ(DIE_TEMP_HIGH,       2, 7),
>> +     AXP20X_IRQ(CHARG_I_LOW,         2, 6),
>> +     AXP20X_IRQ(DCDC1_V_LONG,        2, 5),
>> +     AXP20X_IRQ(DCDC2_V_LONG,        2, 4),
>> +     AXP20X_IRQ(DCDC3_V_LONG,        2, 3),
>> +     AXP20X_IRQ(PEK_SHORT,           2, 1),
>> +     AXP20X_IRQ(PEK_LONG,            2, 0),
>> +     AXP20X_IRQ(N_OE_PWR_ON,         3, 7),
>> +     AXP20X_IRQ(N_OE_PWR_OFF,        3, 6),
>> +     AXP20X_IRQ(VBUS_VALID,          3, 5),
>> +     AXP20X_IRQ(VBUS_NOT_VALID,      3, 4),
>> +     AXP20X_IRQ(VBUS_SESS_VALID,     3, 3),
>> +     AXP20X_IRQ(VBUS_SESS_END,       3, 2),
>> +     AXP20X_IRQ(LOW_PWR_LVL1,        3, 1),
>> +     AXP20X_IRQ(LOW_PWR_LVL2,        3, 0),
>> +     AXP20X_IRQ(TIMER,               4, 7),
>> +     AXP20X_IRQ(PEK_RIS_EDGE,        4, 6),
>> +     AXP20X_IRQ(PEK_FAL_EDGE,        4, 5),
>> +     AXP20X_IRQ(GPIO3_INPUT,         4, 3),
>> +     AXP20X_IRQ(GPIO2_INPUT,         4, 2),
>> +     AXP20X_IRQ(GPIO1_INPUT,         4, 1),
>> +     AXP20X_IRQ(GPIO0_INPUT,         4, 0),
>> +};
>
> Where are these handled i.e. where is the irq_handler located?

Each one is used by a different driver for each subsystem of the MFD,
so each driver will have a specific irq_handler. I need the full list
here to register with regmap_add_irq_chip() the generic
regmap_irq_thread.

>> +static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
>> +     .name                   = "axp20x_irq_chip",
>> +     .status_base            = AXP20X_IRQ1_STATE,
>> +     .ack_base               = AXP20X_IRQ1_STATE,
>> +     .mask_base              = AXP20X_IRQ1_EN,
>> +     .num_regs               = 5,
>> +     .irqs                   = axp20x_regmap_irqs,
>> +     .num_irqs               = ARRAY_SIZE(axp20x_regmap_irqs),
>> +     .mask_invert            = 1,
>
> This is a bool; true or false please.
>
>> +     .init_ack_masked        = 1,
>
> Same here.

I'll fix both in v2.

>> +};
>> +
>> +static struct mfd_cell axp20x_cells[] = {
>> +     {
>> +             .name           = "axp20x-pek",
>> +             .of_compatible  = "x-powers,axp20x-pek",
>> +             .num_resources  = ARRAY_SIZE(axp20x_pek_resources),
>> +             .resources      = axp20x_pek_resources,
>
> I already saw the comments about these.
>
>> +     }, {
>> +             .name           = "axp20x-regulator",
>> +     },
>> +};
>> +
>> +const struct of_device_id axp20x_of_match[] = {
>> +     { .compatible = "x-powers,axp20x", .data = (void *)AXP20X },
>
> There's no need to add device IDs if you only support one device.

Ok. But what if in the future we want to add a new device?

>> +     { },
>> +};
>> +
>> +static struct axp20x_dev *axp20x_pm_power_off;
>
> This looks pretty unconventional. What's the point of it?

On a single board we can have multiple AXPs so I track which one is in
charge of powering off the board (and to get the correct device in the
axp20x_power_off())

>> +static void axp20x_power_off(void)
>> +{
>> +     regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, 0x80);
>
> What does the 0x80 do exactly? Think about #defining.

It's only used here, but I'll #define it.

>> +}
>> +
>> +static int axp20x_i2c_probe(struct i2c_client *i2c,
>> +                      const struct i2c_device_id *id)
>> +{
>> +     struct axp20x_dev *axp20x;
>> +     const struct of_device_id *of_id;
>> +     int ret;
>> +
>> +     axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
>> +     if (!axp20x)
>> +             return -ENOMEM;
>> +
>> +     of_id = of_match_device(axp20x_of_match, &i2c->dev);
>> +     if (!of_id) {
>> +             dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
>> +             return -ENODEV;
>> +     }
>> +     axp20x->variant = (int) of_id->data;
>
> Lots of code here surrounding added device support, but only one
> device is supported. Why so?

Because at the moment I support only axp202 and axp209 but I wanted
something future-proof

>> +     axp20x->i2c_client = i2c;
>> +     i2c_set_clientdata(i2c, axp20x);
>> +
>> +     axp20x->dev = &i2c->dev;
>> +     dev_set_drvdata(axp20x->dev, axp20x);
>
> Do you make use of all this saving of the device container?
>
> If so, where?

In the drivers for subsystems (input, regulators, gpio, etc..)

> Also:
>   i2c_set_clientdata(i2c)
>
> and:
>   dev_set_drvdata(i2c->dev);
>
> ... do exactly the same thing i.e. set i2c->dev->p->device_data.

Right.

>> +     axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
>> +     if (IS_ERR(axp20x->regmap)) {
>> +             ret = PTR_ERR(axp20x->regmap);
>> +             dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     axp20x->irq = i2c->irq;
>> +     ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
>> +                               IRQF_ONESHOT | IRQF_SHARED, -1,
>> +                               &axp20x_regmap_irq_chip,
>> +                               &axp20x->regmap_irqc);
>> +     if (ret != 0) {
>
> It's more succinct to say:
>   if (!ret)

Agree

>> +             dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
>> +                           ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
>> +     if (ret != 0) {
>> +             dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
>> +             goto mfd_err;
>> +     }
>> +
>> +     if (!pm_power_off) {
>> +             axp20x_pm_power_off = axp20x;
>> +             pm_power_off = axp20x_power_off;
>> +     }
>
> Can you describe to me what you're using the pm_power_off call-back
> for please?

It's meant to poweroff the board

>> +     dev_info(&i2c->dev, "AXP20X driver loaded\n");
>> +
>> +     return 0;
>> +
>> +mfd_err:
>> +     regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
>> +
>> +     return ret;
>> +}
>> +
>> +static int axp20x_i2c_remove(struct i2c_client *i2c)
>> +{
>> +     struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
>> +
>> +     if (axp20x == axp20x_pm_power_off) {
>> +             axp20x_pm_power_off = NULL;
>> +             pm_power_off = NULL;
>> +     }
>> +
>> +     mfd_remove_devices(axp20x->dev);
>> +     regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc);
>> +
>> +     return 0;
>> +}
>> +
>> +static const struct i2c_device_id axp20x_i2c_id[] = {
>> +     { "axp20x", AXP20X },
>
> It doesn't look like you're using this ID either?

No, I am not. I'll fix it in v2.

>> +     { }
>> +};
>> +MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
>> +
>> +static struct i2c_driver axp20x_i2c_driver = {
>> +     .driver = {
>> +             .name   = "axp20x",
>> +             .owner  = THIS_MODULE,
>> +             .of_match_table = of_match_ptr(axp20x_of_match),
>> +     },
>> +     .probe          = axp20x_i2c_probe,
>> +     .remove         = axp20x_i2c_remove,
>> +     .id_table       = axp20x_i2c_id,
>> +};
>> +
>> +module_i2c_driver(axp20x_i2c_driver);
>> +
>> +MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
>> +MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
>> +MODULE_LICENSE("GPL");
>> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
>> new file mode 100644
>> index 0000000..94d99fd
>> --- /dev/null
>> +++ b/include/linux/mfd/axp20x.h
>> @@ -0,0 +1,178 @@
>> +/*
>> + * Functions to access AXP20X power management chip.
>> + *
>> + * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#ifndef __LINUX_MFD_AXP20X_H
>> +#define __LINUX_MFD_AXP20X_H
>> +
>> +#define AXP20X                               0
>> +
>> +#define AXP20X_DATA(m)                       (0x04 + (m))
>
> This is not a great name for a macro.  'data' and 'value' seldom make
> for good names for variables/macros.  Please replace it with something
> more descriptive.

Agree. I'll change it.

> In fact, on closer inspection it appears as though you only use this
> once while defining writable registers.  What happened to registers
> 0x00 to 0x03, and why have the top registers below been omitted from
> the range(s)?

All the registers defined here can be used by the drivers of the
different subsystems including this header file, thus all the
registers are reported here though they are not directly used by the
core driver.
About the range you are right, I'll fix it in v2. Thanks for noticing.

>> +
>> +/* Power supply */
>> +#define AXP20X_PWR_INPUT_STATUS              0x00
>> +#define AXP20X_PWR_OP_MODE           0x01
>> +#define AXP20X_USB_OTG_STATUS                0x02
>> +#define AXP20X_PWR_OUT_CTRL          0x12
>> +#define AXP20X_DCDC2_V_OUT           0x23
>> +#define AXP20X_DCDC2_LDO3_V_SCAL     0x25
>> +#define AXP20X_DCDC3_V_OUT           0x27
>> +#define AXP20X_LDO24_V_OUT           0x28
>> +#define AXP20X_LDO3_V_OUT            0x29
>> +#define AXP20X_VBUS_IPSOUT_MGMT              0x30
>> +#define AXP20X_V_OFF                 0x31
>> +#define AXP20X_OFF_CTRL                      0x32
>> +#define AXP20X_CHRG_CTRL1            0x33
>> +#define AXP20X_CHRG_CTRL2            0x34
>> +#define AXP20X_CHRG_BAK_CTRL         0x35
>> +#define AXP20X_PEK_KEY                       0x36
>> +#define AXP20X_DCDC_FREQ             0x37
>> +#define AXP20X_V_LTF_CHRG            0x38
>> +#define AXP20X_V_HTF_CHRG            0x39
>> +#define AXP20X_APS_WARN_L1           0x3a
>> +#define AXP20X_APS_WARN_L2           0x3b
>> +#define AXP20X_V_LTF_DISCHRG         0x3c
>> +#define AXP20X_V_HTF_DISCHRG         0x3d
>> +
>> +/* Interrupt */
>> +#define AXP20X_IRQ1_EN                       0x40
>> +#define AXP20X_IRQ2_EN                       0x41
>> +#define AXP20X_IRQ3_EN                       0x42
>> +#define AXP20X_IRQ4_EN                       0x43
>> +#define AXP20X_IRQ5_EN                       0x44
>> +#define AXP20X_IRQ1_STATE            0x48
>> +#define AXP20X_IRQ2_STATE            0x49
>> +#define AXP20X_IRQ3_STATE            0x4a
>> +#define AXP20X_IRQ4_STATE            0x4b
>> +#define AXP20X_IRQ5_STATE            0x4c
>> +
>> +/* ADC */
>> +#define AXP20X_ACIN_V_ADC_H          0x56
>> +#define AXP20X_ACIN_V_ADC_L          0x57
>> +#define AXP20X_ACIN_I_ADC_H          0x58
>> +#define AXP20X_ACIN_I_ADC_L          0x59
>> +#define AXP20X_VBUS_V_ADC_H          0x5a
>> +#define AXP20X_VBUS_V_ADC_L          0x5b
>> +#define AXP20X_VBUS_I_ADC_H          0x5c
>> +#define AXP20X_VBUS_I_ADC_L          0x5d
>> +#define AXP20X_TEMP_ADC_H            0x5e
>> +#define AXP20X_TEMP_ADC_L            0x5f
>> +#define AXP20X_TS_IN_H                       0x62
>> +#define AXP20X_TS_IN_L                       0x63
>> +#define AXP20X_GPIO0_V_ADC_H         0x64
>> +#define AXP20X_GPIO0_V_ADC_L         0x65
>> +#define AXP20X_GPIO1_V_ADC_H         0x66
>> +#define AXP20X_GPIO1_V_ADC_L         0x67
>> +#define AXP20X_PWR_BATT_H            0x70
>> +#define AXP20X_PWR_BATT_M            0x71
>> +#define AXP20X_PWR_BATT_L            0x72
>> +#define AXP20X_BATT_V_H                      0x78
>> +#define AXP20X_BATT_V_L                      0x79
>> +#define AXP20X_BATT_CHRG_I_H         0x7a
>> +#define AXP20X_BATT_CHRG_I_L         0x7b
>> +#define AXP20X_BATT_DISCHRG_I_H              0x7c
>> +#define AXP20X_BATT_DISCHRG_I_L              0x7d
>> +#define AXP20X_IPSOUT_V_HIGH_H               0x7e
>> +#define AXP20X_IPSOUT_V_HIGH_L               0x7f
>> +
>> +/* Power supply */
>> +#define AXP20X_DCDC_MODE             0x80
>> +#define AXP20X_ADC_EN1                       0x82
>> +#define AXP20X_ADC_EN2                       0x83
>> +#define AXP20X_ADC_RATE                      0x84
>> +#define AXP20X_GPIO10_IN_RANGE               0x85
>> +#define AXP20X_GPIO1_ADC_IRQ_RIS     0x86
>> +#define AXP20X_GPIO1_ADC_IRQ_FAL     0x87
>> +#define AXP20X_TIMER_CTRL            0x8a
>> +#define AXP20X_VBUS_MON                      0x8b
>> +#define AXP20X_OVER_TMP                      0x8f
>> +
>> +/* GPIO */
>> +#define AXP20X_GPIO0_CTRL            0x90
>> +#define AXP20X_LDO5_V_OUT            0x91
>> +#define AXP20X_GPIO1_CTRL            0x92
>> +#define AXP20X_GPIO2_CTRL            0x93
>> +#define AXP20X_GPIO20_SS             0x94
>> +#define AXP20X_GPIO3_CTRL            0x95
>> +
>> +/* Battery */
>> +#define AXP20X_CHRG_CC_31_24         0xb0
>> +#define AXP20X_CHRG_CC_23_16         0xb1
>> +#define AXP20X_CHRG_CC_15_8          0xb2
>> +#define AXP20X_CHRG_CC_7_0           0xb3
>> +#define AXP20X_DISCHRG_CC_31_24              0xb4
>> +#define AXP20X_DISCHRG_CC_23_16              0xb5
>> +#define AXP20X_DISCHRG_CC_15_8               0xb6
>> +#define AXP20X_DISCHRG_CC_7_0                0xb7
>> +#define AXP20X_CC_CTRL                       0xb8
>> +#define AXP20X_FG_RES                        0xb9
>> +
>> +/* Regulators IDs */
>> +enum {
>> +     AXP20X_LDO1 = 0,
>> +     AXP20X_LDO2,
>> +     AXP20X_LDO3,
>> +     AXP20X_LDO4,
>> +     AXP20X_LDO5,
>> +     AXP20X_DCDC2,
>> +     AXP20X_DCDC3,
>> +     AXP20X_REG_ID_MAX,
>> +};
>> +
>> +/* IRQs */
>> +enum {
>> +     AXP20X_IRQ_ACIN_OVER_V = 1,
>> +     AXP20X_IRQ_ACIN_PLUGIN,
>> +     AXP20X_IRQ_ACIN_REMOVAL,
>> +     AXP20X_IRQ_VBUS_OVER_V,
>> +     AXP20X_IRQ_VBUS_PLUGIN,
>> +     AXP20X_IRQ_VBUS_REMOVAL,
>> +     AXP20X_IRQ_VBUS_V_LOW,
>> +     AXP20X_IRQ_BATT_PLUGIN,
>> +     AXP20X_IRQ_BATT_REMOVAL,
>> +     AXP20X_IRQ_BATT_ENT_ACT_MODE,
>> +     AXP20X_IRQ_BATT_EXIT_ACT_MODE,
>> +     AXP20X_IRQ_CHARG,
>> +     AXP20X_IRQ_CHARG_DONE,
>> +     AXP20X_IRQ_BATT_TEMP_HIGH,
>> +     AXP20X_IRQ_BATT_TEMP_LOW,
>> +     AXP20X_IRQ_DIE_TEMP_HIGH,
>> +     AXP20X_IRQ_CHARG_I_LOW,
>> +     AXP20X_IRQ_DCDC1_V_LONG,
>> +     AXP20X_IRQ_DCDC2_V_LONG,
>> +     AXP20X_IRQ_DCDC3_V_LONG,
>> +     AXP20X_IRQ_PEK_SHORT = 22,
>> +     AXP20X_IRQ_PEK_LONG,
>> +     AXP20X_IRQ_N_OE_PWR_ON,
>> +     AXP20X_IRQ_N_OE_PWR_OFF,
>> +     AXP20X_IRQ_VBUS_VALID,
>> +     AXP20X_IRQ_VBUS_NOT_VALID,
>> +     AXP20X_IRQ_VBUS_SESS_VALID,
>> +     AXP20X_IRQ_VBUS_SESS_END,
>> +     AXP20X_IRQ_LOW_PWR_LVL1,
>> +     AXP20X_IRQ_LOW_PWR_LVL2,
>> +     AXP20X_IRQ_TIMER,
>> +     AXP20X_IRQ_PEK_RIS_EDGE,
>> +     AXP20X_IRQ_PEK_FAL_EDGE,
>> +     AXP20X_IRQ_GPIO3_INPUT,
>> +     AXP20X_IRQ_GPIO2_INPUT,
>> +     AXP20X_IRQ_GPIO1_INPUT,
>> +     AXP20X_IRQ_GPIO0_INPUT,
>> +};
>> +
>> +struct axp20x_dev {
>> +     struct device                   *dev;
>> +     struct i2c_client               *i2c_client;
>> +     struct regmap                   *regmap;
>> +     struct regmap_irq_chip_data     *regmap_irqc;
>> +     int                             variant;
>> +     int                             irq;
>> +};
>
> Is this used anywhere else except in the MFD driver?
>
> If not, consider moving it into the *.c file.

Yes, it is used by drivers of subsystems.

Thank you,

-- 
Carlo Caione

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox