All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-06-29 18:23 ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones, boris.brezillon, linux-arm-kernel, maxime.ripard,
	hdegoede, dmitry.torokhov, linux-input, linux-doc, linux-sunxi
  Cc: Carlo Caione

During the merging of v6 several patches were left out. This v7 comprises
all the patches that are still pending.

//--

AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
as well as 4 configurable GPIOs. 

This set of patches introduces the core driver and support for two different
subsystems:
	- Regulators
	- PEK (Power Enable Key)

Changes since v1:

	- Added a new standalone patch for defconfig

	- MFD core:
	  * Removed axp,system-power-controller property

	- Bindings documentation:
	  * Corrected description for dcdc-workmode property
	  * Removed unused axp20x-pek compatible

	- Input misc PEK driver:
	  * Fixed seconds in lower case

	- Regulators subsystem:
	  * Fixed axp20x_set_suspend_voltage()
	  * Switched to using multi-bit control for regulators
	  * When "regulators" node is not found driver doesn't quit
	  * Driver is now using devm_regulator_register()
	  * Added module_platform_driver() instead of subsys_initcall()

	- DT:
	  * Added new DTSI for AXP209
	  * Added support for cubietruck and olinuxino-micro

Changes since v2:

	- Added a new patch for multi_v7_defconfig to enable MFD core
	  and subsystems

	- DT:
	  * Dropped axp,system-power-controller property from DTS
	  * Moved compatible and interrupt-related properties from the
	    DTSI file to the DTS board files

	- Regulators subsystem:
	  * Deleted useless struct axp20x_regulators
	  * Added a warning when out of specs values are used for the
	    dcdc frequency

	- MFD core:
	  * Fixed coding style
	  * Removed IDs from device table for i2c

	- Bindings documentation:
	  * Several corrections and fixes

Changes since v3:

	- Removed x-powers-axp209.dtsi file
	- Rewritten bindings document

	- MFD core:
	  * Fixed casting
	  * Better comments / documentation

	- Input misc PEK driver:
	  * Timings are now expressed in ms and the sysfs appies the
	    closest possible value
	  * No more useless pretty-printing
	  * Removed devm_request_threaded_irq in favour of
	    devm_request_any_context_irq
	  * Moved from input attributes to platform device attributes

	- Regulators subsystem:
	  * Removed suspend mode (axp20x_set_suspend_voltage)
	  * Added regulators input supply

	- DT:
	  * DTs doesn't include anymore the dtsi
	  * Added input supplies for regulators

Changes since v4:

	- Removed regulator patches already applied / acked by Mark Brown

	- Input misc PEK driver:
	  * Don't print anymore the "us" unit
	  * Added cleanup for attributes when unbindind the device
	  * Fixed error code returned when device_create_file() fails

	- DT:
	  * Enable all the regulators on at boot-time
       	  * Removed min and max microvolts for all the regulators but DCDC2
	  * Moved the axp_ipsout regulator outside the MFD node
	  
	- MFD core:
	  * The supply regulators are now specified in the MFD driver using
	    regulator_bulk_register_supply_alias() and the .parent_supplies
	    in the MFD cell

Changes since v5:
	- Added ACKs
	- Fixed compilation warning (reported by Hans De Goede)
	- Vendor-prefixes are now sorted
	- Removed DT patch


Carlo Caione (6):
  mfd: AXP20x: Add bindings documentation
  dt-bindings: add vendor-prefix for X-Powers
  input: misc: Add driver for AXP20x Power Enable Key
  input: misc: Add ABI docs for AXP20x PEK
  ARM: sunxi: Add AXP20x support in defconfig
  ARM: sunxi: Add AXP20x support multi_v7_defconfig

 .../ABI/testing/sysfs-driver-input-axp-pek         |  11 +
 Documentation/devicetree/bindings/mfd/axp20x.txt   |  93 +++++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/configs/sunxi_defconfig                   |   3 +
 drivers/input/misc/Kconfig                         |  11 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/axp20x-pek.c                    | 281 +++++++++++++++++++++
 8 files changed, 404 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
 create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
 create mode 100644 drivers/input/misc/axp20x-pek.c

-- 
1.9.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-06-29 18:23 ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

During the merging of v6 several patches were left out. This v7 comprises
all the patches that are still pending.

//--

AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
as well as 4 configurable GPIOs. 

This set of patches introduces the core driver and support for two different
subsystems:
	- Regulators
	- PEK (Power Enable Key)

Changes since v1:

	- Added a new standalone patch for defconfig

	- MFD core:
	  * Removed axp,system-power-controller property

	- Bindings documentation:
	  * Corrected description for dcdc-workmode property
	  * Removed unused axp20x-pek compatible

	- Input misc PEK driver:
	  * Fixed seconds in lower case

	- Regulators subsystem:
	  * Fixed axp20x_set_suspend_voltage()
	  * Switched to using multi-bit control for regulators
	  * When "regulators" node is not found driver doesn't quit
	  * Driver is now using devm_regulator_register()
	  * Added module_platform_driver() instead of subsys_initcall()

	- DT:
	  * Added new DTSI for AXP209
	  * Added support for cubietruck and olinuxino-micro

Changes since v2:

	- Added a new patch for multi_v7_defconfig to enable MFD core
	  and subsystems

	- DT:
	  * Dropped axp,system-power-controller property from DTS
	  * Moved compatible and interrupt-related properties from the
	    DTSI file to the DTS board files

	- Regulators subsystem:
	  * Deleted useless struct axp20x_regulators
	  * Added a warning when out of specs values are used for the
	    dcdc frequency

	- MFD core:
	  * Fixed coding style
	  * Removed IDs from device table for i2c

	- Bindings documentation:
	  * Several corrections and fixes

Changes since v3:

	- Removed x-powers-axp209.dtsi file
	- Rewritten bindings document

	- MFD core:
	  * Fixed casting
	  * Better comments / documentation

	- Input misc PEK driver:
	  * Timings are now expressed in ms and the sysfs appies the
	    closest possible value
	  * No more useless pretty-printing
	  * Removed devm_request_threaded_irq in favour of
	    devm_request_any_context_irq
	  * Moved from input attributes to platform device attributes

	- Regulators subsystem:
	  * Removed suspend mode (axp20x_set_suspend_voltage)
	  * Added regulators input supply

	- DT:
	  * DTs doesn't include anymore the dtsi
	  * Added input supplies for regulators

Changes since v4:

	- Removed regulator patches already applied / acked by Mark Brown

	- Input misc PEK driver:
	  * Don't print anymore the "us" unit
	  * Added cleanup for attributes when unbindind the device
	  * Fixed error code returned when device_create_file() fails

	- DT:
	  * Enable all the regulators on at boot-time
       	  * Removed min and max microvolts for all the regulators but DCDC2
	  * Moved the axp_ipsout regulator outside the MFD node
	  
	- MFD core:
	  * The supply regulators are now specified in the MFD driver using
	    regulator_bulk_register_supply_alias() and the .parent_supplies
	    in the MFD cell

Changes since v5:
	- Added ACKs
	- Fixed compilation warning (reported by Hans De Goede)
	- Vendor-prefixes are now sorted
	- Removed DT patch


Carlo Caione (6):
  mfd: AXP20x: Add bindings documentation
  dt-bindings: add vendor-prefix for X-Powers
  input: misc: Add driver for AXP20x Power Enable Key
  input: misc: Add ABI docs for AXP20x PEK
  ARM: sunxi: Add AXP20x support in defconfig
  ARM: sunxi: Add AXP20x support multi_v7_defconfig

 .../ABI/testing/sysfs-driver-input-axp-pek         |  11 +
 Documentation/devicetree/bindings/mfd/axp20x.txt   |  93 +++++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/configs/sunxi_defconfig                   |   3 +
 drivers/input/misc/Kconfig                         |  11 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/axp20x-pek.c                    | 281 +++++++++++++++++++++
 8 files changed, 404 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
 create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
 create mode 100644 drivers/input/misc/axp20x-pek.c

