Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f92a7e71 authored by Gidon Studinski's avatar Gidon Studinski Committed by Gerrit - the friendly Code Review server
Browse files

wigig_sensing: fix driver state machine



Allow mode change from INITIALIZED to READY_STOPPED only after SPI has been
initialized. This change will prevent mode change before SPI is ready for
operation.

Change-Id: I12b52bb9c9726c2d8e615fa0c504d01c7b1e26e3
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
Signed-off-by: default avatarAlexei Avshalom Lazar <ailizaro@codeaurora.org>
parent 9e7dd857
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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;