rtc: ds3232: Call device_init_wakeup before device_register
The wakealarm attribute is currently not exposed in the sysfs interface as the device has not been set as doing wakealarm when device_register is called. Changing the order of the calls fixes that problem. Interrupts are cleared in check_rtc_status prior to requesting the interrupt. This is only set if an irq is defined. If irq registration fails then set wakeup_capable to false. With this change the sysfs wakealarm attribute will be left visible but it is non functional. rtcwake still returns that the device is not enabled for wakeup. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
This commit is contained in:
parent
3769a375ab
commit
d4f6c6f15a
|
@ -363,6 +363,9 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (ds3232->irq > 0)
|
||||||
|
device_init_wakeup(dev, 1);
|
||||||
|
|
||||||
ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
|
ds3232->rtc = devm_rtc_device_register(dev, name, &ds3232_rtc_ops,
|
||||||
THIS_MODULE);
|
THIS_MODULE);
|
||||||
if (IS_ERR(ds3232->rtc))
|
if (IS_ERR(ds3232->rtc))
|
||||||
|
@ -374,10 +377,10 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||||
IRQF_SHARED | IRQF_ONESHOT,
|
IRQF_SHARED | IRQF_ONESHOT,
|
||||||
name, dev);
|
name, dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
device_set_wakeup_capable(dev, 0);
|
||||||
ds3232->irq = 0;
|
ds3232->irq = 0;
|
||||||
dev_err(dev, "unable to request IRQ\n");
|
dev_err(dev, "unable to request IRQ\n");
|
||||||
} else
|
}
|
||||||
device_init_wakeup(dev, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue