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

Commit e26d0627 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: add support for platform specific notification events"

parents cb54a0f2 7c0b230c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -394,9 +394,10 @@ static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie)
		wil_fw_core_dump(wil);
		wil_notify_fw_error(wil);
		isr &= ~ISR_MISC_FW_ERROR;
		if (wil->platform_ops.notify_crash) {
		if (wil->platform_ops.notify) {
			wil_err(wil, "notify platform driver about FW crash");
			wil->platform_ops.notify_crash(wil->platform_handle);
			wil->platform_ops.notify(wil->platform_handle,
						 WIL_PLATFORM_EVT_FW_CRASH);
		} else {
			wil_fw_error_recovery(wil);
		}
+30 −2
Original line number Diff line number Diff line
@@ -767,6 +767,15 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	if (wil->hw_version == HW_VER_UNKNOWN)
		return -ENODEV;

	if (wil->platform_ops.notify) {
		rc = wil->platform_ops.notify(wil->platform_handle,
					      WIL_PLATFORM_EVT_PRE_RESET);
		if (rc)
			wil_err(wil,
				"%s: PRE_RESET platform notify failed, rc %d\n",
				__func__, rc);
	}

	set_bit(wil_status_resetting, wil->status);

	cancel_work_sync(&wil->disconnect_worker);
@@ -846,8 +855,27 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

		/* we just started MAC, wait for FW ready */
		rc = wil_wait_for_fw_ready(wil);
		if (rc == 0) /* check FW is responsive */
		if (rc)
			return rc;

		/* check FW is responsive */
		rc = wmi_echo(wil);
		if (rc) {
			wil_err(wil, "%s: wmi_echo failed, rc %d\n",
				__func__, rc);
			return rc;
		}

		if (wil->platform_ops.notify) {
			rc = wil->platform_ops.notify(wil->platform_handle,
						      WIL_PLATFORM_EVT_FW_RDY);
			if (rc) {
				wil_err(wil,
					"%s: FW_RDY notify failed, rc %d\n",
					__func__, rc);
				rc = 0;
			}
		}
	}

	return rc;
+7 −1
Original line number Diff line number Diff line
@@ -19,6 +19,12 @@

struct device;

enum wil_platform_event {
	WIL_PLATFORM_EVT_FW_CRASH = 0,
	WIL_PLATFORM_EVT_PRE_RESET = 1,
	WIL_PLATFORM_EVT_FW_RDY = 2,
};

/**
 * struct wil_platform_ops - wil platform module calls from this
 * driver to platform driver
@@ -28,7 +34,7 @@ struct wil_platform_ops {
	int (*suspend)(void *handle);
	int (*resume)(void *handle);
	void (*uninit)(void *handle);
	int (*notify_crash)(void *handle);
	int (*notify)(void *handle, enum wil_platform_event evt);
};

/**
+19 −3
Original line number Diff line number Diff line
@@ -901,9 +901,8 @@ static void ops_uninit(void *handle)
	ops_suspend(ctx);
}

static int ops_notify_crash(void *handle)
static int msm_11ad_notify_crash(struct msm11ad_ctx *ctx)
{
	struct msm11ad_ctx *ctx = (struct msm11ad_ctx *)handle;
	int rc;

	if (ctx->subsys) {
@@ -920,6 +919,23 @@ static int ops_notify_crash(void *handle)
	return 0;
}

static int ops_notify(void *handle, enum wil_platform_event evt)
{
	struct msm11ad_ctx *ctx = (struct msm11ad_ctx *)handle;
	int rc = 0;

	switch (evt) {
	case WIL_PLATFORM_EVT_FW_CRASH:
		rc = msm_11ad_notify_crash(ctx);
		break;
	default:
		pr_debug("%s: Unhandled event %d\n", __func__, evt);
		break;
	}

	return rc;
}

void *msm_11ad_dev_init(struct device *dev, struct wil_platform_ops *ops,
			const struct wil_platform_rops *rops, void *wil_handle)
{
@@ -958,7 +974,7 @@ void *msm_11ad_dev_init(struct device *dev, struct wil_platform_ops *ops,
	ops->suspend = ops_suspend;
	ops->resume = ops_resume;
	ops->uninit = ops_uninit;
	ops->notify_crash = ops_notify_crash;
	ops->notify = ops_notify;

	return ctx;
}