Hi655x powerkey support for HiKey (v2)
Subsystems (4)
cover Hi655x powerkey support for HiKey (v2)
This patchset enables the pmic powerkey to function on HiKey.
I wanted to submit it for some initial review. Feedback would be greatly appreciated!
New in v2:
* Larger rework to the powerkey driver, integrating feedback from Dmitry
* Minor dts cleanup suggested by Rob
thanks
-john
Guodong Xu (1):
arm64: dts: Add powerkey info to pmic for hi6220-hikey
John Stultz (3):
dts: bindings: Add binding documentation for hisilicon,hi6552-powerkey
hi655x-pmic: Make hi655x pmic logic probe child nodes in the dt
hi655x-pmic: Fixup issue with un-acked interrupts
Jorge Ramirez-Ortiz (1):
drivers: input: powerkey for HISI 65xx SoC
.../bindings/input/hisilicon,hi6552-powerkey.txt | 40 ++++++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 7 + drivers/input/misc/Kconfig | 9 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/hisi_powerkey.c | 155 +++++++++++++++++++++ drivers/mfd/hi655x-pmic.c | 9 ++ 6 files changed, 221 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/hisilicon,hi6552-powerkey.txt create mode 100644 drivers/input/misc/hisi_powerkey.c
Signature · 1 line
1.9.1
PATCH 1/5 dts: bindings: Add binding documentation for hisilicon,hi6552-powerkey
Adds binding documentation for hi6552 pmic powerkey button.
--- .../bindings/input/hisilicon,hi6552-powerkey.txt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/hisilicon,hi6552-powerkey.txt
Documentation/devicetree/bindings/input/hisilicon,hi6552-powerkey.txt new file +40 -0
@@ -0,0 +1,40 @@ +HiSilicon hi6552 PMIC Power Key + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: must be one of: + "hisilicon,hi6552-powerkey" + +- interrupt-parent + Usage: (required if interrupt property is defined) + Value type: <phandle> + Definition: A single <phandle> value that points to the interrupt + parent to which the child domain is being mapped. + +- interrupts: + Usage: required + Value type: <prop-encoded-array> + Definition: The first interrupt specifies the key release interrupt + and the second interrupt specifies the key press interrupt, + the third defines the timed key-hold interrupt. + The format of the specifier is defined by the binding + document describing the node's interrupt parent. + +- interrupt-names: + Usage: required + Value type: "down", "up", "hold 4s" + Definition: String names for the press, release and timed hold + interrupts. + + +EXAMPLE + + powerkey:powerkey@b1{ + compatible = "hisilicon,hi6552-powerkey"; + interrupt-parent = <&pmic>; + interrupts = <6 0>, <5 0>, <4 0>; + interrupt-names = "down", "up", "hold 4s"; + };
Signature · 1 line
1.9.1
PATCH 2/5 hi655x-pmic: Make hi655x pmic logic probe child nodes in the dt
In reply to John StultzIn trying to wire up the powerkey driver, I found I needed to add this to get the pmic logic to probe child nodes in the dt data.
With this patch, child nodes get properly probed.
--- drivers/mfd/hi655x-pmic.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mfd/hi655x-pmic.c +8 -0
@@ -39,6 +39,11 @@ static const struct regmap_irq hi655x_irqs[] = { { .reg_offset = 0, .mask = RESERVE_INT }, }; +static const struct of_device_id of_hi655x_pmic_child_match_tbl[] = { + { .compatible ="hisilicon,hi6552-powerkey" , }, + {/* end */ } +}; +static const struct regmap_irq_chip hi655x_irq_chip = { .name ="hi655x-pmic" , .irqs = hi655x_irqs,
@@ -122,6 +127,9 @@ static int hi655x_pmic_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pmic); +/* populate sub nodes */ +of_platform_populate (np, of_hi655x_pmic_child_match_tbl,NULL , dev); + ret =mfd_add_devices (dev,PLATFORM_DEVID_AUTO , hi655x_pmic_devs,ARRAY_SIZE (hi655x_pmic_devs),NULL ,0 ,NULL );if (ret) {
Signature · 1 line
1.9.1
PATCH 3/5 hi655x-pmic: Fixup issue with un-acked interrupts
In reply to John StultzWhile trying to get the powerkey to function, I found when pressing the key, I would get infinitely repeating interrupts.
After digging around a bit, it seems we didn't set the ack_base value for the regmap irqchip logic, so nothing was acking the interrupt.
This patch adds the ack_base, which seems to make things work.
--- drivers/mfd/hi655x-pmic.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/hi655x-pmic.c +1 -0
@@ -50,6 +50,7 @@ static const struct regmap_irq_chip hi655x_irq_chip = { .num_regs = 1, .num_irqs = ARRAY_SIZE(hi655x_irqs), .status_base = HI655X_IRQ_STAT_BASE, + .ack_base = HI655X_IRQ_STAT_BASE, .mask_base = HI655X_IRQ_MASK_BASE, };
Signature · 1 line
1.9.1
PATCH 4/5 drivers: input: powerkey for HISI 65xx SoC
In reply to John StultzFrom: Jorge Ramirez-Ortiz <[email protected]>
This driver provides a input driver for the power button on the HiSi 65xx SoC for boards like HiKey.
This driver was originally by Zhiliang Xue <[email protected]> then basically rewritten by Jorge, but preserving the original module author credits.
[jstultz: Reworked commit message, folded in other fixes/cleanups from Jorge, implemented some larger cleanups suggested by DmitryT]
--- drivers/input/misc/Kconfig | 9 +++ drivers/input/misc/Makefile | 1 + drivers/input/misc/hisi_powerkey.c | 155 +++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 drivers/input/misc/hisi_powerkey.c
drivers/input/misc/Kconfig +9 -0
@@ -796,4 +796,13 @@ config INPUT_DRV2667_HAPTICS To compile this driver as a module, choose M here: the module will be called drv2667-haptics. +config HISI_POWERKEY + tristate "Hisilicon PMIC ONKEY support" + depends on ARCH_HISI || COMPILE_TEST + help + Say Y to enable support for PMIC ONKEY. + + To compile this driver as a module, choose M here: the + module will be called hisi_powerkey. + endif
drivers/input/misc/Makefile +1 -0
@@ -75,3 +75,4 @@ obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o +obj-$(CONFIG_HISI_POWERKEY) += hisi_powerkey.o
drivers/input/misc/hisi_powerkey.c new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 5/5 arm64: dts: Add powerkey info to pmic for hi6220-hikey
In reply to John StultzFrom: Guodong Xu <[email protected]>
Add powerkey entry to the HiKey dts.
--- arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +7 -0
@@ -144,6 +144,13 @@ #interrupt-cells = <2>; pmic-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + powerkey { + compatible = "hisilicon,hi6552-powerkey"; + interrupt-parent = <&pmic>; + interrupts = <6 0>, <5 0>, <4 0>; + interrupt-names = "down", "up", "hold 4s"; + }; + regulators { ldo2: LDO2 { regulator-name = "LDO2_2V8";
Signature · 1 line
1.9.1
Quoted 9 lines · John Stultz
This patchset enables the pmic powerkey to function on HiKey.
I wanted to submit it for some initial review. Feedback would be greatly appreciated!
New in v2:
* Larger rework to the powerkey driver, integrating feedback from Dmitry
* Minor dts cleanup suggested by Rob
Looks like I reviewed your RFC instead.
The points are still valid here though.
Quoted 33 lines
Cc Dmitry Torokhov <[email protected]>Cc Rob Herring <[email protected]>Cc Pawel Moll <[email protected]>Cc Mark Rutland <[email protected]>Cc Ian Campbell <[email protected]>Cc Kumar Gala <[email protected]>Cc Lee Jones <[email protected]>Cc Jorge Ramirez-Ortiz <[email protected]>Cc Wei Xu <[email protected]>Cc Guodong Xu <[email protected]>Guodong Xu (1):
arm64: dts: Add powerkey info to pmic for hi6220-hikeyJohn Stultz (3):
dts: bindings: Add binding documentation for hisilicon,hi6552-powerkey
hi655x-pmic: Make hi655x pmic logic probe child nodes in the dt
hi655x-pmic: Fixup issue with un-acked interruptsJorge Ramirez-Ortiz (1):
drivers: input: powerkey for HISI 65xx SoC.../bindings/input/hisilicon,hi6552-powerkey.txt | 40 ++++++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 7 + drivers/input/misc/Kconfig | 9 ++ drivers/input/misc/Makefile | 1 + drivers/input/misc/hisi_powerkey.c | 155 +++++++++++++++++++++ drivers/mfd/hi655x-pmic.c | 9 ++ 6 files changed, 221 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/hisilicon,hi6552-powerkey.txt create mode 100644 drivers/input/misc/hisi_powerkey.c
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog