Other sub-components (da9052-wdt) could use the result to determine reboot cause. Expose the result by make it part of the da9052 structure. Signed-off-by: Marcus Folkesson <marcus.folkesson@xxxxxxxxx> --- drivers/mfd/da9052-core.c | 26 +++++++++++++------------- include/linux/mfd/da9052/da9052.h | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index dc85801b9fa0850fe4dbc351014b7f2981460f02..17baf02b68d60198ff7ec69bf49102423b822d0b 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c @@ -545,35 +545,35 @@ EXPORT_SYMBOL_GPL(da9052_regmap_config); static int da9052_clear_fault_log(struct da9052 *da9052) { int ret = 0; - int fault_log = 0; + int *fault_log = &da9052->fault_log; - fault_log = da9052_reg_read(da9052, DA9052_FAULTLOG_REG); - if (fault_log < 0) { + *fault_log = da9052_reg_read(da9052, DA9052_FAULTLOG_REG); + if (*fault_log < 0) { dev_err(da9052->dev, - "Cannot read FAULT_LOG %d\n", fault_log); - return fault_log; + "Cannot read FAULT_LOG %d\n", *fault_log); + return *fault_log; } - if (fault_log) { - if (fault_log & DA9052_FAULTLOG_TWDERROR) + if (*fault_log) { + if (*fault_log & DA9052_FAULTLOG_TWDERROR) dev_dbg(da9052->dev, "Fault log entry detected: TWD_ERROR\n"); - if (fault_log & DA9052_FAULTLOG_VDDFAULT) + if (*fault_log & DA9052_FAULTLOG_VDDFAULT) dev_dbg(da9052->dev, "Fault log entry detected: VDD_FAULT\n"); - if (fault_log & DA9052_FAULTLOG_VDDSTART) + if (*fault_log & DA9052_FAULTLOG_VDDSTART) dev_dbg(da9052->dev, "Fault log entry detected: VDD_START\n"); - if (fault_log & DA9052_FAULTLOG_TEMPOVER) + if (*fault_log & DA9052_FAULTLOG_TEMPOVER) dev_dbg(da9052->dev, "Fault log entry detected: TEMP_OVER\n"); - if (fault_log & DA9052_FAULTLOG_KEYSHUT) + if (*fault_log & DA9052_FAULTLOG_KEYSHUT) dev_dbg(da9052->dev, "Fault log entry detected: KEY_SHUT\n"); - if (fault_log & DA9052_FAULTLOG_NSDSET) + if (*fault_log & DA9052_FAULTLOG_NSDSET) dev_dbg(da9052->dev, "Fault log entry detected: nSD_SHUT\n"); - if (fault_log & DA9052_FAULTLOG_WAITSET) + if (*fault_log & DA9052_FAULTLOG_WAITSET) dev_dbg(da9052->dev, "Fault log entry detected: WAIT_SHUT\n"); diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h index 76feb3a7066dd4ea2f7768794b8920f67726b211..9cb2fc2938cecf6ddb76da401ae3a098525c380e 100644 --- a/include/linux/mfd/da9052/da9052.h +++ b/include/linux/mfd/da9052/da9052.h @@ -93,6 +93,8 @@ struct da9052 { int chip_irq; + int fault_log; + /* SOC I/O transfer related fixes for DA9052/53 */ int (*fix_io) (struct da9052 *da9052, unsigned char reg); }; -- 2.47.0