diff --git a/adapter/khdf/linux/model/audio/Makefile b/adapter/khdf/linux/model/audio/Makefile index 745c69851335abfa2bd3a5c85e5263e5964c27a3..04e5db2ce27f814d252fce6a180ea4e31045e34e 100644 --- a/adapter/khdf/linux/model/audio/Makefile +++ b/adapter/khdf/linux/model/audio/Makefile @@ -94,7 +94,7 @@ obj-$(CONFIG_DRIVERS_HDF_AUDIO_IMX8MM) += \ $(KHDF_AUDIO_IMX8MM_DIR)/codec/src/wm8904.o \ $(KHDF_AUDIO_IMX8MM_DIR)/codec/src/wm8904_impl.o -ccflags-$(CONFIG_DRIVERS_HDF_AUDIO) += -lm -lc -lgcc -std=gnu99 -Werror\ +ccflags-$(CONFIG_DRIVERS_HDF_AUDIO) += -std=gnu99 -Werror\ -I$(srctree)/$(KHDF_AUDIO_KHDF_ROOT_DIR)/osal/include \ -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/core \ -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/utils \ diff --git a/adapter/khdf/linux/model/display/Makefile b/adapter/khdf/linux/model/display/Makefile index c990ef9daba2e05b8bdcf09ee11ff5792cef92d7..01c86a37971abb8f646128998402cadf69c6cb77 100644 --- a/adapter/khdf/linux/model/display/Makefile +++ b/adapter/khdf/linux/model/display/Makefile @@ -46,7 +46,7 @@ obj-$(CONFIG_DRIVERS_HDF_LCD_ST7789) += \ obj-$(CONFIG_ARCH_ROCKCHIP) += \ $(DISPLAY_ROOT_DIR)/panel/ili9881_st_5p5.o -ccflags-y += -lm -lc -lgcc \ +ccflags-y += \ -I$(srctree)/drivers/hdf/framework/model/display/driver \ -I$(srctree)/drivers/hdf/framework/model/display/driver/adapter_soc \ -I$(srctree)/drivers/hdf/framework/include/utils \ diff --git a/adapter/khdf/linux/model/usb/host/Makefile b/adapter/khdf/linux/model/usb/host/Makefile index 73bad22c9609751775562b46bbf6c22ef4bae091..6e4a80e30deff10cea45e4eb9402b124e5583d4b 100644 --- a/adapter/khdf/linux/model/usb/host/Makefile +++ b/adapter/khdf/linux/model/usb/host/Makefile @@ -16,7 +16,8 @@ obj-$(CONFIG_DRIVERS_HDF_USB_PNP_NOTIFY) += \ obj-$(CONFIG_DRIVERS_HDF_USB_NET_ADAPTER) += \ $(USB_PNP_NOTIFY_ROOT_DIR)/src/usb_net_adapter.o -ccflags-y += -lm -lc -lgcc \ +ccflags-y += -Wno-incompatible-pointer-types-discards-qualifiers +ccflags-y += \ -I$(srctree)/drivers/hdf/khdf/model/usb/host/include \ -I$(srctree)/drivers/hdf/framework/include/utils \ -I$(srctree)/drivers/hdf/framework/utils/include \ diff --git a/adapter/khdf/linux/model/usb/host/src/usb_net_adapter.c b/adapter/khdf/linux/model/usb/host/src/usb_net_adapter.c index c8280c890045a6820a3229ad963533881a25931e..b8957f55059cd5ca337c403529854153ad68e2a7 100755 --- a/adapter/khdf/linux/model/usb/host/src/usb_net_adapter.c +++ b/adapter/khdf/linux/model/usb/host/src/usb_net_adapter.c @@ -26,7 +26,11 @@ #endif #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) #include +#else +#include +#endif #include "osal_mem.h" #include "securec.h" @@ -116,8 +120,13 @@ static void RxComplete(WorkStruct *work) stats64->tx_packets, stats64->tx_bytes); flags = u64_stats_update_begin_irqsave(&stats64->syncp); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) stats64->rx_packets++; stats64->rx_bytes += usbNet->rxLen; +#else + u64_stats_inc(&stats64->rx_packets); + u64_stats_add(&stats64->rx_bytes, usbNet->rxLen); +#endif u64_stats_update_end_irqrestore(&stats64->syncp, flags); HARCH_NET_INFO_PRINT("rx_complete stats64->rx_packets = %lu,usbNet stats64->rx_bytes = %lu", @@ -544,8 +553,13 @@ static void TxComplete(WorkStruct *work) stats64->tx_packets, stats64->tx_bytes); flags = u64_stats_update_begin_irqsave(&stats64->syncp); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) stats64->tx_packets++; stats64->tx_bytes += usbNet->txLen; +#else + u64_stats_inc(&stats64->tx_packets); + u64_stats_add(&stats64->tx_bytes, usbNet->txLen); +#endif u64_stats_update_end_irqrestore(&stats64->syncp, flags); HARCH_NET_INFO_PRINT ("tx_complete stats64->rx_packets = %lu,usbNet stats64->rx_bytes = %lu", diff --git a/adapter/khdf/linux/osal/src/osal_cdev.c b/adapter/khdf/linux/osal/src/osal_cdev.c index c1a05b8f306f19ce84dc935e7a439160bab0bce0..6e928a64c70df67d32e643225ea61d475086f457 100644 --- a/adapter/khdf/linux/osal/src/osal_cdev.c +++ b/adapter/khdf/linux/osal/src/osal_cdev.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "osal_cdev.h" #include "hdf_log.h" #include "osal_file.h" @@ -58,7 +59,11 @@ static const char* StringRfindChar(const char* str, char chr) return NULL; } -static char* hdfDevnode(struct device* dev, umode_t* mode) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +static char* hdfDevnode(struct device* dev, unsigned short* mode) +#else +static char* hdfDevnode(const struct device* dev, unsigned short* mode) +#endif { (void)mode; return kasprintf(GFP_KERNEL, "hdf/%s", dev_name(dev)); diff --git a/adapter/khdf/linux/osal/src/osal_time.c b/adapter/khdf/linux/osal/src/osal_time.c index 20d121ecd5ab112d6b48fe9cc446d6a7a20bbbd0..42e5cbbe3a0e6605bd002b3b3c3a755a37f19e9b 100644 --- a/adapter/khdf/linux/osal/src/osal_time.c +++ b/adapter/khdf/linux/osal/src/osal_time.c @@ -98,7 +98,7 @@ void OsalMDelay(uint32_t ms) } EXPORT_SYMBOL(OsalMDelay); -uint64_t OsalGetSysTimeMs() +uint64_t OsalGetSysTimeMs(void) { OsalTimespec time; diff --git a/adapter/khdf/linux/platform/fwk/platform_trace.c b/adapter/khdf/linux/platform/fwk/platform_trace.c index 5436a7ee830ed4abbb21e287d6489975c33d8418..047d97017905a4114fb52f11182ed2d1cd551a27 100644 --- a/adapter/khdf/linux/platform/fwk/platform_trace.c +++ b/adapter/khdf/linux/platform/fwk/platform_trace.c @@ -17,7 +17,12 @@ #include "osal_file.h" #include "osal_mem.h" #include "securec.h" +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) #include "stdarg.h" +#else +#include +#endif #include #include @@ -112,7 +117,9 @@ static ssize_t TraceFileWrite(OsalFile *file, const char *string, uint32_t lengt { ssize_t ret; loff_t pos; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t org_fs; +#endif struct file *fp = NULL; if (file == NULL || IS_ERR_OR_NULL(file->realFile) || string == NULL) { @@ -121,11 +128,15 @@ static ssize_t TraceFileWrite(OsalFile *file, const char *string, uint32_t lengt } fp = (struct file *)file->realFile; pos = fp->f_pos; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) org_fs = get_fs(); set_fs(KERNEL_DS); +#endif ret = vfs_write(fp, string, length, &pos); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(org_fs); +#endif if (ret < 0) { HDF_LOGE("TraceFileWrite: write file length %d fail, ret: %d!", length, ret); return HDF_FAILURE; @@ -137,7 +148,9 @@ static ssize_t TraceFileWrite(OsalFile *file, const char *string, uint32_t lengt static ssize_t TraceFileRead(OsalFile *file, char *buf, uint32_t length) { ssize_t ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t org_fs; +#endif loff_t pos; struct file *fp = NULL; @@ -146,12 +159,16 @@ static ssize_t TraceFileRead(OsalFile *file, char *buf, uint32_t length) return HDF_ERR_INVALID_PARAM; } fp = (struct file *)file->realFile; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) org_fs = get_fs(); set_fs(KERNEL_DS); +#endif pos = fp->f_pos; ret = vfs_read(fp, buf, length, &pos); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(org_fs); +#endif if (ret < 0) { HDF_LOGE("TraceFileRead: read file length %d fail, ret: %d!", length, ret); return HDF_FAILURE; diff --git a/adapter/khdf/linux/platform/spi/spi_adapter.c b/adapter/khdf/linux/platform/spi/spi_adapter.c index ba598a5d372a6a3a35dd5b49036e59474eac5fc8..7d8b11bd30b8cd2f0e83f334f363ce48a3358212 100644 --- a/adapter/khdf/linux/platform/spi/spi_adapter.c +++ b/adapter/khdf/linux/platform/spi/spi_adapter.c @@ -173,7 +173,12 @@ static int32_t SpiAdapterTransferOneMsg(struct SpiCntlr *cntlr, struct SpiMsg *m transfer->len = msg->len; transfer->speed_hz = msg->speed; transfer->cs_change = msg->keepCs; // yes! cs_change will keep the last cs active ... - transfer->delay_usecs = msg->delayUs; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + transfer->delay_usecs = msg->delayUs; +#else + transfer->delay.value = msg->delayUs; + transfer->delay.unit = SPI_DELAY_UNIT_USECS; +#endif spi_message_add_tail(transfer, &xfer); ret = spi_sync(dev->priv, &xfer); @@ -235,8 +240,15 @@ static int32_t SpiAdapterTransferDifferent(struct SpiCntlr *cntlr, struct SpiMsg transfer[i].speed_hz = msg[i].speed; if (msg[i].keepCs != 0) transfer[i].cs_change = msg[i].keepCs; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) if (msg[i].delayUs != 0) transfer[i].delay_usecs = msg[i].delayUs; +#else + if (msg[i].delayUs != 0) { + transfer[i].delay.value = msg[i].delayUs; + transfer[i].delay.unit = SPI_DELAY_UNIT_USECS; + } +#endif spi_message_add_tail(&transfer[i], &xfer); } diff --git a/adapter/khdf/linux/platform/uart/uart_adapter.c b/adapter/khdf/linux/platform/uart/uart_adapter.c index e8bac7820b35197d2d6ac5e951adebd3ad9bb754..89af4e0aaa9a4a6c7ab57950b8e5d2e8173140da 100644 --- a/adapter/khdf/linux/platform/uart/uart_adapter.c +++ b/adapter/khdf/linux/platform/uart/uart_adapter.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "device_resource_if.h" #include "hdf_base.h" #include "hdf_log.h" @@ -40,7 +41,9 @@ static int32_t UartAdapterInit(struct UartHost *host) { char name[UART_PATHNAME_LEN] = {0}; struct file *fp = NULL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t oldfs; +#endif if (host == NULL) { HDF_LOGE("UartAdapterInit: host is null!"); @@ -49,15 +52,21 @@ static int32_t UartAdapterInit(struct UartHost *host) if (sprintf_s(name, UART_PATHNAME_LEN - 1, "/dev/%s%d", g_driverName, host->num) < 0) { return HDF_FAILURE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) oldfs = get_fs(); set_fs(KERNEL_DS); +#endif fp = filp_open(name, O_RDWR | O_NOCTTY | O_NDELAY, 0600); /* 0600 : file mode */ if (IS_ERR(fp)) { HDF_LOGE("UartAdapterInit: filp_open %s fail!", name); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif return HDF_FAILURE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif host->priv = fp; return HDF_SUCCESS; } @@ -65,19 +74,26 @@ static int32_t UartAdapterInit(struct UartHost *host) static int32_t UartAdapterDeInit(struct UartHost *host) { struct file *fp = NULL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t oldfs; +#endif if (host == NULL) { HDF_LOGE("UartAdapterDeInit: host is null!"); return HDF_ERR_INVALID_OBJECT; } + fp = (struct file *)host->priv; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) oldfs = get_fs(); set_fs(KERNEL_DS); +#endif if (!IS_ERR(fp) && fp) { filp_close(fp, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif host->priv = NULL; return HDF_SUCCESS; } @@ -88,7 +104,9 @@ static int32_t UartAdapterRead(struct UartHost *host, uint8_t *data, uint32_t si int ret; struct file *fp = NULL; char *p = (char *)data; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t oldfs; +#endif uint32_t tmp = 0; if (host == NULL || host->priv == NULL || data == NULL || size == 0) { @@ -97,8 +115,10 @@ static int32_t UartAdapterRead(struct UartHost *host, uint8_t *data, uint32_t si } fp = (struct file *)host->priv; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) oldfs = get_fs(); set_fs(KERNEL_DS); +#endif while (size >= tmp) { ret = vfs_read(fp, p + tmp, 1, &pos); if (ret < 0) { @@ -107,7 +127,9 @@ static int32_t UartAdapterRead(struct UartHost *host, uint8_t *data, uint32_t si } tmp++; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif return tmp; } @@ -117,7 +139,9 @@ static int32_t UartAdapterWrite(struct UartHost *host, uint8_t *data, uint32_t s int ret; struct file *fp = NULL; char *p = (char *)data; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t oldfs; +#endif if (host == NULL || host->priv == NULL || data == NULL || size == 0) { HDF_LOGE("UartAdapterWrite: invalid parameters!"); @@ -125,33 +149,45 @@ static int32_t UartAdapterWrite(struct UartHost *host, uint8_t *data, uint32_t s } fp = (struct file *)host->priv; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) oldfs = get_fs(); set_fs(KERNEL_DS); +#endif ret = vfs_write(fp, p, size, &pos); if (ret < 0) { HDF_LOGE("UartAdapterWrite: vfs_write fail, ret: %d!", ret); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif return HDF_FAILURE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif return HDF_SUCCESS; } static int UartAdapterIoctlInner(struct file *fp, unsigned cmd, unsigned long arg) { int ret = HDF_FAILURE; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) mm_segment_t oldfs; +#endif if (fp == NULL) { HDF_LOGE("UartAdapterIoctlInner: fp is null!"); return HDF_FAILURE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) oldfs = get_fs(); set_fs(KERNEL_DS); +#endif if (fp->f_op->unlocked_ioctl != NULL) { ret = fp->f_op->unlocked_ioctl(fp, cmd, arg); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) set_fs(oldfs); +#endif return ret; } diff --git a/framework/model/display/driver/panel/ili9881_st_5p5.c b/framework/model/display/driver/panel/ili9881_st_5p5.c index 6ca69a7faec9e5d53da8a492b2cc9681d1200a44..6308670d3e7263461aebb8c6ef71f05a949e4ee8 100755 --- a/framework/model/display/driver/panel/ili9881_st_5p5.c +++ b/framework/model/display/driver/panel/ili9881_st_5p5.c @@ -6,6 +6,7 @@ * See the LICENSE file in the root of this repository for complete details. */ +#include #include "ili9881_st_5p5.h" #include "gpio_if.h" #include "hdf_bl.h" @@ -566,6 +567,11 @@ static int32_t PanelInit(struct PanelData *panel) #define MIN_LEVEL 0 #define MAX_LEVEL 255 #define DEFAULT_LEVEL 127 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0) +#ifndef MIPI_DSI_MODE_EOT_PACKET +#define MIPI_DSI_MODE_EOT_PACKET MIPI_DSI_MODE_NO_EOT_PACKET +#endif +#endif static struct PanelInfo g_panelInfo = { .width = 720, /* width */ diff --git a/framework/model/misc/vibrator/driver/src/vibrator_haptic.c b/framework/model/misc/vibrator/driver/src/vibrator_haptic.c index 6a486a6ad826cedb3e1cb0fe2301947698f542cc..9caff32ee9e2ae6b0d32ad693be31a8fba971185 100644 --- a/framework/model/misc/vibrator/driver/src/vibrator_haptic.c +++ b/framework/model/misc/vibrator/driver/src/vibrator_haptic.c @@ -324,7 +324,7 @@ int32_t StartHaptic(struct VibratorEffectCfg *effectCfg) return HDF_SUCCESS; } -int32_t StopHaptic() +int32_t StopHaptic(void) { int32_t ret; struct VibratorHapticData *hapticData = GetHapticData(); @@ -398,7 +398,7 @@ static void FreeHapticConfig(void) (void)OsalMutexUnlock(&hapticData->mutex); } -int32_t DestroyVibratorHaptic() +int32_t DestroyVibratorHaptic(void) { struct VibratorHapticData *hapticData = GetHapticData(); CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(hapticData, HDF_FAILURE); diff --git a/framework/support/platform/src/fwk/platform_device.c b/framework/support/platform/src/fwk/platform_device.c index 83641be59ad11edb693964ffc55afdffffdca874..f28f2e80c397f2f83bd4c5b15bdf5d0959c0820f 100644 --- a/framework/support/platform/src/fwk/platform_device.c +++ b/framework/support/platform/src/fwk/platform_device.c @@ -6,12 +6,17 @@ * See the LICENSE file in the root of this repository for complete details. */ +#include #include "platform_device.h" #include "hdf_log.h" #include "osal_mem.h" #include "platform_core.h" #include "securec.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) #include "stdarg.h" +#else +#include "linux/stdarg.h" +#endif #define PLATFORM_DEV_NAME_DEFAULT "platform_device" diff --git a/framework/test/unittest/platform/virtual/adc_linux_virtual_iio_driver.c b/framework/test/unittest/platform/virtual/adc_linux_virtual_iio_driver.c index 6b14e56ae2710c9d79947d56a748592ca9eb5150..2c8e3d7b922ea08c2888f636cbc7fadee0d82b14 100644 --- a/framework/test/unittest/platform/virtual/adc_linux_virtual_iio_driver.c +++ b/framework/test/unittest/platform/virtual/adc_linux_virtual_iio_driver.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "hdf_log.h" #include "hdf_base.h" @@ -144,6 +145,9 @@ static struct platform_device g_virtualAdcPlatformDevice = { static int VirtualAdcPlatformProbe(struct platform_device *pdev) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0) + static const unsigned long scanMasks[] = { SCAN_MASKS, 0x00 }; +#endif struct VirtualAdcDev *adcInfo = NULL; struct iio_dev *indioDev = NULL; int ret; @@ -156,11 +160,15 @@ static int VirtualAdcPlatformProbe(struct platform_device *pdev) adcInfo = iio_priv(indioDev); adcInfo->name = "virtual-adc-3516"; adcInfo->busNum = BUS_NUM; - + indioDev->name = KBUILD_MODNAME; indioDev->channels = AdcChannels; indioDev->num_channels = ARRAY_SIZE(AdcChannels); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) indioDev->available_scan_masks = SCAN_MASKS; +#else + indioDev->available_scan_masks = scanMasks; +#endif indioDev->info = &AdcIioInfo; indioDev->modes = INDIO_DIRECT_MODE;