qcacld-3.0: Add support for QMI component

Add support for QMI component.

Change-Id: I63735800ea1166e875ff12bfd22df3c3d9c6312f
CRs-Fixed: 3337043
This commit is contained in:
Yeshwanth Sriram Guntuka
2022-11-15 11:45:19 +05:30
کامیت شده توسط Madan Koyyalamudi
والد ec079fcb49
کامیت d2cc52d5ae
11فایلهای تغییر یافته به همراه827 افزوده شده و 0 حذف شده

مشاهده پرونده

@@ -0,0 +1,80 @@
/*
* 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 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_qmi_main.h
*
* QMI component core function declarations
*/
#ifndef _WLAN_QMI_MAIN_H_
#define _WLAN_QMI_MAIN_H_
#include "wlan_objmgr_psoc_obj.h"
#include <qdf_trace.h>
#define qmi_debug(params...) \
QDF_TRACE_DEBUG(QDF_MODULE_ID_QMI, params)
#define qmi_debug_rl(params...) \
QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_QMI, params)
#define qmi_info(params...) \
QDF_TRACE_INFO(QDF_MODULE_ID_QMI, params)
#define qmi_warn(params...) \
QDF_TRACE_WARN(QDF_MODULE_ID_QMI, params)
#define qmi_err(params...) \
QDF_TRACE_ERROR(QDF_MODULE_ID_QMI, params)
#define qmi_fatal(params...) \
QDF_TRACE_FATAL(QDF_MODULE_ID_QMI, params)
#define qmi_nofl_debug(params...) \
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_QMI, params)
#define qmi_nofl_info(params...) \
QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_QMI, params)
#define qmi_nofl_warn(params...) \
QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_QMI, params)
#define qmi_nofl_err(params...) \
QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_QMI, params)
#define qmi_nofl_fatal(params...) \
QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_QMI, params)
/**
* qmi_psoc_obj_create_notification() - Function to allocate per psoc QMI
* private object
* @psoc: psoc context
* @arg: Pointer to arguments
*
* This function gets called from object manager when psoc is being
* created and creates QMI soc context.
*
* Return: QDF status
*/
QDF_STATUS
qmi_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc, void *arg);
/**
* qmi_psoc_obj_destroy_notification() - Free per psoc QMI private object
* @psoc: psoc context
* @arg: Pointer to arguments
*
* This function gets called from object manager when psoc is being
* deleted and delete QMI soc context.
*
* Return: QDF status
*/
QDF_STATUS
qmi_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg);
#endif

مشاهده پرونده

@@ -0,0 +1,54 @@
/*
* 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 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_qmi_objmgr.h
*
* This file contains various object manager related wrappers and helpers
*/
#ifndef _WLAN_QMI_OBJMGR_H_
#define _WLAN_QMI_OBJMGR_H_
#include "wlan_cmn.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_qmi_priv.h"
#define qmi_comp_psoc_get_ref(psoc) wlan_objmgr_psoc_try_get_ref(psoc, \
WLAN_QMI_ID)
#define qmi_comp_psoc_put_ref(psoc) wlan_objmgr_psoc_release_ref(psoc, \
WLAN_QMI_ID)
/**
* qmi_psoc_get_priv() - Wrapper to retrieve psoc priv obj
* @psoc: psoc pointer
*
* Return: QMI psoc private object
*/
static inline
struct wlan_qmi_psoc_context *qmi_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
{
struct wlan_qmi_psoc_context *qmi_ctx;
qmi_ctx = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_QMI);
QDF_BUG(qmi_ctx);
return qmi_ctx;
}
#endif

مشاهده پرونده

@@ -0,0 +1,38 @@
/*
* 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 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_qmi_priv.h
*
* Declare various struct, macros which are used private to QMI component.
*/
#ifndef _WLAN_QMI_PRIV_H_
#define _WLAN_QMI_PRIV_H_
#include "wlan_qmi_public_struct.h"
#include "wlan_objmgr_psoc_obj.h"
/**
* struct wlan_qmi_psoc_context - psoc related data required for QMI
* @psoc: object manager psoc context
* @qmi_cbs: QMI callbacks
*/
struct wlan_qmi_psoc_context {
struct wlan_objmgr_psoc *psoc;
struct wlan_qmi_psoc_callbacks qmi_cbs;
};
#endif

مشاهده پرونده

