Commit 929a3270 authored by Peng Ma's avatar Peng Ma Committed by Alexandre Belloni

rtc: fsl-ftm-alarm: enable acpi support

This patch enables ACPI support in Rtc Flex timer driver.
Signed-off-by: default avatarPeng Ma <peng.ma@nxp.com>
Link: https://lore.kernel.org/r/20200318025354.6447-1-peng.ma@nxp.com
Link: https://lore.kernel.org/r/20200323072956.38263-1-peng.ma@nxp.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent fdc9f0ea
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/fsl/ftm.h> #include <linux/fsl/ftm.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/acpi.h>
#define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_MASK_SHIFT) #define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_MASK_SHIFT)
...@@ -242,7 +243,6 @@ static const struct rtc_class_ops ftm_rtc_ops = { ...@@ -242,7 +243,6 @@ static const struct rtc_class_ops ftm_rtc_ops = {
static int ftm_rtc_probe(struct platform_device *pdev) static int ftm_rtc_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node;
int irq; int irq;
int ret; int ret;
struct ftm_rtc *rtc; struct ftm_rtc *rtc;
...@@ -265,10 +265,10 @@ static int ftm_rtc_probe(struct platform_device *pdev) ...@@ -265,10 +265,10 @@ static int ftm_rtc_probe(struct platform_device *pdev)
return PTR_ERR(rtc->base); return PTR_ERR(rtc->base);
} }
irq = irq_of_parse_and_map(np, 0); irq = platform_get_irq(pdev, 0);
if (irq <= 0) { if (irq < 0) {
dev_err(&pdev->dev, "unable to get IRQ from DT, %d\n", irq); dev_err(&pdev->dev, "can't get irq number\n");
return -EINVAL; return irq;
} }
ret = devm_request_irq(&pdev->dev, irq, ftm_rtc_alarm_interrupt, ret = devm_request_irq(&pdev->dev, irq, ftm_rtc_alarm_interrupt,
...@@ -278,7 +278,9 @@ static int ftm_rtc_probe(struct platform_device *pdev) ...@@ -278,7 +278,9 @@ static int ftm_rtc_probe(struct platform_device *pdev)
return ret; return ret;
} }
rtc->big_endian = of_property_read_bool(np, "big-endian"); rtc->big_endian =
device_property_read_bool(&pdev->dev, "big-endian");
rtc->alarm_freq = (u32)FIXED_FREQ_CLK / (u32)MAX_FREQ_DIV; rtc->alarm_freq = (u32)FIXED_FREQ_CLK / (u32)MAX_FREQ_DIV;
rtc->rtc_dev->ops = &ftm_rtc_ops; rtc->rtc_dev->ops = &ftm_rtc_ops;
...@@ -305,11 +307,18 @@ static const struct of_device_id ftm_rtc_match[] = { ...@@ -305,11 +307,18 @@ static const struct of_device_id ftm_rtc_match[] = {
{ }, { },
}; };
static const struct acpi_device_id ftm_imx_acpi_ids[] = {
{"NXP0011",},
{ }
};
MODULE_DEVICE_TABLE(acpi, ftm_imx_acpi_ids);
static struct platform_driver ftm_rtc_driver = { static struct platform_driver ftm_rtc_driver = {
.probe = ftm_rtc_probe, .probe = ftm_rtc_probe,
.driver = { .driver = {
.name = "ftm-alarm", .name = "ftm-alarm",
.of_match_table = ftm_rtc_match, .of_match_table = ftm_rtc_match,
.acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids),
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment