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

Commit 07609e0f 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 platform capabilities bitmap"

parents 268de5c5 a3a5288d
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -779,9 +779,8 @@ void wil_refresh_fw_capabilities(struct wil6210_priv *wil)
	struct wiphy *wiphy = wil_to_wiphy(wil);

	wil->keep_radio_on_during_sleep =
		wil->platform_ops.keep_radio_on_during_sleep &&
		wil->platform_ops.keep_radio_on_during_sleep(
			wil->platform_handle) &&
		test_bit(WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND,
			 wil->platform_capa) &&
		test_bit(WMI_FW_CAPABILITY_D3_SUSPEND, wil->fw_capabilities);

	wil_info(wil, "keep_radio_on_during_sleep (%d)\n",
@@ -1006,9 +1005,18 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
	if (wil->hw_version == HW_VER_UNKNOWN)
		return -ENODEV;

	wil_dbg_misc(wil, "Prevent DS in BL & mark FW to set T_POWER_ON=0\n");
	wil_s(wil, RGF_USER_USAGE_8, BIT_USER_PREVENT_DEEP_SLEEP |
	      BIT_USER_SUPPORT_T_POWER_ON_0);
	wil_dbg_misc(wil, "Prevent DS in BL\n");
	wil_s(wil, RGF_USER_USAGE_8, BIT_USER_PREVENT_DEEP_SLEEP);

	if (test_bit(WIL_PLATFORM_CAPA_T_PWR_ON_0, wil->platform_capa)) {
		wil_dbg_misc(wil, "Notify FW to set T_POWER_ON=0\n");
		wil_s(wil, RGF_USER_USAGE_8, BIT_USER_SUPPORT_T_POWER_ON_0);
	}

	if (test_bit(WIL_PLATFORM_CAPA_EXT_CLK, wil->platform_capa)) {
		wil_dbg_misc(wil, "Notify FW on ext clock configuration\n");
		wil_s(wil, RGF_USER_USAGE_8, BIT_USER_EXT_CLK);
	}

	if (wil->platform_ops.notify) {
		rc = wil->platform_ops.notify(wil->platform_handle,
+10 −0
Original line number Diff line number Diff line
@@ -45,9 +45,11 @@ void wil_set_capabilities(struct wil6210_priv *wil)
	u32 jtag_id = wil_r(wil, RGF_USER_JTAG_DEV_ID);
	u8 chip_revision = (wil_r(wil, RGF_USER_REVISION_ID) &
			    RGF_USER_REVISION_ID_MASK);
	int platform_capa;

	bitmap_zero(wil->hw_capabilities, hw_capability_last);
	bitmap_zero(wil->fw_capabilities, WMI_FW_CAPABILITY_MAX);
	bitmap_zero(wil->platform_capa, WIL_PLATFORM_CAPA_MAX);
	wil->wil_fw_name = ftm_mode ? WIL_FW_NAME_FTM_DEFAULT :
			   WIL_FW_NAME_DEFAULT;
	wil->chip_revision = chip_revision;
@@ -83,6 +85,14 @@ void wil_set_capabilities(struct wil6210_priv *wil)

	wil_info(wil, "Board hardware is %s\n", wil->hw_name);

	/* Get platform capabilities */
	if (wil->platform_ops.get_capa) {
		platform_capa =
			wil->platform_ops.get_capa(wil->platform_handle);
		memcpy(wil->platform_capa, &platform_capa,
		       min(sizeof(wil->platform_capa), sizeof(platform_capa)));
	}

	/* extract FW capabilities from file without loading the FW */
	wil_request_firmware(wil, wil->wil_fw_name, false);
	wil_refresh_fw_capabilities(wil);
+2 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ struct RGF_ICR {
#define RGF_USER_USAGE_8		(0x880020)
	#define BIT_USER_PREVENT_DEEP_SLEEP	BIT(0)
	#define BIT_USER_SUPPORT_T_POWER_ON_0	BIT(1)
	#define BIT_USER_EXT_CLK		BIT(2)
#define RGF_USER_HW_MACHINE_STATE	(0x8801dc)
	#define HW_MACHINE_BOOT_DONE	(0x3fffffd)
#define RGF_USER_USER_CPU_0		(0x8801e0)
@@ -648,6 +649,7 @@ struct wil6210_priv {
	const char *wil_fw_name;
	DECLARE_BITMAP(hw_capabilities, hw_capability_last);
	DECLARE_BITMAP(fw_capabilities, WMI_FW_CAPABILITY_MAX);
	DECLARE_BITMAP(platform_capa, WIL_PLATFORM_CAPA_MAX);
	u8 n_mids; /* number of additional MIDs as reported by FW */
	u32 recovery_count; /* num of FW recovery attempts in a short time */
	u32 recovery_state; /* FW recovery state machine */
+8 −1
Original line number Diff line number Diff line
@@ -27,6 +27,13 @@ enum wil_platform_event {
	WIL_PLATFORM_EVT_POST_SUSPEND = 4,
};

enum wil_platform_capa {
	WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND = 0,
	WIL_PLATFORM_CAPA_T_PWR_ON_0 = 1,
	WIL_PLATFORM_CAPA_EXT_CLK = 2,
	WIL_PLATFORM_CAPA_MAX,
};

/**
 * struct wil_platform_ops - wil platform module calls from this
 * driver to platform driver
@@ -37,7 +44,7 @@ struct wil_platform_ops {
	int (*resume)(void *handle, bool device_powered_on);
	void (*uninit)(void *handle);
	int (*notify)(void *handle, enum wil_platform_event evt);
	bool (*keep_radio_on_during_sleep)(void *handle);
	int (*get_capa)(void *handle);
};

/**
+9 −3
Original line number Diff line number Diff line
@@ -1469,14 +1469,20 @@ static int ops_notify(void *handle, enum wil_platform_event evt)
	return rc;
}

static bool ops_keep_radio_on_during_sleep(void *handle)
static int ops_get_capa(void *handle)
{
	struct msm11ad_ctx *ctx = (struct msm11ad_ctx *)handle;
	int capa;

	pr_debug("%s: keep radio on during sleep is %s\n", __func__,
		 ctx->keep_radio_on_during_sleep ? "allowed" : "not allowed");

	return ctx->keep_radio_on_during_sleep;
	capa = (ctx->keep_radio_on_during_sleep ?
			BIT(WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND) : 0) |
		BIT(WIL_PLATFORM_CAPA_T_PWR_ON_0) |
		BIT(WIL_PLATFORM_CAPA_EXT_CLK);

	return capa;
}

void *msm_11ad_dev_init(struct device *dev, struct wil_platform_ops *ops,
@@ -1518,7 +1524,7 @@ void *msm_11ad_dev_init(struct device *dev, struct wil_platform_ops *ops,
	ops->resume = ops_resume;
	ops->uninit = ops_uninit;
	ops->notify = ops_notify;
	ops->keep_radio_on_during_sleep = ops_keep_radio_on_during_sleep;
	ops->get_capa = ops_get_capa;

	return ctx;
}