Forráskód Böngészése

qcacld-3.0: Use PLD API to get SOC serial number

Socinfo API is not a standard system API. Hence, use PLD API to get
SOC serial number instead of calling socinfo API directly to enhance
driver portability.

Change-Id: I1d673d2f3b0066f4e05f2f465abc8a6cad7a1f8f
CRs-Fixed: 1069480
Yuanyuan Liu 8 éve
szülő
commit
f97e822df4

+ 1 - 2
core/hdd/src/wlan_hdd_main.c

@@ -80,7 +80,6 @@
 #ifdef MSM_PLATFORM
 #include <soc/qcom/subsystem_restart.h>
 #endif
-#include <soc/qcom/socinfo.h>
 #include <wlan_hdd_hostapd.h>
 #include <wlan_hdd_softap_tx_rx.h>
 #include "cfg_api.h"
@@ -1344,7 +1343,7 @@ static int hdd_generate_macaddr_auto(hdd_context_t *hdd_ctx)
 		{0x00, 0x0A, 0xF5, 0x00, 0x00, 0x00}
 	};
 
-	serialno = socinfo_get_serial_number();
+	serialno = pld_socinfo_get_serial_number(hdd_ctx->parent_dev);
 	if (serialno == 0)
 		return -EINVAL;
 

+ 1 - 0
core/pld/inc/pld_common.h

@@ -378,4 +378,5 @@ int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype,
 void *pld_smmu_get_mapping(struct device *dev);
 int pld_smmu_map(struct device *dev, phys_addr_t paddr,
 		 uint32_t *iova_addr, size_t size);
+unsigned int pld_socinfo_get_serial_number(struct device *dev);
 #endif

+ 26 - 0
core/pld/src/pld_common.c

@@ -1518,3 +1518,29 @@ int pld_smmu_map(struct device *dev, phys_addr_t paddr,
 
 	return ret;
 }
+
+/**
+ * pld_socinfo_get_serial_number() - Get SOC serial number
+ * @dev: device
+ *
+ * Return: SOC serial number
+ */
+unsigned int pld_socinfo_get_serial_number(struct device *dev)
+{
+	unsigned int ret = 0;
+	enum pld_bus_type type = pld_get_bus_type(dev);
+
+	switch (type) {
+	case PLD_BUS_TYPE_SNOC:
+		ret = pld_snoc_socinfo_get_serial_number(dev);
+		break;
+	case PLD_BUS_TYPE_PCIE:
+		pr_err("Not supported on type %d\n", type);
+		break;
+	default:
+		pr_err("Invalid device type %d\n", type);
+		break;
+	}
+
+	return ret;
+}

+ 10 - 0
core/pld/src/pld_snoc.h

@@ -130,6 +130,11 @@ static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
 {
 	return 0;
 }
+static inline
+unsigned int pld_snoc_socinfo_get_serial_number(struct device *dev)
+{
+	return 0;
+}
 #else
 int pld_snoc_register_driver(void);
 void pld_snoc_unregister_driver(void);
@@ -213,5 +218,10 @@ static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr,
 {
 	return icnss_smmu_map(dev, paddr, iova_addr, size);
 }
+static inline
+unsigned int pld_snoc_socinfo_get_serial_number(struct device *dev)
+{
+	return icnss_socinfo_get_serial_number(dev);
+}
 #endif
 #endif