Quellcode durchsuchen

qcacld-3.0: Add support of getting MAC address from platform driver

Add support of getting WLAN MAC address from ICNSS platform driver.

Change-Id: Ie31d9147e8dc4e11e14a6fdf93200122acbb4000
CRs-Fixed: 1096290
Yuanyuan Liu vor 8 Jahren
Ursprung
Commit
7145eb2383
4 geänderte Dateien mit 29 neuen und 12 gelöschten Zeilen
  1. 9 7
      core/hdd/src/wlan_hdd_main.c
  2. 1 1
      core/pld/inc/pld_common.h
  3. 8 4
      core/pld/src/pld_common.c
  4. 11 0
      core/pld/src/pld_snoc.h

+ 9 - 7
core/hdd/src/wlan_hdd_main.c

@@ -7220,15 +7220,17 @@ QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void)
 #endif
 
 /**
- * hdd_get_cnss_wlan_mac_buff() - API to query platform driver for MAC address
+ * hdd_get_platform_wlan_mac_buff() - API to query platform driver
+ *                                    for MAC address
  * @dev: Device Pointer
  * @num: Number of Valid Mac address
  *
  * Return: Pointer to MAC address buffer
  */
-static uint8_t *hdd_get_cnss_wlan_mac_buff(struct device *dev, uint32_t *num)
+static uint8_t *hdd_get_platform_wlan_mac_buff(struct device *dev,
+					       uint32_t *num)
 {
-	return pld_common_get_wlan_mac_address(dev, num);
+	return pld_get_wlan_mac_address(dev, num);
 }
 
 /**
@@ -7264,14 +7266,14 @@ static void hdd_populate_random_mac_addr(hdd_context_t *hdd_ctx, uint32_t num)
 }
 
 /**
- * hdd_cnss_wlan_mac() - API to get mac addresses from cnss platform driver
+ * hdd_platform_wlan_mac() - API to get mac addresses from platform driver
  * @hdd_ctx: HDD Context
  *
  * API to get mac addresses from platform driver and update the driver
  * structures and configure FW with the base mac address.
  * Return: int
  */
-static int hdd_cnss_wlan_mac(hdd_context_t *hdd_ctx)
+static int hdd_platform_wlan_mac(hdd_context_t *hdd_ctx)
 {
 	uint32_t no_of_mac_addr, iter;
 	uint32_t max_mac_addr = QDF_MAX_CONCURRENCY_PERSONA;
@@ -7282,7 +7284,7 @@ static int hdd_cnss_wlan_mac(hdd_context_t *hdd_ctx)
 	tSirMacAddr mac_addr;
 	QDF_STATUS status;
 
-	addr = hdd_get_cnss_wlan_mac_buff(dev, &no_of_mac_addr);
+	addr = hdd_get_platform_wlan_mac_buff(dev, &no_of_mac_addr);
 
 	if (no_of_mac_addr == 0 || !addr) {
 		hdd_warn("Platform Driver Doesn't have wlan mac addresses");
@@ -7349,7 +7351,7 @@ static void hdd_initialize_mac_address(hdd_context_t *hdd_ctx)
 	QDF_STATUS status;
 	int ret;
 
-	ret = hdd_cnss_wlan_mac(hdd_ctx);
+	ret = hdd_platform_wlan_mac(hdd_ctx);
 	if (ret == 0)
 		return;
 

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

@@ -363,7 +363,7 @@ int pld_get_msi_irq(struct device *dev, unsigned int vector);
 void pld_get_msi_address(struct device *dev, uint32_t *msi_addr_low,
 			 uint32_t *msi_addr_high);
 unsigned int pld_socinfo_get_serial_number(struct device *dev);
-uint8_t *pld_common_get_wlan_mac_address(struct device *dev, uint32_t *num);
+uint8_t *pld_get_wlan_mac_address(struct device *dev, uint32_t *num);
 int pld_is_qmi_disable(struct device *dev);
 
 #endif

+ 8 - 4
core/pld/src/pld_common.c

@@ -1630,7 +1630,7 @@ unsigned int pld_socinfo_get_serial_number(struct device *dev)
 }
 
 /*
- * pld_common_get_wlan_mac_address() - API to query MAC address from Platform
+ * pld_get_wlan_mac_address() - API to query MAC address from Platform
  * Driver
  * @dev: Device Structure
  * @num: Pointer to number of MAC address supported
@@ -1640,15 +1640,19 @@ unsigned int pld_socinfo_get_serial_number(struct device *dev)
  *
  * Return: Pointer to the list of MAC address
  */
-uint8_t *pld_common_get_wlan_mac_address(struct device *dev, uint32_t *num)
+uint8_t *pld_get_wlan_mac_address(struct device *dev, uint32_t *num)
 {
-	switch (pld_get_bus_type(dev)) {
+	enum pld_bus_type type = pld_get_bus_type(dev);
+
+	switch (type) {
 	case PLD_BUS_TYPE_PCIE:
 		return pld_pcie_get_wlan_mac_address(dev, num);
 	case PLD_BUS_TYPE_SDIO:
 		return pld_sdio_get_wlan_mac_address(dev, num);
-	case PLD_BUS_TYPE_USB:
 	case PLD_BUS_TYPE_SNOC:
+		return pld_snoc_get_wlan_mac_address(dev, num);
+	case PLD_BUS_TYPE_USB:
+		pr_err("Not supported on type %d\n", type);
 		break;
 	default:
 		pr_err("Invalid device type\n");

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

@@ -139,6 +139,12 @@ static inline int pld_snoc_is_qmi_disable(void)
 {
 	return 0;
 }
+static inline uint8_t *pld_snoc_get_wlan_mac_address(struct device *dev,
+						     uint32_t *num)
+{
+	*num = 0;
+	return NULL;
+}
 #else
 int pld_snoc_register_driver(void);
 void pld_snoc_unregister_driver(void);
@@ -231,5 +237,10 @@ static inline int pld_snoc_is_qmi_disable(void)
 {
 	return icnss_is_qmi_disable();
 }
+static inline uint8_t *pld_snoc_get_wlan_mac_address(struct device *dev,
+						      uint32_t *num)
+{
+	return icnss_get_wlan_mac_address(dev, num);
+}
 #endif
 #endif