Thread (12 messages) 12 messages, 5 authors, 2023-03-14

RE: [PATCH v5 2/3] rtc: bbnsm: Add the bbnsm rtc support

From: Jacky Bai <ping.bai@nxp.com>
Date: 2023-02-22 07:10:15
Also in: linux-devicetree, linux-input, linux-rtc

Hi Alexandre,
Subject: Re: [PATCH v5 2/3] rtc: bbnsm: Add the bbnsm rtc support

On 21/02/2023 19:01:16+0100, Alexandre Belloni wrote:
quoted
On 15/02/2023 10:41:16+0800, Jacky Bai wrote:
quoted
The BBNSM module includes a real time counter with alarm.
Add a RTC driver for this function.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Actually, as there is no dependency anymore, I'm going to apply that directly.
Do I need to resend or you will directly apply this V5 patch?

BR
quoted
quoted
+static int bbnsm_rtc_probe(struct platform_device *pdev) {
+	struct device_node *np = pdev->dev.of_node;
+	struct bbnsm_rtc *bbnsm;
+	int ret;
+
+	bbnsm = devm_kzalloc(&pdev->dev, sizeof(*bbnsm), GFP_KERNEL);
+	if (!bbnsm)
+		return -ENOMEM;
+
+	bbnsm->rtc = devm_rtc_allocate_device(&pdev->dev);
+	if (IS_ERR(bbnsm->rtc))
+		return PTR_ERR(bbnsm->rtc);
+
+	bbnsm->regmap = syscon_node_to_regmap(np->parent);
+	if (IS_ERR(bbnsm->regmap)) {
+		dev_dbg(&pdev->dev, "bbnsm get regmap failed\n");
+		return PTR_ERR(bbnsm->regmap);
+	}
+
+	bbnsm->irq = platform_get_irq(pdev, 0);
+	if (bbnsm->irq < 0)
+		return bbnsm->irq;
+
+	platform_set_drvdata(pdev, bbnsm);
+
+	/* clear all the pending events */
+	regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A);
+
+	device_init_wakeup(&pdev->dev, true);
+	dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+
+	ret = devm_request_irq(&pdev->dev, bbnsm->irq,
bbnsm_rtc_irq_handler,
quoted
quoted
+			IRQF_SHARED, "rtc alarm", &pdev->dev);
This is not properly aligned, you can fix that if you ever have to
resend.
quoted

--
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help