Просмотр исходного кода

qcacld-3.0: Add uevent to update status & data

Update uevent status to hdd, based on the uevent received
from the platform driver

Change-Id: I1ac0fa61efa8b7f4f9d5e4e6abfcf969dbc1c592
CRs-fixed: 2027958
Anurag Chouhan 8 лет назад
Родитель
Сommit
1ddb9b3e47
4 измененных файлов с 61 добавлено и 30 удалено
  1. 7 17
      core/hdd/src/wlan_hdd_driver_ops.c
  2. 25 2
      core/pld/inc/pld_common.h
  3. 14 6
      core/pld/src/pld_pcie.c
  4. 15 5
      core/pld/src/pld_snoc.c

+ 7 - 17
core/hdd/src/wlan_hdd_driver_ops.c

@@ -511,18 +511,6 @@ static void wlan_hdd_notify_handler(int state)
 	}
 }
 
-/**
- * wlan_hdd_update_status() - update driver status
- * @status: driver status
- *
- * Return: void
- */
-static void wlan_hdd_update_status(uint32_t status)
-{
-	if (status == PLD_RECOVERY)
-		cds_set_recovery_in_progress(true);
-}
-
 static int hdd_to_pmo_interface_pause(enum wow_interface_pause hdd_pause,
 				      enum pmo_wow_interface_pause *pmo_pause)
 {
@@ -1277,15 +1265,17 @@ static void wlan_hdd_pld_notify_handler(struct device *dev,
 }
 
 /**
- * wlan_hdd_pld_update_status() - update driver status
+ * wlan_hdd_pld_uevent() - update driver status
  * @dev: device
- * @status: driver status
+ * @uevent: uevent status
  *
  * Return: void
  */
-static void wlan_hdd_pld_update_status(struct device *dev, uint32_t status)
+static void wlan_hdd_pld_uevent(struct device *dev,
+				struct pld_uevent_data *uevent)
 {
-	wlan_hdd_update_status(status);
+	if (uevent->uevent == PLD_RECOVERY)
+		cds_set_recovery_in_progress(true);
 }
 
 #ifdef FEATURE_RUNTIME_PM
@@ -1328,7 +1318,7 @@ struct pld_driver_ops wlan_drv_ops = {
 	.resume_noirq  = wlan_hdd_pld_resume_noirq,
 	.reset_resume = wlan_hdd_pld_reset_resume,
 	.modem_status = wlan_hdd_pld_notify_handler,
-	.update_status = wlan_hdd_pld_update_status,
+	.uevent = wlan_hdd_pld_uevent,
 #ifdef FEATURE_RUNTIME_PM
 	.runtime_suspend = wlan_hdd_pld_runtime_suspend,
 	.runtime_resume = wlan_hdd_pld_runtime_resume,

+ 25 - 2
core/pld/inc/pld_common.h

@@ -129,7 +129,30 @@ enum pld_driver_status {
 	PLD_UNINITIALIZED,
 	PLD_INITIALIZED,
 	PLD_LOAD_UNLOAD,
+};
+
+/**
+ * enum pld_uevent - WLAN FW status
+ * @PLD_RECOVERY: driver is recovering
+ * @PLD_FW_DOWN: FW is down
+ */
+enum pld_uevent {
 	PLD_RECOVERY,
+	PLD_FW_DOWN,
+};
+
+/**
+ * struct pld_uevent_data - uevent status received from platform driver
+ * @uevent: uevent type
+ * @fw_down: FW down info
+ */
+struct pld_uevent_data {
+	enum pld_uevent uevent;
+	union {
+		struct {
+			bool crashed;
+		} fw_down;
+	};
 };
 
 /**
@@ -282,7 +305,7 @@ enum pld_recovery_reason {
  *          is enabled
  * @modem_status: optional operation, will be called when platform driver
  *                sending modem power status to WLAN FW
- * @update_status: optional operation, will be called when platform driver
+ * @uevent: optional operation, will be called when platform driver
  *                 updating driver status
  * @runtime_suspend: optional operation, prepare the device for a condition
  *                   in which it won't be able to communicate with the CPU(s)
@@ -316,7 +339,7 @@ struct pld_driver_ops {
 	void (*modem_status)(struct device *dev,
 			     enum pld_bus_type bus_type,
 			     int state);
-	void (*update_status)(struct device *dev, uint32_t status);
+	void (*uevent)(struct device *dev, struct pld_uevent_data *uevent);
 	int (*runtime_suspend)(struct device *dev,
 			       enum pld_bus_type bus_type);
 	int (*runtime_resume)(struct device *dev,

+ 14 - 6
core/pld/src/pld_pcie.c

@@ -181,22 +181,30 @@ static void pld_pcie_notify_handler(struct pci_dev *pdev, int state)
 }
 
 /**
- * pld_pcie_update_status() - update wlan driver status callback function
+ * pld_pcie_uevent() - update wlan driver status callback function
  * @pdev: PCIE device
- * @status: driver status
+ * @status driver uevent status
  *
  * This function will be called when platform driver wants to update wlan
  * driver's status.
  *
  * Return: void
  */
-static void pld_pcie_update_status(struct pci_dev *pdev, uint32_t status)
+static void pld_pcie_uevent(struct pci_dev *pdev, uint32_t status)
 {
 	struct pld_context *pld_context;
+	struct pld_uevent_data data;
 
 	pld_context = pld_get_global_context();
-	if (pld_context->ops->update_status)
-		pld_context->ops->update_status(&pdev->dev, status);
+	if (!pld_context)
+		return;
+
+	data.uevent = status;
+
+	if (!pld_context->ops->uevent)
+		pld_context->ops->uevent(&pdev->dev, &data);
+
+	return;
 }
 
 #ifdef FEATURE_RUNTIME_PM
@@ -449,7 +457,7 @@ struct cnss_wlan_driver pld_pcie_ops = {
 	.shutdown   = pld_pcie_shutdown,
 	.crash_shutdown = pld_pcie_crash_shutdown,
 	.modem_status   = pld_pcie_notify_handler,
-	.update_status  = pld_pcie_update_status,
+	.update_status  = pld_pcie_uevent,
 #ifdef CONFIG_PM
 	.suspend    = pld_pcie_suspend,
 	.resume     = pld_pcie_resume,

+ 15 - 5
core/pld/src/pld_snoc.c

@@ -239,25 +239,35 @@ static int pld_snoc_uevent(struct device *dev,
 			   struct icnss_uevent_data *uevent)
 {
 	struct pld_context *pld_context;
-	uint32_t status;
+	struct icnss_uevent_fw_down_data *uevent_data = NULL;
+	struct pld_uevent_data data;
 
 	pld_context = pld_get_global_context();
 	if (!pld_context)
 		return -EINVAL;
 
-	if (!pld_context->ops->update_status)
+	if (!pld_context->ops->uevent)
 		goto out;
 
+	if (!uevent)
+		return -EINVAL;
+
 	switch (uevent->uevent) {
 	case ICNSS_UEVENT_FW_CRASHED:
-		status = PLD_RECOVERY;
+		data.uevent = PLD_RECOVERY;
+		break;
+	case ICNSS_UEVENT_FW_DOWN:
+		if (uevent->data == NULL)
+			return -EINVAL;
+		uevent_data = (struct icnss_uevent_fw_down_data *)uevent->data;
+		data.uevent = PLD_FW_DOWN;
+		data.fw_down.crashed = uevent_data->crashed;
 		break;
 	default:
 		goto out;
 	}
 
-	pld_context->ops->update_status(dev, status);
-
+	pld_context->ops->uevent(dev, &data);
 out:
 	return 0;
 }