msm: ipa: add api for getting IPA pdev
Add API intended for IPA kernel tests.
This API will allow kernel tests to use IPA driver
pdev struct by returning a pointer to this struct.
CRs-Fixed: 1077422
Change-Id: Ideeaa89f15b8895ce7256fed9f614d5c39ef105f
Signed-off-by: Amir Levy <alevy@codeaurora.org>
Signed-off-by: Gidon Studinski <gidons@codeaurora.org>
diff --git a/drivers/platform/msm/ipa/ipa_api.c b/drivers/platform/msm/ipa/ipa_api.c
index 8010561..b6dd436 100644
--- a/drivers/platform/msm/ipa/ipa_api.c
+++ b/drivers/platform/msm/ipa/ipa_api.c
@@ -2903,6 +2903,22 @@
return ret;
}
+/**
+ * ipa_get_pdev() - return a pointer to IPA dev struct
+ *
+ * Return value: a pointer to IPA dev struct
+ *
+ */
+struct device *ipa_get_pdev(void)
+{
+ struct device *ret;
+
+ IPA_API_DISPATCH_RETURN_PTR(ipa_get_pdev);
+
+ return ret;
+}
+EXPORT_SYMBOL(ipa_get_pdev);
+
static const struct dev_pm_ops ipa_pm_ops = {
.suspend_noirq = ipa_ap_suspend,
.resume_noirq = ipa_ap_resume,
diff --git a/drivers/platform/msm/ipa/ipa_api.h b/drivers/platform/msm/ipa/ipa_api.h
index f662661..171c9fb 100644
--- a/drivers/platform/msm/ipa/ipa_api.h
+++ b/drivers/platform/msm/ipa/ipa_api.h
@@ -369,6 +369,8 @@
int (*ipa_tear_down_uc_offload_pipes)(int ipa_ep_idx_ul,
int ipa_ep_idx_dl);
+
+ struct device *(*ipa_get_pdev)(void);
};
#ifdef CONFIG_IPA
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h
index b12fba8..8b69298 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h
@@ -1835,4 +1835,5 @@
int ipa2_get_ntn_stats(struct IpaHwStatsNTNInfoData_t *stats);
int ipa2_register_ipa_ready_cb(void (*ipa_ready_cb)(void *),
void *user_data);
+struct device *ipa2_get_pdev(void);
#endif /* _IPA_I_H_ */
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c
index e2b7fe1..f399bae 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c
@@ -5104,6 +5104,7 @@
api_ctrl->ipa_setup_uc_ntn_pipes = ipa2_setup_uc_ntn_pipes;
api_ctrl->ipa_tear_down_uc_offload_pipes =
ipa2_tear_down_uc_offload_pipes;
+ api_ctrl->ipa_get_pdev = ipa2_get_pdev;
return 0;
}
@@ -5183,3 +5184,17 @@
}
}
}
+
+/**
+ * ipa2_get_pdev() - return a pointer to IPA dev struct
+ *
+ * Return value: a pointer to IPA dev struct
+ *
+ */
+struct device *ipa2_get_pdev(void)
+{
+ if (!ipa_ctx)
+ return NULL;
+
+ return ipa_ctx->pdev;
+}
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
index 4cb4d5a..461b720 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
@@ -2019,4 +2019,5 @@
int ipa3_get_ntn_stats(struct Ipa3HwStatsNTNInfoData_t *stats);
struct dentry *ipa_debugfs_get_root(void);
bool ipa3_is_msm_device(void);
+struct device *ipa3_get_pdev(void);
#endif /* _IPA3_I_H_ */
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
index a6e462f6..c3f3cfa 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
@@ -3200,6 +3200,7 @@
api_ctrl->ipa_setup_uc_ntn_pipes = ipa3_setup_uc_ntn_pipes;
api_ctrl->ipa_tear_down_uc_offload_pipes =
ipa3_tear_down_uc_offload_pipes;
+ api_ctrl->ipa_get_pdev = ipa3_get_pdev;
return 0;
}
@@ -3637,3 +3638,17 @@
return false;
}
+
+/**
+ * ipa3_get_pdev() - return a pointer to IPA dev struct
+ *
+ * Return value: a pointer to IPA dev struct
+ *
+ */
+struct device *ipa3_get_pdev(void)
+{
+ if (!ipa3_ctx)
+ return NULL;
+
+ return ipa3_ctx->pdev;
+}