Lines Matching +full:imx8qxp +full:- +full:sc +full:- +full:rtc

1 // SPDX-License-Identifier: GPL-2.0+
6 #include <dt-bindings/firmware/imx/rsrc.h>
7 #include <linux/arm-smccc.h>
12 #include <linux/rtc.h>
48 hdr->ver = IMX_SC_RPC_VERSION; in imx_sc_rtc_read_time()
49 hdr->svc = IMX_SC_RPC_SVC_TIMER; in imx_sc_rtc_read_time()
50 hdr->func = IMX_SC_TIMER_FUNC_GET_RTC_SEC1970; in imx_sc_rtc_read_time()
51 hdr->size = 1; in imx_sc_rtc_read_time()
55 dev_err(dev, "read rtc time failed, ret %d\n", ret); in imx_sc_rtc_read_time()
70 ((tm->tm_year + 1900) << 16) | (tm->tm_mon + 1), in imx_sc_rtc_set_time()
71 (tm->tm_mday << 16) | tm->tm_hour, in imx_sc_rtc_set_time()
72 (tm->tm_min << 16) | tm->tm_sec, in imx_sc_rtc_set_time()
88 struct rtc_time *alrm_tm = &alrm->time; in imx_sc_rtc_set_alarm()
90 hdr->ver = IMX_SC_RPC_VERSION; in imx_sc_rtc_set_alarm()
91 hdr->svc = IMX_SC_RPC_SVC_TIMER; in imx_sc_rtc_set_alarm()
92 hdr->func = IMX_SC_TIMER_FUNC_SET_RTC_ALARM; in imx_sc_rtc_set_alarm()
93 hdr->size = 3; in imx_sc_rtc_set_alarm()
95 msg.year = alrm_tm->tm_year + 1900; in imx_sc_rtc_set_alarm()
96 msg.mon = alrm_tm->tm_mon + 1; in imx_sc_rtc_set_alarm()
97 msg.day = alrm_tm->tm_mday; in imx_sc_rtc_set_alarm()
98 msg.hour = alrm_tm->tm_hour; in imx_sc_rtc_set_alarm()
99 msg.min = alrm_tm->tm_min; in imx_sc_rtc_set_alarm()
100 msg.sec = alrm_tm->tm_sec; in imx_sc_rtc_set_alarm()
104 dev_err(dev, "set rtc alarm failed, ret %d\n", ret); in imx_sc_rtc_set_alarm()
108 ret = imx_sc_rtc_alarm_irq_enable(dev, alrm->enabled); in imx_sc_rtc_set_alarm()
110 dev_err(dev, "enable rtc alarm failed, ret %d\n", ret); in imx_sc_rtc_set_alarm()
127 /* ignore non-rtc irq */ in imx_sc_rtc_alarm_notify()
148 device_init_wakeup(&pdev->dev, true); in imx_sc_rtc_probe()
150 imx_sc_rtc = devm_rtc_allocate_device(&pdev->dev); in imx_sc_rtc_probe()
154 imx_sc_rtc->ops = &imx_sc_rtc_ops; in imx_sc_rtc_probe()
155 imx_sc_rtc->range_min = 0; in imx_sc_rtc_probe()
156 imx_sc_rtc->range_max = U32_MAX; in imx_sc_rtc_probe()
168 { .compatible = "fsl,imx8qxp-sc-rtc", },
175 .name = "imx-sc-rtc",
183 MODULE_DESCRIPTION("NXP i.MX System Controller RTC Driver");