qcacmn: Add and enable GPIO Component
Add the common GPIO component code for MCC and WIN Change-Id: Id93629856d42afc433844b568deb2fa63a5b67e6
This commit is contained in:
59
gpio/core/inc/wlan_gpio_api.h
Normal file
59
gpio/core/inc/wlan_gpio_api.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. 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 above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_gpio_api.h
|
||||
*
|
||||
* This header file provide API declarations required for gpio cfg
|
||||
* that called by other components
|
||||
*/
|
||||
|
||||
#ifndef __WLAN_GPIO_CFG_API_H__
|
||||
#define __WLAN_GPIO_CFG_API_H__
|
||||
|
||||
#include <qdf_types.h>
|
||||
|
||||
#ifdef WLAN_FEATURE_GPIO_CFG
|
||||
|
||||
/**
|
||||
* wlan_gpio_init() - API to init component
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS wlan_gpio_init(void);
|
||||
|
||||
/**
|
||||
* wlan_gpio_deinit() - API to deinit component
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS wlan_gpio_deinit(void);
|
||||
|
||||
#else
|
||||
static inline
|
||||
QDF_STATUS wlan_gpio_init(void)
|
||||
{
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static inline
|
||||
QDF_STATUS wlan_gpio_deinit(void)
|
||||
{
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif /* WLAN_FEATURE_GPIO_CFG */
|
||||
#endif /*__WLAN_GPIO_CFG_API_H__*/
|
||||
|
86
gpio/core/inc/wlan_gpio_priv_api.h
Normal file
86
gpio/core/inc/wlan_gpio_priv_api.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. 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 above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_gpio_priv_api.h
|
||||
*
|
||||
* This header file provide API declarations required for gpio cfg
|
||||
* that called internally
|
||||
*/
|
||||
|
||||
#ifndef __WLAN_GPIO_CFG_PRIV_API_H__
|
||||
#define __WLAN_GPIO_CFG_PRIV_API_H__
|
||||
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <wlan_lmac_if_def.h>
|
||||
#include <qdf_lock.h>
|
||||
|
||||
#define gpio_debug(args ...) \
|
||||
QDF_TRACE_DEBUG(QDF_MODULE_ID_GPIO, ## args)
|
||||
#define gpio_err(args ...) \
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_GPIO, ## args)
|
||||
|
||||
/**
|
||||
* struct gpio_psoc_priv_obj - psoc private object
|
||||
* @lock: qdf spin lock
|
||||
* @soc: pointer to psoc object
|
||||
*/
|
||||
struct gpio_psoc_priv_obj {
|
||||
qdf_spinlock_t lock;
|
||||
struct wlan_objmgr_psoc *soc;
|
||||
};
|
||||
|
||||
/**
|
||||
* gpio_get_psoc_priv_obj() - get priv object from psoc object
|
||||
* @psoc: pointer to psoc object
|
||||
*
|
||||
* Return: pointer to gpio psoc private object
|
||||
*/
|
||||
static inline
|
||||
struct gpio_psoc_priv_obj *
|
||||
gpio_get_psoc_priv_obj(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct gpio_psoc_priv_obj *obj;
|
||||
|
||||
if (!psoc)
|
||||
return NULL;
|
||||
obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
|
||||
WLAN_UMAC_COMP_GPIO);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_psoc_get_gpio_txops() - get TX ops from the private object
|
||||
* @psoc: pointer to psoc object
|
||||
*
|
||||
* Return: pointer to TX op callback
|
||||
*/
|
||||
|
||||
static inline struct wlan_lmac_if_gpio_tx_ops *
|
||||
wlan_psoc_get_gpio_txops(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
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 NULL;
|
||||
}
|
||||
|
||||
return &tx_ops->gpio_ops;
|
||||
}
|
||||
#endif /*__WLAN_GPIO_CFG_PRIV_API_H__*/
|
مرجع در شماره جدید
Block a user