msm: ipa: update the MHI Prime/MHI Proxy API

API update for MHI Prime/Proxy.

Change-Id: I2888468ee9592e1b9045af19ce58205f3c8e5416
This commit is contained in:
Bojun Pan
2021-02-26 15:27:20 -08:00
کامیت شده توسط Gerrit - the friendly Code Review server
والد 1ab18b622f
کامیت dd8ad88cf9
2فایلهای تغییر یافته به همراه91 افزوده شده و 4 حذف شده

مشاهده پرونده

@@ -8,7 +8,12 @@
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/mhi.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
#include <linux/mhi_misc.h>
#include <linux/pm_runtime.h>
#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,

مشاهده پرونده

@@ -9,6 +9,11 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/mhi.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
#include <linux/mhi_misc.h>
#include <linux/pm_runtime.h>
#endif
#include <linux/msm_gsi.h>
#include <linux/delay.h>
#include <linux/log2.h>
@@ -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;