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
This commit is contained in:
Anurag Chouhan
2017-04-13 13:57:09 +05:30
committed by snandini
parent bd92f53484
commit 1ddb9b3e47
4 changed files with 61 additions and 30 deletions

View File

@@ -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, static int hdd_to_pmo_interface_pause(enum wow_interface_pause hdd_pause,
enum pmo_wow_interface_pause *pmo_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 * @dev: device
* @status: driver status * @uevent: uevent status
* *
* Return: void * 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 #ifdef FEATURE_RUNTIME_PM
@@ -1328,7 +1318,7 @@ struct pld_driver_ops wlan_drv_ops = {
.resume_noirq = wlan_hdd_pld_resume_noirq, .resume_noirq = wlan_hdd_pld_resume_noirq,
.reset_resume = wlan_hdd_pld_reset_resume, .reset_resume = wlan_hdd_pld_reset_resume,
.modem_status = wlan_hdd_pld_notify_handler, .modem_status = wlan_hdd_pld_notify_handler,
.update_status = wlan_hdd_pld_update_status, .uevent = wlan_hdd_pld_uevent,
#ifdef FEATURE_RUNTIME_PM #ifdef FEATURE_RUNTIME_PM
.runtime_suspend = wlan_hdd_pld_runtime_suspend, .runtime_suspend = wlan_hdd_pld_runtime_suspend,
.runtime_resume = wlan_hdd_pld_runtime_resume, .runtime_resume = wlan_hdd_pld_runtime_resume,

View File

@@ -129,7 +129,30 @@ enum pld_driver_status {
PLD_UNINITIALIZED, PLD_UNINITIALIZED,
PLD_INITIALIZED, PLD_INITIALIZED,
PLD_LOAD_UNLOAD, 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_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 * is enabled
* @modem_status: optional operation, will be called when platform driver * @modem_status: optional operation, will be called when platform driver
* sending modem power status to WLAN FW * 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 * updating driver status
* @runtime_suspend: optional operation, prepare the device for a condition * @runtime_suspend: optional operation, prepare the device for a condition
* in which it won't be able to communicate with the CPU(s) * 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, void (*modem_status)(struct device *dev,
enum pld_bus_type bus_type, enum pld_bus_type bus_type,
int state); 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, int (*runtime_suspend)(struct device *dev,
enum pld_bus_type bus_type); enum pld_bus_type bus_type);
int (*runtime_resume)(struct device *dev, int (*runtime_resume)(struct device *dev,

View File

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

View File

@@ -239,25 +239,35 @@ static int pld_snoc_uevent(struct device *dev,
struct icnss_uevent_data *uevent) struct icnss_uevent_data *uevent)
{ {
struct pld_context *pld_context; 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(); pld_context = pld_get_global_context();
if (!pld_context) if (!pld_context)
return -EINVAL; return -EINVAL;
if (!pld_context->ops->update_status) if (!pld_context->ops->uevent)
goto out; goto out;
if (!uevent)
return -EINVAL;
switch (uevent->uevent) { switch (uevent->uevent) {
case ICNSS_UEVENT_FW_CRASHED: 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; break;
default: default:
goto out; goto out;
} }
pld_context->ops->update_status(dev, status); pld_context->ops->uevent(dev, &data);
out: out:
return 0; return 0;
} }