qcacld-3.0: add build flag DYNAMIC_SINGLE_CHIP

Introduces a new build flag 'DYNAMIC_SINGLE_CHIP':
If DYNAMIC_SINGLE_CHIP is defined, which means there
are multiple possible drivers, but only requires one
instance of driver at a time. In such case, leave
MULTI_IF_NAME undefined, no matter what the module
name is, only prepend DYNAMIC_SINGLE_CHIP to names
of firmware/mac/ini files.

Take path of driverdump and ini file for example:
If both MULTI_IF_NAME and DYNAMIC_SINGLE_CHIP are not
defined, the paths are:
driverdump: '/proc/debugdriver/driverdump'
ini: '/<fw_root>/wlan/qca_cld/WCNSS_qcom_cfg.ini'

If DYNAMIC_SINGLE_CHIP is defined as 'qca6174':
driverdump: '/proc/debugdriver/driverdump'
ini: '/<fw_root>/wlan/qca_cld/qca6174/WCNSS_qcom_cfg.ini'

If MULTI_IF_NAME is defined as 'qca6174' and
DYNAMIC_SINGLE_CHIP is not defined:
driverdump: '/proc/debugdriverqca6174/driverdump'
ini: '/<fw_root>/wlan/qca_cld/qca6174/WCNSS_qcom_cfg.ini'

On LA platform, DYNAMIC_SINGLE_CHIP is controlled by
TARGET_WLAN_CHIP and TARGET_MULTI_WLAN:

If more than one WLAN devices are enabled in TARGET_WLAN_CHIP,
and TARGET_MULTI_WLAN is not set to 'true',
DYNAMIC_SINGLE_CHIP will be set to the device name, to
avoid name conflicts of firmware/mac/ini files;
meanwhile, MODNAME is set to 'wlan', then paths for
debugging are not changed.
Otherwise, MULTI_IF_NAME will be defined if requires
multiple instances of driver.

Change-Id: I22ed34d80d3540451bf8b891243c6cdac5a73d7e
CRs-Fixed: 2402432
This commit is contained in:
Yu Wang 2019-03-13 17:55:44 +08:00 committed by nshrivas
parent 793fd05680
commit 7d866f6906
5 changed files with 67 additions and 15 deletions

View File

@ -23,16 +23,18 @@ ifneq ($(findstring opensource,$(LOCAL_PATH)),)
endif # opensource
# Multi-ko check
LOCAL_MOD_NAME := $(lastword $(strip \
LOCAL_DEV_NAME := $(lastword $(strip \
$(subst ~, , \
$(subst /, ,$(LOCAL_PATH)))))
ifeq (1, $(strip $(shell expr $(words $(strip $(TARGET_WLAN_CHIP))) \>= 2)))
ifeq ($(LOCAL_MOD_NAME), qcacld-3.0)
ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
LOCAL_MULTI_KO := true
else
LOCAL_MULTI_KO := false
endif
endif
ifeq ($(LOCAL_MULTI_KO), true)
@ -56,7 +58,9 @@ include $(foreach chip, $(TARGET_WLAN_CHIP), $(LOCAL_PATH)/~$(chip)/Android.mk)
else # Multi-ok check
ifeq ($(LOCAL_MOD_NAME), qcacld-3.0)
ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
LOCAL_DEV_NAME := wlan
LOCAL_MOD_NAME := wlan
CMN_OFFSET := ..
LOCAL_SRC_DIR :=
@ -64,13 +68,23 @@ WLAN_PROFILE := default
TARGET_FW_DIR := firmware/wlan/qca_cld
TARGET_CFG_PATH := /vendor/etc/wifi
TARGET_MAC_BIN_PATH := /mnt/vendor/persist
else
LOCAL_SRC_DIR := ~$(LOCAL_MOD_NAME)
LOCAL_SRC_DIR := ~$(LOCAL_DEV_NAME)
CMN_OFFSET := .
WLAN_PROFILE := $(LOCAL_MOD_NAME)
TARGET_FW_DIR := firmware/wlan/qca_cld/$(LOCAL_MOD_NAME)
TARGET_CFG_PATH := /vendor/etc/wifi/$(LOCAL_MOD_NAME)
TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_MOD_NAME)
WLAN_PROFILE := $(LOCAL_DEV_NAME)
TARGET_FW_DIR := firmware/wlan/qca_cld/$(LOCAL_DEV_NAME)
TARGET_CFG_PATH := /vendor/etc/wifi/$(LOCAL_DEV_NAME)
TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_DEV_NAME)
ifneq ($(TARGET_MULTI_WLAN), true)
LOCAL_MOD_NAME := wlan
DYNAMIC_SINGLE_CHIP := $(LOCAL_DEV_NAME)
else
LOCAL_MOD_NAME := $(LOCAL_DEV_NAME)
endif
endif
# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
@ -88,6 +102,7 @@ KBUILD_OPTIONS += WLAN_COMMON_ROOT=$(CMN_OFFSET)/qca-wifi-host-cmn
KBUILD_OPTIONS += WLAN_COMMON_INC=$(WLAN_BLD_DIR)/qca-wifi-host-cmn
KBUILD_OPTIONS += WLAN_FW_API=$(WLAN_BLD_DIR)/fw-api
KBUILD_OPTIONS += WLAN_PROFILE=$(WLAN_PROFILE)
KBUILD_OPTIONS += DYNAMIC_SINGLE_CHIP=$(DYNAMIC_SINGLE_CHIP)
# We are actually building wlan.ko here, as per the
# requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
@ -98,7 +113,7 @@ KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
KBUILD_OPTIONS += $(WLAN_SELECT)
include $(CLEAR_VARS)
LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_MOD_NAME).ko
LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko
LOCAL_MODULE_KBUILD_NAME := $(LOCAL_MOD_NAME).ko
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_DEBUG_ENABLE := true
@ -120,11 +135,11 @@ ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
ifneq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),)
$(shell mkdir -p $(TARGET_OUT_VENDOR)/lib/modules; \
ln -sf /$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MOD_NAME).ko)
ln -sf /$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
endif
else
$(shell mkdir -p $(TARGET_OUT)/lib/modules; \
ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/$(LOCAL_MOD_NAME).ko)
ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
endif
endif

12
Kbuild
View File

@ -2710,11 +2710,23 @@ endif
# This allows multiple instances of the driver with different module names.
# If the module name is wlan, leave MULTI_IF_NAME undefined and the code will
# treat the driver as the primary driver.
#
# If DYNAMIC_SINGLE_CHIP is defined, which means there are multiple possible
# drivers, but only 1 driver will be loaded at a time(WLAN dynamic detect),
# leave MULTI_IF_NAME undefined, no matter what the module name is, then
# host driver will only append DYNAMIC_SINGLE_CHIP to the path of
# firmware/mac/ini file.
ifneq ($(DYNAMIC_SINGLE_CHIP),)
ccflags-y += -DDYNAMIC_SINGLE_CHIP=\"$(DYNAMIC_SINGLE_CHIP)\"
else
ifneq ($(MODNAME), wlan)
CHIP_NAME ?= $(MODNAME)
ccflags-y += -DMULTI_IF_NAME=\"$(CHIP_NAME)\"
endif
endif #DYNAMIC_SINGLE_CHIP
# WLAN_HDD_ADAPTER_MAGIC must be unique for all instances of the driver on the
# system. If it is not defined, then the host driver will use the first 4
# characters (including NULL) of MULTI_IF_NAME to construct

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2014,2016-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014,2016-2017,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
@ -19,15 +19,28 @@
#ifndef WLAN_HDD_MISC_H
#define WLAN_HDD_MISC_H
/*
* If MULTI_IF_NAME is defined, then prepend MULTI_IF_NAME to the filename
* to prevent name conflicts when loading multiple instances of the driver.
* To prevent name conflicts when loading different instances of the driver:
*
* If DYNAMIC_SINGLE_CHIP is defined, which means there are multiple possible
* drivers, but only one instance of driver at a time(WLAN dynamic detect),
* prepend DYNAMIC_SINGLE_CHIP to the filenames.
*
* Otherwise, if MULTI_IF_NAME is defined, which means there are multiple
* instances of the driver with different module names, prepend MULTI_IF_NAME
* to the filenames.
*/
#ifdef DYNAMIC_SINGLE_CHIP
#define PREFIX DYNAMIC_SINGLE_CHIP "/"
#else
#ifdef MULTI_IF_NAME
#define PREFIX MULTI_IF_NAME "/"
#else
#define PREFIX ""
#endif
#endif
#ifdef MSM_PLATFORM
#define WLAN_INI_FILE "wlan/qca_cld/" PREFIX "WCNSS_qcom_cfg.ini"
#define WLAN_MAC_FILE "wlan/qca_cld/" PREFIX "wlan_mac.bin"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-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
@ -24,12 +24,18 @@
#endif
#include "pld_internal.h"
#ifdef DYNAMIC_SINGLE_CHIP
#define PREFIX DYNAMIC_SINGLE_CHIP "/"
#else
#ifdef MULTI_IF_NAME
#define PREFIX MULTI_IF_NAME "/"
#else
#define PREFIX ""
#endif
#endif
#ifndef HIF_PCI
static inline int pld_pcie_register_driver(void)
{

View File

@ -24,12 +24,18 @@
#endif
#include "pld_common.h"
#ifdef DYNAMIC_SINGLE_CHIP
#define PREFIX DYNAMIC_SINGLE_CHIP "/"
#else
#ifdef MULTI_IF_NAME
#define PREFIX MULTI_IF_NAME "/"
#else
#define PREFIX ""
#endif
#endif
#define PLD_QCA9377_REV1_1_VERSION 0x5020001
#define PLD_QCA9379_REV1_VERSION 0x5040000