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

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

Merge "msm: ipa: unify IPA RM"

parents 4f39e802 47f6a9c4
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
obj-$(CONFIG_IPA) += ipa_v2/ ipa_clients/
obj-$(CONFIG_IPA3) += ipa_v3/ ipa_clients/
obj-$(CONFIG_IPA) += ipa_v2/ ipa_clients/ ipa_common
obj-$(CONFIG_IPA3) += ipa_v3/ ipa_clients/ ipa_common

obj-$(CONFIG_IPA) += ipa_api.o
obj-$(CONFIG_IPA3) += ipa_api.o
ipa_common += ipa_api.o ipa_rm.o ipa_rm_dependency_graph.o ipa_rm_peers_list.o ipa_rm_resource.o ipa_rm_inactivity_timer.o
+202 −333
Original line number Diff line number Diff line
@@ -76,6 +76,78 @@
static enum ipa_hw_type ipa_api_hw_type;
static struct ipa_api_controller *ipa_api_ctrl;

const char *ipa_clients_strings[IPA_CLIENT_MAX] = {
	__stringify(IPA_CLIENT_HSIC1_PROD),
	__stringify(IPA_CLIENT_WLAN1_PROD),
	__stringify(IPA_CLIENT_HSIC2_PROD),
	__stringify(IPA_CLIENT_USB2_PROD),
	__stringify(IPA_CLIENT_HSIC3_PROD),
	__stringify(IPA_CLIENT_USB3_PROD),
	__stringify(IPA_CLIENT_HSIC4_PROD),
	__stringify(IPA_CLIENT_USB4_PROD),
	__stringify(IPA_CLIENT_HSIC5_PROD),
	__stringify(IPA_CLIENT_USB_PROD),
	__stringify(IPA_CLIENT_A5_WLAN_AMPDU_PROD),
	__stringify(IPA_CLIENT_A2_EMBEDDED_PROD),
	__stringify(IPA_CLIENT_A2_TETHERED_PROD),
	__stringify(IPA_CLIENT_APPS_LAN_WAN_PROD),
	__stringify(IPA_CLIENT_APPS_CMD_PROD),
	__stringify(IPA_CLIENT_ODU_PROD),
	__stringify(IPA_CLIENT_MHI_PROD),
	__stringify(IPA_CLIENT_Q6_LAN_PROD),
	__stringify(IPA_CLIENT_Q6_WAN_PROD),
	__stringify(IPA_CLIENT_Q6_CMD_PROD),
	__stringify(IPA_CLIENT_MEMCPY_DMA_SYNC_PROD),
	__stringify(IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD),
	__stringify(IPA_CLIENT_Q6_DECOMP_PROD),
	__stringify(IPA_CLIENT_Q6_DECOMP2_PROD),
	__stringify(IPA_CLIENT_UC_USB_PROD),

	/* Below PROD client type is only for test purpose */
	__stringify(IPA_CLIENT_TEST_PROD),
	__stringify(IPA_CLIENT_TEST1_PROD),
	__stringify(IPA_CLIENT_TEST2_PROD),
	__stringify(IPA_CLIENT_TEST3_PROD),
	__stringify(IPA_CLIENT_TEST4_PROD),

	__stringify(IPA_CLIENT_HSIC1_CONS),
	__stringify(IPA_CLIENT_WLAN1_CONS),
	__stringify(IPA_CLIENT_HSIC2_CONS),
	__stringify(IPA_CLIENT_USB2_CONS),
	__stringify(IPA_CLIENT_WLAN2_CONS),
	__stringify(IPA_CLIENT_HSIC3_CONS),
	__stringify(IPA_CLIENT_USB3_CONS),
	__stringify(IPA_CLIENT_WLAN3_CONS),
	__stringify(IPA_CLIENT_HSIC4_CONS),
	__stringify(IPA_CLIENT_USB4_CONS),
	__stringify(IPA_CLIENT_WLAN4_CONS),
	__stringify(IPA_CLIENT_HSIC5_CONS),
	__stringify(IPA_CLIENT_USB_CONS),
	__stringify(IPA_CLIENT_USB_DPL_CONS),
	__stringify(IPA_CLIENT_A2_EMBEDDED_CONS),
	__stringify(IPA_CLIENT_A2_TETHERED_CONS),
	__stringify(IPA_CLIENT_A5_LAN_WAN_CONS),
	__stringify(IPA_CLIENT_APPS_LAN_CONS),
	__stringify(IPA_CLIENT_APPS_WAN_CONS),
	__stringify(IPA_CLIENT_ODU_EMB_CONS),
	__stringify(IPA_CLIENT_ODU_TETH_CONS),
	__stringify(IPA_CLIENT_MHI_CONS),
	__stringify(IPA_CLIENT_Q6_LAN_CONS),
	__stringify(IPA_CLIENT_Q6_WAN_CONS),
	__stringify(IPA_CLIENT_Q6_DUN_CONS),
	__stringify(IPA_CLIENT_MEMCPY_DMA_SYNC_CONS),
	__stringify(IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS),
	__stringify(IPA_CLIENT_Q6_DECOMP_CONS),
	__stringify(IPA_CLIENT_Q6_DECOMP2_CONS),
	__stringify(IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS),
	/* Below CONS client type is only for test purpose */
	__stringify(IPA_CLIENT_TEST_CONS),
	__stringify(IPA_CLIENT_TEST1_CONS),
	__stringify(IPA_CLIENT_TEST2_CONS),
	__stringify(IPA_CLIENT_TEST3_CONS),
	__stringify(IPA_CLIENT_TEST4_CONS),
};


