All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-12-23  2:53 ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Chen-Yu Tsai,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Carlo Caione

Hi everyone,

This is v8 of the AXP20x PMIC patches. These are the remaining patches
of the original series: PEK (power button) input driver, binding docs,
and defconfig updates.

Mark raised some questions during v7 about the first patch, specifically
about the "x-powers,dcdc-workmode" property. I've expanded the regulator
parts of the DT bindings doc. Mark, if you could take a look and give us
your blessing?

Dmitry, you were OK with the input bits going through the MFD tree, is
that still the case?

If there are no more problems, maybe Lee could take patches 1~4, and
Maxime can take the defconfig patches through his tree.


Thanks
ChenYu


Changes since v7:

	- DT bindings
	  * Clarified the AXP's interrupt source
	  * Added explaination for "x-powers,dcdc-workmode" property
	  * Made regulator supply properties optional. They can be omitted
	    when the input is unregulated, as is the case when they are
	    connected to the IPSOUT output on the PMIC.
	  * Used real world example (Cubieboard2) for regulator nodes
	
	- Fixed paths for PEK sysfs entries.

	- PEK driver
	  * Made axp20x_pek_remove() in PEK driver static.
	  * Removed driver owner field.
	  * Wrapped some lines over 80 characters.


Original cover letter from v7:


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   |  97 +++++++
 .../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                    | 282 +++++++++++++++++++++
 8 files changed, 409 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

-- 
2.1.4

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

* [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-12-23  2:53 ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi everyone,

This is v8 of the AXP20x PMIC patches. These are the remaining patches
of the original series: PEK (power button) input driver, binding docs,
and defconfig updates.

Mark raised some questions during v7 about the first patch, specifically
about the "x-powers,dcdc-workmode" property. I've expanded the regulator
parts of the DT bindings doc. Mark, if you could take a look and give us
your blessing?

Dmitry, you were OK with the input bits going through the MFD tree, is
that still the case?

If there are no more problems, maybe Lee could take patches 1~4, and
Maxime can take the defconfig patches through his tree.


Thanks
ChenYu


Changes since v7:

	- DT bindings
	  * Clarified the AXP's interrupt source
	  * Added explaination for "x-powers,dcdc-workmode" property
	  * Made regulator supply properties optional. They can be omitted
	    when the input is unregulated, as is the case when they are
	    connected to the IPSOUT output on the PMIC.
	  * Used real world example (Cubieboard2) for regulator nodes
	
	- Fixed paths for PEK sysfs entries.

	- PEK driver
	  * Made axp20x_pek_remove() in PEK driver static.
	  * Removed driver owner field.
	  * Wrapped some lines over 80 characters.


Original cover letter from v7:


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   |  97 +++++++
 .../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                    | 282 +++++++++++++++++++++
 8 files changed, 409 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

-- 
2.1.4

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

* [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai

From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

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>
[wens-jdAy2FN1RRM@public.gmane.org: clarify interrupt source for the axp PMIC]
[wens-jdAy2FN1RRM@public.gmane.org: explain dcdc-workmode in detail and trim lines to 80 chars]
[wens-jdAy2FN1RRM@public.gmane.org: make regulator supplies optional if using unregulated input]
[wens-jdAy2FN1RRM@public.gmane.org: use cubieboard2 regulator nodes as example]
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
 1 file changed, 97 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 000000000000..b775d8ccbc7c
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,97 @@
+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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- 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. Regulators not used should
+	      still be listed for completeness and that the regulator subsystem
+	      properly registers them.
+
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+		      (range: 750-1875). Default: 1.5MHz
+
+Optional properties:
+- regulator supplies - may be omitted if inputs are unregulated, such as using
+		       the IPSOUT output from the PMIC
+  - 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
+
+Optional properties for DCDC regulators:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
+			  Default: AUTO mode
+			  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.
+
+Example:
+
+axp209: pmic@34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		x-powers,dcdc-freq = <1500>;
+
+		vdd_cpu: dcdc2 {
+			regulator-always-on;
+			regulator-min-microvolt = <1000000>;
+			regulator-max-microvolt = <1450000>;
+			regulator-name = "vdd-cpu";
+		};
+
+		vdd_int_dll: dcdc3 {
+			regulator-always-on;
+			regulator-min-microvolt = <1000000>;
+			regulator-max-microvolt = <1400000>;
+			regulator-name = "vdd-int-dll";
+		};
+
+		vdd_rtc: ldo1 {
+			regulator-always-on;
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1400000>;
+			regulator-name = "vdd-rtc";
+		};
+
+		avcc: ldo2 {
+			regulator-always-on;
+			regulator-min-microvolt = <2700000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-name = "avcc";
+		};
+
+		ldo3 {
+			/* unused */
+		};
+
+		csi1_io_2v8: ldo4 {
+			/* output on extension headers */
+			regulator-name = "csi1-io-2v8";
+		};
+	};
+};
+
-- 
2.1.4

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

* [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Carlo Caione <carlo@caione.org>

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>
[wens at csie.org: clarify interrupt source for the axp PMIC]
[wens at csie.org: explain dcdc-workmode in detail and trim lines to 80 chars]
[wens at csie.org: make regulator supplies optional if using unregulated input]
[wens at csie.org: use cubieboard2 regulator nodes as example]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
 1 file changed, 97 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 000000000000..b775d8ccbc7c
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,97 @@
+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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- 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. Regulators not used should
+	      still be listed for completeness and that the regulator subsystem
+	      properly registers them.
+
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+		      (range: 750-1875). Default: 1.5MHz
+
+Optional properties:
+- regulator supplies - may be omitted if inputs are unregulated, such as using
+		       the IPSOUT output from the PMIC
+  - 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
+
+Optional properties for DCDC regulators:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
+			  Default: AUTO mode
+			  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.
+
+Example:
+
+axp209: pmic at 34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		x-powers,dcdc-freq = <1500>;
+
+		vdd_cpu: dcdc2 {
+			regulator-always-on;
+			regulator-min-microvolt = <1000000>;
+			regulator-max-microvolt = <1450000>;
+			regulator-name = "vdd-cpu";
+		};
+
+		vdd_int_dll: dcdc3 {
+			regulator-always-on;
+			regulator-min-microvolt = <1000000>;
+			regulator-max-microvolt = <1400000>;
+			regulator-name = "vdd-int-dll";
+		};
+
+		vdd_rtc: ldo1 {
+			regulator-always-on;
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1400000>;
+			regulator-name = "vdd-rtc";
+		};
+
+		avcc: ldo2 {
+			regulator-always-on;
+			regulator-min-microvolt = <2700000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-name = "avcc";
+		};
+
+		ldo3 {
+			/* unused */
+		};
+
+		csi1_io_2v8: ldo4 {
+			/* output on extension headers */
+			regulator-name = "csi1-io-2v8";
+		};
+	};
+};
+
-- 
2.1.4

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

* [PATCH v8 2/6] dt-bindings: add vendor-prefix for X-Powers
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai

From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 b1df0ad1306c..1794fce3de80 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -172,6 +172,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)
 xillybus	Xillybus Ltd.
 xlnx	Xilinx
-- 
2.1.4

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

* [PATCH v8 2/6] dt-bindings: add vendor-prefix for X-Powers
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Carlo Caione <carlo@caione.org>

Signed-off-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.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 b1df0ad1306c..1794fce3de80 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -172,6 +172,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)
 xillybus	Xillybus Ltd.
 xlnx	Xilinx
-- 
2.1.4

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

* [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai

From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

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>
[wens-jdAy2FN1RRM@public.gmane.org: make axp20x_pek_remove() static; remove driver owner field]
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 drivers/input/misc/Kconfig      |  11 ++
 drivers/input/misc/Makefile     |   1 +
 drivers/input/misc/axp20x-pek.c | 282 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 294 insertions(+)
 create mode 100644 drivers/input/misc/axp20x-pek.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab6163f..a49bcd351e13 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -404,6 +404,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 19c760361f80..04ea87fd600d 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -54,6 +54,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 000000000000..8dbd097ac939
--- /dev/null
+++ b/drivers/input/misc/axp20x-pek.c
@@ -0,0 +1,282 @@
+/*
+ * 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;
+}
+
+static 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",
+	},
+};
+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");
-- 
2.1.4

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

* [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Carlo Caione <carlo@caione.org>

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>
[wens at csie.org: make axp20x_pek_remove() static; remove driver owner field]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/input/misc/Kconfig      |  11 ++
 drivers/input/misc/Makefile     |   1 +
 drivers/input/misc/axp20x-pek.c | 282 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 294 insertions(+)
 create mode 100644 drivers/input/misc/axp20x-pek.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 23297ab6163f..a49bcd351e13 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -404,6 +404,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 19c760361f80..04ea87fd600d 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -54,6 +54,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 000000000000..8dbd097ac939
--- /dev/null
+++ b/drivers/input/misc/axp20x-pek.c
@@ -0,0 +1,282 @@
+/*
+ * 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;
+}
+
+static 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",
+	},
+};
+module_platform_driver(axp20x_pek_driver);
+
+MODULE_DESCRIPTION("axp20x Power Button");
+MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
+MODULE_LICENSE("GPL");
-- 
2.1.4

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

* [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai

From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

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>
[wens-jdAy2FN1RRM@public.gmane.org: Fixed path for sysfs entries]
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 000000000000..a5e671b9fa79
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
@@ -0,0 +1,11 @@
+What:		/sys/class/input/input(x)/device/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)/device/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>
-- 
2.1.4

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

* [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Carlo Caione <carlo@caione.org>

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

Signed-off-by: Carlo Caione <carlo@caione.org>
[wens at csie.org: Fixed path for sysfs entries]
Signed-off-by: Chen-Yu Tsai <wens@csie.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 000000000000..a5e671b9fa79
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
@@ -0,0 +1,11 @@
+What:		/sys/class/input/input(x)/device/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)/device/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>
-- 
2.1.4

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

* [PATCH v8 5/6] ARM: sunxi: Add AXP20x support in defconfig
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai

From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 7a342d2780a8..0a781e3c6de3 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=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
-- 
2.1.4

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

* [PATCH v8 5/6] ARM: sunxi: Add AXP20x support in defconfig
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Carlo Caione <carlo@caione.org>

Signed-off-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.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 7a342d2780a8..0a781e3c6de3 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=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
-- 
2.1.4

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

* [PATCH v8 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai

From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 2328fe752e9c..bef90c4ca984 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -191,6 +191,7 @@ CONFIG_TOUCHSCREEN_ATMEL_MXT=y
 CONFIG_TOUCHSCREEN_STMPE=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
@@ -278,6 +279,7 @@ CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MESON_WATCHDOG=y
 CONFIG_MFD_AS3722=y
 CONFIG_MFD_BCM590XX=y
+CONFIG_MFD_AXP20X=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX77686=y
@@ -290,6 +292,7 @@ CONFIG_MFD_TPS6586X=y
 CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_BCM590XX=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_MFD_SYSCON=y
-- 
2.1.4

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

* [PATCH v8 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig
@ 2014-12-23  2:53     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-23  2:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Carlo Caione <carlo@caione.org>

Signed-off-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.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 2328fe752e9c..bef90c4ca984 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -191,6 +191,7 @@ CONFIG_TOUCHSCREEN_ATMEL_MXT=y
 CONFIG_TOUCHSCREEN_STMPE=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
@@ -278,6 +279,7 @@ CONFIG_SUNXI_WATCHDOG=y
 CONFIG_MESON_WATCHDOG=y
 CONFIG_MFD_AS3722=y
 CONFIG_MFD_BCM590XX=y
+CONFIG_MFD_AXP20X=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX77686=y
@@ -290,6 +292,7 @@ CONFIG_MFD_TPS6586X=y
 CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_BCM590XX=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_MFD_SYSCON=y
-- 
2.1.4

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

* Re: [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2014-12-24 11:00     ` Carlo Caione
  -1 siblings, 0 replies; 40+ messages in thread
From: Carlo Caione @ 2014-12-24 11:00 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
  Cc: Lee Jones, Mark Brown, Maxime Ripard, Dmitry Torokhov,
	Chen-Yu Tsai, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Carlo Caione

On Tue, Dec 23, 2014 at 3:53 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> Hi everyone,

Hi ChenYu,
Thank you very much for respinning this.

-- 
Carlo Caione

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

* [linux-sunxi] [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-12-24 11:00     ` Carlo Caione
  0 siblings, 0 replies; 40+ messages in thread
From: Carlo Caione @ 2014-12-24 11:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 3:53 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> Hi everyone,

Hi ChenYu,
Thank you very much for respinning this.

-- 
Carlo Caione

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

* Re: [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2014-12-29 23:16         ` Dmitry Torokhov
  -1 siblings, 0 replies; 40+ messages in thread
From: Dmitry Torokhov @ 2014-12-29 23:16 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Mark Brown, Maxime Ripard,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 23, 2014 at 10:53:11AM +0800, Chen-Yu Tsai wrote:
> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> 
> 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>
> [wens-jdAy2FN1RRM@public.gmane.org: make axp20x_pek_remove() static; remove driver owner field]
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Hmm, it looks like MFD parts are in mainline, so I can actually pick
this up myself. OK.

By the way, does driver works for you with the patch below?

Thanks.

-- 
Dmitry

Input: axp20x-pek - switch over to using attribute group

From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Instead of registering device attributes individually let's use attribute
groups and also devm_* infrastructure to ease cleanup.

Refresh of synaptics-forcepad-pnp.patch
---
 drivers/input/misc/axp20x-pek.c |   64 ++++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 28 deletions(-)

diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index 8dbd097..f1c8447 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -138,17 +138,28 @@ static ssize_t axp20x_store_ext_attr(struct device *dev,
 				 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
+	.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
+	.var	= &axp20x_pek_shutdown_ext_attr,
+};
+
+static struct attribute *axp20x_attributes[] = {
+	&axp20x_dev_attr_startup.attr.attr,
+	&axp20x_dev_attr_shutdown.attr.attr,
+	NULL,
+};
+
+static const struct attribute_group axp20x_attribute_group = {
+	.attrs = axp20x_attributes,
 };
 
 static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
@@ -166,6 +177,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
 	return IRQ_HANDLED;
 }
 
+static void axp20x_remove_sysfs_group(void *_data)
+{
+	struct device *dev = _data;
+
+	sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
+}
+
 static int axp20x_pek_probe(struct platform_device *pdev)
 {
 	struct axp20x_pek *axp20x_pek;
@@ -214,12 +232,11 @@ static int axp20x_pek_probe(struct platform_device *pdev)
 	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);
+					     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;
 	}
 
@@ -232,45 +249,36 @@ static int axp20x_pek_probe(struct platform_device *pdev)
 		return error;
 	}
 
-	error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
-	if (error)
+	error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
+	if (error) {
+		dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n",
+			error);
 		return error;
+	}
 
-	error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
-	if (error)
-		goto clear_startup_attr;
+	error = devm_add_action(&pdev->dev,
+				axp20x_remove_sysfs_group, &pdev->dev);
+	if (error) {
+		axp20x_remove_sysfs_group(&pdev->dev);
+		dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
+			error);
+		return error;
+	}
 
 	error = input_register_device(idev);
 	if (error) {
 		dev_err(axp20x->dev, "Can't register input device: %d\n",
 			error);
-		goto clear_attr;
+		return error;
 	}
 
 	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;
-}
-
-static 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",
 	},

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

* [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-12-29 23:16         ` Dmitry Torokhov
  0 siblings, 0 replies; 40+ messages in thread
From: Dmitry Torokhov @ 2014-12-29 23:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 10:53:11AM +0800, Chen-Yu Tsai wrote:
> From: Carlo Caione <carlo@caione.org>
> 
> 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>
> [wens at csie.org: make axp20x_pek_remove() static; remove driver owner field]
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Hmm, it looks like MFD parts are in mainline, so I can actually pick
this up myself. OK.

By the way, does driver works for you with the patch below?

Thanks.

-- 
Dmitry

Input: axp20x-pek - switch over to using attribute group

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Instead of registering device attributes individually let's use attribute
groups and also devm_* infrastructure to ease cleanup.

Refresh of synaptics-forcepad-pnp.patch
---
 drivers/input/misc/axp20x-pek.c |   64 ++++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 28 deletions(-)

diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index 8dbd097..f1c8447 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -138,17 +138,28 @@ static ssize_t axp20x_store_ext_attr(struct device *dev,
 				 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
+	.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
+	.var	= &axp20x_pek_shutdown_ext_attr,
+};
+
+static struct attribute *axp20x_attributes[] = {
+	&axp20x_dev_attr_startup.attr.attr,
+	&axp20x_dev_attr_shutdown.attr.attr,
+	NULL,
+};
+
+static const struct attribute_group axp20x_attribute_group = {
+	.attrs = axp20x_attributes,
 };
 
 static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
@@ -166,6 +177,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
 	return IRQ_HANDLED;
 }
 
+static void axp20x_remove_sysfs_group(void *_data)
+{
+	struct device *dev = _data;
+
+	sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
+}
+
 static int axp20x_pek_probe(struct platform_device *pdev)
 {
 	struct axp20x_pek *axp20x_pek;
@@ -214,12 +232,11 @@ static int axp20x_pek_probe(struct platform_device *pdev)
 	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);
+					     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;
 	}
 
@@ -232,45 +249,36 @@ static int axp20x_pek_probe(struct platform_device *pdev)
 		return error;
 	}
 
-	error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
-	if (error)
+	error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
+	if (error) {
+		dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n",
+			error);
 		return error;
+	}
 
-	error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
-	if (error)
-		goto clear_startup_attr;
+	error = devm_add_action(&pdev->dev,
+				axp20x_remove_sysfs_group, &pdev->dev);
+	if (error) {
+		axp20x_remove_sysfs_group(&pdev->dev);
+		dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
+			error);
+		return error;
+	}
 
 	error = input_register_device(idev);
 	if (error) {
 		dev_err(axp20x->dev, "Can't register input device: %d\n",
 			error);
-		goto clear_attr;
+		return error;
 	}
 
 	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;
-}
-
-static 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",
 	},

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

* Re: [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key
  2014-12-29 23:16         ` Dmitry Torokhov
@ 2014-12-30  7:25           ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-30  7:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Lee Jones, Mark Brown, Maxime Ripard, linux-sunxi, Carlo Caione,
	linux-arm-kernel, linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 30, 2014 at 7:16 AM, Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Tue, Dec 23, 2014 at 10:53:11AM +0800, Chen-Yu Tsai wrote:
>> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>>
>> 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>
>> [wens-jdAy2FN1RRM@public.gmane.org: make axp20x_pek_remove() static; remove driver owner field]
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>
> Hmm, it looks like MFD parts are in mainline, so I can actually pick
> this up myself. OK.

Cool.

>
> By the way, does driver works for you with the patch below?

It does. You could apply it or squash it when you pick up the
PEK patch. I'm ok either way.


Thanks!
ChenYu

> Thanks.
>
> --
> Dmitry
>
> Input: axp20x-pek - switch over to using attribute group
>
> From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> Instead of registering device attributes individually let's use attribute
> groups and also devm_* infrastructure to ease cleanup.
>
> Refresh of synaptics-forcepad-pnp.patch
> ---
>  drivers/input/misc/axp20x-pek.c |   64 ++++++++++++++++++++++-----------------
>  1 file changed, 36 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> index 8dbd097..f1c8447 100644
> --- a/drivers/input/misc/axp20x-pek.c
> +++ b/drivers/input/misc/axp20x-pek.c
> @@ -138,17 +138,28 @@ static ssize_t axp20x_store_ext_attr(struct device *dev,
>                                  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
> +       .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
> +       .var    = &axp20x_pek_shutdown_ext_attr,
> +};
> +
> +static struct attribute *axp20x_attributes[] = {
> +       &axp20x_dev_attr_startup.attr.attr,
> +       &axp20x_dev_attr_shutdown.attr.attr,
> +       NULL,
> +};
> +
> +static const struct attribute_group axp20x_attribute_group = {
> +       .attrs = axp20x_attributes,
>  };
>
>  static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
> @@ -166,6 +177,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
>         return IRQ_HANDLED;
>  }
>
> +static void axp20x_remove_sysfs_group(void *_data)
> +{
> +       struct device *dev = _data;
> +
> +       sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
> +}
> +
>  static int axp20x_pek_probe(struct platform_device *pdev)
>  {
>         struct axp20x_pek *axp20x_pek;
> @@ -214,12 +232,11 @@ static int axp20x_pek_probe(struct platform_device *pdev)
>         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);
> +                                            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;
>         }
>
> @@ -232,45 +249,36 @@ static int axp20x_pek_probe(struct platform_device *pdev)
>                 return error;
>         }
>
> -       error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
> -       if (error)
> +       error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
> +       if (error) {
> +               dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n",
> +                       error);
>                 return error;
> +       }
>
> -       error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
> -       if (error)
> -               goto clear_startup_attr;
> +       error = devm_add_action(&pdev->dev,
> +                               axp20x_remove_sysfs_group, &pdev->dev);
> +       if (error) {
> +               axp20x_remove_sysfs_group(&pdev->dev);
> +               dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
> +                       error);
> +               return error;
> +       }
>
>         error = input_register_device(idev);
>         if (error) {
>                 dev_err(axp20x->dev, "Can't register input device: %d\n",
>                         error);
> -               goto clear_attr;
> +               return error;
>         }
>
>         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;
> -}
> -
> -static 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",
>         },

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

* [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-12-30  7:25           ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2014-12-30  7:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 30, 2014 at 7:16 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Tue, Dec 23, 2014 at 10:53:11AM +0800, Chen-Yu Tsai wrote:
>> From: Carlo Caione <carlo@caione.org>
>>
>> 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>
>> [wens at csie.org: make axp20x_pek_remove() static; remove driver owner field]
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>
> Hmm, it looks like MFD parts are in mainline, so I can actually pick
> this up myself. OK.

Cool.

>
> By the way, does driver works for you with the patch below?

It does. You could apply it or squash it when you pick up the
PEK patch. I'm ok either way.


Thanks!
ChenYu

> Thanks.
>
> --
> Dmitry
>
> Input: axp20x-pek - switch over to using attribute group
>
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> Instead of registering device attributes individually let's use attribute
> groups and also devm_* infrastructure to ease cleanup.
>
> Refresh of synaptics-forcepad-pnp.patch
> ---
>  drivers/input/misc/axp20x-pek.c |   64 ++++++++++++++++++++++-----------------
>  1 file changed, 36 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> index 8dbd097..f1c8447 100644
> --- a/drivers/input/misc/axp20x-pek.c
> +++ b/drivers/input/misc/axp20x-pek.c
> @@ -138,17 +138,28 @@ static ssize_t axp20x_store_ext_attr(struct device *dev,
>                                  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
> +       .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
> +       .var    = &axp20x_pek_shutdown_ext_attr,
> +};
> +
> +static struct attribute *axp20x_attributes[] = {
> +       &axp20x_dev_attr_startup.attr.attr,
> +       &axp20x_dev_attr_shutdown.attr.attr,
> +       NULL,
> +};
> +
> +static const struct attribute_group axp20x_attribute_group = {
> +       .attrs = axp20x_attributes,
>  };
>
>  static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
> @@ -166,6 +177,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
>         return IRQ_HANDLED;
>  }
>
> +static void axp20x_remove_sysfs_group(void *_data)
> +{
> +       struct device *dev = _data;
> +
> +       sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
> +}
> +
>  static int axp20x_pek_probe(struct platform_device *pdev)
>  {
>         struct axp20x_pek *axp20x_pek;
> @@ -214,12 +232,11 @@ static int axp20x_pek_probe(struct platform_device *pdev)
>         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);
> +                                            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;
>         }
>
> @@ -232,45 +249,36 @@ static int axp20x_pek_probe(struct platform_device *pdev)
>                 return error;
>         }
>
> -       error = device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr);
> -       if (error)
> +       error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
> +       if (error) {
> +               dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n",
> +                       error);
>                 return error;
> +       }
>
> -       error = device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr);
> -       if (error)
> -               goto clear_startup_attr;
> +       error = devm_add_action(&pdev->dev,
> +                               axp20x_remove_sysfs_group, &pdev->dev);
> +       if (error) {
> +               axp20x_remove_sysfs_group(&pdev->dev);
> +               dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
> +                       error);
> +               return error;
> +       }
>
>         error = input_register_device(idev);
>         if (error) {
>                 dev_err(axp20x->dev, "Can't register input device: %d\n",
>                         error);
> -               goto clear_attr;
> +               return error;
>         }
>
>         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;
> -}
> -
> -static 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",
>         },

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

* Re: [PATCH v8 5/6] ARM: sunxi: Add AXP20x support in defconfig
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2015-01-06 16:33         ` Maxime Ripard
  -1 siblings, 0 replies; 40+ messages in thread
From: Maxime Ripard @ 2015-01-06 16:33 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Mark Brown, Dmitry Torokhov,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA

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

On Tue, Dec 23, 2014 at 10:53:13AM +0800, Chen-Yu Tsai wrote:
> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> 
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Applied, thanks!

Maxime

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

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

* [PATCH v8 5/6] ARM: sunxi: Add AXP20x support in defconfig
@ 2015-01-06 16:33         ` Maxime Ripard
  0 siblings, 0 replies; 40+ messages in thread
From: Maxime Ripard @ 2015-01-06 16:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 10:53:13AM +0800, Chen-Yu Tsai wrote:
> From: Carlo Caione <carlo@caione.org>
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

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

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

* Re: [PATCH v8 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2015-01-06 16:34         ` Maxime Ripard
  -1 siblings, 0 replies; 40+ messages in thread
From: Maxime Ripard @ 2015-01-06 16:34 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Mark Brown, Dmitry Torokhov,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA

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

On Tue, Dec 23, 2014 at 10:53:14AM +0800, Chen-Yu Tsai wrote:
> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> 
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Applied, thanks!

Maxime

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

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

* [PATCH v8 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig
@ 2015-01-06 16:34         ` Maxime Ripard
  0 siblings, 0 replies; 40+ messages in thread
From: Maxime Ripard @ 2015-01-06 16:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 10:53:14AM +0800, Chen-Yu Tsai wrote:
> From: Carlo Caione <carlo@caione.org>
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

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

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

* Re: [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2015-01-11  2:02         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-11  2:02 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-sunxi, Carlo Caione, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai, Lee Jones,
	Maxime Ripard, Dmitry Torokhov

On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>
> 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>
> [wens-jdAy2FN1RRM@public.gmane.org: clarify interrupt source for the axp PMIC]
> [wens-jdAy2FN1RRM@public.gmane.org: explain dcdc-workmode in detail and trim lines to 80 chars]
> [wens-jdAy2FN1RRM@public.gmane.org: make regulator supplies optional if using unregulated input]
> [wens-jdAy2FN1RRM@public.gmane.org: use cubieboard2 regulator nodes as example]
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
>  1 file changed, 97 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 000000000000..b775d8ccbc7c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,97 @@
> +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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
> +- interrupt-controller: axp20x has its own internal IRQs
> +- #interrupt-cells: Should be set to 1
> +- 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. Regulators not used should
> +             still be listed for completeness and that the regulator subsystem
> +             properly registers them.
> +
> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
> +                     (range: 750-1875). Default: 1.5MHz
> +
> +Optional properties:
> +- regulator supplies - may be omitted if inputs are unregulated, such as using
> +                      the IPSOUT output from the PMIC
> +  - 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
> +
> +Optional properties for DCDC regulators:
> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
> +                         Default: AUTO mode
> +                         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.

Hi Mark,

You raised some questions during v7 about the regulator bits, specifically
about the "x-powers,dcdc-workmode" property. I've expanded the regulator
parts of the DT bindings doc.

Is the current version clear enough for you? I'd like to get this merged.


Thank You
ChenYu

> +
> +Example:
> +
> +axp209: pmic@34 {
> +       compatible = "x-powers,axp209";
> +       reg = <0x34>;
> +       interrupt-parent = <&nmi_intc>;
> +       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +       interrupt-controller;
> +       #interrupt-cells = <1>;
> +
> +       regulators {
> +               x-powers,dcdc-freq = <1500>;
> +
> +               vdd_cpu: dcdc2 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <1000000>;
> +                       regulator-max-microvolt = <1450000>;
> +                       regulator-name = "vdd-cpu";
> +               };
> +
> +               vdd_int_dll: dcdc3 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <1000000>;
> +                       regulator-max-microvolt = <1400000>;
> +                       regulator-name = "vdd-int-dll";
> +               };
> +
> +               vdd_rtc: ldo1 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <1200000>;
> +                       regulator-max-microvolt = <1400000>;
> +                       regulator-name = "vdd-rtc";
> +               };
> +
> +               avcc: ldo2 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <2700000>;
> +                       regulator-max-microvolt = <3300000>;
> +                       regulator-name = "avcc";
> +               };
> +
> +               ldo3 {
> +                       /* unused */
> +               };
> +
> +               csi1_io_2v8: ldo4 {
> +                       /* output on extension headers */
> +                       regulator-name = "csi1-io-2v8";
> +               };
> +       };
> +};
> +
> --
> 2.1.4
>

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

* [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
@ 2015-01-11  2:02         ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-11  2:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> From: Carlo Caione <carlo@caione.org>
>
> 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>
> [wens at csie.org: clarify interrupt source for the axp PMIC]
> [wens at csie.org: explain dcdc-workmode in detail and trim lines to 80 chars]
> [wens at csie.org: make regulator supplies optional if using unregulated input]
> [wens at csie.org: use cubieboard2 regulator nodes as example]
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
>  1 file changed, 97 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 000000000000..b775d8ccbc7c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,97 @@
> +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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
> +- interrupt-controller: axp20x has its own internal IRQs
> +- #interrupt-cells: Should be set to 1
> +- 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. Regulators not used should
> +             still be listed for completeness and that the regulator subsystem
> +             properly registers them.
> +
> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
> +                     (range: 750-1875). Default: 1.5MHz
> +
> +Optional properties:
> +- regulator supplies - may be omitted if inputs are unregulated, such as using
> +                      the IPSOUT output from the PMIC
> +  - 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
> +
> +Optional properties for DCDC regulators:
> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
> +                         Default: AUTO mode
> +                         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.

Hi Mark,

You raised some questions during v7 about the regulator bits, specifically
about the "x-powers,dcdc-workmode" property. I've expanded the regulator
parts of the DT bindings doc.

Is the current version clear enough for you? I'd like to get this merged.


Thank You
ChenYu

> +
> +Example:
> +
> +axp209: pmic at 34 {
> +       compatible = "x-powers,axp209";
> +       reg = <0x34>;
> +       interrupt-parent = <&nmi_intc>;
> +       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +       interrupt-controller;
> +       #interrupt-cells = <1>;
> +
> +       regulators {
> +               x-powers,dcdc-freq = <1500>;
> +
> +               vdd_cpu: dcdc2 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <1000000>;
> +                       regulator-max-microvolt = <1450000>;
> +                       regulator-name = "vdd-cpu";
> +               };
> +
> +               vdd_int_dll: dcdc3 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <1000000>;
> +                       regulator-max-microvolt = <1400000>;
> +                       regulator-name = "vdd-int-dll";
> +               };
> +
> +               vdd_rtc: ldo1 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <1200000>;
> +                       regulator-max-microvolt = <1400000>;
> +                       regulator-name = "vdd-rtc";
> +               };
> +
> +               avcc: ldo2 {
> +                       regulator-always-on;
> +                       regulator-min-microvolt = <2700000>;
> +                       regulator-max-microvolt = <3300000>;
> +                       regulator-name = "avcc";
> +               };
> +
> +               ldo3 {
> +                       /* unused */
> +               };
> +
> +               csi1_io_2v8: ldo4 {
> +                       /* output on extension headers */
> +                       regulator-name = "csi1-io-2v8";
> +               };
> +       };
> +};
> +
> --
> 2.1.4
>

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

