qcacld-3.0: Add pld api to get PCI slot of attached device

Add pld api to get PCI slot of attached device.

Change-Id: I5adb49a8c28d4211ede5aee4e5bc0e8046bbf542
This commit is contained in:
Mohammed Siddiq
2021-12-29 16:27:44 +05:30
committed by Madan Koyyalamudi
parent 58beac2703
commit 1c61feb5de
3 changed files with 50 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -851,6 +851,7 @@ void pld_lock_pm_sem(struct device *dev);
void pld_release_pm_sem(struct device *dev);
void pld_lock_reg_window(struct device *dev, unsigned long *flags);
void pld_unlock_reg_window(struct device *dev, unsigned long *flags);
int pld_get_pci_slot(struct device *dev);
int pld_power_on(struct device *dev);
int pld_power_off(struct device *dev);
int pld_athdiag_read(struct device *dev, uint32_t offset, uint32_t memtype,

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -1839,6 +1839,35 @@ void pld_unlock_reg_window(struct device *dev, unsigned long *flags)
}
}
/**
* pld_get_pci_slot() - Get PCI slot of attached device
* @dev: device
*
* Return: pci slot
*/
int pld_get_pci_slot(struct device *dev)
{
int ret = 0;
switch (pld_get_bus_type(dev)) {
case PLD_BUS_TYPE_PCIE:
ret = pld_pcie_get_pci_slot(dev);
break;
case PLD_BUS_TYPE_PCIE_FW_SIM:
case PLD_BUS_TYPE_IPCI_FW_SIM:
case PLD_BUS_TYPE_SNOC_FW_SIM:
case PLD_BUS_TYPE_SNOC:
case PLD_BUS_TYPE_IPCI:
break;
default:
pr_err("Invalid device type\n");
ret = -EINVAL;
break;
}
return ret;
}
/**
* pld_power_on() - Power on WLAN hardware
* @dev: device

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -347,6 +348,11 @@ static inline void pld_pcie_unlock_reg_window(struct device *dev,
{
}
static inline int pld_pcie_get_pci_slot(struct device *dev)
{
return 0;
}
static inline int pld_pcie_power_on(struct device *dev)
{
return 0;
@@ -645,6 +651,18 @@ static inline void pld_pcie_unlock_reg_window(struct device *dev,
cnss_pci_unlock_reg_window(dev, flags);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
static inline int pld_pcie_get_pci_slot(struct device *dev)
{
return cnss_get_pci_slot(dev);
}
#else
static inline int pld_pcie_get_pci_slot(struct device *dev)
{
return 0;
}
#endif
static inline int pld_pcie_power_on(struct device *dev)
{
return cnss_power_up(dev);