xref: /openbmc/linux/drivers/rtc/rtc-max8998.c (revision 443c6ae2)
19b16c0a4SJoonyoung Shim /*
29b16c0a4SJoonyoung Shim  * RTC driver for Maxim MAX8998
39b16c0a4SJoonyoung Shim  *
49b16c0a4SJoonyoung Shim  * Copyright (C) 2010 Samsung Electronics Co.Ltd
59b16c0a4SJoonyoung Shim  * Author: Minkyu Kang <mk7.kang@samsung.com>
69b16c0a4SJoonyoung Shim  * Author: Joonyoung Shim <jy0922.shim@samsung.com>
79b16c0a4SJoonyoung Shim  *
89b16c0a4SJoonyoung Shim  *  This program is free software; you can redistribute  it and/or modify it
99b16c0a4SJoonyoung Shim  *  under  the terms of  the GNU General  Public License as published by the
109b16c0a4SJoonyoung Shim  *  Free Software Foundation;  either version 2 of the  License, or (at your
119b16c0a4SJoonyoung Shim  *  option) any later version.
129b16c0a4SJoonyoung Shim  *
139b16c0a4SJoonyoung Shim  */
149b16c0a4SJoonyoung Shim 
159b16c0a4SJoonyoung Shim #include <linux/module.h>
169b16c0a4SJoonyoung Shim #include <linux/i2c.h>
179b16c0a4SJoonyoung Shim #include <linux/slab.h>
189b16c0a4SJoonyoung Shim #include <linux/bcd.h>
19443c6ae2STomasz Figa #include <linux/irqdomain.h>
209b16c0a4SJoonyoung Shim #include <linux/rtc.h>
219b16c0a4SJoonyoung Shim #include <linux/platform_device.h>
229b16c0a4SJoonyoung Shim #include <linux/mfd/max8998.h>
239b16c0a4SJoonyoung Shim #include <linux/mfd/max8998-private.h>
24337ce5d1SMyungJoo Ham #include <linux/delay.h>
259b16c0a4SJoonyoung Shim 
269b16c0a4SJoonyoung Shim #define MAX8998_RTC_SEC			0x00
279b16c0a4SJoonyoung Shim #define MAX8998_RTC_MIN			0x01
289b16c0a4SJoonyoung Shim #define MAX8998_RTC_HOUR		0x02
299b16c0a4SJoonyoung Shim #define MAX8998_RTC_WEEKDAY		0x03
309b16c0a4SJoonyoung Shim #define MAX8998_RTC_DATE		0x04
319b16c0a4SJoonyoung Shim #define MAX8998_RTC_MONTH		0x05
329b16c0a4SJoonyoung Shim #define MAX8998_RTC_YEAR1		0x06
339b16c0a4SJoonyoung Shim #define MAX8998_RTC_YEAR2		0x07
349b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_SEC		0x08
359b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_MIN		0x09
369b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_HOUR		0x0a
379b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_WEEKDAY		0x0b
389b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_DATE		0x0c
399b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_MONTH		0x0d
409b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_YEAR1		0x0e
419b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_YEAR2		0x0f
429b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_SEC		0x10
439b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_MIN		0x11
449b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_HOUR		0x12
459b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_WEEKDAY		0x13
469b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_DATE		0x14
479b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_MONTH		0x15
489b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_YEAR1		0x16
499b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_YEAR2		0x17
509b16c0a4SJoonyoung Shim #define MAX8998_ALARM0_CONF		0x18
519b16c0a4SJoonyoung Shim #define MAX8998_ALARM1_CONF		0x19
529b16c0a4SJoonyoung Shim #define MAX8998_RTC_STATUS		0x1a
539b16c0a4SJoonyoung Shim #define MAX8998_WTSR_SMPL_CNTL		0x1b
549b16c0a4SJoonyoung Shim #define MAX8998_TEST			0x1f
559b16c0a4SJoonyoung Shim 
569b16c0a4SJoonyoung Shim #define HOUR_12				(1 << 7)
579b16c0a4SJoonyoung Shim #define HOUR_PM				(1 << 5)
589b16c0a4SJoonyoung Shim #define ALARM0_STATUS			(1 << 1)
599b16c0a4SJoonyoung Shim #define ALARM1_STATUS			(1 << 2)
609b16c0a4SJoonyoung Shim 
619b16c0a4SJoonyoung Shim enum {
629b16c0a4SJoonyoung Shim 	RTC_SEC = 0,
639b16c0a4SJoonyoung Shim 	RTC_MIN,
649b16c0a4SJoonyoung Shim 	RTC_HOUR,
659b16c0a4SJoonyoung Shim 	RTC_WEEKDAY,
669b16c0a4SJoonyoung Shim 	RTC_DATE,
679b16c0a4SJoonyoung Shim 	RTC_MONTH,
689b16c0a4SJoonyoung Shim 	RTC_YEAR1,
699b16c0a4SJoonyoung Shim 	RTC_YEAR2,
709b16c0a4SJoonyoung Shim };
719b16c0a4SJoonyoung Shim 
729b16c0a4SJoonyoung Shim struct max8998_rtc_info {
739b16c0a4SJoonyoung Shim 	struct device		*dev;
749b16c0a4SJoonyoung Shim 	struct max8998_dev	*max8998;
759b16c0a4SJoonyoung Shim 	struct i2c_client	*rtc;
769b16c0a4SJoonyoung Shim 	struct rtc_device	*rtc_dev;
779b16c0a4SJoonyoung Shim 	int irq;
78337ce5d1SMyungJoo Ham 	bool lp3974_bug_workaround;
799b16c0a4SJoonyoung Shim };
809b16c0a4SJoonyoung Shim 
819b16c0a4SJoonyoung Shim static void max8998_data_to_tm(u8 *data, struct rtc_time *tm)
829b16c0a4SJoonyoung Shim {
839b16c0a4SJoonyoung Shim 	tm->tm_sec = bcd2bin(data[RTC_SEC]);
849b16c0a4SJoonyoung Shim 	tm->tm_min = bcd2bin(data[RTC_MIN]);
859b16c0a4SJoonyoung Shim 	if (data[RTC_HOUR] & HOUR_12) {
869b16c0a4SJoonyoung Shim 		tm->tm_hour = bcd2bin(data[RTC_HOUR] & 0x1f);
879b16c0a4SJoonyoung Shim 		if (data[RTC_HOUR] & HOUR_PM)
889b16c0a4SJoonyoung Shim 			tm->tm_hour += 12;
899b16c0a4SJoonyoung Shim 	} else
909b16c0a4SJoonyoung Shim 		tm->tm_hour = bcd2bin(data[RTC_HOUR] & 0x3f);
919b16c0a4SJoonyoung Shim 
929b16c0a4SJoonyoung Shim 	tm->tm_wday = data[RTC_WEEKDAY] & 0x07;
939b16c0a4SJoonyoung Shim 	tm->tm_mday = bcd2bin(data[RTC_DATE]);
949b16c0a4SJoonyoung Shim 	tm->tm_mon = bcd2bin(data[RTC_MONTH]);
959b16c0a4SJoonyoung Shim 	tm->tm_year = bcd2bin(data[RTC_YEAR1]) + bcd2bin(data[RTC_YEAR2]) * 100;
969b16c0a4SJoonyoung Shim 	tm->tm_year -= 1900;
979b16c0a4SJoonyoung Shim }
989b16c0a4SJoonyoung Shim 
999b16c0a4SJoonyoung Shim static void max8998_tm_to_data(struct rtc_time *tm, u8 *data)
1009b16c0a4SJoonyoung Shim {
1019b16c0a4SJoonyoung Shim 	data[RTC_SEC] = bin2bcd(tm->tm_sec);
1029b16c0a4SJoonyoung Shim 	data[RTC_MIN] = bin2bcd(tm->tm_min);
1039b16c0a4SJoonyoung Shim 	data[RTC_HOUR] = bin2bcd(tm->tm_hour);
1049b16c0a4SJoonyoung Shim 	data[RTC_WEEKDAY] = tm->tm_wday;
1059b16c0a4SJoonyoung Shim 	data[RTC_DATE] = bin2bcd(tm->tm_mday);
1069b16c0a4SJoonyoung Shim 	data[RTC_MONTH] = bin2bcd(tm->tm_mon);
1079b16c0a4SJoonyoung Shim 	data[RTC_YEAR1] = bin2bcd(tm->tm_year % 100);
1089b16c0a4SJoonyoung Shim 	data[RTC_YEAR2] = bin2bcd((tm->tm_year + 1900) / 100);
1099b16c0a4SJoonyoung Shim }
1109b16c0a4SJoonyoung Shim 
1119b16c0a4SJoonyoung Shim static int max8998_rtc_read_time(struct device *dev, struct rtc_time *tm)
1129b16c0a4SJoonyoung Shim {
1139b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info = dev_get_drvdata(dev);
1149b16c0a4SJoonyoung Shim 	u8 data[8];
1159b16c0a4SJoonyoung Shim 	int ret;
1169b16c0a4SJoonyoung Shim 
1179b16c0a4SJoonyoung Shim 	ret = max8998_bulk_read(info->rtc, MAX8998_RTC_SEC, 8, data);
1189b16c0a4SJoonyoung Shim 	if (ret < 0)
1199b16c0a4SJoonyoung Shim 		return ret;
1209b16c0a4SJoonyoung Shim 
1219b16c0a4SJoonyoung Shim 	max8998_data_to_tm(data, tm);
1229b16c0a4SJoonyoung Shim 
1239b16c0a4SJoonyoung Shim 	return rtc_valid_tm(tm);
1249b16c0a4SJoonyoung Shim }
1259b16c0a4SJoonyoung Shim 
1269b16c0a4SJoonyoung Shim static int max8998_rtc_set_time(struct device *dev, struct rtc_time *tm)
1279b16c0a4SJoonyoung Shim {
1289b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info = dev_get_drvdata(dev);
1299b16c0a4SJoonyoung Shim 	u8 data[8];
130337ce5d1SMyungJoo Ham 	int ret;
1319b16c0a4SJoonyoung Shim 
1329b16c0a4SJoonyoung Shim 	max8998_tm_to_data(tm, data);
1339b16c0a4SJoonyoung Shim 
134337ce5d1SMyungJoo Ham 	ret = max8998_bulk_write(info->rtc, MAX8998_RTC_SEC, 8, data);
135337ce5d1SMyungJoo Ham 
136337ce5d1SMyungJoo Ham 	if (info->lp3974_bug_workaround)
137337ce5d1SMyungJoo Ham 		msleep(2000);
138337ce5d1SMyungJoo Ham 
139337ce5d1SMyungJoo Ham 	return ret;
1409b16c0a4SJoonyoung Shim }
1419b16c0a4SJoonyoung Shim 
1429b16c0a4SJoonyoung Shim static int max8998_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
1439b16c0a4SJoonyoung Shim {
1449b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info = dev_get_drvdata(dev);
1459b16c0a4SJoonyoung Shim 	u8 data[8];
1469b16c0a4SJoonyoung Shim 	u8 val;
1479b16c0a4SJoonyoung Shim 	int ret;
1489b16c0a4SJoonyoung Shim 
1499b16c0a4SJoonyoung Shim 	ret = max8998_bulk_read(info->rtc, MAX8998_ALARM0_SEC, 8, data);
1509b16c0a4SJoonyoung Shim 	if (ret < 0)
1519b16c0a4SJoonyoung Shim 		return ret;
1529b16c0a4SJoonyoung Shim 
1539b16c0a4SJoonyoung Shim 	max8998_data_to_tm(data, &alrm->time);
1549b16c0a4SJoonyoung Shim 
1559b16c0a4SJoonyoung Shim 	ret = max8998_read_reg(info->rtc, MAX8998_ALARM0_CONF, &val);
1569b16c0a4SJoonyoung Shim 	if (ret < 0)
1579b16c0a4SJoonyoung Shim 		return ret;
1589b16c0a4SJoonyoung Shim 
1599b16c0a4SJoonyoung Shim 	alrm->enabled = !!val;
1609b16c0a4SJoonyoung Shim 
1619b16c0a4SJoonyoung Shim 	ret = max8998_read_reg(info->rtc, MAX8998_RTC_STATUS, &val);
1629b16c0a4SJoonyoung Shim 	if (ret < 0)
1639b16c0a4SJoonyoung Shim 		return ret;
1649b16c0a4SJoonyoung Shim 
1659b16c0a4SJoonyoung Shim 	if (val & ALARM0_STATUS)
1669b16c0a4SJoonyoung Shim 		alrm->pending = 1;
1679b16c0a4SJoonyoung Shim 	else
1689b16c0a4SJoonyoung Shim 		alrm->pending = 0;
1699b16c0a4SJoonyoung Shim 
1709b16c0a4SJoonyoung Shim 	return 0;
1719b16c0a4SJoonyoung Shim }
1729b16c0a4SJoonyoung Shim 
1739b16c0a4SJoonyoung Shim static int max8998_rtc_stop_alarm(struct max8998_rtc_info *info)
1749b16c0a4SJoonyoung Shim {
175337ce5d1SMyungJoo Ham 	int ret = max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, 0);
176337ce5d1SMyungJoo Ham 
177337ce5d1SMyungJoo Ham 	if (info->lp3974_bug_workaround)
178337ce5d1SMyungJoo Ham 		msleep(2000);
179337ce5d1SMyungJoo Ham 
180337ce5d1SMyungJoo Ham 	return ret;
1819b16c0a4SJoonyoung Shim }
1829b16c0a4SJoonyoung Shim 
1839b16c0a4SJoonyoung Shim static int max8998_rtc_start_alarm(struct max8998_rtc_info *info)
1849b16c0a4SJoonyoung Shim {
185337ce5d1SMyungJoo Ham 	int ret;
186337ce5d1SMyungJoo Ham 	u8 alarm0_conf = 0x77;
187337ce5d1SMyungJoo Ham 
188337ce5d1SMyungJoo Ham 	/* LP3974 with delay bug chips has rtc alarm bugs with "MONTH" field */
189337ce5d1SMyungJoo Ham 	if (info->lp3974_bug_workaround)
190337ce5d1SMyungJoo Ham 		alarm0_conf = 0x57;
191337ce5d1SMyungJoo Ham 
192337ce5d1SMyungJoo Ham 	ret = max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, alarm0_conf);
193337ce5d1SMyungJoo Ham 
194337ce5d1SMyungJoo Ham 	if (info->lp3974_bug_workaround)
195337ce5d1SMyungJoo Ham 		msleep(2000);
196337ce5d1SMyungJoo Ham 
197337ce5d1SMyungJoo Ham 	return ret;
1989b16c0a4SJoonyoung Shim }
1999b16c0a4SJoonyoung Shim 
2009b16c0a4SJoonyoung Shim static int max8998_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
2019b16c0a4SJoonyoung Shim {
2029b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info = dev_get_drvdata(dev);
2039b16c0a4SJoonyoung Shim 	u8 data[8];
2049b16c0a4SJoonyoung Shim 	int ret;
2059b16c0a4SJoonyoung Shim 
2069b16c0a4SJoonyoung Shim 	max8998_tm_to_data(&alrm->time, data);
2079b16c0a4SJoonyoung Shim 
2089b16c0a4SJoonyoung Shim 	ret = max8998_rtc_stop_alarm(info);
2099b16c0a4SJoonyoung Shim 	if (ret < 0)
2109b16c0a4SJoonyoung Shim 		return ret;
2119b16c0a4SJoonyoung Shim 
2129b16c0a4SJoonyoung Shim 	ret = max8998_bulk_write(info->rtc, MAX8998_ALARM0_SEC, 8, data);
2139b16c0a4SJoonyoung Shim 	if (ret < 0)
2149b16c0a4SJoonyoung Shim 		return ret;
2159b16c0a4SJoonyoung Shim 
216337ce5d1SMyungJoo Ham 	if (info->lp3974_bug_workaround)
217337ce5d1SMyungJoo Ham 		msleep(2000);
2189b16c0a4SJoonyoung Shim 
219337ce5d1SMyungJoo Ham 	if (alrm->enabled)
220337ce5d1SMyungJoo Ham 		ret = max8998_rtc_start_alarm(info);
221337ce5d1SMyungJoo Ham 
222337ce5d1SMyungJoo Ham 	return ret;
2239b16c0a4SJoonyoung Shim }
2249b16c0a4SJoonyoung Shim 
2259b16c0a4SJoonyoung Shim static int max8998_rtc_alarm_irq_enable(struct device *dev,
2269b16c0a4SJoonyoung Shim 					unsigned int enabled)
2279b16c0a4SJoonyoung Shim {
2289b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info = dev_get_drvdata(dev);
2299b16c0a4SJoonyoung Shim 
2309b16c0a4SJoonyoung Shim 	if (enabled)
2319b16c0a4SJoonyoung Shim 		return max8998_rtc_start_alarm(info);
2329b16c0a4SJoonyoung Shim 	else
2339b16c0a4SJoonyoung Shim 		return max8998_rtc_stop_alarm(info);
2349b16c0a4SJoonyoung Shim }
2359b16c0a4SJoonyoung Shim 
2369b16c0a4SJoonyoung Shim static irqreturn_t max8998_rtc_alarm_irq(int irq, void *data)
2379b16c0a4SJoonyoung Shim {
2389b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info = data;
2399b16c0a4SJoonyoung Shim 
2409b16c0a4SJoonyoung Shim 	rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF);
2419b16c0a4SJoonyoung Shim 
2429b16c0a4SJoonyoung Shim 	return IRQ_HANDLED;
2439b16c0a4SJoonyoung Shim }
2449b16c0a4SJoonyoung Shim 
2459b16c0a4SJoonyoung Shim static const struct rtc_class_ops max8998_rtc_ops = {
2469b16c0a4SJoonyoung Shim 	.read_time = max8998_rtc_read_time,
2479b16c0a4SJoonyoung Shim 	.set_time = max8998_rtc_set_time,
2489b16c0a4SJoonyoung Shim 	.read_alarm = max8998_rtc_read_alarm,
2499b16c0a4SJoonyoung Shim 	.set_alarm = max8998_rtc_set_alarm,
2509b16c0a4SJoonyoung Shim 	.alarm_irq_enable = max8998_rtc_alarm_irq_enable,
2519b16c0a4SJoonyoung Shim };
2529b16c0a4SJoonyoung Shim 
2535a167f45SGreg Kroah-Hartman static int max8998_rtc_probe(struct platform_device *pdev)
2549b16c0a4SJoonyoung Shim {
2559b16c0a4SJoonyoung Shim 	struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent);
256337ce5d1SMyungJoo Ham 	struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev);
2579b16c0a4SJoonyoung Shim 	struct max8998_rtc_info *info;
2589b16c0a4SJoonyoung Shim 	int ret;
2599b16c0a4SJoonyoung Shim 
2608925e31aSJingoo Han 	info = devm_kzalloc(&pdev->dev, sizeof(struct max8998_rtc_info),
2618925e31aSJingoo Han 			GFP_KERNEL);
2629b16c0a4SJoonyoung Shim 	if (!info)
2639b16c0a4SJoonyoung Shim 		return -ENOMEM;
2649b16c0a4SJoonyoung Shim 
2659b16c0a4SJoonyoung Shim 	info->dev = &pdev->dev;
2669b16c0a4SJoonyoung Shim 	info->max8998 = max8998;
2679b16c0a4SJoonyoung Shim 	info->rtc = max8998->rtc;
2689b16c0a4SJoonyoung Shim 
26903cf7c47SJohn Stultz 	platform_set_drvdata(pdev, info);
27003cf7c47SJohn Stultz 
2718925e31aSJingoo Han 	info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8998-rtc",
2729b16c0a4SJoonyoung Shim 			&max8998_rtc_ops, THIS_MODULE);
2739b16c0a4SJoonyoung Shim 
2749b16c0a4SJoonyoung Shim 	if (IS_ERR(info->rtc_dev)) {
2759b16c0a4SJoonyoung Shim 		ret = PTR_ERR(info->rtc_dev);
2769b16c0a4SJoonyoung Shim 		dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
2779b16c0a4SJoonyoung Shim 		goto out_rtc;
2789b16c0a4SJoonyoung Shim 	}
2799b16c0a4SJoonyoung Shim 
280443c6ae2STomasz Figa 	if (!max8998->irq_domain)
281443c6ae2STomasz Figa 		goto no_irq;
282443c6ae2STomasz Figa 
283443c6ae2STomasz Figa 	info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0);
284443c6ae2STomasz Figa 	if (!info->irq) {
285443c6ae2STomasz Figa 		dev_warn(&pdev->dev, "Failed to map alarm IRQ\n");
286443c6ae2STomasz Figa 		goto no_irq;
287443c6ae2STomasz Figa 	}
288443c6ae2STomasz Figa 
2898925e31aSJingoo Han 	ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
2908925e31aSJingoo Han 				max8998_rtc_alarm_irq, 0, "rtc-alarm0", info);
291337ce5d1SMyungJoo Ham 
2929b16c0a4SJoonyoung Shim 	if (ret < 0)
2939b16c0a4SJoonyoung Shim 		dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
2949b16c0a4SJoonyoung Shim 			info->irq, ret);
2959b16c0a4SJoonyoung Shim 
296443c6ae2STomasz Figa no_irq:
297337ce5d1SMyungJoo Ham 	dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name);
29843c523bfSTomasz Figa 	if (pdata && pdata->rtc_delay) {
299337ce5d1SMyungJoo Ham 		info->lp3974_bug_workaround = true;
300337ce5d1SMyungJoo Ham 		dev_warn(&pdev->dev, "LP3974 with RTC REGERR option."
301337ce5d1SMyungJoo Ham 				" RTC updates will be extremely slow.\n");
302337ce5d1SMyungJoo Ham 	}
303337ce5d1SMyungJoo Ham 
3049b16c0a4SJoonyoung Shim 	return 0;
3059b16c0a4SJoonyoung Shim 
3069b16c0a4SJoonyoung Shim out_rtc:
30703cf7c47SJohn Stultz 	platform_set_drvdata(pdev, NULL);
3089b16c0a4SJoonyoung Shim 	return ret;
3099b16c0a4SJoonyoung Shim }
3109b16c0a4SJoonyoung Shim 
3115a167f45SGreg Kroah-Hartman static int max8998_rtc_remove(struct platform_device *pdev)
3129b16c0a4SJoonyoung Shim {
3139b16c0a4SJoonyoung Shim 	return 0;
3149b16c0a4SJoonyoung Shim }
3159b16c0a4SJoonyoung Shim 
316337ce5d1SMyungJoo Ham static const struct platform_device_id max8998_rtc_id[] = {
317337ce5d1SMyungJoo Ham 	{ "max8998-rtc", TYPE_MAX8998 },
318337ce5d1SMyungJoo Ham 	{ "lp3974-rtc", TYPE_LP3974 },
319337ce5d1SMyungJoo Ham 	{ }
320337ce5d1SMyungJoo Ham };
321337ce5d1SMyungJoo Ham 
3229b16c0a4SJoonyoung Shim static struct platform_driver max8998_rtc_driver = {
3239b16c0a4SJoonyoung Shim 	.driver		= {
3249b16c0a4SJoonyoung Shim 		.name	= "max8998-rtc",
3259b16c0a4SJoonyoung Shim 		.owner	= THIS_MODULE,
3269b16c0a4SJoonyoung Shim 	},
3279b16c0a4SJoonyoung Shim 	.probe		= max8998_rtc_probe,
3285a167f45SGreg Kroah-Hartman 	.remove		= max8998_rtc_remove,
329337ce5d1SMyungJoo Ham 	.id_table	= max8998_rtc_id,
3309b16c0a4SJoonyoung Shim };
3319b16c0a4SJoonyoung Shim 
3320c4eae66SAxel Lin module_platform_driver(max8998_rtc_driver);
3339b16c0a4SJoonyoung Shim 
3349b16c0a4SJoonyoung Shim MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>");
3359b16c0a4SJoonyoung Shim MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
3369b16c0a4SJoonyoung Shim MODULE_DESCRIPTION("Maxim MAX8998 RTC driver");
3379b16c0a4SJoonyoung Shim MODULE_LICENSE("GPL");
338