drivers: rtc: pcf8563: check if the node has an interrupt pin
Verify if the int1_gpios property exists for the specific node. Signed-off-by: Jakub Topic <jakub.topic@anitra.cz>
This commit is contained in:
parent
fdd7f524b9
commit
2feeeefbe7
1 changed files with 6 additions and 2 deletions
|
|
@ -413,6 +413,10 @@ static int pcf8563_alarm_set_callback(const struct device *dev, uint16_t id,
|
|||
struct pcf8563_data *data = dev->data;
|
||||
int ret;
|
||||
|
||||
if (config->int1.port == NULL) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (id != 0) {
|
||||
LOG_ERR("invalid ID %d", id);
|
||||
return -EINVAL;
|
||||
|
|
@ -471,14 +475,14 @@ int pcf8563_init(const struct device *dev)
|
|||
|
||||
if (!device_is_ready(config->i2c.bus)) {
|
||||
LOG_ERR("Failed to get pointer to %s device!", config->i2c.bus->name);
|
||||
return -EINVAL;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Check if it's alive. */
|
||||
ret = i2c_reg_read_byte_dt(&config->i2c, PCF8563_CONTROL1_REGISTER, ®);
|
||||
if (ret) {
|
||||
LOG_ERR("Failed to read from PCF85063! (err %i)", ret);
|
||||
return -EIO;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
LOG_INF("%s is initialized!", dev->name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue