diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi_proxy.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi_proxy.c index c71f443946..66532cefd0 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi_proxy.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi_proxy.c @@ -8,7 +8,12 @@ #include #include #include +#include #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) +#include +#include +#endif #include "ipa_qmi_service.h" #include "ipa_common_i.h" #include "ipa_i.h" @@ -64,7 +69,11 @@ static const struct mhi_device_id mhi_driver_match_table[] = { static int imp_mhi_probe_cb(struct mhi_device *, const struct mhi_device_id *); static void imp_mhi_remove_cb(struct mhi_device *); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) +static void imp_mhi_status_cb(struct mhi_device *, enum mhi_callback); +#else static void imp_mhi_status_cb(struct mhi_device *, enum MHI_CB); +#endif static struct mhi_driver mhi_driver = { .id_table = mhi_driver_match_table, @@ -510,14 +519,22 @@ struct ipa_mhi_alloc_channel_resp_msg_v01 *imp_handle_allocate_channel_req( if (imp_ctx->dev_info.smmu_enabled) { /* map CTRL */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.ctrl, req->ctrl_addr_map_info_len, req->ctrl_addr_map_info, true); /* map DATA */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.data, req->data_addr_map_info_len, req->data_addr_map_info, @@ -573,14 +590,22 @@ struct ipa_mhi_alloc_channel_resp_msg_v01 *imp_handle_allocate_channel_req( fail_smmu: if (imp_ctx->dev_info.smmu_enabled) { /* unmap CTRL */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.ctrl, req->ctrl_addr_map_info_len, req->ctrl_addr_map_info, false); /* unmap DATA */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.data, req->data_addr_map_info_len, req->data_addr_map_info, @@ -641,8 +666,13 @@ struct ipa_mhi_clk_vote_resp_msg_v01 * executed from mhi context. */ if (vote) { + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + pm_runtime_get_sync(imp_ctx->md.mhi_dev->dev.parent->parent); + ret = mhi_device_get_sync(imp_ctx->md.mhi_dev); + #else ret = mhi_device_get_sync(imp_ctx->md.mhi_dev, - MHI_VOTE_BUS | MHI_VOTE_DEVICE); + MHI_VOTE_BUS | MHI_VOTE_DEVICE); + #endif if (ret) { IMP_ERR("mhi_sync_get failed %d\n", ret); resp->resp.result = IPA_QMI_RESULT_FAILURE_V01; @@ -652,8 +682,13 @@ struct ipa_mhi_clk_vote_resp_msg_v01 return resp; } } else { + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + mhi_device_put(imp_ctx->md.mhi_dev); + pm_runtime_put(imp_ctx->md.mhi_dev->dev.parent->parent); + #else mhi_device_put(imp_ctx->md.mhi_dev, MHI_VOTE_BUS | MHI_VOTE_DEVICE); + #endif } mutex_lock(&imp_ctx->mutex); @@ -700,21 +735,34 @@ static void imp_mhi_shutdown(void) = &imp_ctx->qmi.alloc_ch_req; /* unmap CTRL */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.ctrl, creq->ctrl_addr_map_info_len, creq->ctrl_addr_map_info, false); /* unmap DATA */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.data, creq->data_addr_map_info_len, creq->data_addr_map_info, false); } if (imp_ctx->lpm_disabled) { - mhi_device_put(imp_ctx->md.mhi_dev, MHI_VOTE_BUS); + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + pm_runtime_put(imp_ctx->md.mhi_dev->dev.parent->parent); + #else + mhi_device_put(imp_ctx->md.mhi_dev, + MHI_VOTE_BUS); + #endif imp_ctx->lpm_disabled = false; } @@ -870,7 +918,11 @@ static void imp_mhi_remove_cb(struct mhi_device *mhi_dev) IMP_FUNC_EXIT(); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) +static void imp_mhi_status_cb(struct mhi_device *mhi_dev, enum mhi_callback mhi_cb) +#else static void imp_mhi_status_cb(struct mhi_device *mhi_dev, enum MHI_CB mhi_cb) +#endif { IMP_DBG("%d\n", mhi_cb); @@ -1062,14 +1114,22 @@ void imp_handle_modem_shutdown(void) = &imp_ctx->qmi.alloc_ch_req; /* unmap CTRL */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.ctrl, creq->ctrl_addr_map_info_len, creq->ctrl_addr_map_info, false); /* unmap DATA */ + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent->parent, + #else __map_smmu_info(imp_ctx->md.mhi_dev->dev.parent, + #endif &imp_ctx->dev_info.data, creq->data_addr_map_info_len, creq->data_addr_map_info, diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c index 7a65b7ce8c..f82e275b89 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c @@ -9,6 +9,11 @@ #include #include #include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) +#include +#include +#endif #include #include #include @@ -419,7 +424,11 @@ static struct platform_device *m_pdev; static int ipa_mpm_mhi_probe_cb(struct mhi_device *, const struct mhi_device_id *); static void ipa_mpm_mhi_remove_cb(struct mhi_device *); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) +static void ipa_mpm_mhi_status_cb(struct mhi_device *, enum mhi_callback); +#else static void ipa_mpm_mhi_status_cb(struct mhi_device *, enum MHI_CB); +#endif static void ipa_mpm_change_teth_state(int probe_id, enum ipa_mpm_teth_state ip_state); static void ipa_mpm_change_gsi_state(int probe_id, @@ -1513,9 +1522,15 @@ static int ipa_mpm_vote_unvote_pcie_clk(enum ipa_mpm_clk_vote_type vote, atomic_read(&ipa_mpm_ctx->md[probe_id].clk_cnt.pcie_clk_cnt)); if (vote == CLK_ON) { + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + pm_runtime_get_sync(ipa_mpm_ctx->mhi_parent_dev); + result = mhi_device_get_sync( + ipa_mpm_ctx->md[probe_id].mhi_dev); + #else result = mhi_device_get_sync( ipa_mpm_ctx->md[probe_id].mhi_dev, MHI_VOTE_BUS | MHI_VOTE_DEVICE); + #endif if (result) { IPA_MPM_ERR("mhi_sync_get failed for probe_id %d\n", result, probe_id); @@ -1536,8 +1551,13 @@ static int ipa_mpm_vote_unvote_pcie_clk(enum ipa_mpm_clk_vote_type vote, *is_acted = true; return 0; } + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + mhi_device_put(ipa_mpm_ctx->md[probe_id].mhi_dev); + pm_runtime_put(ipa_mpm_ctx->mhi_parent_dev); + #else mhi_device_put(ipa_mpm_ctx->md[probe_id].mhi_dev, - MHI_VOTE_BUS | MHI_VOTE_DEVICE); + MHI_VOTE_BUS | MHI_VOTE_DEVICE); + #endif IPA_MPM_DBG("probe_id %d PCIE clock off\n", probe_id); atomic_dec(&ipa_mpm_ctx->md[probe_id].clk_cnt.pcie_clk_cnt); atomic_dec(&ipa_mpm_ctx->pcie_clk_total_cnt); @@ -2152,8 +2172,11 @@ static int ipa_mpm_mhi_probe_cb(struct mhi_device *mhi_dev, */ ipa_mpm_ctx->md[probe_id].mhi_dev = mhi_dev; ipa_mpm_ctx->mhi_parent_dev = + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + ipa_mpm_ctx->md[probe_id].mhi_dev->dev.parent->parent; + #else ipa_mpm_ctx->md[probe_id].mhi_dev->dev.parent; - + #endif mutex_lock(&ipa_mpm_ctx->md[probe_id].mhi_mutex); ipa_mpm_ctx->md[probe_id].remote_state = MPM_MHIP_REMOTE_STOP; mutex_unlock(&ipa_mpm_ctx->md[probe_id].mhi_mutex); @@ -2637,7 +2660,11 @@ static void ipa_mpm_mhi_remove_cb(struct mhi_device *mhi_dev) } static void ipa_mpm_mhi_status_cb(struct mhi_device *mhi_dev, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) + enum mhi_callback mhi_cb) +#else enum MHI_CB mhi_cb) +#endif { int mhip_idx; enum mhip_status_type status;