mfd: AXP20x: Add support for AXP202 and AXP209
Subsystems (8)
v3 cover mfd: AXP20x: Add support for AXP202 and AXP209
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)
This patchset depends on patchsets:
irq: sun4i IRQ 0 / ENMI fixes (Hans de Goede)
ARM: sun7i/sun6i: irqchip: Irqchip driver for NMI controller (Carlo Caione)
regulator: helpers: Modify helpers enabling multi-bit control (Carlo Caione)
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
Carlo Caione (10):
mfd: AXP20x: Add mfd driver for AXP20x PMIC
dt-bindings: add vendor-prefix for X-Powers
mfd: AXP20x: Add bindings documentation
input: misc: Add driver for AXP20x Power Enable Key
input: misc: Add ABI docs for AXP20x PEK
regulator: AXP20x: Add support for regulators subsystem
ARM: sunxi: dt: Add x-powers-axp209.dtsi file
ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
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 | 83 ++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/boot/dts/sun4i-a10-a1000.dts | 13 + arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 13 + arch/arm/boot/dts/sun4i-a10-hackberry.dts | 19 ++ arch/arm/boot/dts/sun4i-a10-inet97fv2.dts | 13 + arch/arm/boot/dts/sun4i-a10-mini-xplus.dts | 19 ++ arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts | 19 ++ arch/arm/boot/dts/sun4i-a10-pcduino.dts | 13 + arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 14 ++ arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 15 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 14 ++ arch/arm/boot/dts/x-powers-axp209.dtsi | 54 ++++ arch/arm/configs/multi_v7_defconfig | 3 + arch/arm/configs/sunxi_defconfig | 4 + drivers/input/misc/Kconfig | 11 + drivers/input/misc/Makefile | 1 + drivers/input/misc/axp20x-pek.c | 260 +++++++++++++++++++ drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/axp20x.c | 240 ++++++++++++++++++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/axp20x-regulator.c | 280 +++++++++++++++++++++ include/linux/mfd/axp20x.h | 180 +++++++++++++ 26 files changed, 1301 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt create mode 100644 arch/arm/boot/dts/x-powers-axp209.dtsi create mode 100644 drivers/input/misc/axp20x-pek.c create mode 100644 drivers/mfd/axp20x.c create mode 100644 drivers/regulator/axp20x-regulator.c create mode 100644 include/linux/mfd/axp20x.h
Signature · 1 line
1.8.3.2
PATCH v3 1/10 mfd: AXP20x: Add mfd driver for AXP20x PMIC
This patch introduces the preliminary support for PMICs X-Powers AXP202 and AXP209. The 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.
The core enables support for two subsystems:
- PEK (Power Enable Key)
- Regulators
--- drivers/mfd/Kconfig | 12 +++ drivers/mfd/Makefile | 1 + drivers/mfd/axp20x.c | 240 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++++ 4 files changed, 433 insertions(+) create mode 100644 drivers/mfd/axp20x.c create mode 100644 include/linux/mfd/axp20x.h
drivers/mfd/Kconfig +12 -0
@@ -59,6 +59,18 @@ config MFD_AAT2870_CORE additional drivers must be enabled in order to use the functionality of the device. +config MFD_AXP20X + bool "X-Powers AXP20X" + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + depends on I2C=y + help + If you say Y here you get support for the AXP20X. + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the + functionality of the device. + config MFD_CROS_EC tristate "ChromeOS Embedded Controller" select MFD_CORE
drivers/mfd/Makefile +1 -0
@@ -101,6 +101,7 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-irq.o obj-$(CONFIG_PMIC_DA9052) += da9052-core.o obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o +obj-$(CONFIG_MFD_AXP20X) += axp20x.o obj-$(CONFIG_MFD_LP3943) += lp3943.o obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
drivers/mfd/axp20x.c new file +240 -0
240 lines not on this page · raw message
include/linux/mfd/axp20x.h new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v3 1/10 mfd: AXP20x: Add mfd driver for AXP20x PMIC
Quoted 28 lines
This patch introduces the preliminary support for PMICs X-Powers AXP202 and AXP209. The 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.
The core enables support for two subsystems:
- PEK (Power Enable Key)
- RegulatorsSigned-off-by Carlo Caione <[email protected]>--- drivers/mfd/Kconfig | 12 +++ drivers/mfd/Makefile | 1 + drivers/mfd/axp20x.c | 240 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++++ 4 files changed, 433 insertions(+) create mode 100644 drivers/mfd/axp20x.c create mode 100644 include/linux/mfd/axp20x.hdrivers/mfd/Kconfig +1
-0@@ -59,6 +59,18 @@ config MFD_AAT2870_CORE additional drivers must be enabled in order to use the functionality of the device. +config MFD_AXP20X
drivers/mfd/Kconfig config MFD_AAT2870_CORE · line 72
Quoted 10 lines
drivers/mfd/Kconfig +10
-0+ bool "X-Powers AXP20X" + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + depends on I2C=y + help + If you say Y here you get support for the AXP20X. + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the + functionality of the device.
Please tell us what this device is and what sub-devices are available?
[...]
drivers/mfd/axp20x.c line 2
Quoted 8 lines
drivers/mfd/axp20x.c new file +2
-0@@ -0,0 +1,240 @@ +/* +* axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209
... which consist of ...
[...]
drivers/mfd/axp20x.c line 58
Quoted 13 lines
drivers/mfd/axp20x.c new file +13
-0+static struct resource axp20x_pek_resources[] = { + { + .name ="PEK_DBR" , + .start =AXP20X_IRQ_PEK_RIS_EDGE , + .end =AXP20X_IRQ_PEK_RIS_EDGE , + .flags =IORESOURCE_IRQ , + }, { + .name ="PEK_DBF" , + .start =AXP20X_IRQ_PEK_FAL_EDGE , + .end =AXP20X_IRQ_PEK_FAL_EDGE , + .flags =IORESOURCE_IRQ , + }, +};
Have you considered doing this in the Device Tree? It's a lot less code/overhead.
drivers/mfd/axp20x.c line 122
Quoted 4 lines
drivers/mfd/axp20x.c new file +4
-0+static const struct i2c_device_id axp20x_i2c_id[] = { + { }, +}; +MODULE_DEVICE_TABLE (i2c, axp20x_i2c_id);
We really should consider changing the I2C subsystem!
Can you add a comment here describing why we have to add this seemingly pointless empty struct please?
drivers/mfd/axp20x.c line 144
Quoted 9 lines
drivers/mfd/axp20x.c new file +9
-0+static struct mfd_cell axp20x_cells[] = { + { + .name ="axp20x-pek" , + .num_resources =ARRAY_SIZE (axp20x_pek_resources), + .resources = axp20x_pek_resources, + }, { + .name ="axp20x-regulator" , + }, +};
Do these drivers don't look inside the DTB at all?
[...]
drivers/mfd/axp20x.c line 169
Quoted 6 lines
drivers/mfd/axp20x.c new file +6
-0+ of_id =of_match_device (axp20x_of_match, &i2c->dev); +if (!of_id) { +dev_err (&i2c->dev,"Unable to setup AXP20X data\n" ); +return -ENODEV ; + } + axp20x->variant = (int ) of_id->data;
'variant' needs to be a (unsigned?) long or it will break on 64bit architectures.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[linux-sunxi] Re: [PATCH v3 01/10] mfd: AXP20x: Add mfd driver for AXP20x PMIC
Quoted 27 lines · Lee Jones
Quoted 27 lines
This patch introduces the preliminary support for PMICs X-Powers AXP202 and AXP209. The 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.
The core enables support for two subsystems:
- PEK (Power Enable Key)
- RegulatorsSigned-off-by Carlo Caione <[email protected]>--- drivers/mfd/Kconfig | 12 +++ drivers/mfd/Makefile | 1 + drivers/mfd/axp20x.c | 240 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++++ 4 files changed, 433 insertions(+) create mode 100644 drivers/mfd/axp20x.c create mode 100644 include/linux/mfd/axp20x.hdrivers/mfd/Kconfig +0
-0@@ -59,6 +59,18 @@ config MFD_AAT2870_CORE additional drivers must be enabled in order to use the functionality of the device.
Quoted 13 lines
drivers/mfd/Kconfig config MFD_AAT2870_CORE · line 72
Quoted 11 lines
drivers/mfd/Kconfig +11
-0+config MFD_AXP20X + bool "X-Powers AXP20X" + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + depends on I2C=y + help + If you say Y here you get support for the AXP20X. + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the + functionality of the device.Please tell us what this device is and what sub-devices are available?
Ok
Quoted 12 lines
[...]
drivers/mfd/axp20x.c line 2
Quoted 8 lines
drivers/mfd/axp20x.c new file +2
-0@@ -0,0 +1,240 @@ +/* +* axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209 ... which consist of ...
Yeah, I should improve my code documentation :)
Quoted 18 lines
[...]
drivers/mfd/axp20x.c line 58
Quoted 13 lines
drivers/mfd/axp20x.c new file +13
-0+static struct resource axp20x_pek_resources[] = { + { + .name ="PEK_DBR" , + .start =AXP20X_IRQ_PEK_RIS_EDGE , + .end =AXP20X_IRQ_PEK_RIS_EDGE , + .flags =IORESOURCE_IRQ , + }, { + .name ="PEK_DBF" , + .start =AXP20X_IRQ_PEK_FAL_EDGE , + .end =AXP20X_IRQ_PEK_FAL_EDGE , + .flags =IORESOURCE_IRQ , + }, +};Have you considered doing this in the Device Tree? It's a lot less code/overhead.
Ok, I'll change it in v4.
Quoted 9 lines
drivers/mfd/axp20x.c line 122
Quoted 4 lines
drivers/mfd/axp20x.c new file +4
-0+static const struct i2c_device_id axp20x_i2c_id[] = { + { }, +}; +MODULE_DEVICE_TABLE (i2c, axp20x_i2c_id);We really should consider changing the I2C subsystem!
Can you add a comment here describing why we have to add this seemingly pointless empty struct please?
Sure.
Quoted 11 lines
drivers/mfd/axp20x.c line 144
Quoted 9 lines
drivers/mfd/axp20x.c new file +9
-0+static struct mfd_cell axp20x_cells[] = { + { + .name ="axp20x-pek" , + .num_resources =ARRAY_SIZE (axp20x_pek_resources), + .resources = axp20x_pek_resources, + }, { + .name ="axp20x-regulator" , + }, +};Do these drivers don't look inside the DTB at all?
Only the regulators driver.
Quoted 9 lines
drivers/mfd/axp20x.c line 169
Quoted 6 lines
drivers/mfd/axp20x.c new file +6
-0+ of_id =of_match_device (axp20x_of_match, &i2c->dev); +if (!of_id) { +dev_err (&i2c->dev,"Unable to setup AXP20X data\n" ); +return -ENODEV ; + } + axp20x->variant = (int ) of_id->data;'variant' needs to be a (unsigned?) long or it will break on 64bit architectures.
Ok, I really need to start thinking to 64bit also.
Thank you,
Signature · 1 line
Carlo Caione
[linux-sunxi] Re: [PATCH v3 01/10] mfd: AXP20x: Add mfd driver for AXP20x PMIC
In reply to Lee JonesOn Fri, Mar 28, 2014 at 10:21 AM, Lee Jones <[email protected]> wrote:
[...]
Quoted 8 lines
Quoted 8 lines
drivers/mfd/axp20x.c new file +8
-0+static struct resource axp20x_pek_resources[] = { + { + .name ="PEK_DBR" , + .start =AXP20X_IRQ_PEK_RIS_EDGE , + .end =AXP20X_IRQ_PEK_RIS_EDGE , + .flags =IORESOURCE_IRQ , + }, { + .name ="PEK_DBF" ,
Quoted 8 lines
drivers/mfd/axp20x.c line 58
Quoted 5 lines
drivers/mfd/axp20x.c new file +5
-0+ .start = AXP20X_IRQ_PEK_FAL_EDGE, + .end = AXP20X_IRQ_PEK_FAL_EDGE, + .flags = IORESOURCE_IRQ, + }, +};Have you considered doing this in the Device Tree? It's a lot less code/overhead.
Hi Lee,
in v4 (I will send it soon) I left this code in since the resources are well managed by the MFD core and adding it in the DT results in pretty much the same code/overhead (atm the input device is not present in the DT).
If you really think that it is the case to move the code in the DT, please comment it in the v4.
Thanks,
Signature · 1 line
Carlo Caione
PATCH v3 2/10 dt-bindings: add vendor-prefix for X-Powers
In reply to Carlo Caione--- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -95,3 +95,4 @@ winbond Winbond Electronics corp. wlf Wolfson Microelectronics wm Wondermedia Technologies, Inc. xlnx Xilinx +x-powers X-Powers
Signature · 1 line
1.8.3.2
PATCH v3 3/10 mfd: AXP20x: Add bindings documentation
In reply to Carlo CaioneBindings documentation for the AXP20x driver. In this file also sub-nodes are documented.
--- Documentation/devicetree/bindings/mfd/axp20x.txt | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
Documentation/devicetree/bindings/mfd/axp20x.txt new file +83 -0
@@ -0,0 +1,83 @@ +* axp20x device tree bindings + +The axp20x family current members :- +axp202 (X-Powers) +axp209 (X-Powers) + +Required properties: +- compatible : Should be "x-powers,axp202" or "x-powers,axp209" +- interrupt-controller : axp20x has its own internal IRQs +- #interrupt-cells : Should be set to 1 +- interrupt-parent : The parent interrupt controller +- interrupts : Interrupt specifiers for interrupt sources +- reg : The I2C slave address for the AXP chip + +Sub-nodes: +* regulators : Contain the regulator nodes. The regulators are bound using + their name as listed here: dcdc2, dcdc3, ldo1, ldo2, ldo3, + ldo4, ldo5. + The bindings details of individual regulator device can be found in: + Documentation/devicetree/bindings/regulator/regulator.txt with the + exception of: + + - x-powers,dcdc-freq : defines the work frequency of DC-DC in KHz + (range: 750-1875). Default: 1.5MHz + + For each DCDC: + - x-powers,dcdc-workmode: Optional. 1 for PWM mode, 0 for AUTO mode + Default: AUTO mode + +Example: + +axp: axp20x at 34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 8>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + regulators { + dcdc-freq = <1500>; + + axp_dcdc2: dcdc2 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <2275000>; + regulator-always-on; + }; + + axp_dcdc3: dcdc3 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <3500000>; + regulator-always-on; + }; + + axp_ldo1: ldo1 { + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + }; + + axp_ldo2: ldo2 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + axp_ldo3: ldo3 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <3500000>; + }; + + axp_ldo4: ldo4 { + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <3300000>; + }; + + axp_ldo5: ldo5 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + }; + }; +}; +
Signature · 1 line
1.8.3.2
PATCH v3 4/10 input: misc: Add driver for AXP20x Power Enable Key
In reply to Carlo CaioneThis 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.
--- drivers/input/misc/Kconfig | 11 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/axp20x-pek.c | 260 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 drivers/input/misc/axp20x-pek.c
drivers/input/misc/Kconfig +11 -0
@@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON To compile this driver as a module, choose M here. The module will be called retu-pwrbutton. +config INPUT_AXP20X_PEK + tristate "X-Powers AXP20X power button driver" + depends on MFD_AXP20X + help + Say Y here if you want to enable power key reporting via the + AXP20X PMIC. + + To compile this driver as a module, choose M here. The module will + be called axp20x-pek. + + config INPUT_TWL4030_PWRBUTTON tristate "TWL4030 Power button Driver" depends on TWL4030_CORE
drivers/input/misc/Makefile +1 -0
@@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE) += powermate.o obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o +obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
drivers/input/misc/axp20x-pek.c new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Dmitry Torokhov
maintainerPATCH v3 4/10 input: misc: Add driver for AXP20x Power Enable Key
Hi Carlo,
Quoted 74 lines · Carlo Caione
This patch add support for the Power Enable Key found on MFD AXP202 and AXP209. Besides the basic support for the button, the driver adds two entries in sysfs to configure the time delay for power on/off.
Signed-off-by Carlo Caione <[email protected]>--- drivers/input/misc/Kconfig | 11 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/axp20x-pek.c | 260 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 drivers/input/misc/axp20x-pek.cdrivers/input/misc/Kconfig +11
-0@@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON To compile this driver as a module, choose M here. The module will be called retu-pwrbutton. +config INPUT_AXP20X_PEK + tristate "X-Powers AXP20X power button driver" + depends on MFD_AXP20X + help + Say Y here if you want to enable power key reporting via the + AXP20X PMIC. + + To compile this driver as a module, choose M here. The module will + be called axp20x-pek. + + config INPUT_TWL4030_PWRBUTTON tristate "TWL4030 Power button Driver" depends on TWL4030_COREdrivers/input/misc/Makefile +1
-0@@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE) += powermate.o obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o +obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.odrivers/input/misc/axp20x-pek.c new file +22
-0@@ -0,0 +1,260 @@ +/* +* axp20x power button driver. +* +* Copyright (C) 2013 Carlo Caione <[email protected]> +* +* 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>
drivers/input/misc/axp20x-pek.c line 32
Quoted 10 lines
drivers/input/misc/axp20x-pek.c new file +10
-0+#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) + +static const char const *startup_time[] = {"128ms" ,"3s" ,"1s" ,"2s" }; +static const char const *shutdown_time[] = {"4s" ,"6s" ,"8s" ,"10s" };
Why not have everything expressed in milliseconds and have sysfs attribute apply the closest one possible?
By the way, do you want to plumb these through device tree as well?
Quoted 39 lines
drivers/input/misc/axp20x-pek.c new file +39
-0+ +struct axp20x_pek { +struct axp20x_dev *axp20x; +struct input_dev *input; +int irq_dbr; +int irq_dbf; +}; + +struct axp20x_pek_ext_attr { +const char const **str; +unsigned int mask; +}; + +static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = { + .str = startup_time, + .mask =AXP20X_PEK_STARTUP_MASK , +}; + +static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = { + .str = 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; +int cnt =0 ; + + ret =regmap_read (axp20x_pek->axp20x->regmap,AXP20X_PEK_KEY , &val); +if (ret !=0 )
drivers/input/misc/axp20x-pek.c line 81
Quoted 10 lines
drivers/input/misc/axp20x-pek.c new file +10
-0+return ret; + + val &= axp20x_ea->mask; + val >>=ffs (axp20x_ea->mask) -1 ; + +for (i =0 ; i <4 ; i++) { +if (val == i) + cnt +=sprintf (buf + cnt,"[%s] " , axp20x_ea->str[i]); +else + cnt +=sprintf (buf + cnt,"%s " , axp20x_ea->str[i]);
Please just return the current value; why do we need pretty-printing?
Quoted 119 lines
drivers/input/misc/axp20x-pek.c new file +119
-0+ } + + cnt +=sprintf (buf + cnt,"\n" ); + +return cnt; +} + +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 ]; +int ret, i; +size_t len; + + 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' ; + +for (i =0 ; i <4 ; i++) { +if (!strcmp (val_str, axp20x_ea->str[i])) { + + i <<=ffs (axp20x_ea->mask) -1 ; + ret =regmap_update_bits (axp20x_pek->axp20x->regmap, +AXP20X_PEK_KEY , + axp20x_ea->mask, i); +if (ret !=0 ) +return -EINVAL ; +return count; + } + } + +return -EINVAL ; +} + +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 (shutdown,0644 , axp20x_show_ext_attr, axp20x_store_ext_attr), + &axp20x_pek_shutdown_ext_attr +}; + +static struct attribute *dev_attrs[] = { + &axp20x_dev_attr_startup.attr.attr, + &axp20x_dev_attr_shutdown.attr.attr, +NULL , +}; + +static struct attribute_group dev_attr_group = { + .attrs = dev_attrs, +}; + +static const struct attribute_group *dev_attr_groups[] = { + &dev_attr_group, +NULL , +}; + +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" ;
drivers/input/misc/axp20x-pek.c line 210
Quoted 10 lines
drivers/input/misc/axp20x-pek.c new file +10
-0+ 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_threaded_irq (&pdev->dev, axp20x_pek->irq_dbr, +NULL , axp20x_pek_irq,0 , +"axp20x-pek-dbr" , idev);
Why does it have to be threaded IRQ?
Quoted 7 lines
drivers/input/misc/axp20x-pek.c new file +7
-0+if (error) { +dev_err (axp20x->dev,"Failed to request dbr IRQ#%d: %d\n" , + axp20x_pek->irq_dbr, error); + +return error; + } +
drivers/input/misc/axp20x-pek.c line 227
Quoted 10 lines
drivers/input/misc/axp20x-pek.c new file +10
-0+ error =devm_request_threaded_irq (&pdev->dev, axp20x_pek->irq_dbf, +NULL , axp20x_pek_irq,0 , +"axp20x-pek-dbf" , idev); +if (error) { +dev_err (axp20x->dev,"Failed to request dbf IRQ#%d: %d\n" , + axp20x_pek->irq_dbf, error); +return error; + } + + idev->dev.groups = dev_attr_groups;
These are not generic input attributes so they should belong to the platform device, not input device.
Quoted 6 lines
drivers/input/misc/axp20x-pek.c new file +6
-0+ error =input_register_device (idev); +if (error) { +dev_err (axp20x->dev,"Can't register input device: %d\n" , error); +return error; + } +
drivers/input/misc/axp20x-pek.c line 243
Quoted 10 lines
drivers/input/misc/axp20x-pek.c new file +10
-0+platform_set_drvdata (pdev, axp20x_pek); + +return 0 ; +} + +static int axp20x_pek_remove (struct platform_device *pdev) +{ +struct axp20x_pek *axp20x_pek =platform_get_drvdata (pdev); + +input_unregister_device (axp20x_pek->input);
No need to call input_unregister_device() for managed input devices.
Quoted 20 lines
drivers/input/misc/axp20x-pek.c new file +17
-0+ +return 0 ; +} + +static struct platform_driver axp20x_pek_driver = { + .probe = axp20x_pek_probe, + .remove = axp20x_pek_remove, + .driver = { + .name ="axp20x-pek" , + .owner =THIS_MODULE , + }, +}; +module_platform_driver (axp20x_pek_driver); + +MODULE_DESCRIPTION ("axp20x Power Button" ); +MODULE_AUTHOR ("Carlo Caione <[email protected]>" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
1.8.3.2
Thanks.
Signature · 1 line
Dmitry
[linux-sunxi] Re: [PATCH v3 04/10] input: misc: Add driver for AXP20x Power Enable Key
Quoted 1 line · Dmitry Torokhov
Hi Carlo,
Hi Dmitry,
Quoted 2 lines · Carlo Caione
[...]
Quoted 12 lines
Quoted 12 lines
drivers/input/misc/axp20x-pek.c new file +12
-0+#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> +
Quoted 8 lines
drivers/input/misc/axp20x-pek.c line 32
Quoted 5 lines
drivers/input/misc/axp20x-pek.c new file +5
-0+#define AXP20X_PEK_STARTUP_MASK (0xc0) +#define AXP20X_PEK_SHUTDOWN_MASK (0x03) + +static const char const *startup_time[] = {"128ms" ,"3s" ,"1s" ,"2s" }; +static const char const *shutdown_time[] = {"4s" ,"6s" ,"8s" ,"10s" };Why not have everything expressed in milliseconds and have sysfs attribute apply the closest one possible?
Yep, I agree that could be nice. Fix in v3.
Quoted 1 line
By the way, do you want to plumb these through device tree as well?
Hum, not sure about that. AFAIK device tree is used for hardware description whereas these are configuration parameters. Moreover you would have these parameters saved through reboots.
Quoted 43 lines
Quoted 43 lines
drivers/input/misc/axp20x-pek.c new file +43
-0+ +struct axp20x_pek { +struct axp20x_dev *axp20x; +struct input_dev *input; +int irq_dbr; +int irq_dbf; +}; + +struct axp20x_pek_ext_attr { +const char const **str; +unsigned int mask; +}; + +static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = { + .str = startup_time, + .mask =AXP20X_PEK_STARTUP_MASK , +}; + +static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = { + .str = 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; +int cnt =0 ; + + 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 ;
Quoted 8 lines
drivers/input/misc/axp20x-pek.c line 81
Quoted 6 lines
drivers/input/misc/axp20x-pek.c new file +6
-0+ +for (i =0 ; i <4 ; i++) { +if (val == i) + cnt +=sprintf (buf + cnt,"[%s] " , axp20x_ea->str[i]); +else + cnt +=sprintf (buf + cnt,"%s " , axp20x_ea->str[i]);Please just return the current value; why do we need pretty-printing?
It was done to have the possibility to look at the accepted values. With the modification you suggested before this is not necessary anymore. I'll change it.
Quoted 123 lines
Quoted 123 lines
drivers/input/misc/axp20x-pek.c new file +123
-0+ } + + cnt +=sprintf (buf + cnt,"\n" ); + +return cnt; +} + +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 ]; +int ret, i; +size_t len; + + 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' ; + +for (i =0 ; i <4 ; i++) { +if (!strcmp (val_str, axp20x_ea->str[i])) { + + i <<=ffs (axp20x_ea->mask) -1 ; + ret =regmap_update_bits (axp20x_pek->axp20x->regmap, +AXP20X_PEK_KEY , + axp20x_ea->mask, i); +if (ret !=0 ) +return -EINVAL ; +return count; + } + } + +return -EINVAL ; +} + +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 (shutdown,0644 , axp20x_show_ext_attr, axp20x_store_ext_attr), + &axp20x_pek_shutdown_ext_attr +}; + +static struct attribute *dev_attrs[] = { + &axp20x_dev_attr_startup.attr.attr, + &axp20x_dev_attr_shutdown.attr.attr, +NULL , +}; + +static struct attribute_group dev_attr_group = { + .attrs = dev_attrs, +}; + +static const struct attribute_group *dev_attr_groups[] = { + &dev_attr_group, +NULL , +}; + +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 );
Quoted 8 lines
drivers/input/misc/axp20x-pek.c line 210
Quoted 6 lines
drivers/input/misc/axp20x-pek.c new file +6
-0+ +input_set_drvdata (idev, axp20x_pek); + + error =devm_request_threaded_irq (&pdev->dev, axp20x_pek->irq_dbr, +NULL , axp20x_pek_irq,0 , +"axp20x-pek-dbr" , idev);Why does it have to be threaded IRQ?
Because this is already handled as a nested irq from a irq thread. The parent threaded irq is installed by regmap_add_irq_chip() in the MFD driver core.
Quoted 12 lines
Quoted 12 lines
drivers/input/misc/axp20x-pek.c new file +12
-0+if (error) { +dev_err (axp20x->dev,"Failed to request dbr IRQ#%d: %d\n" , + axp20x_pek->irq_dbr, error); + +return error; + } + + error =devm_request_threaded_irq (&pdev->dev, axp20x_pek->irq_dbf, +NULL , axp20x_pek_irq,0 , +"axp20x-pek-dbf" , idev); +if (error) { + dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
Quoted 8 lines
drivers/input/misc/axp20x-pek.c line 227
Quoted 5 lines
drivers/input/misc/axp20x-pek.c new file +5
-0+ axp20x_pek->irq_dbf, error); +return error; + } + + idev->dev.groups = dev_attr_groups;These are not generic input attributes so they should belong to the platform device, not input device.
Ok. Can I ask why they cannot be considered an input attributes?
Quoted 10 lines
Quoted 10 lines
drivers/input/misc/axp20x-pek.c new file +10
-0+ error =input_register_device (idev); +if (error) { +dev_err (axp20x->dev,"Can't register input device: %d\n" , error); +return error; + } + +platform_set_drvdata (pdev, axp20x_pek); + +return 0 ; +}
Quoted 8 lines
drivers/input/misc/axp20x-pek.c line 243
Quoted 6 lines
drivers/input/misc/axp20x-pek.c new file +6
-0+ +static int axp20x_pek_remove (struct platform_device *pdev) +{ +struct axp20x_pek *axp20x_pek =platform_get_drvdata (pdev); + +input_unregister_device (axp20x_pek->input);No need to call
input_unregister_device()for managed input devices.
Right. Fix in v3.
Quoted 14 lines
Quoted 14 lines
drivers/input/misc/axp20x-pek.c new file +14
-0+ +return 0 ; +} + +static struct platform_driver axp20x_pek_driver = { + .probe = axp20x_pek_probe, + .remove = axp20x_pek_remove, + .driver = { + .name ="axp20x-pek" , + .owner =THIS_MODULE , + }, +}; +module_platform_driver (axp20x_pek_driver); +
Quoted 8 lines
Quoted 6 lines
drivers/input/misc/axp20x-pek.c new file +3
-0+MODULE_DESCRIPTION ("axp20x Power Button" ); +MODULE_AUTHOR ("Carlo Caione <[email protected]>" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
1.8.3.2Thanks.
Thank you,
Signature · 1 line
Carlo Caione
Dmitry Torokhov
maintainer[linux-sunxi] Re: [PATCH v3 04/10] input: misc: Add driver for AXP20x Power Enable Key
Quoted 7 lines · Carlo Caione
Quoted 1 line · Dmitry Torokhov
Hi Carlo,
Hi Dmitry,
Quoted 2 lines · Carlo Caione
[...]
Quoted 10 lines
Quoted 6 lines
drivers/input/misc/axp20x-pek.c line 210
Quoted 4 lines
drivers/input/misc/axp20x-pek.c new file +4
-0+ + error =devm_request_threaded_irq (&pdev->dev, axp20x_pek->irq_dbr, +NULL , axp20x_pek_irq,0 , +"axp20x-pek-dbr" , idev);Why does it have to be threaded IRQ?
Because this is already handled as a nested irq from a irq thread. The parent threaded irq is installed by
regmap_add_irq_chip()in the MFD driver core.
Then you probably want to use devm_request_any_context_irq() - the driver does not necessarily care if IRQ is threaded or not, t can work either way.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
drivers/input/misc/axp20x-pek.c new file +12
-0+if (error) { +dev_err (axp20x->dev,"Failed to request dbr IRQ#%d: %d\n" , + axp20x_pek->irq_dbr, error); + +return error; + } + + error =devm_request_threaded_irq (&pdev->dev, axp20x_pek->irq_dbf, +NULL , axp20x_pek_irq,0 , +"axp20x-pek-dbf" , idev); +if (error) { + dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",Quoted 8 lines
drivers/input/misc/axp20x-pek.c line 227
Quoted 5 lines
drivers/input/misc/axp20x-pek.c new file +5
-0+ axp20x_pek->irq_dbf, error); +return error; + } + + idev->dev.groups = dev_attr_groups;These are not generic input attributes so they should belong to the platform device, not input device.
Quoted 1 line
Ok. Can I ask why they cannot be considered an input attributes?
Input layer is an abstraction; I am trying to keep all attributes generic and applicable to all input devices. If you look at other input drivers you will see that attributes that control hardware behavior are attached to the devices representing the hardware itself. For example attributes to control report rate of PS/2 mouse belong to serio port that represents the physical mouse device; typematic rate of AT keyboards also tied to serio port, etc, etc.
Thanks.
Signature · 1 line
Dmitry
PATCH v3 5/10 input: misc: Add ABI docs for AXP20x PEK
In reply to Carlo CaioneAdd ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.
--- 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
Documentation/ABI/testing/sysfs-driver-input-axp-pek new file +11 -0
@@ -0,0 +1,11 @@ +What: /sys/class/input/input(x)/startup +Date: March 2014 +Contact: Carlo Caione <[email protected]> +Description: Startup time. Board is powered on if the button is pressed + for more than <startup_time> + +What: /sys/class/input/input(x)/shutdown +Date: March 2014 +Contact: Carlo Caione <[email protected]> +Description: Shutdown time. Board is powered off if the button is pressed + for more than <shutdown_time>
Signature · 1 line
1.8.3.2
PATCH v3 6/10 regulator: AXP20x: Add support for regulators subsystem
In reply to Carlo CaioneAXP202 and AXP209 come with two synchronous step-down DC-DCs and five LDOs. This patch introduces basic support for those regulators.
--- drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/axp20x-regulator.c | 280 +++++++++++++++++++++++++++++++++++ 3 files changed, 288 insertions(+) create mode 100644 drivers/regulator/axp20x-regulator.c
drivers/regulator/Kconfig +7 -0
@@ -139,6 +139,13 @@ config REGULATOR_AS3722 AS3722 PMIC. This will enable support for all the software controllable DCDC/LDO regulators. +config REGULATOR_AXP20X + tristate "X-POWERS AXP20X PMIC Regulators" + depends on MFD_AXP20X + help + This driver provides support for the voltage regulators on the + AXP20X PMIC. + config REGULATOR_DA903X tristate "Dialog Semiconductor DA9030/DA9034 regulators" depends on PMIC_DA903X
drivers/regulator/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o +obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
drivers/regulator/axp20x-regulator.c new file +280 -0
280 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Mark Brown
maintainerPATCH v3 6/10 regulator: AXP20x: Add support for regulators subsystem
drivers/regulator/axp20x-regulator.c line 96
Quoted 9 lines · Carlo Caione
drivers/regulator/axp20x-regulator.c new file +9
-0+static int axp20x_set_suspend_voltage (struct regulator_dev *rdev,int uV) +{ +int sel =regulator_map_voltage_iterate (rdev, uV, uV); + +if (sel <0 ) +return sel; + +return regulator_set_voltage_sel_regmap (rdev, sel); +}
This is fairly obviously broken - it's overwriting the normal runtime value, this will disrupt the running system if we want the value we use on suspend is different to the value we want at runtime.
Think about it - if this was a sane thing to do the core would just do
it without needing driver specific code, we already know how to set the
voltage for the device.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/80a4b3b6/attachment.sig>
[linux-sunxi] Re: [PATCH v3 06/10] regulator: AXP20x: Add support for regulators subsystem
Quoted 15 lines · Mark Brown
drivers/regulator/axp20x-regulator.c line 96
Quoted 9 lines · Carlo Caione
drivers/regulator/axp20x-regulator.c new file +9
-0+static int axp20x_set_suspend_voltage (struct regulator_dev *rdev,int uV) +{ +int sel =regulator_map_voltage_iterate (rdev, uV, uV); + +if (sel <0 ) +return sel; + +return regulator_set_voltage_sel_regmap (rdev, sel); +}This is fairly obviously broken - it's overwriting the normal runtime value, this will disrupt the running system if we want the value we use on suspend is different to the value we want at runtime.
Ok, silly question: isn't it exactly what we want? Set the voltage for the regulator when the system is suspended?
Quoted 3 lines
Think about it - if this was a sane thing to do the core would just do it without needing driver specific code, we already know how to set the voltage for the device.
I thought it was because some regulators can have specific regs for managing the suspend mode.
BTW, but then what is the difference between my code and (i.e.) the same routine in da9055-regulator.c?
http://lxr.linux.no/linux+v3.13.5/drivers/regulator/da9055-regulator.c#L276
Thanks,
Signature · 1 line
Carlo Caione
Mark Brown
maintainer[linux-sunxi] Re: [PATCH v3 06/10] regulator: AXP20x: Add support for regulators subsystem
Quoted 8 lines · Carlo Caione
Quoted 3 lines · Mark Brown
This is fairly obviously broken - it's overwriting the normal runtime value, this will disrupt the running system if we want the value we use on suspend is different to the value we want at runtime.
Ok, silly question: isn't it exactly what we want? Set the voltage for the regulator when the system is suspended?
This needs to be done without affecting the current system state - many PMICs are aware of system suspend and have support for transitioning into a separate suspend state, this should only be configuring that. We may call this function separately to the actual suspend.
Quoted 6 lines
Quoted 3 lines
Think about it - if this was a sane thing to do the core would just do it without needing driver specific code, we already know how to set the voltage for the device.
I thought it was because some regulators can have specific regs for managing the suspend mode.
Right, but if the PMIC doesn't have that feature then it should indicate that by not implementing the operation and letting the core worry about how to handle the situation.
Quoted 4 lines
BTW, but then what is the difference between my code and (i.e.) the same routine in
da9055-regulator.c?http://lxr.linux.no/linux+v3.13.5/drivers/regulator/da9055-regulator.c#L276
That's updating the B register set which IIRC is used only in suspend
mode.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140330/924df094/attachment.sig>
PATCH v3 7/10 ARM: sunxi: dt: Add x-powers-axp209.dtsi file
In reply to Carlo CaioneThis dtsi describes the axp209 PMIC, and is to be included from inside the i2c controller node to which the axp209 is connected.
--- arch/arm/boot/dts/x-powers-axp209.dtsi | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 arch/arm/boot/dts/x-powers-axp209.dtsi
arch/arm/boot/dts/x-powers-axp209.dtsi new file +54 -0
@@ -0,0 +1,54 @@ +/* + * x-powers,axp209 common code to be include from inside the axp209 node + * + * Copyright 2014 - Carlo Caione <[email protected]> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +regulators { + dcdc-freq = <1500>; + + axp_dcdc2: dcdc2 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <2275000>; + regulator-always-on; + }; + + axp_dcdc3: dcdc3 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <3500000>; + regulator-always-on; + }; + + axp_ldo1: ldo1 { + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + }; + + axp_ldo2: ldo2 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + axp_ldo3: ldo3 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <3500000>; + }; + + axp_ldo4: ldo4 { + regulator-min-microvolt = <1250000>; + regulator-max-microvolt = <3300000>; + }; + + axp_ldo5: ldo5 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + }; +};
Signature · 1 line
1.8.3.2
Mark Brown
maintainerPATCH v3 7/10 ARM: sunxi: dt: Add x-powers-axp209.dtsi file
Quoted 4 lines · Carlo Caione
This dtsi describes the axp209 PMIC, and is to be included from inside the i2c controller node to which the axp209 is connected.
arch/arm/boot/dts/x-powers-axp209.dtsi | 54 ++++++++++++++++++++++++++++++++++
Something is wrong here. Either the changelog is inaccurate or this is broken, either way this should be cleaned up because this looks like very bad practice. If this is a common include file for boards derived from some reference design then the changelog is misleading and the DT should be clearer about the board tie ins. Otherwise the .dtsi is defining what should be board specific parameters.
The fact that the DT names everything after the regulator on the PMIC and not after the supply names on the board is especially suspicious and glancing at a couple of the regulators it looks like the constraints here are the maximum ranges the PMIC supports rather than anything to do with any board.
Please take a step back and think about what the regulator constraints are intended to do - they're about matching the regulator capabilities to the board since it is rare for boards to be able to do everything the regulator can support. Duplicating the basic device capabilities into the DT would be a pointless waste of time.
arch/arm/boot/dts/x-powers-axp209.dtsi line 21
Quoted 5 lines
arch/arm/boot/dts/x-powers-axp209.dtsi new file +5
-0+ axp_dcdc2: dcdc2 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <2275000>; + regulator-always-on; + };
What is this configuration actually for - what guarantee do we have that the above is safe for a given board using this regulator?
In general I'd expect to see anything specifying variability for a
regulator to also include the relevant consumer node.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/e00d621d/attachment.sig>
PATCH v3 7/10 ARM: sunxi: dt: Add x-powers-axp209.dtsi file
Quoted 34 lines · Mark Brown
Quoted 4 lines · Carlo Caione
This dtsi describes the axp209 PMIC, and is to be included from inside the i2c controller node to which the axp209 is connected.
arch/arm/boot/dts/x-powers-axp209.dtsi | 54 ++++++++++++++++++++++++++++++++++Something is wrong here. Either the changelog is inaccurate or this is broken, either way this should be cleaned up because this looks like very bad practice. If this is a common include file for boards derived from some reference design then the changelog is misleading and the DT should be clearer about the board tie ins. Otherwise the .dtsi is defining what should be board specific parameters.
The fact that the DT names everything after the regulator on the PMIC and not after the supply names on the board is especially suspicious and glancing at a couple of the regulators it looks like the constraints here are the maximum ranges the PMIC supports rather than anything to do with any board.
Please take a step back and think about what the regulator constraints are intended to do - they're about matching the regulator capabilities to the board since it is rare for boards to be able to do everything the regulator can support. Duplicating the basic device capabilities into the DT would be a pointless waste of time.
arch/arm/boot/dts/x-powers-axp209.dtsi line 21
Quoted 5 lines
arch/arm/boot/dts/x-powers-axp209.dtsi new file +5
-0+ axp_dcdc2: dcdc2 { + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <2275000>; + regulator-always-on; + };What is this configuration actually for - what guarantee do we have that the above is safe for a given board using this regulator?
Quoted 2 lines
In general I'd expect to see anything specifying variability for a regulator to also include the relevant consumer node.
Ok, you are completely right. These values in the DTSI are wrongly the maximum and minimum ranges for the PMIC. Even worst I didn't specify the board specific parameters for the regulators.
Thank you for reviewing and noticing it,
Signature · 1 line
Carlo Caione
PATCH v3 8/10 ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
In reply to Carlo Caione--- arch/arm/boot/dts/sun4i-a10-a1000.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-hackberry.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-inet97fv2.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-mini-xplus.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-pcduino.dts | 13 +++++++++++++ arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 14 ++++++++++++++ arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 15 +++++++++++++++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 14 ++++++++++++++ 10 files changed, 152 insertions(+)
arch/arm/boot/dts/sun4i-a10-a1000.dts +13 -0
@@ -88,6 +88,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; };
arch/arm/boot/dts/sun4i-a10-cubieboard.dts +13 -0
@@ -80,6 +80,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; i2c1: i2c at 01c2b000 {
arch/arm/boot/dts/sun4i-a10-hackberry.dts +19 -0
@@ -82,6 +82,25 @@ pinctrl-0 = <&uart0_pins_a>; status = "okay"; }; + + i2c0: i2c at 01c2ac00 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins_a>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; + }; }; reg_emac_3v3: emac-3v3 {
arch/arm/boot/dts/sun4i-a10-inet97fv2.dts +13 -0
@@ -34,6 +34,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; usbphy: phy at 01c13400 {
arch/arm/boot/dts/sun4i-a10-mini-xplus.dts +19 -0
@@ -47,6 +47,25 @@ pinctrl-0 = <&uart0_pins_a>; status = "okay"; }; + + i2c0: i2c at 01c2ac00 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins_a>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; + }; }; reg_usb1_vbus: usb1-vbus {
arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts +19 -0
@@ -81,6 +81,25 @@ pinctrl-0 = <&uart0_pins_a>; status = "okay"; }; + + i2c0: i2c at 01c2ac00 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins_a>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; + }; }; leds {
arch/arm/boot/dts/sun4i-a10-pcduino.dts +13 -0
@@ -66,6 +66,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; };
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +14 -0
@@ -66,6 +66,20 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 8>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; i2c1: i2c at 01c2b000 {
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +15 -0
@@ -73,6 +73,21 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 8>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; + }; i2c1: i2c at 01c2b000 {
arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +14 -0
@@ -95,6 +95,20 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 8>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; i2c1: i2c at 01c2b000 {
Signature · 1 line
1.8.3.2
PATCH v3 8/10 ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
Quoted 20 lines · Carlo Caione
Signed-off-by Hans de Goede <[email protected]>Signed-off-by Carlo Caione <[email protected]>--- arch/arm/boot/dts/sun4i-a10-a1000.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-hackberry.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-inet97fv2.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-mini-xplus.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-pcduino.dts | 13 +++++++++++++ arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 14 ++++++++++++++ arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 15 +++++++++++++++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 14 ++++++++++++++ 10 files changed, 152 insertions(+)arch/arm/boot/dts/sun4i-a10-a1000.dts +0
-0
arch/arm/boot/dts/sun4i-a10-a1000.dts line 94
Quoted 7 lines
arch/arm/boot/dts/sun4i-a10-a1000.dts +4
-0@@ -88,6 +88,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 {
Hi,
Sorry for spotting this just now. I suggest you change it to
axp209: pmic at 34 {or
axp209_pmic at 34 {to match the ePAPR policy that node names should be generic and describe functionality. The latter is what some DTs use.
arch/arm/boot/dts/sun4i-a10-a1000.dts line 106
Quoted 12 lines
arch/arm/boot/dts/sun4i-a10-a1000.dts +9
-0+ reg = <0x34>; + interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; };
[...]
Same for all the other files.
Thanks for working on this!
ChenYu
[linux-sunxi] Re: [PATCH v3 08/10] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
Quoted 17 lines · Chen-Yu Tsai
arch/arm/boot/dts/sun4i-a10-a1000.dts line 94
Quoted 12 lines
arch/arm/boot/dts/sun4i-a10-a1000.dts +4
-0@@ -88,6 +88,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 {Hi,
Sorry for spotting this just now. I suggest you change it to
Quoted 8 lines
axp209: pmic at 34 {or
axp209_pmic at 34 {to match the ePAPR policy that node names should be generic and describe functionality. The latter is what some DTs use.
Right. Thanks for reviewing this.
Quoted 3 lines
Same for all the other files.
Thanks for working on this!
Thank you,
Signature · 1 line
Carlo Caione
PATCH v3 8/10 ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
In reply to Carlo CaioneQuoted 28 lines · Carlo Caione
Signed-off-by Hans de Goede <[email protected]>Signed-off-by Carlo Caione <[email protected]>--- arch/arm/boot/dts/sun4i-a10-a1000.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-hackberry.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-inet97fv2.dts | 13 +++++++++++++ arch/arm/boot/dts/sun4i-a10-mini-xplus.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts | 19 +++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-pcduino.dts | 13 +++++++++++++ arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 14 ++++++++++++++ arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 15 +++++++++++++++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 14 ++++++++++++++ 10 files changed, 152 insertions(+)arch/arm/boot/dts/sun4i-a10-a1000.dts +5
-0@@ -88,6 +88,19 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + axp: axp20x at 34 { + reg = <0x34>;
arch/arm/boot/dts/sun4i-a10-a1000.dts line 105
Quoted 10 lines
arch/arm/boot/dts/sun4i-a10-a1000.dts +8
-0+ interrupts = <0>; + + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + + /include/ "x-powers-axp209.dtsi" + }; }; };
Actually, you can make the whole thing much more robust by using the &label syntax.
Here, you would just include the dtsi at the top of the file, and in the DTSI, you would have something like:
&axp209 {
regulators {
... }
}
(Given that the node in your DTS is axp209: pmic at something like Chen-Yu suggested)
You don't rely any more on the position of the include, and you use a standard DT syntax.
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/a64d1732/attachment.sig>
Mark Brown
maintainerPATCH v3 8/10 ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
Quoted 8 lines · Maxime Ripard
Here, you would just include the dtsi at the top of the file, and in the DTSI, you would have something like:
&axp209 { regulators { ... } }
Hang on, what is an include file setting up regulators for?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/9c468972/attachment.sig>
PATCH v3 8/10 ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
Quoted 5 lines · Mark Brown
Quoted 2 lines · Maxime Ripard
Here, you would just include the dtsi at the top of the file, and in the DTSI, you would have something like:
Quoted 7 lines
Quoted 5 lines
&axp209 { regulators { ... } }Hang on, what is an include file setting up regulators for?
Look at patch 7. To share the regulators declaration across all boards and avoid duplication.
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/a45285d7/attachment.sig>
Mark Brown
maintainerPATCH v3 8/10 ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
Quoted 6 lines · Maxime Ripard
Quoted 1 line · Mark Brown
Hang on, what is an include file setting up regulators for?
Look at patch 7. To share the regulators declaration across all boards and avoid duplication.
Oh, wonderful. I'll go and reply to that...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/dd8338e1/attachment.sig>
PATCH v3 9/10 ARM: sunxi: Add AXP20x support in defconfig
In reply to Carlo Caione--- arch/arm/configs/sunxi_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/configs/sunxi_defconfig +4 -0
@@ -40,6 +40,8 @@ CONFIG_SUN4I_EMAC=y # CONFIG_NET_VENDOR_STMICRO is not set # CONFIG_NET_VENDOR_WIZNET is not set # CONFIG_WLAN 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
@@ -55,6 +57,7 @@ CONFIG_GPIO_SYSFS=y # CONFIG_HWMON is not set CONFIG_WATCHDOG=y CONFIG_SUNXI_WATCHDOG=y +CONFIG_MFD_AXP20X=y # CONFIG_USB_SUPPORT is not set CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y
@@ -69,3 +72,4 @@ CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_NLS=y CONFIG_PRINTK_TIME=y +CONFIG_REGULATOR_AXP20X=y
Signature · 1 line
1.8.3.2
PATCH v3 10/10 ARM: sunxi: Add AXP20x support multi_v7_defconfig
In reply to Carlo Caione--- arch/arm/configs/multi_v7_defconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/configs/multi_v7_defconfig +3 -0
@@ -134,6 +134,7 @@ CONFIG_KEYBOARD_SPEAR=y CONFIG_KEYBOARD_CROS_EC=y CONFIG_MOUSE_PS2_ELANTECH=y CONFIG_INPUT_MISC=y +CONFIG_INPUT_AXP20X_PEK=y CONFIG_INPUT_MPU3050=y CONFIG_SERIO_AMBAKMI=y CONFIG_SERIAL_8250=y
@@ -189,6 +190,7 @@ CONFIG_SENSORS_LM90=y CONFIG_THERMAL=y CONFIG_ARMADA_THERMAL=y CONFIG_MFD_AS3722=y +CONFIG_MFD_AXP20X=y CONFIG_MFD_CROS_EC=y CONFIG_MFD_CROS_EC_SPI=y CONFIG_MFD_MAX8907=y
@@ -199,6 +201,7 @@ CONFIG_MFD_TPS65910=y CONFIG_REGULATOR_VIRTUAL_CONSUMER=y CONFIG_REGULATOR_AB8500=y CONFIG_REGULATOR_AS3722=y +CONFIG_REGULATOR_AXP20X=y CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_MAX8907=y CONFIG_REGULATOR_PALMAS=y
Signature · 1 line
1.8.3.2
v3 cover mfd: AXP20x: Add support for AXP202 and AXP209
In reply to Carlo CaioneQuoted 5 lines
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.
[...]
Quoted 11 lines
Carlo Caione (10):
mfd: AXP20x: Add mfd driver for AXP20x PMIC
dt-bindings: add vendor-prefix for X-Powers
mfd: AXP20x: Add bindings documentation
input: misc: Add driver for AXP20x Power Enable Key
input: misc: Add ABI docs for AXP20x PEK
regulator: AXP20x: Add support for regulators subsystem
ARM: sunxi: dt: Addx-powers-axp209.dtsifile
ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
ARM: sunxi: Add AXP20x support in defconfig
ARM: sunxi: Add AXP20x supportmulti_v7_defconfig
I'm only CC'ed on two of these patches. In order to gain a full appreciation what what the set is trying to achieve, can you CC me on the entire set please?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog