forked from luck/tmp_suning_uos_patched
Merge branch 'fortglx/3.1/tip/timers/rtc' of git://git.linaro.org/people/jstultz/linux into timers/urgent
This commit is contained in:
commit
4862571308
|
@ -708,7 +708,7 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
|
|||
int err = 0;
|
||||
unsigned long flags;
|
||||
|
||||
if (freq <= 0 || freq > 5000)
|
||||
if (freq <= 0 || freq > RTC_MAX_FREQ)
|
||||
return -EINVAL;
|
||||
retry:
|
||||
spin_lock_irqsave(&rtc->irq_task_lock, flags);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
struct ep93xx_rtc {
|
||||
void __iomem *mmio_base;
|
||||
struct rtc_device *rtc;
|
||||
};
|
||||
|
||||
static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload,
|
||||
|
@ -130,7 +131,6 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
|
|||
{
|
||||
struct ep93xx_rtc *ep93xx_rtc;
|
||||
struct resource *res;
|
||||
struct rtc_device *rtc;
|
||||
int err;
|
||||
|
||||
ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL);
|
||||
|
@ -151,12 +151,12 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
|
|||
return -ENXIO;
|
||||
|
||||
pdev->dev.platform_data = ep93xx_rtc;
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
platform_set_drvdata(pdev, ep93xx_rtc);
|
||||
|
||||
rtc = rtc_device_register(pdev->name,
|
||||
ep93xx_rtc->rtc = rtc_device_register(pdev->name,
|
||||
&pdev->dev, &ep93xx_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(rtc)) {
|
||||
err = PTR_ERR(rtc);
|
||||
if (IS_ERR(ep93xx_rtc->rtc)) {
|
||||
err = PTR_ERR(ep93xx_rtc->rtc);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
rtc_device_unregister(rtc);
|
||||
rtc_device_unregister(ep93xx_rtc->rtc);
|
||||
exit:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
pdev->dev.platform_data = NULL;
|
||||
|
@ -176,11 +176,11 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
static int __exit ep93xx_rtc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rtc_device *rtc = platform_get_drvdata(pdev);
|
||||
struct ep93xx_rtc *ep93xx_rtc = platform_get_drvdata(pdev);
|
||||
|
||||
sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
rtc_device_unregister(rtc);
|
||||
rtc_device_unregister(ep93xx_rtc->rtc);
|
||||
pdev->dev.platform_data = NULL;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -85,6 +85,8 @@ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
|
|||
time -= tm->tm_hour * 3600;
|
||||
tm->tm_min = time / 60;
|
||||
tm->tm_sec = time - tm->tm_min * 60;
|
||||
|
||||
tm->tm_isdst = 0;
|
||||
}
|
||||
EXPORT_SYMBOL(rtc_time_to_tm);
|
||||
|
||||
|
|
|
@ -362,14 +362,6 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
|
|||
int res;
|
||||
u8 rd_reg;
|
||||
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
/* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
|
||||
* we don't want and can't tolerate. Although it might be
|
||||
* friendlier not to borrow this thread context...
|
||||
*/
|
||||
local_irq_enable();
|
||||
#endif
|
||||
|
||||
res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
|
||||
if (res)
|
||||
goto out;
|
||||
|
@ -428,24 +420,12 @@ static struct rtc_class_ops twl_rtc_ops = {
|
|||
static int __devinit twl_rtc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct rtc_device *rtc;
|
||||
int ret = 0;
|
||||
int ret = -EINVAL;
|
||||
int irq = platform_get_irq(pdev, 0);
|
||||
u8 rd_reg;
|
||||
|
||||
if (irq <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
rtc = rtc_device_register(pdev->name,
|
||||
&pdev->dev, &twl_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(rtc)) {
|
||||
ret = PTR_ERR(rtc);
|
||||
dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
|
||||
PTR_ERR(rtc));
|
||||
goto out0;
|
||||
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
goto out1;
|
||||
|
||||
ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
|
||||
if (ret < 0)
|
||||
|
@ -462,14 +442,6 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
|
|||
if (ret < 0)
|
||||
goto out1;
|
||||
|
||||
ret = request_irq(irq, twl_rtc_interrupt,
|
||||
IRQF_TRIGGER_RISING,
|
||||
dev_name(&rtc->dev), rtc);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "IRQ is not free.\n");
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if (twl_class_is_6030()) {
|
||||
twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
|
||||
REG_INT_MSK_LINE_A);
|
||||
|
@ -480,28 +452,44 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
|
|||
/* Check RTC module status, Enable if it is off */
|
||||
ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG);
|
||||
if (ret < 0)
|
||||
goto out2;
|
||||
goto out1;
|
||||
|
||||
if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) {
|
||||
dev_info(&pdev->dev, "Enabling TWL-RTC.\n");
|
||||
rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M;
|
||||
ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG);
|
||||
if (ret < 0)
|
||||
goto out2;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
/* init cached IRQ enable bits */
|
||||
ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
|
||||
if (ret < 0)
|
||||
goto out2;
|
||||
goto out1;
|
||||
|
||||
return ret;
|
||||
rtc = rtc_device_register(pdev->name,
|
||||
&pdev->dev, &twl_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(rtc)) {
|
||||
ret = PTR_ERR(rtc);
|
||||
dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
|
||||
PTR_ERR(rtc));
|
||||
goto out1;
|
||||
}
|
||||
|
||||
ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
|
||||
IRQF_TRIGGER_RISING,
|
||||
dev_name(&rtc->dev), rtc);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "IRQ is not free.\n");
|
||||
goto out2;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
free_irq(irq, rtc);
|
||||
out1:
|
||||
rtc_device_unregister(rtc);
|
||||
out0:
|
||||
out1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,9 @@ struct rtc_pll_info {
|
|||
#define RTC_AF 0x20 /* Alarm interrupt */
|
||||
#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
|
||||
|
||||
|
||||
#define RTC_MAX_FREQ 8192
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
|
Loading…
Reference in New Issue
Block a user