Skip to content

Commit

Permalink
poweroff working
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-w committed Jul 7, 2018
1 parent 12e0082 commit fc6285a
Show file tree
Hide file tree
Showing 19 changed files with 638 additions and 201 deletions.
8 changes: 8 additions & 0 deletions Documentation/devicetree/bindings/input/keys.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
General Keys Properties:

Optional properties for Keys:
- power-off-time-sec: Duration in seconds which the key should be kept
pressed for device to power off automatically. Device with key pressed
shutdown feature can specify this property.
- linux,keycodes: Specifies the numeric keycode values to be used for
reporting key presses.
43 changes: 43 additions & 0 deletions Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
MediaTek MT6397/MT6323 PMIC Keys Device Driver

There are two key functions provided by MT6397/MT6323 PMIC, pwrkey
and homekey. The key functions are defined as the subnode of the function
node provided by MT6397/MT6323 PMIC that is being defined as one kind
of Muti-Function Device (MFD)

For MT6397/MT6323 MFD bindings see:
Documentation/devicetree/bindings/mfd/mt6397.txt

Required properties:
- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys"
- linux,keycodes: See Documentation/devicetree/bindings/input/keys.txt

Optional Properties:
- wakeup-source: See Documentation/devicetree/bindings/power/wakeup-source.txt
- mediatek,long-press-mode: Long press key shutdown setting, 1 for
pwrkey only, 2 for pwrkey/homekey together, others for disabled.
- power-off-time-sec: See Documentation/devicetree/bindings/input/keys.txt

Example:

pmic: mt6397 {
compatible = "mediatek,mt6397";

...

mt6397keys: mt6397keys {
compatible = "mediatek,mt6397-keys";
mediatek,long-press-mode = <1>;
power-off-time-sec = <0>;

power {
linux,keycodes = <116>;
wakeup-source;
};

home {
linux,keycodes = <114>;
};
};

};
12 changes: 12 additions & 0 deletions Documentation/devicetree/bindings/mfd/mt6397.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ MT6397/MT6323 is a multifunction device with the following sub modules:
- GPIO
- Clock
- LED
- Keys
- Power controller

It is interfaced to host controller using SPI interface by a proprietary hardware
called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
Expand Down Expand Up @@ -42,6 +44,16 @@ Optional subnodes:
- compatible: "mediatek,mt6323-led"
see Documentation/devicetree/bindings/leds/leds-mt6323.txt

- keys
Required properties:
- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys"
see Documentation/devicetree/bindings/input/mtk-pmic-keys.txt

- power-controller
Required properties:
- compatible: "mediatek,mt6323-pwrc"
For details, see Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt

Example:
pwrap: pwrap@1000f000 {
compatible = "mediatek,mt8135-pwrap";
Expand Down
20 changes: 20 additions & 0 deletions Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Device Tree Bindings for Power Controller on MediaTek PMIC

The power controller which could be found on PMIC is responsible for externally
powering off or on the remote MediaTek SoC through the circuit BBPU.

Required properties:
- compatible: Should be one of follows
"mediatek,mt6323-pwrc": for MT6323 PMIC

Example:

pmic {
compatible = "mediatek,mt6323";

...

power-controller {
compatible = "mediatek,mt6323-pwrc";
};
}

This file was deleted.

28 changes: 9 additions & 19 deletions Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
Device-Tree bindings for MediaTek PMIC based RTC

MediaTek PMIC based RTC is an independent function of MediaTek PMIC which
is working as a multi-function device (MFD). And the RTC can be configured and
set up via PMIC wrapper bus. Which is also common resource shared among the
other functions present on the PMIC.
MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
as a type of multi-function device (MFD). The RTC can be configured and set up
with PMIC wrapper bus which is a common resource shared with the other
functions found on the same PMIC.

For MediaTek PMIC MFD bindings, see:
Documentation/devicetree/bindings/mfd/mt6397.txt

For MediaTek PMIC wrapper bus bindings, see:
Documentation/devicetree/bindings/soc/mediatek/pwrap.txt

Required parent node:
- pmic
For MediaTek PMIC MFD bindings, see:
Documentation/devicetree/bindings/mfd/mt6397.txt

Required properties:
- compatible: Should be one of follows
"mediatek,mt6323-rtc": for MT6323 PMIC
"mediatek,mt6397-rtc": for MT6397 PMIC

Optional child node:
- power-off
For Power-Off Device for MediaTek PMIC RTC bindings, see:
Documentation/devicetree/bindings/power/reset/mt6397-rtc-poweroff.txt

Example:

pmic {
compatible = "mediatek,mt6323";

...

rtc {
compatible = "mediatek,mt6323-rtc";

power-off {
compatible = "mediatek,mt6323-rtc-poweroff";
};
};
};
};
9 changes: 9 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,9 @@ M: Eddie Huang <eddie.huang@mediatek.com>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
L: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
S: Maintained
F: Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
F: drivers/rtc/rtc-mt6397.c
F: include/linux/mfd/mt6397/rtc.h

ARM/Mediatek SoC support
M: Matthias Brugger <matthias.bgg@gmail.com>
Expand Down Expand Up @@ -8614,6 +8616,13 @@ L: netdev@vger.kernel.org
S: Maintained
F: drivers/net/ethernet/mediatek/

MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
M: Sean Wang <sean.wang@mediatek.com>
L: linux-pm@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
F: drivers/power/reset/mt6323-poweroff.c

MEDIATEK JPEG DRIVER
M: Rick Chang <rick.chang@mediatek.com>
M: Bin Liu <bin.liu@mediatek.com>
Expand Down
32 changes: 25 additions & 7 deletions arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -871,15 +871,33 @@
};
};

mt6323rtc: rtc {
compatible = "mediatek,mt6323-rtc";
mt6323keys: mt6323keys {
compatible = "mediatek,mt6323-keys";
mediatek,long-press-mode = <1>;
power-off-time-sec = <0>;

power-off {
compatible = "mediatek,mt6323-rtc-poweroff";
};
};
};
power {
linux,keycodes = <116>;
wakeup-source;
};

home {
linux,keycodes = <114>;
};
};

codec: mt6397codec {
compatible = "mediatek,mt6397-codec";
};

power-controller {
compatible = "mediatek,mt6323-pwrc";
};

rtc {
compatible = "mediatek,mt6323-rtc";
};
};
};

&consys {
Expand Down
10 changes: 6 additions & 4 deletions arch/arm/configs/mt7623n_evb_fwu_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=y
CONFIG_KEYBOARD_MATRIX=y
CONFIG_KEYBOARD_SAMSUNG=y
CONFIG_KEYBOARD_MTK_PMIC=m
CONFIG_MOUSE_PS2_ELANTECH=y
CONFIG_MOUSE_PS2_SENTELIC=y
CONFIG_INPUT_MOUSEDEV=y
Expand Down Expand Up @@ -376,6 +377,7 @@ CONFIG_I2C_CHARDEV=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=m
CONFIG_RTC_DRV_DS1307_CENTURY=y
CONFIG_RTC_DRV_MT6397=m

CONFIG_SPI=y
CONFIG_SPI_MASTER=y
Expand All @@ -385,6 +387,10 @@ CONFIG_SPI_MT65XX=m
CONFIG_PWM=y
CONFIG_PWM_MEDIATEK=m

#reset
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_MT6323=y

#Temperature sensor driver for mediatek SoCs
CONFIG_MEDIATEK_MT6577_AUXADC=m
CONFIG_THERMAL=m
Expand Down Expand Up @@ -570,7 +576,3 @@ CONFIG_NFS_COMMON=y
#xfs
CONFIG_XFS_FS=m

#RTC/POWER
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_MT6397_RTC=y

9 changes: 9 additions & 0 deletions drivers/input/keyboard/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -756,4 +756,13 @@ config KEYBOARD_BCM
To compile this driver as a module, choose M here: the
module will be called bcm-keypad.

config KEYBOARD_MTK_PMIC
tristate "MediaTek PMIC keys support"
depends on MFD_MT6397
help
Say Y here if you want to use the pmic keys (powerkey/homekey).

To compile this driver as a module, choose M here: the
module will be called pmic-keys.

endif
1 change: 1 addition & 0 deletions drivers/input/keyboard/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o
obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o
obj-$(CONFIG_KEYBOARD_MCS) += mcs_touchkey.o
obj-$(CONFIG_KEYBOARD_MPR121) += mpr121_touchkey.o
obj-$(CONFIG_KEYBOARD_MTK_PMIC) += mtk-pmic-keys.o
obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o
obj-$(CONFIG_KEYBOARD_NOMADIK) += nomadik-ske-keypad.o
obj-$(CONFIG_KEYBOARD_NSPIRE) += nspire-keypad.o
Expand Down
Loading

0 comments on commit fc6285a

Please sign in to comment.