qcacmn: Abstraction mechanism for OS API's
Provide support for abstraction layer for OS API's. Change-Id: I1f51350c2ae4c35330aa7355e9cd20fa28aad194 CRs-Fixed: 2222560
This commit is contained in:
40
qal/inc/qal_devcfg.h
Normal file
40
qal/inc/qal_devcfg.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 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: qal_devcfg
|
||||
* QCA abstraction layer (QAL) device config APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_DEVCFG_H)
|
||||
#define __QDF_DEVCFG_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
/**
|
||||
* qal_devcfg_send_response() - send devcfg response
|
||||
* @cfgbuf: response buffer
|
||||
*
|
||||
* This function will send the response for a config request
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_devcfg_send_response(qdf_nbuf_t cfgbuf);
|
||||
#endif
|
185
qal/inc/qal_vbus_dev.h
Normal file
185
qal/inc/qal_vbus_dev.h
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qal_vbus_dev
|
||||
* QCA abstraction layer (QAL) virtual bus management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_VBUS_DEV_H)
|
||||
#define __QDF_VBUS_DEV_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_vbus_resource;
|
||||
struct qdf_vbus_rstctl;
|
||||
struct qdf_dev_clk;
|
||||
struct qdf_pfm_hndl;
|
||||
struct qdf_pfm_drv;
|
||||
|
||||
/**
|
||||
* qal_vbus_get_iorsc() - acquire io resource
|
||||
* @devnum: Device Number
|
||||
* @flag: Property bitmap for the io resource
|
||||
* @devname: Device name string
|
||||
*
|
||||
* This function will allocate the io resource for a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_get_iorsc(int devnum, uint32_t flag, char *devname);
|
||||
|
||||
/**
|
||||
* qdf_vbus_release_iorsc() - release io resource
|
||||
* @devnum: Device Number
|
||||
*
|
||||
* This function will release the io resource attached to a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_release_iorsc(int devnum);
|
||||
|
||||
/**
|
||||
* qal_vbus_enable_devclk() - enable device clock
|
||||
* @clk: Device clock
|
||||
*
|
||||
* This function will enable the clock for a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_enable_devclk(struct qdf_dev_clk *clk);
|
||||
|
||||
/**
|
||||
* qal_vbus_disable_devclk() - disable device clock
|
||||
* @clk: Device clock
|
||||
*
|
||||
* This function will disable the clock for a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_disable_devclk(struct qdf_dev_clk *clk);
|
||||
|
||||
/**
|
||||
* qal_vbus_acquire_dev_rstctl() - get device reset control
|
||||
* @pfhndl: Device handle
|
||||
* @state: Device state information
|
||||
* @rstctl: Device reset control handle
|
||||
*
|
||||
* This function will acquire the control to reset the device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state,
|
||||
struct qdf_vbus_rstctl **rstctl);
|
||||
|
||||
/**
|
||||
* qal_vbus_release_dev_rstctl() - release device reset control
|
||||
* @pfhndl: Device handle
|
||||
* @rstctl: Device reset control handle
|
||||
*
|
||||
* This function will release the control to reset the device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl);
|
||||
|
||||
/**
|
||||
* qal_vbus_activate_dev_rstctl() - activate device reset control
|
||||
* @pfhndl: Device handle
|
||||
* @rstctl: Device reset control handle
|
||||
*
|
||||
* This function will activate the reset control for the device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl);
|
||||
|
||||
/**
|
||||
* qal_vbus_deactivate_dev_rstctl() - deactivate device reset control
|
||||
* @pfhndl: Device handle
|
||||
* @rstctl: Device reset control handle
|
||||
*
|
||||
* This function will deactivate the reset control for the device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl);
|
||||
|
||||
/**
|
||||
* qal_vbus_get_resource() - get resource
|
||||
* @pfhndl: Device handle
|
||||
* @rsc: Resource handle
|
||||
* @restype: Resource type
|
||||
* @residx: Resource index
|
||||
*
|
||||
* This function will acquire a particular resource and attach it to the device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_get_resource(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_resource **rsc, uint32_t restype,
|
||||
uint32_t residx);
|
||||
|
||||
/**
|
||||
* qal_vbus_get_irq() - get irq
|
||||
* @pfhndl: Device handle
|
||||
* @str: Device identifier
|
||||
* @irq: irq number
|
||||
*
|
||||
* This function will acquire an irq for the device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_get_irq(struct qdf_pfm_hndl *pfhndl, const char *str, int *irq);
|
||||
|
||||
/**
|
||||
* qal_vbus_register_driver() - register driver
|
||||
* @pfdev: Device handle
|
||||
*
|
||||
* This function will initialize a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_register_driver(struct qdf_pfm_drv *pfdev);
|
||||
|
||||
/**
|
||||
* qal_vbus_deregister_driver() - deregister driver
|
||||
* @pfdev: Device handle
|
||||
*
|
||||
* This function will deregister the driver for a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev);
|
||||
#endif
|
45
qal/linux/src/qal_devcfg.c
Normal file
45
qal/linux/src/qal_devcfg.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qal_devcfg
|
||||
* This file provides OS dependent device config related APIs
|
||||
*/
|
||||
|
||||
#include "qdf_debugfs.h"
|
||||
#include "qdf_mem.h"
|
||||
#include "qdf_types.h"
|
||||
#include "qdf_nbuf.h"
|
||||
#include "qdf_module.h"
|
||||
#include "qal_devcfg.h"
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
QDF_STATUS
|
||||
qal_devcfg_send_response(qdf_nbuf_t cfgbuf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!cfgbuf)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = cfg80211_vendor_cmd_reply(cfgbuf);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_devcfg_send_response);
|
252
qal/linux/src/qal_vbus_dev.c
Normal file
252
qal/linux/src/qal_vbus_dev.c
Normal file
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qal_vbus_dev
|
||||
* This file provides OS dependent virtual bus device related APIs
|
||||
*/
|
||||
|
||||
#include "qdf_util.h"
|
||||
#include "qal_vbus_dev.h"
|
||||
#include "qdf_module.h"
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/platform_device.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
||||
#include <linux/reset.h>
|
||||
#endif
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_get_iorsc(int devnum, uint32_t flag, char *devname)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!devname)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = gpio_request_one(devnum, flag, devname);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_get_iorsc);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_release_iorsc(int devnum)
|
||||
{
|
||||
if (devnum <= 0)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
gpio_free(devnum);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_release_iorsc);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_enable_devclk(struct qdf_dev_clk *clk)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!clk)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = clk_prepare_enable((struct clk *)clk);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_enable_devclk);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_disable_devclk(struct qdf_dev_clk *clk)
|
||||
{
|
||||
if (!clk)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
clk_disable_unprepare((struct clk *)clk);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_disable_devclk);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
||||
QDF_STATUS
|
||||
qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state,
|
||||
struct qdf_vbus_rstctl **rstctl)
|
||||
{
|
||||
struct platform_device *pfdev;
|
||||
struct reset_control *rsctl;
|
||||
|
||||
if (!pfhndl || !state)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
pfdev = (struct platform_device *)pfhndl;
|
||||
rsctl = reset_control_get(&pfdev->dev, state);
|
||||
|
||||
if (!rsctl)
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
*rstctl = (struct qdf_vbus_rstctl *)rsctl;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
QDF_STATUS
|
||||
qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state,
|
||||
struct qdf_vbus_rstctl **rstctl)
|
||||
{
|
||||
if (!pfhndl || !state)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
*rstctl = NULL;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
qdf_export_symbol(qal_vbus_get_dev_rstctl);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
||||
QDF_STATUS
|
||||
qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl)
|
||||
{
|
||||
if (!pfhndl || !rstctl)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
reset_control_put((struct reset_control *)rstctl);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
QDF_STATUS
|
||||
qal_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl)
|
||||
{
|
||||
if (!pfhndl || !rstctl)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
qdf_export_symbol(qal_vbus_release_dev_rstctl);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!pfhndl || !rstctl)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = reset_control_assert((struct reset_control *)rstctl);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_activate_dev_rstctl);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_rstctl *rstctl)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!pfhndl || !rstctl)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = reset_control_deassert((struct reset_control *)rstctl);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_deactivate_dev_rstctl);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_get_resource(struct qdf_pfm_hndl *pfhndl,
|
||||
struct qdf_vbus_resource **rsc,
|
||||
uint32_t restype, uint32_t residx)
|
||||
{
|
||||
struct resource *rsrc;
|
||||
|
||||
if (!pfhndl)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
rsrc = platform_get_resource((struct platform_device *)pfhndl,
|
||||
restype, residx);
|
||||
if (!rsrc)
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
*rsc = (struct qdf_vbus_resource *)rsrc;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_get_resource);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_get_irq(struct qdf_pfm_hndl *pfhndl, const char *str, int *irq)
|
||||
{
|
||||
int inum;
|
||||
|
||||
if (!pfhndl || !str)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
inum = platform_get_irq_byname((struct platform_device *)pfhndl, str);
|
||||
|
||||
if (inum < 0)
|
||||
return QDF_STATUS_E_FAULT;
|
||||
|
||||
*irq = inum;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_get_irq);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_register_driver(struct qdf_pfm_drv *pfdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!pfdev)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = platform_driver_register((struct platform_driver *)pfdev);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_register_driver);
|
||||
|
||||
QDF_STATUS
|
||||
qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev)
|
||||
{
|
||||
if (!pfdev)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
platform_driver_unregister((struct platform_driver *)pfdev);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qal_vbus_deregister_driver);
|
10
qdf/Kbuild
10
qdf/Kbuild
@@ -15,6 +15,7 @@ INCS += -Iinclude/nbuf -Iinclude/net -Iinclude/os
|
||||
INCS += -Inbuf/linux -Inet/linux -Ios/linux
|
||||
INCS += -I$(WLAN_TOP)/../../include
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qdf/inc
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qal/inc
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qdf/linux/src
|
||||
INCS += -I$(obj)/$(HOST_CMN_CONVG_PTT)/inc \
|
||||
-I$(obj)/$(HOST_CMN_CONVG_NLINK)/inc \
|
||||
@@ -34,22 +35,27 @@ endif
|
||||
|
||||
qdf-objs := \
|
||||
linux/src/qdf_defer.o \
|
||||
linux/src/qdf_dev.o \
|
||||
linux/src/qdf_event.o \
|
||||
linux/src/qdf_file.o \
|
||||
linux/src/qdf_list.o \
|
||||
linux/src/qdf_lock.o \
|
||||
linux/src/qdf_mc_timer.o \
|
||||
linux/src/qdf_mem.o \
|
||||
linux/src/qdf_module.o \
|
||||
linux/src/qdf_net_if.o \
|
||||
linux/src/qdf_nbuf.o \
|
||||
linux/src/qdf_perf.o \
|
||||
linux/src/qdf_threads.o \
|
||||
linux/src/qdf_trace.o \
|
||||
linux/src/qdf_file.o \
|
||||
linux/src/qdf_vfs.o \
|
||||
src/qdf_flex_mem.o \
|
||||
src/qdf_parse.o \
|
||||
src/qdf_str.o \
|
||||
src/qdf_types.o \
|
||||
$(HOST_CMN_CONVG_NLINK)/src/wlan_nlink_srv.o
|
||||
$(HOST_CMN_CONVG_NLINK)/src/wlan_nlink_srv.o \
|
||||
$(HOST_CMN_CONVG_SRC)/qal/linux/src/qal_devcfg.o \
|
||||
$(HOST_CMN_CONVG_SRC)/qal/linux/src/qal_vbus_dev.o \
|
||||
#linux/src/qdf_net.o \
|
||||
#linux/src/qdf_net_event.o \
|
||||
#linux/src/qdf_net_ioctl.o
|
||||
|
85
qdf/inc/qdf_dev.h
Normal file
85
qdf/inc/qdf_dev.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qdf_dev
|
||||
* QCA driver framework (QDF) device management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_DEV_H)
|
||||
#define __QDF_DEV_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_cpu_mask;
|
||||
struct qdf_devm;
|
||||
|
||||
/**
|
||||
* qdf_dev_alloc_mem() - allocate memory
|
||||
* @qdfdev: Device handle
|
||||
* @mrptr: Pointer to the allocated memory
|
||||
* @reqsize: Allocation request in bytes
|
||||
* @mask: Property mask to be associated to the allocated memory
|
||||
*
|
||||
* This function will acquire memory to be associated with a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_alloc_mem(qdf_device_t qdfdev, struct qdf_devm **mrptr,
|
||||
uint32_t reqsize, uint32_t mask);
|
||||
|
||||
/**
|
||||
* qdf_dev_release_mem() - release memory
|
||||
* @qdfdev: Device handle
|
||||
* @mrptr: Pointer to the allocated memory
|
||||
*
|
||||
* This function will acquire memory to be associated with a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_release_mem(qdf_device_t qdfdev, struct qdf_devm *mrptr);
|
||||
|
||||
/**
|
||||
* qdf_dev_modify_irq() - modify irq
|
||||
* @irnum: irq number
|
||||
* @cmask: Bitmap to be cleared for the property mask
|
||||
* @smask: Bitmap to be set for the property mask
|
||||
*
|
||||
* This function will acquire memory to be associated with a device
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
|
||||
unsigned long smask);
|
||||
|
||||
/**
|
||||
* qdf_dev_set_irq_affinity() - set irq affinity
|
||||
* @irnum: irq number
|
||||
* @cpmask: cpu affinity bitmap
|
||||
*
|
||||
* This function will set the affinity level for an irq
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask);
|
||||
#endif
|
42
qdf/inc/qdf_net_if.h
Normal file
42
qdf/inc/qdf_net_if.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 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: qdf_net_if
|
||||
* QCA driver framework (QDF) network interface management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_NET_IF_H)
|
||||
#define __QDF_NET_IF_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_net_if;
|
||||
|
||||
/**
|
||||
* qdf_net_if_create_dummy_if() - create dummy interface
|
||||
* @nif: interface handle
|
||||
*
|
||||
* This function will create a dummy network interface
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_net_if_create_dummy_if(struct qdf_net_if *nif);
|
||||
#endif
|
85
qdf/inc/qdf_vfs.h
Normal file
85
qdf/inc/qdf_vfs.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qdf_vfs
|
||||
* QCA driver framework (QDF) virtual filesystem management APIs
|
||||
*/
|
||||
|
||||
#if !defined(__QDF_VFS_H)
|
||||
#define __QDF_VFS_H
|
||||
|
||||
/* Include Files */
|
||||
#include <qdf_types.h>
|
||||
|
||||
struct qdf_vfs_attr;
|
||||
struct qdf_vf_bin_attr;
|
||||
struct qdf_dev_obj;
|
||||
|
||||
/**
|
||||
* qdf_vfs_set_file_attributes() - set file attributes
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will set the attributes of a file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_set_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr);
|
||||
|
||||
/**
|
||||
* qdf_vfs_clear_file_attributes() - clear file attributes
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will clear the attributes of a file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_clear_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr);
|
||||
|
||||
/**
|
||||
* qdf_vfs_create_binfile() - create binfile
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will create a binary file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_create_binfile(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vf_bin_attr *attr);
|
||||
|
||||
/**
|
||||
* qdf_vfs_delete_binfile() - delete binfile
|
||||
* @devobj: Device object
|
||||
* @attr: File attribute
|
||||
*
|
||||
* This function will delete a binary file
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success
|
||||
*/
|
||||
QDF_STATUS
|
||||
qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vf_bin_attr *attr);
|
||||
#endif
|
91
qdf/linux/src/qdf_dev.c
Normal file
91
qdf/linux/src/qdf_dev.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qdf_dev
|
||||
* This file provides OS dependent device related APIs
|
||||
*/
|
||||
|
||||
#include "qdf_dev.h"
|
||||
#include "qdf_mem.h"
|
||||
#include "qdf_util.h"
|
||||
#include "qdf_module.h"
|
||||
#include <linux/irq.h>
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_alloc_mem(qdf_device_t qdfdev, struct qdf_devm **mrptr,
|
||||
uint32_t reqsize, uint32_t mask)
|
||||
{
|
||||
struct qdf_devm *mptr;
|
||||
|
||||
if (!qdfdev)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
mptr = devm_kzalloc(qdfdev->dev, reqsize, mask);
|
||||
|
||||
if (!mrptr)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
*mrptr = mptr;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_alloc_mem);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_release_mem(qdf_device_t qdfdev, struct qdf_devm *mrptr)
|
||||
{
|
||||
if (!mrptr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
devm_kfree(qdfdev->dev, mrptr);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_release_mem);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask,
|
||||
unsigned long smask)
|
||||
{
|
||||
if (irnum <= 0)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
irq_modify_status(irnum, cmask, smask);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_modify_irq_status);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (irnum <= 0)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = irq_set_affinity_hint(irnum, (struct cpumask *)cpmask);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_dev_set_irq_affinity);
|
43
qdf/linux/src/qdf_net_if.c
Normal file
43
qdf/linux/src/qdf_net_if.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qdf_net_if
|
||||
* This file provides OS dependent network interface related APIs
|
||||
*/
|
||||
|
||||
#include "qdf_net_if.h"
|
||||
#include "qdf_types.h"
|
||||
#include "qdf_module.h"
|
||||
#include "qdf_util.h"
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
QDF_STATUS
|
||||
qdf_net_if_create_dummy_if(struct qdf_net_if *nif)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!nif)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = init_dummy_netdev((struct net_device *)nif);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_net_if_create_dummy_if);
|
90
qdf/linux/src/qdf_vfs.c
Normal file
90
qdf/linux/src/qdf_vfs.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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: qdf_vfs
|
||||
* This file provides OS dependent virtual fiesystem APIs
|
||||
*/
|
||||
|
||||
#include "qdf_vfs.h"
|
||||
#include "qdf_util.h"
|
||||
#include "qdf_module.h"
|
||||
#include <linux/string.h>
|
||||
#include <linux/kobject.h>
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_set_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = sysfs_create_group((struct kobject *)devobj,
|
||||
(struct attribute_group *)attr);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_set_file_attributes);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_clear_file_attributes(struct qdf_dev_obj *devobj,
|
||||
struct qdf_vfs_attr *attr)
|
||||
{
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
sysfs_remove_group((struct kobject *)devobj,
|
||||
(struct attribute_group *)attr);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_clear_file_attributes);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_create_binfile(struct qdf_dev_obj *devobj, struct qdf_vf_bin_attr *attr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
ret = sysfs_create_bin_file((struct kobject *)devobj,
|
||||
(struct bin_attribute *)attr);
|
||||
|
||||
return qdf_status_from_os_return(ret);
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_create_binfile);
|
||||
|
||||
QDF_STATUS
|
||||
qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj, struct qdf_vf_bin_attr *attr)
|
||||
{
|
||||
if (!devobj || !attr)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
sysfs_remove_bin_file((struct kobject *)devobj,
|
||||
(struct bin_attribute *)attr);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
qdf_export_symbol(qdf_vfs_delete_binfile);
|
Reference in New Issue
Block a user