-- 
1.9.1

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation
  2014-06-29 18:23 ` Carlo Caione
@ 2014-06-29 18:23   ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones, boris.brezillon, linux-arm-kernel, maxime.ripard,
	hdegoede, dmitry.torokhov, linux-input, linux-doc, linux-sunxi
  Cc: Carlo Caione

Bindings documentation for the AXP20x driver. In this file also
sub-nodes are documented.

Signed-off-by: Carlo Caione <carlo@caione.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
 1 file changed, 93 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..cc9e01b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,93 @@
+AXP202/AXP209 device tree bindings
+
+The axp20x family current members :-
+axp202 (X-Powers)
+axp209 (X-Powers)
+
+Required properties:
+- compatible: "x-powers,axp202" or "x-powers,axp209"
+- reg: The I2C slave address for the AXP chip
+- interrupt-parent: The parent interrupt controller
+- interrupts: Interrupt specifiers for interrupt sources
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- acin-supply: The input supply for LDO1
+- vin2-supply: The input supply for DCDC2
+- vin3-supply: The input supply for DCDC3
+- ldo24in-supply: The input supply for LDO2, LDO4
+- ldo3in-supply: The input supply for LDO3
+- ldo5in-supply: The input supply for LDO5
+
+- regulators: A node that houses a sub-node for each regulator. 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 x-powers,dcdc-freq
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+		      (range: 750-1875). Default: 1.5MHz
+
+Optional properties for DCDCs:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
+			  Default: AUTO mode
+
+Example:
+
+axp209: pmic@34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 8>;
+
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	acin-supply = <&axp_ipsout_reg>;
+	vin2-supply = <&axp_ipsout_reg>;
+	vin3-supply = <&axp_ipsout_reg>;
+	ldo24in-supply = <&axp_ipsout_reg>;
+	ldo3in-supply = <&axp_ipsout_reg>;
+	ldo5in-supply = <&axp_ipsout_reg>;
+
+	regulators {
+		x-powers,dcdc-freq = <1500>;
+
+		axp_vcore_reg: dcdc2 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <2275000>;
+			regulator-always-on;
+		};
+
+		axp_ddr_reg: dcdc3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+			regulator-always-on;
+		};
+
+		axp_rtc_reg: ldo1 {
+			regulator-always-on;
+		};
+
+		axp_analog_reg: ldo2 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+
+		axp_pll_reg: ldo3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+		};
+
+		axp_hdmi_reg: ldo4 {
+			regulator-min-microvolt = <1250000>;
+			regulator-max-microvolt = <3300000>;
+		};
+
+		axp_mic_reg: ldo5 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+		};
+	};
+};
+
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation
@ 2014-06-29 18:23   ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

Bindings documentation for the AXP20x driver. In this file also
sub-nodes are documented.

Signed-off-by: Carlo Caione <carlo@caione.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
 1 file changed, 93 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..cc9e01b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,93 @@
+AXP202/AXP209 device tree bindings
+
+The axp20x family current members :-
+axp202 (X-Powers)
+axp209 (X-Powers)
+
+Required properties:
+- compatible: "x-powers,axp202" or "x-powers,axp209"
+- reg: The I2C slave address for the AXP chip
+- interrupt-parent: The parent interrupt controller
+- interrupts: Interrupt specifiers for interrupt sources
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- acin-supply: The input supply for LDO1
+- vin2-supply: The input supply for DCDC2
+- vin3-supply: The input supply for DCDC3
+- ldo24in-supply: The input supply for LDO2, LDO4
+- ldo3in-supply: The input supply for LDO3
+- ldo5in-supply: The input supply for LDO5
+
+- regulators: A node that houses a sub-node for each regulator. 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 x-powers,dcdc-freq
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+		      (range: 750-1875). Default: 1.5MHz
+
+Optional properties for DCDCs:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
+			  Default: AUTO mode
+
+Example:
+
+axp209: pmic at 34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 8>;
+
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	acin-supply = <&axp_ipsout_reg>;
+	vin2-supply = <&axp_ipsout_reg>;
+	vin3-supply = <&axp_ipsout_reg>;
+	ldo24in-supply = <&axp_ipsout_reg>;
+	ldo3in-supply = <&axp_ipsout_reg>;
+	ldo5in-supply = <&axp_ipsout_reg>;
+
+	regulators {
+		x-powers,dcdc-freq = <1500>;
+
+		axp_vcore_reg: dcdc2 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <2275000>;
+			regulator-always-on;
+		};
+
+		axp_ddr_reg: dcdc3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+			regulator-always-on;
+		};
+
+		axp_rtc_reg: ldo1 {
+			regulator-always-on;
+		};
+
+		axp_analog_reg: ldo2 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+
+		axp_pll_reg: ldo3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+		};
+
+		axp_hdmi_reg: ldo4 {
+			regulator-min-microvolt = <1250000>;
+			regulator-max-microvolt = <3300000>;
+		};
+
+		axp_mic_reg: ldo5 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+		};
+	};
+};
+
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 2/6] dt-bindings: add vendor-prefix for X-Powers
  2014-06-29 18:23 ` Carlo Caione
@ 2014-06-29 18:23     ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
  Cc: Carlo Caione

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 46a311e..0d5a80c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -140,6 +140,7 @@ voipac	Voipac Technologies s.r.o.
 winbond Winbond Electronics corp.
 wlf	Wolfson Microelectronics
 wm	Wondermedia Technologies, Inc.
+x-powers	X-Powers
 xes	Extreme Engineering Solutions (X-ES)
 xlnx	Xilinx
 zyxel	ZyXEL Communications Corp.
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 2/6] dt-bindings: add vendor-prefix for X-Powers
@ 2014-06-29 18:23     ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 46a311e..0d5a80c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -140,6 +140,7 @@ voipac	Voipac Technologies s.r.o.
 winbond Winbond Electronics corp.
 wlf	Wolfson Microelectronics
 wm	Wondermedia Technologies, Inc.