* Re: [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2015-01-15 16:00         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-15 16:00 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-sunxi, Carlo Caione, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai, Lee Jones,
	Mark Brown, Maxime Ripard

On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>
> Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Hi Dmitry,

Would it be possible to take this patch through your tree?


Thanks
ChenYu

> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> [wens-jdAy2FN1RRM@public.gmane.org: Fixed path for sysfs entries]
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 000000000000..a5e671b9fa79
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
> @@ -0,0 +1,11 @@
> +What:          /sys/class/input/input(x)/device/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)/device/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>
> --
> 2.1.4
>

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

* [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
@ 2015-01-15 16:00         ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-15 16:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> From: Carlo Caione <carlo@caione.org>
>
> Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Hi Dmitry,

Would it be possible to take this patch through your tree?


Thanks
ChenYu

> Signed-off-by: Carlo Caione <carlo@caione.org>
> [wens at csie.org: Fixed path for sysfs entries]
> Signed-off-by: Chen-Yu Tsai <wens@csie.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 000000000000..a5e671b9fa79
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
> @@ -0,0 +1,11 @@
> +What:          /sys/class/input/input(x)/device/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)/device/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>
> --
> 2.1.4
>

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

* Re: [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
  2015-01-15 16:00         ` Chen-Yu Tsai
@ 2015-01-15 17:39             ` Dmitry Torokhov
  -1 siblings, 0 replies; 40+ messages in thread
From: Dmitry Torokhov @ 2015-01-15 17:39 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: linux-sunxi, Carlo Caione, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Lee Jones, Mark Brown,
	Maxime Ripard

Hi Chen-Yu,

On Fri, Jan 16, 2015 at 12:00:31AM +0800, Chen-Yu Tsai wrote:
> On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> > From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> >
> > Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.
> 
> Hi Dmitry,
> 
> Would it be possible to take this patch through your tree?

Actually I folded it into the original patch adding the code so it's
already there.

Thanks.

> 
> 
> Thanks
> ChenYu
> 
> > Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> > [wens-jdAy2FN1RRM@public.gmane.org: Fixed path for sysfs entries]
> > Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 000000000000..a5e671b9fa79
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
> > @@ -0,0 +1,11 @@
> > +What:          /sys/class/input/input(x)/device/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)/device/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>
> > --
> > 2.1.4
> >