/**
 * ipa_connect() - low-level IPA client connect
@@ -1458,314 +1530,6 @@ int ipa_uc_dereg_rdyCB(void)
}
EXPORT_SYMBOL(ipa_uc_dereg_rdyCB);

/**
 * ipa_rm_create_resource() - create resource
 * @create_params: [in] parameters needed
 *                  for resource initialization
 *
 * Returns: 0 on success, negative on failure
 *
 * This function is called by IPA RM client to initialize client's resources.
 * This API should be called before any other IPA RM API on a given resource
 * name.
 *
 */
int ipa_rm_create_resource(struct ipa_rm_create_params *create_params)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_create_resource, create_params);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_create_resource);

/**
 * ipa_rm_delete_resource() - delete resource
 * @resource_name: name of resource to be deleted
 *
 * Returns: 0 on success, negative on failure
 *
 * This function is called by IPA RM client to delete client's resources.
 *
 */
int ipa_rm_delete_resource(enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_delete_resource, resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_delete_resource);

/**
 * ipa_rm_add_dependency() - create dependency
 *					between 2 resources
 * @resource_name: name of dependent resource
 * @depends_on_name: name of its dependency
 *
 * Returns: 0 on success, negative on failure
 *
 * Side effects: IPA_RM_RESORCE_GRANTED could be generated
 * in case client registered with IPA RM
 */
int ipa_rm_add_dependency(enum ipa_rm_resource_name resource_name,
			enum ipa_rm_resource_name depends_on_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_add_dependency, resource_name,
		depends_on_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_add_dependency);

/**
 * ipa_rm_delete_dependency() - create dependency
 *					between 2 resources
 * @resource_name: name of dependent resource
 * @depends_on_name: name of its dependency
 *
 * Returns: 0 on success, negative on failure
 *
 * Side effects: IPA_RM_RESORCE_GRANTED could be generated
 * in case client registered with IPA RM
 */
int ipa_rm_delete_dependency(enum ipa_rm_resource_name resource_name,
			enum ipa_rm_resource_name depends_on_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_delete_dependency, resource_name,
		depends_on_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_delete_dependency);

/**
 * ipa_rm_request_resource() - request resource
 * @resource_name: [in] name of the requested resource
 *
 * Returns: 0 on success, negative on failure
 *
 * All registered callbacks are called with IPA_RM_RESOURCE_GRANTED
 * on successful completion of this operation.
 */
int ipa_rm_request_resource(enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_request_resource, resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_request_resource);

/**
 * ipa_rm_release_resource() - release resource
 * @resource_name: [in] name of the requested resource
 *
 * Returns: 0 on success, negative on failure
 *
 * All registered callbacks are called with IPA_RM_RESOURCE_RELEASED
 * on successful completion of this operation.
 */
