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

Commit 6e9bf582 authored by Talel Atias's avatar Talel Atias
Browse files

msm: ipa: add differentiation for endpoint config



Allow IPA clients to decide whether IPA driver
should configure the connected endpoint during
pipe connection.

In some use-cases Q6 processor should configure
the endpoint, while in other cases A7 processor should.

Change-Id: I5e34d18228afcce4683790aa7f2433f05a15d60d
Signed-off-by: default avatarTalel Atias <tatias@codeaurora.org>
parent 2f8fb2e9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -420,6 +420,8 @@ typedef void (*ipa_notify_cb)(void *priv, enum ipa_dp_evt_type evt,
 *			to sys mem if pipe mem alloc fails
 * @desc:	desc FIFO meta-data when client has allocated it
 * @data:	data FIFO meta-data when client has allocated it
 * @skip_ep_cfg: boolean field that determines if EP should be configured
 *  by IPA driver
 */
struct ipa_connect_params {
	struct ipa_ep_cfg ipa_ep_cfg;
@@ -433,6 +435,7 @@ struct ipa_connect_params {
	bool pipe_mem_preferred;
	struct sps_mem_buffer desc;
	struct sps_mem_buffer data;
	bool skip_ep_cfg;
};

/**
@@ -496,6 +499,8 @@ struct ipa_ext_intf {
 *		evt - type of event
 *		data - data relevant to event.  May not be valid. See event_type
 *		enum for valid cases.
 * @skip_ep_cfg: boolean field that determines if EP should be configured
 *  by IPA driver
 */
struct ipa_sys_connect_params {
	struct ipa_ep_cfg ipa_ep_cfg;
@@ -503,6 +508,7 @@ struct ipa_sys_connect_params {
	u32 desc_fifo_sz;
	void *priv;
	ipa_notify_cb notify;
	bool skip_ep_cfg;
};

/**
+4 −5
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps,
	memset(&ipa_ctx->ep[ipa_ep_idx], 0, sizeof(struct ipa_ep_context));
	ipa_inc_client_enable_clks();

	ep->skip_ep_cfg = in->skip_ep_cfg;
	ep->valid = 1;
	ep->client = in->client;
	ep->client_notify = in->notify;
@@ -251,12 +252,12 @@ int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps,
		goto ipa_cfg_ep_fail;
	}

	if (ipa_ctx->ipa_hw_type != IPA_HW_v2_0 || ep->priv == NULL ||
	    (enum ipa_config_this_ep)ep->priv != IPA_DO_NOT_CONFIGURE_THIS_EP) {
	if (!ep->skip_ep_cfg) {
		if (ipa_cfg_ep(ipa_ep_idx, &in->ipa_ep_cfg)) {
			IPAERR("fail to configure EP.\n");
			goto ipa_cfg_ep_fail;
		}
		IPADBG("ep configuration successful\n");
	} else {
		IPADBG("Skipping endpoint configuration.\n");
	}
@@ -325,9 +326,7 @@ int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps,

	ipa_program_holb(ep, ipa_ep_idx);

	if (in->client == IPA_CLIENT_USB_PROD &&
		((enum ipa_config_this_ep)ep->priv !=
		 IPA_DO_NOT_CONFIGURE_THIS_EP))
	if (!ep->skip_ep_cfg && IPA_CLIENT_IS_PROD(in->client))
		ipa_install_dflt_flt_rules(ipa_ep_idx);

	IPADBG("client %d (ep: %d) connected\n", in->client, ipa_ep_idx);
+25 −11
Original line number Diff line number Diff line
@@ -943,17 +943,18 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
		goto fail_wq;
	}

	ep->sys->ep = ep;
	if (ipa_assign_policy(sys_in, ep->sys)) {
		IPAERR("failed to sys ctx for client %d\n", sys_in->client);
		result = -ENOMEM;
		goto fail_gen2;
	}

	ep->skip_ep_cfg = sys_in->skip_ep_cfg;
	ep->valid = 1;
	ep->client = sys_in->client;
	ep->client_notify = sys_in->notify;
	ep->priv = sys_in->priv;
	ep->sys->ep = ep;
	ep->avail_fifo_desc =
		((sys_in->desc_fifo_sz/sizeof(struct sps_iovec))-1);
	INIT_LIST_HEAD(&ep->sys->head_desc_list);
@@ -967,11 +968,15 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
		goto fail_gen2;
	}

	if (!ep->skip_ep_cfg) {
		if (ipa_cfg_ep(ipa_ep_idx, &sys_in->ipa_ep_cfg)) {
			IPAERR("fail to configure EP.\n");
			goto fail_gen2;
		}
		IPADBG("ep configuration successful\n");
	} else {
		IPADBG("skipping ep configuration\n");
	}

	/* Default Config */
	ep->ep_hdl = sps_alloc_endpoint();
@@ -1049,7 +1054,7 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
		ipa_allocate_wlan_rx_common_cache(IPA_WLAN_COMM_RX_POOL_LOW);
	}

	if (sys_in->client == IPA_CLIENT_WLAN1_PROD)
	if (!ep->skip_ep_cfg && IPA_CLIENT_IS_PROD(sys_in->client))
		ipa_install_dflt_flt_rules(ipa_ep_idx);

	IPADBG("client %d (ep: %d) connected sys=%p\n", sys_in->client,
@@ -2085,11 +2090,20 @@ static int ipa_assign_policy(struct ipa_sys_connect_params *in,
	} else if (ipa_ctx->ipa_hw_type == IPA_HW_v2_0) {
		in->ipa_ep_cfg.status.status_en = true;
		if (IPA_CLIENT_IS_PROD(in->client)) {
			if (!sys->ep->skip_ep_cfg) {
				sys->policy = IPA_POLICY_NOINTR_MODE;
				sys->sps_option = SPS_O_AUTO_ENABLE;
				sys->sps_callback = NULL;
				in->ipa_ep_cfg.status.status_ep =
				ipa_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
					ipa_get_ep_mapping(
						IPA_CLIENT_APPS_LAN_CONS);
			} else {
				sys->policy = IPA_POLICY_INTR_MODE;
				sys->sps_option = (SPS_O_AUTO_ENABLE |
						SPS_O_EOT);
				sys->sps_callback =
					ipa_sps_irq_tx_no_aggr_notify;
			}
		} else {
			sys->policy = IPA_POLICY_INTR_MODE;
			sys->sps_option = (SPS_O_AUTO_ENABLE | SPS_O_EOT);
+3 −0
Original line number Diff line number Diff line
@@ -317,6 +317,8 @@ struct ipa_tree_node {
 * @desc_fifo_client_allocated: if descriptors FIFO was allocated by a client
 * @data_fifo_client_allocated: if data FIFO was allocated by a client
 * @suspended: valid for B2B pipes, whether IPA EP is suspended
 * @skip_ep_cfg: boolean field that determines if EP should be configured
 *  by IPA driver
 */
struct ipa_ep_context {
	int valid;
@@ -341,6 +343,7 @@ struct ipa_ep_context {
	u32 avail_fifo_desc;
	u32 dflt_flt4_rule_hdl;
	u32 dflt_flt6_rule_hdl;
	bool skip_ep_cfg;
};

enum ipa_sys_pipe_policy {