Browse Source

qcacld-3.0: Implement update_status driver callback

Implement update_status driver callback, which will be called
when platform driver wants to update wlan driver status.

CRs-Fixed: 1111424
Change-Id: I0c4a20119e383d00e2dbd395159351572b956566
Yuanyuan Liu 8 years ago
parent
commit
06a342ffdb
3 changed files with 50 additions and 1 deletions
  1. 25 0
      core/hdd/src/wlan_hdd_driver_ops.c
  2. 5 1
      core/pld/inc/pld_common.h
  3. 20 0
      core/pld/src/pld_pcie.c

+ 25 - 0
core/hdd/src/wlan_hdd_driver_ops.c

@@ -489,6 +489,18 @@ 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);
+}
+
 /**
  * __wlan_hdd_bus_suspend() - handles platform supsend
  * @state: suspend message from the kernel
@@ -1139,6 +1151,18 @@ static void wlan_hdd_pld_notify_handler(struct device *dev,
 	wlan_hdd_notify_handler(state);
 }
 
+/**
+ * wlan_hdd_pld_update_status() - update driver status
+ * @dev: device
+ * @status: driver status
+ *
+ * Return: void
+ */
+static void wlan_hdd_pld_update_status(struct device *dev, uint32_t status)
+{
+	wlan_hdd_update_status(status);
+}
+
 #ifdef FEATURE_RUNTIME_PM
 /**
  * wlan_hdd_pld_runtime_suspend() - runtime suspend function registered to PLD
@@ -1179,6 +1203,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,
 #ifdef FEATURE_RUNTIME_PM
 	.runtime_suspend = wlan_hdd_pld_runtime_suspend,
 	.runtime_resume = wlan_hdd_pld_runtime_resume,

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

@@ -127,7 +127,8 @@ struct pld_platform_cap {
 enum pld_driver_status {
 	PLD_UNINITIALIZED,
 	PLD_INITIALIZED,
-	PLD_LOAD_UNLOAD
+	PLD_LOAD_UNLOAD,
+	PLD_RECOVERY,
 };
 
 /**
@@ -270,6 +271,8 @@ struct pld_soc_info {
  *          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
+ *                 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)
  *                   and RAM due to power management.
@@ -302,6 +305,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);
 	int (*runtime_suspend)(struct device *dev,
 			       enum pld_bus_type bus_type);
 	int (*runtime_resume)(struct device *dev,

+ 20 - 0
core/pld/src/pld_pcie.c

@@ -180,6 +180,25 @@ static void pld_pcie_notify_handler(struct pci_dev *pdev, int state)
 					       PLD_BUS_TYPE_PCIE, state);
 }
 
+/**
+ * pld_pcie_update_status() - update wlan driver status callback function
+ * @pdev: PCIE device
+ * @status: driver 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)
+{
+	struct pld_context *pld_context;
+
+	pld_context = pld_get_global_context();
+	if (pld_context->ops->update_status)
+		pld_context->ops->update_status(&pdev->dev, status);
+}
+
 #ifdef FEATURE_RUNTIME_PM
 /**
  * pld_pcie_runtime_suspend() - PM runtime suspend
@@ -287,6 +306,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,
 #ifdef CONFIG_PM
 	.suspend    = pld_pcie_suspend,
 	.resume     = pld_pcie_resume,