+x-powers	X-Powers
 xes	Extreme Engineering Solutions (X-ES)
 xlnx	Xilinx
 zyxel	ZyXEL Communications Corp.
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key
  2014-06-29 18:23 ` Carlo Caione
@ 2014-06-29 18:23     ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
  Cc: Carlo Caione

This patch add support for the Power Enable Key found on MFD AXP202 and
AXP209. Besides the basic support for the button, the driver adds two
entries in sysfs to configure the time delay for power on/off.

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/input/misc/Kconfig      |  11 ++
 drivers/input/misc/Makefile     |   1 +
 drivers/input/misc/axp20x-pek.c | 281 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/input/misc/axp20x-pek.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 2ff4425..3fa6229 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON
 	  To compile this driver as a module, choose M here. The module will
 	  be called retu-pwrbutton.
 
+config INPUT_AXP20X_PEK
+	tristate "X-Powers AXP20X power button driver"
+	depends on MFD_AXP20X
+	help
+	  Say Y here if you want to enable power key reporting via the
+	  AXP20X PMIC.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called axp20x-pek.
+
+
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
 	depends on TWL4030_CORE
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 4955ad3..a25ad18 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
 obj-$(CONFIG_INPUT_RETU_PWRBUTTON)	+= retu-pwrbutton.o
+obj-$(CONFIG_INPUT_AXP20X_PEK)		+= axp20x-pek.o
 obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)	+= rotary_encoder.o
 obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
 obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
new file mode 100644
index 0000000..0fba252
--- /dev/null
+++ b/drivers/input/misc/axp20x-pek.c
@@ -0,0 +1,281 @@
+/*
+ * axp20x power button driver.
+ *
+ * Copyright (C) 2013 Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * 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/errno.h>
+#include <linux/irq.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_PEK_STARTUP_MASK		(0xc0)
+#define AXP20X_PEK_SHUTDOWN_MASK	(0x03)
+
+struct axp20x_pek {
+	struct axp20x_dev *axp20x;
+	struct input_dev *input;
+	int irq_dbr;
+	int irq_dbf;
+};
+
+struct axp20x_time {
+	unsigned int time;
+	unsigned int idx;
+};
+
+static const struct axp20x_time startup_time[] = {
+	{ .time = 128,  .idx = 0 },
+	{ .time = 1000, .idx = 2 },
+	{ .time = 3000, .idx = 1 },
+	{ .time = 2000, .idx = 3 },
+};
+
+static const struct axp20x_time shutdown_time[] = {
+	{ .time = 4000,  .idx = 0 },
+	{ .time = 6000,  .idx = 1 },
+	{ .time = 8000,  .idx = 2 },
+	{ .time = 10000, .idx = 3 },
+};
+
+struct axp20x_pek_ext_attr {
+	const struct axp20x_time *p_time;
+	unsigned int mask;
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = {
+	.p_time	= startup_time,
+	.mask	= AXP20X_PEK_STARTUP_MASK,
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = {
+	.p_time	= shutdown_time,
+	.mask	= AXP20X_PEK_SHUTDOWN_MASK,
+};
+
+static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
+{
+	return container_of(attr, struct dev_ext_attribute, attr)->var;
+}
+
+static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
+				    char *buf)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	unsigned int val;
+	int ret, i;
+
+	ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
+	if (ret != 0)
+		return ret;
+
+	val &= axp20x_ea->mask;
+	val >>= ffs(axp20x_ea->mask) - 1;
+
+	for (i = 0; i < 4; i++)
+		if (val == axp20x_ea->p_time[i].idx)
+			val = axp20x_ea->p_time[i].time;
+
+	return sprintf(buf, "%u\n", val);
+}
+
+static ssize_t axp20x_store_ext_attr(struct device *dev, struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	char val_str[20];
+	size_t len;
+	int ret, i;
+	unsigned int val, idx = 0;
+	unsigned int best_err = UINT_MAX;
+
+	val_str[sizeof(val_str) - 1] = '\0';
+	strncpy(val_str, buf, sizeof(val_str) - 1);
+	len = strlen(val_str);
+
+	if (len && val_str[len - 1] == '\n')
+		val_str[len - 1] = '\0';
+
+	ret = kstrtouint(val_str, 10, &val);
+	if (ret)
+		return ret;
+
+	for (i = 3; i >= 0; i--) {
+		unsigned int err;
+
+		err = abs(axp20x_ea->p_time[i].time - val);
+		if (err < best_err) {
+			best_err = err;
+			idx = axp20x_ea->p_time[i].idx;
+		}
+
+		if (!err)
+			break;
+	}
+
+	idx <<= ffs(axp20x_ea->mask) - 1;
+	ret = regmap_update_bits(axp20x_pek->axp20x->regmap,
+				 AXP20X_PEK_KEY,
+				 axp20x_ea->mask, idx);
+	if (ret != 0)
+		return -EINVAL;
+	return count;
+}
+
+static struct dev_ext_attribute axp20x_dev_attr_startup = {
+	.attr	= __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_startup_ext_attr
+};
+
+static struct dev_ext_attribute axp20x_dev_attr_shutdown = {
+	.attr	= __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_shutdown_ext_attr
+};
+
+static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
+{
+	struct input_dev *idev = pwr;
+	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
+
+	if (irq == axp20x_pek->irq_dbr)
+		input_report_key(idev, KEY_POWER, true);
+	else if (irq == axp20x_pek->irq_dbf)
+		input_report_key(idev, KEY_POWER, false);
+
+	input_sync(idev);
+
+	return IRQ_HANDLED;
+}
+
+static int axp20x_pek_probe(struct platform_device *pdev)
+{
+	struct axp20x_pek *axp20x_pek;
+	struct axp20x_dev *axp20x;
+	struct input_dev *idev;
+	int error;
+
+	axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
+				  GFP_KERNEL);
+	if (!axp20x_pek)
+		return -ENOMEM;
+
+	axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
+	axp20x = axp20x_pek->axp20x;
+
+	axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
+	if (axp20x_pek->irq_dbr < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
+				axp20x_pek->irq_dbr);
+		return axp20x_pek->irq_dbr;
+	}
+	axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbr);
+
+	axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
+	if (axp20x_pek->irq_dbf < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
+				axp20x_pek->irq_dbf);
+		return axp20x_pek->irq_dbf;
+	}
+	axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbf);
+
+	axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
+	if (!axp20x_pek->input)
+		return -ENOMEM;
+
+	idev = axp20x_pek->input;
+
+	idev->name = "axp20x-pek";
+	idev->phys = "m1kbd/input2";
+	idev->dev.parent = &pdev->dev;
+
+	input_set_capability(idev, EV_KEY, KEY_POWER);
+
+	input_set_drvdata(idev, axp20x_pek);
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbr", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
+			axp20x_pek->irq_dbr, error);
+
+		return error;
+	}
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbf", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
+			axp20x_pek->irq_dbf, error);
+		return error;
+	}
+
+	error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
+	if (error)
+		return error;
+
+	error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
+	if (error)
+		goto clear_startup_attr;
+
+	error = input_register_device(idev);
+	if (error) {
+		dev_err(axp20x->dev, "Can't register input device: %d\n", error);
+		goto clear_attr;
+	}
+
+	platform_set_drvdata(pdev, axp20x_pek);
+
+	return 0;
+
+clear_attr:
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
+
+clear_startup_attr:
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
+
+	return error;
+}
+
+int axp20x_pek_remove(struct platform_device *pdev)
+{
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
+
+	return 0;
+}
+
+static struct platform_driver axp20x_pek_driver = {
+	.probe		= axp20x_pek_probe,
+	.remove		= axp20x_pek_remove,
+	.driver		= {
+		.name		= "axp20x-pek",
+		.owner		= THIS_MODULE,
+	},
+};
+module_platform_driver(axp20x_pek_driver);
+
+MODULE_DESCRIPTION("axp20x Power Button");
+MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
+MODULE_LICENSE("GPL");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-06-29 18:23     ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch add support for the Power Enable Key found on MFD AXP202 and
AXP209. Besides the basic support for the button, the driver adds two
entries in sysfs to configure the time delay for power on/off.

Signed-off-by: Carlo Caione <carlo@caione.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/Kconfig      |  11 ++
 drivers/input/misc/Makefile     |   1 +
 drivers/input/misc/axp20x-pek.c | 281 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/input/misc/axp20x-pek.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 2ff4425..3fa6229 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON
 	  To compile this driver as a module, choose M here. The module will
 	  be called retu-pwrbutton.
 
+config INPUT_AXP20X_PEK
+	tristate "X-Powers AXP20X power button driver"
+	depends on MFD_AXP20X
+	help
+	  Say Y here if you want to enable power key reporting via the
+	  AXP20X PMIC.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called axp20x-pek.
+
+
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
 	depends on TWL4030_CORE
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 4955ad3..a25ad18 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
 obj-$(CONFIG_INPUT_RETU_PWRBUTTON)	+= retu-pwrbutton.o
+obj-$(CONFIG_INPUT_AXP20X_PEK)		+= axp20x-pek.o
 obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)	+= rotary_encoder.o
 obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
 obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
new file mode 100644
index 0000000..0fba252
--- /dev/null
+++ b/drivers/input/misc/axp20x-pek.c
@@ -0,0 +1,281 @@
+/*
+ * axp20x power button driver.
+ *
+ * Copyright (C) 2013 Carlo Caione <carlo@caione.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * 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/errno.h>
+#include <linux/irq.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_PEK_STARTUP_MASK		(0xc0)
+#define AXP20X_PEK_SHUTDOWN_MASK	(0x03)
+
+struct axp20x_pek {
+	struct axp20x_dev *axp20x;
+	struct input_dev *input;
+	int irq_dbr;
+	int irq_dbf;
+};
+
+struct axp20x_time {
+	unsigned int time;
+	unsigned int idx;
+};
+
+static const struct axp20x_time startup_time[] = {
+	{ .time = 128,  .idx = 0 },
+	{ .time = 1000, .idx = 2 },
+	{ .time = 3000, .idx = 1 },
+	{ .time = 2000, .idx = 3 },
+};
+
+static const struct axp20x_time shutdown_time[] = {
+	{ .time = 4000,  .idx = 0 },
+	{ .time = 6000,  .idx = 1 },
+	{ .time = 8000,  .idx = 2 },
+	{ .time = 10000, .idx = 3 },
+};
+
+struct axp20x_pek_ext_attr {
+	const struct axp20x_time *p_time;
+	unsigned int mask;
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = {
+	.p_time	= startup_time,
+	.mask	= AXP20X_PEK_STARTUP_MASK,
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = {
+	.p_time	= shutdown_time,
+	.mask	= AXP20X_PEK_SHUTDOWN_MASK,
+};
+
+static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
+{
+	return container_of(attr, struct dev_ext_attribute, attr)->var;
+}
+
+static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
+				    char *buf)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	unsigned int val;
+	int ret, i;
+
+	ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
+	if (ret != 0)
+		return ret;
+
+	val &= axp20x_ea->mask;
+	val >>= ffs(axp20x_ea->mask) - 1;
+
+	for (i = 0; i < 4; i++)
+		if (val == axp20x_ea->p_time[i].idx)
+			val = axp20x_ea->p_time[i].time;
+
+	return sprintf(buf, "%u\n", val);
+}
+
+static ssize_t axp20x_store_ext_attr(struct device *dev, struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	char val_str[20];
+	size_t len;
+	int ret, i;
+	unsigned int val, idx = 0;
+	unsigned int best_err = UINT_MAX;
+
+	val_str[sizeof(val_str) - 1] = '\0';
+	strncpy(val_str, buf, sizeof(val_str) - 1);
+	len = strlen(val_str);
+
+	if (len && val_str[len - 1] == '\n')
+		val_str[len - 1] = '\0';
+
+	ret = kstrtouint(val_str, 10, &val);
+	if (ret)
+		return ret;
+
+	for (i = 3; i >= 0; i--) {
+		unsigned int err;
+
+		err = abs(axp20x_ea->p_time[i].time - val);
+		if (err < best_err) {
+			best_err = err;
+			idx = axp20x_ea->p_time[i].idx;
+		}
+
+		if (!err)
+			break;
+	}
+
+	idx <<= ffs(axp20x_ea->mask) - 1;
+	ret = regmap_update_bits(axp20x_pek->axp20x->regmap,
+				 AXP20X_PEK_KEY,
+				 axp20x_ea->mask, idx);
+	if (ret != 0)
+		return -EINVAL;
+	return count;
+}
+
+static struct dev_ext_attribute axp20x_dev_attr_startup = {
+	.attr	= __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_startup_ext_attr
+};
+
+static struct dev_ext_attribute axp20x_dev_attr_shutdown = {
+	.attr	= __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_shutdown_ext_attr
+};
+
+static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
+{
+	struct input_dev *idev = pwr;
+	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
+
+	if (irq == axp20x_pek->irq_dbr)
+		input_report_key(idev, KEY_POWER, true);
+	else if (irq == axp20x_pek->irq_dbf)
+		input_report_key(idev, KEY_POWER, false);
+
+	input_sync(idev);
+
+	return IRQ_HANDLED;
+}
+
+static int axp20x_pek_probe(struct platform_device *pdev)
+{
+	struct axp20x_pek *axp20x_pek;
+	struct axp20x_dev *axp20x;
+	struct input_dev *idev;
+	int error;
+
+	axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
+				  GFP_KERNEL);
+	if (!axp20x_pek)
+		return -ENOMEM;
+
+	axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
+	axp20x = axp20x_pek->axp20x;
+
+	axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
+	if (axp20x_pek->irq_dbr < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
+				axp20x_pek->irq_dbr);
+		return axp20x_pek->irq_dbr;
+	}
+	axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbr);
+
+	axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
+	if (axp20x_pek->irq_dbf < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
+				axp20x_pek->irq_dbf);
+		return axp20x_pek->irq_dbf;
+	}
+	axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbf);
+
+	axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
+	if (!axp20x_pek->input)
+		return -ENOMEM;
+
+	idev = axp20x_pek->input;
+
+	idev->name = "axp20x-pek";
+	idev->phys = "m1kbd/input2";
+	idev->dev.parent = &pdev->dev;
+
+	input_set_capability(idev, EV_KEY, KEY_POWER);
+
+	input_set_drvdata(idev, axp20x_pek);
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbr", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
+			axp20x_pek->irq_dbr, error);
+
+		return error;
+	}
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbf", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
+			axp20x_pek->irq_dbf, error);
+		return error;
+	}
+
+	error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
+	if (error)
+		return error;
+
+	error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
+	if (error)
+		goto clear_startup_attr;
+
+	error = input_register_device(idev);
+	if (error) {
+		dev_err(axp20x->dev, "Can't register input device: %d\n", error);
+		goto clear_attr;
+	}
+
+	platform_set_drvdata(pdev, axp20x_pek);
+
+	return 0;
+
+clear_attr:
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
+
+clear_startup_attr:
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
+
+	return error;
+}
+
+int axp20x_pek_remove(struct platform_device *pdev)
+{
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
+	device_remove_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
+
+	return 0;
+}
+
+static struct platform_driver axp20x_pek_driver = {
+	.probe		= axp20x_pek_probe,
+	.remove		= axp20x_pek_remove,
+	.driver		= {
+		.name		= "axp20x-pek",
+		.owner		= THIS_MODULE,
+	},
+};
+module_platform_driver(axp20x_pek_driver);
+
+MODULE_DESCRIPTION("axp20x Power Button");
+MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
+MODULE_LICENSE("GPL");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 4/6] input: misc: Add ABI docs for AXP20x PEK
  2014-06-29 18:23 ` Carlo Caione
