--- v1
+++ v6
@@ -1,54 +1,56 @@
-This patch adds the device tree binding documentation for the MediaTek
-pmic keys found on PMIC MT6397/MT6323.
+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 <lee.jones@linaro.org>
+Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Chen Zhong <chen.zhong@mediatek.com>
---
- .../devicetree/bindings/input/mtk-pmic-keys.txt | 36 ++++++++++++++++++++
- 1 file changed, 36 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
+ drivers/mfd/mt6397-core.c | 4 ++--
+ drivers/rtc/rtc-mt6397.c | 7 +++----
+ 2 files changed, 5 insertions(+), 6 deletions(-)
-diff --git a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
-new file mode 100644
-index 0000000..c5b230f
---- /dev/null
-+++ b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt
-@@ -0,0 +1,36 @@
-+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"
-+- mediatek,pwrkey-code: Keycode of pwrkey
-+
-+Optional Properties:
-+- mediatek,homekey-code: Keycode of homekey
-+- mediatek,long-press-mode: Long press key shutdown setting, 1 for
-+ pwrkey only, 2 for pwrkey/homekey together, others for disabled.
-+- mediatek,long-press-duration: Long press key shutdown duration setting,
-+ 0/1/2/3 for 8/11/14/5 seconds.
-+
-+Example:
-+
-+ pmic: mt6397 {
-+ compatible = "mediatek,mt6397";
-+
-+ ...
-+
-+ mt6397keys: mt6397keys {
-+ compatible = "mediatek,mt6397-keys";
-+ mediatek,pwrkey-code = <116>;
-+ mediatek,homekey-code = <114>;
-+ mediatek,long-press-mode = <1>;
-+ mediatek,long-press-duration = <0>;
-+ };
-+ };
-\ No newline at end of file
+diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
+index 04a601f..6546d7f 100644
+--- a/drivers/mfd/mt6397-core.c
++++ b/drivers/mfd/mt6397-core.c
+@@ -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:
+diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
+index 1a61fa5..385f830 100644
+--- a/drivers/rtc/rtc-mt6397.c
++++ b/drivers/rtc/rtc-mt6397.c
+@@ -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;
--
1.7.9.5