Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 129663
b: refs/heads/master
c: a748384
h: refs/heads/master
i:
  129661: 4c55d7d
  129659: 74b5bcf
  129655: 5164788
  129647: 970ef4b
  129631: fbc90cf
  129599: 939ed3d
  129535: c0a394d
v: v3
  • Loading branch information
Alessandro Zummo authored and Linus Torvalds committed Jan 16, 2009
1 parent b8fbd7f commit e391a7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb144adc517d9ebe8fd8d98a5696fb68ec91e1f5
refs/heads/master: a748384bba1754409383ba9f0738bffdfa3fd431
44 changes: 10 additions & 34 deletions trunk/drivers/rtc/rtc-twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ static int twl4030_rtc_write_u8(u8 data, u8 reg)
static unsigned char rtc_irq_bits;

/*
* Enable timer and/or alarm interrupts.
* Enable 1/second update and/or alarm interrupts.
*/
static int set_rtc_irq_bit(unsigned char bit)
{
unsigned char val;
int ret;

val = rtc_irq_bits | bit;
val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M;
ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
if (ret == 0)
rtc_irq_bits = val;
Expand All @@ -136,7 +137,7 @@ static int set_rtc_irq_bit(unsigned char bit)
}

/*
* Disable timer and/or alarm interrupts.
* Disable update and/or alarm interrupts.
*/
static int mask_rtc_irq_bit(unsigned char bit)
{
Expand All @@ -151,7 +152,7 @@ static int mask_rtc_irq_bit(unsigned char bit)
return ret;
}

static inline int twl4030_rtc_alarm_irq_set_state(int enabled)
static int twl4030_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
{
int ret;

Expand All @@ -163,7 +164,7 @@ static inline int twl4030_rtc_alarm_irq_set_state(int enabled)
return ret;
}

static inline int twl4030_rtc_irq_set_state(int enabled)
static int twl4030_rtc_update_irq_enable(struct device *dev, unsigned enabled)
{
int ret;

Expand Down Expand Up @@ -292,7 +293,7 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
unsigned char alarm_data[ALL_TIME_REGS + 1];
int ret;

ret = twl4030_rtc_alarm_irq_set_state(0);
ret = twl4030_rtc_alarm_irq_enable(dev, 0);
if (ret)
goto out;

Expand All @@ -312,35 +313,11 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
}

if (alm->enabled)
ret = twl4030_rtc_alarm_irq_set_state(1);
ret = twl4030_rtc_alarm_irq_enable(dev, 1);
out:
return ret;
}

#ifdef CONFIG_RTC_INTF_DEV

static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
unsigned long arg)
{
switch (cmd) {
case RTC_AIE_OFF:
return twl4030_rtc_alarm_irq_set_state(0);
case RTC_AIE_ON:
return twl4030_rtc_alarm_irq_set_state(1);
case RTC_UIE_OFF:
return twl4030_rtc_irq_set_state(0);
case RTC_UIE_ON:
return twl4030_rtc_irq_set_state(1);

default:
return -ENOIOCTLCMD;
}
}

#else
#define twl4030_rtc_ioctl NULL
#endif

static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
{
unsigned long events = 0;
Expand Down Expand Up @@ -400,11 +377,12 @@ static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
}

static struct rtc_class_ops twl4030_rtc_ops = {
.ioctl = twl4030_rtc_ioctl,
.read_time = twl4030_rtc_read_time,
.set_time = twl4030_rtc_set_time,
.read_alarm = twl4030_rtc_read_alarm,
.set_alarm = twl4030_rtc_set_alarm,
.alarm_irq_enable = twl4030_rtc_alarm_irq_enable,
.update_irq_enable = twl4030_rtc_update_irq_enable,
};

/*----------------------------------------------------------------------*/
Expand All @@ -422,7 +400,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
rtc = rtc_device_register(pdev->name,
&pdev->dev, &twl4030_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) {
ret = -EINVAL;
ret = PTR_ERR(rtc);
dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
PTR_ERR(rtc));
goto out0;
Expand All @@ -432,7 +410,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rtc);

ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);

if (ret < 0)
goto out1;

Expand Down Expand Up @@ -475,7 +452,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)

return ret;


out2:
free_irq(irq, rtc);
out1:
Expand Down

0 comments on commit e391a7c

Please sign in to comment.