@ 2014-06-29 18:23     ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
  Cc: Carlo Caione

Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 Documentation/ABI/testing/sysfs-driver-input-axp-pek | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek

diff --git a/Documentation/ABI/testing/sysfs-driver-input-axp-pek b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
new file mode 100644
index 0000000..080563b
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
@@ -0,0 +1,11 @@
+What:		/sys/class/input/input(x)/startup
+Date:		March 2014
+Contact:	Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+Description:	Startup time in us. Board is powered on if the button is pressed
+		for more than <startup_time>
+
+What:		/sys/class/input/input(x)/shutdown
+Date:		March 2014
+Contact:	Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+Description:	Shutdown time in us. Board is powered off if the button is pressed
+		for more than <shutdown_time>
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 4/6] input: misc: Add ABI docs for AXP20x PEK
@ 2014-06-29 18:23     ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 Documentation/ABI/testing/sysfs-driver-input-axp-pek | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek

diff --git a/Documentation/ABI/testing/sysfs-driver-input-axp-pek b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
new file mode 100644
index 0000000..080563b
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
@@ -0,0 +1,11 @@
+What:		/sys/class/input/input(x)/startup
+Date:		March 2014
+Contact:	Carlo Caione <carlo@caione.org>
+Description:	Startup time in us. Board is powered on if the button is pressed
+		for more than <startup_time>
+
+What:		/sys/class/input/input(x)/shutdown
+Date:		March 2014
+Contact:	Carlo Caione <carlo@caione.org>
+Description:	Shutdown time in us. Board is powered off if the button is pressed
+		for more than <shutdown_time>
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 5/6] ARM: sunxi: Add AXP20x support in defconfig
  2014-06-29 18:23 ` Carlo Caione
@ 2014-06-29 18:23     ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
  Cc: Carlo Caione

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 arch/arm/configs/sunxi_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index 7209bfd..acf465f 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -54,6 +54,8 @@ CONFIG_STMMAC_ETH=y
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=8
@@ -77,6 +79,7 @@ CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MFD_AXP20X=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
 CONFIG_REGULATOR_GPIO=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 5/6] ARM: sunxi: Add AXP20x support in defconfig
@ 2014-06-29 18:23     ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 arch/arm/configs/sunxi_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index 7209bfd..acf465f 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -54,6 +54,8 @@ CONFIG_STMMAC_ETH=y
 # CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=8
@@ -77,6 +79,7 @@ CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MFD_AXP20X=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
 CONFIG_REGULATOR_GPIO=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig
  2014-06-29 18:23 ` Carlo Caione
