From e01118e85f3d3c2d21726e8830894d18ed0dd05b Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Mon, 8 Apr 2019 10:31:41 -0700 Subject: [PATCH] qcacld-3.0: Define PLD APIs for idle shutdown and restart Define PLD APIs for idle shutdown and restart such that platform driver can serialize PSOC idle shutdown and restart with driver load/unload and SSR shutdown/reinit. Change-Id: I4e772343fbccb099b9af104ac978dcdb650a567a CRs-Fixed: 2431405 --- core/pld/inc/pld_common.h | 28 +++++++++++++++++++++++++++ core/pld/src/pld_common.c | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 4fd122c03d82e..20922ea3617a7 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -304,6 +304,10 @@ enum pld_recovery_reason { * struct pld_driver_ops - driver callback functions * @probe: required operation, will be called when device is detected * @remove: required operation, will be called when device is removed + * @idle_shutdown: required operation, will be called when device is doing + * idle shutdown after interface inactivity timer has fired + * @idle_restart: required operation, will be called when device is doing + * idle restart after idle shutdown * @shutdown: optional operation, will be called during SSR * @reinit: optional operation, will be called during SSR * @crash_shutdown: optional operation, will be called when a crash is @@ -331,6 +335,10 @@ struct pld_driver_ops { void *bdev, void *id); void (*remove)(struct device *dev, enum pld_bus_type bus_type); + void (*idle_shutdown)(struct device *dev, + enum pld_bus_type bus_type); + void (*idle_restart)(struct device *dev, + enum pld_bus_type bus_type); void (*shutdown)(struct device *dev, enum pld_bus_type bus_type); int (*reinit)(struct device *dev, @@ -625,6 +633,26 @@ int pld_is_fw_rejuvenate(struct device *dev); */ bool pld_have_platform_driver_support(struct device *dev); +/** + * pld_idle_shutdown - request idle shutdown callback from platform driver + * @dev: pointer to struct dev + * @shutdown_cb: pointer to hdd psoc idle shutdown callback handler + * + * Return: none + */ +void pld_idle_shutdown(struct device *dev, + void (*shutdown_cb)(struct device *dev)); + +/** + * pld_idle_restart - request idle restart callback from platform driver + * @dev: pointer to struct dev + * @restart_cb: pointer to hdd psoc idle restart callback handler + * + * Return: none + */ +void pld_idle_restart(struct device *dev, + void (*restart_cb)(struct device *dev)); + #if defined(CONFIG_WCNSS_MEM_PRE_ALLOC) && defined(FEATURE_SKB_PRE_ALLOC) /** diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index 1b67020ff81df..689e616dfff4c 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1776,3 +1776,43 @@ void pld_block_shutdown(struct device *dev, bool status) break; } } + +void pld_idle_shutdown(struct device *dev, + void (*shutdown_cb)(struct device *dev)) +{ + enum pld_bus_type type; + + if (!shutdown_cb) + return; + + type = pld_get_bus_type(dev); + switch (type) { + case PLD_BUS_TYPE_SNOC: + shutdown_cb(dev); + break; + case PLD_BUS_TYPE_PCIE: + break; + default: + break; + } +} + +void pld_idle_restart(struct device *dev, + void (*restart_cb)(struct device *dev)) +{ + enum pld_bus_type type; + + if (!restart_cb) + return; + + type = pld_get_bus_type(dev); + switch (type) { + case PLD_BUS_TYPE_SNOC: + restart_cb(dev); + break; + case PLD_BUS_TYPE_PCIE: + break; + default: + break; + } +}