aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-06-24 08:39:52 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-30 17:29:44 -0400
commit443c6ae253e96db9a5800a28d7c61131e81c2dee (patch)
treec9df532a7f81a8799fe52f6845504b275803e58e /drivers/rtc
parentb5c46787df1f28b0a24499e275491ba9a505c8ec (diff)
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')
-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 @@
16#include <linux/i2c.h> 16#include <linux/i2c.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/bcd.h> 18#include <linux/bcd.h>
19#include <linux/irqdomain.h>
19#include <linux/rtc.h> 20#include <linux/rtc.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/mfd/max8998.h> 22#include <linux/mfd/max8998.h>
@@ -264,7 +265,6 @@ static int max8998_rtc_probe(struct platform_device *pdev)
264 info->dev = &pdev->dev; 265 info->dev = &pdev->dev;
265 info->max8998 = max8998; 266 info->max8998 = max8998;
266 info->rtc = max8998->rtc; 267 info->rtc = max8998->rtc;
267 info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0;
268 268
269 platform_set_drvdata(pdev, info); 269 platform_set_drvdata(pdev, info);
270 270
@@ -277,6 +277,15 @@ static int max8998_rtc_probe(struct platform_device *pdev)
277 goto out_rtc; 277 goto out_rtc;
278 } 278 }
279 279
280 if (!max8998->irq_domain)
281 goto no_irq;
282
283 info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0);
284 if (!info->irq) {
285 dev_warn(&pdev->dev, "Failed to map alarm IRQ\n");
286 goto no_irq;
287 }
288
280 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, 289 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
281 max8998_rtc_alarm_irq, 0, "rtc-alarm0", info); 290 max8998_rtc_alarm_irq, 0, "rtc-alarm0", info);
282 291
@@ -284,6 +293,7 @@ static int max8998_rtc_probe(struct platform_device *pdev)
284 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", 293 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
285 info->irq, ret); 294 info->irq, ret);
286 295
296no_irq:
287 dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); 297 dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name);
288 if (pdata && pdata->rtc_delay) { 298 if (pdata && pdata->rtc_delay) {
289 info->lp3974_bug_workaround = true; 299 info->lp3974_bug_workaround = true;