arm: boot: dts: am437x-idk: add gpio-based power key
PATCH 1/1 arm: boot: dts: am437x-idk: add gpio-based power key
AM437x IDK board has a User Switch which we can program to whatever we want. Because this board doesn't have a PMIC which can give us power button presses, let's use this user switch as a gpio-keys power button.
---
depends on [1]. Boot logs at [2]. Note that this can rather easily be folded into the original patch if so desired.
[1] http://marc.info/?l=linux-omap&m=141928747902983&w=2
[2] http://hastebin.com/xasuyinizu
arch/arm/boot/dts/am437x-idk-evm.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/boot/dts/am437x-idk-evm.dts +12 -0
@@ -96,6 +96,18 @@ regulator-boot-on; vin-supply = <&v1_5dreg>; }; + + gpio_keys: gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + switch at 0 { + label = "power-button"; + linux,code = <KEY_POWER>; + gpios = <&gpio4 2 GPIO_ACTIVE_LOW>; + }; + }; }; &am43xx_pinmux {
Signature · 1 line
2.2.0
PATCH v2 1/1 arm: boot: dts: am437x-idk: add gpio-based power key
AM437x IDK board has a User Switch which we can program to whatever we want. Because this board doesn't have a PMIC which can give us power button presses, let's use this user switch as a gpio-keys power button.
---
Changes since v1:
- Add explicit pinctrl data.
(note that ball reset state is already MUX_MODE7, and even
though it was already working before, as can be seen from v1's boot logs, it's best that we cope with possibly broken bootloaders)
depends on [1]. Boot logs at [2]. Note that this can rather easily be folded into the original patch if so desired.
[1] http://marc.info/?l=linux-omap&m=141928747902983&w=2
[2] http://hastebin.com/qezicehunu
arch/arm/boot/dts/am437x-idk-evm.dts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/am437x-idk-evm.dts +24 -0
@@ -96,9 +96,29 @@ regulator-boot-on; vin-supply = <&v1_5dreg>; }; + + gpio_keys: gpio_keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_keys_pins_default>; + #address-cells = <1>; + #size-cells = <0>; + + switch at 0 { + label = "power-button"; + linux,code = <KEY_POWER>; + gpios = <&gpio4 2 GPIO_ACTIVE_LOW>; + }; + }; }; &am43xx_pinmux { + gpio_keys_pins_default: gpio_keys_pins_default { + pinctrl-single,pins = < + 0x1b8 (PIN_INPUT | MUX_MODE7) /* cam0_field.gpio4_2 */ + >; + }; + i2c0_pins_default: i2c0_pins_default { pinctrl-single,pins = < 0x188 (PIN_INPUT | SLEWCTRL_FAST | MUX_MODE0) /* i2c0_sda.i2c0_sda */
@@ -282,6 +302,10 @@ status = "okay"; }; +&gpio4 { + status = "okay"; +}; + &gpio5 { status = "okay"; };
Signature · 1 line
2.2.0
PATCH v2 1/1 arm: boot: dts: am437x-idk: add gpio-based power key
Quoted 7 lines · Felipe Balbi
AM437x IDK board has a User Switch which we can program to whatever we want. Because this board doesn't have a PMIC which can give us power button presses, let's use this user switch as a gpio-keys power button.
Signed-off-by Felipe Balbi <[email protected]>
Applying into omap-for-v3.20/dt thanks.
Tony
Quoted 66 lines
---
Changes since v1:
- Add explicit pinctrl data.
(note that ball reset state is alreadyMUX_MODE7, and even
though it was already working before, as can be seen from v1's boot logs, it's best that we cope with possibly broken bootloaders)depends on [1]. Boot logs at [2]. Note that this can rather easily be folded into the original patch if so desired.
[1] http://marc.info/?l=linux-omap&m=141928747902983&w=2
[2] http://hastebin.com/qezicehunuarch/arm/boot/dts/am437x-idk-evm.dts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm/boot/dts/am437x-idk-evm.dts +24
-0@@ -96,9 +96,29 @@ regulator-boot-on; vin-supply = <&v1_5dreg>; }; + + gpio_keys: gpio_keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&gpio_keys_pins_default>; + #address-cells = <1>; + #size-cells = <0>; + + switch at 0 { + label = "power-button"; + linux,code = <KEY_POWER>; + gpios = <&gpio4 2 GPIO_ACTIVE_LOW>; + }; + }; }; &am43xx_pinmux { + gpio_keys_pins_default: gpio_keys_pins_default { + pinctrl-single,pins = < + 0x1b8 (PIN_INPUT | MUX_MODE7) /* cam0_field.gpio4_2 */ + >; + }; + i2c0_pins_default: i2c0_pins_default { pinctrl-single,pins = < 0x188 (PIN_INPUT | SLEWCTRL_FAST | MUX_MODE0) /* i2c0_sda.i2c0_sda */@@ -282,6 +302,10 @@ status = "okay"; }; +&gpio4 { + status = "okay"; +}; + &gpio5 { status = "okay"; };Signature · 1 line
2.2.0