* [PATCH 0/7] Input: mtk-pmic-keys - add support for MT6358
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek
The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.
The interrupt logic is a little different than other PMICs from the
same family:
* for MT6323 and MT6397, we have one interrupt source per button
* for MT6358, we have two interrupts lines per button: the press and
* release interrupts are distinct sources.
These series:
* Fix a NULL ptr error when we use mtk-pmic-keys without dts code
* Rework the mt6397 driver to prepare for this different interrupt logic
* Add support for the MT6358 power buttons
This has been functionally tested (using evtest) on
the mt8183-pumpkin board on linux/master
It has also been used for a couple of months in a downstream
tree based on v5.4.
Mattijs Korpershoek (7):
Input: mtk-pmic-keys - check for NULL on of_match_device()
mfd: mt6397: add mt6358 register definitions for power key
mfd: mt6397: keys: use named IRQs instead of index
dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
Input: mtk-pmic-keys - add support for MT6358
mfd: mt6397: Add PMIC keys for MT6358
arm64: dts: mt6358: add mt6358-keys node
.../bindings/input/mtk-pmic-keys.txt | 5 +-
arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++
drivers/input/keyboard/mtk-pmic-keys.c | 59 +++++++++++++++++--
drivers/mfd/mt6397-core.c | 20 +++++--
include/linux/mfd/mt6358/registers.h | 2 +
5 files changed, 89 insertions(+), 9 deletions(-)
base-commit: 4a0225c3d208cfa6e4550f2210ffd9114a952a81
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH 0/7] Input: mtk-pmic-keys - add support for MT6358
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek
The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.
The interrupt logic is a little different than other PMICs from the
same family:
* for MT6323 and MT6397, we have one interrupt source per button
* for MT6358, we have two interrupts lines per button: the press and
* release interrupts are distinct sources.
These series:
* Fix a NULL ptr error when we use mtk-pmic-keys without dts code
* Rework the mt6397 driver to prepare for this different interrupt logic
* Add support for the MT6358 power buttons
This has been functionally tested (using evtest) on
the mt8183-pumpkin board on linux/master
It has also been used for a couple of months in a downstream
tree based on v5.4.
Mattijs Korpershoek (7):
Input: mtk-pmic-keys - check for NULL on of_match_device()
mfd: mt6397: add mt6358 register definitions for power key
mfd: mt6397: keys: use named IRQs instead of index
dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
Input: mtk-pmic-keys - add support for MT6358
mfd: mt6397: Add PMIC keys for MT6358
arm64: dts: mt6358: add mt6358-keys node
.../bindings/input/mtk-pmic-keys.txt | 5 +-
arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++
drivers/input/keyboard/mtk-pmic-keys.c | 59 +++++++++++++++++--
drivers/mfd/mt6397-core.c | 20 +++++--
include/linux/mfd/mt6358/registers.h | 2 +
5 files changed, 89 insertions(+), 9 deletions(-)
base-commit: 4a0225c3d208cfa6e4550f2210ffd9114a952a81
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
mtk-pmic-keys being a child device of mt6397, it will always get probed
when mt6397_probe() is called.
This also happens when we have no device tree node matching
mediatek,mt6397-keys.
In that case, the mfd core warns us:
[ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.
In case of NULL print error message and return -ENODEV
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 62391d6c7da6..12c449eed026 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
const struct of_device_id *of_id =
of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
+ if (!of_id)
+ return -ENODEV;
+
keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
if (!keys)
return -ENOMEM;
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
mtk-pmic-keys being a child device of mt6397, it will always get probed
when mt6397_probe() is called.
This also happens when we have no device tree node matching
mediatek,mt6397-keys.
In that case, the mfd core warns us:
[ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.
In case of NULL print error message and return -ENODEV
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 62391d6c7da6..12c449eed026 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
const struct of_device_id *of_id =
of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
+ if (!of_id)
+ return -ENODEV;
+
keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
if (!keys)
return -ENOMEM;
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
mtk-pmic-keys being a child device of mt6397, it will always get probed
when mt6397_probe() is called.
This also happens when we have no device tree node matching
mediatek,mt6397-keys.
In that case, the mfd core warns us:
[ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.
In case of NULL print error message and return -ENODEV
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 62391d6c7da6..12c449eed026 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
const struct of_device_id *of_id =
of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
+ if (!of_id)
+ return -ENODEV;
+
keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
if (!keys)
return -ENOMEM;
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 2/7] mfd: mt6397: add mt6358 register definitions for power key
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek,
linux-kernel
In order to support power/home key detection, add definitions for
two more MT6358 PMIC registers:
- TOPSTATUS: homekey and powerkey debounce status
- TOP_RST_MISC: controls homekey,powerkey long press reset time
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
include/linux/mfd/mt6358/registers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
index 2ad0b312aa28..201139b12140 100644
--- a/include/linux/mfd/mt6358/registers.h
+++ b/include/linux/mfd/mt6358/registers.h
@@ -8,6 +8,8 @@
/* PMIC Registers */
#define MT6358_SWCID 0xa
+#define MT6358_TOPSTATUS 0x28
+#define MT6358_TOP_RST_MISC 0x14c
#define MT6358_MISC_TOP_INT_CON0 0x188
#define MT6358_MISC_TOP_INT_STATUS0 0x194
#define MT6358_TOP_INT_STATUS0 0x19e
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 2/7] mfd: mt6397: add mt6358 register definitions for power key
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek,
linux-kernel
In order to support power/home key detection, add definitions for
two more MT6358 PMIC registers:
- TOPSTATUS: homekey and powerkey debounce status
- TOP_RST_MISC: controls homekey,powerkey long press reset time
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
include/linux/mfd/mt6358/registers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
index 2ad0b312aa28..201139b12140 100644
--- a/include/linux/mfd/mt6358/registers.h
+++ b/include/linux/mfd/mt6358/registers.h
@@ -8,6 +8,8 @@
/* PMIC Registers */
#define MT6358_SWCID 0xa
+#define MT6358_TOPSTATUS 0x28
+#define MT6358_TOP_RST_MISC 0x14c
#define MT6358_MISC_TOP_INT_CON0 0x188
#define MT6358_MISC_TOP_INT_STATUS0 0x194
#define MT6358_TOP_INT_STATUS0 0x19e
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 2/7] mfd: mt6397: add mt6358 register definitions for power key
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek,
linux-kernel
In order to support power/home key detection, add definitions for
two more MT6358 PMIC registers:
- TOPSTATUS: homekey and powerkey debounce status
- TOP_RST_MISC: controls homekey,powerkey long press reset time
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
include/linux/mfd/mt6358/registers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
index 2ad0b312aa28..201139b12140 100644
--- a/include/linux/mfd/mt6358/registers.h
+++ b/include/linux/mfd/mt6358/registers.h
@@ -8,6 +8,8 @@
/* PMIC Registers */
#define MT6358_SWCID 0xa
+#define MT6358_TOPSTATUS 0x28
+#define MT6358_TOP_RST_MISC 0x14c
#define MT6358_MISC_TOP_INT_CON0 0x188
#define MT6358_MISC_TOP_INT_STATUS0 0x194
#define MT6358_TOP_INT_STATUS0 0x19e
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 3/7] mfd: mt6397: keys: use named IRQs instead of index
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger, Lee Jones
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
For some compatible pmics (such as MT6358), there are two IRQs per
physical key: one for press event, another for release event.
Currently, the mtk-pmic-keys driver assumes that each key only has one
IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping.
This won't work for MT6358, as we have multiple resources (2) for one key.
To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name
instead of by index.
Note: The keys_resources are not part of the device-tree bindings so
this won't break any DT schemas.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 7 +++++--
drivers/mfd/mt6397-core.c | 8 ++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 12c449eed026..b877bf98db38 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -241,6 +241,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
unsigned int keycount;
struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
struct device_node *node = pdev->dev.of_node, *child;
+ static const char *const irqnames[] = { "powerkey", "homekey" };
struct mtk_pmic_keys *keys;
const struct mtk_pmic_regs *mtk_pmic_regs;
struct input_dev *input_dev;
@@ -271,7 +272,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
input_dev->id.version = 0x0001;
keycount = of_get_available_child_count(node);
- if (keycount > MTK_PMIC_MAX_KEY_COUNT) {
+ if (keycount > MTK_PMIC_MAX_KEY_COUNT ||
+ keycount > ARRAY_SIZE(irqnames)) {
dev_err(keys->dev, "too many keys defined (%d)\n", keycount);
return -EINVAL;
}
@@ -279,7 +281,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
for_each_child_of_node(node, child) {
keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];
- keys->keys[index].irq = platform_get_irq(pdev, index);
+ keys->keys[index].irq =
+ platform_get_irq_byname(pdev, irqnames[index]);
if (keys->keys[index].irq < 0) {
of_node_put(child);
return keys->keys[index].irq;
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 7518d74c3b4c..8738b5524783 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -46,13 +46,13 @@ static const struct resource mt6397_rtc_resources[] = {
};
static const struct resource mt6323_keys_resources[] = {
- DEFINE_RES_IRQ(MT6323_IRQ_STATUS_PWRKEY),
- DEFINE_RES_IRQ(MT6323_IRQ_STATUS_FCHRKEY),
+ DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
};
static const struct resource mt6397_keys_resources[] = {
- DEFINE_RES_IRQ(MT6397_IRQ_PWRKEY),
- DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY),
+ DEFINE_RES_IRQ_NAMED(MT6397_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6397_IRQ_HOMEKEY, "homekey"),
};
static const struct resource mt6323_pwrc_resources[] = {
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 3/7] mfd: mt6397: keys: use named IRQs instead of index
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger, Lee Jones
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
For some compatible pmics (such as MT6358), there are two IRQs per
physical key: one for press event, another for release event.
Currently, the mtk-pmic-keys driver assumes that each key only has one
IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping.
This won't work for MT6358, as we have multiple resources (2) for one key.
To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name
instead of by index.
Note: The keys_resources are not part of the device-tree bindings so
this won't break any DT schemas.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 7 +++++--
drivers/mfd/mt6397-core.c | 8 ++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 12c449eed026..b877bf98db38 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -241,6 +241,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
unsigned int keycount;
struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
struct device_node *node = pdev->dev.of_node, *child;
+ static const char *const irqnames[] = { "powerkey", "homekey" };
struct mtk_pmic_keys *keys;
const struct mtk_pmic_regs *mtk_pmic_regs;
struct input_dev *input_dev;
@@ -271,7 +272,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
input_dev->id.version = 0x0001;
keycount = of_get_available_child_count(node);
- if (keycount > MTK_PMIC_MAX_KEY_COUNT) {
+ if (keycount > MTK_PMIC_MAX_KEY_COUNT ||
+ keycount > ARRAY_SIZE(irqnames)) {
dev_err(keys->dev, "too many keys defined (%d)\n", keycount);
return -EINVAL;
}
@@ -279,7 +281,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
for_each_child_of_node(node, child) {
keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];
- keys->keys[index].irq = platform_get_irq(pdev, index);
+ keys->keys[index].irq =
+ platform_get_irq_byname(pdev, irqnames[index]);
if (keys->keys[index].irq < 0) {
of_node_put(child);
return keys->keys[index].irq;
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 7518d74c3b4c..8738b5524783 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -46,13 +46,13 @@ static const struct resource mt6397_rtc_resources[] = {
};
static const struct resource mt6323_keys_resources[] = {
- DEFINE_RES_IRQ(MT6323_IRQ_STATUS_PWRKEY),
- DEFINE_RES_IRQ(MT6323_IRQ_STATUS_FCHRKEY),
+ DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
};
static const struct resource mt6397_keys_resources[] = {
- DEFINE_RES_IRQ(MT6397_IRQ_PWRKEY),
- DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY),
+ DEFINE_RES_IRQ_NAMED(MT6397_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6397_IRQ_HOMEKEY, "homekey"),
};
static const struct resource mt6323_pwrc_resources[] = {
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 3/7] mfd: mt6397: keys: use named IRQs instead of index
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger, Lee Jones
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
For some compatible pmics (such as MT6358), there are two IRQs per
physical key: one for press event, another for release event.
Currently, the mtk-pmic-keys driver assumes that each key only has one
IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping.
This won't work for MT6358, as we have multiple resources (2) for one key.
To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name
instead of by index.
Note: The keys_resources are not part of the device-tree bindings so
this won't break any DT schemas.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 7 +++++--
drivers/mfd/mt6397-core.c | 8 ++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 12c449eed026..b877bf98db38 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -241,6 +241,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
unsigned int keycount;
struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
struct device_node *node = pdev->dev.of_node, *child;
+ static const char *const irqnames[] = { "powerkey", "homekey" };
struct mtk_pmic_keys *keys;
const struct mtk_pmic_regs *mtk_pmic_regs;
struct input_dev *input_dev;
@@ -271,7 +272,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
input_dev->id.version = 0x0001;
keycount = of_get_available_child_count(node);
- if (keycount > MTK_PMIC_MAX_KEY_COUNT) {
+ if (keycount > MTK_PMIC_MAX_KEY_COUNT ||
+ keycount > ARRAY_SIZE(irqnames)) {
dev_err(keys->dev, "too many keys defined (%d)\n", keycount);
return -EINVAL;
}
@@ -279,7 +281,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
for_each_child_of_node(node, child) {
keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index];
- keys->keys[index].irq = platform_get_irq(pdev, index);
+ keys->keys[index].irq =
+ platform_get_irq_byname(pdev, irqnames[index]);
if (keys->keys[index].irq < 0) {
of_node_put(child);
return keys->keys[index].irq;
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 7518d74c3b4c..8738b5524783 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -46,13 +46,13 @@ static const struct resource mt6397_rtc_resources[] = {
};
static const struct resource mt6323_keys_resources[] = {
- DEFINE_RES_IRQ(MT6323_IRQ_STATUS_PWRKEY),
- DEFINE_RES_IRQ(MT6323_IRQ_STATUS_FCHRKEY),
+ DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
};
static const struct resource mt6397_keys_resources[] = {
- DEFINE_RES_IRQ(MT6397_IRQ_PWRKEY),
- DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY),
+ DEFINE_RES_IRQ_NAMED(MT6397_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6397_IRQ_HOMEKEY, "homekey"),
};
static const struct resource mt6323_pwrc_resources[] = {
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Rob Herring, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.
MT6358 is a little different since it used separate IRQs for the
release key (_r) event
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
index 535d92885372..9d00f2a8e13a 100644
--- a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
+++ b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
@@ -9,7 +9,10 @@ For MT6397/MT6323 MFD bindings see:
Documentation/devicetree/bindings/mfd/mt6397.txt
Required properties:
-- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys"
+- compatible: Should be one of:
+ - "mediatek,mt6397-keys"
+ - "mediatek,mt6323-keys"
+ - "mediatek,mt6358-keys"
- linux,keycodes: See Documentation/devicetree/bindings/input/input.yaml
Optional Properties:
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Rob Herring, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.
MT6358 is a little different since it used separate IRQs for the
release key (_r) event
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
index 535d92885372..9d00f2a8e13a 100644
--- a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
+++ b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
@@ -9,7 +9,10 @@ For MT6397/MT6323 MFD bindings see:
Documentation/devicetree/bindings/mfd/mt6397.txt
Required properties:
-- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys"
+- compatible: Should be one of:
+ - "mediatek,mt6397-keys"
+ - "mediatek,mt6323-keys"
+ - "mediatek,mt6358-keys"
- linux,keycodes: See Documentation/devicetree/bindings/input/input.yaml
Optional Properties:
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Rob Herring, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.
MT6358 is a little different since it used separate IRQs for the
release key (_r) event
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
index 535d92885372..9d00f2a8e13a 100644
--- a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
+++ b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
@@ -9,7 +9,10 @@ For MT6397/MT6323 MFD bindings see:
Documentation/devicetree/bindings/mfd/mt6397.txt
Required properties:
-- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys"
+- compatible: Should be one of:
+ - "mediatek,mt6397-keys"
+ - "mediatek,mt6323-keys"
+ - "mediatek,mt6358-keys"
- linux,keycodes: See Documentation/devicetree/bindings/input/input.yaml
Optional Properties:
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 5/7] Input: mtk-pmic-keys - add support for MT6358
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
MT6358 pmic keys behave differently than mt6397 and mt6323: there are
two interrupts per key: one for press, the other one for release (_r)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 49 ++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index b877bf98db38..c635d612bd44 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -9,6 +9,7 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/mt6323/registers.h>
+#include <linux/mfd/mt6358/registers.h>
#include <linux/mfd/mt6397/core.h>
#include <linux/mfd/mt6397/registers.h>
#include <linux/module.h>
@@ -74,11 +75,22 @@ static const struct mtk_pmic_regs mt6323_regs = {
.pmic_rst_reg = MT6323_TOP_RST_MISC,
};
+static const struct mtk_pmic_regs mt6358_regs = {
+ .keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+ MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+ 0x2, MT6358_PSC_TOP_INT_CON0, 0x5),
+ .keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+ MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+ 0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
+ .pmic_rst_reg = MT6358_TOP_RST_MISC,
+};
+
struct mtk_pmic_keys_info {
struct mtk_pmic_keys *keys;
const struct mtk_pmic_keys_regs *regs;
unsigned int keycode;
int irq;
+ int irq_r; /* optional: release irq if different */
bool wakeup:1;
};
@@ -188,6 +200,19 @@ static int mtk_pmic_key_setup(struct mtk_pmic_keys *keys,
return ret;
}
+ if (info->irq_r > 0) {
+ ret = devm_request_threaded_irq(
+ keys->dev, info->irq_r, 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_r: %d: %d\n",
+ info->irq, ret);
+ return ret;
+ }
+ }
+
input_set_capability(keys->input_dev, EV_KEY, info->keycode);
return 0;
@@ -199,8 +224,11 @@ static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev)
int index;
for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
- if (keys->keys[index].wakeup)
+ if (keys->keys[index].wakeup) {
enable_irq_wake(keys->keys[index].irq);
+ if (keys->keys[index].irq_r > 0)
+ enable_irq_wake(keys->keys[index].irq_r);
+ }
}
return 0;
@@ -212,8 +240,11 @@ static int __maybe_unused mtk_pmic_keys_resume(struct device *dev)
int index;
for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
- if (keys->keys[index].wakeup)
+ if (keys->keys[index].wakeup) {
disable_irq_wake(keys->keys[index].irq);
+ if (keys->keys[index].irq_r > 0)
+ disable_irq_wake(keys->keys[index].irq_r);
+ }
}
return 0;
@@ -229,6 +260,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
}, {
.compatible = "mediatek,mt6323-keys",
.data = &mt6323_regs,
+ }, {
+ .compatible = "mediatek,mt6358-keys",
+ .data = &mt6358_regs,
}, {
/* sentinel */
}
@@ -242,6 +276,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
struct device_node *node = pdev->dev.of_node, *child;
static const char *const irqnames[] = { "powerkey", "homekey" };
+ static const char *const irqnames_r[] = { "powerkey_r", "homekey_r" };
struct mtk_pmic_keys *keys;
const struct mtk_pmic_regs *mtk_pmic_regs;
struct input_dev *input_dev;
@@ -288,6 +323,16 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
return keys->keys[index].irq;
}
+ if (of_device_is_compatible(node, "mediatek,mt6358-keys")) {
+ keys->keys[index].irq_r = platform_get_irq_byname(
+ pdev, irqnames_r[index]);
+
+ if (keys->keys[index].irq_r < 0) {
+ of_node_put(child);
+ return keys->keys[index].irq_r;
+ }
+ }
+
error = of_property_read_u32(child,
"linux,keycodes", &keys->keys[index].keycode);
if (error) {
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 5/7] Input: mtk-pmic-keys - add support for MT6358
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
MT6358 pmic keys behave differently than mt6397 and mt6323: there are
two interrupts per key: one for press, the other one for release (_r)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 49 ++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index b877bf98db38..c635d612bd44 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -9,6 +9,7 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/mt6323/registers.h>
+#include <linux/mfd/mt6358/registers.h>
#include <linux/mfd/mt6397/core.h>
#include <linux/mfd/mt6397/registers.h>
#include <linux/module.h>
@@ -74,11 +75,22 @@ static const struct mtk_pmic_regs mt6323_regs = {
.pmic_rst_reg = MT6323_TOP_RST_MISC,
};
+static const struct mtk_pmic_regs mt6358_regs = {
+ .keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+ MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+ 0x2, MT6358_PSC_TOP_INT_CON0, 0x5),
+ .keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+ MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+ 0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
+ .pmic_rst_reg = MT6358_TOP_RST_MISC,
+};
+
struct mtk_pmic_keys_info {
struct mtk_pmic_keys *keys;
const struct mtk_pmic_keys_regs *regs;
unsigned int keycode;
int irq;
+ int irq_r; /* optional: release irq if different */
bool wakeup:1;
};
@@ -188,6 +200,19 @@ static int mtk_pmic_key_setup(struct mtk_pmic_keys *keys,
return ret;
}
+ if (info->irq_r > 0) {
+ ret = devm_request_threaded_irq(
+ keys->dev, info->irq_r, 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_r: %d: %d\n",
+ info->irq, ret);
+ return ret;
+ }
+ }
+
input_set_capability(keys->input_dev, EV_KEY, info->keycode);
return 0;
@@ -199,8 +224,11 @@ static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev)
int index;
for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
- if (keys->keys[index].wakeup)
+ if (keys->keys[index].wakeup) {
enable_irq_wake(keys->keys[index].irq);
+ if (keys->keys[index].irq_r > 0)
+ enable_irq_wake(keys->keys[index].irq_r);
+ }
}
return 0;
@@ -212,8 +240,11 @@ static int __maybe_unused mtk_pmic_keys_resume(struct device *dev)
int index;
for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
- if (keys->keys[index].wakeup)
+ if (keys->keys[index].wakeup) {
disable_irq_wake(keys->keys[index].irq);
+ if (keys->keys[index].irq_r > 0)
+ disable_irq_wake(keys->keys[index].irq_r);
+ }
}
return 0;
@@ -229,6 +260,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
}, {
.compatible = "mediatek,mt6323-keys",
.data = &mt6323_regs,
+ }, {
+ .compatible = "mediatek,mt6358-keys",
+ .data = &mt6358_regs,
}, {
/* sentinel */
}
@@ -242,6 +276,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
struct device_node *node = pdev->dev.of_node, *child;
static const char *const irqnames[] = { "powerkey", "homekey" };
+ static const char *const irqnames_r[] = { "powerkey_r", "homekey_r" };
struct mtk_pmic_keys *keys;
const struct mtk_pmic_regs *mtk_pmic_regs;
struct input_dev *input_dev;
@@ -288,6 +323,16 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
return keys->keys[index].irq;
}
+ if (of_device_is_compatible(node, "mediatek,mt6358-keys")) {
+ keys->keys[index].irq_r = platform_get_irq_byname(
+ pdev, irqnames_r[index]);
+
+ if (keys->keys[index].irq_r < 0) {
+ of_node_put(child);
+ return keys->keys[index].irq_r;
+ }
+ }
+
error = of_property_read_u32(child,
"linux,keycodes", &keys->keys[index].keycode);
if (error) {
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 5/7] Input: mtk-pmic-keys - add support for MT6358
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Dmitry Torokhov, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
MT6358 pmic keys behave differently than mt6397 and mt6323: there are
two interrupts per key: one for press, the other one for release (_r)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/input/keyboard/mtk-pmic-keys.c | 49 ++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index b877bf98db38..c635d612bd44 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -9,6 +9,7 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/mt6323/registers.h>
+#include <linux/mfd/mt6358/registers.h>
#include <linux/mfd/mt6397/core.h>
#include <linux/mfd/mt6397/registers.h>
#include <linux/module.h>
@@ -74,11 +75,22 @@ static const struct mtk_pmic_regs mt6323_regs = {
.pmic_rst_reg = MT6323_TOP_RST_MISC,
};
+static const struct mtk_pmic_regs mt6358_regs = {
+ .keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+ MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+ 0x2, MT6358_PSC_TOP_INT_CON0, 0x5),
+ .keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+ MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS,
+ 0x8, MT6358_PSC_TOP_INT_CON0, 0xa),
+ .pmic_rst_reg = MT6358_TOP_RST_MISC,
+};
+
struct mtk_pmic_keys_info {
struct mtk_pmic_keys *keys;
const struct mtk_pmic_keys_regs *regs;
unsigned int keycode;
int irq;
+ int irq_r; /* optional: release irq if different */
bool wakeup:1;
};
@@ -188,6 +200,19 @@ static int mtk_pmic_key_setup(struct mtk_pmic_keys *keys,
return ret;
}
+ if (info->irq_r > 0) {
+ ret = devm_request_threaded_irq(
+ keys->dev, info->irq_r, 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_r: %d: %d\n",
+ info->irq, ret);
+ return ret;
+ }
+ }
+
input_set_capability(keys->input_dev, EV_KEY, info->keycode);
return 0;
@@ -199,8 +224,11 @@ static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev)
int index;
for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
- if (keys->keys[index].wakeup)
+ if (keys->keys[index].wakeup) {
enable_irq_wake(keys->keys[index].irq);
+ if (keys->keys[index].irq_r > 0)
+ enable_irq_wake(keys->keys[index].irq_r);
+ }
}
return 0;
@@ -212,8 +240,11 @@ static int __maybe_unused mtk_pmic_keys_resume(struct device *dev)
int index;
for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) {
- if (keys->keys[index].wakeup)
+ if (keys->keys[index].wakeup) {
disable_irq_wake(keys->keys[index].irq);
+ if (keys->keys[index].irq_r > 0)
+ disable_irq_wake(keys->keys[index].irq_r);
+ }
}
return 0;
@@ -229,6 +260,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
}, {
.compatible = "mediatek,mt6323-keys",
.data = &mt6323_regs,
+ }, {
+ .compatible = "mediatek,mt6358-keys",
+ .data = &mt6358_regs,
}, {
/* sentinel */
}
@@ -242,6 +276,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent);
struct device_node *node = pdev->dev.of_node, *child;
static const char *const irqnames[] = { "powerkey", "homekey" };
+ static const char *const irqnames_r[] = { "powerkey_r", "homekey_r" };
struct mtk_pmic_keys *keys;
const struct mtk_pmic_regs *mtk_pmic_regs;
struct input_dev *input_dev;
@@ -288,6 +323,16 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
return keys->keys[index].irq;
}
+ if (of_device_is_compatible(node, "mediatek,mt6358-keys")) {
+ keys->keys[index].irq_r = platform_get_irq_byname(
+ pdev, irqnames_r[index]);
+
+ if (keys->keys[index].irq_r < 0) {
+ of_node_put(child);
+ return keys->keys[index].irq_r;
+ }
+ }
+
error = of_property_read_u32(child,
"linux,keycodes", &keys->keys[index].keycode);
if (error) {
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 6/7] mfd: mt6397: Add PMIC keys for MT6358
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek,
linux-kernel
This patch adds compatible strings and interrupts for pmic keys
which serves as child device of MFD.
MT6358 has two interrupts per key: one for press, another one for
release (_R)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/mfd/mt6397-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 8738b5524783..13a5e15e9dd6 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -45,6 +45,13 @@ static const struct resource mt6397_rtc_resources[] = {
DEFINE_RES_IRQ(MT6397_IRQ_RTC),
};
+static const struct resource mt6358_keys_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY, "homekey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY_R, "powerkey_r"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY_R, "homekey_r"),
+};
+
static const struct resource mt6323_keys_resources[] = {
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
@@ -96,6 +103,11 @@ static const struct mfd_cell mt6358_devs[] = {
}, {
.name = "mt6358-sound",
.of_compatible = "mediatek,mt6358-sound"
+ }, {
+ .name = "mtk-pmic-keys",
+ .num_resources = ARRAY_SIZE(mt6358_keys_resources),
+ .resources = mt6358_keys_resources,
+ .of_compatible = "mediatek,mt6358-keys"
},
};
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 6/7] mfd: mt6397: Add PMIC keys for MT6358
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek,
linux-kernel
This patch adds compatible strings and interrupts for pmic keys
which serves as child device of MFD.
MT6358 has two interrupts per key: one for press, another one for
release (_R)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/mfd/mt6397-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 8738b5524783..13a5e15e9dd6 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -45,6 +45,13 @@ static const struct resource mt6397_rtc_resources[] = {
DEFINE_RES_IRQ(MT6397_IRQ_RTC),
};
+static const struct resource mt6358_keys_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY, "homekey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY_R, "powerkey_r"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY_R, "homekey_r"),
+};
+
static const struct resource mt6323_keys_resources[] = {
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
@@ -96,6 +103,11 @@ static const struct mfd_cell mt6358_devs[] = {
}, {
.name = "mt6358-sound",
.of_compatible = "mediatek,mt6358-sound"
+ }, {
+ .name = "mtk-pmic-keys",
+ .num_resources = ARRAY_SIZE(mt6358_keys_resources),
+ .resources = mt6358_keys_resources,
+ .of_compatible = "mediatek,mt6358-keys"
},
};
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 6/7] mfd: mt6397: Add PMIC keys for MT6358
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, linux-arm-kernel, linux-mediatek,
linux-kernel
This patch adds compatible strings and interrupts for pmic keys
which serves as child device of MFD.
MT6358 has two interrupts per key: one for press, another one for
release (_R)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/mfd/mt6397-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 8738b5524783..13a5e15e9dd6 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -45,6 +45,13 @@ static const struct resource mt6397_rtc_resources[] = {
DEFINE_RES_IRQ(MT6397_IRQ_RTC),
};
+static const struct resource mt6358_keys_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY, "homekey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY_R, "powerkey_r"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY_R, "homekey_r"),
+};
+
static const struct resource mt6323_keys_resources[] = {
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
@@ -96,6 +103,11 @@ static const struct mfd_cell mt6358_devs[] = {
}, {
.name = "mt6358-sound",
.of_compatible = "mediatek,mt6358-sound"
+ }, {
+ .name = "mtk-pmic-keys",
+ .num_resources = ARRAY_SIZE(mt6358_keys_resources),
+ .resources = mt6358_keys_resources,
+ .of_compatible = "mediatek,mt6358-keys"
},
};
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 7/7] arm64: dts: mt6358: add mt6358-keys node
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 16:42 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Rob Herring, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel
This enables the power,home keys on MediaTek boards with a mt6358 pmic.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt6358.dtsi b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
index fa159b20379e..a1b017a6a751 100644
--- a/arch/arm64/boot/dts/mediatek/mt6358.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2020 MediaTek Inc.
*/
+#include <dt-bindings/input/input.h>
&pwrap {
pmic: mt6358 {
@@ -356,5 +357,16 @@ mt6358_vsim2_reg: ldo_vsim2 {
mt6358rtc: mt6358rtc {
compatible = "mediatek,mt6358-rtc";
};
+
+ mt6358keys: mt6358keys {
+ compatible = "mediatek,mt6358-keys";
+ power {
+ linux,keycodes = <KEY_POWER>;
+ wakeup-source;
+ };
+ home {
+ linux,keycodes = <KEY_HOME>;
+ };
+ };
};
};
--
2.27.0
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 7/7] arm64: dts: mt6358: add mt6358-keys node
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Rob Herring, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel
This enables the power,home keys on MediaTek boards with a mt6358 pmic.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt6358.dtsi b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
index fa159b20379e..a1b017a6a751 100644
--- a/arch/arm64/boot/dts/mediatek/mt6358.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2020 MediaTek Inc.
*/
+#include <dt-bindings/input/input.h>
&pwrap {
pmic: mt6358 {
@@ -356,5 +357,16 @@ mt6358_vsim2_reg: ldo_vsim2 {
mt6358rtc: mt6358rtc {
compatible = "mediatek,mt6358-rtc";
};
+
+ mt6358keys: mt6358keys {
+ compatible = "mediatek,mt6358-keys";
+ power {
+ linux,keycodes = <KEY_POWER>;
+ wakeup-source;
+ };
+ home {
+ linux,keycodes = <KEY_HOME>;
+ };
+ };
};
};
--
2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 7/7] arm64: dts: mt6358: add mt6358-keys node
@ 2021-04-28 16:42 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-28 16:42 UTC (permalink / raw)
To: Rob Herring, Matthias Brugger
Cc: fparent, Mattijs Korpershoek, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel
This enables the power,home keys on MediaTek boards with a mt6358 pmic.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt6358.dtsi b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
index fa159b20379e..a1b017a6a751 100644
--- a/arch/arm64/boot/dts/mediatek/mt6358.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt6358.dtsi
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2020 MediaTek Inc.
*/
+#include <dt-bindings/input/input.h>
&pwrap {
pmic: mt6358 {
@@ -356,5 +357,16 @@ mt6358_vsim2_reg: ldo_vsim2 {
mt6358rtc: mt6358rtc {
compatible = "mediatek,mt6358-rtc";
};
+
+ mt6358keys: mt6358keys {
+ compatible = "mediatek,mt6358-keys";
+ power {
+ linux,keycodes = <KEY_POWER>;
+ wakeup-source;
+ };
+ home {
+ linux,keycodes = <KEY_HOME>;
+ };
+ };
};
};
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-04-28 19:52 ` Dmitry Torokhov
-1 siblings, 0 replies; 37+ messages in thread
From: Dmitry Torokhov @ 2021-04-28 19:52 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Mattijs,
On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
> mtk-pmic-keys being a child device of mt6397, it will always get probed
> when mt6397_probe() is called.
>
> This also happens when we have no device tree node matching
> mediatek,mt6397-keys.
It sounds for me that creating a platform device instance in case where
we know need OF node, but do not have one, is wasteful. Can
mt6397-core.c and/or MFD core be adjusted to not do that.
>
> In that case, the mfd core warns us:
>
> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>
> Check return value from call to of_match_device()
> in order to prevent a NULL pointer dereference.
>
> In case of NULL print error message and return -ENODEV
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> index 62391d6c7da6..12c449eed026 100644
> --- a/drivers/input/keyboard/mtk-pmic-keys.c
> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
> const struct of_device_id *of_id =
> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>
> + if (!of_id)
> + return -ENODEV;
> +
So if we make MFD/6396 core smarter we would not be needing this. I
guess there is still a possibility of someone stuffing "mtk-pmic-keys"
into "driver_override" attribute of a random platform device but I
wonder if we really need to take care of such scenarios...
> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
> if (!keys)
> return -ENOMEM;
> --
> 2.27.0
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-28 19:52 ` Dmitry Torokhov
0 siblings, 0 replies; 37+ messages in thread
From: Dmitry Torokhov @ 2021-04-28 19:52 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Mattijs,
On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
> mtk-pmic-keys being a child device of mt6397, it will always get probed
> when mt6397_probe() is called.
>
> This also happens when we have no device tree node matching
> mediatek,mt6397-keys.
It sounds for me that creating a platform device instance in case where
we know need OF node, but do not have one, is wasteful. Can
mt6397-core.c and/or MFD core be adjusted to not do that.
>
> In that case, the mfd core warns us:
>
> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>
> Check return value from call to of_match_device()
> in order to prevent a NULL pointer dereference.
>
> In case of NULL print error message and return -ENODEV
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> index 62391d6c7da6..12c449eed026 100644
> --- a/drivers/input/keyboard/mtk-pmic-keys.c
> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
> const struct of_device_id *of_id =
> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>
> + if (!of_id)
> + return -ENODEV;
> +
So if we make MFD/6396 core smarter we would not be needing this. I
guess there is still a possibility of someone stuffing "mtk-pmic-keys"
into "driver_override" attribute of a random platform device but I
wonder if we really need to take care of such scenarios...
> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
> if (!keys)
> return -ENOMEM;
> --
> 2.27.0
>
Thanks.
--
Dmitry
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-28 19:52 ` Dmitry Torokhov
0 siblings, 0 replies; 37+ messages in thread
From: Dmitry Torokhov @ 2021-04-28 19:52 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Mattijs,
On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
> mtk-pmic-keys being a child device of mt6397, it will always get probed
> when mt6397_probe() is called.
>
> This also happens when we have no device tree node matching
> mediatek,mt6397-keys.
It sounds for me that creating a platform device instance in case where
we know need OF node, but do not have one, is wasteful. Can
mt6397-core.c and/or MFD core be adjusted to not do that.
>
> In that case, the mfd core warns us:
>
> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>
> Check return value from call to of_match_device()
> in order to prevent a NULL pointer dereference.
>
> In case of NULL print error message and return -ENODEV
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> index 62391d6c7da6..12c449eed026 100644
> --- a/drivers/input/keyboard/mtk-pmic-keys.c
> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
> const struct of_device_id *of_id =
> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>
> + if (!of_id)
> + return -ENODEV;
> +
So if we make MFD/6396 core smarter we would not be needing this. I
guess there is still a possibility of someone stuffing "mtk-pmic-keys"
into "driver_override" attribute of a random platform device but I
wonder if we really need to take care of such scenarios...
> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
> if (!keys)
> return -ENOMEM;
> --
> 2.27.0
>
Thanks.
--
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
2021-04-28 19:52 ` Dmitry Torokhov
(?)
@ 2021-04-29 6:48 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 6:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Dmitry,
Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
> Hi Mattijs,
>
> On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
>> mtk-pmic-keys being a child device of mt6397, it will always get probed
>> when mt6397_probe() is called.
>>
>> This also happens when we have no device tree node matching
>> mediatek,mt6397-keys.
>
> It sounds for me that creating a platform device instance in case where
> we know need OF node, but do not have one, is wasteful. Can
> mt6397-core.c and/or MFD core be adjusted to not do that.
You are right. Maybe I can fix MFD core instead. I will look into it.
Thanks for your review.
>
>>
>> In that case, the mfd core warns us:
>>
>> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>>
>> Check return value from call to of_match_device()
>> in order to prevent a NULL pointer dereference.
>>
>> In case of NULL print error message and return -ENODEV
>>
>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>> ---
>> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>> index 62391d6c7da6..12c449eed026 100644
>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>> const struct of_device_id *of_id =
>> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>>
>> + if (!of_id)
>> + return -ENODEV;
>> +
>
> So if we make MFD/6396 core smarter we would not be needing this. I
> guess there is still a possibility of someone stuffing "mtk-pmic-keys"
> into "driver_override" attribute of a random platform device but I
> wonder if we really need to take care of such scenarios...
>
>> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
>> if (!keys)
>> return -ENOMEM;
>> --
>> 2.27.0
>>
>
> Thanks.
>
> --
> Dmitry
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-29 6:48 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 6:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Dmitry,
Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
> Hi Mattijs,
>
> On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
>> mtk-pmic-keys being a child device of mt6397, it will always get probed
>> when mt6397_probe() is called.
>>
>> This also happens when we have no device tree node matching
>> mediatek,mt6397-keys.
>
> It sounds for me that creating a platform device instance in case where
> we know need OF node, but do not have one, is wasteful. Can
> mt6397-core.c and/or MFD core be adjusted to not do that.
You are right. Maybe I can fix MFD core instead. I will look into it.
Thanks for your review.
>
>>
>> In that case, the mfd core warns us:
>>
>> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>>
>> Check return value from call to of_match_device()
>> in order to prevent a NULL pointer dereference.
>>
>> In case of NULL print error message and return -ENODEV
>>
>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>> ---
>> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>> index 62391d6c7da6..12c449eed026 100644
>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>> const struct of_device_id *of_id =
>> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>>
>> + if (!of_id)
>> + return -ENODEV;
>> +
>
> So if we make MFD/6396 core smarter we would not be needing this. I
> guess there is still a possibility of someone stuffing "mtk-pmic-keys"
> into "driver_override" attribute of a random platform device but I
> wonder if we really need to take care of such scenarios...
>
>> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
>> if (!keys)
>> return -ENOMEM;
>> --
>> 2.27.0
>>
>
> Thanks.
>
> --
> Dmitry
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-29 6:48 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 6:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Dmitry,
Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
> Hi Mattijs,
>
> On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
>> mtk-pmic-keys being a child device of mt6397, it will always get probed
>> when mt6397_probe() is called.
>>
>> This also happens when we have no device tree node matching
>> mediatek,mt6397-keys.
>
> It sounds for me that creating a platform device instance in case where
> we know need OF node, but do not have one, is wasteful. Can
> mt6397-core.c and/or MFD core be adjusted to not do that.
You are right. Maybe I can fix MFD core instead. I will look into it.
Thanks for your review.
>
>>
>> In that case, the mfd core warns us:
>>
>> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>>
>> Check return value from call to of_match_device()
>> in order to prevent a NULL pointer dereference.
>>
>> In case of NULL print error message and return -ENODEV
>>
>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>> ---
>> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>> index 62391d6c7da6..12c449eed026 100644
>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>> const struct of_device_id *of_id =
>> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>>
>> + if (!of_id)
>> + return -ENODEV;
>> +
>
> So if we make MFD/6396 core smarter we would not be needing this. I
> guess there is still a possibility of someone stuffing "mtk-pmic-keys"
> into "driver_override" attribute of a random platform device but I
> wonder if we really need to take care of such scenarios...
>
>> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
>> if (!keys)
>> return -ENOMEM;
>> --
>> 2.27.0
>>
>
> Thanks.
>
> --
> Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
2021-04-29 6:48 ` Mattijs Korpershoek
(?)
@ 2021-04-29 14:48 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 14:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Dmitry,
Mattijs Korpershoek <mkorpershoek@baylibre.com> writes:
> Hi Dmitry,
>
> Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
>
>> Hi Mattijs,
>>
>> On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
>>> mtk-pmic-keys being a child device of mt6397, it will always get probed
>>> when mt6397_probe() is called.
>>>
>>> This also happens when we have no device tree node matching
>>> mediatek,mt6397-keys.
>>
>> It sounds for me that creating a platform device instance in case where
>> we know need OF node, but do not have one, is wasteful. Can
>> mt6397-core.c and/or MFD core be adjusted to not do that.
>
> You are right. Maybe I can fix MFD core instead. I will look into it.
>
> Thanks for your review.
>>
>>>
>>> In that case, the mfd core warns us:
>>>
>>> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>>>
>>> Check return value from call to of_match_device()
>>> in order to prevent a NULL pointer dereference.
>>>
>>> In case of NULL print error message and return -ENODEV
>>>
>>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>>> ---
>>> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>>> index 62391d6c7da6..12c449eed026 100644
>>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>>> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>>> const struct of_device_id *of_id =
>>> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>>>
>>> + if (!of_id)
>>> + return -ENODEV;
>>> +
>>
>> So if we make MFD/6396 core smarter we would not be needing this. I
>> guess there is still a possibility of someone stuffing "mtk-pmic-keys"
>> into "driver_override" attribute of a random platform device but I
>> wonder if we really need to take care of such scenarios...
It turns out it was possible to make 6397-core smarter.
I've submitted [1] to replace this patch.
Thanks again for your suggestion. Please let me know if I should add
your Suggested-by: in [1].
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210429143811.2030717-1-mkorpershoek@baylibre.com/ instead
>>
>>> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
>>> if (!keys)
>>> return -ENOMEM;
>>> --
>>> 2.27.0
>>>
>>
>> Thanks.
>>
>> --
>> Dmitry
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-29 14:48 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 14:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Dmitry,
Mattijs Korpershoek <mkorpershoek@baylibre.com> writes:
> Hi Dmitry,
>
> Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
>
>> Hi Mattijs,
>>
>> On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
>>> mtk-pmic-keys being a child device of mt6397, it will always get probed
>>> when mt6397_probe() is called.
>>>
>>> This also happens when we have no device tree node matching
>>> mediatek,mt6397-keys.
>>
>> It sounds for me that creating a platform device instance in case where
>> we know need OF node, but do not have one, is wasteful. Can
>> mt6397-core.c and/or MFD core be adjusted to not do that.
>
> You are right. Maybe I can fix MFD core instead. I will look into it.
>
> Thanks for your review.
>>
>>>
>>> In that case, the mfd core warns us:
>>>
>>> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>>>
>>> Check return value from call to of_match_device()
>>> in order to prevent a NULL pointer dereference.
>>>
>>> In case of NULL print error message and return -ENODEV
>>>
>>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>>> ---
>>> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>>> index 62391d6c7da6..12c449eed026 100644
>>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>>> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>>> const struct of_device_id *of_id =
>>> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>>>
>>> + if (!of_id)
>>> + return -ENODEV;
>>> +
>>
>> So if we make MFD/6396 core smarter we would not be needing this. I
>> guess there is still a possibility of someone stuffing "mtk-pmic-keys"
>> into "driver_override" attribute of a random platform device but I
>> wonder if we really need to take care of such scenarios...
It turns out it was possible to make 6397-core smarter.
I've submitted [1] to replace this patch.
Thanks again for your suggestion. Please let me know if I should add
your Suggested-by: in [1].
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210429143811.2030717-1-mkorpershoek@baylibre.com/ instead
>>
>>> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
>>> if (!keys)
>>> return -ENOMEM;
>>> --
>>> 2.27.0
>>>
>>
>> Thanks.
>>
>> --
>> Dmitry
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device()
@ 2021-04-29 14:48 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 14:48 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, fparent, linux-input, linux-arm-kernel,
linux-mediatek, linux-kernel
Hi Dmitry,
Mattijs Korpershoek <mkorpershoek@baylibre.com> writes:
> Hi Dmitry,
>
> Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
>
>> Hi Mattijs,
>>
>> On Wed, Apr 28, 2021 at 06:42:13PM +0200, Mattijs Korpershoek wrote:
>>> mtk-pmic-keys being a child device of mt6397, it will always get probed
>>> when mt6397_probe() is called.
>>>
>>> This also happens when we have no device tree node matching
>>> mediatek,mt6397-keys.
>>
>> It sounds for me that creating a platform device instance in case where
>> we know need OF node, but do not have one, is wasteful. Can
>> mt6397-core.c and/or MFD core be adjusted to not do that.
>
> You are right. Maybe I can fix MFD core instead. I will look into it.
>
> Thanks for your review.
>>
>>>
>>> In that case, the mfd core warns us:
>>>
>>> [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1]
>>>
>>> Check return value from call to of_match_device()
>>> in order to prevent a NULL pointer dereference.
>>>
>>> In case of NULL print error message and return -ENODEV
>>>
>>> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>>> ---
>>> drivers/input/keyboard/mtk-pmic-keys.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
>>> index 62391d6c7da6..12c449eed026 100644
>>> --- a/drivers/input/keyboard/mtk-pmic-keys.c
>>> +++ b/drivers/input/keyboard/mtk-pmic-keys.c
>>> @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
>>> const struct of_device_id *of_id =
>>> of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
>>>
>>> + if (!of_id)
>>> + return -ENODEV;
>>> +
>>
>> So if we make MFD/6396 core smarter we would not be needing this. I
>> guess there is still a possibility of someone stuffing "mtk-pmic-keys"
>> into "driver_override" attribute of a random platform device but I
>> wonder if we really need to take care of such scenarios...
It turns out it was possible to make 6397-core smarter.
I've submitted [1] to replace this patch.
Thanks again for your suggestion. Please let me know if I should add
your Suggested-by: in [1].
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210429143811.2030717-1-mkorpershoek@baylibre.com/ instead
>>
>>> keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL);
>>> if (!keys)
>>> return -ENOMEM;
>>> --
>>> 2.27.0
>>>
>>
>> Thanks.
>>
>> --
>> Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 0/7] Input: mtk-pmic-keys - add support for MT6358
2021-04-28 16:42 ` Mattijs Korpershoek
@ 2021-04-29 14:57 ` Mattijs Korpershoek
-1 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 14:57 UTC (permalink / raw)
To: Matthias Brugger, Dmitry Torokhov, Lee Jones
Cc: fparent, linux-arm-kernel, linux-mediatek
Hi Matthias, Dmitry, Lee,
Mattijs Korpershoek <mkorpershoek@baylibre.com> writes:
Please ignore this series for now
> The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.
>
> The interrupt logic is a little different than other PMICs from the
> same family:
> * for MT6323 and MT6397, we have one interrupt source per button
> * for MT6358, we have two interrupts lines per button: the press and
> * release interrupts are distinct sources.
>
> These series:
> * Fix a NULL ptr error when we use mtk-pmic-keys without dts code
I've submitted this as a separate bugfix [1] to ease the review.
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210429143811.2030717-1-mkorpershoek@baylibre.com/
> * Rework the mt6397 driver to prepare for this different interrupt logic
> * Add support for the MT6358 power buttons
>
> This has been functionally tested (using evtest) on
> the mt8183-pumpkin board on linux/master
>
> It has also been used for a couple of months in a downstream
> tree based on v5.4.
>
> Mattijs Korpershoek (7):
> Input: mtk-pmic-keys - check for NULL on of_match_device()
> mfd: mt6397: add mt6358 register definitions for power key
> mfd: mt6397: keys: use named IRQs instead of index
> dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
> Input: mtk-pmic-keys - add support for MT6358
I'll send a v2 for these
> mfd: mt6397: Add PMIC keys for MT6358
> arm64: dts: mt6358: add mt6358-keys node
>
> .../bindings/input/mtk-pmic-keys.txt | 5 +-
> arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++
> drivers/input/keyboard/mtk-pmic-keys.c | 59 +++++++++++++++++--
> drivers/mfd/mt6397-core.c | 20 +++++--
> include/linux/mfd/mt6358/registers.h | 2 +
> 5 files changed, 89 insertions(+), 9 deletions(-)
>
>
> base-commit: 4a0225c3d208cfa6e4550f2210ffd9114a952a81
> --
> 2.27.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 0/7] Input: mtk-pmic-keys - add support for MT6358
@ 2021-04-29 14:57 ` Mattijs Korpershoek
0 siblings, 0 replies; 37+ messages in thread
From: Mattijs Korpershoek @ 2021-04-29 14:57 UTC (permalink / raw)
To: Matthias Brugger, Dmitry Torokhov, Lee Jones
Cc: fparent, linux-arm-kernel, linux-mediatek
Hi Matthias, Dmitry, Lee,
Mattijs Korpershoek <mkorpershoek@baylibre.com> writes:
Please ignore this series for now
> The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.
>
> The interrupt logic is a little different than other PMICs from the
> same family:
> * for MT6323 and MT6397, we have one interrupt source per button
> * for MT6358, we have two interrupts lines per button: the press and
> * release interrupts are distinct sources.
>
> These series:
> * Fix a NULL ptr error when we use mtk-pmic-keys without dts code
I've submitted this as a separate bugfix [1] to ease the review.
[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210429143811.2030717-1-mkorpershoek@baylibre.com/
> * Rework the mt6397 driver to prepare for this different interrupt logic
> * Add support for the MT6358 power buttons
>
> This has been functionally tested (using evtest) on
> the mt8183-pumpkin board on linux/master
>
> It has also been used for a couple of months in a downstream
> tree based on v5.4.
>
> Mattijs Korpershoek (7):
> Input: mtk-pmic-keys - check for NULL on of_match_device()
> mfd: mt6397: add mt6358 register definitions for power key
> mfd: mt6397: keys: use named IRQs instead of index
> dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
> Input: mtk-pmic-keys - add support for MT6358
I'll send a v2 for these
> mfd: mt6397: Add PMIC keys for MT6358
> arm64: dts: mt6358: add mt6358-keys node
>
> .../bindings/input/mtk-pmic-keys.txt | 5 +-
> arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++
> drivers/input/keyboard/mtk-pmic-keys.c | 59 +++++++++++++++++--
> drivers/mfd/mt6397-core.c | 20 +++++--
> include/linux/mfd/mt6358/registers.h | 2 +
> 5 files changed, 89 insertions(+), 9 deletions(-)
>
>
> base-commit: 4a0225c3d208cfa6e4550f2210ffd9114a952a81
> --
> 2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
2021-04-28 16:42 ` Mattijs Korpershoek
(?)
@ 2021-05-03 19:28 ` Rob Herring
-1 siblings, 0 replies; 37+ messages in thread
From: Rob Herring @ 2021-05-03 19:28 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: fparent, devicetree, Rob Herring, linux-kernel, linux-mediatek,
linux-input, Matthias Brugger, linux-arm-kernel, Dmitry Torokhov
On Wed, 28 Apr 2021 18:42:16 +0200, Mattijs Korpershoek wrote:
> Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.
>
> MT6358 is a little different since it used separate IRQs for the
> release key (_r) event
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
@ 2021-05-03 19:28 ` Rob Herring
0 siblings, 0 replies; 37+ messages in thread
From: Rob Herring @ 2021-05-03 19:28 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: fparent, devicetree, Rob Herring, linux-kernel, linux-mediatek,
linux-input, Matthias Brugger, linux-arm-kernel, Dmitry Torokhov
On Wed, 28 Apr 2021 18:42:16 +0200, Mattijs Korpershoek wrote:
> Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.
>
> MT6358 is a little different since it used separate IRQs for the
> release key (_r) event
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring <robh@kernel.org>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition
@ 2021-05-03 19:28 ` Rob Herring
0 siblings, 0 replies; 37+ messages in thread
From: Rob Herring @ 2021-05-03 19:28 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: fparent, devicetree, Rob Herring, linux-kernel, linux-mediatek,
linux-input, Matthias Brugger, linux-arm-kernel, Dmitry Torokhov
On Wed, 28 Apr 2021 18:42:16 +0200, Mattijs Korpershoek wrote:
> Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs.
>
> MT6358 is a little different since it used separate IRQs for the
> release key (_r) event
>
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring <robh@kernel.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2021-05-03 19:31 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 16:42 [PATCH 0/7] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device() Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 19:52 ` Dmitry Torokhov
2021-04-28 19:52 ` Dmitry Torokhov
2021-04-28 19:52 ` Dmitry Torokhov
2021-04-29 6:48 ` Mattijs Korpershoek
2021-04-29 6:48 ` Mattijs Korpershoek
2021-04-29 6:48 ` Mattijs Korpershoek
2021-04-29 14:48 ` Mattijs Korpershoek
2021-04-29 14:48 ` Mattijs Korpershoek
2021-04-29 14:48 ` Mattijs Korpershoek
2021-04-28 16:42 ` [PATCH 2/7] mfd: mt6397: add mt6358 register definitions for power key Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` [PATCH 3/7] mfd: mt6397: keys: use named IRQs instead of index Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-05-03 19:28 ` Rob Herring
2021-05-03 19:28 ` Rob Herring
2021-05-03 19:28 ` Rob Herring
2021-04-28 16:42 ` [PATCH 5/7] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` [PATCH 6/7] mfd: mt6397: Add PMIC keys " Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` [PATCH 7/7] arm64: dts: mt6358: add mt6358-keys node Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-28 16:42 ` Mattijs Korpershoek
2021-04-29 14:57 ` [PATCH 0/7] Input: mtk-pmic-keys - add support for MT6358 Mattijs Korpershoek
2021-04-29 14:57 ` Mattijs Korpershoek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.