static int ade7754_reset(struct device *dev)
{
+ int ret;
u8 val;
- ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+ ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+ if (ret < 0)
+ return ret;
+
val |= 1 << 6; /* Software Chip Reset */
return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
}
/* Power down the device */
static int ade7754_stop_device(struct device *dev)
{
+ int ret;
u8 val;
- ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+ ret = ade7754_spi_read_reg_8(dev, ADE7754_OPMODE, &val);
+ if (ret < 0) {
+ dev_err(dev, "unable to power down the device, error: %d",
+ ret);
+ return ret;
+ }
+
val |= 7 << 3; /* ADE7754 powered down */
return ade7754_spi_write_reg_8(dev, ADE7754_OPMODE, val);
}