qcacmn: Add support to config gpio cfg/output

Add support to config gpio cfg/output

CRs-Fixed: 2785829
Change-Id: Ibb26a36791de584ee6a90d539e17d326545633fa
This commit is contained in:
Surya Prakash Raajen
2020-09-25 21:34:53 +05:30
committed by snandini
parent eb134979c1
commit 8e8ac2c5d1
3 changed files with 110 additions and 14 deletions

View File

@@ -21,6 +21,8 @@
*/
#include <wlan_gpio_priv_api.h>
#include <wlan_gpio_tgt_api.h>
#include <target_type.h>
#include <qdf_module.h>
QDF_STATUS tgt_set_gpio_config_req(struct wlan_objmgr_psoc *psoc,
struct gpio_config_params *param)
@@ -54,3 +56,74 @@ QDF_STATUS tgt_set_gpio_output_req(struct wlan_objmgr_psoc *psoc,
return gpio_tx_ops->set_gpio_output(psoc, param);
}
QDF_STATUS tgt_gpio_config(struct wlan_objmgr_psoc *psoc, uint32_t gpio_num,
uint32_t input, uint32_t pull_type,
uint32_t intr_mode)
{
struct gpio_config_params param;
if (!psoc) {
gpio_err("psoc_obj is null");
return QDF_STATUS_E_INVAL;
}
qdf_mem_set(&param, sizeof(param), 0);
param.pin_pull_type = pull_type;
param.pin_num = gpio_num;
param.pin_dir = input;
param.pin_intr_mode = intr_mode;
return tgt_set_gpio_config_req(psoc, &param);
}
qdf_export_symbol(tgt_gpio_config);
static bool tgt_gpio_disabled(struct wlan_objmgr_psoc *psoc)
{
uint32_t target_type = 0;
struct wlan_lmac_if_target_tx_ops *target_type_tx_ops;
struct wlan_lmac_if_tx_ops *tx_ops;
tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
if (!tx_ops) {
gpio_err("tx_ops is NULL");
return false;
}
target_type_tx_ops = &tx_ops->target_tx_ops;
if (target_type_tx_ops->tgt_get_tgt_type)
target_type = target_type_tx_ops->tgt_get_tgt_type(psoc);
if ((target_type == TARGET_TYPE_QCA8074) ||
(target_type == TARGET_TYPE_QCN9100) ||
(target_type == TARGET_TYPE_QCA8074V2) ||
(target_type == TARGET_TYPE_QCA5018) ||
(target_type == TARGET_TYPE_QCA6018)) {
return true;
}
return false;
}
QDF_STATUS tgt_gpio_output(struct wlan_objmgr_psoc *psoc, uint32_t gpio_num,
uint32_t set)
{
struct gpio_output_params param;
if (!psoc) {
gpio_err("psoc_obj is null");
return QDF_STATUS_E_INVAL;
}
if (tgt_gpio_disabled(psoc))
return QDF_STATUS_E_INVAL;
qdf_mem_set(&param, sizeof(param), 0);
param.pin_num = gpio_num;
param.pin_set = set;
return tgt_set_gpio_output_req(psoc, &param);
}
qdf_export_symbol(tgt_gpio_output);