From 1ddb9b3e4787dc351604e0433dfa099cd2c63869 Mon Sep 17 00:00:00 2001 From: Anurag Chouhan Date: Thu, 13 Apr 2017 13:57:09 +0530 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_driver_ops.c | 24 +++++++----------------- core/pld/inc/pld_common.h | 27 +++++++++++++++++++++++++-- core/pld/src/pld_pcie.c | 20 ++++++++++++++------ core/pld/src/pld_snoc.c | 20 +++++++++++++++----- 4 files changed, 61 insertions(+), 30 deletions(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index d4e95002aa..6fc8d70997 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/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, diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 53f3ef220a..8fbe0b8f0d 100644 --- a/core/pld/inc/pld_common.h +++ b/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, diff --git a/core/pld/src/pld_pcie.c b/core/pld/src/pld_pcie.c index fa9ab17e65..38d97be8e3 100644 --- a/core/pld/src/pld_pcie.c +++ b/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, diff --git a/core/pld/src/pld_snoc.c b/core/pld/src/pld_snoc.c index 2056556f68..daabfb0b0d 100644 --- a/core/pld/src/pld_snoc.c +++ b/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; }