-- 
Dmitry

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

* [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
@ 2015-01-15 17:39             ` Dmitry Torokhov
  0 siblings, 0 replies; 40+ messages in thread
From: Dmitry Torokhov @ 2015-01-15 17:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chen-Yu,

On Fri, Jan 16, 2015 at 12:00:31AM +0800, Chen-Yu Tsai wrote:
> On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> > From: Carlo Caione <carlo@caione.org>
> >
> > Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.
> 
> Hi Dmitry,
> 
> Would it be possible to take this patch through your tree?

Actually I folded it into the original patch adding the code so it's
already there.

Thanks.

> 
> 
> Thanks
> ChenYu
> 
> > Signed-off-by: Carlo Caione <carlo@caione.org>
> > [wens at csie.org: Fixed path for sysfs entries]
> > Signed-off-by: Chen-Yu Tsai <wens@csie.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 000000000000..a5e671b9fa79
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
> > @@ -0,0 +1,11 @@
> > +What:          /sys/class/input/input(x)/device/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)/device/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>
> > --
> > 2.1.4
> >

-- 
Dmitry

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

* Re: [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
  2015-01-15 17:39             ` Dmitry Torokhov
@ 2015-01-16  1:01               ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-16  1:01 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-sunxi, Carlo Caione, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Lee Jones, Mark Brown,
	Maxime Ripard

On Fri, Jan 16, 2015 at 1:39 AM, Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Chen-Yu,
>
> On Fri, Jan 16, 2015 at 12:00:31AM +0800, Chen-Yu Tsai wrote:
>> On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
>> > From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> >
>> > Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.
>>
>> Hi Dmitry,
>>
>> Would it be possible to take this patch through your tree?
>
> Actually I folded it into the original patch adding the code so it's
> already there.

Sorry I didn't look deep enough. Just looked at the commit messages.

Thanks again.

ChenYu

> Thanks.
>
>>
>>
>> Thanks
>> ChenYu
>>
>> > Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> > [wens-jdAy2FN1RRM@public.gmane.org: Fixed path for sysfs entries]
>> > Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@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 000000000000..a5e671b9fa79
>> > --- /dev/null
>> > +++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
>> > @@ -0,0 +1,11 @@
>> > +What:          /sys/class/input/input(x)/device/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)/device/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>
>> > --
>> > 2.1.4
>> >
>
> --
> Dmitry

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

* [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK
@ 2015-01-16  1:01               ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-16  1:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 16, 2015 at 1:39 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Chen-Yu,
>
> On Fri, Jan 16, 2015 at 12:00:31AM +0800, Chen-Yu Tsai wrote:
>> On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens@csie.org> wrote:
>> > From: Carlo Caione <carlo@caione.org>
>> >
>> > Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.
>>
>> Hi Dmitry,
>>
>> Would it be possible to take this patch through your tree?
>
> Actually I folded it into the original patch adding the code so it's
> already there.

Sorry I didn't look deep enough. Just looked at the commit messages.

Thanks again.

ChenYu

> Thanks.
>
>>
>>
>> Thanks
>> ChenYu
>>
>> > Signed-off-by: Carlo Caione <carlo@caione.org>
>> > [wens at csie.org: Fixed path for sysfs entries]
>> > Signed-off-by: Chen-Yu Tsai <wens@csie.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 000000000000..a5e671b9fa79
>> > --- /dev/null
>> > +++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
>> > @@ -0,0 +1,11 @@
>> > +What:          /sys/class/input/input(x)/device/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)/device/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>
>> > --
>> > 2.1.4
>> >
>
> --
> Dmitry

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

* Re: [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
  2014-12-23  2:53 ` Chen-Yu Tsai
@ 2015-01-16  1:08     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-16  1:08 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-sunxi, Chen-Yu Tsai, linux-arm-kernel,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Carlo Caione, Mark Brown,
	Maxime Ripard, Dmitry Torokhov

On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> Hi everyone,
>
> This is v8 of the AXP20x PMIC patches. These are the remaining patches
> of the original series: PEK (power button) input driver, binding docs,
> and defconfig updates.
>
> Mark raised some questions during v7 about the first patch, specifically
> about the "x-powers,dcdc-workmode" property. I've expanded the regulator
> parts of the DT bindings doc. Mark, if you could take a look and give us
> your blessing?
>
> Dmitry, you were OK with the input bits going through the MFD tree, is
> that still the case?
>
> If there are no more problems, maybe Lee could take patches 1~4, and
> Maxime can take the defconfig patches through his tree.

Hi Lee,

Can we get the last remaining patches (1 & 2) merged?

Thanks
ChenYu

> Thanks
> ChenYu
>
>
> Changes since v7:
>
>         - DT bindings
>           * Clarified the AXP's interrupt source
>           * Added explaination for "x-powers,dcdc-workmode" property
>           * Made regulator supply properties optional. They can be omitted
>             when the input is unregulated, as is the case when they are
>             connected to the IPSOUT output on the PMIC.
>           * Used real world example (Cubieboard2) for regulator nodes
>
>         - Fixed paths for PEK sysfs entries.
>
>         - PEK driver
>           * Made axp20x_pek_remove() in PEK driver static.
>           * Removed driver owner field.
>           * Wrapped some lines over 80 characters.
>
>
> Original cover letter from v7:
>
>
> 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   |  97 +++++++
>  .../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                    | 282 +++++++++++++++++++++
>  8 files changed, 409 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
>
> --
> 2.1.4
>

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

* [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2015-01-16  1:08     ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-16  1:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 23, 2014 at 10:53 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> Hi everyone,
>
> This is v8 of the AXP20x PMIC patches. These are the remaining patches
> of the original series: PEK (power button) input driver, binding docs,
> and defconfig updates.
>
> Mark raised some questions during v7 about the first patch, specifically
> about the "x-powers,dcdc-workmode" property. I've expanded the regulator
> parts of the DT bindings doc. Mark, if you could take a look and give us
> your blessing?
>
> Dmitry, you were OK with the input bits going through the MFD tree, is
> that still the case?
>
> If there are no more problems, maybe Lee could take patches 1~4, and
> Maxime can take the defconfig patches through his tree.

Hi Lee,

Can we get the last remaining patches (1 & 2) merged?

Thanks
ChenYu

> Thanks
> ChenYu
>
>
> Changes since v7:
>
>         - DT bindings
>           * Clarified the AXP's interrupt source
>           * Added explaination for "x-powers,dcdc-workmode" property
>           * Made regulator supply properties optional. They can be omitted
>             when the input is unregulated, as is the case when they are
>             connected to the IPSOUT output on the PMIC.
>           * Used real world example (Cubieboard2) for regulator nodes
>
>         - Fixed paths for PEK sysfs entries.
>
>         - PEK driver
>           * Made axp20x_pek_remove() in PEK driver static.
>           * Removed driver owner field.
>           * Wrapped some lines over 80 characters.
>
>
> Original cover letter from v7:
>
>
> 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   |  97 +++++++
>  .../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                    | 282 +++++++++++++++++++++
>  8 files changed, 409 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
>
> --
> 2.1.4
>

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

* Re: [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2015-01-19  9:37         ` Lee Jones
  -1 siblings, 0 replies; 40+ messages in thread
From: Lee Jones @ 2015-01-19  9:37 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Mark Brown, Maxime Ripard, Dmitry Torokhov,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA

On Tue, 23 Dec 2014, Chen-Yu Tsai wrote:

> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> 
> 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>
> [wens-jdAy2FN1RRM@public.gmane.org: clarify interrupt source for the axp PMIC]
> [wens-jdAy2FN1RRM@public.gmane.org: explain dcdc-workmode in detail and trim lines to 80 chars]
> [wens-jdAy2FN1RRM@public.gmane.org: make regulator supplies optional if using unregulated input]
> [wens-jdAy2FN1RRM@public.gmane.org: use cubieboard2 regulator nodes as example]
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
>  1 file changed, 97 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 000000000000..b775d8ccbc7c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,97 @@
> +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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
> +- interrupt-controller: axp20x has its own internal IRQs
> +- #interrupt-cells: Should be set to 1
> +- 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. Regulators not used should
> +	      still be listed for completeness and that the regulator subsystem
> +	      properly registers them.
> +
> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
> +		      (range: 750-1875). Default: 1.5MHz

I'm not keen on defining new properties when existing properties would
suffice.  How about using clock-frequency here instead?  Also it's not
common to issue this stuff using metric prefixes (KHz, MHz, etc).
Please use HZ.

> +Optional properties:
> +- regulator supplies - may be omitted if inputs are unregulated, such as using
> +		       the IPSOUT output from the PMIC
> +  - 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
> +
> +Optional properties for DCDC regulators:
> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode

If there only two options, please use bool.

'x-powers,dcdc-workmode-pwm' and default to auto if it's not present.

> +			  Default: AUTO mode
> +			  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.
> +
> +Example:
> +
> +axp209: pmic@34 {
> +	compatible = "x-powers,axp209";
> +	reg = <0x34>;
> +	interrupt-parent = <&nmi_intc>;
> +	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +	interrupt-controller;
> +	#interrupt-cells = <1>;
> +
> +	regulators {
> +		x-powers,dcdc-freq = <1500>;
> +
> +		vdd_cpu: dcdc2 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <1000000>;
> +			regulator-max-microvolt = <1450000>;
> +			regulator-name = "vdd-cpu";
> +		};
> +
> +		vdd_int_dll: dcdc3 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <1000000>;
> +			regulator-max-microvolt = <1400000>;
> +			regulator-name = "vdd-int-dll";
> +		};
> +
> +		vdd_rtc: ldo1 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <1200000>;
> +			regulator-max-microvolt = <1400000>;
> +			regulator-name = "vdd-rtc";
> +		};
> +
> +		avcc: ldo2 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <2700000>;
> +			regulator-max-microvolt = <3300000>;
> +			regulator-name = "avcc";
> +		};
> +
> +		ldo3 {
> +			/* unused */
> +		};

Does this need to be in the example?

> +		csi1_io_2v8: ldo4 {
> +			/* output on extension headers */
> +			regulator-name = "csi1-io-2v8";
> +		};
> +	};
> +};
> +

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

-- 
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] 40+ messages in thread

