qcacmn: pointerize hif power_management apis

Bus power management requirements are different for different busses.
Add them to the bus opps table.

Change-Id: Ia5a2500dc2f1db3be2ddbbaea6a5969420ec0c51
CRs-Fixed: 978810 978802
This commit is contained in:
Houston Hoffman
2016-03-23 15:55:41 -07:00
committed by Gerrit - the friendly Code Review server
parent febbf6b9ec
commit b4149dda4f
8 changed files with 74 additions and 11 deletions

View File

@@ -94,3 +94,20 @@ int hif_dummy_target_sleep_state_adjust(struct hif_softc *scn,
{ {
return 0; return 0;
} }
/**
* hif_dummy_enable_power_management - dummy call
* hif_ctx: hif context
* is_packet_log_enabled: true if packet log is enabled
*/
void hif_dummy_enable_power_management(struct hif_softc *hif_ctx,
bool is_packet_log_enabled)
{}
/**
* hif_dummy_disable_power_management - dummy call
* hif_ctx: hif context
* is_packet_log_enabled: true if packet log is enabled
*/
void hif_dummy_disable_power_management(struct hif_softc *hif_ctx)
{}

View File

@@ -32,4 +32,6 @@ int hif_dummy_bus_suspend(struct hif_softc *hif_ctx);
int hif_dummy_bus_resume(struct hif_softc *hif_ctx); int hif_dummy_bus_resume(struct hif_softc *hif_ctx);
int hif_dummy_target_sleep_state_adjust(struct hif_softc *scn, int hif_dummy_target_sleep_state_adjust(struct hif_softc *scn,
bool sleep_ok, bool wait_for_it); bool sleep_ok, bool wait_for_it);
void hif_dummy_enable_power_management(struct hif_softc *hif_ctx,
bool is_packet_log_enabled);
void hif_dummy_disable_power_management(struct hif_softc *hif_ctx);

View File

@@ -220,3 +220,35 @@ int hif_dump_registers(struct hif_opaque_softc *hif_hdl)
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl); struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
return hif_sc->bus_ops.hif_dump_registers(hif_sc); return hif_sc->bus_ops.hif_dump_registers(hif_sc);
} }
/**
* hif_enable_power_management() - enable power management after driver load
* @hif_hdl: opaque pointer to the hif context
* is_packet_log_enabled: true if packet log is enabled
*
* Driver load and firmware download are done in a high performance mode.
* Enable power management after the driver is loaded.
* packet log can require fewer power management features to be enabled.
*/
void hif_enable_power_management(struct hif_opaque_softc *hif_hdl,
bool is_packet_log_enabled)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
hif_sc->bus_ops.hif_enable_power_management(hif_sc,
is_packet_log_enabled);
}
/**
* hif_disable_power_management() - reset the bus power management
* @hif_hdl: opaque pointer to the hif context
*
* return the power management of the bus to its default state.
* This isn't necessarily a complete reversal of its counterpart.
* This should be called when unloading the driver.
*/
void hif_disable_power_management(struct hif_opaque_softc *hif_hdl)
{
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_hdl);
hif_sc->bus_ops.hif_disable_power_management(hif_sc);
}

View File

@@ -54,6 +54,10 @@ struct hif_bus_ops {
void (*hif_irq_disable)(struct hif_softc *hif_sc, int ce_id); void (*hif_irq_disable)(struct hif_softc *hif_sc, int ce_id);
void (*hif_irq_enable)(struct hif_softc *hif_sc, int ce_id); void (*hif_irq_enable)(struct hif_softc *hif_sc, int ce_id);
int (*hif_dump_registers)(struct hif_softc *hif_sc); int (*hif_dump_registers)(struct hif_softc *hif_sc);
void (*hif_enable_power_management)(struct hif_softc *hif_ctx,
bool is_packet_log_enabled);
void (*hif_disable_power_management)(struct hif_softc *hif_ctx);
}; };
#ifdef HIF_SNOC #ifdef HIF_SNOC

View File

@@ -67,6 +67,11 @@ QDF_STATUS hif_initialize_pci_ops(struct hif_softc *hif_sc)
bus_ops->hif_irq_disable = &hif_pci_irq_disable; bus_ops->hif_irq_disable = &hif_pci_irq_disable;
bus_ops->hif_irq_enable = &hif_pci_irq_enable; bus_ops->hif_irq_enable = &hif_pci_irq_enable;
bus_ops->hif_dump_registers = &hif_pci_dump_registers; bus_ops->hif_dump_registers = &hif_pci_dump_registers;
bus_ops->hif_enable_power_management =
&hif_pci_enable_power_management;
bus_ops->hif_disable_power_management =
&hif_pci_disable_power_management;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -57,6 +57,10 @@ QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops)
bus_ops->hif_irq_disable = &hif_snoc_irq_disable; bus_ops->hif_irq_disable = &hif_snoc_irq_disable;
bus_ops->hif_irq_enable = &hif_snoc_irq_enable; bus_ops->hif_irq_enable = &hif_snoc_irq_enable;
bus_ops->hif_dump_registers = &hif_snoc_dump_registers; bus_ops->hif_dump_registers = &hif_snoc_dump_registers;
bus_ops->hif_enable_power_management =
&hif_dummy_enable_power_management;
bus_ops->hif_disable_power_management =
&hif_dummy_disable_power_management;
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }

View File

@@ -46,3 +46,6 @@ int hif_pci_bus_configure(struct hif_softc *scn);
void hif_pci_irq_disable(struct hif_softc *scn, int ce_id); void hif_pci_irq_disable(struct hif_softc *scn, int ce_id);
void hif_pci_irq_enable(struct hif_softc *scn, int ce_id); void hif_pci_irq_enable(struct hif_softc *scn, int ce_id);
int hif_pci_dump_registers(struct hif_softc *scn); int hif_pci_dump_registers(struct hif_softc *scn);
void hif_pci_enable_power_management(struct hif_softc *hif_ctx,
bool is_packet_log_enabled);
void hif_pci_disable_power_management(struct hif_softc *hif_ctx);

View File

@@ -1178,12 +1178,9 @@ static void hif_disable_power_gating(struct hif_opaque_softc *hif_ctx)
* *
* enables pcie L1 power states * enables pcie L1 power states
*/ */
static void hif_enable_power_gating(struct hif_opaque_softc *hif_ctx) static void hif_enable_power_gating(struct hif_pci_softc *sc)
{ {
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); if (NULL == sc) {
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
if (NULL == scn) {
HIF_ERROR("%s: Could not disable ASPM scn is null", HIF_ERROR("%s: Could not disable ASPM scn is null",
__func__); __func__);
return; return;
@@ -1202,11 +1199,10 @@ static void hif_enable_power_gating(struct hif_opaque_softc *hif_ctx)
* the soc sleep after the driver finishes loading and re-enabling * the soc sleep after the driver finishes loading and re-enabling
* aspm (hif_enable_power_gating). * aspm (hif_enable_power_gating).
*/ */
void hif_enable_power_management(struct hif_opaque_softc *hif_ctx, void hif_pci_enable_power_management(struct hif_softc *hif_sc,
bool is_packet_log_enabled) bool is_packet_log_enabled)
{ {
struct hif_pci_softc *pci_ctx = HIF_GET_PCI_SOFTC(hif_ctx); struct hif_pci_softc *pci_ctx = HIF_GET_PCI_SOFTC(hif_sc);
struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx);
if (pci_ctx == NULL) { if (pci_ctx == NULL) {
HIF_ERROR("%s, hif_ctx null", __func__); HIF_ERROR("%s, hif_ctx null", __func__);
@@ -1216,7 +1212,7 @@ void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
hif_pm_runtime_start(pci_ctx); hif_pm_runtime_start(pci_ctx);
if (!is_packet_log_enabled) if (!is_packet_log_enabled)
hif_enable_power_gating(hif_ctx); hif_enable_power_gating(pci_ctx);
if (!CONFIG_ATH_PCIE_MAX_PERF && if (!CONFIG_ATH_PCIE_MAX_PERF &&
CONFIG_ATH_PCIE_AWAKE_WHILE_DRIVER_LOAD) { CONFIG_ATH_PCIE_AWAKE_WHILE_DRIVER_LOAD) {
@@ -1234,7 +1230,7 @@ void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
* if runtime pm is not started. Should be updated to take care * if runtime pm is not started. Should be updated to take care
* of aspm and soc sleep for driver load. * of aspm and soc sleep for driver load.
*/ */
void hif_disable_power_management(struct hif_opaque_softc *hif_ctx) void hif_pci_disable_power_management(struct hif_softc *hif_ctx)
{ {
struct hif_pci_softc *pci_ctx = HIF_GET_PCI_SOFTC(hif_ctx); struct hif_pci_softc *pci_ctx = HIF_GET_PCI_SOFTC(hif_ctx);