aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/rtc/rtc-max8998.c
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-06-24 14:39:52 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-30 23:29:44 +0200
commit443c6ae253e96db9a5800a28d7c61131e81c2dee (patch)
treec9df532a7f81a8799fe52f6845504b275803e58e /drivers/rtc/rtc-max8998.c
parentregulator: palmas: Add TPS659038 support (diff)
downloadwireguard-linux-443c6ae253e96db9a5800a28d7c61131e81c2dee.tar.xz
wireguard-linux-443c6ae253e96db9a5800a28d7c61131e81c2dee.zip
mfd: max8998: Add irq domain support
This patch adds irq domain support for max8998 interrupts. To keep both non-DT and DT worlds happy, simple domain is used, which is linear when no explicit IRQ base is specified and legacy, with static mapping, otherwise. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/rtc/rtc-max8998.c')
-rw-r--r--drivers/rtc/rtc-max8998.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c
index d5af7baa48b5..46f23014759b 100644
--- a/drivers/rtc/rtc-max8998.c
+++ b/drivers/rtc/rtc-max8998.c
@@ -16,6 +16,7 @@
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/bcd.h>
+#include <linux/irqdomain.h>
#include <linux/rtc.h>
#include <linux/platform_device.h>
#include <linux/mfd/max8998.h>
@@ -264,7 +265,6 @@ static int max8998_rtc_probe(struct platform_device *pdev)
info->dev = &pdev->dev;
info->max8998 = max8998;
info->rtc = max8998->rtc;
- info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0;
platform_set_drvdata(pdev, info);
@@ -277,6 +277,15 @@ static int max8998_rtc_probe(struct platform_device *pdev)
goto out_rtc;
}
+ if (!max8998->irq_domain)
+ goto no_irq;
+
+ info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0);
+ if (!info->irq) {
+ dev_warn(&pdev->dev, "Failed to map alarm IRQ\n");
+ goto no_irq;
+ }
+
ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
max8998_rtc_alarm_irq, 0, "rtc-alarm0", info);
@@ -284,6 +293,7 @@ static int max8998_rtc_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
info->irq, ret);
+no_irq:
dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name);
if (pdata && pdata->rtc_delay) {
info->lp3974_bug_workaround = true;