From 9440d3b99fde28b370d98499927de126f5137c62 Mon Sep 17 00:00:00 2001 From: zhaoxc0502 Date: Mon, 11 Apr 2022 11:52:52 +0800 Subject: [PATCH] codec check --- Kconfig | 1 + model/audio/Kconfig | 7 + model/audio/Makefile | 19 ++ model/input/Makefile | 2 + model/network/wifi/Kconfig | 7 + model/network/wifi/hdfwifi.mk | 1 - model/network/wifi/vendor/Makefile | 7 + model/network/wifi/vendor/ap6212/Makefile | 13 ++ model/network/wifi/vendor/hi3881/Makefile | 1 + model/storage/Kconfig | 7 + model/storage/Makefile | 5 + .../vendor_adapter/imx8mm_mmc_adapter.c | 38 ++++ network/src/net_device_adapter.c | 95 ++++++++ platform/Kconfig | 23 +- platform/mipi_dsi/Makefile | 5 + platform/mipi_dsi/mipi_drm_imx8mm.c | 209 ++++++++++++++++++ platform/uart/Makefile | 3 +- platform/watchdog/Makefile | 3 +- test/Kconfig | 7 + test/Makefile | 1 + 20 files changed, 450 insertions(+), 4 deletions(-) create mode 100644 model/network/wifi/vendor/ap6212/Makefile create mode 100644 model/storage/vendor_adapter/imx8mm_mmc_adapter.c create mode 100644 platform/mipi_dsi/mipi_drm_imx8mm.c diff --git a/Kconfig b/Kconfig index ff129ec..4fe34bf 100644 --- a/Kconfig +++ b/Kconfig @@ -28,5 +28,6 @@ source "drivers/hdf/khdf/model/audio/Kconfig" source "drivers/hdf/khdf/model/misc/vibrator/Kconfig" source "drivers/hdf/khdf/model/misc/dsoftbus/Kconfig" source "drivers/hdf/khdf/model/misc/light/Kconfig" +source "drivers/hdf/framework/model/input/driver/touchscreen/Kconfig" endif diff --git a/model/audio/Kconfig b/model/audio/Kconfig index e1beac5..66063cb 100644 --- a/model/audio/Kconfig +++ b/model/audio/Kconfig @@ -27,6 +27,13 @@ config DRIVERS_HDF_AUDIO_ANA_HEADSET support hook interrupt mode. support hook adc mode. +config DRIVERS_HDF_AUDIO_IMX8MM + bool "Enable HDF Audio Codec driver" + default n + depends on DRIVERS_HDF_AUDIO + help + Answer Y to choice HDF Audio Codec driver. + config DRIVERS_HDF_AUDIO_TEST bool "Enable HDF Audio driver Test" default n diff --git a/model/audio/Makefile b/model/audio/Makefile index 901164f..ec39eb2 100644 --- a/model/audio/Makefile +++ b/model/audio/Makefile @@ -19,6 +19,8 @@ KHDF_AUDIO_HI3516DV300_DIR = $(KHDF_AUDIO_BASE_ROOT_DIR)/drivers/peripheral/audi KHDF_AUDIO_HI3516DV300_INC_DIR = drivers/hdf/framework/../peripheral/audio/chipsets/hi3516dv300 KHDF_AUDIO_RK3568_DIR = $(KHDF_AUDIO_BASE_ROOT_DIR)/device/board/hihope/rk3568/audio_drivers KHDF_AUDIO_RK3568_INC_DIR = drivers/hdf/framework/../../device/board/hihope/rk3568/audio_drivers +KHDF_AUDIO_CODEC_DIR = $(KHDF_AUDIO_BASE_ROOT_DIR)/drivers/peripheral/audio/chipsets +KHDF_AUDIO_CODEC_INC_DIR = drivers/hdf/framework/../peripheral/audio/chipsets obj-$(CONFIG_DRIVERS_HDF_AUDIO) += \ $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_core.o \ @@ -66,6 +68,17 @@ obj-$(CONFIG_DRIVERS_HDF_AUDIO_ANA_HEADSET) += \ $(KHDF_AUDIO_RK3568_DIR)/headset_monitor/src/analog_headset_gpio.o \ $(KHDF_AUDIO_RK3568_DIR)/headset_monitor/src/analog_headset_adc.o +obj-$(CONFIG_DRIVERS_HDF_AUDIO_IMX8MM) += \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/soc/src/sai_driver.o \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/soc/src/dma_driver.o \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/soc/src/imx8mm_platform_ops.o \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/soc/src/imx8mm_dai_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/soc/src/imx8mm_platform_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/dsp/src/dsp_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/imx8mm/dsp/src/dsp_ops.o \ + $(KHDF_AUDIO_CODEC_DIR)/wm8904/codec/src/wm8904.o \ + $(KHDF_AUDIO_CODEC_DIR)/wm8904/codec/src/wm8904_impl.o + ccflags-$(CONFIG_DRIVERS_HDF_AUDIO) += -lm -lc -lgcc -std=gnu99 -Werror\ -I$(srctree)/$(KHDF_AUDIO_KHDF_ROOT_DIR)/osal/include \ -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/core \ @@ -100,3 +113,9 @@ ccflags-$(CONFIG_DRIVERS_HDF_AUDIO_ANA_HEADSET) += \ -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/model/input/driver \ -I$(srctree)/drivers/hdf/evdev \ -I$(srctree)/$(KHDF_AUDIO_RK3568_INC_DIR)/headset_monitor/include + +ccflags-$(CONFIG_DRIVERS_HDF_AUDIO_IMX8MM) += \ + -I$(srctree)/$(KHDF_AUDIO_CODEC_INC_DIR)/wm8904/codec/include \ + -I$(srctree)/$(KHDF_AUDIO_CODEC_INC_DIR)/imx8mm/soc/include \ + -I$(srctree)/$(KHDF_AUDIO_CODEC_INC_DIR)/imx8mm/dsp/include \ + -I$(srctree)/$(KHDF_AUDIO_CODEC_INC_DIR)/imx8mm/include \ No newline at end of file diff --git a/model/input/Makefile b/model/input/Makefile index 52eae07..42157ae 100644 --- a/model/input/Makefile +++ b/model/input/Makefile @@ -25,6 +25,8 @@ obj-$(CONFIG_DRIVERS_HDF_INPUT) += \ obj-$(CONFIG_DRIVERS_HDF_TP_5P5_GT911) += \ $(INPUT_ROOT_DIR)/touchscreen/touch_gt911.o +obj-$(CONFIG_ARCH_NXP_TOUCH) += \ + $(INPUT_ROOT_DIR)/touchscreen/touch_ft5x06.o obj-$(CONFIG_DRIVERS_HDF_TP_2P35_FT6236) += \ $(INPUT_ROOT_DIR)/touchscreen/touch_ft6336.o diff --git a/model/network/wifi/Kconfig b/model/network/wifi/Kconfig index 7d893dd..fd9a5ea 100644 --- a/model/network/wifi/Kconfig +++ b/model/network/wifi/Kconfig @@ -29,3 +29,10 @@ config AP6XXX_WIFI6_HDF This driver supports wifi6 for ap6xxx HDF chipset. This driver uses the kernel's wireless extensions subsystem. If you choose to build a module, it'll be called dhd. Say M if unsure. + +config DRIVERS_AP6212 + bool "Enable ap6212" + default n + depends on DRIVERS_HDF_WIFI + help + Answer Y to enable ap6212 wifi chip driver. diff --git a/model/network/wifi/hdfwifi.mk b/model/network/wifi/hdfwifi.mk index 221c8fc..e7945e9 100755 --- a/model/network/wifi/hdfwifi.mk +++ b/model/network/wifi/hdfwifi.mk @@ -14,7 +14,6 @@ HDF_WIFI_FRAMEWORKS_ROOT = $(HDF_DIR_PREFIX)/framework/model/network/wifi HDF_WIFI_KHDF_FRAMEWORKS_ROOT = $(HDF_DIR_PREFIX)/adapter/khdf/linux/model/network/wifi -HDF_WIFI_VENDOR_ROOT = $(HDF_VENDOR_PREFIX)/device/soc/hisilicon/common/platform/wifi/hi3881v100 HDF_FRAMEWORKS_INC := \ -I$(srctree)/drivers/hdf/framework/core/common/include/host \ -I$(srctree)/drivers/hdf/framework/core/host/include \ diff --git a/model/network/wifi/vendor/Makefile b/model/network/wifi/vendor/Makefile index fa87955..87ac3c8 100644 --- a/model/network/wifi/vendor/Makefile +++ b/model/network/wifi/vendor/Makefile @@ -18,6 +18,12 @@ HDF_VENDOR_PREFIX := ../../../../../../../../ include drivers/hdf/khdf/model/network/wifi/hdfwifi.mk +ifneq ($(CONFIG_DRIVERS_AP6212),) +HDF_WIFI_VENDOR_ROOT = $(HDF_VENDOR_PREFIX)/device/board/nxp/imx8mm/wifi +else +HDF_WIFI_VENDOR_ROOT = $(HDF_VENDOR_PREFIX)/device/soc/hisilicon/common/platform/wifi/hi3881v100 +endif + obj-$(CONFIG_DRIVERS_HDF_WIFI) += $(MODULE_NAME).o $(MODULE_NAME)-objs := $(HDF_WIFI_VENDOR_ROOT)/adapter/hdf_wlan_sdio_adapt.o @@ -29,6 +35,7 @@ ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += \ $(SECURE_LIB_INC) obj-$(CONFIG_DRIVERS_HI3881) += hi3881/ +obj-$(CONFIG_DRIVERS_AP6212) += ap6212/ ifneq ($(CONFIG_AP6XXX_WIFI6_HDF),) RKWIFI_PATH := $(HDF_VENDOR_PREFIX)/device/$(product_company)/$(product_device)/wifi diff --git a/model/network/wifi/vendor/ap6212/Makefile b/model/network/wifi/vendor/ap6212/Makefile new file mode 100644 index 0000000..9a2ba2a --- /dev/null +++ b/model/network/wifi/vendor/ap6212/Makefile @@ -0,0 +1,13 @@ +MODULE_NAME := ap6212 + +HDF_VENDOR_PREFIX := ../../../../../../../../../ + +include drivers/hdf/khdf/model/network/wifi/hdfwifi.mk + +INC_TOP_PATH := $(PROJECT_ROOT) +VENDOR_WIFI_PATH := device/board/nxp/imx8mm/wifi +WIFI_DRIVER_DIR := ap6212 + +obj-y += $(HDF_VENDOR_PREFIX)/device/board/nxp/imx8mm/ethernet/adapter/ +ccflags-y += -Idrivers/net/ethernet/freescale/ +obj-y += $(HDF_VENDOR_PREFIX)/device/board/nxp/imx8mm/wifi/ap6212/ \ No newline at end of file diff --git a/model/network/wifi/vendor/hi3881/Makefile b/model/network/wifi/vendor/hi3881/Makefile index dd5d23c..feb2b2b 100755 --- a/model/network/wifi/vendor/hi3881/Makefile +++ b/model/network/wifi/vendor/hi3881/Makefile @@ -21,6 +21,7 @@ include drivers/hdf/khdf/model/network/wifi/hdfwifi.mk INC_TOP_PATH := drivers/hdf/wifi/hi3881v100/ VENDOR_WIFI_PATH := device/soc/hisilicon/common/platform/wifi/hi3881v100 WIFI_DRIVER_DIR := driver +HDF_WIFI_VENDOR_ROOT = $(HDF_VENDOR_PREFIX)/device/soc/hisilicon/common/platform/wifi/hi3881v100 ##################path of compile file :start############### #####wifi##### diff --git a/model/storage/Kconfig b/model/storage/Kconfig index 08059de..1792cd6 100644 --- a/model/storage/Kconfig +++ b/model/storage/Kconfig @@ -15,3 +15,10 @@ config DRIVERS_HDF_STORAGE depends on DRIVERS_HDF help Answer Y to enable HDF storage driver. + +config IMX8MM_SDIO_TEST + bool "Enable imx8mm sdio test" + default n + depends on DRIVERS_HDF + help + Answer Y to enable imx8mm sdio test. \ No newline at end of file diff --git a/model/storage/Makefile b/model/storage/Makefile index 5ef9689..b321b30 100644 --- a/model/storage/Makefile +++ b/model/storage/Makefile @@ -45,7 +45,12 @@ obj-y += $(STORAGE_ROOT_DIR)/src/mmc/emmc_if.o \ ifeq ($(CONFIG_ARCH_HI3516DV300), y) obj-y += \ ./vendor_adapter/hi35xx_mmc_adapter.o +else +ifeq ($(CONFIG_IMX8MM_EMMC), y) + obj-y += \ + ./vendor_adapter/imx8mm_mmc_adapter.o else obj-y += \ ./mmc_adapter.o +endif endif \ No newline at end of file diff --git a/model/storage/vendor_adapter/imx8mm_mmc_adapter.c b/model/storage/vendor_adapter/imx8mm_mmc_adapter.c new file mode 100644 index 0000000..3b2b602 --- /dev/null +++ b/model/storage/vendor_adapter/imx8mm_mmc_adapter.c @@ -0,0 +1,38 @@ +/* + * hi35xx_mmc_adapter.c + * + * hi35xx linux mmc driver implement. + * + * Copyright (c) 2022 Huawei Device Co., Ltd. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include "hdf_base.h" +#include "hdf_log.h" + +#define HDF_LOG_TAG imx8mm_mmc_adapter_c + +struct mmc_host *sdhci_esdhc_get_mmc_host(int slot); +void sdhci_esdhc_sdio_rescan(int slot); + +struct mmc_host *GetMmcHost(int32_t slot) +{ + HDF_LOGD("imx8mm GetMmcHost entry"); + return sdhci_esdhc_get_mmc_host(slot); +} + +void SdioRescan(int slot) +{ + HDF_LOGD("imx8mm SdioRescan entry"); + sdhci_esdhc_sdio_rescan(slot); +} diff --git a/network/src/net_device_adapter.c b/network/src/net_device_adapter.c index ebf278e..3abe6f2 100644 --- a/network/src/net_device_adapter.c +++ b/network/src/net_device_adapter.c @@ -20,12 +20,17 @@ #include #include #include +#include #include "net_device.h" #include "net_device_impl.h" #include "osal_mem.h" #include "securec.h" #define HDF_LOG_TAG NetDeviceFull +extern struct phy_device *of_phy_connect(struct net_device *dev, + struct device_node *phy_np, + void (*hndlr)(struct net_device *), u32 flags, + phy_interface_t iface); static int32_t NetDevXmitCheck(struct sk_buff *skb, struct net_device *dev) { @@ -230,6 +235,87 @@ static int32_t NetDevDelete(struct NetDeviceImpl *impl) return HDF_SUCCESS; } +void NetDevApiAdd(struct NetDeviceImpl *impl, struct napi_struct *napi, + int (*poll)(struct napi_struct *, int), int weight) +{ + struct net_device *dev = GetDevFromDevImpl(impl); + + netif_napi_add(dev, napi, poll, 64); +} + +struct netdev_queue *NetDevGetTxQueue(struct NetDeviceImpl *impl, unsigned int queue) +{ + struct net_device *dev = GetDevFromDevImpl(impl); + struct netdev_queue *nq; + + nq = netdev_get_tx_queue(dev, queue); + + return nq; +} + +__be16 NetDevTypeTrans(struct NetDeviceImpl *impl, struct sk_buff *skb) +{ + __be16 ret; + struct net_device *dev = GetDevFromDevImpl(impl); + + ret = eth_type_trans(skb, dev); + + + return ret; +} + +struct sk_buff *NetDevAllocBuf(struct NetDeviceImpl *impl, uint32_t length) +{ + struct sk_buff *skb = NULL; + struct net_device *dev = GetDevFromDevImpl(impl); + + skb = netdev_alloc_skb(dev, length); + return skb; +} + +void NetDevStartQueue(struct NetDeviceImpl *impl) +{ + struct net_device *dev = GetDevFromDevImpl(impl); + struct netdev_queue *nq; + + nq = netdev_get_tx_queue(dev, 1); + netif_tx_start_queue(nq); +} + +void NetDevDisableTx(struct NetDeviceImpl *impl) +{ + struct net_device *dev = GetDevFromDevImpl(impl); + + netif_tx_disable(dev); +} + +void NetDevSetDev(struct NetDeviceImpl *impl, struct device *dev) +{ + struct net_device *ndev = GetDevFromDevImpl(impl); + + SET_NETDEV_DEV(ndev,dev); +} + +void NetDevWakeQueue(struct NetDeviceImpl *impl) +{ + struct net_device *dev = GetDevFromDevImpl(impl); + struct netdev_queue *nq; + + nq = netdev_get_tx_queue(dev, 1); + netif_tx_wake_queue(nq); +} + +struct phy_device *NetDevOfPhyConnect(struct NetDeviceImpl *impl, + struct device_node *phy_np, + void (*hndlr)(struct net_device *), u32 flags, + phy_interface_t iface) +{ + struct phy_device *phy = NULL; + struct net_device *ndev = GetDevFromDevImpl(impl); + phy = of_phy_connect(ndev, phy_np, hndlr, 0, iface); + return phy; +} + static int32_t NetDevSetStatus(struct NetDeviceImpl *impl, NetIfStatus status) { @@ -316,6 +402,15 @@ static struct NetDeviceImplOp g_ndImplOps = { .setStatus = NetDevSetStatus, .receive = NetDevReceive, .changeMacAddr = NetDevChangeMacAddr, + .netif_napi_add = NetDevApiAdd, + .get_tx_queue = NetDevGetTxQueue, + .type_trans = NetDevTypeTrans, + .alloc_buf = NetDevAllocBuf, + .start_queue = NetDevStartQueue, + .disable_tx = NetDevDisableTx, + .set_dev = NetDevSetDev, + .wake_queue = NetDevWakeQueue, + .of_phyconnect = NetDevOfPhyConnect, }; int32_t RegisterNetDeviceImpl(struct NetDeviceImpl *ndImpl) diff --git a/platform/Kconfig b/platform/Kconfig index 8cb37be..a25e575 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -98,4 +98,25 @@ config DRIVERS_HDF_PLATFORM_REGULATOR default n depends on DRIVERS_HDF_PLATFORM help - Answer Y to enable HDF platform regulator driver. \ No newline at end of file + Answer Y to enable HDF platform regulator driver. + +config IMX8MM_EMMC + bool "Enable HDF imx8mm emmc driver" + default n + depends on DRIVERS_HDF + help + Answer Y to enable HDF imx8mm emmc driver. + +config IMX8MM_SDIO + bool "Enable HDF imx8mm sdio driver" + default n + depends on DRIVERS_HDF + help + Answer Y to enable HDF imx8mm sdio driver. + +config DRIVERS_HDF_PLATFORM_IMX8MM_MIPI_DSI + bool "Enable HDF platform imx8mm mipi_dsi driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform imx8mm mipi_dsi driver. \ No newline at end of file diff --git a/platform/mipi_dsi/Makefile b/platform/mipi_dsi/Makefile index 337a1b3..fe62f73 100644 --- a/platform/mipi_dsi/Makefile +++ b/platform/mipi_dsi/Makefile @@ -16,9 +16,14 @@ include drivers/hdf/khdf/platform/platform.mk obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mipi/mipi_dsi_core.o \ $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mipi/mipi_dsi_if.o + +ifeq ($(CONFIG_DRIVERS_HDF_PLATFORM_IMX8MM_MIPI_DSI), y) +obj-$(CONFIG_DRM_MIPI_DSI) += mipi_drm_imx8mm.o +else obj-$(CONFIG_DRM_MIPI_DSI) += mipi_drm_adapter.o obj-y += mipi_tx_dev.o \ mipi_tx_hi35xx.o +endif EXTRA_CFLAGS += -Wno-error=date-time diff --git a/platform/mipi_dsi/mipi_drm_imx8mm.c b/platform/mipi_dsi/mipi_drm_imx8mm.c new file mode 100644 index 0000000..231039a --- /dev/null +++ b/platform/mipi_dsi/mipi_drm_imx8mm.c @@ -0,0 +1,209 @@ +/* + * mipi_drm_adapter.c + * + * Mipi drm adapter driver. + * + * Copyright (c) 2021 Huawei Device Co., Ltd. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include "hdf_base.h" +#include +#include