Browse Source

msm: ipa3: add support for DPM port query in pcie mode

Add support for dpm ep-ip/IPA pipe info for user-space
module to query.

Change-Id: I06ecea1ecfc953315a2cc826e81517b3a97b0d7b
Signed-off-by: Skylar Chang <[email protected]>
Skylar Chang 3 years ago
parent
commit
be8e39c3eb
2 changed files with 45 additions and 32 deletions
  1. 37 32
      drivers/platform/msm/ipa/ipa_v3/ipa.c
  2. 8 0
      drivers/platform/msm/ipa/ipa_v3/ipa_i.h

+ 37 - 32
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -1099,7 +1099,7 @@ static void ipa3_get_usb_ep_info(
 			pair_info[ep_info->num_ep_pairs].producer_pipe_num =
 				ep_index;
 			pair_info[ep_info->num_ep_pairs].ep_id =
-				IPA_USB1_EP_ID;
+				IPA_v4_USB1_EP_ID;
 
 			IPADBG("ep_pair_info consumer_pipe_num %d",
 			pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
@@ -1126,7 +1126,7 @@ static void ipa3_get_usb_ep_info(
 			pair_info[ep_info->num_ep_pairs].producer_pipe_num =
 				ep_index;
 			pair_info[ep_info->num_ep_pairs].ep_id =
-				IPA_USB0_EP_ID;
+				IPA_v4_USB0_EP_ID;
 
 			IPADBG("ep_pair_info consumer_pipe_num %d",
 			pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
@@ -1159,30 +1159,35 @@ static void ipa3_get_pcie_ep_info(
 		pair_info[i].ep_id = -1;
 	}
 
-	ep_index = ipa3_get_ep_mapping(IPA_CLIENT_MHI2_PROD);
-
-	if ((ep_index != -1) && ipa3_ctx->ep[ep_index].valid) {
-		pair_info[ep_info->num_ep_pairs].consumer_pipe_num = ep_index;
-		ep_index = ipa3_get_ep_mapping(IPA_CLIENT_MHI2_CONS);
-		if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) {
-			pair_info[ep_info->num_ep_pairs].producer_pipe_num =
+	/*
+	 * Legacy codes for ipa4.X version
+	 */
+	if (ipa3_ctx->ipa_hw_type < IPA_HW_v5_0) {
+		ep_index = ipa3_get_ep_mapping(IPA_CLIENT_MHI2_PROD);
+
+		if ((ep_index != -1) && ipa3_ctx->ep[ep_index].valid) {
+			pair_info[ep_info->num_ep_pairs].consumer_pipe_num = ep_index;
+			ep_index = ipa3_get_ep_mapping(IPA_CLIENT_MHI2_CONS);
+			if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) {
+				pair_info[ep_info->num_ep_pairs].producer_pipe_num =
 				ep_index;
-			pair_info[ep_info->num_ep_pairs].ep_id =
-				IPA_PCIE1_EP_ID;
-
-			IPADBG("ep_pair_info consumer_pipe_num %d",
-			pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
-			IPADBG(" producer_pipe_num %d ep_id %d\n",
-			pair_info[ep_info->num_ep_pairs].producer_pipe_num,
-				pair_info[ep_info->num_ep_pairs].ep_id);
-			ep_info->num_ep_pairs++;
-		} else {
-			pair_info[ep_info->num_ep_pairs].consumer_pipe_num = -1;
-			IPADBG("ep_pair_info consumer_pipe_num %d",
-			pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
-			IPADBG(" producer_pipe_num %d ep_id %d\n",
-			pair_info[ep_info->num_ep_pairs].producer_pipe_num,
-				pair_info[ep_info->num_ep_pairs].ep_id);
+				pair_info[ep_info->num_ep_pairs].ep_id =
+				IPA_v4_PCIE1_EP_ID;
+
+				IPADBG("ep_pair_info consumer_pipe_num %d",
+					pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
+				IPADBG(" producer_pipe_num %d ep_id %d\n",
+					pair_info[ep_info->num_ep_pairs].producer_pipe_num,
+					pair_info[ep_info->num_ep_pairs].ep_id);
+				ep_info->num_ep_pairs++;
+			} else {
+				pair_info[ep_info->num_ep_pairs].consumer_pipe_num = -1;
+				IPADBG("ep_pair_info consumer_pipe_num %d",
+					pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
+				IPADBG(" producer_pipe_num %d ep_id %d\n",
+				pair_info[ep_info->num_ep_pairs].producer_pipe_num,
+					pair_info[ep_info->num_ep_pairs].ep_id);
+			}
 		}
 	}
 
@@ -1194,8 +1199,12 @@ static void ipa3_get_pcie_ep_info(
 		if ((ep_index != -1) && (ipa3_ctx->ep[ep_index].valid)) {
 			pair_info[ep_info->num_ep_pairs].producer_pipe_num =
 				ep_index;
-			pair_info[ep_info->num_ep_pairs].ep_id =
-				IPA_PCIE0_EP_ID;
+			if (ipa3_ctx->ipa_hw_type < IPA_HW_v5_0)
+				pair_info[ep_info->num_ep_pairs].ep_id =
+					IPA_v4_PCIE0_EP_ID;
+			else
+				pair_info[ep_info->num_ep_pairs].ep_id =
+					IPA_v5_PCIE0_EP_ID;
 
 			IPADBG("ep_pair_info consumer_pipe_num %d",
 			pair_info[ep_info->num_ep_pairs].consumer_pipe_num);
@@ -3788,11 +3797,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 	case IPA_IOC_GET_PHERIPHERAL_EP_INFO:
 		IPADBG("Got IPA_IOC_GET_EP_INFO\n");
-		if (ipa3_ctx->ipa_config_is_auto == false) {
-			IPADBG("not an auto config: returning error\n");
-			retval = -ENOTTY;
-			break;
-		}
+		/* used in IPA4.X AUTO and IPA5.0 MDM onwards */
 		if (copy_from_user(&ep_info, (const void __user *)arg,
 			sizeof(struct ipa_ioc_get_ep_info))) {
 			IPAERR_RL("copy_from_user fails\n");

+ 8 - 0
drivers/platform/msm/ipa/ipa_v3/ipa_i.h

@@ -44,6 +44,14 @@
 #define IPA_DEV_NAME_MAX_LEN 15
 #define DRV_NAME "ipa"
 
+#define IPA_v4_USB0_EP_ID		11
+#define IPA_v4_USB1_EP_ID		12
+
+#define IPA_v4_PCIE0_EP_ID		21
+#define IPA_v4_PCIE1_EP_ID		22
+
+#define IPA_v5_PCIE0_EP_ID		4
+
 #define IPA_COOKIE 0x57831603
 #define IPA_RT_RULE_COOKIE 0x57831604
 #define IPA_RT_TBL_COOKIE 0x57831605