diff --git a/qal/inc/qal_devcfg.h b/qal/inc/qal_devcfg.h index 8a1030a5c4..2d4a88abc8 100644 --- a/qal/inc/qal_devcfg.h +++ b/qal/inc/qal_devcfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2019 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 @@ -21,12 +21,14 @@ * QCA abstraction layer (QAL) device config APIs */ -#if !defined(__QDF_DEVCFG_H) -#define __QDF_DEVCFG_H +#if !defined(__QAL_DEVCFG_H) +#define __QAL_DEVCFG_H /* Include Files */ #include +#include +#ifdef ENHANCED_OS_ABSTRACTION /** * qal_devcfg_send_response() - send devcfg response * @cfgbuf: response buffer @@ -37,4 +39,11 @@ */ QDF_STATUS qal_devcfg_send_response(qdf_nbuf_t cfgbuf); +#else +static inline QDF_STATUS +qal_devcfg_send_response(qdf_nbuf_t cfgbuf) +{ + return __qal_devcfg_send_response(cfgbuf); +} #endif +#endif /* __QAL_DEVCFG_H */ diff --git a/qal/inc/qal_vbus_dev.h b/qal/inc/qal_vbus_dev.h index ccad4ece80..67eab99e95 100644 --- a/qal/inc/qal_vbus_dev.h +++ b/qal/inc/qal_vbus_dev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 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 @@ -21,11 +21,12 @@ * QCA abstraction layer (QAL) virtual bus management APIs */ -#if !defined(__QDF_VBUS_DEV_H) -#define __QDF_VBUS_DEV_H +#if !defined(__QAL_VBUS_DEV_H) +#define __QAL_VBUS_DEV_H /* Include Files */ #include +#include struct qdf_vbus_resource; struct qdf_vbus_rstctl; @@ -33,6 +34,7 @@ struct qdf_dev_clk; struct qdf_pfm_hndl; struct qdf_pfm_drv; +#ifdef ENHANCED_OS_ABSTRACTION /** * qal_vbus_get_iorsc() - acquire io resource * @devnum: Device Number @@ -182,4 +184,83 @@ qal_vbus_register_driver(struct qdf_pfm_drv *pfdev); */ QDF_STATUS qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev); +#else +static inline QDF_STATUS +qal_vbus_get_iorsc(int devnum, uint32_t flag, char *devname) +{ + return __qal_vbus_get_iorsc(devnum, flag, devname); +} + +static inline QDF_STATUS +qal_vbus_release_iorsc(int devnum) +{ + return __qal_vbus_release_iorsc(devnum); +} + +static inline QDF_STATUS +qal_vbus_enable_devclk(struct qdf_dev_clk *clk) +{ + return __qal_vbus_enable_devclk(clk); +} + +static inline QDF_STATUS +qal_vbus_disable_devclk(struct qdf_dev_clk *clk) +{ + return __qal_vbus_disable_devclk(clk); +} + +static inline QDF_STATUS +qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state, + struct qdf_vbus_rstctl **rstctl) +{ + return __qal_vbus_get_dev_rstctl(pfhndl, state, rstctl); +} + +static inline QDF_STATUS +qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_rstctl *rstctl) +{ + return __qal_vbus_release_dev_rstctl(pfhndl, rstctl); +} + +static inline QDF_STATUS +qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_rstctl *rstctl) +{ + return __qal_vbus_activate_dev_rstctl(pfhndl, rstctl); +} + +static inline QDF_STATUS +qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_rstctl *rstctl) +{ + return __qal_vbus_deactivate_dev_rstctl(pfhndl, rstctl); +} + +static inline QDF_STATUS +qal_vbus_get_resource(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_resource **rsc, uint32_t restype, + uint32_t residx) +{ + return __qal_vbus_get_resource(pfhndl, rsc, restype, residx); +} + +static inline QDF_STATUS +qal_vbus_get_irq(struct qdf_pfm_hndl *pfhndl, const char *str, int *irq) +{ + return __qal_vbus_get_irq(pfhndl, str, irq); +} + +static inline QDF_STATUS +qal_vbus_register_driver(struct qdf_pfm_drv *pfdev) +{ + return __qal_vbus_register_driver(pfdev); +} + +static inline QDF_STATUS +qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev) +{ + return __qal_vbus_deregister_driver(pfdev); +} #endif +#endif /* __QAL_VBUS_DEV_H */ diff --git a/qal/linux/src/i_qal_devcfg.h b/qal/linux/src/i_qal_devcfg.h new file mode 100644 index 0000000000..aebb66c7dd --- /dev/null +++ b/qal/linux/src/i_qal_devcfg.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019 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(__I_QAL_DEVCFG_H) +#define __I_QAL_DEVCFG_H + +/* Include Files */ +#include +#include + +/** + * __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 + */ +static inline QDF_STATUS +__qal_devcfg_send_response(qdf_nbuf_t cfgbuf) +{ + cfg80211_vendor_cmd_reply(cfgbuf); + + return QDF_STATUS_SUCCESS; +} +#endif /* __I_QAL_DEVCFG_H */ diff --git a/qal/linux/src/i_qal_vbus_dev.h b/qal/linux/src/i_qal_vbus_dev.h new file mode 100644 index 0000000000..f9c0653d99 --- /dev/null +++ b/qal/linux/src/i_qal_vbus_dev.h @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2019 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(__I_QAL_VBUS_DEV_H) +#define __I_QAL_VBUS_DEV_H + +/* Include Files */ +#include +#include "qdf_util.h" +#include "qdf_module.h" +#include +#include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) +#include +#endif + +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 + */ +static inline QDF_STATUS +__qal_vbus_get_iorsc(int devnum, uint32_t flag, char *devname) +{ + int ret; + + ret = gpio_request_one(devnum, flag, devname); + + return qdf_status_from_os_return(ret); +} + +/** + * __qal_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 + */ +static inline QDF_STATUS +__qal_vbus_release_iorsc(int devnum) +{ + gpio_free(devnum); + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qal_vbus_enable_devclk(struct qdf_dev_clk *clk) +{ + int ret; + + ret = clk_prepare_enable((struct clk *)clk); + + return qdf_status_from_os_return(ret); +} + +/** + * __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 + */ +static inline QDF_STATUS +__qal_vbus_disable_devclk(struct qdf_dev_clk *clk) +{ + clk_disable_unprepare((struct clk *)clk); + + return QDF_STATUS_SUCCESS; +} + +/** + * __qal_vbus_get_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 + */ +static inline QDF_STATUS +__qal_vbus_get_dev_rstctl(struct qdf_pfm_hndl *pfhndl, const char *state, + struct qdf_vbus_rstctl **rstctl) +{ + struct reset_control *rsctl; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + rsctl = reset_control_get_optional((struct device *)pfhndl, state); +#else + rsctl = NULL; +#endif + *rstctl = (struct qdf_vbus_rstctl *)rsctl; + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qal_vbus_release_dev_rstctl(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_rstctl *rstctl) +{ + reset_control_put((struct reset_control *)rstctl); + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qal_vbus_activate_dev_rstctl(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_rstctl *rstctl) +{ + reset_control_assert((struct reset_control *)rstctl); + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qal_vbus_deactivate_dev_rstctl(struct qdf_pfm_hndl *pfhndl, + struct qdf_vbus_rstctl *rstctl) +{ + reset_control_deassert((struct reset_control *)rstctl); + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline 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; + + rsrc = platform_get_resource((struct platform_device *)pfhndl, + restype, residx); + *rsc = (struct qdf_vbus_resource *)rsrc; + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qal_vbus_get_irq(struct qdf_pfm_hndl *pfhndl, const char *str, int *irq) +{ + *irq = platform_get_irq_byname((struct platform_device *)pfhndl, str); + + if (*irq < 0) + return QDF_STATUS_E_FAULT; + + return QDF_STATUS_SUCCESS; +} + +/** + * __qal_vbus_register_driver() - register driver + * @pfdev: Device handle + * + * This function will initialize a device + * + * Return: QDF_STATUS_SUCCESS on success + */ +static inline QDF_STATUS +__qal_vbus_register_driver(struct qdf_pfm_drv *pfdev) +{ + int ret; + + ret = platform_driver_register((struct platform_driver *)pfdev); + + return qdf_status_from_os_return(ret); +} + +/** + * __qal_vbus_deregister_driver() - deregister driver + * @pfdev: Device handle + * + * This function will deregister the driver for a device + * + * Return: QDF_STATUS_SUCCESS on success + */ +static inline QDF_STATUS +__qal_vbus_deregister_driver(struct qdf_pfm_drv *pfdev) +{ + platform_driver_unregister((struct platform_driver *)pfdev); + + return QDF_STATUS_SUCCESS; +} +#endif /* __I_QAL_VBUS_DEV_H */ diff --git a/qdf/Kbuild b/qdf/Kbuild index b1468c5272..6405b99919 100644 --- a/qdf/Kbuild +++ b/qdf/Kbuild @@ -18,6 +18,7 @@ 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)/component_dev/qal/inc +INCS += -I$(WLAN_TOP)/cmn_dev/qal/linux/src INCS += -I$(WLAN_TOP)/cmn_dev/qdf/linux/src INCS += -I$(obj)/$(HOST_CMN_CONVG_PTT)/inc \ -I$(obj)/$(HOST_CMN_CONVG_NLINK)/inc \ @@ -58,8 +59,8 @@ src/qdf_str.o \ src/qdf_types.o \ src/qdf_platform.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 \ +$(HOST_QAL_SRC)/linux/src/qal_devcfg.o \ +$(HOST_QAL_SRC)/linux/src/qal_vbus_dev.o \ $(HOST_QAL_SRC)/linux/src/qal_streamfs.o \ #linux/src/qdf_net.o \ #linux/src/qdf_net_event.o \ diff --git a/qdf/inc/qdf_dev.h b/qdf/inc/qdf_dev.h index 276232adea..075514cbee 100644 --- a/qdf/inc/qdf_dev.h +++ b/qdf/inc/qdf_dev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 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 @@ -26,11 +26,13 @@ /* Include Files */ #include +#include "i_qdf_dev.h" struct qdf_cpu_mask; struct qdf_devm; struct qdf_dev; +#ifdef ENHANCED_OS_ABSTRACTION /** * qdf_dev_alloc_mem() - allocate memory * @qdfdev: Device handle @@ -83,4 +85,31 @@ qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask, */ QDF_STATUS qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask); +#else +static inline QDF_STATUS +qdf_dev_alloc_mem(struct qdf_dev *qdfdev, struct qdf_devm **mrptr, + uint32_t reqsize, uint32_t mask) +{ + return __qdf_dev_alloc_mem(qdfdev, mrptr, reqsize, mask); +} + +static inline QDF_STATUS +qdf_dev_release_mem(struct qdf_dev *qdfdev, struct qdf_devm *mrptr) +{ + return __qdf_dev_release_mem(qdfdev, mrptr); +} + +static inline QDF_STATUS +qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask, + unsigned long smask) +{ + return __qdf_dev_modify_irq_status(irnum, cmask, smask); +} + +static inline QDF_STATUS +qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask) +{ + return __qdf_dev_set_irq_affinity(irnum, cpmask); +} #endif +#endif /* __QDF_DEV_H */ diff --git a/qdf/inc/qdf_net_if.h b/qdf/inc/qdf_net_if.h index 2f4ff1f2e2..e0e190929a 100644 --- a/qdf/inc/qdf_net_if.h +++ b/qdf/inc/qdf_net_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2019 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 @@ -26,9 +26,11 @@ /* Include Files */ #include +#include struct qdf_net_if; +#ifdef ENHANCED_OS_ABSTRACTION /** * qdf_net_if_create_dummy_if() - create dummy interface * @nif: interface handle @@ -39,4 +41,11 @@ struct qdf_net_if; */ QDF_STATUS qdf_net_if_create_dummy_if(struct qdf_net_if *nif); +#else +static inline QDF_STATUS +qdf_net_if_create_dummy_if(struct qdf_net_if *nif) +{ + return __qdf_net_if_create_dummy_if(nif); +} #endif +#endif /* __QDF_NET_IF_H */ diff --git a/qdf/inc/qdf_vfs.h b/qdf/inc/qdf_vfs.h index 751c761621..4876bd975d 100644 --- a/qdf/inc/qdf_vfs.h +++ b/qdf/inc/qdf_vfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 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 @@ -31,6 +31,7 @@ struct qdf_vfs_attr; struct qdf_vf_bin_attr; struct qdf_dev_obj; +#ifdef ENHANCED_OS_ABSTRACTION /** * qdf_vfs_set_file_attributes() - set file attributes * @devobj: Device object @@ -82,4 +83,33 @@ qdf_vfs_create_binfile(struct qdf_dev_obj *devobj, QDF_STATUS qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj, struct qdf_vf_bin_attr *attr); +#else +static inline QDF_STATUS +qdf_vfs_set_file_attributes(struct qdf_dev_obj *devobj, + struct qdf_vfs_attr *attr) +{ + return __qdf_vfs_set_file_attributes(devobj, attr); +} + +static inline QDF_STATUS +qdf_vfs_clear_file_attributes(struct qdf_dev_obj *devobj, + struct qdf_vfs_attr *attr) +{ + return __qdf_vfs_clear_file_attributes(devobj, attr); +} + +statuc inline QDF_STATUS +qdf_vfs_create_binfile(struct qdf_dev_obj *devobj, + struct qdf_vf_bin_attr *attr) +{ + return __qdf_vfs_create_binfile(devobj, attr); +} + +static inline QDF_STATUS +qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj, + struct qdf_vf_bin_attr *attr) +{ + return __qdf_vfs_delete_binfile(devobj, attr); +} #endif +#endif /* __QDF_VFS_H */ diff --git a/qdf/linux/src/i_qdf_dev.h b/qdf/linux/src/i_qdf_dev.h new file mode 100644 index 0000000000..1a45fc8321 --- /dev/null +++ b/qdf/linux/src/i_qdf_dev.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2019 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(__I_QDF_DEV_H) +#define __I_QDF_DEV_H + +/* Include Files */ +#include +#include "qdf_util.h" +#include + +struct qdf_cpu_mask; +struct qdf_devm; +struct qdf_dev; + +/** + * __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 + */ +static inline QDF_STATUS +__qdf_dev_alloc_mem(struct qdf_dev *qdfdev, struct qdf_devm **mrptr, + uint32_t reqsize, uint32_t mask) +{ + *mrptr = devm_kzalloc((struct device *)qdfdev, reqsize, mask); + + if (!*mrptr) + return QDF_STATUS_E_NOMEM; + + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qdf_dev_release_mem(struct qdf_dev *qdfdev, struct qdf_devm *mrptr) +{ + devm_kfree((struct device *)qdfdev, mrptr); + + return QDF_STATUS_SUCCESS; +} + +/** + * __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 modify the properties of the irq associated with a device + * + * Return: QDF_STATUS_SUCCESS on success + */ +static inline QDF_STATUS +__qdf_dev_modify_irq_status(uint32_t irnum, unsigned long cmask, + unsigned long smask) +{ + irq_modify_status(irnum, cmask, smask); + + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +static inline QDF_STATUS +__qdf_dev_set_irq_affinity(uint32_t irnum, struct qdf_cpu_mask *cpmask) +{ + int ret; + + ret = irq_set_affinity_hint(irnum, (struct cpumask *)cpmask); + + return qdf_status_from_os_return(ret); +} +#endif /* __I_QDF_DEV_H */ diff --git a/qdf/linux/src/i_qdf_net_if.h b/qdf/linux/src/i_qdf_net_if.h new file mode 100644 index 0000000000..d459e892da --- /dev/null +++ b/qdf/linux/src/i_qdf_net_if.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019 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(__I_QDF_NET_IF_H) +#define __I_QDF_NET_IF_H + +/* Include Files */ +#include +#include +#include + +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 + */ +static inline QDF_STATUS +__qdf_net_if_create_dummy_if(struct qdf_net_if *nif) +{ + int ret; + + ret = init_dummy_netdev((struct net_device *)nif); + + return qdf_status_from_os_return(ret); +} +#endif /*__I_QDF_NET_IF_H */ diff --git a/qdf/linux/src/i_qdf_vfs.h b/qdf/linux/src/i_qdf_vfs.h new file mode 100644 index 0000000000..e719c4d85b --- /dev/null +++ b/qdf/linux/src/i_qdf_vfs.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2019 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(__I_QDF_VFS_H) +#define __I_QDF_VFS_H + +/* Include Files */ +#include + +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 + */ +static inline QDF_STATUS +__qdf_vfs_set_file_attributes(struct qdf_dev_obj *devobj, + struct qdf_vfs_attr *attr) +{ + int ret; + + ret = sysfs_create_group((struct kobject *)devobj, + (struct attribute_group *)attr); + + return qdf_status_from_os_return(ret); +} + +/** + * __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 + */ +static inline QDF_STATUS +__qdf_vfs_clear_file_attributes(struct qdf_dev_obj *devobj, + struct qdf_vfs_attr *attr) +{ + sysfs_remove_group((struct kobject *)devobj, + (struct attribute_group *)attr); + + return QDF_STATUS_SUCCESS; +} + +/** + * __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 + */ +statuc inline QDF_STATUS +__qdf_vfs_create_binfile(struct qdf_dev_obj *devobj, + struct qdf_vf_bin_attr *attr) +{ + int ret; + + ret = sysfs_create_bin_file((struct kobject *)devobj, + (struct bin_attribute *)attr); + + return qdf_status_from_os_return(ret); +} + +/** + * __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 + */ +static inline QDF_STATUS +__qdf_vfs_delete_binfile(struct qdf_dev_obj *devobj, + struct qdf_vf_bin_attr *attr) +{ + sysfs_remove_bin_file((struct kobject *)devobj, + (struct bin_attribute *)attr); + + return QDF_STATUS_SUCCESS; +} +#endif /* __I_QDF_VFS_H */