[PATCH v5 2/3] rtc: bbnsm: Add the bbnsm rtc support
Alexandre Belloni
alexandre.belloni at bootlin.com
Tue Feb 21 10:04:51 PST 2023
On 21/02/2023 19:01:16+0100, Alexandre Belloni wrote:
> On 15/02/2023 10:41:16+0800, Jacky Bai wrote:
> > The BBNSM module includes a real time counter with alarm.
> > Add a RTC driver for this function.
> >
> > Signed-off-by: Jacky Bai <ping.bai at nxp.com>
> > Reviewed-by: Peng Fan <peng.fan at nxp.com>
> Acked-by: Alexandre Belloni <alexandre.belloni at bootlin.com>
>
Actually, as there is no dependency anymore, I'm going to apply that
directly.
> > +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,
> > + IRQF_SHARED, "rtc alarm", &pdev->dev);
>
> This is not properly aligned, you can fix that if you ever have to
> resend.
>
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the linux-arm-kernel
mailing list