* [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
@ 2015-01-19  9:37         ` Lee Jones
  0 siblings, 0 replies; 40+ messages in thread
From: Lee Jones @ 2015-01-19  9:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Dec 2014, Chen-Yu Tsai wrote:

> From: Carlo Caione <carlo@caione.org>
> 
> 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>
> [wens at csie.org: clarify interrupt source for the axp PMIC]
> [wens at csie.org: explain dcdc-workmode in detail and trim lines to 80 chars]
> [wens at csie.org: make regulator supplies optional if using unregulated input]
> [wens at csie.org: use cubieboard2 regulator nodes as example]
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
>  1 file changed, 97 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 000000000000..b775d8ccbc7c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -0,0 +1,97 @@
> +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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
> +- interrupt-controller: axp20x has its own internal IRQs
> +- #interrupt-cells: Should be set to 1
> +- 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. Regulators not used should
> +	      still be listed for completeness and that the regulator subsystem
> +	      properly registers them.
> +
> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
> +		      (range: 750-1875). Default: 1.5MHz

I'm not keen on defining new properties when existing properties would
suffice.  How about using clock-frequency here instead?  Also it's not
common to issue this stuff using metric prefixes (KHz, MHz, etc).
Please use HZ.

> +Optional properties:
> +- regulator supplies - may be omitted if inputs are unregulated, such as using
> +		       the IPSOUT output from the PMIC
> +  - 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
> +
> +Optional properties for DCDC regulators:
> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode

If there only two options, please use bool.

'x-powers,dcdc-workmode-pwm' and default to auto if it's not present.

> +			  Default: AUTO mode
> +			  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.
> +
> +Example:
> +
> +axp209: pmic at 34 {
> +	compatible = "x-powers,axp209";
> +	reg = <0x34>;
> +	interrupt-parent = <&nmi_intc>;
> +	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +	interrupt-controller;
> +	#interrupt-cells = <1>;
> +
> +	regulators {
> +		x-powers,dcdc-freq = <1500>;
> +
> +		vdd_cpu: dcdc2 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <1000000>;
> +			regulator-max-microvolt = <1450000>;
> +			regulator-name = "vdd-cpu";
> +		};
> +
> +		vdd_int_dll: dcdc3 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <1000000>;
> +			regulator-max-microvolt = <1400000>;
> +			regulator-name = "vdd-int-dll";
> +		};
> +
> +		vdd_rtc: ldo1 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <1200000>;
> +			regulator-max-microvolt = <1400000>;
> +			regulator-name = "vdd-rtc";
> +		};
> +
> +		avcc: ldo2 {
> +			regulator-always-on;
> +			regulator-min-microvolt = <2700000>;
> +			regulator-max-microvolt = <3300000>;
> +			regulator-name = "avcc";
> +		};
> +
> +		ldo3 {
> +			/* unused */
> +		};

Does this need to be in the example?

> +		csi1_io_2v8: ldo4 {
> +			/* output on extension headers */
> +			regulator-name = "csi1-io-2v8";
> +		};
> +	};
> +};
> +

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

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

* Re: [PATCH v8 2/6] dt-bindings: add vendor-prefix for X-Powers
  2014-12-23  2:53     ` Chen-Yu Tsai
@ 2015-01-19  9:38         ` Lee Jones
  -1 siblings, 0 replies; 40+ messages in thread
From: Lee Jones @ 2015-01-19  9:38 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Mark Brown, Maxime Ripard, Dmitry Torokhov,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Carlo Caione,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA

On Tue, 23 Dec 2014, Chen-Yu Tsai wrote:

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

Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index b1df0ad1306c..1794fce3de80 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -172,6 +172,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)
>  xillybus	Xillybus Ltd.
>  xlnx	Xilinx

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

-- 
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] 40+ messages in thread

* [PATCH v8 2/6] dt-bindings: add vendor-prefix for X-Powers
@ 2015-01-19  9:38         ` Lee Jones
  0 siblings, 0 replies; 40+ messages in thread
From: Lee Jones @ 2015-01-19  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Dec 2014, Chen-Yu Tsai wrote:

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

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index b1df0ad1306c..1794fce3de80 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -172,6 +172,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)
>  xillybus	Xillybus Ltd.
>  xlnx	Xilinx

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

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

* Re: Re: [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
  2015-01-19  9:37         ` Lee Jones
@ 2015-01-19 10:02           ` Chen-Yu Tsai
  -1 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-19 10:02 UTC (permalink / raw)
  To: Lee Jones
  Cc: Mark Brown, Maxime Ripard, Dmitry Torokhov, Carlo Caione,
	linux-arm-kernel, linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, linux-sunxi

On Mon, Jan 19, 2015 at 5:37 PM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On Tue, 23 Dec 2014, Chen-Yu Tsai wrote:
>
>> From: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>>
>> 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>
>> [wens-jdAy2FN1RRM@public.gmane.org: clarify interrupt source for the axp PMIC]
>> [wens-jdAy2FN1RRM@public.gmane.org: explain dcdc-workmode in detail and trim lines to 80 chars]
>> [wens-jdAy2FN1RRM@public.gmane.org: make regulator supplies optional if using unregulated input]
>> [wens-jdAy2FN1RRM@public.gmane.org: use cubieboard2 regulator nodes as example]
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
>>  1 file changed, 97 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 000000000000..b775d8ccbc7c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -0,0 +1,97 @@
>> +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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
>> +- interrupt-controller: axp20x has its own internal IRQs
>> +- #interrupt-cells: Should be set to 1
>> +- 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. Regulators not used should
>> +           still be listed for completeness and that the regulator subsystem
>> +           properly registers them.
>> +
>> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
>> +                   (range: 750-1875). Default: 1.5MHz
>
> I'm not keen on defining new properties when existing properties would
> suffice.  How about using clock-frequency here instead?  Also it's not
> common to issue this stuff using metric prefixes (KHz, MHz, etc).
> Please use HZ.

I was a bit worried about conflicts later on with things like ADC
sampling rates. But I guess that would be in a separate sub-node.
So yeah, using clock-frequencies should work out. Same for the
prefix. I'll add a patch to fix axp209.dtsi that was merged.

>> +Optional properties:
>> +- regulator supplies - may be omitted if inputs are unregulated, such as using
>> +                    the IPSOUT output from the PMIC
>> +  - 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
>> +
>> +Optional properties for DCDC regulators:
>> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
>
> If there only two options, please use bool.
>
> 'x-powers,dcdc-workmode-pwm' and default to auto if it's not present.

OK. Adding another regulator patch for this.

>> +                       Default: AUTO mode
>> +                       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.
>> +
>> +Example:
>> +
>> +axp209: pmic@34 {
>> +     compatible = "x-powers,axp209";
>> +     reg = <0x34>;
>> +     interrupt-parent = <&nmi_intc>;
>> +     interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
>> +     interrupt-controller;
>> +     #interrupt-cells = <1>;
>> +
>> +     regulators {
>> +             x-powers,dcdc-freq = <1500>;
>> +
>> +             vdd_cpu: dcdc2 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1000000>;
>> +                     regulator-max-microvolt = <1450000>;
>> +                     regulator-name = "vdd-cpu";
>> +             };
>> +
>> +             vdd_int_dll: dcdc3 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1000000>;
>> +                     regulator-max-microvolt = <1400000>;
>> +                     regulator-name = "vdd-int-dll";
>> +             };
>> +
>> +             vdd_rtc: ldo1 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1200000>;
>> +                     regulator-max-microvolt = <1400000>;
>> +                     regulator-name = "vdd-rtc";
>> +             };
>> +
>> +             avcc: ldo2 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <2700000>;
>> +                     regulator-max-microvolt = <3300000>;
>> +                     regulator-name = "avcc";
>> +             };
>> +
>> +             ldo3 {
>> +                     /* unused */
>> +             };
>
> Does this need to be in the example?

This follows the bit in the bindings saying that _all_ regulators
should be listed, even unused ones, so the regulator subsystem
can do cleanup.

>> +             csi1_io_2v8: ldo4 {
>> +                     /* output on extension headers */
>> +                     regulator-name = "csi1-io-2v8";
>> +             };
>> +     };

