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

Commit a0b05c44 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: Fix to register client callback in USB/MHI connect"

parents cb2fc92f 9de18fa3
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -3515,16 +3515,17 @@ int ipa_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info, u16 num_regs)
}

void ipa_register_client_callback(int (*client_cb)(bool is_lock),
				bool (*teth_port_state)(void), u32 ipa_ep_idx)
				bool (*teth_port_state)(void),
					enum ipa_client_type client)
{
	IPA_API_DISPATCH(ipa_register_client_callback,
		client_cb, teth_port_state, ipa_ep_idx);
		client_cb, teth_port_state, client);
}

void ipa_deregister_client_callback(u32 ipa_ep_idx)
void ipa_deregister_client_callback(enum ipa_client_type client)
{
	IPA_API_DISPATCH(ipa_deregister_client_callback,
		ipa_ep_idx);
		client);
}


+2 −2
Original line number Diff line number Diff line
@@ -450,9 +450,9 @@ struct ipa_api_controller {

	void (*ipa_register_client_callback)(
		int (*client_cb)(bool is_lock),
		bool (*teth_port_state)(void), u32 ipa_ep_idx);
		bool (*teth_port_state)(void), enum ipa_client_type client);

	void (*ipa_deregister_client_callback)(u32 ipa_ep_idx);
	void (*ipa_deregister_client_callback)(enum ipa_client_type client);
};

#ifdef CONFIG_IPA3
+8 −10
Original line number Diff line number Diff line
@@ -1572,6 +1572,7 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl)

	IPA_ACTIVE_CLIENTS_INC_EP(in->sys.client);

	mutex_lock(&mhi_client_general_mutex);
	if (ipa_get_transport_type() == IPA_TRANSPORT_TYPE_GSI) {
		struct ipa_mhi_connect_params_internal internal;

@@ -1602,7 +1603,6 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl)
				&channel->cached_gsi_evt_ring_hdl;
		internal.start.gsi.evchid = channel->index;

		mutex_lock(&mhi_client_general_mutex);
		res = ipa_connect_mhi_pipe(&internal, clnt_hdl);
		if (res) {
			IPA_MHI_ERR("ipa_connect_mhi_pipe failed %d\n", res);
@@ -1638,11 +1638,6 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl)
		}
		channel->state = IPA_HW_MHI_CHANNEL_STATE_RUN;
	}

	if (IPA_CLIENT_IS_PROD(in->sys.client)) {
		ipa_register_client_callback(&ipa_mhi_set_lock_unlock,
			NULL, *clnt_hdl);
	}
	mutex_unlock(&mhi_client_general_mutex);

	if (!in->sys.keep_ipa_awake)
@@ -1715,10 +1710,6 @@ int ipa_mhi_disconnect_pipe(u32 clnt_hdl)
				, clnt_hdl, res);
		goto fail_disconnect_pipe;
	}

	if (IPA_CLIENT_IS_PROD(client))
		ipa_deregister_client_callback(clnt_hdl);

	mutex_unlock(&mhi_client_general_mutex);

	IPA_ACTIVE_CLIENTS_DEC_EP(ipa_get_client_mapping(clnt_hdl));
@@ -2553,6 +2544,9 @@ void ipa_mhi_destroy(void)
		IPA_MHI_DBG("IPA MHI was not initialized, already destroyed\n");
		return;
	}

	ipa_deregister_client_callback(IPA_CLIENT_MHI_PROD);

	/* reset all UL and DL acc channels and its accociated event rings */
	if (ipa_get_transport_type() == IPA_TRANSPORT_TYPE_GSI) {
		res = ipa_mhi_destroy_all_channels();
@@ -2814,6 +2808,10 @@ int ipa_mhi_init(struct ipa_mhi_init_params *params)
		if (ipa_uc_state_check() == 0)
			ipa_mhi_set_state(IPA_MHI_STATE_READY);
	}

	ipa_register_client_callback(&ipa_mhi_set_lock_unlock, NULL,
					IPA_CLIENT_MHI_PROD);

	/* Initialize debugfs */
	ipa_mhi_debugfs_init();

+29 −33
Original line number Diff line number Diff line
@@ -977,6 +977,18 @@ static bool ipa3_usb_is_teth_switch_valid(enum ipa_usb_teth_prot new_teth)
}


static int ipa_usb_set_lock_unlock(bool is_lock)
{
	IPA_USB_DBG("entry\n");
	if (is_lock)
		mutex_lock(&ipa3_usb_ctx->general_mutex);
	else
		mutex_unlock(&ipa3_usb_ctx->general_mutex);
	IPA_USB_DBG("exit\n");

	return 0;
}

int ipa_usb_init_teth_prot(enum ipa_usb_teth_prot teth_prot,
			   struct ipa_usb_teth_params *teth_params,
			   int (*ipa_usb_notify_cb)(enum ipa_usb_notify_event,
@@ -1111,6 +1123,14 @@ int ipa_usb_init_teth_prot(enum ipa_usb_teth_prot teth_prot,
		IPA_USB_DBG("initialized %s %s\n",
			ipa3_usb_teth_prot_to_string(teth_prot),
			ipa3_usb_teth_bridge_prot_to_string(teth_prot));
		/*
		 * Register for xdci lock/unlock callback with ipa core driver.
		 * As per use case, only register for IPA_CONS end point now.
		 * If needed we can include the same for IPA_PROD ep.
		 * For IPA_USB_DIAG/DPL config there will not be any UL ep.
		 */
		ipa3_register_client_callback(&ipa_usb_set_lock_unlock,
			&ipa3_usb_get_teth_port_state, IPA_CLIENT_USB_PROD);
		break;
	case IPA_USB_DIAG:
		if (ipa3_usb_ctx->teth_prot_ctx[teth_prot].state !=
@@ -2274,20 +2294,6 @@ static void ipa_usb_debugfs_init(void){}
static void ipa_usb_debugfs_remove(void){}
#endif /* CONFIG_DEBUG_FS */

static int ipa_usb_set_lock_unlock(bool is_lock)
{
	IPA_USB_DBG("entry\n");
	if (is_lock)
		mutex_lock(&ipa3_usb_ctx->general_mutex);
	else
		mutex_unlock(&ipa3_usb_ctx->general_mutex);
	IPA_USB_DBG("exit\n");

	return 0;
}



int ipa_usb_xdci_connect(struct ipa_usb_xdci_chan_params *ul_chan_params,
			 struct ipa_usb_xdci_chan_params *dl_chan_params,
			 struct ipa_req_chan_out_params *ul_out_params,
@@ -2354,16 +2360,6 @@ int ipa_usb_xdci_connect(struct ipa_usb_xdci_chan_params *ul_chan_params,
		goto connect_fail;
	}

	/*
	 * Register for xdci lock/unlock callback with ipa core driver.
	 * As per use case, only register for IPA_CONS end point for now.
	 * If needed we can include the same for IPA_PROD ep.
	 * For IPA_USB_DIAG/DPL config there will not be any UL ep.
	 */
	if (connect_params->teth_prot != IPA_USB_DIAG)
		ipa3_register_client_callback(&ipa_usb_set_lock_unlock,
			&ipa3_usb_get_teth_port_state, ul_out_params->clnt_hdl);

	IPA_USB_DBG_LOW("exit\n");
	mutex_unlock(&ipa3_usb_ctx->general_mutex);
	return 0;
@@ -2441,15 +2437,6 @@ static int ipa_usb_xdci_dismiss_channels(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
		}
	}

	/*
	 * Deregister for xdci lock/unlock callback from ipa core driver.
	 * As per use case, only deregister for IPA_CONS end point for now.
	 * If needed we can include the same for IPA_PROD ep.
	 * For IPA_USB_DIAG/DPL config there will not be any UL config.
	 */
	if (!IPA3_USB_IS_TTYPE_DPL(ttype))
		ipa3_deregister_client_callback(ul_clnt_hdl);

	/* Change state to STOPPED */
	if (!ipa3_usb_set_state(IPA_USB_STOPPED, false, ttype))
		IPA_USB_ERR("failed to change state to stopped\n");
@@ -3177,6 +3164,15 @@ static int __init ipa3_usb_init(void)
static void ipa3_usb_exit(void)
{
	IPA_USB_DBG_LOW("IPA_USB exit\n");

	/*
	 * Deregister for xdci lock/unlock callback from ipa core driver.
	 * As per use case, only deregister for IPA_CONS end point for now.
	 * If needed we can include the same for IPA_PROD ep.
	 * For IPA_USB_DIAG/DPL config there will not be any UL config.
	 */
	ipa3_deregister_client_callback(IPA_CLIENT_USB_PROD);

	ipa_usb_debugfs_remove();
	kfree(ipa3_usb_ctx);
}
+3 −6
Original line number Diff line number Diff line
@@ -388,14 +388,13 @@ static enum ipa_client_cb_type ipa_get_client_cb_type(
	return client_cb;
}
void ipa3_register_client_callback(int (*client_cb)(bool is_lock),
				bool (*teth_port_state)(void), u32 ipa_ep_idx)
				bool (*teth_port_state)(void),
				enum ipa_client_type client_type)
{
	enum ipa_client_cb_type client;
	enum ipa_client_type client_type;

	IPADBG("entry\n");

	client_type = ipa3_get_client_by_pipe(ipa_ep_idx);
	client = ipa_get_client_cb_type(client_type);
	if (client == IPA_MAX_CLNT)
		return;
@@ -412,14 +411,12 @@ void ipa3_register_client_callback(int (*client_cb)(bool is_lock),
	IPADBG("exit\n");
}

void ipa3_deregister_client_callback(u32 ipa_ep_idx)
void ipa3_deregister_client_callback(enum ipa_client_type client_type)
{
	enum ipa_client_cb_type client_cb;
	enum ipa_client_type client_type;

	IPADBG("entry\n");

	client_type = ipa3_get_client_by_pipe(ipa_ep_idx);
	client_cb = ipa_get_client_cb_type(client_type);
	if (client_cb == IPA_MAX_CLNT)
		return;
Loading