Add MediaTek PMIC keys support
Subsystems (7)
v3 cover Add MediaTek PMIC keys support
MediaTek PMIC are multi-function devices that can handle key interrupts, typically there are two keys attached to PMIC, which called pwrkey and homekey. PWRKEY usually used to wake up system from sleep. Homekey can used as volume down key due to board design. Long press keys can shutdown PMIC, the mode can be choose to be one key only or two keys together.
This series add support for key functions for MediaTek PMIC MT6397/MT6323.
Chen Zhong (5):
mfd: mt6397: create irq mappings in mfd core driver
dt-bindings: input: Add document bindings for mtk-pmic-keys
dt-bindings: mfd: Add bindings for the keys as subnode of PMIC
input: Add MediaTek PMIC keys support
mfd: mt6397: Add PMIC keys support to MT6397 driver
.../devicetree/bindings/input/mtk-pmic-keys.txt | 38 +++ Documentation/devicetree/bindings/mfd/mt6397.txt | 6 + drivers/input/keyboard/Kconfig | 9 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-pmic-keys.c | 308 +++++++++++++++++++++ drivers/mfd/mt6397-core.c | 26 +- drivers/rtc/rtc-mt6397.c | 7 +- 7 files changed, 388 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txt create mode 100644 drivers/input/keyboard/mtk-pmic-keys.c
Signature · 1 line
1.9.1
PATCH v3 1/5 mfd: mt6397: create irq mappings in mfd core driver
The core driver should create and manage irq mappings instead of leaf drivers. This patch change to pass irq domain to devm_mfd_add_devices() and it will create mapping for irq resources automatically. And remove irq mapping in rtc driver since this has been done in core driver.
--- drivers/mfd/mt6397-core.c | 4 ++-- drivers/rtc/rtc-mt6397.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/mfd/mt6397-core.c +2 -2
@@ -289,7 +289,7 @@ static int mt6397_probe(struct platform_device *pdev) ret =devm_mfd_add_devices (&pdev->dev,-1 , mt6323_devs,ARRAY_SIZE (mt6323_devs),NULL , -0 ,NULL ); +0 , pmic->irq_domain);break ;case MT6397_CID_CODE :
@@ -304,7 +304,7 @@ static int mt6397_probe(struct platform_device *pdev) ret =devm_mfd_add_devices (&pdev->dev,-1 , mt6397_devs,ARRAY_SIZE (mt6397_devs),NULL , -0 ,NULL ); +0 , pmic->irq_domain);break ;default :
drivers/rtc/rtc-mt6397.c +3 -4
@@ -322,10 +322,9 @@ static int mtk_rtc_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); rtc->addr_base = res->start; - res =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); - rtc->irq =irq_create_mapping (mt6397_chip->irq_domain, res->start); -if (rtc->irq <=0 ) -return -EINVAL ; + rtc->irq =platform_get_irq (pdev,0 ); +if (rtc->irq <0 ) +return rtc->irq; rtc->regmap = mt6397_chip->regmap; rtc->dev = &pdev->dev;
Signature · 1 line
1.7.9.5
PATCH v3 2/5 dt-bindings: input: Add document bindings for mtk-pmic-keys
In reply to Chen ZhongThis patch adds the device tree binding documentation for the MediaTek pmic keys found on PMIC MT6397/MT6323.
--- .../devicetree/bindings/input/mtk-pmic-keys.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +38 -0
@@ -0,0 +1,38 @@ +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: Specifies the numeric keycode values to + be used for reporting keys presses. The array can + contain up to 2 entries. + +Optional Properties: +- wakeup-source: each key can be used as a wakeup source. +- mediatek,long-press-mode: Long press key shutdown setting, 1 for + pwrkey only, 2 for pwrkey/homekey together, others for disabled. +- debounce-interval: Long press key shutdown debouncing interval time + in seconds. 0/1/2/3 for 8/11/14/5 seconds. If not specified defaults to 0. + +Example: + + pmic: mt6397 { + compatible = "mediatek,mt6397"; + + ... + + mt6397keys: mt6397keys { + compatible = "mediatek,mt6397-keys"; + linux,keycodes = <KEY_POWER>, <KEY_VOLUMEDOWN>; + wakeup-source = <1>, <0>; + mediatek,long-press-mode = <1>; + debounce-interval = <0>; + }; + };
Signature · 1 line
1.7.9.5
PATCH v3 3/5 dt-bindings: mfd: Add bindings for the keys as subnode of PMIC
In reply to Chen ZhongThis patch adds documentation for device tree bindings for keys support as the subnode of MT6397/MT6323 PMIC.
--- Documentation/devicetree/bindings/mfd/mt6397.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/mfd/mt6397.txt +6 -0
@@ -7,6 +7,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules: - GPIO - Clock - LED +- Keys 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.
@@ -40,6 +41,11 @@ 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 + Example: pwrap: pwrap at 1000f000 { compatible = "mediatek,mt8135-pwrap";
Signature · 1 line
1.7.9.5
PATCH v3 4/5 input: Add MediaTek PMIC keys support
In reply to Chen ZhongThis patch add support to handle MediaTek PMIC MT6397/MT6323 key interrupts including pwrkey and homekey, also add setting for long press key shutdown behavior.
--- drivers/input/keyboard/Kconfig | 9 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-pmic-keys.c | 308 ++++++++++++++++++++++++++++++++ 3 files changed, 318 insertions(+) create mode 100644 drivers/input/keyboard/mtk-pmic-keys.c
drivers/input/keyboard/Kconfig +9 -0
@@ -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
drivers/input/keyboard/Makefile +1 -0
@@ -40,6 +40,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
drivers/input/keyboard/mtk-pmic-keys.c new file +308 -0
308 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 5/5 mfd: mt6397: Add PMIC keys support to MT6397 driver
In reply to Chen ZhongThis patch adds compatible strings and interrupts for pmic keys which serves as child device of MFD.
--- drivers/mfd/mt6397-core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/mfd/mt6397-core.c +21 -1
@@ -43,6 +43,16 @@ }, }; +static const struct resource mt6323_keys_resources[] = { +DEFINE_RES_IRQ (MT6323_IRQ_STATUS_PWRKEY ), +DEFINE_RES_IRQ (MT6323_IRQ_STATUS_FCHRKEY ), +}; + +static const struct resource mt6397_keys_resources[] = { +DEFINE_RES_IRQ (MT6397_IRQ_PWRKEY ), +DEFINE_RES_IRQ (MT6397_IRQ_HOMEKEY ), +}; +static const struct mfd_cell mt6323_devs[] = { { .name ="mt6323-regulator" ,
@@ -50,6 +60,11 @@ }, { .name = "mt6323-led", .of_compatible ="mediatek,mt6323-led" + }, { + .name = "mtk-pmic-keys", + .num_resources = ARRAY_SIZE(mt6323_keys_resources), + .resources = mt6323_keys_resources, + .of_compatible ="mediatek,mt6323-keys" }, };
@@ -71,7 +86,12 @@ }, { .name = "mt6397-pinctrl", .of_compatible = "mediatek,mt6397-pinctrl", - }, + }, { + .name = "mtk-pmic-keys", + .num_resources = ARRAY_SIZE(mt6397_keys_resources), + .resources = mt6397_keys_resources, + .of_compatible = "mediatek,mt6397-keys" + } };static void mt6397_irq_lock (struct irq_data *data)
Signature · 1 line
1.7.9.5
Re: [PATCH v3 1/5] mfd: mt6397: create irq mappings in mfd core driver
In reply to Chen ZhongQuoted 8 lines · Chen Zhong
The core driver should create and manage irq mappings instead of leaf drivers. This patch change to pass irq domain to
devm_mfd_add_devices()and it will create mapping for irq resources automatically. And remove irq mapping in rtc driver since this has been done in core driver.Acked-for-MFD-by Lee Jones <[email protected]>Signed-off-by Chen Zhong <[email protected]>
Quoted 48 lines
--- drivers/mfd/mt6397-core.c | 4 ++-- drivers/rtc/rtc-mt6397.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)drivers/mfd/mt6397-core.c +2
-2@@ -289,7 +289,7 @@ static int mt6397_probe(struct platform_device *pdev) ret =devm_mfd_add_devices (&pdev->dev,-1 , mt6323_devs,ARRAY_SIZE (mt6323_devs),NULL , -0 ,NULL ); +0 , pmic->irq_domain);break ;case MT6397_CID_CODE :@@ -304,7 +304,7 @@ static int mt6397_probe(struct platform_device *pdev) ret =devm_mfd_add_devices (&pdev->dev,-1 , mt6397_devs,ARRAY_SIZE (mt6397_devs),NULL , -0 ,NULL ); +0 , pmic->irq_domain);break ;default :drivers/rtc/rtc-mt6397.c +3
-4@@ -322,10 +322,9 @@ static int mtk_rtc_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); rtc->addr_base = res->start; - res =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); - rtc->irq =irq_create_mapping (mt6397_chip->irq_domain, res->start); -if (rtc->irq <=0 ) -return -EINVAL ; + rtc->irq =platform_get_irq (pdev,0 ); +if (rtc->irq <0 ) +return rtc->irq; rtc->regmap = mt6397_chip->regmap; rtc->dev = &pdev->dev;Signature · 1 line
1.7.9.5
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Sorry for missing the change history.
Changes since v2:
- use standard properties for keycodes and debounce time
- change to use platform_get_irq in leaf drivers
- use better ways to define IRQ resources
Changes since v1:
- create irq mappings in mfd core driver instead of leaf drivers
- remove some unused parts in mtk-pmic-keys driver
Quoted 26 lines · Chen Zhong
MediaTek PMIC are multi-function devices that can handle key interrupts, typically there are two keys attached to PMIC, which called pwrkey and homekey. PWRKEY usually used to wake up system from sleep. Homekey can used as volume down key due to board design. Long press keys can shutdown PMIC, the mode can be choose to be one key only or two keys together.
This series add support for key functions for MediaTek PMIC MT6397/MT6323.Chen Zhong (5):
mfd: mt6397: create irq mappings in mfd core driver
dt-bindings: input: Add document bindings for mtk-pmic-keys
dt-bindings: mfd: Add bindings for the keys as subnode of PMIC
input: Add MediaTek PMIC keys support
mfd: mt6397: Add PMIC keys support to MT6397 driver.../devicetree/bindings/input/mtk-pmic-keys.txt | 38 +++ Documentation/devicetree/bindings/mfd/mt6397.txt | 6 + drivers/input/keyboard/Kconfig | 9 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-pmic-keys.c | 308 +++++++++++++++++++++ drivers/mfd/mt6397-core.c | 26 +- drivers/rtc/rtc-mt6397.c | 7 +- 7 files changed, 388 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txt create mode 100644 drivers/input/keyboard/mtk-pmic-keys.c
Dmitry Torokhov
maintainerRe: [PATCH v3 4/5] input: Add MediaTek PMIC keys support
In reply to Chen ZhongHi Chen,
Quoted 15 lines · Chen Zhong
drivers/input/keyboard/mtk-pmic-keys.c new file +15
-0+static int mtk_pmic_key_setup (struct mtk_pmic_keys *keys, +struct pmic_keys_info *info) +{ +int ret; + + info->keys = keys; + + ret =regmap_update_bits (keys->regmap, info->regs->intsel_reg, + info->regs->intsel_mask, + info->regs->intsel_mask); +if (ret <0 ) +return ret; + + ret = devm_request_threaded_irq(keys->dev, info->irq, NULL, + mtk_pmic_keys_irq_handler_thread,
drivers/input/keyboard/mtk-pmic-keys.c line 191
Quoted 10 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +10
-0+IRQF_ONESHOT |IRQF_TRIGGER_HIGH , + "mtk-pmic-keys", info); +if (ret) { +dev_err (keys->dev,"Failed to request IRQ: %d: %d\n" , + info->irq, ret); +return ret; + } + +if (info->wakeup) +irq_set_irq_wake (info->irq,1 );
Normally we do this in suspend() (and undo in resume()), and I believe the drover API is enable_irq_wake() and disable_irq_wake().
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH v3 4/5] input: Add MediaTek PMIC keys support
Quoted 23 lines · Dmitry Torokhov
Hi Chen,
Quoted 20 lines · Chen Zhong
drivers/input/keyboard/mtk-pmic-keys.c new file +20
-0+static int mtk_pmic_key_setup (struct mtk_pmic_keys *keys, +struct pmic_keys_info *info) +{ +int ret; + + info->keys = keys; + + ret =regmap_update_bits (keys->regmap, info->regs->intsel_reg, + info->regs->intsel_mask, + info->regs->intsel_mask); +if (ret <0 ) +return ret; + + ret =devm_request_threaded_irq (keys->dev, info->irq,NULL , + mtk_pmic_keys_irq_handler_thread, +IRQF_ONESHOT |IRQF_TRIGGER_HIGH , +"mtk-pmic-keys" , info); +if (ret) { +dev_err (keys->dev,"Failed to request IRQ: %d: %d\n" , + info->irq, ret);
Quoted 9 lines
drivers/input/keyboard/mtk-pmic-keys.c line 191
Quoted 5 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +5
-0+return ret; + } + +if (info->wakeup) +irq_set_irq_wake (info->irq,1 );Normally we do this in
suspend()(and undo inresume()), and I believe the drover API isenable_irq_wake()anddisable_irq_wake().
Hi Dmitry,
I'll add suspend/resume callback functions and do this with enable_irq_wake() and disable_irq_wake().
Thank you.
Quoted 2 lines
Thanks.
Re: [PATCH v3 4/5] input: Add MediaTek PMIC keys support
In reply to Chen ZhongHi Chen,
what I would ask you is to be consistent with the naming, if your driver is called mtk-pmic, then all your functions and global variables should be named accordingly as mtk_pmic or MTK_PMIC. Please check in between the lines for real examples:
drivers/input/keyboard/mtk-pmic-keys.c line 39
Quoted 10 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +10
-0+#define PWRKEY_RST_EN_MASK 0x1 +#define PWRKEY_RST_EN_SHIFT 6 +#define HOMEKEY_RST_EN_MASK 0x1 +#define HOMEKEY_RST_EN_SHIFT 5 +#define RST_DU_MASK 0x3 +#define RST_DU_SHIFT 8 + +#define PMIC_PWRKEY_INDEX 0 +#define PMIC_HOMEKEY_INDEX 1 +#define PMIC_MAX_KEY_COUNT 2
#define MTK_PMIC_*
Quoted 1 line
+struct
pmic_keys_regs{
struct mtk_pmic_keys_regs
drivers/input/keyboard/mtk-pmic-keys.c line 48
Quoted 7 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +7
-0+u32 deb_reg; +u32 deb_mask; +u32 intsel_reg; +u32 intsel_mask; +}; + +#define PMIC_KEYS_REGS (_deb_reg, _deb_mask, _intsel_reg, _intsel_mask) \
MTK_PMIC_KEYS_REGS
drivers/input/keyboard/mtk-pmic-keys.c line 56
Quoted 8 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +8
-0+{ \ + .deb_reg = _deb_reg, \ + .deb_mask = _deb_mask, \ + .intsel_reg = _intsel_reg, \ + .intsel_mask = _intsel_mask, \ +} + +struct pmic_regs {
mtk_pmic_regs
and so on... you got the point.
Andi
Re: [PATCH v3 4/5] input: Add MediaTek PMIC keys support
Hi Andi,
Sorry for that, i deleted some prefix since the namings will be such long. If this should be consistent, I'll check and modify them in the next version.
Thank you.
Quoted 48 lines · Andi Shyti
Hi Chen,
what I would ask you is to be consistent with the naming, if your driver is called mtk-pmic, then all your functions and global variables should be named accordingly as
mtk_pmicorMTK_PMIC. Please check in between the lines for real examples:drivers/input/keyboard/mtk-pmic-keys.c line 39
Quoted 10 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +10
-0+#define PWRKEY_RST_EN_MASK 0x1 +#define PWRKEY_RST_EN_SHIFT 6 +#define HOMEKEY_RST_EN_MASK 0x1 +#define HOMEKEY_RST_EN_SHIFT 5 +#define RST_DU_MASK 0x3 +#define RST_DU_SHIFT 8 + +#define PMIC_PWRKEY_INDEX 0 +#define PMIC_HOMEKEY_INDEX 1 +#define PMIC_MAX_KEY_COUNT 2#define MTK_PMIC_*
Quoted 1 line
+struct
pmic_keys_regs{struct
mtk_pmic_keys_regsdrivers/input/keyboard/mtk-pmic-keys.c line 48
Quoted 7 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +7
-0+u32 deb_reg; +u32 deb_mask; +u32 intsel_reg; +u32 intsel_mask; +}; + +#define PMIC_KEYS_REGS (_deb_reg, _deb_mask, _intsel_reg, _intsel_mask) \
MTK_PMIC_KEYS_REGSdrivers/input/keyboard/mtk-pmic-keys.c line 56
Quoted 8 lines
drivers/input/keyboard/mtk-pmic-keys.c new file +8
-0+{ \ + .deb_reg = _deb_reg, \ + .deb_mask = _deb_mask, \ + .intsel_reg = _intsel_reg, \ + .intsel_mask = _intsel_mask, \ +} + +struct pmic_regs {
mtk_pmic_regsand so on... you got the point.
Andi
Rob Herring
maintainerRe: [PATCH v3 2/5] dt-bindings: input: Add document bindings for mtk-pmic-keys
In reply to Chen ZhongQuoted 23 lines · Chen Zhong
This patch adds the device tree binding documentation for the MediaTek pmic keys found on PMIC MT6397/MT6323.
Signed-off-by Chen Zhong <[email protected]>--- .../devicetree/bindings/input/mtk-pmic-keys.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txtDocumentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +8
-0@@ -0,0 +1,38 @@ +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/input/mtk-pmic-keys.txt line 18
Quoted 10 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +10
-0+Documentation/devicetree/bindings/mfd/mt6397.txt + +Required properties: +- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys" +- linux,keycodes: Specifies the numeric keycode values to + be used for reporting keys presses. The array can + contain up to 2 entries. + +Optional Properties: +- wakeup-source: each key can be used as a wakeup source.
wakeup-source is defined as a boolean.
Quoted 23 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +20
-0+- mediatek,long-press-mode: Long press key shutdown setting, 1 for + pwrkey only, 2 for pwrkey/homekey together, others for disabled. +- debounce-interval: Long press key shutdown debouncing interval time + in seconds. 0/1/2/3 for 8/11/14/5 seconds. If not specified defaults to 0. + +Example: + + pmic: mt6397 { + compatible = "mediatek,mt6397"; + + ... + + mt6397keys: mt6397keys { + compatible = "mediatek,mt6397-keys"; + linux,keycodes = <KEY_POWER>, <KEY_VOLUMEDOWN>; + wakeup-source = <1>, <0>; + mediatek,long-press-mode = <1>; + debounce-interval = <0>; + }; + };Signature · 1 line
1.7.9.5
Re: [PATCH v3 2/5] dt-bindings: input: Add document bindings for mtk-pmic-keys
Quoted 28 lines · Rob Herring
Quoted 27 lines · Chen Zhong
This patch adds the device tree binding documentation for the MediaTek pmic keys found on PMIC MT6397/MT6323.
Signed-off-by Chen Zhong <[email protected]>--- .../devicetree/bindings/input/mtk-pmic-keys.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txtDocumentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +12
-0@@ -0,0 +1,38 @@ +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"
Quoted 8 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt line 18
Quoted 6 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +6
-0+- linux,keycodes: Specifies the numeric keycode values to + be used for reporting keys presses. The array can + contain up to 2 entries. + +Optional Properties: +- wakeup-source: each key can be used as a wakeup source.wakeup-source is defined as a boolean.
Hi Rob,
We have two keys, maybe one key can be used as a wakeup source, another not.Since wakeup-source is defined as a boolean, we cannot distinguish the behavior of the two keys. May i know the better way to do this?
Thank you.
Quoted 24 lines
Quoted 24 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +20
-0+- mediatek,long-press-mode: Long press key shutdown setting, 1 for + pwrkey only, 2 for pwrkey/homekey together, others for disabled. +- debounce-interval: Long press key shutdown debouncing interval time + in seconds. 0/1/2/3 for 8/11/14/5 seconds. If not specified defaults to 0. + +Example: + + pmic: mt6397 { + compatible = "mediatek,mt6397"; + + ... + + mt6397keys: mt6397keys { + compatible = "mediatek,mt6397-keys"; + linux,keycodes = <KEY_POWER>, <KEY_VOLUMEDOWN>; + wakeup-source = <1>, <0>; + mediatek,long-press-mode = <1>; + debounce-interval = <0>; + }; + };Signature · 1 line
1.7.9.5
Re: [PATCH v3 2/5] dt-bindings: input: Add document bindings for mtk-pmic-keys
In reply to Rob HerringQuoted 28 lines · Rob Herring
Quoted 27 lines · Chen Zhong
This patch adds the device tree binding documentation for the MediaTek pmic keys found on PMIC MT6397/MT6323.
Signed-off-by Chen Zhong <[email protected]>--- .../devicetree/bindings/input/mtk-pmic-keys.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txtDocumentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +12
-0@@ -0,0 +1,38 @@ +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"
Quoted 8 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt line 18
Quoted 6 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +6
-0+- linux,keycodes: Specifies the numeric keycode values to + be used for reporting keys presses. The array can + contain up to 2 entries. + +Optional Properties: +- wakeup-source: each key can be used as a wakeup source.wakeup-source is defined as a boolean.
Hi Rob,
Could I modify it as this?
mediatek,wakeup-keys = <1>, <0>;
wakeup-source;
Thanks.
Quoted 24 lines
Quoted 24 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +20
-0+- mediatek,long-press-mode: Long press key shutdown setting, 1 for + pwrkey only, 2 for pwrkey/homekey together, others for disabled. +- debounce-interval: Long press key shutdown debouncing interval time + in seconds. 0/1/2/3 for 8/11/14/5 seconds. If not specified defaults to 0. + +Example: + + pmic: mt6397 { + compatible = "mediatek,mt6397"; + + ... + + mt6397keys: mt6397keys { + compatible = "mediatek,mt6397-keys"; + linux,keycodes = <KEY_POWER>, <KEY_VOLUMEDOWN>; + wakeup-source = <1>, <0>; + mediatek,long-press-mode = <1>; + debounce-interval = <0>; + }; + };Signature · 1 line
1.7.9.5
Re: [PATCH v3 3/5] dt-bindings: mfd: Add bindings for the keys as subnode of PMIC
In reply to Chen ZhongQuoted 8 lines · Chen Zhong
This patch adds documentation for device tree bindings for keys support as the subnode of MT6397/MT6323 PMIC.
Acked-by Rob Herring <[email protected]>Signed-off-by Chen Zhong <[email protected]>--- Documentation/devicetree/bindings/mfd/mt6397.txt | 6 ++++++ 1 file changed, 6 insertions(+)
For my own reference:
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v3 5/5] mfd: mt6397: Add PMIC keys support to MT6397 driver
In reply to Chen ZhongQuoted 7 lines · Chen Zhong
This patch adds compatible strings and interrupts for pmic keys which serves as child device of MFD.
Signed-off-by Chen Zhong <[email protected]>--- drivers/mfd/mt6397-core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
For my own reference:
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Rob Herring
maintainerRe: [PATCH v3 2/5] dt-bindings: input: Add document bindings for mtk-pmic-keys
In reply to Chen ZhongQuoted 38 lines · Chen Zhong
Quoted 28 lines · Rob Herring
Quoted 27 lines · Chen Zhong
This patch adds the device tree binding documentation for the MediaTek pmic keys found on PMIC MT6397/MT6323.
Signed-off-by Chen Zhong <[email protected]>--- .../devicetree/bindings/input/mtk-pmic-keys.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txtDocumentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +12
-0@@ -0,0 +1,38 @@ +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"Quoted 8 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt line 18
Quoted 6 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +6
-0+- linux,keycodes: Specifies the numeric keycode values to + be used for reporting keys presses. The array can + contain up to 2 entries. + +Optional Properties: +- wakeup-source: each key can be used as a wakeup source.wakeup-source is defined as a boolean.
Quoted 6 lines
Hi Rob,
Could I modify it as this?
mediatek,wakeup-keys = <1>, <0>;
wakeup-source;
What do the values and index signify? The power key is index 0 and the value 1 means enable wakeup? Or each value is the raw key (i.e. indexes in linux,keycode) that wakeup is enabled for?
I don't think this should be in DT really. It's really up to the user (i.e. userspace) to decide what keys cause wakeup (or maybe that's only suspend). If you default to the power key causes wakeup, do you really need to support different options?
If we do put this in DT, then it should be a common binding to specify keys that cause wake-up.
Rob
Re: [PATCH v3 2/5] dt-bindings: input: Add document bindings for mtk-pmic-keys
Quoted 55 lines · Rob Herring
Quoted 38 lines · Chen Zhong
Quoted 28 lines · Rob Herring
Quoted 27 lines · Chen Zhong
This patch adds the device tree binding documentation for the MediaTek pmic keys found on PMIC MT6397/MT6323.
Signed-off-by Chen Zhong <[email protected]>--- .../devicetree/bindings/input/mtk-pmic-keys.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txtDocumentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +12
-0@@ -0,0 +1,38 @@ +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"Quoted 8 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt line 18
Quoted 6 lines
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt new file +6
-0+- linux,keycodes: Specifies the numeric keycode values to + be used for reporting keys presses. The array can + contain up to 2 entries. + +Optional Properties: +- wakeup-source: each key can be used as a wakeup source.wakeup-source is defined as a boolean.
Quoted 6 lines
Hi Rob,
Could I modify it as this?
mediatek,wakeup-keys = <1>, <0>;
wakeup-source;What do the values and index signify? The power key is index 0 and the value 1 means enable wakeup? Or each value is the raw key (i.e. indexes in linux,keycode) that wakeup is enabled for?
I don't think this should be in DT really. It's really up to the user (i.e. userspace) to decide what keys cause wakeup (or maybe that's only suspend). If you default to the power key causes wakeup, do you really need to support different options?
Quoted 4 lines
If we do put this in DT, then it should be a common binding to specify keys that cause wake-up.
Rob
Hi Rob,
Yes, we want to describe that power key is index 0 and is a wakeup source, homekey is index 1 and not a wakeup source.
Since power key and homekey are two real HW keys, customer can decide which key to be the wakeup source or both due to their hw design, so we put this in DT and can be different for different boards.
Thank you.
Chen