diff --git a/drivers/misc/wigig_sensing.c b/drivers/misc/wigig_sensing.c index 1e262d864784..ca35341efcc9 100644 --- a/drivers/misc/wigig_sensing.c +++ b/drivers/misc/wigig_sensing.c @@ -454,9 +454,11 @@ static int wigig_sensing_change_state(struct wigig_sensing_ctx *ctx, /* * Moving from INITIALIZED state is allowed only to READY_STOPPED state + * and only when spi_ready is set */ else if (curr_state == WIGIG_SENSING_STATE_INITIALIZED && - new_state != WIGIG_SENSING_STATE_READY_STOPPED) { + (new_state != WIGIG_SENSING_STATE_READY_STOPPED || + !ctx->stm.spi_ready)) { transition_allowed = false; rc = -EFAULT; } @@ -1255,9 +1257,11 @@ static irqreturn_t wigig_sensing_dri_isr_thread(int irq, void *cookie) } ctx->stm.spi_malfunction = false; - if (ctx->stm.state == WIGIG_SENSING_STATE_INITIALIZED) + if (ctx->stm.state == WIGIG_SENSING_STATE_INITIALIZED) { wigig_sensing_change_state(ctx, &ctx->stm, WIGIG_SENSING_STATE_READY_STOPPED); + ctx->stm.spi_ready = true; + } } pr_debug("Reading SANITY register\n"); @@ -1313,6 +1317,7 @@ static irqreturn_t wigig_sensing_dri_isr_thread(int irq, void *cookie) WIGIG_SENSING_EVENT_RESET); ctx->stm.spi_malfunction = true; + ctx->stm.spi_ready = false; memset(&ctx->inb_cmd, 0, sizeof(ctx->inb_cmd)); spi_status.v &= ~INT_SYSASSERT; goto deassert_and_bail_out; diff --git a/drivers/misc/wigig_sensing.h b/drivers/misc/wigig_sensing.h index e45a7f62101e..d53eead8281a 100644 --- a/drivers/misc/wigig_sensing.h +++ b/drivers/misc/wigig_sensing.h @@ -146,6 +146,7 @@ struct wigig_sensing_stm { bool auto_recovery; bool fw_is_ready; bool spi_malfunction; + bool spi_ready; bool waiting_for_deep_sleep_exit; bool waiting_for_deep_sleep_exit_first_pass; bool burst_size_ready;