Loading drivers/platform/msm/ipa/ipa_api.c +14 −0 Original line number Diff line number Diff line Loading @@ -3514,6 +3514,20 @@ int ipa_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info, u16 num_regs) return ret; } void ipa_register_client_callback(int (*client_cb)(bool is_lock), bool (*teth_port_state)(void), u32 ipa_ep_idx) { IPA_API_DISPATCH(ipa_register_client_callback, client_cb, teth_port_state, ipa_ep_idx); } void ipa_deregister_client_callback(u32 ipa_ep_idx) { IPA_API_DISPATCH(ipa_deregister_client_callback, ipa_ep_idx); } /** * ipa_pm_is_used() - Returns if IPA PM framework is used */ Loading drivers/platform/msm/ipa/ipa_api.h +6 −0 Original line number Diff line number Diff line Loading @@ -447,6 +447,12 @@ struct ipa_api_controller { int (*ipa_enable_wigig_pipe_i)(enum ipa_client_type client); int (*ipa_disable_wigig_pipe_i)(enum ipa_client_type client); void (*ipa_register_client_callback)( int (*client_cb)(bool is_lock), bool (*teth_port_state)(void), u32 ipa_ep_idx); void (*ipa_deregister_client_callback)(u32 ipa_ep_idx); }; #ifdef CONFIG_IPA3 Loading drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c +32 −2 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ struct ipa_mhi_client_ctx { }; static struct ipa_mhi_client_ctx *ipa_mhi_client_ctx; static DEFINE_MUTEX(mhi_client_general_mutex); #ifdef CONFIG_DEBUG_FS #define IPA_MHI_MAX_MSG_LEN 512 Loading @@ -176,6 +177,18 @@ static char *ipa_mhi_channel_state_str[] = { ipa_mhi_channel_state_str[(state)] : \ "INVALID") static int ipa_mhi_set_lock_unlock(bool is_lock) { IPA_MHI_DBG("entry\n"); if (is_lock) mutex_lock(&mhi_client_general_mutex); else mutex_unlock(&mhi_client_general_mutex); IPA_MHI_DBG("exit\n"); return 0; } static int ipa_mhi_read_write_host(enum ipa_mhi_dma_dir dir, void *dev_addr, u64 host_addr, int size) { Loading Loading @@ -1589,6 +1602,7 @@ 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); Loading @@ -1604,6 +1618,8 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl) sizeof(((struct ipa_mhi_ch_ctx *)0)->chstate)); if (res) { IPA_MHI_ERR("ipa_mhi_read_write_host failed\n"); mutex_unlock(&mhi_client_general_mutex); IPA_ACTIVE_CLIENTS_DEC_EP(in->sys.client); return res; } Loading @@ -1623,6 +1639,12 @@ 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) IPA_ACTIVE_CLIENTS_DEC_EP(in->sys.client); Loading @@ -1630,6 +1652,7 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl) return 0; fail_connect_pipe: mutex_unlock(&mhi_client_general_mutex); ipa_mhi_reset_channel(channel); fail_start_channel: IPA_ACTIVE_CLIENTS_DEC_EP(in->sys.client); Loading Loading @@ -1684,19 +1707,27 @@ int ipa_mhi_disconnect_pipe(u32 clnt_hdl) goto fail_reset_channel; } mutex_lock(&mhi_client_general_mutex); res = ipa_disconnect_mhi_pipe(clnt_hdl); if (res) { IPA_MHI_ERR( "IPA core driver failed to disconnect the pipe hdl %d, res %d" , clnt_hdl, res); return 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)); IPA_MHI_DBG("client (ep: %d) disconnected\n", clnt_hdl); IPA_MHI_FUNC_EXIT(); return 0; fail_disconnect_pipe: mutex_unlock(&mhi_client_general_mutex); fail_reset_channel: IPA_ACTIVE_CLIENTS_DEC_EP(ipa_get_client_mapping(clnt_hdl)); return res; Loading Loading @@ -2863,6 +2894,5 @@ const char *ipa_mhi_get_state_str(int state) return MHI_STATE_STR(state); } EXPORT_SYMBOL(ipa_mhi_get_state_str); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("IPA MHI client driver"); drivers/platform/msm/ipa/ipa_common_i.h +5 −0 Original line number Diff line number Diff line Loading @@ -466,4 +466,9 @@ int ipa_wigig_send_msg(int msg_type, const char *netdev_name, u8 *mac, enum ipa_client_type client, bool to_wigig); void ipa_register_client_callback(int (*client_cb)(bool is_lock), bool (*teth_port_state)(void), u32 ipa_ep_idx); void ipa_deregister_client_callback(u32 ipa_ep_idx); #endif /* _IPA_COMMON_I_H_ */ drivers/platform/msm/ipa/ipa_v3/ipa.c +21 −12 Original line number Diff line number Diff line Loading @@ -2579,15 +2579,9 @@ void ipa3_q6_pre_shutdown_cleanup(void) ipa3_q6_pipe_delay(false); ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_USB_PROD); if (ipa3_ctx->ipa_config_is_mhi) ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_MHI_PROD); } else { ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_USB_PROD, false); if (ipa3_ctx->ipa_config_is_mhi) ipa3_start_stop_client_prod_gsi_chnl( IPA_CLIENT_MHI_PROD, false); } IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); Loading Loading @@ -2651,6 +2645,27 @@ void ipa3_q6_post_shutdown_cleanup(void) IPADBG_LOW("Exit with success\n"); } /** * ipa3_q6_pre_powerup_cleanup() - A cleanup routine for pheripheral * configuration in IPA HW. This is performed in case of SSR. * * This is a mandatory procedure, in case one of the steps fails, the * AP needs to restart. */ void ipa3_q6_pre_powerup_cleanup(void) { IPADBG_LOW("ENTER\n"); IPA_ACTIVE_CLIENTS_INC_SIMPLE(); if (ipa3_ctx->ipa_config_is_mhi) ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_MHI_PROD); IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); IPADBG_LOW("Exit with success\n"); } /* * ipa3_client_prod_post_shutdown_cleanup () - As part of this function * set end point delay client producer pipes and starting corresponding Loading @@ -2667,12 +2682,6 @@ void ipa3_client_prod_post_shutdown_cleanup(void) IPA_CLIENT_USB_PROD); ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_USB_PROD, true); if (ipa3_ctx->ipa_config_is_mhi) { ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_MHI_PROD); ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_MHI_PROD, true); } IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); IPADBG_LOW("Exit with success\n"); } Loading Loading
drivers/platform/msm/ipa/ipa_api.c +14 −0 Original line number Diff line number Diff line Loading @@ -3514,6 +3514,20 @@ int ipa_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info, u16 num_regs) return ret; } void ipa_register_client_callback(int (*client_cb)(bool is_lock), bool (*teth_port_state)(void), u32 ipa_ep_idx) { IPA_API_DISPATCH(ipa_register_client_callback, client_cb, teth_port_state, ipa_ep_idx); } void ipa_deregister_client_callback(u32 ipa_ep_idx) { IPA_API_DISPATCH(ipa_deregister_client_callback, ipa_ep_idx); } /** * ipa_pm_is_used() - Returns if IPA PM framework is used */ Loading
drivers/platform/msm/ipa/ipa_api.h +6 −0 Original line number Diff line number Diff line Loading @@ -447,6 +447,12 @@ struct ipa_api_controller { int (*ipa_enable_wigig_pipe_i)(enum ipa_client_type client); int (*ipa_disable_wigig_pipe_i)(enum ipa_client_type client); void (*ipa_register_client_callback)( int (*client_cb)(bool is_lock), bool (*teth_port_state)(void), u32 ipa_ep_idx); void (*ipa_deregister_client_callback)(u32 ipa_ep_idx); }; #ifdef CONFIG_IPA3 Loading
drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c +32 −2 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ struct ipa_mhi_client_ctx { }; static struct ipa_mhi_client_ctx *ipa_mhi_client_ctx; static DEFINE_MUTEX(mhi_client_general_mutex); #ifdef CONFIG_DEBUG_FS #define IPA_MHI_MAX_MSG_LEN 512 Loading @@ -176,6 +177,18 @@ static char *ipa_mhi_channel_state_str[] = { ipa_mhi_channel_state_str[(state)] : \ "INVALID") static int ipa_mhi_set_lock_unlock(bool is_lock) { IPA_MHI_DBG("entry\n"); if (is_lock) mutex_lock(&mhi_client_general_mutex); else mutex_unlock(&mhi_client_general_mutex); IPA_MHI_DBG("exit\n"); return 0; } static int ipa_mhi_read_write_host(enum ipa_mhi_dma_dir dir, void *dev_addr, u64 host_addr, int size) { Loading Loading @@ -1589,6 +1602,7 @@ 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); Loading @@ -1604,6 +1618,8 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl) sizeof(((struct ipa_mhi_ch_ctx *)0)->chstate)); if (res) { IPA_MHI_ERR("ipa_mhi_read_write_host failed\n"); mutex_unlock(&mhi_client_general_mutex); IPA_ACTIVE_CLIENTS_DEC_EP(in->sys.client); return res; } Loading @@ -1623,6 +1639,12 @@ 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) IPA_ACTIVE_CLIENTS_DEC_EP(in->sys.client); Loading @@ -1630,6 +1652,7 @@ int ipa_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl) return 0; fail_connect_pipe: mutex_unlock(&mhi_client_general_mutex); ipa_mhi_reset_channel(channel); fail_start_channel: IPA_ACTIVE_CLIENTS_DEC_EP(in->sys.client); Loading Loading @@ -1684,19 +1707,27 @@ int ipa_mhi_disconnect_pipe(u32 clnt_hdl) goto fail_reset_channel; } mutex_lock(&mhi_client_general_mutex); res = ipa_disconnect_mhi_pipe(clnt_hdl); if (res) { IPA_MHI_ERR( "IPA core driver failed to disconnect the pipe hdl %d, res %d" , clnt_hdl, res); return 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)); IPA_MHI_DBG("client (ep: %d) disconnected\n", clnt_hdl); IPA_MHI_FUNC_EXIT(); return 0; fail_disconnect_pipe: mutex_unlock(&mhi_client_general_mutex); fail_reset_channel: IPA_ACTIVE_CLIENTS_DEC_EP(ipa_get_client_mapping(clnt_hdl)); return res; Loading Loading @@ -2863,6 +2894,5 @@ const char *ipa_mhi_get_state_str(int state) return MHI_STATE_STR(state); } EXPORT_SYMBOL(ipa_mhi_get_state_str); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("IPA MHI client driver");
drivers/platform/msm/ipa/ipa_common_i.h +5 −0 Original line number Diff line number Diff line Loading @@ -466,4 +466,9 @@ int ipa_wigig_send_msg(int msg_type, const char *netdev_name, u8 *mac, enum ipa_client_type client, bool to_wigig); void ipa_register_client_callback(int (*client_cb)(bool is_lock), bool (*teth_port_state)(void), u32 ipa_ep_idx); void ipa_deregister_client_callback(u32 ipa_ep_idx); #endif /* _IPA_COMMON_I_H_ */
drivers/platform/msm/ipa/ipa_v3/ipa.c +21 −12 Original line number Diff line number Diff line Loading @@ -2579,15 +2579,9 @@ void ipa3_q6_pre_shutdown_cleanup(void) ipa3_q6_pipe_delay(false); ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_USB_PROD); if (ipa3_ctx->ipa_config_is_mhi) ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_MHI_PROD); } else { ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_USB_PROD, false); if (ipa3_ctx->ipa_config_is_mhi) ipa3_start_stop_client_prod_gsi_chnl( IPA_CLIENT_MHI_PROD, false); } IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); Loading Loading @@ -2651,6 +2645,27 @@ void ipa3_q6_post_shutdown_cleanup(void) IPADBG_LOW("Exit with success\n"); } /** * ipa3_q6_pre_powerup_cleanup() - A cleanup routine for pheripheral * configuration in IPA HW. This is performed in case of SSR. * * This is a mandatory procedure, in case one of the steps fails, the * AP needs to restart. */ void ipa3_q6_pre_powerup_cleanup(void) { IPADBG_LOW("ENTER\n"); IPA_ACTIVE_CLIENTS_INC_SIMPLE(); if (ipa3_ctx->ipa_config_is_mhi) ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_MHI_PROD); IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); IPADBG_LOW("Exit with success\n"); } /* * ipa3_client_prod_post_shutdown_cleanup () - As part of this function * set end point delay client producer pipes and starting corresponding Loading @@ -2667,12 +2682,6 @@ void ipa3_client_prod_post_shutdown_cleanup(void) IPA_CLIENT_USB_PROD); ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_USB_PROD, true); if (ipa3_ctx->ipa_config_is_mhi) { ipa3_set_reset_client_prod_pipe_delay(true, IPA_CLIENT_MHI_PROD); ipa3_start_stop_client_prod_gsi_chnl(IPA_CLIENT_MHI_PROD, true); } IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); IPADBG_LOW("Exit with success\n"); } Loading