@ 2014-06-29 18:23     ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
  Cc: Carlo Caione

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index be1a345..d79418e 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -159,6 +159,7 @@ CONFIG_KEYBOARD_CROS_EC=y
 CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MPU3050=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -229,6 +230,7 @@ CONFIG_WATCHDOG=y
 CONFIG_ORION_WATCHDOG=y
 CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MFD_AS3722=y
+CONFIG_MFD_AXP20X=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX8907=y
@@ -240,6 +242,7 @@ CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MAX8907=y
 CONFIG_REGULATOR_PALMAS=y
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v7 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig
@ 2014-06-29 18:23     ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-29 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index be1a345..d79418e 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -159,6 +159,7 @@ CONFIG_KEYBOARD_CROS_EC=y
 CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MPU3050=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -229,6 +230,7 @@ CONFIG_WATCHDOG=y
 CONFIG_ORION_WATCHDOG=y
 CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MFD_AS3722=y
+CONFIG_MFD_AXP20X=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX8907=y
@@ -240,6 +242,7 @@ CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MAX8907=y
 CONFIG_REGULATOR_PALMAS=y
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key
  2014-06-29 18:23     ` Carlo Caione
@ 2014-06-30  9:47         ` Mark Rutland
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Rutland @ 2014-06-30  9:47 UTC (permalink / raw)
  To: Carlo Caione
  Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Sun, Jun 29, 2014 at 07:23:54PM +0100, Carlo Caione wrote:
> This patch add support for the Power Enable Key found on MFD AXP202 and
> AXP209. Besides the basic support for the button, the driver adds two
> entries in sysfs to configure the time delay for power on/off.
> 
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> Acked-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/input/misc/Kconfig      |  11 ++
>  drivers/input/misc/Makefile     |   1 +
>  drivers/input/misc/axp20x-pek.c | 281 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 293 insertions(+)
>  create mode 100644 drivers/input/misc/axp20x-pek.c

[...]

> +static int axp20x_pek_probe(struct platform_device *pdev)
> +{
> +       struct axp20x_pek *axp20x_pek;
> +       struct axp20x_dev *axp20x;
> +       struct input_dev *idev;
> +       int error;
> +
> +       axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
> +                                 GFP_KERNEL);

You can use sizeof(*axp20x_pek) here.

[...]

> +static struct platform_driver axp20x_pek_driver = {
> +       .probe          = axp20x_pek_probe,
> +       .remove         = axp20x_pek_remove,
> +       .driver         = {
> +               .name           = "axp20x-pek",
> +               .owner          = THIS_MODULE,
> +       },
> +};
> +module_platform_driver(axp20x_pek_driver);

So this requires platform data rather than a DTB? Or have I missed
something?

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-06-30  9:47         ` Mark Rutland
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Rutland @ 2014-06-30  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 29, 2014 at 07:23:54PM +0100, Carlo Caione wrote:
> This patch add support for the Power Enable Key found on MFD AXP202 and
> AXP209. Besides the basic support for the button, the driver adds two
> entries in sysfs to configure the time delay for power on/off.
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/misc/Kconfig      |  11 ++
>  drivers/input/misc/Makefile     |   1 +
>  drivers/input/misc/axp20x-pek.c | 281 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 293 insertions(+)
>  create mode 100644 drivers/input/misc/axp20x-pek.c

[...]

> +static int axp20x_pek_probe(struct platform_device *pdev)
> +{
> +       struct axp20x_pek *axp20x_pek;
> +       struct axp20x_dev *axp20x;
> +       struct input_dev *idev;
> +       int error;
> +
> +       axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
> +                                 GFP_KERNEL);

You can use sizeof(*axp20x_pek) here.

[...]

> +static struct platform_driver axp20x_pek_driver = {
> +       .probe          = axp20x_pek_probe,
> +       .remove         = axp20x_pek_remove,
> +       .driver         = {
> +               .name           = "axp20x-pek",
> +               .owner          = THIS_MODULE,
> +       },
> +};
> +module_platform_driver(axp20x_pek_driver);

So this requires platform data rather than a DTB? Or have I missed
something?

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation
  2014-06-29 18:23   ` Carlo Caione
@ 2014-06-30  9:48       ` Mark Rutland
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Rutland @ 2014-06-30  9:48 UTC (permalink / raw)
  To: Carlo Caione
  Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Sun, Jun 29, 2014 at 07:23:52PM +0100, Carlo Caione wrote:
> Bindings documentation for the AXP20x driver. In this file also
> sub-nodes are documented.
> 
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
>  1 file changed, 93 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..cc9e01b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,93 @@
> +AXP202/AXP209 device tree bindings
> +
> +The axp20x family current members :-
> +axp202 (X-Powers)
> +axp209 (X-Powers)
> +
> +Required properties:
> +- compatible: "x-powers,axp202" or "x-powers,axp209"
> +- reg: The I2C slave address for the AXP chip
> +- interrupt-parent: The parent interrupt controller
> +- interrupts: Interrupt specifiers for interrupt sources

How many, what are they?

> +- interrupt-controller: axp20x has its own internal IRQs
> +- #interrupt-cells: Should be set to 1
> +- acin-supply: The input supply for LDO1
> +- vin2-supply: The input supply for DCDC2
> +- vin3-supply: The input supply for DCDC3
> +- ldo24in-supply: The input supply for LDO2, LDO4
> +- ldo3in-supply: The input supply for LDO3
> +- ldo5in-supply: The input supply for LDO5
> +
> +- regulators: A node that houses a sub-node for each regulator. 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 x-powers,dcdc-freq
> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
> +		      (range: 750-1875). Default: 1.5MHz
> +
> +Optional properties for DCDCs:
> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
> +			  Default: AUTO mode

When would I want to select PWM mode, and why should this be in the DT?

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation
@ 2014-06-30  9:48       ` Mark Rutland
  0 siblings, 0 replies; 28+ messages in thread
From: Mark Rutland @ 2014-06-30  9:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 29, 2014 at 07:23:52PM +0100, Carlo Caione wrote:
> Bindings documentation for the AXP20x driver. In this file also
> sub-nodes are documented.
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
>  1 file changed, 93 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..cc9e01b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,93 @@
> +AXP202/AXP209 device tree bindings
> +
> +The axp20x family current members :-
> +axp202 (X-Powers)
> +axp209 (X-Powers)
> +
> +Required properties:
> +- compatible: "x-powers,axp202" or "x-powers,axp209"
> +- reg: The I2C slave address for the AXP chip
> +- interrupt-parent: The parent interrupt controller
> +- interrupts: Interrupt specifiers for interrupt sources

How many, what are they?

> +- interrupt-controller: axp20x has its own internal IRQs
> +- #interrupt-cells: Should be set to 1
> +- acin-supply: The input supply for LDO1
> +- vin2-supply: The input supply for DCDC2
> +- vin3-supply: The input supply for DCDC3
> +- ldo24in-supply: The input supply for LDO2, LDO4
> +- ldo3in-supply: The input supply for LDO3
> +- ldo5in-supply: The input supply for LDO5
> +
> +- regulators: A node that houses a sub-node for each regulator. 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 x-powers,dcdc-freq
> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
> +		      (range: 750-1875). Default: 1.5MHz
> +
> +Optional properties for DCDCs:
> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
> +			  Default: AUTO mode

When would I want to select PWM mode, and why should this be in the DT?

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key
  2014-06-30  9:47         ` Mark Rutland
@ 2014-06-30 17:43           ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-30 17:43 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Carlo Caione, lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Mon, Jun 30, 2014 at 11:47 AM, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> wrote:
>> +static struct platform_driver axp20x_pek_driver = {
>> +       .probe          = axp20x_pek_probe,
>> +       .remove         = axp20x_pek_remove,
>> +       .driver         = {
>> +               .name           = "axp20x-pek",
>> +               .owner          = THIS_MODULE,
>> +       },
>> +};
>> +module_platform_driver(axp20x_pek_driver);
>
> So this requires platform data rather than a DTB? Or have I missed
> something?

It is not loaded by DTB but by the MFD core driver (axp20x). So I
assume this is still a platform device.

Regards,

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-06-30 17:43           ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-06-30 17:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 30, 2014 at 11:47 AM, Mark Rutland <mark.rutland@arm.com> wrote:
>> +static struct platform_driver axp20x_pek_driver = {
>> +       .probe          = axp20x_pek_probe,
>> +       .remove         = axp20x_pek_remove,
>> +       .driver         = {
>> +               .name           = "axp20x-pek",
>> +               .owner          = THIS_MODULE,
>> +       },
>> +};
>> +module_platform_driver(axp20x_pek_driver);
>
> So this requires platform data rather than a DTB? Or have I missed
> something?

It is not loaded by DTB but by the MFD core driver (axp20x). So I
assume this is still a platform device.

Regards,

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
  2014-06-29 18:23 ` Carlo Caione
@ 2014-10-22  6:28     ` Bruno Prémont
  -1 siblings, 0 replies; 28+ messages in thread
From: Bruno Prémont @ 2014-10-22  6:28 UTC (permalink / raw)
  To: Carlo Caione, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> During the merging of v6 several patches were left out. This v7 comprises
> all the patches that are still pending.

Any progress on this or reason why these are stuck?

> //--
> 
> AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
> and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
> AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
> converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
> as well as 4 configurable GPIOs. 
> 
> This set of patches introduces the core driver and support for two different
> subsystems:
> 	- Regulators
> 	- PEK (Power Enable Key)
> 
> Changes since v1:
> 
> 	- Added a new standalone patch for defconfig
> 
> 	- MFD core:
> 	  * Removed axp,system-power-controller property
> 
> 	- Bindings documentation:
> 	  * Corrected description for dcdc-workmode property
> 	  * Removed unused axp20x-pek compatible
> 
> 	- Input misc PEK driver:
> 	  * Fixed seconds in lower case
> 
> 	- Regulators subsystem:
> 	  * Fixed axp20x_set_suspend_voltage()
> 	  * Switched to using multi-bit control for regulators
> 	  * When "regulators" node is not found driver doesn't quit
> 	  * Driver is now using devm_regulator_register()
> 	  * Added module_platform_driver() instead of subsys_initcall()
> 
> 	- DT:
> 	  * Added new DTSI for AXP209
> 	  * Added support for cubietruck and olinuxino-micro
> 
> Changes since v2:
> 
> 	- Added a new patch for multi_v7_defconfig to enable MFD core
> 	  and subsystems
> 
> 	- DT:
> 	  * Dropped axp,system-power-controller property from DTS
> 	  * Moved compatible and interrupt-related properties from the
> 	    DTSI file to the DTS board files
> 
> 	- Regulators subsystem:
> 	  * Deleted useless struct axp20x_regulators
> 	  * Added a warning when out of specs values are used for the
> 	    dcdc frequency
> 
> 	- MFD core:
> 	  * Fixed coding style
> 	  * Removed IDs from device table for i2c
> 
> 	- Bindings documentation:
> 	  * Several corrections and fixes
> 
> Changes since v3:
> 
> 	- Removed x-powers-axp209.dtsi file
> 	- Rewritten bindings document
> 
> 	- MFD core:
> 	  * Fixed casting
> 	  * Better comments / documentation
> 
> 	- Input misc PEK driver:
> 	  * Timings are now expressed in ms and the sysfs appies the
> 	    closest possible value
> 	  * No more useless pretty-printing
> 	  * Removed devm_request_threaded_irq in favour of
> 	    devm_request_any_context_irq
> 	  * Moved from input attributes to platform device attributes
> 
> 	- Regulators subsystem:
> 	  * Removed suspend mode (axp20x_set_suspend_voltage)
> 	  * Added regulators input supply
> 
> 	- DT:
> 	  * DTs doesn't include anymore the dtsi
> 	  * Added input supplies for regulators
> 
> Changes since v4:
> 
> 	- Removed regulator patches already applied / acked by Mark Brown
> 
> 	- Input misc PEK driver:
> 	  * Don't print anymore the "us" unit
> 	  * Added cleanup for attributes when unbindind the device
> 	  * Fixed error code returned when device_create_file() fails
> 
> 	- DT:
> 	  * Enable all the regulators on at boot-time
>        	  * Removed min and max microvolts for all the regulators but DCDC2
> 	  * Moved the axp_ipsout regulator outside the MFD node
> 	  
> 	- MFD core:
> 	  * The supply regulators are now specified in the MFD driver using
> 	    regulator_bulk_register_supply_alias() and the .parent_supplies
> 	    in the MFD cell
> 
> Changes since v5:
> 	- Added ACKs
> 	- Fixed compilation warning (reported by Hans De Goede)
> 	- Vendor-prefixes are now sorted
> 	- Removed DT patch
> 
> 
> Carlo Caione (6):
>   mfd: AXP20x: Add bindings documentation
>   dt-bindings: add vendor-prefix for X-Powers
>   input: misc: Add driver for AXP20x Power Enable Key
>   input: misc: Add ABI docs for AXP20x PEK
>   ARM: sunxi: Add AXP20x support in defconfig
>   ARM: sunxi: Add AXP20x support multi_v7_defconfig
> 
>  .../ABI/testing/sysfs-driver-input-axp-pek         |  11 +
>  Documentation/devicetree/bindings/mfd/axp20x.txt   |  93 +++++++
>  .../devicetree/bindings/vendor-prefixes.txt        |   1 +
>  arch/arm/configs/multi_v7_defconfig                |   3 +
>  arch/arm/configs/sunxi_defconfig                   |   3 +
>  drivers/input/misc/Kconfig                         |  11 +
>  drivers/input/misc/Makefile                        |   1 +
>  drivers/input/misc/axp20x-pek.c                    | 281 +++++++++++++++++++++
>  8 files changed, 404 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
>  create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
>  create mode 100644 drivers/input/misc/axp20x-pek.c
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-10-22  6:28     ` Bruno Prémont
  0 siblings, 0 replies; 28+ messages in thread
From: Bruno Prémont @ 2014-10-22  6:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> During the merging of v6 several patches were left out. This v7 comprises
> all the patches that are still pending.

Any progress on this or reason why these are stuck?

> //--
> 
> AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
> and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
> AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
> converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
> as well as 4 configurable GPIOs. 
> 
> This set of patches introduces the core driver and support for two different
> subsystems:
> 	- Regulators
> 	- PEK (Power Enable Key)
> 
> Changes since v1:
> 
> 	- Added a new standalone patch for defconfig
> 
> 	- MFD core:
> 	  * Removed axp,system-power-controller property
> 
> 	- Bindings documentation:
> 	  * Corrected description for dcdc-workmode property
> 	  * Removed unused axp20x-pek compatible
> 
> 	- Input misc PEK driver:
> 	  * Fixed seconds in lower case
> 
> 	- Regulators subsystem:
> 	  * Fixed axp20x_set_suspend_voltage()
> 	  * Switched to using multi-bit control for regulators
> 	  * When "regulators" node is not found driver doesn't quit
> 	  * Driver is now using devm_regulator_register()
> 	  * Added module_platform_driver() instead of subsys_initcall()
> 
> 	- DT:
> 	  * Added new DTSI for AXP209
> 	  * Added support for cubietruck and olinuxino-micro
> 
> Changes since v2:
> 
> 	- Added a new patch for multi_v7_defconfig to enable MFD core
> 	  and subsystems
> 
> 	- DT:
> 	  * Dropped axp,system-power-controller property from DTS
> 	  * Moved compatible and interrupt-related properties from the
> 	    DTSI file to the DTS board files
> 
> 	- Regulators subsystem:
> 	  * Deleted useless struct axp20x_regulators
> 	  * Added a warning when out of specs values are used for the
> 	    dcdc frequency
> 
> 	- MFD core:
> 	  * Fixed coding style
> 	  * Removed IDs from device table for i2c
> 
> 	- Bindings documentation:
> 	  * Several corrections and fixes
> 
> Changes since v3:
> 
> 	- Removed x-powers-axp209.dtsi file
> 	- Rewritten bindings document
> 
> 	- MFD core:
> 	  * Fixed casting
> 	  * Better comments / documentation
> 
> 	- Input misc PEK driver:
> 	  * Timings are now expressed in ms and the sysfs appies the
> 	    closest possible value
> 	  * No more useless pretty-printing
> 	  * Removed devm_request_threaded_irq in favour of
> 	    devm_request_any_context_irq
> 	  * Moved from input attributes to platform device attributes
> 
> 	- Regulators subsystem:
> 	  * Removed suspend mode (axp20x_set_suspend_voltage)
> 	  * Added regulators input supply
> 
> 	- DT:
> 	  * DTs doesn't include anymore the dtsi
> 	  * Added input supplies for regulators
> 
> Changes since v4:
> 
> 	- Removed regulator patches already applied / acked by Mark Brown
> 
> 	- Input misc PEK driver:
> 	  * Don't print anymore the "us" unit
> 	  * Added cleanup for attributes when unbindind the device
> 	  * Fixed error code returned when device_create_file() fails
> 
> 	- DT:
> 	  * Enable all the regulators on at boot-time
>        	  * Removed min and max microvolts for all the regulators but DCDC2
> 	  * Moved the axp_ipsout regulator outside the MFD node
> 	  
> 	- MFD core:
> 	  * The supply regulators are now specified in the MFD driver using
> 	    regulator_bulk_register_supply_alias() and the .parent_supplies
> 	    in the MFD cell
> 
> Changes since v5:
> 	- Added ACKs
> 	- Fixed compilation warning (reported by Hans De Goede)
> 	- Vendor-prefixes are now sorted
> 	- Removed DT patch
> 
> 
> Carlo Caione (6):
>   mfd: AXP20x: Add bindings documentation
>   dt-bindings: add vendor-prefix for X-Powers
>   input: misc: Add driver for AXP20x Power Enable Key
>   input: misc: Add ABI docs for AXP20x PEK
>   ARM: sunxi: Add AXP20x support in defconfig
>   ARM: sunxi: Add AXP20x support multi_v7_defconfig
> 
>  .../ABI/testing/sysfs-driver-input-axp-pek         |  11 +
>  Documentation/devicetree/bindings/mfd/axp20x.txt   |  93 +++++++
>  .../devicetree/bindings/vendor-prefixes.txt        |   1 +
>  arch/arm/configs/multi_v7_defconfig                |   3 +
>  arch/arm/configs/sunxi_defconfig                   |   3 +
>  drivers/input/misc/Kconfig                         |  11 +
>  drivers/input/misc/Makefile                        |   1 +
>  drivers/input/misc/axp20x-pek.c                    | 281 +++++++++++++++++++++
>  8 files changed, 404 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
>  create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
>  create mode 100644 drivers/input/misc/axp20x-pek.c
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
  2014-10-22  6:28     ` Bruno Prémont
@ 2014-10-22  7:59         ` Maxime Ripard
  -1 siblings, 0 replies; 28+ messages in thread
From: Maxime Ripard @ 2014-10-22  7:59 UTC (permalink / raw)
  To: Bruno Prémont
  Cc: Carlo Caione, lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

On Wed, Oct 22, 2014 at 08:28:42AM +0200, Bruno Prémont wrote:
> On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> > During the merging of v6 several patches were left out. This v7 comprises
> > all the patches that are still pending.
> 
> Any progress on this or reason why these are stuck?

No one bothered resubmitting it.

If you have some time to work on this, it would be great if you could
pick up the work, if not, I'll do it.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-10-22  7:59         ` Maxime Ripard
  0 siblings, 0 replies; 28+ messages in thread
From: Maxime Ripard @ 2014-10-22  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 22, 2014 at 08:28:42AM +0200, Bruno Pr?mont wrote:
> On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> > During the merging of v6 several patches were left out. This v7 comprises
> > all the patches that are still pending.
> 
> Any progress on this or reason why these are stuck?

No one bothered resubmitting it.

If you have some time to work on this, it would be great if you could
pick up the work, if not, I'll do it.

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

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
  2014-10-22  7:59         ` Maxime Ripard
@ 2014-10-22 10:22           ` Carlo Caione
  -1 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-10-22 10:22 UTC (permalink / raw)
  To: Bruno Prémont
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

On Wed, Oct 22, 2014 at 09:59:29AM +0200, Maxime Ripard wrote:
> On Wed, Oct 22, 2014 at 08:28:42AM +0200, Bruno Prémont wrote:
> > On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> > > During the merging of v6 several patches were left out. This v7 comprises
> > > all the patches that are still pending.
> > 
> > Any progress on this or reason why these are stuck?
> 
> No one bothered resubmitting it.
> 
> If you have some time to work on this, it would be great if you could
> pick up the work, if not, I'll do it.

Wow, I totally forgot about those patches. Sorry for that.
If you are willing to work on the patches go ahead, otherwise
I'll find a bit of time myself.

-- 
Carlo Caione

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [linux-sunxi] Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-10-22 10:22           ` Carlo Caione
  0 siblings, 0 replies; 28+ messages in thread
From: Carlo Caione @ 2014-10-22 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 22, 2014 at 09:59:29AM +0200, Maxime Ripard wrote:
> On Wed, Oct 22, 2014 at 08:28:42AM +0200, Bruno Pr?mont wrote:
> > On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> > > During the merging of v6 several patches were left out. This v7 comprises
> > > all the patches that are still pending.
> > 
> > Any progress on this or reason why these are stuck?
> 
> No one bothered resubmitting it.
> 
> If you have some time to work on this, it would be great if you could
> pick up the work, if not, I'll do it.

Wow, I totally forgot about those patches. Sorry for that.
If you are willing to work on the patches go ahead, otherwise
I'll find a bit of time myself.

-- 
Carlo Caione

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Re: [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation
  2014-06-30  9:48       ` Mark Rutland
