mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 01:51:39 +00:00
RTC: Convert rtc drivers to use the alarm_irq_enable method
Some rtc drivers use the ioctl method instead of the alarm_irq_enable method for enabling alarm interupts. With the new virtualized RTC rework, its important for drivers to use the alarm_irq_enable instead. This patch converts the drivers that use the AIE ioctl method to use the alarm_irq_enable method. Other ioctl cmds are left untouched. I have not been able to test or even compile most of these drivers. Any help to make sure this change is correct would be appreciated! CC: Alessandro Zummo <a.zummo@towertech.it> CC: Thomas Gleixner <tglx@linutronix.de> CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Reported-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Tested-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
parent
ac54cd2bd5
commit
16380c153a
18 changed files with 223 additions and 297 deletions
|
@ -495,50 +495,27 @@ static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ds1307_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
|
||||
static int ds1307_alarm_irq_enable(struct device *dev, unsigned int enabled)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct ds1307 *ds1307 = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
|
||||
switch (cmd) {
|
||||
case RTC_AIE_OFF:
|
||||
if (!test_bit(HAS_ALARM, &ds1307->flags))
|
||||
return -ENOTTY;
|
||||
if (!test_bit(HAS_ALARM, &ds1307->flags))
|
||||
return -ENOTTY;
|
||||
|
||||
ret = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (enabled)
|
||||
ret |= DS1337_BIT_A1IE;
|
||||
else
|
||||
ret &= ~DS1337_BIT_A1IE;
|
||||
|
||||
ret = i2c_smbus_write_byte_data(client,
|
||||
DS1337_REG_CONTROL, ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
|
||||
case RTC_AIE_ON:
|
||||
if (!test_bit(HAS_ALARM, &ds1307->flags))
|
||||
return -ENOTTY;
|
||||
|
||||
ret = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret |= DS1337_BIT_A1IE;
|
||||
|
||||
ret = i2c_smbus_write_byte_data(client,
|
||||
DS1337_REG_CONTROL, ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
ret = i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, ret);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -548,7 +525,7 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
|
|||
.set_time = ds1307_set_time,
|
||||
.read_alarm = ds1337_read_alarm,
|
||||
.set_alarm = ds1337_set_alarm,
|
||||
.ioctl = ds1307_ioctl,
|
||||
.alarm_irq_enable = ds1307_alarm_irq_enable,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue