struct ds3232 *ds3232 = dev_get_drvdata(dev);
int control;
int ret;
- u8 buf[4];
mutex_lock(&ds3232->mutex);
- ret = regmap_bulk_read(ds3232->regmap, DS3232_REG_ALARM1, buf, 4);
- if (ret)
- goto unlock;
-
- buf[0] = bcd2bin(buf[0]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
- 0x80 : buf[0];
- buf[1] = bcd2bin(buf[1]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
- 0x80 : buf[1];
- buf[2] = bcd2bin(buf[2]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
- 0x80 : buf[2];
- buf[3] = bcd2bin(buf[3]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
- 0x80 : buf[3];
-
- ret = regmap_bulk_write(ds3232->regmap, DS3232_REG_ALARM1, buf, 4);
- if (ret)
- goto unlock;
-
ret = regmap_read(ds3232->regmap, DS3232_REG_CR, &control);
if (ret)
goto unlock;
- if (enabled || (ds3232->rtc->irq_data & RTC_UF))
+ if (enabled)
/* enable alarm1 interrupt */
control |= DS3232_REG_CR_A1IE;
else