@ 2014-12-03 10:05         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 28+ messages in thread
From: Chen-Yu Tsai @ 2014-12-03 10:05 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Carlo Caione, lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-sunxi

Hi Mark,

I'm (hopefully) picking up the work for this series.

On Mon, Jun 30, 2014 at 5:48 PM, Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> wrote:
> On Sun, Jun 29, 2014 at 07:23:52PM +0100, Carlo Caione wrote:
>> Bindings documentation for the AXP20x driver. In this file also
>> sub-nodes are documented.
>>
>> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
>>  1 file changed, 93 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..cc9e01b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -0,0 +1,93 @@
>> +AXP202/AXP209 device tree bindings
>> +
>> +The axp20x family current members :-
>> +axp202 (X-Powers)
>> +axp209 (X-Powers)
>> +
>> +Required properties:
>> +- compatible: "x-powers,axp202" or "x-powers,axp209"
>> +- reg: The I2C slave address for the AXP chip
>> +- interrupt-parent: The parent interrupt controller
>> +- interrupts: Interrupt specifiers for interrupt sources
>
> How many, what are they?

Now reads: SoC external interrupt / NMI connected to the PMIC's IRQ pin

>> +- interrupt-controller: axp20x has its own internal IRQs
>> +- #interrupt-cells: Should be set to 1
>> +- acin-supply: The input supply for LDO1
>> +- vin2-supply: The input supply for DCDC2
>> +- vin3-supply: The input supply for DCDC3
>> +- ldo24in-supply: The input supply for LDO2, LDO4
>> +- ldo3in-supply: The input supply for LDO3
>> +- ldo5in-supply: The input supply for LDO5
>> +
>> +- regulators: A node that houses a sub-node for each regulator. 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 x-powers,dcdc-freq
>> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
>> +                   (range: 750-1875). Default: 1.5MHz
>> +
>> +Optional properties for DCDCs:
>> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
>> +                       Default: AUTO mode
>
> When would I want to select PWM mode, and why should this be in the DT?

Expanded description:

"""
The DCDC regulators work in a mixed PWM/PFM mode,
using PFM under light loads and switching to PWM
for heavier loads. Forcing PWM mode trades efficiency
under light loads for lower output noise. This
probably makes sense for HiFi audio related
applications that aren't battery constrained.
"""

As I'm not an electronics person, I really can't say under
what circumstances one would force the PMIC into PWM mode.
The expanded description is an educated guess based on
research on the internet about PWM and PFM.

I think it makes sense to put this in the DT. The vendor
building the board/DT is in the best position to know the
constraints and requirements of the board, and can decide
whether the trade off makes sense. As for the boards/DTs
already out there, we can just leave it in auto mode.


Regards
ChenYu

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [linux-sunxi] Re: [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation
@ 2014-12-03 10:05         ` Chen-Yu Tsai
  0 siblings, 0 replies; 28+ messages in thread
From: Chen-Yu Tsai @ 2014-12-03 10:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mark,

I'm (hopefully) picking up the work for this series.

On Mon, Jun 30, 2014 at 5:48 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Sun, Jun 29, 2014 at 07:23:52PM +0100, Carlo Caione wrote:
>> Bindings documentation for the AXP20x driver. In this file also
>> sub-nodes are documented.
>>
>> Signed-off-by: Carlo Caione <carlo@caione.org>
>> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 93 ++++++++++++++++++++++++
>>  1 file changed, 93 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..cc9e01b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -0,0 +1,93 @@
>> +AXP202/AXP209 device tree bindings
>> +
>> +The axp20x family current members :-
>> +axp202 (X-Powers)
>> +axp209 (X-Powers)
>> +
>> +Required properties:
>> +- compatible: "x-powers,axp202" or "x-powers,axp209"
>> +- reg: The I2C slave address for the AXP chip
>> +- interrupt-parent: The parent interrupt controller
>> +- interrupts: Interrupt specifiers for interrupt sources
>
> How many, what are they?

Now reads: SoC external interrupt / NMI connected to the PMIC's IRQ pin

>> +- interrupt-controller: axp20x has its own internal IRQs
>> +- #interrupt-cells: Should be set to 1
>> +- acin-supply: The input supply for LDO1
>> +- vin2-supply: The input supply for DCDC2
>> +- vin3-supply: The input supply for DCDC3
>> +- ldo24in-supply: The input supply for LDO2, LDO4
>> +- ldo3in-supply: The input supply for LDO3
>> +- ldo5in-supply: The input supply for LDO5
>> +
>> +- regulators: A node that houses a sub-node for each regulator. 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 x-powers,dcdc-freq
>> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
>> +                   (range: 750-1875). Default: 1.5MHz
>> +
>> +Optional properties for DCDCs:
>> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
>> +                       Default: AUTO mode
>
> When would I want to select PWM mode, and why should this be in the DT?

Expanded description:

"""
The DCDC regulators work in a mixed PWM/PFM mode,
using PFM under light loads and switching to PWM
for heavier loads. Forcing PWM mode trades efficiency
under light loads for lower output noise. This
probably makes sense for HiFi audio related
applications that aren't battery constrained.
"""

As I'm not an electronics person, I really can't say under
what circumstances one would force the PMIC into PWM mode.
The expanded description is an educated guess based on
research on the internet about PWM and PFM.

I think it makes sense to put this in the DT. The vendor
building the board/DT is in the best position to know the
constraints and requirements of the board, and can decide
whether the trade off makes sense. As for the boards/DTs
already out there, we can just leave it in auto mode.


Regards
ChenYu

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2014-12-03 10:05 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-29 18:23 [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209 Carlo Caione
2014-06-29 18:23 ` Carlo Caione
2014-06-29 18:23 ` [PATCH v7 1/6] mfd: AXP20x: Add bindings documentation Carlo Caione
2014-06-29 18:23   ` Carlo Caione
     [not found]   ` <1404066237-20234-2-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-06-30  9:48     ` Mark Rutland
2014-06-30  9:48       ` Mark Rutland
2014-12-03 10:05       ` Chen-Yu Tsai
2014-12-03 10:05         ` [linux-sunxi] " Chen-Yu Tsai
     [not found] ` <1404066237-20234-1-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-06-29 18:23   ` [PATCH v7 2/6] dt-bindings: add vendor-prefix for X-Powers Carlo Caione
2014-06-29 18:23     ` Carlo Caione
2014-06-29 18:23   ` [PATCH v7 3/6] input: misc: Add driver for AXP20x Power Enable Key Carlo Caione
2014-06-29 18:23     ` Carlo Caione
     [not found]     ` <1404066237-20234-4-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-06-30  9:47       ` Mark Rutland
2014-06-30  9:47         ` Mark Rutland
2014-06-30 17:43         ` Carlo Caione
2014-06-30 17:43           ` Carlo Caione
2014-06-29 18:23   ` [PATCH v7 4/6] input: misc: Add ABI docs for AXP20x PEK Carlo Caione
2014-06-29 18:23     ` Carlo Caione
2014-06-29 18:23   ` [PATCH v7 5/6] ARM: sunxi: Add AXP20x support in defconfig Carlo Caione
2014-06-29 18:23     ` Carlo Caione
2014-06-29 18:23   ` [PATCH v7 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig Carlo Caione
2014-06-29 18:23     ` Carlo Caione
2014-10-22  6:28   ` [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209 Bruno Prémont
2014-10-22  6:28     ` Bruno Prémont
     [not found]     ` <20141022082842.58578191-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
2014-10-22  7:59       ` Maxime Ripard
2014-10-22  7:59         ` Maxime Ripard
2014-10-22 10:22         ` Carlo Caione
2014-10-22 10:22           ` [linux-sunxi] " Carlo Caione

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.