qcacld-3.0: Add support for registering runtime PM APIs

Add support for registering runtime PM APIs in PLD.

CRs-Fixed: 1010156
Change-Id: I8747edd0f8fc4bd79f72f7fba4b65d8c6ebd6887
This commit is contained in:
Yuanyuan Liu 2016-04-11 11:43:30 -07:00 • committed by Akash Patel
commit d698eb6cd3
2 changed files with 62 additions and 0 deletions

View file

@ -268,6 +268,12 @@ struct pld_soc_info {
* is enabled
* @modem_status: optional operation, will be called when platform driver
* sending modem power status to WLAN FW
* @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.
* @runtime_resume: optional operation, put the device into the fully
* active state in response to a wakeup event generated by
* hardware or at the request of software.
*/
struct pld_driver_ops {
int (*probe)(struct device *dev,
@ -290,6 +296,10 @@ struct pld_driver_ops {
void (*modem_status)(struct device *dev,
enum pld_bus_type bus_type,
int state);
int (*runtime_suspend)(struct device *dev,
enum pld_bus_type bus_type);
int (*runtime_resume)(struct device *dev,
enum pld_bus_type bus_type);
};
int pld_init(void);

View file

@ -198,6 +198,48 @@ static void pld_pcie_notify_handler(struct pci_dev *pdev, int state)
pld_context->ops->modem_status(&pdev->dev,
PLD_BUS_TYPE_PCIE, state);
}
#ifdef FEATURE_RUNTIME_PM
/**
* pld_pcie_runtime_suspend() - PM runtime suspend
* @pdev: PCIE device
*
* PM runtime suspend callback function.
*
* Return: int
*/
static int pld_pcie_runtime_suspend(struct pci_dev *pdev)
{
struct pld_context *pld_context;
pld_context = pld_get_global_context();
if (pld_context->ops->runtime_suspend)
return pld_context->ops->runtime_suspend(&pdev->dev,
PLD_BUS_TYPE_PCIE);
return -ENODEV;
}
/**
* pld_pcie_runtime_resume() - PM runtime resume
* @pdev: PCIE device
*
* PM runtime resume callback function.
*
* Return: int
*/
static int pld_pcie_runtime_resume(struct pci_dev *pdev)
{
struct pld_context *pld_context;
pld_context = pld_get_global_context();
if (pld_context->ops->runtime_resume)
return pld_context->ops->runtime_resume(&pdev->dev,
PLD_BUS_TYPE_PCIE);
return -ENODEV;
}
#endif
#endif
/**
@ -246,6 +288,13 @@ static struct pci_device_id pld_pcie_id_table[] = {
};
#ifdef CONFIG_CNSS
#ifdef FEATURE_RUNTIME_PM
struct cnss_wlan_runtime_ops runtime_pm_ops = {
.runtime_suspend = pld_pcie_runtime_suspend,
.runtime_resume = pld_pcie_runtime_resume,
};
#endif
struct cnss_wlan_driver pld_pcie_ops = {
.name = "pld_pcie",
.id_table = pld_pcie_id_table,
@ -259,6 +308,9 @@ struct cnss_wlan_driver pld_pcie_ops = {
.suspend = pld_pcie_suspend,
.resume = pld_pcie_resume,
#endif
#ifdef FEATURE_RUNTIME_PM
.runtime_ops = &runtime_pm_ops,
#endif
};
/**