int ipa_rm_release_resource(enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_release_resource, resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_release_resource);

/**
 * ipa_rm_register() - register for event
 * @resource_name: resource name
 * @reg_params: [in] registration parameters
 *
 * Returns: 0 on success, negative on failure
 *
 * Registration parameters provided here should be the same
 * as provided later in  ipa_rm_deregister() call.
 */
int ipa_rm_register(enum ipa_rm_resource_name resource_name,
			struct ipa_rm_register_params *reg_params)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_register, resource_name, reg_params);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_register);

/**
 * ipa_rm_deregister() - cancel the registration
 * @resource_name: resource name
 * @reg_params: [in] registration parameters
 *
 * Returns: 0 on success, negative on failure
 *
 * Registration parameters provided here should be the same
 * as provided in  ipa_rm_register() call.
 */
int ipa_rm_deregister(enum ipa_rm_resource_name resource_name,
			struct ipa_rm_register_params *reg_params)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_deregister, resource_name, reg_params);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_deregister);

/**
 * ipa_rm_set_perf_profile() - set performance profile
 * @resource_name: resource name
 * @profile: [in] profile information.
 *
 * Returns: 0 on success, negative on failure
 *
 * Set resource performance profile.
 * Updates IPA driver if performance level changed.
 */
int ipa_rm_set_perf_profile(enum ipa_rm_resource_name resource_name,
			struct ipa_rm_perf_profile *profile)
{
	int ret;

	IPA_API_DISPATCH_RETURN(
		ipa_rm_set_perf_profile,
		resource_name,
		profile);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_set_perf_profile);

/**
 * ipa_rm_notify_completion() -
 *	consumer driver notification for
 *	request_resource / release_resource operations
 *	completion
 * @event: notified event
 * @resource_name: resource name
 *
 * Returns: 0 on success, negative on failure
 */
int ipa_rm_notify_completion(enum ipa_rm_event event,
		enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_notify_completion, event, resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_notify_completion);

/**
* ipa_rm_inactivity_timer_init() - Init function for IPA RM
* inactivity timer. This function shall be called prior calling
* any other API of IPA RM inactivity timer.
*
* @resource_name: Resource name. @see ipa_rm.h
* @msecs: time in miliseccond, that IPA RM inactivity timer
* shall wait prior calling to ipa_rm_release_resource().
*
* Return codes:
* 0: success
* -EINVAL: invalid parameters
*/
int ipa_rm_inactivity_timer_init(enum ipa_rm_resource_name resource_name,
	unsigned long msecs)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_inactivity_timer_init, resource_name,
		msecs);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_inactivity_timer_init);

/**
* ipa_rm_inactivity_timer_destroy() - De-Init function for IPA
* RM inactivity timer.
*
* @resource_name: Resource name. @see ipa_rm.h
*
* Return codes:
* 0: success
* -EINVAL: invalid parameters
*/
int ipa_rm_inactivity_timer_destroy(enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_inactivity_timer_destroy, resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_inactivity_timer_destroy);

/**
* ipa_rm_inactivity_timer_request_resource() - Same as
* ipa_rm_request_resource(), with a difference that calling to
* this function will also cancel the inactivity timer, if
* ipa_rm_inactivity_timer_release_resource() was called earlier.
*
* @resource_name: Resource name. @see ipa_rm.h
*
* Return codes:
* 0: success
* -EINVAL: invalid parameters
*/
int ipa_rm_inactivity_timer_request_resource(
	enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_inactivity_timer_request_resource,
		resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_inactivity_timer_request_resource);

/**
* ipa_rm_inactivity_timer_release_resource() - Sets the
* inactivity timer to the timeout set by
* ipa_rm_inactivity_timer_init(). When the timeout expires, IPA
* RM inactivity timer will call to ipa_rm_release_resource().
* If a call to ipa_rm_inactivity_timer_request_resource() was
* made BEFORE the timout has expired, rge timer will be
* cancelled.
*
* @resource_name: Resource name. @see ipa_rm.h
*
* Return codes:
* 0: success
* -EINVAL: invalid parameters
*/
int ipa_rm_inactivity_timer_release_resource(
	enum ipa_rm_resource_name resource_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_inactivity_timer_release_resource,
		resource_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_inactivity_timer_release_resource);

/**
* teth_bridge_init() - Initialize the Tethering bridge driver
* @params - in/out params for USB initialization API (please look at struct
@@ -2430,31 +2194,6 @@ int ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
}
EXPORT_SYMBOL(ipa_disable_apps_wan_cons_deaggr);

/**
 * ipa_rm_add_dependency_sync() - Create a dependency between 2 resources
 * in a synchronized fashion. In case a producer resource is in GRANTED state
 * and the newly added consumer resource is in RELEASED state, the consumer
 * entity will be requested and the function will block until the consumer
 * is granted.
 * @resource_name: name of dependent resource
 * @depends_on_name: name of its dependency
 *
 * Returns: 0 on success, negative on failure
 *
 * Side effects: May block. See documentation above.
 */
int ipa_rm_add_dependency_sync(enum ipa_rm_resource_name resource_name,
		enum ipa_rm_resource_name depends_on_name)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_rm_add_dependency_sync, resource_name,
		depends_on_name);

	return ret;
}
EXPORT_SYMBOL(ipa_rm_add_dependency_sync);

/**
 * ipa_get_dma_dev()- Returns ipa_ctx dma dev pointer
 *
@@ -2634,6 +2373,136 @@ int ipa_register_ipa_ready_cb(void (*ipa_ready_cb)(void *user_data),
}
EXPORT_SYMBOL(ipa_register_ipa_ready_cb);

/**
 * ipa_inc_client_enable_clks() - Increase active clients counter, and
 * enable ipa clocks if necessary
 *
 * Please do not use this API, use the wrapper macros instead (ipa_i.h)
 * IPA_ACTIVE_CLIENTS_INC_XXX();
 *
 * Return codes:
 * None
*/
void ipa_inc_client_enable_clks(struct ipa_active_client_logging_info *id)
{
	IPA_API_DISPATCH(ipa_inc_client_enable_clks, id);
}
EXPORT_SYMBOL(ipa_inc_client_enable_clks);

/**
 * ipa_dec_client_disable_clks() - Increase active clients counter, and
 * enable ipa clocks if necessary
 *
 * Please do not use this API, use the wrapper macros instead (ipa_i.h)
 * IPA_ACTIVE_CLIENTS_DEC_XXX();
 *
 * Return codes:
 * None
*/
void ipa_dec_client_disable_clks(struct ipa_active_client_logging_info *id)
{
	IPA_API_DISPATCH(ipa_dec_client_disable_clks, id);
}
EXPORT_SYMBOL(ipa_dec_client_disable_clks);

/**
 * ipa_inc_client_enable_clks_no_block() - Only increment the number of active
 * clients if no asynchronous actions should be done.Asynchronous actions are
 * locking a mutex and waking up IPA HW.
 *
 * Please do not use this API, use the wrapper macros instead(ipa_i.h)
 *
 *
 * Return codes : 0 for success
 *		-EPERM if an asynchronous action should have been done
 */
int ipa_inc_client_enable_clks_no_block(
	struct ipa_active_client_logging_info *id)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_inc_client_enable_clks_no_block, id);

	return ret;
}
EXPORT_SYMBOL(ipa_inc_client_enable_clks_no_block);

/**
* ipa_suspend_resource_no_block() - suspend client endpoints related to the
* IPA_RM resource and decrement active clients counter. This function is
* guaranteed to avoid sleeping.
*
* @resource: [IN] IPA Resource Manager resource
*
* Return codes: 0 on success, negative on failure.
*/
int ipa_suspend_resource_no_block(enum ipa_rm_resource_name resource)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_suspend_resource_no_block, resource);

	return ret;
}
EXPORT_SYMBOL(ipa_suspend_resource_no_block);
/**
 * ipa_resume_resource() - resume client endpoints related to the IPA_RM
 * resource.
 *
 * @resource: [IN] IPA Resource Manager resource
 *
 * Return codes: 0 on success, negative on failure.
 */
