Re: [PATCH] rtc: max8997: Add driver for max8997 rtc.

From: jonghwa3 . lee
Date: Wed Feb 06 2013 - 23:23:14 EST


On 2013ë 02ì 07ì 13:14, devendra.aaru wrote:
> Hello,
>
> On Wed, Feb 6, 2013 at 4:53 PM, Jonghwa Lee <jonghwa3.lee@xxxxxxxxxxx> wrote:
>> This patch adds rtc driver for Maxim 8997 multifunction chip.
>> Max8997 has rtc module in it. and it can be used for timekeeping
>> clock and system alarm. It provide various operational mode those are
>> BCD/binary, 24/12hour, am/pm. Driver sets binary/24/ for default.
>> Maxim 8997 also supports SMPL(Sudden Momentary Power Loss), WTSR
>> (Watchdog Timeout and Software Reset).
>>
>> Signed-off-by: Jonghwa Lee <jonghwa3.lee@xxxxxxxxxxx>
>> ---
>> drivers/rtc/Kconfig | 30 +++
>> drivers/rtc/Makefile | 1 +
>> drivers/rtc/rtc-max8997.c | 542 +++++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 573 insertions(+)
>> create mode 100644 drivers/rtc/rtc-max8997.c
>>
>> +
>> +static int max8997_rtc_probe(struct platform_device *pdev)
>> +{
>> + struct max8997_dev *max8997 = dev_get_drvdata(pdev->dev.parent);
>> + struct max8997_rtc_info *info;
>> + int ret, virq;
>> +
>> + info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_rtc_info),
>> + GFP_KERNEL);
>> + if (!info)
>> + return -ENOMEM;
>> +
>> + mutex_init(&info->lock);
>> + info->dev = &pdev->dev;
>> + info->max8997 = max8997;
>> + info->rtc = max8997->rtc;
>> +
>> + platform_set_drvdata(pdev, info);
>> +
>> + ret = max8997_rtc_init_reg(info);
>> +
>> + if (ret < 0) {
>> + dev_err(&pdev->dev, "Failed to initialize RTC reg:%d\n", ret);
>> + return ret;
>> + }
>> +
>> + max8997_rtc_enable_wtsr(info, true);
>> + max8997_rtc_enable_smpl(info, true);
>> +
>> + device_init_wakeup(&pdev->dev, 1);
>> +
>> + info->rtc_dev = rtc_device_register("max8997-rtc", &pdev->dev,
>> + &max8997_rtc_ops, THIS_MODULE);
>> +
>> + if (IS_ERR(info->rtc_dev)) {
>> + ret = PTR_ERR(info->rtc_dev);
>> + dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
>> + return ret;
>> + }
>> +
>> + virq = irq_create_mapping(max8997->irq_domain, MAX8997_PMICIRQ_RTCA1);
>> + if (!virq) {
>> + dev_err(&pdev->dev, "Failed to create mapping alarm IRQ\n");
> + rtc_device_unregister(&pdev->dev, &max8997_rtc_ops) ?

Yes, It should be,,

>> + return ret;
>> + }
>> + info->virq = virq;
>> +
>> + ret = request_threaded_irq(virq, NULL, max8997_rtc_alarm_irq, 0,
>> + "rtc-alarm0", info);
>> + if (ret < 0) {
>> + dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
>> + info->virq, ret);
> + here unregistering the rtc dev too?

also

>> + return ret;
>> + }
>> +
>> + return ret;
>> +}
>> +
>

Thanks for reviewing, I'll fix it.

Thanks,
Jonghwa

>
> Thanks,
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/