Release 4.7 drivers/rtc/rtc-test.c
/*
* An RTC test device/driver
* Copyright (C) 2005 Tower Technologies
* Author: Alessandro Zummo <a.zummo@towertech.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/err.h>
#include <linux/rtc.h>
#include <linux/platform_device.h>
static int test_mmss64;
module_param(test_mmss64, int, 0644);
MODULE_PARM_DESC(test_mmss64, "Test struct rtc_class_ops.set_mmss64().");
static struct platform_device *test0 = NULL, *test1 = NULL;
static int test_rtc_read_alarm(struct device *dev,
struct rtc_wkalrm *alrm)
{
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 19 | 100.00% | 1 | 100.00% |
| Total | 19 | 100.00% | 1 | 100.00% |
static int test_rtc_set_alarm(struct device *dev,
struct rtc_wkalrm *alrm)
{
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 19 | 100.00% | 1 | 100.00% |
| Total | 19 | 100.00% | 1 | 100.00% |
static int test_rtc_read_time(struct device *dev,
struct rtc_time *tm)
{
rtc_time64_to_tm(ktime_get_real_seconds(), tm);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 25 | 92.59% | 1 | 50.00% |
pang xunlei | pang xunlei | 2 | 7.41% | 1 | 50.00% |
| Total | 27 | 100.00% | 2 | 100.00% |
static int test_rtc_set_mmss64(struct device *dev, time64_t secs)
{
dev_info(dev, "%s, secs = %lld\n", __func__, (long long)secs);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pang xunlei | pang xunlei | 32 | 100.00% | 1 | 100.00% |
| Total | 32 | 100.00% | 1 | 100.00% |
static int test_rtc_set_mmss(struct device *dev, unsigned long secs)
{
dev_info(dev, "%s, secs = %lu\n", __func__, secs);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 29 | 100.00% | 2 | 100.00% |
| Total | 29 | 100.00% | 2 | 100.00% |
static int test_rtc_proc(struct device *dev, struct seq_file *seq)
{
struct platform_device *plat_dev = to_platform_device(dev);
seq_printf(seq, "test\t\t: yes\n");
seq_printf(seq, "id\t\t: %d\n", plat_dev->id);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 47 | 100.00% | 1 | 100.00% |
| Total | 47 | 100.00% | 1 | 100.00% |
static int test_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
{
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 16 | 88.89% | 1 | 50.00% |
john stultz | john stultz | 2 | 11.11% | 1 | 50.00% |
| Total | 18 | 100.00% | 2 | 100.00% |
static struct rtc_class_ops test_rtc_ops = {
.proc = test_rtc_proc,
.read_time = test_rtc_read_time,
.read_alarm = test_rtc_read_alarm,
.set_alarm = test_rtc_set_alarm,
.set_mmss = test_rtc_set_mmss,
.alarm_irq_enable = test_rtc_alarm_irq_enable,
};
static ssize_t test_irq_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", 42);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 30 | 100.00% | 1 | 100.00% |
| Total | 30 | 100.00% | 1 | 100.00% |
static ssize_t test_irq_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int retval;
struct platform_device *plat_dev = to_platform_device(dev);
struct rtc_device *rtc = platform_get_drvdata(plat_dev);
retval = count;
if (strncmp(buf, "tick", 4) == 0 && rtc->pie_enabled)
rtc_update_irq(rtc, 1, RTC_PF | RTC_IRQF);
else if (strncmp(buf, "alarm", 5) == 0) {
struct rtc_wkalrm alrm;
int err = rtc_read_alarm(rtc, &alrm);
if (!err && alrm.enabled)
rtc_update_irq(rtc, 1, RTC_AF | RTC_IRQF);
} else if (strncmp(buf, "update", 6) == 0 && rtc->uie_rtctimer.enabled)
rtc_update_irq(rtc, 1, RTC_UF | RTC_IRQF);
else
retval = -EINVAL;
return retval;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 134 | 78.82% | 1 | 50.00% |
marcelo roberto jimenez | marcelo roberto jimenez | 36 | 21.18% | 1 | 50.00% |
| Total | 170 | 100.00% | 2 | 100.00% |
static DEVICE_ATTR(irq, S_IRUGO | S_IWUSR, test_irq_show, test_irq_store);
static int test_probe(struct platform_device *plat_dev)
{
int err;
struct rtc_device *rtc;
if (test_mmss64) {
test_rtc_ops.set_mmss64 = test_rtc_set_mmss64;
test_rtc_ops.set_mmss = NULL;
}
rtc = devm_rtc_device_register(&plat_dev->dev, "test",
&test_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) {
return PTR_ERR(rtc);
}
err = device_create_file(&plat_dev->dev, &dev_attr_irq);
if (err)
dev_err(&plat_dev->dev, "Unable to create sysfs entry: %s\n",
dev_attr_irq.attr.name);
platform_set_drvdata(plat_dev, rtc);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 81 | 72.32% | 2 | 40.00% |
pang xunlei | pang xunlei | 18 | 16.07% | 1 | 20.00% |
jingoo han | jingoo han | 7 | 6.25% | 1 | 20.00% |
jeff garzik | jeff garzik | 6 | 5.36% | 1 | 20.00% |
| Total | 112 | 100.00% | 5 | 100.00% |
static int test_remove(struct platform_device *plat_dev)
{
device_remove_file(&plat_dev->dev, &dev_attr_irq);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 25 | 100.00% | 1 | 100.00% |
| Total | 25 | 100.00% | 1 | 100.00% |
static struct platform_driver test_driver = {
.probe = test_probe,
.remove = test_remove,
.driver = {
.name = "rtc-test",
},
};
static int __init test_init(void)
{
int err;
if ((err = platform_driver_register(&test_driver)))
return err;
if ((test0 = platform_device_alloc("rtc-test", 0)) == NULL) {
err = -ENOMEM;
goto exit_driver_unregister;
}
if ((test1 = platform_device_alloc("rtc-test", 1)) == NULL) {
err = -ENOMEM;
goto exit_put_test0;
}
if ((err = platform_device_add(test0)))
goto exit_put_test1;
if ((err = platform_device_add(test1)))
goto exit_del_test0;
return 0;
exit_del_test0:
platform_device_del(test0);
exit_put_test1:
platform_device_put(test1);
exit_put_test0:
platform_device_put(test0);
exit_driver_unregister:
platform_driver_unregister(&test_driver);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 131 | 93.57% | 1 | 33.33% |
wei yongjun | wei yongjun | 7 | 5.00% | 1 | 33.33% |
sam ravnborg | sam ravnborg | 2 | 1.43% | 1 | 33.33% |
| Total | 140 | 100.00% | 3 | 100.00% |
static void __exit test_exit(void)
{
platform_device_unregister(test0);
platform_device_unregister(test1);
platform_driver_unregister(&test_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 24 | 96.00% | 1 | 50.00% |
sam ravnborg | sam ravnborg | 1 | 4.00% | 1 | 50.00% |
| Total | 25 | 100.00% | 2 | 100.00% |
MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
MODULE_DESCRIPTION("RTC test driver/device");
MODULE_LICENSE("GPL");
module_init(test_init);
module_exit(test_exit);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alessandro zummo | alessandro zummo | 706 | 83.85% | 3 | 30.00% |
pang xunlei | pang xunlei | 72 | 8.55% | 1 | 10.00% |
marcelo roberto jimenez | marcelo roberto jimenez | 36 | 4.28% | 1 | 10.00% |
jingoo han | jingoo han | 7 | 0.83% | 1 | 10.00% |
wei yongjun | wei yongjun | 7 | 0.83% | 1 | 10.00% |
jeff garzik | jeff garzik | 6 | 0.71% | 1 | 10.00% |
john stultz | john stultz | 4 | 0.48% | 1 | 10.00% |
sam ravnborg | sam ravnborg | 4 | 0.48% | 1 | 10.00% |
| Total | 842 | 100.00% | 10 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.