@@ -0,0 +1,71 @@
/*
* 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 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_qmi_main.c
*
* QMI component core function definitions
*/
#include "wlan_qmi_main.h"
#include "wlan_qmi_public_struct.h"
#include "wlan_qmi_objmgr.h"
QDF_STATUS
qmi_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct wlan_qmi_psoc_context *qmi_ctx;
QDF_STATUS status;
qmi_ctx = qdf_mem_malloc(sizeof(*qmi_ctx));
if (!qmi_ctx)
return QDF_STATUS_E_NOMEM;
qmi_ctx->psoc = psoc;
status = wlan_objmgr_psoc_component_obj_attach(psoc, WLAN_UMAC_COMP_QMI,
qmi_ctx,
QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
qmi_err("Failed to attach psoc QMI component obj");
qdf_mem_free(qmi_ctx);
return status;
}
return status;
}
QDF_STATUS
qmi_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct wlan_qmi_psoc_context *qmi_ctx;
QDF_STATUS status;
qmi_ctx = qmi_psoc_get_priv(psoc);
if (!qmi_ctx) {
qmi_err("psoc priv is NULL");
return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_psoc_component_obj_detach(psoc, WLAN_UMAC_COMP_QMI,
qmi_ctx);
if (QDF_IS_STATUS_ERROR(status))
qmi_err("Failed to detach psoc QMI component obj");
qdf_mem_free(qmi_ctx);
return status;
}

مشاهده پرونده

@@ -0,0 +1,32 @@
/*
* 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 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_qmi_public_struct.h
*
* Contains QMI public data structure definitions.
*/
#ifndef _WLAN_QMI_PUBLIC_STRUCT_H_
#define _WLAN_QMI_PUBLIC_STRUCT_H_
/**
* struct wlan_qmi_psoc_callbacks - struct containing callbacks
* to osif QMI APIs
*/
struct wlan_qmi_psoc_callbacks {
};
#endif

مشاهده پرونده

@@ -0,0 +1,79 @@
/*
* 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 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_qmi_ucfg_api.h
*
* QMI component north bound interface
*/
#ifndef _WLAN_QMI_UCFG_API_H_
#define _WLAN_QMI_UCFG_API_H_
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_qmi_public_struct.h>
#ifdef QMI_COMPONENT_ENABLE
/**
* ucfg_qmi_init() - API to init QMI component
*
* This API is invoked from hdd_component_init during all component init.
* This API will register all required handlers for psoc object
* create/delete notification.
*
* Return: QDF status
*/
QDF_STATUS ucfg_qmi_init(void);
/**
* ucfg_qmi_deinit() - API to deinit QMI component
*
* This API is invoked from hdd_component_deinit during all component deinit.
* This API will unregister all required handlers for psoc object
* create/delete notification.
*
* Return: QDF status
*/
QDF_STATUS ucfg_qmi_deinit(void);
/**
* ucfg_qmi_register_os_if_callbacks() - API to register os if callbacks with
* QMI component
* @psoc: PSOC handle
* @cb_obj: callback object
*
* Return: None
*/
void ucfg_qmi_register_os_if_callbacks(struct wlan_objmgr_psoc *psoc,
struct wlan_qmi_psoc_callbacks *cb_obj);
#else
static inline QDF_STATUS ucfg_qmi_init(void)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS ucfg_qmi_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
static inline
void ucfg_qmi_register_os_if_callbacks(struct wlan_objmgr_psoc *psoc,
struct wlan_qmi_psoc_callbacks *cb_obj)
{
}
#endif
#endif

مشاهده پرونده

@@ -0,0 +1,91 @@
/*
* 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 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_qmi_ucfg_api.c
*
* QMI component north bound interface definitions
*/
#include "wlan_qmi_ucfg_api.h"
#include "wlan_qmi_main.h"
#include "wlan_qmi_objmgr.h"
#include "wlan_objmgr_global_obj.h"
#include "wlan_cmn.h"
QDF_STATUS ucfg_qmi_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_QMI,
qmi_psoc_obj_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
qmi_err("Failed to register psoc create handler for QMI");
return status;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_QMI,
qmi_psoc_obj_destroy_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
qmi_err("Failed to register psoc destroy handler for QMI");
goto fail_destroy_psoc;
}
return status;
fail_destroy_psoc:
wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_QMI,
qmi_psoc_obj_create_notification, NULL);
return status;
}
QDF_STATUS ucfg_qmi_deinit(void)
{
QDF_STATUS status;
qmi_debug("QMI module dispatcher deinit");
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_QMI,
qmi_psoc_obj_destroy_notification, NULL);
if (QDF_IS_STATUS_ERROR(status))
qmi_err("Failed to unregister QMI psoc delete handle:%d",
status);
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_QMI,
qmi_psoc_obj_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status))
qmi_err("Failed to unregister QMI psoc create handle:%d",
status);
return status;
}
void ucfg_qmi_register_os_if_callbacks(struct wlan_objmgr_psoc *psoc,
struct wlan_qmi_psoc_callbacks *cb_obj)
{
struct wlan_qmi_psoc_context *qmi_ctx = qmi_psoc_get_priv(psoc);
if (!qmi_ctx) {
qmi_err("QMI context is NULL");
return;
}
}