int ipa_resume_resource(enum ipa_rm_resource_name resource)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_resume_resource, resource);

	return ret;
}
EXPORT_SYMBOL(ipa_resume_resource);

/**
 * ipa_suspend_resource_sync() - suspend client endpoints related to the IPA_RM
 * resource and decrement active clients counter, which may result in clock
 * gating of IPA clocks.
 *
 * @resource: [IN] IPA Resource Manager resource
 *
 * Return codes: 0 on success, negative on failure.
 */
int ipa_suspend_resource_sync(enum ipa_rm_resource_name resource)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_suspend_resource_sync, resource);

	return ret;
}
EXPORT_SYMBOL(ipa_suspend_resource_sync);

/**
 * ipa_set_required_perf_profile() - set IPA to the specified performance
 *	profile based on the bandwidth, unless minimum voltage required is
 *	higher. In this case the floor_voltage specified will be used.
 * @floor_voltage: minimum voltage to operate
 * @bandwidth_mbps: needed bandwidth from IPA
 *
 * Return codes: 0 on success, negative on failure.
 */
int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
	u32 bandwidth_mbps)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_set_required_perf_profile, floor_voltage,
		bandwidth_mbps);

	return ret;
}
EXPORT_SYMBOL(ipa_set_required_perf_profile);

