From e59be13550ff529fd53774d6d485c22465b1da8a Mon Sep 17 00:00:00 2001 From: puyj0604 Date: Tue, 28 Dec 2021 21:17:43 +0800 Subject: [PATCH 1/7] add imx8mm change content Signed-off-by: puyj0604 --- Kconfig | 4 +- Makefile | 7 + model/audio/Makefile | 28 +- model/input/Makefile | 2 + model/usb/device/f_generic.c | 1 + osal/src/osal_mutex.c | 23 +- platform/emmc/emmc_adapter.c | 84 +++--- platform/rtc/rtc_adapter.c | 2 +- platform/sdio/sdio_adapter.c | 279 +++++++++--------- platform/spi/Makefile | 2 +- .../{hi35xx_spi_adapter.c => spi_adapter.c} | 0 platform/watchdog/watchdog_adapter.c | 4 +- 12 files changed, 228 insertions(+), 208 deletions(-) rename platform/spi/{hi35xx_spi_adapter.c => spi_adapter.c} (100%) diff --git a/Kconfig b/Kconfig index 037b190..b540920 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/nxp/drivers/ethernet/adapter/Kconfig" +source "drivers/hdf/framework/model/input/driver/touchscreen/Kconfig" diff --git a/Makefile b/Makefile index 33c8c23..42742d1 100644 --- a/Makefile +++ b/Makefile @@ -51,3 +51,10 @@ obj-$(CONFIG_DRIVERS_HDF_BT) += model/network/bluetooth/ obj-$(CONFIG_DRIVERS_HDF_VIBRATOR) += model/misc/vibrator/ obj-$(CONFIG_DRIVERS_HDF_AUDIO) += model/audio/ obj-$(CONFIG_DRIVERS_HDF_DSOFTBUS) += model/misc/dsoftbus/ +# ThunderSoft for OpenHarmony start +obj-y += network/ +obj-$(CONFIG_DRIVERS_HDF_IMX8MM_ETHERNET) += ../../../../device/nxp/drivers/ethernet/adapter/ +ccflags-$(CONFIG_DRIVERS_HDF_IMX8MM_ETHERNET) += -Idrivers/net/ethernet/freescale/ +obj-$(CONFIG_DRIVERS_HDF_WIFI) += ../../../../device/nxp/drivers/wifi/ap6212/ +# ThunderSoft for OpenHarmony end + diff --git a/model/audio/Makefile b/model/audio/Makefile index f6eeeb8..99f2539 100755 --- a/model/audio/Makefile +++ b/model/audio/Makefile @@ -28,17 +28,16 @@ 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_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_impl.o \ - $(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 \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/dsp/src/dsp_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_dai_adapter.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_aiao_impl.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_ops.o \ - $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_adapter.o + $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o + +obj-y += \ + $(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)/wm8904/codec/src/wm8904.o \ + $(KHDF_AUDIO_CODEC_DIR)/wm8904/codec/src/wm8904_impl.o obj-$(CONFIG_ARCH_HI3516DV300) += \ $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_core.o \ @@ -83,9 +82,8 @@ 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_CODEC_DIR)/imx8mm/soc/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/imx8mm/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/wm8904/codec/include \ -Iinclude/$(KHDF_AUDIO_PERIPHERAL_ROOT_DIR)/audio/interfaces/include \ -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/include diff --git a/model/input/Makefile b/model/input/Makefile index 024bc5e..ab7c92b 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/usb/device/f_generic.c b/model/usb/device/f_generic.c index 6878c95..1d9bde5 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/osal/src/osal_mutex.c b/osal/src/osal_mutex.c index 1809540..85f66c9 100644 --- a/osal/src/osal_mutex.c +++ b/osal/src/osal_mutex.c @@ -73,14 +73,27 @@ 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) { - HDF_LOGE("%s invalid param", __func__); - return HDF_ERR_INVALID_PARAM; - } + if (mutex == NULL || mutex->realMutex == NULL) { + HDF_LOGE("%s invalid param", __func__); + return HDF_ERR_INVALID_PARAM; + } - (void)mSec; + (void)mSec; mutex_lock((struct mutex *)mutex->realMutex); return HDF_SUCCESS; diff --git a/platform/emmc/emmc_adapter.c b/platform/emmc/emmc_adapter.c index 449cab0..5ae4c18 100644 --- a/platform/emmc/emmc_adapter.c +++ b/platform/emmc/emmc_adapter.c @@ -1,7 +1,7 @@ /* * emmc_adapter.c * - * hi35xx linux emmc driver implement. + * linux emmc driver implement. * * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * @@ -27,45 +27,45 @@ #define HDF_LOG_TAG emmc_adapter_c -struct mmc_host *himci_get_mmc_host(int slot); +struct mmc_host *sdhci_esdhc_get_mmc_host(int slot); -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 +79,108 @@ 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."); - goto _ERR; + HDF_LOGE("LinuxEmmcBind: cntlr parse fail."); + LinuxEmmcDeleteCntlr(cntlr); + return HDF_FAILURE; } - cntlr->priv = (void *)himci_get_mmc_host((int32_t)cntlr->index); + cntlr->priv = (void *)sdhci_esdhc_get_mmc_host((int32_t)cntlr->index); ret = MmcCntlrAdd(cntlr); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: cntlr add fail."); - goto _ERR; + HDF_LOGE("LinuxEmmcBind: cntlr add fail."); + LinuxEmmcDeleteCntlr(cntlr); + return HDF_FAILURE; } ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxEmmcBind: alloc dev fail."); - goto _ERR; + HDF_LOGE("LinuxEmmcBind: alloc dev fail."); + LinuxEmmcDeleteCntlr(cntlr); + return HDF_FAILURE; } MmcDeviceAddOps(cntlr->curDev, &g_emmcMethod); - HDF_LOGD("Hi35xxLinuxEmmcBind: Success!"); + HDF_LOGD("LinuxEmmcBind: Success!"); return HDF_SUCCESS; - -_ERR: - Hi35xxLinuxEmmcDeleteCntlr(cntlr); - HDF_LOGE("Hi35xxLinuxEmmcBind: 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 = { +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); +HDF_INIT(g_emmcdriverentry); diff --git a/platform/rtc/rtc_adapter.c b/platform/rtc/rtc_adapter.c index 41262fd..031b529 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/sdio_adapter.c b/platform/sdio/sdio_adapter.c index 59fdba5..d7a006e 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,32 @@ #define MMC_SLOT_NUM 3 #define SDIO_RESCAN_WAIT_TIME 40 -struct mmc_host *himci_get_mmc_host(int slot); -void hisi_sdio_rescan(int slot); +struct mmc_host *sdhci_esdhc_get_mmc_host(int slot); +void sdhci_esdhc_sdio_rescan(int slot); -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 +79,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 +109,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 +170,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 +189,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 +236,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 +270,95 @@ 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; } return mmc_sw_reset(func->card->host); } -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 +366,7 @@ 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); + host = sdhci_esdhc_get_mmc_host(i); if (host == NULL) { continue; } @@ -380,57 +380,57 @@ 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_LOGE("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); + host = sdhci_esdhc_get_mmc_host(cntlr->index); if (host == NULL) { return false; } @@ -445,25 +445,25 @@ 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; } - hisi_sdio_rescan(cntlr->index); + sdhci_esdhc_sdio_rescan(cntlr->index); 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; } @@ -471,11 +471,11 @@ static int32_t Hi35xxLinuxSdioRescan(struct MmcCntlr *cntlr) return HDF_SUCCESS; } -struct MmcCntlrOps g_sdioCntlrOps = { - .rescanSdioDev = Hi35xxLinuxSdioRescan, +struct MmcCntlrOps g_sdiocntlrops = { + .rescanSdioDev = LinuxSdioRescan, }; -static void Hi35xxLinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) +static void LinuxSdioDeleteCntlr(struct MmcCntlr *cntlr) { if (cntlr == NULL) { return; @@ -489,110 +489,109 @@ 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_LOGE("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; } - cntlr->ops = &g_sdioCntlrOps; + cntlr->ops = &g_sdiocntlrops; 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."); - goto _ERR; + HDF_LOGE("LinuxSdioBind: cntlr parse fail."); + LinuxSdioDeleteCntlr(cntlr); + return HDF_FAILURE; } ret = MmcCntlrAdd(cntlr); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: cntlr add fail."); - goto _ERR; + HDF_LOGE("LinuxSdioBind: cntlr add fail."); + LinuxSdioDeleteCntlr(cntlr); + return HDF_FAILURE; } ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType); if (ret != HDF_SUCCESS) { - HDF_LOGE("Hi35xxLinuxSdioBind: alloc dev fail."); - goto _ERR; + HDF_LOGE("LinuxSdioBind: alloc dev fail."); + LinuxSdioDeleteCntlr(cntlr); + return HDF_FAILURE; } + MmcDeviceAddOps(cntlr->curDev, &g_sdioDeviceOps); - HDF_LOGD("Hi35xxLinuxSdioBind: Success!"); + HDF_LOGE("LinuxSdioBind: Success!"); return HDF_SUCCESS; - -_ERR: - Hi35xxLinuxSdioDeleteCntlr(cntlr); - HDF_LOGE("Hi35xxLinuxSdioBind: 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_LOGE("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 = { +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); +HDF_INIT(g_sdiodriverentry); diff --git a/platform/spi/Makefile b/platform/spi/Makefile index d049969..3574fa4 100644 --- a/platform/spi/Makefile +++ b/platform/spi/Makefile @@ -16,5 +16,5 @@ include drivers/hdf/khdf/platform/platform.mk obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/spi_core.o \ $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/spi_if.o \ - hi35xx_spi_adapter.o + spi_adapter.o diff --git a/platform/spi/hi35xx_spi_adapter.c b/platform/spi/spi_adapter.c similarity index 100% rename from platform/spi/hi35xx_spi_adapter.c rename to platform/spi/spi_adapter.c diff --git a/platform/watchdog/watchdog_adapter.c b/platform/watchdog/watchdog_adapter.c index 309a4d1..055a4ab 100644 --- a/platform/watchdog/watchdog_adapter.c +++ b/platform/watchdog/watchdog_adapter.c @@ -146,9 +146,9 @@ static struct watchdog_device *WdtCoreDataToWdd(void *wdCoreData) * struct watchdog_device *wdd; * ... * } - */ + */ 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; -- Gitee From 6f12534b4bad686012ea2f32958bbd893a47d819 Mon Sep 17 00:00:00 2001 From: puyj0604 Date: Fri, 31 Dec 2021 14:34:04 +0800 Subject: [PATCH 2/7] modify for wifi Signed-off-by: puyj0604 --- model/network/wifi/hdfwifi.mk | 2 +- network/Makefile | 2 +- network/src/Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/model/network/wifi/hdfwifi.mk b/model/network/wifi/hdfwifi.mk index 63703c3..915903b 100644 --- a/model/network/wifi/hdfwifi.mk +++ b/model/network/wifi/hdfwifi.mk @@ -14,7 +14,7 @@ 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/nxp/drivers/wifi HDF_FRAMEWORKS_INC := \ -Idrivers/hdf/framework/ability/sbuf/include \ -Idrivers/hdf/framework/core/common/include/host \ diff --git a/network/Makefile b/network/Makefile index e6891c5..93b3a29 100644 --- a/network/Makefile +++ b/network/Makefile @@ -12,4 +12,4 @@ # # -obj-$(CONFIG_DRIVERS_HDF_WIFI) += src/ \ No newline at end of file +obj-y += src/ diff --git a/network/src/Makefile b/network/src/Makefile index 34d25ae..408e229 100755 --- a/network/src/Makefile +++ b/network/src/Makefile @@ -12,9 +12,9 @@ # # -obj-$(CONFIG_DRIVERS_HDF_WIFI) += net_device_adapter.o netbuf_adapter.o +obj-y += net_device_adapter.o netbuf_adapter.o -ccflags-$(CONFIG_DRIVERS_HDF_WIFI) += \ +ccflags-y += \ -Idrivers/hdf/framework/model/network/common/netdevice \ -Idrivers/hdf/framework/include/net\ -Idrivers/hdf/khdf/network/include \ -- Gitee From d0ce2c383f535e2c7ffa5bb46f54d5f68b632a2c Mon Sep 17 00:00:00 2001 From: zhaoxc0502 Date: Thu, 6 Jan 2022 18:39:09 +0800 Subject: [PATCH 3/7] push solved probelm Signed-off-by: zhaoxc0502 --- model/audio/Kconfig | 14 ++++++++++++++ model/audio/Makefile | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/model/audio/Kconfig b/model/audio/Kconfig index a760df7..e031212 100755 --- a/model/audio/Kconfig +++ b/model/audio/Kconfig @@ -11,3 +11,17 @@ config DRIVERS_HDF_AUDIO_TEST depends on DRIVERS_HDF_AUDIO help Answer Y to choice HDF Audio Test input driver. + +config ARCH_ARM64 + bool "Enable HDF arm64 lib" + default n + depends on DRIVERS_HDF_AUDIO + help + Answer Y to choice HDF arm64 lib. + +config IMX8MM_AUDIO + bool "Enable HDF imx8mm driver" + default n + depends on DRIVERS_HDF_AUDIO + help + Answer Y to choice HDF imx8mm driver. \ No newline at end of file diff --git a/model/audio/Makefile b/model/audio/Makefile index 99f2539..6f076b2 100755 --- a/model/audio/Makefile +++ b/model/audio/Makefile @@ -30,7 +30,7 @@ obj-y += \ $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_stream_dispatch.o \ $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o -obj-y += \ +obj-$(CONFIG_IMX8MM_AUDIO) += \ $(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 \ @@ -82,8 +82,8 @@ 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_PERIPHERAL_ROOT_DIR)/audio/interfaces/include \ + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/include \ -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/imx8mm/soc/include \ -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/imx8mm/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/wm8904/codec/include \ - -Iinclude/$(KHDF_AUDIO_PERIPHERAL_ROOT_DIR)/audio/interfaces/include \ - -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/include + -Iinclude/$(KHDF_AUDIO_CODEC_DIR)/wm8904/codec/include -- Gitee From 28b602f55b0b6059931213f68df703e45fd2c0f6 Mon Sep 17 00:00:00 2001 From: puyj0604 Date: Tue, 11 Jan 2022 22:15:17 +0800 Subject: [PATCH 4/7] modify for sdio Signed-off-by: puyj0604 --- test/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/Kconfig b/test/Kconfig index e1c527b..0d056f4 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -15,3 +15,17 @@ config DRIVERS_HDF_TEST depends on DRIVERS_HDF help Answer Y to enable linux support HDF test. + +config IMX8MM_SDIO_TEST + bool "Enable imx8mm sdio test" + default n + depends on DRIVERS_HDF_TEST + help + Answer Y to enable imx8mm sdio test. + +config IMX8MM_SPI_TEST + bool "Enable imx8mm spi test" + default n + depends on DRIVERS_HDF_TEST + help + Answer Y to enable imx8mm spi test. -- Gitee From a5368379fa3d1aa7699d91d141bc16007cc2bf68 Mon Sep 17 00:00:00 2001 From: puyj0604 Date: Wed, 12 Jan 2022 21:57:13 +0800 Subject: [PATCH 5/7] modify for mipi Signed-off-by: puyj0604 --- platform/Kconfig | 14 ++ platform/mipi_dsi/Makefile | 6 +- platform/mipi_dsi/mipi_drm_adapter.c | 209 +++++++++++++++++++++++++++ 3 files changed, 227 insertions(+), 2 deletions(-) create mode 100644 platform/mipi_dsi/mipi_drm_adapter.c diff --git a/platform/Kconfig b/platform/Kconfig index 658fbf5..1d1cc62 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -85,3 +85,17 @@ config DRIVERS_HDF_PLATFORM_RTC depends on DRIVERS_HDF_PLATFORM help Answer Y to enable HDF platform rtc driver. + +config DRIVERS_HDF_PLATFORM_IMX8MM_MIPI_DSI + bool "Enable HDF platform imx8mm mipi dsi driver" + default n + depends on DRIVERS_HDF_PLATFORM_MIPI_DSI + help + Answer Y to enable HDF platform imx8mm mipi dsi driver. + +config DRIVERS_HDF_PLATFORM_HI35XX_MIPI_DSI + bool "Enable HDF platform hi35xx mipi dsi driver" + default n + depends on DRIVERS_HDF_PLATFORM_MIPI_DSI + help + Answer Y to enable HDF platform hi35xx mipi dsi driver. diff --git a/platform/mipi_dsi/Makefile b/platform/mipi_dsi/Makefile index 82728cc..4dc7136 100644 --- a/platform/mipi_dsi/Makefile +++ b/platform/mipi_dsi/Makefile @@ -18,7 +18,9 @@ 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 +obj-$(CONFIG_DRIVERS_HDF_PLATFORM_IMX8MM_MIPI_DSI) += mipi_drm_adapter.o + +obj-$(CONFIG_DRIVERS_HDF_PLATFORM_HI35XX_MIPI_DSI) += mipi_tx_dev.o \ + mipi_tx_hi35xx.o EXTRA_CFLAGS += -Wno-error=date-time diff --git a/platform/mipi_dsi/mipi_drm_adapter.c b/platform/mipi_dsi/mipi_drm_adapter.c new file mode 100644 index 0000000..231039a --- /dev/null +++ b/platform/mipi_dsi/mipi_drm_adapter.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