ldo5 is missing here.

>> +};
>> +

Thanks for the review.

Regards,
ChenYu

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

* [linux-sunxi] Re: [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation
@ 2015-01-19 10:02           ` Chen-Yu Tsai
  0 siblings, 0 replies; 40+ messages in thread
From: Chen-Yu Tsai @ 2015-01-19 10:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 19, 2015 at 5:37 PM, Lee Jones <lee.jones@linaro.org> wrote:
> On Tue, 23 Dec 2014, Chen-Yu Tsai wrote:
>
>> From: Carlo Caione <carlo@caione.org>
>>
>> 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>
>> [wens at csie.org: clarify interrupt source for the axp PMIC]
>> [wens at csie.org: explain dcdc-workmode in detail and trim lines to 80 chars]
>> [wens at csie.org: make regulator supplies optional if using unregulated input]
>> [wens at csie.org: use cubieboard2 regulator nodes as example]
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt | 97 ++++++++++++++++++++++++
>>  1 file changed, 97 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 000000000000..b775d8ccbc7c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -0,0 +1,97 @@
>> +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: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
>> +- interrupt-controller: axp20x has its own internal IRQs
>> +- #interrupt-cells: Should be set to 1
>> +- 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. Regulators not used should
>> +           still be listed for completeness and that the regulator subsystem
>> +           properly registers them.
>> +
>> +- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
>> +                   (range: 750-1875). Default: 1.5MHz
>
> I'm not keen on defining new properties when existing properties would
> suffice.  How about using clock-frequency here instead?  Also it's not
> common to issue this stuff using metric prefixes (KHz, MHz, etc).
> Please use HZ.

I was a bit worried about conflicts later on with things like ADC
sampling rates. But I guess that would be in a separate sub-node.
So yeah, using clock-frequencies should work out. Same for the
prefix. I'll add a patch to fix axp209.dtsi that was merged.

>> +Optional properties:
>> +- regulator supplies - may be omitted if inputs are unregulated, such as using
>> +                    the IPSOUT output from the PMIC
>> +  - 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
>> +
>> +Optional properties for DCDC regulators:
>> +- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO (PWM/PFM) mode
>
> If there only two options, please use bool.
>
> 'x-powers,dcdc-workmode-pwm' and default to auto if it's not present.

OK. Adding another regulator patch for this.

>> +                       Default: AUTO mode
>> +                       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.
>> +
>> +Example:
>> +
>> +axp209: pmic at 34 {
>> +     compatible = "x-powers,axp209";
>> +     reg = <0x34>;
>> +     interrupt-parent = <&nmi_intc>;
>> +     interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
>> +     interrupt-controller;
>> +     #interrupt-cells = <1>;
>> +
>> +     regulators {
>> +             x-powers,dcdc-freq = <1500>;
>> +
>> +             vdd_cpu: dcdc2 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1000000>;
>> +                     regulator-max-microvolt = <1450000>;
>> +                     regulator-name = "vdd-cpu";
>> +             };
>> +
>> +             vdd_int_dll: dcdc3 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1000000>;
>> +                     regulator-max-microvolt = <1400000>;
>> +                     regulator-name = "vdd-int-dll";
>> +             };
>> +
>> +             vdd_rtc: ldo1 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1200000>;
>> +                     regulator-max-microvolt = <1400000>;
>> +                     regulator-name = "vdd-rtc";
>> +             };
>> +
>> +             avcc: ldo2 {
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <2700000>;
>> +                     regulator-max-microvolt = <3300000>;
>> +                     regulator-name = "avcc";
>> +             };
>> +
>> +             ldo3 {
>> +                     /* unused */
>> +             };
>
> Does this need to be in the example?

This follows the bit in the bindings saying that _all_ regulators
should be listed, even unused ones, so the regulator subsystem
can do cleanup.

>> +             csi1_io_2v8: ldo4 {
>> +                     /* output on extension headers */
>> +                     regulator-name = "csi1-io-2v8";
>> +             };
>> +     };

ldo5 is missing here.

>> +};
>> +

Thanks for the review.

Regards,
ChenYu

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

end of thread, other threads:[~2015-01-19 10:02 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23  2:53 [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209 Chen-Yu Tsai
2014-12-23  2:53 ` Chen-Yu Tsai
     [not found] ` <1419303194-3075-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2014-12-23  2:53   ` [PATCH v8 1/6] mfd: AXP20x: Add bindings documentation Chen-Yu Tsai
2014-12-23  2:53     ` Chen-Yu Tsai
     [not found]     ` <1419303194-3075-2-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-01-11  2:02       ` Chen-Yu Tsai
2015-01-11  2:02         ` Chen-Yu Tsai
2015-01-19  9:37       ` Lee Jones
2015-01-19  9:37         ` Lee Jones
2015-01-19 10:02         ` Chen-Yu Tsai
2015-01-19 10:02           ` [linux-sunxi] " Chen-Yu Tsai
2014-12-23  2:53   ` [PATCH v8 2/6] dt-bindings: add vendor-prefix for X-Powers Chen-Yu Tsai
2014-12-23  2:53     ` Chen-Yu Tsai
     [not found]     ` <1419303194-3075-3-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-01-19  9:38       ` Lee Jones
2015-01-19  9:38         ` Lee Jones
2014-12-23  2:53   ` [PATCH v8 3/6] input: misc: Add driver for AXP20x Power Enable Key Chen-Yu Tsai
2014-12-23  2:53     ` Chen-Yu Tsai
     [not found]     ` <1419303194-3075-4-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2014-12-29 23:16       ` Dmitry Torokhov
2014-12-29 23:16         ` Dmitry Torokhov
2014-12-30  7:25         ` Chen-Yu Tsai
2014-12-30  7:25           ` Chen-Yu Tsai
2014-12-23  2:53   ` [PATCH v8 4/6] input: misc: Add ABI docs for AXP20x PEK Chen-Yu Tsai
2014-12-23  2:53     ` Chen-Yu Tsai
     [not found]     ` <1419303194-3075-5-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-01-15 16:00       ` Chen-Yu Tsai
2015-01-15 16:00         ` Chen-Yu Tsai
     [not found]         ` <CAGb2v64AvP+niDrFU-vGGsXUoKD_kv34DqEPRFUZ0fiyeWiz9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-15 17:39           ` Dmitry Torokhov
2015-01-15 17:39             ` Dmitry Torokhov
2015-01-16  1:01             ` Chen-Yu Tsai
2015-01-16  1:01               ` Chen-Yu Tsai
2014-12-23  2:53   ` [PATCH v8 5/6] ARM: sunxi: Add AXP20x support in defconfig Chen-Yu Tsai
2014-12-23  2:53     ` Chen-Yu Tsai
     [not found]     ` <1419303194-3075-6-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-01-06 16:33       ` Maxime Ripard
2015-01-06 16:33         ` Maxime Ripard
2014-12-23  2:53   ` [PATCH v8 6/6] ARM: sunxi: Add AXP20x support multi_v7_defconfig Chen-Yu Tsai
2014-12-23  2:53     ` Chen-Yu Tsai
     [not found]     ` <1419303194-3075-7-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-01-06 16:34       ` Maxime Ripard
2015-01-06 16:34         ` Maxime Ripard
2014-12-24 11:00   ` [PATCH v8 0/6] mfd: AXP20x: Add support for AXP202 and AXP209 Carlo Caione
2014-12-24 11:00     ` [linux-sunxi] " Carlo Caione
2015-01-16  1:08   ` Chen-Yu Tsai
2015-01-16  1:08     ` Chen-Yu Tsai

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.