static const struct dev_pm_ops ipa_pm_ops = {
	.suspend_noirq = ipa_ap_suspend,
	.resume_noirq = ipa_ap_resume,
+21 −43
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@
 * GNU General Public License for more details.
 */

#include "ipa_common_i.h"

#ifndef _IPA_API_H_
#define _IPA_API_H_

@@ -183,45 +185,6 @@ struct ipa_api_controller {

	int (*ipa_uc_dereg_rdyCB)(void);

	int (*ipa_rm_create_resource)(
		struct ipa_rm_create_params *create_params);

	int (*ipa_rm_delete_resource)(enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_register)(enum ipa_rm_resource_name resource_name,
		struct ipa_rm_register_params *reg_params);

	int (*ipa_rm_deregister)(enum ipa_rm_resource_name resource_name,
		struct ipa_rm_register_params *reg_params);

	int (*ipa_rm_set_perf_profile)(enum ipa_rm_resource_name resource_name,
		struct ipa_rm_perf_profile *profile);

	int (*ipa_rm_add_dependency)(enum ipa_rm_resource_name resource_name,
		enum ipa_rm_resource_name depends_on_name);

	int (*ipa_rm_delete_dependency)(enum ipa_rm_resource_name resource_name,
			enum ipa_rm_resource_name depends_on_name);

	int (*ipa_rm_request_resource)(enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_release_resource)(enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_notify_completion)(enum ipa_rm_event event,
		enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_inactivity_timer_init)(enum ipa_rm_resource_name
		resource_name, unsigned long msecs);

	int (*ipa_rm_inactivity_timer_destroy)(
		enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_inactivity_timer_request_resource)(
		enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_inactivity_timer_release_resource)(
				enum ipa_rm_resource_name resource_name);

	int (*teth_bridge_init)(struct teth_bridge_init_params *params);

	int (*teth_bridge_disconnect)(enum ipa_client_type client);
@@ -308,10 +271,6 @@ struct ipa_api_controller {
	int (*ipa_disable_apps_wan_cons_deaggr)(uint32_t agg_size,
						uint32_t agg_count);

	int (*ipa_rm_add_dependency_sync)(
		enum ipa_rm_resource_name resource_name,
		enum ipa_rm_resource_name depends_on_name);

	struct device *(*ipa_get_dma_dev)(void);

	int (*ipa_release_wdi_mapping)(u32 num_buffers,
@@ -325,6 +284,25 @@ struct ipa_api_controller {
	int (*ipa_register_ipa_ready_cb)(void (*ipa_ready_cb)(void *user_data),
		void *user_data);

	void (*ipa_inc_client_enable_clks)(
		struct ipa_active_client_logging_info *id);

	void (*ipa_dec_client_disable_clks)(
		struct ipa_active_client_logging_info *id);

	int (*ipa_inc_client_enable_clks_no_block)(
		struct ipa_active_client_logging_info *id);

	int (*ipa_suspend_resource_no_block)(
		enum ipa_rm_resource_name resource);

	int (*ipa_resume_resource)(enum ipa_rm_resource_name name);

	int (*ipa_suspend_resource_sync)(enum ipa_rm_resource_name resource);

	int (*ipa_set_required_perf_profile)(
		enum ipa_voltage_level floor_voltage, u32 bandwidth_mbps);

};

#ifdef CONFIG_IPA
+20 −19
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/rndis_ipa.h>
#include <linux/ecm_ipa.h>
#include "../ipa_v3/ipa_i.h"
#include "../ipa_rm_i.h"

#define IPA_USB_RM_TIMEOUT_MSEC 10000
#define IPA_USB_DEV_READY_TIMEOUT_MSEC 10000
@@ -394,7 +395,7 @@ static bool ipa3_usb_set_state(enum ipa3_usb_state new_state, bool err_permit,
		}
		/* Notify RM that consumer is granted */
		if (rm_ctx->cons_requested) {
			ipa3_rm_notify_completion(
			ipa_rm_notify_completion(
				IPA_RM_RESOURCE_GRANTED,
				rm_ctx->cons_params.name);
			rm_ctx->cons_state = IPA_USB_CONS_GRANTED;
@@ -529,12 +530,12 @@ static void ipa3_usb_prod_notify_cb_do(enum ipa_rm_event event,
	switch (event) {
	case IPA_RM_RESOURCE_GRANTED:
		IPA_USB_DBG(":%s granted\n",
			ipa3_rm_resource_str(rm_ctx->prod_params.name));
			ipa_rm_resource_str(rm_ctx->prod_params.name));
		complete_all(&rm_ctx->prod_comp);
		break;
	case IPA_RM_RESOURCE_RELEASED:
		IPA_USB_DBG(":%s released\n",
			ipa3_rm_resource_str(rm_ctx->prod_params.name));
			ipa_rm_resource_str(rm_ctx->prod_params.name));
		complete_all(&rm_ctx->prod_comp);
		break;
	}
@@ -824,13 +825,13 @@ static int ipa3_usb_create_rm_resources(enum ipa3_usb_transport_type ttype)
		result = ipa_rm_create_resource(&rm_ctx->prod_params);
		if (result) {
			IPA_USB_ERR("Failed to create %s RM resource\n",
				ipa3_rm_resource_str(rm_ctx->prod_params.name));
				ipa_rm_resource_str(rm_ctx->prod_params.name));
			return result;
		}
		rm_ctx->prod_valid = true;
		created = true;
		IPA_USB_DBG("Created %s RM resource\n",
			ipa3_rm_resource_str(rm_ctx->prod_params.name));
			ipa_rm_resource_str(rm_ctx->prod_params.name));
	}

	/* Create CONS */
@@ -852,12 +853,12 @@ static int ipa3_usb_create_rm_resources(enum ipa3_usb_transport_type ttype)
		result = ipa_rm_create_resource(&rm_ctx->cons_params);
		if (result) {
			IPA_USB_ERR("Failed to create %s RM resource\n",
				ipa3_rm_resource_str(rm_ctx->cons_params.name));
				ipa_rm_resource_str(rm_ctx->cons_params.name));
			goto create_cons_rsc_fail;
		}
		rm_ctx->cons_valid = true;
		IPA_USB_DBG("Created %s RM resource\n",
			ipa3_rm_resource_str(rm_ctx->cons_params.name));
			ipa_rm_resource_str(rm_ctx->cons_params.name));
	}

	return 0;
@@ -1298,11 +1299,11 @@ static int ipa3_usb_request_prod(enum ipa3_usb_transport_type ttype)
	const char *rsrc_str;

	rm_ctx = &ipa3_usb_ctx->ttype_ctx[ttype].rm_ctx;
	rsrc_str = ipa3_rm_resource_str(rm_ctx->prod_params.name);
	rsrc_str = ipa_rm_resource_str(rm_ctx->prod_params.name);

	IPA_USB_DBG_LOW("requesting %s\n", rsrc_str);
	init_completion(&rm_ctx->prod_comp);
	result = ipa3_rm_request_resource(rm_ctx->prod_params.name);
	result = ipa_rm_request_resource(rm_ctx->prod_params.name);
	if (result) {
		if (result != -EINPROGRESS) {
			IPA_USB_ERR("failed to request %s: %d\n",
@@ -1328,7 +1329,7 @@ static int ipa3_usb_release_prod(enum ipa3_usb_transport_type ttype)
	const char *rsrc_str;

	rm_ctx = &ipa3_usb_ctx->ttype_ctx[ttype].rm_ctx;
	rsrc_str = ipa3_rm_resource_str(rm_ctx->prod_params.name);
	rsrc_str = ipa_rm_resource_str(rm_ctx->prod_params.name);

	IPA_USB_DBG_LOW("releasing %s\n", rsrc_str);

@@ -1408,10 +1409,10 @@ static int ipa3_usb_connect_dpl(void)
	 * is sync in order to make sure the IPA clocks are up before we
	 * continue and notify the USB driver it may continue.
	 */
	res = ipa3_rm_add_dependency_sync(IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD,
	res = ipa_rm_add_dependency_sync(IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD,
				    IPA_RM_RESOURCE_Q6_CONS);
	if (res < 0) {
		IPA_USB_ERR("ipa3_rm_add_dependency_sync() failed.\n");
		IPA_USB_ERR("ipa_rm_add_dependency_sync() failed.\n");
		return res;
	}

@@ -1420,11 +1421,11 @@ static int ipa3_usb_connect_dpl(void)
	 * status is connected (which can happen only later in the flow),
	 * the clocks are already up so the call doesn't need to block.
	 */
	res = ipa3_rm_add_dependency(IPA_RM_RESOURCE_Q6_PROD,
	res = ipa_rm_add_dependency(IPA_RM_RESOURCE_Q6_PROD,
				    IPA_RM_RESOURCE_USB_DPL_CONS);
	if (res < 0 && res != -EINPROGRESS) {
		IPA_USB_ERR("ipa3_rm_add_dependency() failed.\n");
		ipa3_rm_delete_dependency(IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD,
		IPA_USB_ERR("ipa_rm_add_dependency() failed.\n");
		ipa_rm_delete_dependency(IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD,
				IPA_RM_RESOURCE_Q6_CONS);
		return res;
	}
@@ -1590,12 +1591,12 @@ static int ipa3_usb_disconnect_dpl(void)
	int res;

	/* Remove DPL RM dependency */
	res = ipa3_rm_delete_dependency(IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD,
	res = ipa_rm_delete_dependency(IPA_RM_RESOURCE_USB_DPL_DUMMY_PROD,
				    IPA_RM_RESOURCE_Q6_CONS);
	if (res)
		IPA_USB_ERR("deleting DPL_DUMMY_PROD rsrc dependency fail\n");

	res = ipa3_rm_delete_dependency(IPA_RM_RESOURCE_Q6_PROD,
	res = ipa_rm_delete_dependency(IPA_RM_RESOURCE_Q6_PROD,
				 IPA_RM_RESOURCE_USB_DPL_CONS);
	if (res)
		IPA_USB_ERR("deleting DPL_CONS rsrc dependencty fail\n");
@@ -1716,7 +1717,7 @@ static int ipa3_usb_xdci_connect_internal(
		&profile);
	if (result) {
		IPA_USB_ERR("failed to set %s perf profile\n",
			ipa3_rm_resource_str(ipa3_usb_ctx->ttype_ctx[ttype].
			ipa_rm_resource_str(ipa3_usb_ctx->ttype_ctx[ttype].
				rm_ctx.prod_params.name));
		return result;
	}
@@ -1725,7 +1726,7 @@ static int ipa3_usb_xdci_connect_internal(
		&profile);
	if (result) {
		IPA_USB_ERR("failed to set %s perf profile\n",
			ipa3_rm_resource_str(ipa3_usb_ctx->ttype_ctx[ttype].
			ipa_rm_resource_str(ipa3_usb_ctx->ttype_ctx[ttype].
				rm_ctx.cons_params.name));
		return result;
	}
+128 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading