diff --git a/Kconfig b/Kconfig index 037b190fb2a2bee3bc2025fc9c8955bed9306823..c646dec7346b577120898a93a1bb367ea5ead896 100644 --- a/Kconfig +++ b/Kconfig @@ -25,4 +25,6 @@ source "drivers/hdf/khdf/model/usb/host/Kconfig" source "drivers/hdf/khdf/model/usb/device/Kconfig" source "drivers/hdf/khdf/model/audio/Kconfig" source "drivers/hdf/khdf/model/misc/vibrator/Kconfig" -source "drivers/hdf/khdf/model/misc/dsoftbus/Kconfig" \ No newline at end of file +source "drivers/hdf/khdf/model/misc/dsoftbus/Kconfig" +source "../../../../../device/amlogic/drivers/ethernet/adapter/Kconfig" +source "drivers/hdf/framework/model/input/driver/touchscreen/Kconfig" diff --git a/model/audio/Makefile b/model/audio/Makefile index f6eeeb8a39e8170a8a70e03d656200ab752e8db9..a84b60f29d961e525b84d802132ebdbce93e3788 100755 --- a/model/audio/Makefile +++ b/model/audio/Makefile @@ -28,9 +28,13 @@ obj-y += \ $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_platform_base.o \ $(KHDF_AUDIO_ROOT_DIR)/sapm/src/audio_sapm.o \ $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_stream_dispatch.o \ - $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o \ + $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o + +obj-$(CONFIG_ARCH_TFA9879) += \ $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_impl.o \ + $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_impl.o + +obj-$(CONFIG_ARCH_HI3516DV300) += \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_adapter.o \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_impl.o \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_ops.o \ @@ -40,6 +44,48 @@ obj-y += \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_ops.o \ $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_adapter.o +obj-$(CONFIG_AUDIO_VIM3L) += \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/amlogic_dai_driver.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/amlogic_platform_driver.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_controller.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_io.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_clks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/axg,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/g12a,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/tl1,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/sm1,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/tm2,clocks.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/card_utils.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/tdm_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/spdif.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/spdif_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/iomap.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pdm.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pdm_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/ddr_mngr.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/loopback.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/loopback_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/audio_utils.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/locker.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/locker_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/resample.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/resample_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects_v2.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/effects_hw_v2.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pwrdet.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/pwrdet_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/sharebuffer.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/extn.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/frhdmirx_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/vad.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/vad_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/vad_dev.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/earc.o \ + $(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter/earc_hw.o \ + $(KHDF_AUDIO_CODEC_DIR)/dummy_codec/dummy_codec_adapter.o + obj-$(CONFIG_ARCH_HI3516DV300) += \ $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_core.o \ $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_host.o \ @@ -83,9 +129,19 @@ ccflags-y += -lm -lc -lgcc -std=gnu99 -Werror \ -Iinclude/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/sapm/include \ -Iinclude/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/dispatch/include \ -Iinclude/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/common/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/include \ -Iinclude/$(KHDF_AUDIO_PERIPHERAL_ROOT_DIR)/audio/interfaces/include \ -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/include + +ccflags-$(CONFIG_ARCH_TFA9879) += \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/include + +ccflags-$(CONFIG_ARCH_HI3516DV300) += \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/include + +ccflags-$(CONFIG_AUDIO_VIM3L) += \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/amlogic/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/amlogic/soc/src/linux_adapter \ + -Iinclude/$(KHDF_AUDIO_PERIPHERAL_ROOT_DIR)/audio/chipsets/amlogic/include diff --git a/model/input/Makefile b/model/input/Makefile index 024bc5e2d1b856f72a17ec8583d95f4cf1871422..f34a9ac851248854665953bff8b6f571a49e45fa 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_VIM3L_TOUCH) += \ + $(INPUT_ROOT_DIR)/touchscreen/touch_ft5336.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 c68d514aeb0a63e4efd9c025d4b3019e203c4cc9..8f7c20cc4cae7f574aaf06a279282550e5f70605 100755 --- a/model/network/wifi/Kconfig +++ b/model/network/wifi/Kconfig @@ -10,4 +10,11 @@ config DRIVERS_HI3881 default n depends on DRIVERS_HDF_WIFI help - Answer Y to enable hi3881 wifi chip driver. \ No newline at end of file + Answer Y to enable hi3881 wifi chip driver. + +config DRIVERS_AP6212 + bool "Enable AP6212" + default n + depends on DRIVERS_HDF_WIFI + help + Answer Y to enable AP6212 wifi chip driver. \ No newline at end of file diff --git a/model/network/wifi/Makefile b/model/network/wifi/Makefile index c0d8f82a7ca76f0229ab098649f78494867d7522..76d13e90ec4c8d55bcc4d2327701c7e484e4f257 100755 --- a/model/network/wifi/Makefile +++ b/model/network/wifi/Makefile @@ -62,5 +62,11 @@ ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += \ $(HDF_WIFI_ADAPTER_INC) \ $(SECURE_LIB_INC) +HDF_WIFI_FLAGS +=-D_PRE_OS_VERSION_LINUX=1 +HDF_WIFI_FLAGS +=-D_PRE_OS_VERSION_LITEOS=2 +HDF_WIFI_FLAGS +=-D_PRE_OS_VERSION=_PRE_OS_VERSION_LINUX + +ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += $(HDF_WIFI_FLAGS) + obj-$(CONFIG_DRIVERS_HDF_WIFI) += vendor/ diff --git a/model/network/wifi/hdfwifi.mk b/model/network/wifi/hdfwifi.mk index 63703c3544c08877984f3c786776c29b3e73476c..4521ace7a8c9eb291085ff69fcc05526fdfbdd53 100644 --- a/model/network/wifi/hdfwifi.mk +++ b/model/network/wifi/hdfwifi.mk @@ -14,7 +14,8 @@ 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/hisilicon/drivers/wifi/driver +#HDF_WIFI_VENDOR_ROOT = $(HDF_VENDOR_PREFIX)/device/hisilicon/drivers/wifi/driver +HDF_WIFI_VENDOR_ROOT = $(HDF_VENDOR_PREFIX)device/amlogic/drivers/wifi HDF_FRAMEWORKS_INC := \ -Idrivers/hdf/framework/ability/sbuf/include \ -Idrivers/hdf/framework/core/common/include/host \ diff --git a/model/network/wifi/vendor/Makefile b/model/network/wifi/vendor/Makefile index ea4a0d17fe3a3b6cf79a20540d4ccd76b383aa1c..d42a6c35136d8442d8fc1a911ac36513323818c1 100755 --- a/model/network/wifi/vendor/Makefile +++ b/model/network/wifi/vendor/Makefile @@ -34,4 +34,5 @@ HDF_WIFI_FLAGS +=-D_PRE_OS_VERSION=_PRE_OS_VERSION_LINUX ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += $(HDF_WIFI_FLAGS) -obj-$(CONFIG_DRIVERS_HI3881) += hi3881/ \ No newline at end of file +obj-$(CONFIG_DRIVERS_HI3881) += hi3881/ +obj-$(CONFIG_DRIVERS_AP6212) += ap6212/ \ No newline at end of file diff --git a/model/network/wifi/vendor/ap6212/Makefile b/model/network/wifi/vendor/ap6212/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..92bb0d501b0f18e21a7afc6c14b15670640f6680 --- /dev/null +++ b/model/network/wifi/vendor/ap6212/Makefile @@ -0,0 +1,27 @@ +# +# Copyright (c) 2020-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. +# +# + +MODULE_NAME := ap6212 + +HDF_VENDOR_PREFIX := ../../../../../../../../../ + +include drivers/hdf/khdf/model/network/wifi/hdfwifi.mk + +INC_TOP_PATH := $(PROJECT_ROOT) +VENDOR_WIFI_PATH := device/amlogic/drivers/wifi +WIFI_DRIVER_DIR := ap6212 + +obj-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += $(HDF_VENDOR_PREFIX)/device/amlogic/drivers/ethernet/adapter/ +ccflags-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += -Idrivers/net/ethernet/stmicro/stmmac/ +obj-$(CONFIG_DRIVERS_HDF_WIFI) += $(HDF_VENDOR_PREFIX)/device/amlogic/drivers/wifi/ap6212/ \ No newline at end of file diff --git a/model/usb/device/Kconfig b/model/usb/device/Kconfig index 54d4cc7962744db897c85acd2382a7872169167f..eb473b36f628c1ad0943f5d61175f5bc90900861 100644 --- a/model/usb/device/Kconfig +++ b/model/usb/device/Kconfig @@ -1,6 +1,6 @@ config DRIVERS_HDF_USB_F_GENERIC bool "Enable F_GENERIC driver" - default y + default n depends on DRIVERS_HDF help Answer Y to choice HDF USB F_GENERIC driver. diff --git a/model/usb/device/f_generic.c b/model/usb/device/f_generic.c index 6878c95797b997e83e6a7d3ebd36f86efc22652b..1d9bde529463c276f77ffcc68824600aef212d97 100644 --- a/model/usb/device/f_generic.c +++ b/model/usb/device/f_generic.c @@ -28,6 +28,7 @@ #include "u_f.h" #include "u_os_desc.h" #include "configfs.h" +#include "linux/swait.h" #define FUNCTIONFS_MAGIC 0xa647361 /* Chosen by a honest dice roll ;) */ diff --git a/network/src/Makefile b/network/src/Makefile index 34d25ae0f500475e6f3eaa77127a910e27a38dff..2b4c3785cc2959e00df0b8d71396d8cda625b6f9 100755 --- a/network/src/Makefile +++ b/network/src/Makefile @@ -23,3 +23,4 @@ ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += \ -Iinclude/hdf/utils \ -Iinclude/hdf/osal \ -I$(PROJECT_ROOT)/third_party/bounds_checking_function/include +ccflags-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += -Idrivers/net/ethernet/stmicro/stmmac/ \ No newline at end of file diff --git a/osal/src/osal_mem.c b/osal/src/osal_mem.c index 22024ab54cf6343176ede0b92437d101bbfda3e9..6ce393709cd31f24ecddc6b933b2a38492076522 100644 --- a/osal/src/osal_mem.c +++ b/osal/src/osal_mem.c @@ -56,7 +56,10 @@ static void *osal_mem_alloc(size_t size, uint32_t *type) base = (char *)vmalloc(size + mng_size); *type = TYPE_VMALLOC; } else { - base = (char *)kmalloc(size + mng_size, GFP_KERNEL); + base = (char *)kmalloc(size + mng_size, GFP_NOWAIT); + if (base == NULL) { + base = (char *)kmalloc(size + mng_size, GFP_ATOMIC); + } *type = TYPE_KMALLOC; } diff --git a/osal/src/osal_mutex.c b/osal/src/osal_mutex.c index 180954076b52c052b379875d3a549f1fea1e6e53..10257203cd8ef23d45f020838b0678ec2ae3c5c0 100644 --- a/osal/src/osal_mutex.c +++ b/osal/src/osal_mutex.c @@ -73,6 +73,19 @@ int32_t OsalMutexLock(struct OsalMutex *mutex) } EXPORT_SYMBOL(OsalMutexLock); +int32_t OsalMutexTryLock(struct OsalMutex *mutex) +{ + int32_t retVal = 0; + if (mutex == NULL || mutex->realMutex == NULL) { + HDF_LOGE("%s invalid param", __func__); + return HDF_ERR_INVALID_PARAM; + } + + retVal = mutex_trylock((struct mutex *)mutex->realMutex); + return HDF_SUCCESS; +} +EXPORT_SYMBOL(OsalMutexTryLock); + int32_t OsalMutexTimedLock(struct OsalMutex *mutex, uint32_t mSec) { if (mutex == NULL || mutex->realMutex == NULL) { diff --git a/osal/src/osal_thread.c b/osal/src/osal_thread.c index b2fb28df50b10789da14535e07ccf6a375069a1d..343a8e41d8572afca44a4532624790096751a5cf 100644 --- a/osal/src/osal_thread.c +++ b/osal/src/osal_thread.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "hdf_log.h" #include "osal_mem.h" #include "securec.h" diff --git a/platform/Kconfig b/platform/Kconfig index 658fbf587e0325255e2758dfbafe478bdc6381be..1821438764fc4f019ac5606bc1047520e7916036 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -85,3 +85,45 @@ config DRIVERS_HDF_PLATFORM_RTC depends on DRIVERS_HDF_PLATFORM help Answer Y to enable HDF platform rtc driver. + +config SPI_VIM3L + bool "Enable HDF platform vim3l spi driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform vim3l spi driver. + +config PWM_VIM3L + bool "Enable HDF platform vim3l pwm driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform vim3l pwm driver. + +config EMMC_VIM3L + bool "Enable HDF platform vim3l emmc driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform vim3l emmc driver. + +config MIPI_VIM3L + bool "Enable HDF platform vim3l mipi driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform vim3l mipi driver. + +config SDIO_VIM3L + bool "Enable HDF platform vim3l sdio driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform vim3l sdio driver. + +config AUDIO_VIM3L + bool "Enable HDF platform vim3l audio driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF platform vim3l audio driver. \ No newline at end of file diff --git a/platform/emmc/emmc_adapter.c b/platform/emmc/emmc_adapter.c index 449cab0213e5c94dfdd5b087e50b496fca337a4c..a5c30f1f311a1e2f8575969cc2db4f5953fddc7b 100644 --- a/platform/emmc/emmc_adapter.c +++ b/platform/emmc/emmc_adapter.c @@ -27,45 +27,49 @@ #define HDF_LOG_TAG emmc_adapter_c +#if defined(CONFIG_EMMC_VIM3L) +struct mmc_host *meson_get_mmc_host(int slot); +#else struct mmc_host *himci_get_mmc_host(int slot); +#endif // CONFIG_EMMC_VIM3L -int32_t Hi35xxLinuxEmmcGetCid(struct EmmcDevice *dev, uint8_t *cid, uint32_t size) +int32_t LinuxEmmcGetCid(struct EmmcDevice *dev, uint8_t *cid, uint32_t size) { struct mmc_host *mmcHost = NULL; struct MmcCntlr *cntlr = NULL; if (dev == NULL || dev->mmc.cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: dev or cntlr is null."); + HDF_LOGE("LinuxEmmcGetCid: dev or cntlr is null."); return HDF_ERR_INVALID_OBJECT; } if (cid == NULL || size < EMMC_CID_LEN) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: cid is null or size is invalid."); + HDF_LOGE("LinuxEmmcGetCid: cid is null or size is invalid."); return HDF_ERR_INVALID_PARAM; } cntlr = dev->mmc.cntlr; mmcHost = (struct mmc_host *)cntlr->priv; if (mmcHost == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: mmcHost is NULL!"); + HDF_LOGE("LinuxEmmcGetCid: mmcHost is NULL!"); return HDF_ERR_NOT_SUPPORT; } if (mmcHost->card == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: card is null."); + HDF_LOGE("LinuxEmmcGetCid: card is null."); return HDF_ERR_NOT_SUPPORT; } if (memcpy_s(cid, sizeof(uint8_t) * size, (uint8_t *)(mmcHost->card->raw_cid), sizeof(mmcHost->card->raw_cid)) != EOK) { - HDF_LOGE("Hi35xxLinuxEmmcGetCid: memcpy_s fail!"); + HDF_LOGE("LinuxEmmcGetCid: memcpy_s fail!"); return HDF_FAILURE; } return HDF_SUCCESS; } static struct EmmcDeviceOps g_emmcMethod = { - .getCid = Hi35xxLinuxEmmcGetCid, + .getCid = LinuxEmmcGetCid, }; -static void Hi35xxLinuxEmmcDeleteCntlr(struct MmcCntlr *cntlr) +static void LinuxEmmcDeleteCntlr(struct MmcCntlr *cntlr) { if (cntlr == NULL) { return; @@ -79,110 +83,114 @@ static void Hi35xxLinuxEmmcDeleteCntlr(struct MmcCntlr *cntlr) OsalMemFree(cntlr); } -static int32_t Hi35xxLinuxEmmcCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) +static int32_t LinuxEmmcCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) { const struct DeviceResourceNode *node = NULL; struct DeviceResourceIface *drsOps = NULL; int32_t ret; if (obj == NULL || cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: input para is NULL."); + HDF_LOGE("LinuxEmmcCntlrParse: input para is NULL."); return HDF_FAILURE; } node = obj->property; if (node == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: drs node is NULL."); + HDF_LOGE("LinuxEmmcCntlrParse: drs node is NULL."); return HDF_FAILURE; } drsOps = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); if (drsOps == NULL || drsOps->GetUint16 == NULL || drsOps->GetUint32 == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: invalid drs ops fail!"); + HDF_LOGE("LinuxEmmcCntlrParse: invalid drs ops fail!"); return HDF_FAILURE; } ret = drsOps->GetUint16(node, "hostId", &(cntlr->index), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: read hostIndex fail!"); + HDF_LOGE("LinuxEmmcCntlrParse: read hostIndex fail!"); return ret; } ret = drsOps->GetUint32(node, "devType", &(cntlr->devType), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcCntlrParse: read devType fail!"); + HDF_LOGE("LinuxEmmcCntlrParse: read devType fail!"); return ret; } return HDF_SUCCESS; } -static int32_t Hi35xxLinuxEmmcBind(struct HdfDeviceObject *obj) +static int32_t LinuxEmmcBind(struct HdfDeviceObject *obj) { struct MmcCntlr *cntlr = NULL; int32_t ret; - HDF_LOGE("Hi35xxLinuxEmmcBind: entry!"); + HDF_LOGE("LinuxEmmcBind: entry!"); if (obj == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcBind: Fail, obj is NULL."); + HDF_LOGE("LinuxEmmcBind: Fail, obj is NULL."); return HDF_ERR_INVALID_OBJECT; } cntlr = (struct MmcCntlr *)OsalMemCalloc(sizeof(struct MmcCntlr)); if (cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxEmmcBind: no mem for MmcCntlr."); + HDF_LOGE("LinuxEmmcBind: no mem for MmcCntlr."); return HDF_ERR_MALLOC_FAIL; } cntlr->ops = NULL; cntlr->hdfDevObj = obj; obj->service = &cntlr->service; - ret = Hi35xxLinuxEmmcCntlrParse(cntlr, obj); + ret = LinuxEmmcCntlrParse(cntlr, obj); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: cntlr parse fail."); + HDF_LOGE("LinuxEmmcBind: cntlr parse fail."); goto _ERR; } +#if defined(CONFIG_EMMC_VIM3L) + cntlr->priv = (void *)meson_get_mmc_host((int32_t)cntlr->index); +#else cntlr->priv = (void *)himci_get_mmc_host((int32_t)cntlr->index); +#endif // CONFIG_EMMC_VIM3L ret = MmcCntlrAdd(cntlr); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: cntlr add fail."); + HDF_LOGE("LinuxEmmcBind: cntlr add fail."); goto _ERR; } ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: alloc dev fail."); + HDF_LOGE("LinuxEmmcBind: alloc dev fail."); goto _ERR; } MmcDeviceAddOps(cntlr->curDev, &g_emmcMethod); - HDF_LOGD("Hi35xxLinuxEmmcBind: Success!"); + HDF_LOGD("LinuxEmmcBind: Success!"); return HDF_SUCCESS; _ERR: - Hi35xxLinuxEmmcDeleteCntlr(cntlr); - HDF_LOGE("Hi35xxLinuxEmmcBind: Fail!"); + LinuxEmmcDeleteCntlr(cntlr); + HDF_LOGE("LinuxEmmcBind: Fail!"); return HDF_FAILURE; } -static int32_t Hi35xxLinuxEmmcInit(struct HdfDeviceObject *obj) +static int32_t LinuxEmmcInit(struct HdfDeviceObject *obj) { (void)obj; - HDF_LOGD("Hi35xxLinuxEmmcInit: Success!"); + HDF_LOGD("LinuxEmmcInit: Success!"); return HDF_SUCCESS; } -static void Hi35xxLinuxEmmcRelease(struct HdfDeviceObject *obj) +static void LinuxEmmcRelease(struct HdfDeviceObject *obj) { if (obj == NULL) { return; } - Hi35xxLinuxEmmcDeleteCntlr((struct MmcCntlr *)obj->service); + LinuxEmmcDeleteCntlr((struct MmcCntlr *)obj->service); } struct HdfDriverEntry g_emmcDriverEntry = { .moduleVersion = 1, - .Bind = Hi35xxLinuxEmmcBind, - .Init = Hi35xxLinuxEmmcInit, - .Release = Hi35xxLinuxEmmcRelease, + .Bind = LinuxEmmcBind, + .Init = LinuxEmmcInit, + .Release = LinuxEmmcRelease, .moduleName = "HDF_PLATFORM_EMMC", }; HDF_INIT(g_emmcDriverEntry); diff --git a/platform/mipi_dsi/Makefile b/platform/mipi_dsi/Makefile index 82728cce50b4d91a65cb0f597f55936964bc73ff..e1425bcfc4a4211b31051541ba0813676aad6081 100644 --- a/platform/mipi_dsi/Makefile +++ b/platform/mipi_dsi/Makefile @@ -18,7 +18,11 @@ obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mipi_dsi_core.o \ $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mipi_dsi_if.o \ mipi_dsi_adapter.o -obj-y += mipi_tx_dev.o \ - mipi_tx_hi35xx.o +ifeq ($(CONFIG_MIPI_VIM3L), y) +obj-y += mipi_tx_vim3l.o +else +obj-y += mipi_tx_dev.o +obj-y += mipi_tx_hi35xx.o +endif EXTRA_CFLAGS += -Wno-error=date-time diff --git a/platform/mipi_dsi/mipi_tx_dev.c b/platform/mipi_dsi/mipi_tx_dev.c index ce49737d03cddebe0bd38cec594ed2123c992207..a7e6503ef38495eafc5b94ea599840284d37f788 100644 --- a/platform/mipi_dsi/mipi_tx_dev.c +++ b/platform/mipi_dsi/mipi_tx_dev.c @@ -328,7 +328,7 @@ static int32_t MipiDsiDevSetCfg(struct MipiDsiCntlr *cntlr, struct MipiCfg *arg) } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif arg, size)) { /* user space */ @@ -378,7 +378,7 @@ int32_t MipiDsiDevSetCmd(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *arg) } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif arg, size)) { /* user space */ @@ -420,7 +420,7 @@ int32_t MipiDsiDevGetCmd(struct MipiDsiCntlr *cntlr, GetDsiCmdDescTag *arg) return HDF_ERR_MALLOC_FAIL; } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif arg, size)) { /* user space */ @@ -440,7 +440,7 @@ int32_t MipiDsiDevGetCmd(struct MipiDsiCntlr *cntlr, GetDsiCmdDescTag *arg) goto fail0; } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_WRITE, #endif arg, size)) { /* user space */ diff --git a/platform/mipi_dsi/mipi_tx_hi35xx.c b/platform/mipi_dsi/mipi_tx_hi35xx.c index 0c43806a947e41ed4b5134d14c3ac3b58267aa30..f3227452d96b2ba3eb33928cf497f923336edc48 100644 --- a/platform/mipi_dsi/mipi_tx_hi35xx.c +++ b/platform/mipi_dsi/mipi_tx_hi35xx.c @@ -690,7 +690,7 @@ static int32_t LinuxCopyToKernel(void *dest, uint32_t max, const void *src, uint int32_t ret; if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_READ, #endif src, count)) { /* user space */ @@ -897,7 +897,7 @@ static int MipiTxDrvGetCmdInfo(GetCmdInfoTag *getCmdInfo) goto fail0; } if (access_ok( -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,2,0) VERIFY_WRITE, #endif getCmdInfo->getData, getCmdInfo->getDataSize)) { /* user space */ diff --git a/platform/mipi_dsi/mipi_tx_vim3l.c b/platform/mipi_dsi/mipi_tx_vim3l.c new file mode 100644 index 0000000000000000000000000000000000000000..9c3a2203b0bc0ac60a093cf933400899a22150b9 --- /dev/null +++ b/platform/mipi_dsi/mipi_tx_vim3l.c @@ -0,0 +1,196 @@ +/* + * mipi_tx_vim3l.c + * + * vim3l mipi_tx driver implement + * + * Copyright (c) 2020-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 "linux/amlogic/media/vout/lcd/lcd_mipi.h" +#include "linux/delay.h" +#include "hdf_base.h" +#include "hdf_device_desc.h" +#include "hdf_log.h" +#include "mipi_dsi_core.h" +#include "mipi_dsi_if.h" +#include "osal_time.h" +#include "osal_mem.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +#define HDF_LOG_TAG mipi_tx_vim3l + +static int32_t Vim3lSetCntlrCfg(struct MipiDsiCntlr *cntlr) +{ + return HDF_SUCCESS; +} + +static int32_t Vim3lSetCmd(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *cmd) +{ + uint8_t *payload = NULL; + uint8_t data_end[2] = {0xFF, 0}; + uint8_t step = 0; + + (void)cntlr; + if (NULL == cmd) { + HDF_LOGE("%s failed, NULL == cmd", __func__); + return HDF_FAILURE; + } + + if (NULL == cmd->payload) { + HDF_LOGE("%s failed, cmd->payload", __func__); + return HDF_FAILURE; + } + + HDF_LOGE("%s cmd->dataLen = %d ", __func__, cmd->dataLen); + HDF_LOGE("%s cmd->dataType = %d ", __func__, cmd->dataType); + HDF_LOGE("%s cmd->delay = %d ", __func__, cmd->delay); + + payload = (uint8_t *)OsalMemAlloc((cmd->dataLen + 2 + 2) * sizeof(uint8_t)); + + if (NULL == payload) { + HDF_LOGE("%s create payload failed ", __func__); + return HDF_FAILURE; + } + payload[0] = cmd->dataType; + payload[1] = cmd->dataLen; + if (0 != cmd->dataLen) { + memcpy(&payload[2], cmd->payload, cmd->dataLen); + } + + /* end code */ + memcpy(&payload[2 + cmd->dataLen], data_end, 2); + + step = dsi_write_cmd(payload); + HDF_LOGE("%s step = %d ", __func__, step); + if (cmd->delay != 0) { + mdelay(cmd->delay); + } + + OsalMemFree(payload); + + return HDF_SUCCESS; +} + +static int32_t Vim3lGetCmd(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *cmd, uint32_t readLen, uint8_t *out) +{ + uint8_t *payload = NULL; + uint8_t data_end[2] = {0xFF, 0}; + uint8_t step = 0; + + (void)cntlr; + if (NULL == cmd) { + HDF_LOGE("%s failed, NULL == cmd", __func__); + return HDF_FAILURE; + } + + if (NULL == cmd->payload) { + HDF_LOGE("%s failed, cmd->payload", __func__); + return HDF_FAILURE; + } + + HDF_LOGE("%s cmd->dataLen = %d ", __func__, cmd->dataLen); + HDF_LOGE("%s cmd->dataType = %d ", __func__, cmd->dataType); + HDF_LOGE("%s cmd->delay = %d ", __func__, cmd->delay); + + payload = (uint8_t *)OsalMemAlloc((cmd->dataLen + 2 + 2) * sizeof(uint8_t)); + + if (NULL == payload) { + HDF_LOGE("%s create payload failed ", __func__); + return HDF_FAILURE; + } + payload[0] = cmd->dataType; + payload[1] = cmd->dataLen; + if (0 != cmd->dataLen) { + memcpy(&payload[2], cmd->payload, cmd->dataLen); + } + + /* end code */ + memcpy(&payload[2 + cmd->dataLen], data_end, 2); + + step = dsi_write_cmd(payload); + HDF_LOGE("%s step = %d ", __func__, step); + if (cmd->delay != 0) { + mdelay(cmd->delay); + } + + OsalMemFree(payload); + + return HDF_SUCCESS; +} + +static struct MipiDsiCntlr g_mipiTx = { + .devNo = 0 +}; + +static struct MipiDsiCntlrMethod g_method = { + .setCntlrCfg = Vim3lSetCntlrCfg, + .setCmd = Vim3lSetCmd, + .getCmd = Vim3lGetCmd, + .toHs = NULL, + .toLp = NULL +}; + +static int32_t Vim3lMipiTxInit(struct HdfDeviceObject *device) +{ + int32_t ret; + + g_mipiTx.priv = NULL; + g_mipiTx.ops = &g_method; + ret = MipiDsiRegisterCntlr(&g_mipiTx, device); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: [MipiDsiRegisterCntlr] failed!", __func__); + return ret; + } + + HDF_LOGI("%s: success.", __func__); + + return ret; +} + +static void Vim3lMipiTxRelease(struct HdfDeviceObject *device) +{ + struct MipiDsiCntlr *cntlr; + + if (device == NULL) { + HDF_LOGE("%s: device is NULL.", __func__); + return; + } + cntlr = MipiDsiCntlrFromDevice(device); + if (cntlr == NULL) { + HDF_LOGE("%s: cntlr is NULL.", __func__); + return; + } + MipiDsiUnregisterCntlr(cntlr); + cntlr->priv = NULL; + + HDF_LOGI("%s: success.", __func__); +} + +struct HdfDriverEntry g_mipiTxDriverEntry = { + .moduleVersion = 1, + .Init = Vim3lMipiTxInit, + .Release = Vim3lMipiTxRelease, + .moduleName = "HDF_MIPI_TX", +}; +HDF_INIT(g_mipiTxDriverEntry); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ diff --git a/platform/pwm/Makefile b/platform/pwm/Makefile index a09cbc00cc1664b42601213d8ab345a8f838bd02..1a310f9a41a330da2c4313b7c36554f3f0e63b14 100644 --- a/platform/pwm/Makefile +++ b/platform/pwm/Makefile @@ -14,5 +14,6 @@ include drivers/hdf/khdf/platform/platform.mk obj-$(CONFIG_DRIVERS_HDF_PLATFORM_PWM) += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/pwm_core.o \ - pwm_adapter.o -obj-$(CONFIG_PWM_HI35XX) += pwm_hi35xx_linux.o + pwm_adapter.o \ + pwm_hi35xx_linux.o + diff --git a/platform/pwm/pwm_hi35xx.h b/platform/pwm/pwm_hi35xx.h index fab085968127e756f5088715a8c2e146ed73b87c..1ac510a8904af57f3b2a3fdb154199be8dccc5f9 100644 --- a/platform/pwm/pwm_hi35xx.h +++ b/platform/pwm/pwm_hi35xx.h @@ -36,9 +36,18 @@ #define PWM_INV_OFFSET 1 #define PWM_KEEP_OFFSET 2 +#if defined(CONFIG_PWM_VIM3L) +#define PWM_DEFAULT_PERIOD 0x018F +#else #define PWM_DEFAULT_PERIOD 0x3E7 +#endif // CONFIG_PWM_VIM3L #define PWM_DEFAULT_POLARITY 0 +#if defined(CONFIG_PWM_VIM3L) +#define PWM_DEFAULT_DUTY_CYCLE 0x00C7 +#else #define PWM_DEFAULT_DUTY_CYCLE 0x14D +#endif // CONFIG_PWM_VIM3L + struct HiPwmRegs { volatile uint32_t cfg0; @@ -55,7 +64,11 @@ static inline void HiPwmDisable(struct HiPwmRegs *reg) if (reg == NULL) { return; } +#if defined(CONFIG_PWM_VIM3L) + reg->ctrl = PWM_DISABLE; +#else reg->ctrl &= ~1; +#endif // CONFIG_PWM_VIM3L } static inline void HiPwmAlwaysOutput(struct HiPwmRegs *reg) diff --git a/platform/pwm/pwm_hi35xx_linux.c b/platform/pwm/pwm_hi35xx_linux.c index 68f1e7e35944c3ec84d250e2bd3b72a8f13f557b..e0b296d68e4069623b77e681f565afb591a28c51 100644 --- a/platform/pwm/pwm_hi35xx_linux.c +++ b/platform/pwm/pwm_hi35xx_linux.c @@ -24,6 +24,16 @@ #include #include "hdf_log.h" +#if defined(CONFIG_PWM_VIM3L) +#include +#include +#include +#include +#include +#include +#include +#endif // CONFIG_PWM_VIM3L + #define HDF_LOG_TAG pwm_hi35xx_linux #define PWM_ENABLE_MASK 0x1 #define PWM_HI35XX_N_CELLS 2 @@ -100,9 +110,14 @@ static void Hi35xxGetState(struct pwm_chip *chip, struct pwm_device *pwm, struct return; } reg = (struct HiPwmRegs *)hi35xxChip->base; +#if defined(CONFIG_PWM_VIM3L) + state->period = reg->cfg0; + state->duty_cycle = reg->cfg1; +#else state->period = reg->cfg0 * PWM_CLK_PERIOD; state->duty_cycle = reg->cfg1 * PWM_CLK_PERIOD; state->polarity = (reg->ctrl & (1 << PWM_INV_OFFSET)) >> PWM_INV_OFFSET; +#endif state->enabled = reg->ctrl & PWM_ENABLE_MASK; HDF_LOGI("%s: get PwmConfig: number none, period %llu, duty %llu, polarity %u, enable %u.", diff --git a/platform/rtc/rtc_adapter.c b/platform/rtc/rtc_adapter.c index 41262fd18ccca83b4207c083859066ddf2cfc004..031b52916247a80b0e4d484484ac46eea3676584 100644 --- a/platform/rtc/rtc_adapter.c +++ b/platform/rtc/rtc_adapter.c @@ -51,7 +51,7 @@ static inline void LinuxTimeToHdfTime(struct RtcTime *hdfTime, const struct rtc_ static inline struct rtc_device *HdfGetRtcDevice(void) { - struct rtc_device *dev = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE); + struct rtc_device *dev = rtc_class_open("rtc0"); if (dev == NULL) { HDF_LOGE("%s: failed to get rtc device", __func__); diff --git a/platform/sdio/Makefile b/platform/sdio/Makefile index 2c0d97eddbdf5d04bb833ac52acc5db8d0bd29d1..b0febe10b927f795bf786794ece761fb00cb5243 100644 --- a/platform/sdio/Makefile +++ b/platform/sdio/Makefile @@ -15,4 +15,5 @@ include drivers/hdf/khdf/platform/platform.mk obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/mmc/sdio_if.o \ - ./sdio_adapter.o + ./sdio_adapter.o + diff --git a/platform/sdio/sdio_adapter.c b/platform/sdio/sdio_adapter.c index 59fdba571911a49694d444d7ebcd644700f82d47..72d4494a8553fe42ff6dd8a5e937897c06d9b5e6 100644 --- a/platform/sdio/sdio_adapter.c +++ b/platform/sdio/sdio_adapter.c @@ -1,7 +1,7 @@ /* * sdio_adapter.c * - * hi35xx linux sdio driver implement. + * linux sdio driver implement. * * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * @@ -33,32 +33,37 @@ #define MMC_SLOT_NUM 3 #define SDIO_RESCAN_WAIT_TIME 40 +#if defined(CONFIG_SDIO_VIM3L) +struct mmc_host *meson_get_mmc_host(int slot); +void meson_mmc_sdio_rescan(int slot); +#else struct mmc_host *himci_get_mmc_host(int slot); void hisi_sdio_rescan(int slot); +#endif // CONFIG_SDIO_VIM3L -static struct sdio_func *Hi35xxLinuxSdioGetFunc(struct SdioDevice *dev) +static struct sdio_func *LinuxSdioGetFunc(struct SdioDevice *dev) { if (dev == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetFunc: dev is null."); + HDF_LOGE("LinuxSdioGetFunc: dev is null."); return NULL; } return (struct sdio_func *)dev->sd.mmc.priv; } -static int32_t Hi35xxLinuxSdioIncrAddrReadBytes(struct SdioDevice *dev, +static int32_t LinuxSdioIncrAddrReadBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); int32_t ret = HDF_SUCCESS; uint16_t *output16 = NULL; uint32_t *output32 = NULL; if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrReadBytes: func is NULL."); + HDF_LOGE("LinuxSdioIncrAddrReadBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioIncrAddrReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -79,18 +84,18 @@ static int32_t Hi35xxLinuxSdioIncrAddrReadBytes(struct SdioDevice *dev, return sdio_memcpy_fromio(func, data, addr, size); } -static int32_t Hi35xxLinuxSdioIncrAddrWriteBytes(struct SdioDevice *dev, +static int32_t LinuxSdioIncrAddrWriteBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { int32_t ret = HDF_SUCCESS; - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrWriteBytes: func is NULL."); + HDF_LOGE("LinuxSdioIncrAddrWriteBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioIncrAddrWriteBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioIncrAddrWriteBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -109,60 +114,60 @@ static int32_t Hi35xxLinuxSdioIncrAddrWriteBytes(struct SdioDevice *dev, return sdio_memcpy_toio(func, addr, data, size); } -static int32_t Hi35xxLinuxSdioFixedAddrReadBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFixedAddrReadBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size, uint32_t scatterLen) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: func is NULL."); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } if (scatterLen > 0) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: not support!"); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: not support!"); return HDF_ERR_NOT_SUPPORT; } return sdio_readsb(func, data, addr, size); } -static int32_t Hi35xxLinuxSdioFixedAddrWriteBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFixedAddrWriteBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size, uint32_t scatterLen) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrWriteBytes: func is NULL."); + HDF_LOGE("LinuxSdioFixedAddrWriteBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFixedAddrReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } if (scatterLen > 0) { - HDF_LOGE("Hi35xxLinuxSdioFixedAddrWriteBytes: not support!"); + HDF_LOGE("LinuxSdioFixedAddrWriteBytes: not support!"); return HDF_ERR_NOT_SUPPORT; } return sdio_writesb(func, addr, data, size); } -static int32_t Hi35xxLinuxSdioFunc0ReadBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFunc0ReadBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { int32_t ret = HDF_SUCCESS; - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFunc0ReadBytes: func is NULL."); + HDF_LOGE("LinuxSdioFunc0ReadBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFunc0ReadBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFunc0ReadBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -170,18 +175,18 @@ static int32_t Hi35xxLinuxSdioFunc0ReadBytes(struct SdioDevice *dev, return ret; } -static int32_t Hi35xxLinuxSdioFunc0WriteBytes(struct SdioDevice *dev, +static int32_t LinuxSdioFunc0WriteBytes(struct SdioDevice *dev, uint8_t *data, uint32_t addr, uint32_t size) { int32_t ret = HDF_SUCCESS; - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFunc0WriteBytes: func is NULL."); + HDF_LOGE("LinuxSdioFunc0WriteBytes: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if ((data == NULL) || (size == 0)) { - HDF_LOGE("Hi35xxLinuxSdioFunc0WriteBytes: data or size is invalid."); + HDF_LOGE("LinuxSdioFunc0WriteBytes: data or size is invalid."); return HDF_ERR_INVALID_PARAM; } @@ -189,41 +194,41 @@ static int32_t Hi35xxLinuxSdioFunc0WriteBytes(struct SdioDevice *dev, return ret; } -static int32_t Hi35xxLinuxSdioSetBlockSize(struct SdioDevice *dev, uint32_t blockSize) +static int32_t LinuxSdioSetBlockSize(struct SdioDevice *dev, uint32_t blockSize) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetBlockSize, func is NULL."); + HDF_LOGE("LinuxSdioSetBlockSize, func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_set_block_size(func, blockSize); } -static int32_t Hi35xxLinuxSdioGetCommonInfo(struct SdioDevice *dev, +static int32_t LinuxSdioGetCommonInfo(struct SdioDevice *dev, SdioCommonInfo *info, uint32_t infoType) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo: func is NULL."); + HDF_LOGE("LinuxSdioGetCommonInfo: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (info == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo: info is null."); + HDF_LOGE("LinuxSdioGetCommonInfo: info is null."); return HDF_ERR_INVALID_PARAM; } if (infoType != SDIO_FUNC_INFO) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo: cur type %d is not support.", infoType); + HDF_LOGE("LinuxSdioGetCommonInfo: cur type %d is not support.", infoType); return HDF_ERR_NOT_SUPPORT; } if (func->card == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo fail, card is null."); + HDF_LOGE("LinuxSdioGetCommonInfo fail, card is null."); return HDF_ERR_INVALID_PARAM; } if (func->card->host == NULL) { - HDF_LOGE("Hi35xxLinuxSdioGetCommonInfo fail, host is null."); + HDF_LOGE("LinuxSdioGetCommonInfo fail, host is null."); return HDF_ERR_INVALID_PARAM; } info->funcInfo.enTimeout = func->enable_timeout; @@ -236,30 +241,30 @@ static int32_t Hi35xxLinuxSdioGetCommonInfo(struct SdioDevice *dev, return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioSetCommonInfo(struct SdioDevice *dev, +static int32_t LinuxSdioSetCommonInfo(struct SdioDevice *dev, SdioCommonInfo *info, uint32_t infoType) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo: func is NULL."); + HDF_LOGE("LinuxSdioSetCommonInfo: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (info == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo: info is null."); + HDF_LOGE("LinuxSdioSetCommonInfo: info is null."); return HDF_ERR_INVALID_PARAM; } if (infoType != SDIO_FUNC_INFO) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo: cur type %d is not support.", infoType); + HDF_LOGE("LinuxSdioSetCommonInfo: cur type %d is not support.", infoType); return HDF_ERR_NOT_SUPPORT; } if (func->card == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo fail, card is null."); + HDF_LOGE("LinuxSdioSetCommonInfo fail, card is null."); return HDF_ERR_INVALID_PARAM; } if (func->card->host == NULL) { - HDF_LOGE("Hi35xxLinuxSdioSetCommonInfo fail, host is null."); + HDF_LOGE("LinuxSdioSetCommonInfo fail, host is null."); return HDF_ERR_INVALID_PARAM; } func->enable_timeout = info->funcInfo.enTimeout; @@ -270,95 +275,99 @@ static int32_t Hi35xxLinuxSdioSetCommonInfo(struct SdioDevice *dev, return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioFlushData(struct SdioDevice *dev) +static int32_t LinuxSdioFlushData(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFlushData: func is NULL."); + HDF_LOGE("LinuxSdioFlushData: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (func->card == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFlushData: card is NULL."); + HDF_LOGE("LinuxSdioFlushData: card is NULL."); return HDF_ERR_INVALID_OBJECT; } +#if defined(CONFIG_SDIO_VIM3L) + return mmc_hw_reset(func->card->host); +#else return mmc_sw_reset(func->card->host); +#endif // CONFIG_SDIO_VIM3L } -static int32_t Hi35xxLinuxSdioClaimHost(struct SdioDevice *dev) +static int32_t LinuxSdioClaimHost(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioClaimHost: func is NULL."); + HDF_LOGE("LinuxSdioClaimHost: func is NULL."); return HDF_ERR_INVALID_OBJECT; } sdio_claim_host(func); return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioReleaseHost(struct SdioDevice *dev) +static int32_t LinuxSdioReleaseHost(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioReleaseHost: func is NULL."); + HDF_LOGE("LinuxSdioReleaseHost: func is NULL."); return HDF_ERR_INVALID_OBJECT; } sdio_release_host(func); return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioEnableFunc(struct SdioDevice *dev) +static int32_t LinuxSdioEnableFunc(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioEnableFunc: func is NULL."); + HDF_LOGE("LinuxSdioEnableFunc: func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_enable_func(func); } -static int32_t Hi35xxLinuxSdioDisableFunc(struct SdioDevice *dev) +static int32_t LinuxSdioDisableFunc(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioDisableFunc: func is NULL."); + HDF_LOGE("LinuxSdioDisableFunc: func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_disable_func(func); } -static int32_t Hi35xxLinuxSdioClaimIrq(struct SdioDevice *dev, SdioIrqHandler *handler) +static int32_t LinuxSdioClaimIrq(struct SdioDevice *dev, SdioIrqHandler *handler) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioClaimIrq: func is NULL."); + HDF_LOGE("LinuxSdioClaimIrq: func is NULL."); return HDF_ERR_INVALID_OBJECT; } if (handler == NULL) { - HDF_LOGE("Hi35xxLinuxSdioClaimIrq: handler is null."); + HDF_LOGE("LinuxSdioClaimIrq: handler is null."); return HDF_ERR_INVALID_PARAM; } return sdio_claim_irq(func, (sdio_irq_handler_t *)handler); } -static int32_t Hi35xxLinuxSdioReleaseIrq(struct SdioDevice *dev) +static int32_t LinuxSdioReleaseIrq(struct SdioDevice *dev) { - struct sdio_func *func = Hi35xxLinuxSdioGetFunc(dev); + struct sdio_func *func = LinuxSdioGetFunc(dev); if (func == NULL) { - HDF_LOGE("Hi35xxLinuxSdioReleaseIrq: func is NULL."); + HDF_LOGE("LinuxSdioReleaseIrq: func is NULL."); return HDF_ERR_INVALID_OBJECT; } return sdio_release_irq(func); } -static struct sdio_func *Hi35xxLinuxSdioSearchFunc(uint32_t funcNum, uint16_t vendorId, uint16_t deviceId) +static struct sdio_func *LinuxSdioSearchFunc(uint32_t funcNum, uint16_t vendorId, uint16_t deviceId) { struct mmc_card *card = NULL; struct mmc_host *host = NULL; @@ -366,7 +375,11 @@ static struct sdio_func *Hi35xxLinuxSdioSearchFunc(uint32_t funcNum, uint16_t ve uint32_t i, j; for (i = 0; i < MMC_SLOT_NUM; i++) { - host = himci_get_mmc_host(i); +#if defined(CONFIG_SDIO_VIM3L) + host = meson_get_mmc_host(i); +#else + host = himci_get_mmc_host(i); +#endif // CONFIG_SDIO_VIM3L if (host == NULL) { continue; } @@ -380,57 +393,61 @@ static struct sdio_func *Hi35xxLinuxSdioSearchFunc(uint32_t funcNum, uint16_t ve (func->num == funcNum) && (func->vendor == vendorId) && (func->device == deviceId)) { - HDF_LOGD("Hi35xxLinuxSdioSearchFunc: find func!"); + HDF_LOGD("LinuxSdioSearchFunc: find func!"); return func; } } } - HDF_LOGE("Hi35xxLinuxSdioSearchFunc: get sdio func fail!"); + HDF_LOGE("LinuxSdioSearchFunc: get sdio func fail!"); return NULL; } -static int32_t Hi35xxLinuxSdioFindFunc(struct SdioDevice *dev, struct SdioFunctionConfig *configData) +static int32_t LinuxSdioFindFunc(struct SdioDevice *dev, struct SdioFunctionConfig *configData) { if (dev == NULL || configData == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFindFunc: dev or configData is NULL."); + HDF_LOGE("LinuxSdioFindFunc: dev or configData is NULL."); return HDF_ERR_INVALID_OBJECT; } - dev->sd.mmc.priv = Hi35xxLinuxSdioSearchFunc(configData->funcNr, configData->vendorId, configData->deviceId); + dev->sd.mmc.priv = LinuxSdioSearchFunc(configData->funcNr, configData->vendorId, configData->deviceId); if (dev->sd.mmc.priv == NULL) { - HDF_LOGE("Hi35xxLinuxSdioFindFunc: Hi35xxLinuxSdioSearchFunc fail."); + HDF_LOGE("LinuxSdioFindFunc: LinuxSdioSearchFunc fail."); return HDF_ERR_NOT_SUPPORT; } return HDF_SUCCESS; } static struct SdioDeviceOps g_sdioDeviceOps = { - .incrAddrReadBytes = Hi35xxLinuxSdioIncrAddrReadBytes, - .incrAddrWriteBytes = Hi35xxLinuxSdioIncrAddrWriteBytes, - .fixedAddrReadBytes = Hi35xxLinuxSdioFixedAddrReadBytes, - .fixedAddrWriteBytes = Hi35xxLinuxSdioFixedAddrWriteBytes, - .func0ReadBytes = Hi35xxLinuxSdioFunc0ReadBytes, - .func0WriteBytes = Hi35xxLinuxSdioFunc0WriteBytes, - .setBlockSize = Hi35xxLinuxSdioSetBlockSize, - .getCommonInfo = Hi35xxLinuxSdioGetCommonInfo, - .setCommonInfo = Hi35xxLinuxSdioSetCommonInfo, - .flushData = Hi35xxLinuxSdioFlushData, - .enableFunc = Hi35xxLinuxSdioEnableFunc, - .disableFunc = Hi35xxLinuxSdioDisableFunc, - .claimIrq = Hi35xxLinuxSdioClaimIrq, - .releaseIrq = Hi35xxLinuxSdioReleaseIrq, - .findFunc = Hi35xxLinuxSdioFindFunc, - .claimHost = Hi35xxLinuxSdioClaimHost, - .releaseHost = Hi35xxLinuxSdioReleaseHost, + .incrAddrReadBytes = LinuxSdioIncrAddrReadBytes, + .incrAddrWriteBytes = LinuxSdioIncrAddrWriteBytes, + .fixedAddrReadBytes = LinuxSdioFixedAddrReadBytes, + .fixedAddrWriteBytes = LinuxSdioFixedAddrWriteBytes, + .func0ReadBytes = LinuxSdioFunc0ReadBytes, + .func0WriteBytes = LinuxSdioFunc0WriteBytes, + .setBlockSize = LinuxSdioSetBlockSize, + .getCommonInfo = LinuxSdioGetCommonInfo, + .setCommonInfo = LinuxSdioSetCommonInfo, + .flushData = LinuxSdioFlushData, + .enableFunc = LinuxSdioEnableFunc, + .disableFunc = LinuxSdioDisableFunc, + .claimIrq = LinuxSdioClaimIrq, + .releaseIrq = LinuxSdioReleaseIrq, + .findFunc = LinuxSdioFindFunc, + .claimHost = LinuxSdioClaimHost, + .releaseHost = LinuxSdioReleaseHost, }; -static bool Hi35xxLinuxSdioRescanFinish(struct MmcCntlr *cntlr) +static bool LinuxSdioRescanFinish(struct MmcCntlr *cntlr) { struct mmc_host *host = NULL; struct mmc_card *card = NULL; - host = himci_get_mmc_host(cntlr->index); +#if defined(CONFIG_SDIO_VIM3L) + meson_get_mmc_host(cntlr->index); +#else + host = himci_get_mmc_host(cntlr->index); +#endif // CONFIG_SDIO_VIM3L if (host == NULL) { return false; } @@ -445,25 +462,29 @@ static bool Hi35xxLinuxSdioRescanFinish(struct MmcCntlr *cntlr) return false; } -static int32_t Hi35xxLinuxSdioRescan(struct MmcCntlr *cntlr) +static int32_t LinuxSdioRescan(struct MmcCntlr *cntlr) { bool rescanFinish = false; uint32_t count = 0; if (cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxSdioRescan: cntlr is NULL."); + HDF_LOGE("LinuxSdioRescan: cntlr is NULL."); return HDF_ERR_INVALID_OBJECT; } +#if defined(CONFIG_SDIO_VIM3L) + meson_mmc_sdio_rescan(cntlr->index); +#else hisi_sdio_rescan(cntlr->index); +#endif // CONFIG_SDIO_VIM3L while (rescanFinish == false && count < SDIO_RESCAN_WAIT_TIME) { OsalMSleep(50); count++; - rescanFinish = Hi35xxLinuxSdioRescanFinish(cntlr); + rescanFinish = LinuxSdioRescanFinish(cntlr); } if (rescanFinish == false) { - HDF_LOGE("Hi35xxLinuxSdioRescan: fail!"); + HDF_LOGE("LinuxSdioRescan: fail!"); return HDF_FAILURE; } @@ -472,10 +493,10 @@ static int32_t Hi35xxLinuxSdioRescan(struct MmcCntlr *cntlr) } struct MmcCntlrOps g_sdioCntlrOps = { - .rescanSdioDev = Hi35xxLinuxSdioRescan, + .rescanSdioDev = LinuxSdioRescan, }; -static void Hi35xxLinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) +static void LinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) { if (cntlr == NULL) { return; @@ -489,56 +510,56 @@ static void Hi35xxLinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) OsalMemFree(cntlr); } -static int32_t Hi35xxLinuxSdioCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) +static int32_t LinuxSdioCntlrParse(struct MmcCntlr *cntlr, struct HdfDeviceObject *obj) { const struct DeviceResourceNode *node = NULL; struct DeviceResourceIface *drsOps = NULL; int32_t ret; if (obj == NULL || cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: input para is NULL."); + HDF_LOGE("LinuxSdioCntlrParse: input para is NULL."); return HDF_FAILURE; } node = obj->property; if (node == NULL) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: drs node is NULL."); + HDF_LOGE("LinuxSdioCntlrParse: drs node is NULL."); return HDF_FAILURE; } drsOps = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); if (drsOps == NULL || drsOps->GetUint16 == NULL || drsOps->GetUint32 == NULL) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: invalid drs ops fail!"); + HDF_LOGE("LinuxSdioCntlrParse: invalid drs ops fail!"); return HDF_FAILURE; } ret = drsOps->GetUint16(node, "hostId", &(cntlr->index), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: read hostIndex fail!"); + HDF_LOGE("LinuxSdioCntlrParse: read hostIndex fail!"); return ret; } ret = drsOps->GetUint32(node, "devType", &(cntlr->devType), 0); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioCntlrParse: read devType fail!"); + HDF_LOGE("LinuxSdioCntlrParse: read devType fail!"); return ret; } - HDF_LOGD("Hi35xxLinuxSdioCntlrParse: hostIndex = %d, devType = %d.", cntlr->index, cntlr->devType); + HDF_LOGD("LinuxSdioCntlrParse: hostIndex = %d, devType = %d.", cntlr->index, cntlr->devType); return HDF_SUCCESS; } -static int32_t Hi35xxLinuxSdioBind(struct HdfDeviceObject *obj) +static int32_t LinuxSdioBind(struct HdfDeviceObject *obj) { struct MmcCntlr *cntlr = NULL; int32_t ret; - HDF_LOGE("Hi35xxLinuxSdioBind: entry!"); + HDF_LOGE("LinuxSdioBind: entry!"); if (obj == NULL) { - HDF_LOGE("Hi35xxLinuxSdioBind: Fail, obj is NULL."); + HDF_LOGE("LinuxSdioBind: Fail, obj is NULL."); return HDF_ERR_INVALID_OBJECT; } cntlr = (struct MmcCntlr *)OsalMemCalloc(sizeof(struct MmcCntlr)); if (cntlr == NULL) { - HDF_LOGE("Hi35xxLinuxSdioBind: no mem for MmcCntlr."); + HDF_LOGE("LinuxSdioBind: no mem for MmcCntlr."); return HDF_ERR_MALLOC_FAIL; } @@ -546,53 +567,53 @@ static int32_t Hi35xxLinuxSdioBind(struct HdfDeviceObject *obj) cntlr->hdfDevObj = obj; obj->service = &cntlr->service; /* init cntlr. */ - ret = Hi35xxLinuxSdioCntlrParse(cntlr, obj); + ret = LinuxSdioCntlrParse(cntlr, obj); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: cntlr parse fail."); + HDF_LOGE("LinuxSdioBind: cntlr parse fail."); goto _ERR; } ret = MmcCntlrAdd(cntlr); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: cntlr add fail."); + HDF_LOGE("LinuxSdioBind: cntlr add fail."); goto _ERR; } ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: alloc dev fail."); + HDF_LOGE("LinuxSdioBind: alloc dev fail."); goto _ERR; } MmcDeviceAddOps(cntlr->curDev, &g_sdioDeviceOps); - HDF_LOGD("Hi35xxLinuxSdioBind: Success!"); + HDF_LOGD("LinuxSdioBind: Success!"); return HDF_SUCCESS; _ERR: - Hi35xxLinuxSdioDeleteCntlr(cntlr); - HDF_LOGE("Hi35xxLinuxSdioBind: Fail!"); + LinuxSdioDeleteCntlr(cntlr); + HDF_LOGE("LinuxSdioBind: Fail!"); return HDF_FAILURE; } -static int32_t Hi35xxLinuxSdioInit(struct HdfDeviceObject *obj) +static int32_t LinuxSdioInit(struct HdfDeviceObject *obj) { (void)obj; - HDF_LOGD("Hi35xxLinuxSdioInit: Success!"); + HDF_LOGD("LinuxSdioInit: Success!"); return HDF_SUCCESS; } -static void Hi35xxLinuxSdioRelease(struct HdfDeviceObject *obj) +static void LinuxSdioRelease(struct HdfDeviceObject *obj) { if (obj == NULL) { return; } - Hi35xxLinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service); + LinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service); } struct HdfDriverEntry g_sdioDriverEntry = { .moduleVersion = 1, - .Bind = Hi35xxLinuxSdioBind, - .Init = Hi35xxLinuxSdioInit, - .Release = Hi35xxLinuxSdioRelease, + .Bind = LinuxSdioBind, + .Init = LinuxSdioInit, + .Release = LinuxSdioRelease, .moduleName = "HDF_PLATFORM_SDIO", }; HDF_INIT(g_sdioDriverEntry); diff --git a/platform/uart/uart_adapter.c b/platform/uart/uart_adapter.c index e8176269bbb2123e84f4de19a44eefce894f3865..c9bcf7b1cb444012f6436296cadee374e893c81b 100644 --- a/platform/uart/uart_adapter.c +++ b/platform/uart/uart_adapter.c @@ -484,7 +484,7 @@ static int32_t HdfUartInit(struct HdfDeviceObject *obj) HDF_LOGE("%s: read num fail", __func__); return HDF_FAILURE; } - if (iface->GetString(obj->property, "driver_name", &drName, "ttyAMA") != HDF_SUCCESS) { + if (iface->GetString(obj->property, "driver_name", &drName, "ttyS") != HDF_SUCCESS) { HDF_LOGE("%s: read driver_name fail", __func__); return HDF_FAILURE; } diff --git a/platform/watchdog/watchdog_adapter.c b/platform/watchdog/watchdog_adapter.c index 309a4d1faf0572a5918d4dd3d28e69cee8894021..5014e9bd704d59dc299dcbfaf7fc8a749fef6ef9 100644 --- a/platform/watchdog/watchdog_adapter.c +++ b/platform/watchdog/watchdog_adapter.c @@ -148,7 +148,7 @@ static struct watchdog_device *WdtCoreDataToWdd(void *wdCoreData) * } */ struct WdtCoreDataHead { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,182) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) struct device dev; #else struct kref kref;