frank-w / BPI-Router-Linux

Linux kernel 4.14+ for BPI-R2, 5.4+ for R64, 6.1+ for R2Pro and R3
Other
131 stars 46 forks source link

About the mainline linux kernel bluetooth and WiFi support for MediaTek #82

Closed alifilhan0 closed 1 year ago

alifilhan0 commented 3 years ago

I am really sorry to disturb with a bit of off topic issue. But I want to know how compatible is the mainline mediatek bluetooth driver a.k.a BTIF and btmtkuart/btmtksdio with the Banana Pi R2? is it usable at all? And what about the mainline WiFi support? The MT6625L is the RF frontend of the WiFi and bluetooth features right? Then there is an internal IP block for the BT/WiFi/ and whatnot on the board. How to get them working with mainline? Can you please point me to the right direction?

alifilhan0 commented 3 years ago

I think all the magic is here https://android.googlesource.com/platform/hardware/bsp/kernel/mediatek/mt8516-v4.4/+/refs/heads/nougat-iot-release/drivers/misc/mediatek/connectivity/common/common_main/platform/include/mt8167.h

A lot of device address definitions. I think this is worth a check, and maybe we can even modify it? If you think we need to modify it, then we need a good informal datahseet or we should look for these in the Mt7623 kernel tree. Maybe if a complete datasheet is needed, I might find a good one in one of the chinese sites I know about.....or is there already required similar files in the kernel tree?

frank-w commented 3 years ago

i guess adresses (at least in later kernel-versions) are defined in devicetree...maybe it's on of the first steps to read the values from DT instead of hardcode in headerfile

frank-w commented 3 years ago

one part looking needed is this:

drivers/misc/mediatek.bak/connectivity/common/conn_soc/mt7623/mtk_wcn_consys_hw.c:610: node = of_find_compatible_node(NULL, NULL, "mediatek,mt7623-consys");

in platform-folder this is hardcoded to mediatek,mt8167-consys

so basicly we need to replace platform folder with (a compatible version) of mt7623-folder or make parts configurable / change to mt7623

alifilhan0 commented 3 years ago

I think changing the device tree nodes should be tried. Did you see the registers and the address of the connsys node? Across the older CPUs, this is based on MT8167, consys ip is the same. It changed recently around the MT6797, when they first used a MIPS Img tech IP. So what I'm thinking is maybe just changing the registers and the address may help here? From the DT node

consys: consys@18070000 {

  | compatible = "mediatek,mt8167-consys";   | reg = <0 0x18070000 0 0x0200>, / CONN_MCU_CONFIG_BASE /   | <0 0x10000000 0 0x2000>; / TOPCKGEN_BASE /   | power-domains = <&scpsys MT8167_POWER_DOMAIN_CONN>;   | interrupts = <GIC_SPI 195 IRQ_TYPE_LEVEL_LOW>, / BGF_EINT /   | <GIC_SPI 197 IRQ_TYPE_LEVEL_LOW>; / WDT_EINT /   | resets = <&toprgu MT8167_TOPRGU_CONN_MCU_RST>;   | reset-names = "connsys";   | status = "disabled";   | };   |     | wifi@180f0000 {   | compatible = "mediatek,wifi";   | reg = <0 0x180f0000 0 0x005c>;   | interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_LOW>;   | clocks = <&topckgen CLK_TOP_APDMA>;   | clock-names = "wifi-dma";   | };

And from the mt8167.h file

/device tree mode/

  | #if CONFIG_OF   | struct CONSYS_BASE_ADDRESS {   | SIZE_T mcu_base;   | SIZE_T ap_rgu_base;   | SIZE_T topckgen_base;   | SIZE_T spm_base;   | };   |     | /TOPCKGEN_BASE/   | #define CONSYS_TOP_CLKCG_CLR_OFFSET 0x00000084   | #define CONSYS_TOP_CLKCG_SET_OFFSET 0x00000054   | #define CONSYS_WD_SYS_RST_OFFSET 0x00000018   | #define CONSYS_AP2CONN_OSC_EN_OFFSET 0x00001f00   | #define CONSYS_EMI_MAPPING_OFFSET 0x00001320   | /AP_RGU_BASE/   | #define CONSYS_CPU_SW_RST_OFFSET 0x00000018   | /SPM_BASE/   | #define CONSYS_PWRON_CONFG_EN_OFFSET 0x00000000   | #define CONSYS_TOP1_PWR_CTRL_OFFSET 0x00000280   | #define CONSYS_PWR_CONN_ACK_OFFSET 0x0000060c   | #define CONSYS_PWR_CONN_ACK_S_OFFSET 0x00000610   | /CONN_MCU_CONFIG_BASE/   | #define CONSYS_CHIP_ID_OFFSET 0x00000008   | #define CONSYS_ROM_RAM_DELSEL_OFFSET 0x00000114   | #define CONSYS_MCU_CFG_ACR_OFFSET 0x00000110   | #define CONSYS_CPUPCR_OFFSET 0x00000160   | #endif   | /AXI bus/   | #define CONSYS_TOPAXI_PROT_EN_OFFSET 0x1220   | #define CONSYS_TOPAXI_PROT_STA1_OFFSET 0x1228   |     | /tag start: connsys register base address (hard code, no use) /   | #define AP_RGU_BASE 0xF0007000   | #define TOPCKGEN_BASE 0xF0000000   | #define SPM_BASE 0xF0006000   | #define CONN_MCU_CONFIG_BASE 0xF8070000   | /GIC Interrupt ID

To me this part looks very interesting. If only I had a Bpi working board, I would have already off in trying, no matter how foolish it looked. According to this header file, even device tree mode and hard code mode header file is also defined in this header. Is there any possible option to use the desired device tree mode depicted here? I suspect this whole driver is being tried to be coded in hard code mode(i.e board file mode with include/mt-plat). I mean is it worth trying changing the registers and the address of the consys node? because the header file definition is based on that register it seems

alifilhan0 commented 3 years ago

Sorry, I meant changing the TOPCKGEN_BASE in the reg and the IRQs, and maybe the header file needs some changes, because I think the IP is just same with different address.

frank-w commented 3 years ago

added platform-file and header-file, but it seems not be used...tried to add some debug, but this is not shown...any idea?

i guess the mtXXXX.c should be more generic, right? it uses compatible (can be also a const) and different header-file (maybe matched by config-option MTK_PLATFORM)?

alifilhan0 commented 3 years ago

This is what I was going to say. If this doesn't work, I think we need to modify the makefiles or the headers in a different way I suppose? Did you change the other files to include the header? And yes, my bad, I thought of modifying the header file because I thought the MT7623 kernel doesn't have one. But apparently it seems you have both of them

frank-w commented 3 years ago

I thought this is done here

https://github.com/frank-w/BPI-R2-4.14/blob/4.4-mt6625/drivers/misc/mediatek/connectivity/common/common_main/platform/Makefile#L27

And as i set Config_mtk_platform to mt7623 is should use my new file (and should be broken before) i tried adding debugs...but i do not see them.in other branch i used info

https://github.com/frank-w/BPI-R2-4.14/blob/5.10-main/drivers/misc/mediatek/Makefile#L16

MTK_PLATFORM is empty in this makefile

changed to info and see this:

Platform-Makefile
y
plat:
use alps.o

traced back and only in misc/mediatek makefile it is available (where it was set from CONFIG_MTK_PLATFORM)

MTK_PLATFORM := $(subst ",,$(CONFIG_MTK_PLATFORM))

alifilhan0 commented 3 years ago

So what is the final result, does the driver compile? The mediatek makefiles are very disorganized sometimes, at first, used to remove the MTPLATFROM or MTK***** variables and wrote the full filenames instead. For example, I would have started by directly putting MT7623 in the makefile removing the variable MTK_PLATFORM. So how's it going? I am thinking for the PMIC, since I am done adding LDOs, I would use the MT6360 charger driver since the IP is the same with MT6328. Which PMIC does this board have and does this board support charging and battery power too?

frank-w commented 3 years ago

Driver compiles,but does not use platform-folder

I remember i had similar issue in old/ported driver.

Imho we need to pass mtk_platform through all makefiles or do the subst in each makefile using it

have added this to the drivers/misc/mediatek/connectivity/common/common_main/platform/Makefile

MTK_PLATFORM := $(subst ",,$(CONFIG_MTK_PLATFORM))

$(info $(CONFIG_MTK_COMBO))
$(info plat:$(MTK_PLATFORM))
$(info combo:$(CONFIG_MTK_COMBO_CHIP))

$(MTK_PLATFORM).o is only built if CONFIG_MTK_COMBOCHIP is set to CONSYS* but currently it is set to MT6620

plat:mt7623
combo:"MT6620"

maybe the combo-setting is wrong here...there is a MTK_COMBO_CHIP_CONSYS_8167, but (of course no MTK_COMBO_CHIP_CONSYS_7623)...i'm not sure it is right to add it to use the new files in platform-folder

now i hang on missing files in include-dir

./drivers/misc/mediatek/include/mt-plat/mt8167/include/mach/upmu_sw.h

this is also needed for mt7623, seems pmic-related...as MT6392PMIC* consts are used...for mt7623 i guess we need to use MT6323, but these do not exist...MT6392 are defined in ./drivers/misc/mediatek/include/mt-plat/mt8167/include/mach/upmu_hw.h

alifilhan0 commented 3 years ago

Sometimes mediatek kernels have absurdly named files but they contain the right thing you need. Moreover, it's hardware blocks are similar, so it is worth trying with different settings. For the combo chip setting, it is set to MT6620 but the real combo chip is actually MT6630, though MT66xx are supported by this driver. And yes, this driver is also somewhat compiled into a devicetree and board file style, so it needs the include/mt-plat files. I will try to compile this kernel's required files and tell you right ahead

alifilhan0 commented 3 years ago

Okay I tried and got this error

This was my config, did I chose anything wrong? I don't understand after I place these config optios, they turn into big and bold text. Can you tell me how do you add code snippets in your comments/messages? `# Modem & Connectivity related configs #

CONFIG_MTK_BTIF is not set

CONFIG_MTK_COMBO=y

CONFIG_MTK_COMBO_CHIP_MT6620 is not set

CONFIG_MTK_COMBO_CHIP_MT6628 is not set

CONFIG_MTK_COMBO_CHIP_MT6630 is not set

CONFIG_MTK_COMBO_CHIP_MT6632 is not set

CONFIG_MTK_COMBO_CHIP_CONSYS_6757 is not set

CONFIG_MTK_COMBO_CHIP_CONSYS_8167 is not set

CONFIG_MTK_COMBO_CHIP_CONSYS_7623=y CONFIG_MTK_COMBO_CHIP="CONSYS_7623" CONFIG_MTK_COMBO_PLAT_PATH="" CONFIG_MTK_COMBO_COMM=y CONFIG_MTK_COMBO_COMM_UART=y CONFIG_MTK_COMBO_COMM_SDIO=y CONFIG_MTK_COMBO_COMM_NPWR=y CONFIG_MTK_COMBO_COMM_APO=y CONFIG_MTK_COMBO_BT=y CONFIG_MTK_COMBO_ANT=y CONFIG_MTK_COMBO_GPS=y CONFIG_MTK_COMBO_WIFI=y

CONFIG_MTK_WAPI_SUPPORT is not set

CONFIG_MTK_PASSPOINT_R1_SUPPORT=y CONFIG_MTK_PASSPOINT_R2_SUPPORT=y CONFIG_MTK_WIFI_MCC_SUPPORT=y

CONFIG_MTK_DHCPV6C_WIFI is not set

CONFIG_MTK_CONN_LTE_IDC_SUPPORT is not set

CONFIG_GPS is not set

CONFIG_MTK_GPS_SUPPORT is not set

CONFIG_MTK_GPS_REGISTER_SETTING is not set

CONFIG_MTK_GPS_EMI is not set

CONFIG_MTK_FMRADIO is not set

CONFIG_MTK_MERGE_INTERFACE_SUPPORT is not set

CONFIG_MTK_CONN_MT3337_CHIP_SUPPORT is not set

CONFIG_MTK_VOLTE_SUPPORT is not set

CONFIG_MTK_EPDG_SUPPORT is not set`

And I also get this error when I save a configuration `[home-amd@home-desktop BPI-R2-4.14-4.4-mt6625]$ make ARCH=arm menuconfig scripts/kconfig/mconf Kconfig warning: (MTK_COMBO_WIFI && GELIC_WIRELESS && PCMCIA_RAYCS && AIRO && ATMEL && PCMCIA_ATMEL && AIRO_CS && PCMCIA_WL3501 && PRISM54 && USB_ZD1201 && HOSTAP && IPW2100 && IPW2200 && LIBIPW && LIBERTAS && HERMES && PRISM2_USB && RTL8192U && R8712U && R8188EU && R8723AU && RTL8192E) selects WIRELESS_EXT which has unmet direct dependencies (NET && WIRELESS) warning: (MTK_COMBO_WIFI && PCMCIA_RAYCS && AIRO && ATMEL && AIRO_CS && PRISM54 && USB_ZD1201 && HOSTAP && IPW2100 && IPW2200 && HERMES && PRISM2_USB && RTL8192U && R8712U && R8188EU && R8723AU && RTL8192E) selects WEXT_PRIV which has unmet direct dependencies (NET && WIRELESS) warning: (MTK_COMBO_WIFI && PCMCIA_RAYCS && AIRO && ATMEL && AIRO_CS && PRISM54 && USB_ZD1201 && HOSTAP && IPW2100 && IPW2200 && HERMES && PRISM2_USB && RTL8192U && R8712U && R8188EU && R8723AU && RTL8192E) selects WEXT_PRIV which has unmet direct dependencies (NET && WIRELESS) configuration written to .config

End of the configuration. Execute 'make' to start the build or try 'make help'. `

frank-w commented 3 years ago

CONFIG_MTK_COMBO_CHIP_CONSYS_7623

Does not work yet...if you compile with my defconfig (see build.sh) compile should work and uses mt6620 without consys

I have only prepared kconfig to make use of platform folder,but it needs additional files

CONFIG_MTK_COMBO_CHIP_CONSYS_8167 should include platform too for supported chip for first test

alifilhan0 commented 3 years ago

Yes, I suppose. It built fine but no activity on the common/ directory. Moreover, no errors. so, how about renaming the two mt7623 files into 8167 and removing the old ones and testing on router? I mean at this point isn't it more important to test the driver than compile with MT7623 setting?

alifilhan0 commented 3 years ago

Finally I get something meaningful, after choosing CONFIG_MTK_COMBO_CHIP_CONSYS_8167. However it looks for conn-drv_init.h and doesn't find it. Also the kernel is full of strange errors, and warnings I don't understad why? Is it because my GCC is 11 and I used kernel headers 5.12.9? Should I build a gcc with this kernel's headers?

DTC arch/arm/boot/dts/mt7623n-bpi-r2.dtb crypto/xts.c:337:13: error: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Werror=builtin-declaration-mismatch] 337 | static void free(struct crypto_instance *inst) | ^~~~ crypto/xts.c:27:1: note: ‘free’ is declared in header ‘<stdlib.h>’ 26 | #include <crypto/gf128mul.h> +++ |+#include <stdlib.h> 27 | In file included from arch/arm/boot/dts/mt7623n-bpi-r2.dts:16: arch/arm/boot/dts/mt7623.dtsi:15:10: fatal error: dt-bindings/interrupt-controller/irq.h: No such file or directory 15 | #include <dt-bindings/interrupt-controller/irq.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [scripts/Makefile.lib:293: arch/arm/boot/dts/mt7623n-bpi-r2.dtb] Error 1 make: *** [arch/arm/Makefile:340: dtbs] Error 2 make: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[1]: *** [scripts/Makefile.build:277: crypto/xts.o] Error 1 make[1]: *** Waiting for unfinished jobs.... CHK kernel/config_data.h make: *** [Makefile:993: crypto] Error 2 misc-mtk_plat:mt7623 connectivity_plat: common_plat: CC [M] drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.o common_main/Makefile common-main_plat:mt7623 CC [M] drivers/misc/mediatek/connectivity/common/common_detect/sdio_detect.o make[6]: *** No rule to make target 'drivers/misc/mediatek/connectivity/common/common_main/linux/pri/wmt_dev.o', needed by 'drivers/misc/mediatek/connectivity/common/common_main/mtk_stp_wmt_soc.o'. Stop. make[5]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/common/common_main] Error 2 make[5]: *** Waiting for unfinished jobs.... CC drivers/perf/arm_pmu.o CC [M] drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.o CC drivers/phy/phy-core.o CC drivers/pinctrl/core.o CC drivers/phy/phy-mt65xx-usb3.o CC drivers/pinctrl/pinctrl-utils.o drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c:27:10: fatal error: conn_drv_init.h: No such file or directory 27 | #include "conn_drv_init.h" | ^~~~~~~~~~~~~~~~~ compilation terminated. make[6]: *** [scripts/Makefile.build:277: drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.o] Error 1 make[6]: *** Waiting for unfinished jobs.... drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c: In function ‘nicRxProcessEventPacket’: drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c:1223:51: error: array subscript ‘struct _BOW_LINK_CONNECTED[0]’ is partly outside array bounds of ‘UINT_8[12]’ {aka ‘unsigned char[12]’} [-Werror=array-bounds] 1223 | prBowLinkConnected->rChannel.ucChannelNum = prEventBtOverWifi->ucSelectedChannel; | ^~ drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c:1204:32: note: while referencing ‘aucTmp’ 1204 | UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)]; | ^~~~~~ make[5]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/common/common_detect] Error 2 make[4]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/common] Error 2 make[4]: *** Waiting for unfinished jobs.... LD drivers/pps/clients/built-in.o CC drivers/power/power_supply_core.o LD drivers/pps/generators/built-in.o CC [M] drivers/pps/pps.o cc1: all warnings being treated as errors make[6]: *** [scripts/Makefile.build:277: drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.o] Error 1 make[5]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/wlan/gen2] Error 2 make[4]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/wlan] Error 2 make[3]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity] Error 2 make[2]: *** [scripts/Makefile.build:484: drivers/misc/mediatek] Error 2 make[1]: *** [scripts/Makefile.build:484: drivers/misc] Error

frank-w commented 3 years ago

I test only with my current defconfig and gcc 9.3

If changing anything it may break,consys_mt8167 is NEXT step we need to check if driver is compilable with this setting before adding mt7623 support to this folder (i've copied come mt8167 files,but not changed much,only compatible and chipid)

You are still on branch 4.4-mt6625l?

alifilhan0 commented 3 years ago

Yeah, and the errors are related directly to headers and libc of the GCC11. So I built gcc again with 4.4 headers and tested, the kernel compiles but with those errors. It has also some dtc errors which I fixed but aftsr that, still missing headers. By the way, which kernel version are you using at this moment? Or which should I try with?

frank-w commented 3 years ago

I use precompiled linaro toolchain from ubuntu 20.4 and distribution kernel.

alifilhan0 commented 3 years ago

No, I meant which kernel version are you using at this moment? Since you asked about 4.4, are you still using it or a newer version?

frank-w commented 3 years ago

You mean ON r2 (not on host for building). I use 5.10.32 from my hnat branch on my mainrouter

alifilhan0 commented 3 years ago

Oh okay. So for the gcc errors, I don't understand....these gcc errors don't look normal. And they are too many to be shared, mostly warnings and notes. Finally I could build on the connectivity directory with make -M, and the file indeed built without errors, but the platform folder is untouched. Should I try modifying the makefiles differently?

frank-w commented 3 years ago

I remember the drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c error i had on gcc8...maybe it is introduced in gcc11.

https://github.com/frank-w/BPI-R2-4.14/commit/f4e54fb1f8a26a1337f5e3eed1266855faa5dad1#diff-7ee30e1acdc394cf4aab93c15a44676d2c92810967ea62e4bb0f37f69e137ee0

File upload here is possible too with the image button...but please only stderr

alifilhan0 commented 3 years ago

As for now, I removed variable MTK_PLATFORM and directly wrote mt7623 so that is just builds compulsorily. I even removed the condition ifeq(CONFIG_MTK_COMBO,y) so that it is forced to compile. But now I find that this directory is never even touched! I thought it wasn't accessed because of the previous compilation errors, but there is something we aren't getting right.

[home-amd@home-desktop BPI-R2-4.14-4.4-mt6625]$ make ARCH=arm -j12 CROSS_COMPILE=arm-linux-gnueabihf- CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CHK scripts/mod/devicetable-offsets.h make[1]: 'include/generated/mach-types.h' is up to date. CHK include/generated/timeconst.h CHK include/generated/bounds.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h CC crypto/xts.o CC crypto/gcm.o CHK kernel/config_data.h crypto/xts.c:337:13: error: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Werror=builtin-declaration-mismatch] 337 | static void free(struct crypto_instance *inst) | ^~~~ crypto/xts.c:27:1: note: ‘free’ is declared in header ‘<stdlib.h>’ 26 | #include <crypto/gf128mul.h> +++ |+#include <stdlib.h> 27 | cc1: all warnings being treated as errors make[1]: *** [scripts/Makefile.build:277: crypto/xts.o] Error 1 make[1]: *** Waiting for unfinished jobs.... DTC arch/arm/boot/dts/mt7623n-bpi-r2.dtb In file included from arch/arm/boot/dts/mt7623n-bpi-r2.dts:16: arch/arm/boot/dts/mt7623.dtsi:15:10: fatal error: dt-bindings/interrupt-controller/irq.h: No such file or directory 15 | #include <dt-bindings/interrupt-controller/irq.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [scripts/Makefile.lib:293: arch/arm/boot/dts/mt7623n-bpi-r2.dtb] Error 1 make: *** [arch/arm/Makefile:340: dtbs] Error 2 make: *** Waiting for unfinished jobs.... make: *** [Makefile:993: crypto] Error 2 misc-mtk_plat:mt7623 connectivity_plat: common_plat: common_main/Makefile common-main_plat:mt7623 LD drivers/misc/mediatek/connectivity/common/common_detect/built-in.o CC [M] drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.o CC [M] drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.o drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c:27:10: fatal error: conn_drv_init.h: No such file or directory 27 | #include "conn_drv_init.h" | ^~~~~~~~~~~~~~~~~ compilation terminated. make[6]: *** [scripts/Makefile.build:277: drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.o] Error 1 make[5]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/common/common_detect] Error 2 make[5]: *** Waiting for unfinished jobs.... drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c: In function ‘nicRxProcessEventPacket’: drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c:1223:51: error: array subscript ‘struct _BOW_LINK_CONNECTED[0]’ is partly outside array bounds of ‘UINT_8[12]’ {aka ‘unsigned char[12]’} [-Werror=array-bounds] 1223 | prBowLinkConnected->rChannel.ucChannelNum = prEventBtOverWifi->ucSelectedChannel; | ^~ drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c:1204:32: note: while referencing ‘aucTmp’ 1204 | UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)]; | ^~~~~~ CC [M] drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_pwr_mgt.o cc1: all warnings being treated as errors make[6]: *** [scripts/Makefile.build:277: drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.o] Error 1 make[6]: *** Waiting for unfinished jobs.... CC drivers/ras/ras.o CC [M] drivers/misc/mediatek/connectivity/common/common_main/core/wmt_core.o CC [M] drivers/misc/mediatek/connectivity/common/common_main/core/wmt_lib.o CC drivers/video/hdmi.o CC drivers/scsi/scsi_sysfs.o LD drivers/usb/common/usb-common.o LD drivers/usb/common/built-in.o CC drivers/video/console/dummycon.o CC drivers/video/console/fbcon.o CC drivers/tty/n_tty.o CC drivers/video/console/bitblit.o LD drivers/usb/gadget/function/built-in.o CC [M] drivers/usb/gadget/function/f_acm.o CC drivers/video/console/softcursor.o CC drivers/usb/core/hub.o CC drivers/usb/core/hcd.o CC drivers/scsi/scsi_devinfo.o CC drivers/scsi/scsi_sysctl.o CC drivers/video/console/tileblit.o CC [M] drivers/usb/gadget/function/u_serial.o CC drivers/scsi/scsi_proc.o make[6]: *** No rule to make target 'drivers/misc/mediatek/connectivity/common/common_main/linux/pri/wmt_dev.o', needed by 'drivers/misc/mediatek/connectivity/common/common_main/mtk_stp_wmt_soc.o'. Stop. make[6]: *** Waiting for unfinished jobs.... CC [M] drivers/misc/mediatek/connectivity/common/common_main/core/wmt_conf.o

frank-w commented 3 years ago

Which dir do you mean?

mt7623 folder (folder from old driver) is not yet used as i get many errors on building,platform should be used,but the mtxxxx.c file is only build if CONFIG_MTK_COMBOCHIP contains CONSYS

https://github.com/frank-w/BPI-R2-4.14/blob/4.4-mt6625/drivers/misc/mediatek/connectivity/common/common_main/platform/Makefile#L30

Could you try using my build.sh (params importconfig and build) to test your setup/gcc? I guess you miss any option

alifilhan0 commented 3 years ago

Note that I didn't remove any line, just uncommented it. And I haven't pasted the whole makefile because this isn't possible. This is my makefile for drivers/misc/mediatek/connectivity/common/common_main

`ifeq ($(CONFIG_ARCH_MT6580), y) subdir-ccflags-y += -D CFG_WMT_READ_EFUSE_VCN33 endif

ifeq ($(CONFIG_MTK_COMBO), m)

WMT DRIVER

obj-$(CONFIG_MTK_COMBO) += mtk_stp_wmt$(EXT_FLAG).o

WMT DRIVER-core part

mtk_stp_wmt$(EXT_FLAG)-objs := core/wmt_core.o core/wmt_ctrl.o core/wmt_func.o core/wmt_ic_soc.o core/wmt_lib.o core/wmt_conf.o

WMT DRIVER-linux private part

mtk_stp_wmt$(EXT_FLAG)-objs += linux/pri/wmt_dev.o linux/pri/wmt_exp.o mtk_stp_wmt$(EXT_FLAG)-objs += linux/pri/stp_btif.o

WMT DRIVER-OSAL

mtk_stp_wmt$(EXT_FLAG)-objs += linux/pub/osal.o linux/pub/bgw_desense.o

WMT DRIVER-platform implementation

mtk_stp_wmt$(EXT_FLAG)-objs += platform/alps/wmt_plat_alps.o

mtk_stp_wmt$(EXT_FLAG)-objs += platform/alps/mtk_wcn_consys_hw.o

mtk_stp_wmt$(EXT_FLAG)-objs += linux/pri/stp_exp.o core/stp_core.o core/psm_core.o core/btm_core.o linux/pri/stp_dbg.o

WMT stub part (built-in kernel image)

obj-y += platform/alps/mtk_wcn_consys_stub_alps.o

endif

ifeq ($(CONFIG_MTK_COMBO), y)

obj-y += core/ obj-y += linux/ obj-y += platform/

obj-y += mt7623/

endif`

And this is for the drivers/misc/mediatek/common/common _main/platform

`PLAT := alps

ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)

$(info use mt7623.o) obj-y += mt7623.o

endif

$(info use $(PLAT).o)

obj-y += wmt_plat_alps.o

obj-y += wmt_plat_stub.o

obj-y += mtk_wcn_cmb_hw.o obj-y += mtk_wcn_consys_hw.o

endif`

I know this is not a good and practical way to use it like this but I just wanted to see what happens when we get there. But I failed too

frank-w commented 3 years ago

mhm, currently i get build-error too..

./drivers/misc/mediatek/include/mt-plat/upmu_common.h:18:10: fatal error: mach/upmu_sw.h: No such file or directory
   18 | #include <mach/upmu_sw.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

it seems my new Kconfig-entry is set by default

MTK_COMBO_CHIP [=CONSYS_7623]

i wonder why i had compiled before adding the mt7623_consys to kconfig....defconfig still

alifilhan0 commented 3 years ago

So what's the conclusion? Is it because the compilation gets terminated even before it reaches the platform directory? Should i try now to make the whole connectivity directory into a module and see if that reaches the platform file? And by the way, the compilation in my case is terminated by that UNIT_8 error and the irq.h file in the mt7623 dts. <dt-bindings/interrupt-controller/irq.h no such file or directory. I am using the new GCC 11 built with 4.4 kernel headers and it still gives warnings but I ignore them.

frank-w commented 3 years ago

sorry CONFIG_MTK_COMBO_CHIP_CONSYS_7623=y was already present in defconfig...at the time i added kconfig-option it was set ;)

if i change MTK_COMBO_CHIP to MT6620 i can compile, but get linking-errors, but i don't know why yet

undefined reference to `g_IsNeedDoChipReset'

in drivers/misc/mediatek/connectivity/wlan/wmt_chrdev_wifi.c

it is because i had hardcoded gen2 before...

--- a/drivers/misc/mediatek/connectivity/wlan/Makefile
+++ b/drivers/misc/mediatek/connectivity/wlan/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_MTK_COMBO_WIFI) += wmt_chrdev_wifi.o
 #########################################################
 # WLAN driver

-#      obj-y   +=  gen2/
+obj-y   +=  gen2/

 ifneq ($(filter "MT6630",$(CONFIG_MTK_COMBO_CHIP)),)
        obj-y   +=  gen3/

as for the UINT8-Error, you could try the gcc8-fix i've linked, it seems that gcc9.3 does not report it...in "new" driver code it is not yet applied

for dtc: i have a include/dt-bindings/interrupt-controller/irq.h, so i guess your dtc is missing the include-folder

i have an actual arch/arm/boot/dts/mt7623n-bpi-r2.dtb from my last build

alifilhan0 commented 3 years ago

I fixed the irq.h error by first removing the dt-bingings and then linking the include/dt-bindings again in the folder, now the dtb compiles fine. Here I am stuck presently, I don't understand this message though and after choosing combo chip 6620, the UNIT8 errors vanished, but that maybe just because the compilation was terminated before it could go there.

DTC arch/arm/boot/dts/mt7623n-bpi-r2.dtb misc-mtk_plat:mt7623 connectivity_plat: common_plat: common_main/Makefile common-main_plat:mt7623 make[6]: *** No rule to make target 'drivers/misc/mediatek/connectivity/common/common_main/linux/pri/wmt_dev.o', needed by 'drivers/misc/mediatek/connectivity/common/common_main/mtk_stp_wmt_soc.o'. Stop. make[5]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/common/common_main] Error 2 make[5]: *** Waiting for unfinished jobs.... make[4]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity/common] Error 2 make[3]: *** [scripts/Makefile.build:484: drivers/misc/mediatek/connectivity] Error 2 make[2]: *** [scripts/Makefile.build:484: drivers/misc/mediatek] Error 2 make[1]: *** [scripts/Makefile.build:484: drivers/misc] Error 2 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:993: drivers] Error 2

frank-w commented 3 years ago

i have no directory drivers/misc/mediatek/connectivity/common/common_main/linux/pri/ (and no other pri-folder in the driver)

drivers/misc/mediatek/connectivity/common/common_main/linux/wmt_dev.o exists

but i see this in common_main-Makefile:

EXT_FLAG=_soc ... mtk_stp_wmt$(EXT_FLAG)-objs += linux/pri/wmt_dev.o linux/pri/wmt_exp.o

which should be without "/pri"

uploaded my current state (compilable with my gcc9.3 and build.sh)

alifilhan0 commented 3 years ago

I immediately noticed it after I commented, and then after the fix UNIT8 errors are back again.

frank-w commented 3 years ago

for dtb-error (irq.h) maybe you miss this?

$ ls -l arch/arm/boot/dts/include
insgesamt 0
lrwxrwxrwx 1 frank frank 34 Jun 11 15:55 dt-bindings -> ../../../../../include/dt-bindings

include is a folder in dts

for uint8-error you can try apply the gcc8-fix i've linked above to the new codebase

alifilhan0 commented 3 years ago

No, I fixed it already, it works fine after removing the file dt-bindings from dts/include and then linking the header file dt-bindings directory again in the include dir inside the device tree containing folder

And yes, I am applying your fixes

frank-w commented 3 years ago

Some of the defines:

https://github.com/BPI-SINOVOIP/BPI-R2-bsp-4.14/blob/master/linux-mt/drivers/misc/mediatek/connectivity/common/conn_soc/mt7623/include/mtk_wcn_consys_hw.h

Maybe we should use mt7623 parts from this as it looks in better shape as 4.4

And this repo has subfolders pub and priv which are simply included

https://github.com/BPI-SINOVOIP/BPI-R2-bsp-4.14/blob/master/linux-mt/drivers/misc/mediatek/connectivity/common/conn_soc/linux/Makefile

frank-w commented 3 years ago

i have tried to add mt6323 pmic-constants, but many of them used in the upmu_{h,s}w.h do not exist...as i have working driver and this binds to much of my limited time, i stop here

alifilhan0 commented 3 years ago

Okay then, I will kwwp working on this, thanks for trying.

frank-w commented 3 years ago

Please notify me (maybe fork and create pull-request) if you make progress. I try to use vendor 4.14 for wifi-client mode (is reported to be working in bpi-forum)

frank-w commented 3 years ago

Btw. I added vendors 4.14 code to my repo (4.14-mt6625) and tried wifi client...this works..ap mode too,but it is reported by vendor that bt is not working...but i try to compare this driver with my 4.14-main to figure out why my client mode is not working (reported,not tried...so i try same steps with my kernel first)

It looks like the wifi-driver is based on my ported code as i see debug messages i've added (and later disabled)...these disabled debugs is largest part in diff

Diff looks pretty small and it looks like wifi-client fix is in drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_fsm.c

https://github.com/frank-w/BPI-R2-4.14/commit/5042bbd1c648fdf19e419539192e2a21fd4eba46

alifilhan0 commented 3 years ago

And can you also try to see why BT/BLE doesn't work?

frank-w commented 3 years ago

Wifi-client works with my 5.10...

Bt works because we disabled automatic init, compiled bt as module and loaded after core init is done (after firmware load)

But i have no idea how to track btle

alifilhan0 commented 3 years ago

You can leave BTLE out of the topic, no one will even notice, since it is compatible with BT. For my vendor code, I directly added them to my kernel tree in 5.12.9, without any testing in the old kernel and voila! It actually reaches there and shows some errors. Though these codes are modem related and not entirely related to the connectivity part. I will try with connectivity this evening.

In file included from drivers/misc/mediatek/c2k_usb/f_rawbulk.c:23: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 | wakeup_source_init(&lock->ws, name); | ^~~~~~ | wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 | wakeup_source_trash(&lock->ws); | ^~~~~~~ | wakeup_source_add In file included from drivers/misc/mediatek/c2k_usb/rawbulk.c:37: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 | wakeup_source_init(&lock->ws, name); | ^~~~~~ | wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 | wakeup_source_trash(&lock->ws); | ^~~~~~~ | wakeup_source_add AR drivers/firmware/smccc/built-in.a CC drivers/clocksource/arm_arch_timer.o AR drivers/firmware/tegra/built-in.a In file included from drivers/misc/mediatek/c2k_usb/viatel_rawbulk.h:25, from drivers/misc/mediatek/c2k_usb/rawbulk_transfer.c:48: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 | wakeup_source_init(&lock->ws, name); | ^~~~~~ | wakeup_source_add CC drivers/clocksource/dummy_timer.o ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 | wakeup_source_trash(&lock->ws); | ^~~~~~~ | wakeup_source_add cc1: all warnings being treated as errors AR drivers/firmware/xilinx/built-in.a make[4]: [scripts/Makefile.build:271: drivers/misc/mediatek/c2k_usb/f_rawbulk.o] Error 1 make[4]: Waiting for unfinished jobs.... CC drivers/hid/i2c-hid/i2c-hid-of.o CC drivers/hid/hid-input.o CC drivers/of/base.o cc1: all warnings being treated as errors make[4]: [scripts/Makefile.build:271: drivers/misc/mediatek/c2k_usb/rawbulk.o] Error 1 CC drivers/of/device.o CC drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.o CC drivers/of/platform.o AR drivers/firmware/psci/built-in.a AR drivers/firmware/built-in.a CC drivers/misc/mediatek/ccci_util/ccci_util_lib_load_img.o AR drivers/platform/built-in.a CC drivers/of/property.o cc1: all warnings being treated as errors make[4]: [scripts/Makefile.build:271: drivers/misc/mediatek/c2k_usb/rawbulk_transfer.o] Error 1 make[3]: [scripts/Makefile.build:514: drivers/misc/mediatek/c2k_usb] Error 2 make[3]: Waiting for unfinished jobs.... CC drivers/remoteproc/remoteproc_core.o AR drivers/hid/i2c-hid/built-in.a CC drivers/remoteproc/remoteproc_coredump.o drivers/misc/mediatek/ccci_util/ccci_util_lib_load_img.c:97:10: fatal error: ../board_id/board_id.h: No such file or directory 97 | #include "../board_id/board_id.h" | ^~~~~~~~ compilation terminated. make[4]: [scripts/Makefile.build:271: drivers/misc/mediatek/ccci_util/ccci_util_lib_load_img.o] Error 1 make[4]: Waiting for unfinished jobs.... CC drivers/hid/hid-quirks.o CC drivers/remoteproc/remoteproc_debugfs.o CC drivers/hid/hid-debug.o drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.c: In function ‘lk_info_parsing_v1’: drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.c:838:27: error: implicit declaration of function ‘ioremap_nocache’; did you mean ‘ioremap_cache’? [-Werror=implicit-function-declaration] 838 | s_g_lk_inf_base = ioremap_nocache((phys_addr_t)lk_inf.lk_info_base_addr, MAX_LK_INFO_SIZE); | ^~~~~~~ | ioremap_cache drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.c:838:25: error: assignment to ‘void ’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion] 838 | s_g_lk_inf_base = ioremap_nocache((phys_addr_t)lk_inf.lk_info_base_addr, MAX_LK_INFO_SIZE); | ^ drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.c: In function ‘lk_info_parsing_v2’: drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.c:883:25: error: assignment to ‘void ’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion] 883 | s_g_lk_inf_base = ioremap_nocache((phys_addr_t)lk_inf.lk_info_base_addr, MAX_LK_INFO_SIZE); | ^ AR drivers/clocksource/built-in.a CC drivers/devfreq/devfreq.o CC drivers/devfreq/governor_simpleondemand.o cc1: all warnings being treated as errors make[4]: [scripts/Makefile.build:271: drivers/misc/mediatek/ccci_util/ccci_util_lib_fo.o] Error 1 make[3]: [scripts/Makefile.build:514: drivers/misc/mediatek/ccci_util] Error 2 make[2]: [scripts/Makefile.build:514: drivers/misc/mediatek] Error 2 make[1]: [scripts/Makefile.build:514: drivers/misc] Error 2

alifilhan0 commented 3 years ago

I didn't wait for evening and completely disabled all modem related code to focus here. And these are the errors, maybe some progress from yesterday's deadlock situation?

In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:46: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:35: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c: In function ‘osal_thread_show_stack’: drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:318:16: error: implicit declaration of function ‘show_stack’ [-Werror=implicit-function-declaration] 318 return show_stack(pThread->pThread, NULL); ^~~~~~ drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:318:16: error: ‘return’ with a value, in function returning void [-Werror=return-type] 318 return show_stack(pThread->pThread, NULL); ^~~~~~~~~~ drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:316:6: note: declared here 316 VOID osal_thread_show_stack(P_OSAL_THREAD pThread) ^~~~~~ drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c: In function ‘osal_timer_create’: drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:626:9: error: implicit declaration of function ‘init_timer’; did you mean ‘init_timers’? [-Werror=implicit-function-declaration] 626 init_timer(timer); ^~~~~~ init_timers drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:627:25: error: assignment to ‘void ()(struct timer_list )’ from incompatible pointer type ‘P_TIMEOUT_HANDLER’ {aka ‘void (*)(long unsigned int)’} [-Werror=incompatible-pointer-types] 627 timer->function = pTimer->timeoutHandler; ^ drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:628:14: error: ‘struct timer_list’ has no member named ‘data’ 628 timer->data = (ULONG)pTimer->timeroutHandlerData; ^~ drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c: In function ‘osal_gettimeofday’: drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:1176:24: error: storage size of ‘now’ isn’t known 1176 struct timeval now; ^~~ drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:1178:9: error: implicit declaration of function ‘do_gettimeofday’; did you mean ‘do_settimeofday64’? [-Werror=implicit-function-declaration] 1178 do_gettimeofday(&now); ^~~~~~~ do_settimeofday64 drivers/misc/mediatek/connectivity/common/common_main/linux/osal.c:1176:24: error: unused variable ‘now’ [-Werror=unused-variable] 1176 struct timeval now; ^~~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c: At top level: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:184:15: error: variable ‘old’ has initializer but incomplete type 184 static struct timeval old = {0}; ^~~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:184:30: error: excess elements in struct initializer [-Werror] 184 static struct timeval old = {0}; ^ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:184:30: note: (near initialization for ‘old’) cc1: all warnings being treated as errors make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/linux/osal.o] Error 1 make[7]: Waiting for unfinished jobs.... drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c: In function ‘stp_sdio_tx_wkr’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:1809:24: error: storage size of ‘now’ isn’t known 1809 struct timeval now; ^~~ CC drivers/misc/mediatek/connectivity/common/common_detect/sdio_detect.o In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_main/include/stp_exp.h:23, from drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c:41: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:1943:25: error: implicit declaration of function ‘do_gettimeofday’; did you mean ‘do_settimeofday64’? [-Werror=implicit-function-declaration] 1943 do_gettimeofday(&old); ^~~~~~~ do_settimeofday64 drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:1952:46: error: invalid use of undefined type ‘struct timeval’ 1952 if ((now.tv_sec - old.tv_sec) > TX_NO_ACK_TIMEOUT_ASSERT) { ^ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:1809:24: error: unused variable ‘now’ [-Werror=unused-variable] 1809 struct timeval now; ^~~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c: In function ‘stp_sdio_rxdbg_setup’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:2748:79: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 2748 gStpSdioRxDbgEntry = proc_create(STP_SDIO_RXDBG_PROCNAME, 0644, NULL, &stp_sdio_rxdbg_fops); ^~~~~~~~
const struct file_operations *
In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:34, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:46: ./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops ’ but argument is of type ‘const struct file_operations ’ 109 struct proc_dir_entry proc_create(const char name, umode_t mode, struct proc_dir_entry parent, const struct proc_ops proc_ops); ~~~~~^~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c: In function ‘stp_sdio_txdbg_setup’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:3031:79: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3031 gStpSdioTxDbgEntry = proc_create(STP_SDIO_TXDBG_PROCNAME, 0644, NULL, &stp_sdio_txdbg_fops); ^~~~~~~~
const struct file_operations *
In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:34, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:46: ./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops ’ but argument is of type ‘const struct file_operations ’ 109 struct proc_dir_entry proc_create(const char name, umode_t mode, struct proc_dir_entry parent, const struct proc_ops proc_ops); ~~~~~^~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c: In function ‘stp_sdio_owndbg_setup’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:3083:78: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 3083 gStpSdioOwnEntry = proc_create(STP_SDIO_OWNDBG_PROCNAME, 0644, NULL, &stp_sdio_own_fops); ^~~~~~
const struct file_operations *
In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:34, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:46: ./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops ’ but argument is of type ‘const struct file_operations ’ 109 struct proc_dir_entry proc_create(const char name, umode_t mode, struct proc_dir_entry parent, const struct proc_ops proc_ops); ~~~~~^~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c: At top level: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.c:184:23: error: storage size of ‘old’ isn’t known 184 static struct timeval old = {0}; ^~~ ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c: In function ‘stp_uart_tty_open’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c:213:18: error: ‘struct tty_port’ has no member named ‘low_latency’ 213 tty->port->low_latency = 1; ^~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c: In function ‘stp_uart_tty_ioctl’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c:595:26: error: ‘struct tty_port’ has no member named ‘low_latency’ 595 tty->port->low_latency = 1; ^~ drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c: In function ‘mtk_wcn_stp_uart_init’: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.c:776:29: error: assignment to ‘ssize_t ()(struct tty_struct , struct file , unsigned char , size_t, void , long unsigned int)’ {aka ‘long int ()(struct tty_struct , struct file , unsigned char , long unsigned int, void , long unsigned int)’} from incompatible pointer type ‘ssize_t ()(struct tty_struct , struct file , unsigned char , size_t)’ {aka ‘long int ()(struct tty_struct , struct file , unsigned char , long unsigned int)’} [-Werror=incompatible-pointer-types] 776 stp_uart_ldisc.read = stp_uart_tty_read; ^ In file included from drivers/misc/mediatek/connectivity/common/common_detect/../common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_detect/../common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_detect/wmt_gpio.h:24, from drivers/misc/mediatek/connectivity/common/common_detect/wmt_gpio.c:15: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add cc1: all warnings being treated as errors cc1: all warnings being treated as errors In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/linux/include/hif_sdio.h:58, from drivers/misc/mediatek/connectivity/common/common_main/linux/hif_sdio.c:43: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_sdio.o] Error 1 make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/linux/stp_uart.o] Error 1 CC drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect_pwr.o ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add cc1: all warnings being treated as errors make[6]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_detect/wmt_gpio.o] Error 1 make[6]: Waiting for unfinished jobs.... In file included from ./include/linux/proc_fs.h:8, from drivers/misc/mediatek/connectivity/common/common_main/linux/hif_sdio.c:42: drivers/misc/mediatek/connectivity/common/common_main/linux/hif_sdio.c: In function ‘hif_sdio_stp_on’: drivers/misc/mediatek/connectivity/common/common_main/linux/hif_sdio.c:2098:33: error: implicit declaration of function ‘mmc_card_removed’; did you mean ‘mmc_can_retune’? [-Werror=implicit-function-declaration] 2098 mmc_card_removed(func->card))) { ^~~~ ./include/linux/compiler.h:78:45: note: in definition of macro ‘unlikely’ 78 # define unlikely(x) __builtin_expect(!!(x), 0) ^ CC drivers/misc/mediatek/connectivity/common/common_main/core/wmt_ctrl.o CC drivers/misc/mediatek/connectivity/common/common_main/core/wmt_func.o CC drivers/misc/mediatek/connectivity/common/common_main/core/wmt_lib.o In file included from drivers/misc/mediatek/connectivity/common/common_detect/../common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_detect/../common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_detect/wmt_gpio.h:24, from drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c:24: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add CC drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_alps.o ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add AR drivers/misc/mediatek/connectivity/common/common_detect/drv_init/built-in.a CC drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_stub.o drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c: In function ‘wmt_detect_unlocked_ioctl’: drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c:120:26: error: implicit declaration of function ‘wmt_plat_get_soc_chipid’ [-Werror=implicit-function-declaration] 120 retval = wmt_plat_get_soc_chipid(); ^~~~~~~ CC drivers/misc/mediatek/connectivity/common/common_main/platform/alps/mtk_wcn_cmb_hw.o CC drivers/misc/mediatek/connectivity/common/common_main/core/wmt_conf.o cc1: all warnings being treated as errors make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/core/wmt_core.o] Error 1 make[7]: Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[6]: *** [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.o] Error 1 In file included from drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_alps.c:36: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/common/common_detect/../common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_detect/../common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/common/common_detect/wmt_gpio.h:24, from drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect_pwr.c:23: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_stub.c:37: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/core/wmt_func.c:40: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add cc1: all warnings being treated as errors make[6]: *** [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect_pwr.o] Error 1 In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/core/wmt_ctrl.c:41: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/core/wmt_lib.c:42: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add make[5]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common/common_detect] Error 2 make[5]: Waiting for unfinished jobs.... ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add CC drivers/misc/mediatek/connectivity/wlan/wmt_chrdev_wifi.o drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_alps.c: In function ‘wmt_plat_uart_ctrl’: drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_alps.c:891:17: error: this statement may fall through [-Werror=implicit-fallthrough=] 891 pinctrl_select_state(gpio_ctrl_info.pinctrl_info, gpio_ctrl_info. ^~~~~~~~~~~~~~~~~ 892 gpio_ctrl_state[GPIO_COMBO_URXD_PIN].gpio_state[GPIO_IN_PULLUP]); ~~~~~~~~~~~~~~~~ drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_alps.c:893:9: note: here 893 default: ^~~ cc1: all warnings being treated as errors make[8]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_stub.o] Error 1 make[8]: Waiting for unfinished jobs.... CC drivers/misc/mediatek/connectivity/gps/stp_chrdev_gps.o In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/include/wmt_plat.h:22, from drivers/misc/mediatek/connectivity/common/common_main/platform/alps/mtk_wcn_cmb_hw.c:42: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/common/common_main/core/wmt_conf.c:26: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add cc1: all warnings being treated as errors cc1: all warnings being treated as errors make[8]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/platform/alps/mtk_wcn_cmb_hw.o] Error 1 make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/core/wmt_func.o] Error 1 CC drivers/misc/mediatek/connectivity/gps/gps.o CC drivers/misc/mediatek/connectivity/gps/gps_emi.o CC drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.o cc1: all warnings being treated as errors make[8]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/platform/alps/wmt_plat_alps.o] Error 1 make[7]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common/common_main/platform/alps] Error 2 make[6]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common/common_main/platform] Error 2 make[6]: Waiting for unfinished jobs.... cc1: all warnings being treated as errors cc1: all warnings being treated as errors cc1: all warnings being treated as errors make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/linux/hif_sdio.o] Error 1 make[6]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common/common_main/linux] Error 2 make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/core/wmt_conf.o] Error 1 drivers/misc/mediatek/connectivity/fmradio/Makefile:28: FM_CHIP := mt6627 drivers/misc/mediatek/connectivity/fmradio/Makefile:50: core/fm_module.o core/fm_main.o core/fm_config.o core/fm_rds_parser.o core/fm_patch.o core/fm_utils.o core/fm_link.o core/fm_eint.o core/fm_cmd.o mt6627/pub/mt6627_fm_lib.o mt6627/pub/mt6627_fm_rds.o make[7]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/core/wmt_ctrl.o] Error 1 CC drivers/misc/mediatek/connectivity/fmradio/core/fm_module.o In file included from drivers/misc/mediatek/connectivity/gps/stp_chrdev_gps.c:21: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add CC drivers/misc/mediatek/connectivity/fmradio/core/fm_main.o CC drivers/misc/mediatek/connectivity/fmradio/core/fm_config.o In file included from ./arch/arm64/include/asm/uaccess.h:22, from drivers/misc/mediatek/connectivity/fmradio/core/fm_main.c:15: ./arch/arm64/include/asm/mmu.h:48:32: error: unknown type name ‘pgprot_t’ 48 pgprot_t prot, bool page_mappings_only); ^~~~ ./arch/arm64/include/asm/mmu.h:49:63: error: unknown type name ‘pgprot_t’ 49 extern void fixmap_remap_fdt(phys_addr_t dt_phys, int size, pgprot_t prot); ^~~~ In file included from drivers/misc/mediatek/connectivity/fmradio/core/fm_main.c:15: ./arch/arm64/include/asm/uaccess.h: In function ‘__range_ok’: ./arch/arm64/include/asm/uaccess.h:38:36: error: ‘TASK_SIZE_MAX’ undeclared (first use in this function); did you mean ‘XATTR_SIZE_MAX’? 38 unsigned long ret, limit = TASK_SIZE_MAX - 1; ^~~~~ XATTR_SIZE_MAX ./arch/arm64/include/asm/uaccess.h:38:36: note: each undeclared identifier is reported only once for each function it appears in ./arch/arm64/include/asm/uaccess.h:46:14: error: ‘current’ undeclared (first use in this function) 46 (current->flags & PF_KTHREAD test_thread_flag(TIF_TAGGED_ADDR))) ^~~ ./arch/arm64/include/asm/uaccess.h:46:31: error: ‘PF_KTHREAD’ undeclared (first use in this function) 46 (current->flags & PF_KTHREAD test_thread_flag(TIF_TAGGED_ADDR))) ^~~~~~ CC drivers/misc/mediatek/connectivity/fmradio/core/fm_rds_parser.o ./arch/arm64/include/asm/uaccess.h:46:45: error: implicit declaration of function ‘test_thread_flag’ [-Werror=implicit-function-declaration] 46 (current->flags & PF_KTHREAD test_thread_flag(TIF_TAGGED_ADDR))) ^~~~ ./arch/arm64/include/asm/uaccess.h:46:62: error: ‘TIF_TAGGED_ADDR’ undeclared (first use in this function) 46 (current->flags & PF_KTHREAD test_thread_flag(TIF_TAGGED_ADDR))) ^~~~~~~ ./arch/arm64/include/asm/uaccess.h: In function ‘__uaccess_mask_ptr’: ./arch/arm64/include/asm/uaccess.h:225:27: error: ‘TASK_SIZE_MAX’ undeclared (first use in this function); did you mean ‘XATTR_SIZE_MAX’? 225 : "r" (ptr), "r" (TASK_SIZE_MAX - 1), ^~~~~ XATTR_SIZE_MAX drivers/misc/mediatek/connectivity/gps/gps.c:1100:34: error: array type has incomplete element type ‘struct of_device_id’ 1100 static const struct of_device_id apgps_of_ids[] = { ^~~~ drivers/misc/mediatek/connectivity/gps/gps.c:1100:34: error: ‘apgps_of_ids’ defined but not used [-Werror=unused-variable] cc1: all warnings being treated as errors In file included from drivers/misc/mediatek/connectivity/wlan/../common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/wlan/../common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/wlan/../common/common_main/include/wmt_exp.h:24, from drivers/misc/mediatek/connectivity/wlan/wmt_chrdev_wifi.c:33: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add make[5]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/gps/gps.o] Error 1 make[5]: Waiting for unfinished jobs.... ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/gps/../common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/gps/../common/common_main/linux/include/osal.h:24, from drivers/misc/mediatek/connectivity/gps/../common/common_main/core/include/wmt_ctrl.h:24, from drivers/misc/mediatek/connectivity/gps/../common/common_main/core/include/wmt_core.h:23, from drivers/misc/mediatek/connectivity/gps/gps.h:10, from drivers/misc/mediatek/connectivity/gps/gps_emi.c:33: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add In file included from drivers/misc/mediatek/connectivity/ant/../common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:27: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 wakeup_source_init(&lock->ws, name); ^~~~~~ wakeup_source_add cc1: all warnings being treated as errors make[7]: *** [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/common/common_main/core/wmt_lib.o] Error 1 ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add make[6]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common/common_main/core] Error 2 make[5]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common/common_main] Error 2 make[4]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/common] Error 2 make[4]: Waiting for unfinished jobs.... In file included from drivers/misc/mediatek/connectivity/gps/gps_emi.c:33: drivers/misc/mediatek/connectivity/gps/gps.h: At top level: drivers/misc/mediatek/connectivity/gps/gps.h:13:10: fatal error: mtk_wcn_consys_hw.h: No such file or directory 13 #include "mtk_wcn_consys_hw.h" ^~~~~ cc1: all warnings being treated as errors compilation terminated. ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: make[5]: *** [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/gps/gps_emi.o] Error 1 ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 wakeup_source_trash(&lock->ws); ^~~~~~~ wakeup_source_add drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c: In function ‘ANT_DownLoad_RAM_Code’: drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:430:9: error: ISO C90 forbids variable length array ‘pbPatchExtBin’ [-Werror=vla] 430 UINT8 pbPatchExtBin[read_ram_code_length]; ^~~~~ drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:436:31: error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration] 436 mm_segment_t old_fs = get_fs(); ^~ sget_fc drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:436:31: error: invalid initializer drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:438:9: error: implicit declaration of function ‘set_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration] 438 set_fs(KERNEL_DS); ^~ sget_fc cc1: all warnings being treated as errors make[5]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/gps/stp_chrdev_gps.o] Error 1 make[4]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/gps] Error 2 drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:438:16: error: ‘KERNEL_DS’ undeclared (first use in this function); did you mean ‘KERNFS_NS’? 438 set_fs(KERNEL_DS); ^~~~~ KERNFS_NS drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.c:438:16: note: each undeclared identifier is reported only once for each function it appears in CC drivers/misc/mediatek/connectivity/fmradio/core/fm_patch.o CC drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.o In file included from drivers/misc/mediatek/connectivity/fmradio/core/fm_main.c:19: drivers/misc/mediatek/connectivity/fmradio/inc/fm_main.h: At top level: drivers/misc/mediatek/connectivity/fmradio/inc/fm_main.h:238:24: error: field ‘tvThd’ has incomplete type 238 struct timeval tvThd; / time value diff threshold / ^~~~~ drivers/misc/mediatek/connectivity/fmradio/inc/fm_main.h:243:32: error: field ‘tv’ has incomplete type 243 struct timeval tv; / time stamp value in RTC / ^~ CC drivers/misc/mediatek/connectivity/fmradio/core/fm_link.o cc1: all warnings being treated as errors make[5]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/ant/stp_chrdev_ant.o] Error 1 make[4]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/ant] Error 2 CC drivers/misc/mediatek/connectivity/fmradio/core/fm_eint.o cc1: all warnings being treated as errors make[5]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/wlan/wmt_chrdev_wifi.o] Error 1 make[4]: [scripts/Makefile.build:514: drivers/misc/mediatek/connectivity/wlan] Error 2 In file included from drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:28: drivers/misc/mediatek/connectivity/fmradio/inc/fm_main.h:238:24: error: field ‘tvThd’ has incomplete type 238 struct timeval tvThd; / time value diff threshold / ^~~~~ drivers/misc/mediatek/connectivity/fmradio/inc/fm_main.h:243:32: error: field ‘tv’ has incomplete type 243 struct timeval tv; / time stamp value in RTC / ^~ In file included from drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:14: drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c: In function ‘fm_ops_ioctl’: drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:102:53: error: ‘struct file’ has no member named ‘f_dentry’ 102 struct fm_platform *plat = container_of(filp->f_dentry->d_inode->i_cdev, struct fm_platform, cdev); ^~ ./include/linux/kernel.h:708:33: note: in definition of macro ‘container_of’ 708 void __mptr = (void )(ptr); \ ^~~ In file included from : drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:102:53: error: ‘struct file’ has no member named ‘f_dentry’ 102 struct fm_platform *plat = container_of(filp->f_dentry->d_inode->i_cdev, struct fm_platform, cdev); ^~ ././include/linux/compiler_types.h:300:23: note: in definition of macro ‘__compiletime_assert’ 300 if (!(condition)) \ ^~~~~ ././include/linux/compiler_types.h:320:9: note: in expansion of macro ‘_compiletime_assert’ 320 _compiletime_assert(condition, msg, compiletimeassert, COUNTER__) ^~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ 39 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~ ./include/linux/kernel.h:709:9: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ 709 BUILD_BUG_ON_MSG(!__same_type((ptr), ((type )0)->member) && \ ^~~~ ./include/linux/kernel.h:709:27: note: in expansion of macro ‘__same_type’ 709 BUILD_BUG_ON_MSG(!__same_type((ptr), ((type )0)->member) && \ ^~~ drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:102:36: note: in expansion of macro ‘container_of’ 102 struct fm_platform *plat = container_of(filp->f_dentry->d_inode->i_cdev, struct fm_platform, cdev); ^~~~ drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:102:53: error: ‘struct file’ has no member named ‘f_dentry’ 102 struct fm_platform *plat = container_of(filp->f_dentry->d_inode->i_cdev, struct fm_platform, cdev); ^~ ././include/linux/compiler_types.h:300:23: note: in definition of macro ‘__compiletime_assert’ 300 if (!(condition)) \ ^~~~~ ././include/linux/compiler_types.h:320:9: note: in expansion of macro ‘_compiletime_assert’ 320 _compiletime_assert(condition, msg, compiletimeassert, COUNTER__) ^~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ 39 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~ ./include/linux/kernel.h:709:9: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ 709 BUILD_BUG_ON_MSG(!__same_type((ptr), ((type )0)->member) && \ ^~~~ ./include/linux/kernel.h:710:27: note: in expansion of macro ‘__same_type’ 710 !__same_type(*(ptr), void), \ ^~~ drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:102:36: note: in expansion of macro ‘container_of’ 102 struct fm_platform *plat = container_of(filp->f_dentry->d_inode->i_cdev, struct fm_platform, cdev); ^~~~ drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c: In function ‘fm_mod_init’: drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:1374:59: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 1374 g_fm_proc = proc_create(FM_PROC_FILE, 0444, NULL, &fm_proc_ops); ^~~~
const struct file_operations *

In file included from drivers/misc/mediatek/connectivity/fmradio/core/fm_module.c:20: ./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops ’ but argument is of type ‘const struct file_operations ’ 109 | struct proc_dir_entry proc_create(const char name, umode_t mode, struct proc_dir_entry parent, const struct proc_ops proc_ops); | ~~~~~^~ cc1: all warnings being treated as errors CC drivers/misc/mediatek/connectivity/fmradio/core/fm_cmd.o make[5]: [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/fmradio/core/fm_module.o] Error 1 make[5]: Waiting for unfinished jobs.... In file included from drivers/misc/mediatek/connectivity/fmradio/../common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/fmradio/core/fm_main.c:22: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 | wakeup_source_init(&lock->ws, name); | ^~~~~~ | wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 | wakeup_source_trash(&lock->ws); | ^~~~~~~ | wakeup_source_add cc1: all warnings being treated as errors make[5]: * [scripts/Makefile.build:271: drivers/misc/mediatek/connectivity/fmradio/core/fm_main.o] Error 1 drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.c: In function ‘fm_timer_init’: drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.c:408:29: error: assignment to ‘void ()(struct timer_list )’ from incompatible pointer type ‘void ()(long unsigned int)’ [-Werror=incompatible-pointer-types] 408 | timerlist->function = thiz->timeout_func; | ^ drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.c:409:18: error: ‘struct timer_list’ has no member named ‘data’ 409 | timerlist->data = (unsigned long)thiz->data; | ^~ drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.c: In function ‘fm_timer_create’: drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.c:470:9: error: implicit declaration of function ‘init_timer’; did you mean ‘init_timers’? [-Werror=implicit-function-declaration] 470 | init_timer(timerlist); | ^~~~~~ | init_timers cc1: all warnings being treated as errors make[5]: [scripts/Makefile.build:272: drivers/misc/mediatek/connectivity/fmradio/core/fm_utils.o] Error 1 In file included from drivers/misc/mediatek/connectivity/fmradio/../common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/fmradio/core/fm_link.c:22: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 | wakeup_source_init(&lock->ws, name); | ^~~~~~ | wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 | wakeup_source_trash(&lock->ws); | ^~~~~~~ | wakeup_source_add In file included from drivers/misc/mediatek/connectivity/fmradio/../common/common_main/linux/include/osal_typedef.h:49, from drivers/misc/mediatek/connectivity/fmradio/core/fm_eint.c:14: ./include/linux/wakelock.h: In function ‘wake_lock_init’: ./include/linux/wakelock.h:39:9: error: implicit declaration of function ‘wakeup_source_init’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 39 | wakeup_source_init(&lock->ws, name); | ^~~~~~ | wakeup_source_add ./include/linux/wakelock.h: In function ‘wake_lock_destroy’: ./include/linux/wakelock.h:44:9: error: implicit declaration of function ‘wakeup_source_trash’; did you mean ‘wakeup_source_add’? [-Werror=implicit-function-declaration] 44 | wakeup_source_trash(&lock->ws); | ^~~~~~~ | wakeup_source_add

frank-w commented 3 years ago

for wakelocks maybe this is useful:

commit 247c0a1b4c44

alifilhan0 commented 3 years ago

By the way, can you tell me more Android API specific things that might be present more in the modems directory? I am very new jn kernel driver forward porting, only had my hands on mtk cam ISP from 4.19 to 5.10.

frank-w commented 3 years ago

porting a driver from 4.4 to 5.10 is a hard thing as many things may changed...also without android parts...imho the wakelock part was the buggest part i had till now...i simply make step by step on compiler messages and look when the missing function gets replaced by a new one

alifilhan0 commented 3 years ago

Since the code is not in kernel style but mostly in vendor style, it should be a bit easier than regular linux kernel driver porting right since we need to change the standard kernel specific fumctions right? Because many parts are not standard linux kernel implementations, so they might not require changes. Basically I need a view on the android specific things on drivers in an android linux kernel. Also, how to be good at kernel forward porting? I mean you even used headers and then port the code in the BPi forum. Can you give me some quick teachings?

frank-w commented 3 years ago

i do not have this android specific view :) i only fix compiler errors...and googling which function was replaced by which and look for porting changes in kernel-patches of other drivers

alifilhan0 commented 3 years ago

I was having struct timeval issues which I fixed by structtimespec64 and do_gettimeofday to ktime_get_real_ts64. Now there are more and more kernel errors. Some are beyond my understanding. Can you have a look into those errors now? Just guide me through all the complex issues. For example I am geting show_stack error: implicit definition of show_stack etc etc.

frank-w commented 3 years ago

Show_stack and timeval i had also in my portings... First one was easy afair (include missing and/or parameter issue)

Second one was a bit more tricky,but solution is in my source, just look through my branches (e.g. -wifi and -main): https://github.com/frank-w/BPI-R2-4.14/commits/5.8-main/drivers/misc/mediatek

Timeval: https://github.com/frank-w/BPI-R2-4.14/commit/f431e9651b2af8ff884696ec864ce61a953968a3#diff-316ff3f2eb45ca2cb637970009b1b3c3b425a658daf49d7a024c58efa487934e

https://github.com/frank-w/BPI-R2-4.14/commit/1a7e884e8ad3495e0839b54770e3a1b735877b5f#diff-316ff3f2eb45ca2cb637970009b1b3c3b425a658daf49d7a024c58efa487934e

Ioremap_nocache: https://github.com/frank-w/BPI-R2-4.14/commit/e2ff9d256377700fa3ee31d2e9b1e283c72d3f46#diff-316ff3f2eb45ca2cb637970009b1b3c3b425a658daf49d7a024c58efa487934e

Proc_ops: https://github.com/frank-w/BPI-R2-4.14/commit/94d3627f99ff0b35463a11a5825c428b62cce650#diff-316ff3f2eb45ca2cb637970009b1b3c3b425a658daf49d7a024c58efa487934e

Show_stack: https://github.com/frank-w/BPI-R2-4.14/commit/edc94a2539196604fd5fdebe4adf70fad63aaf72#diff-316ff3f2eb45ca2cb637970009b1b3c3b425a658daf49d7a024c58efa487934e

frank-w commented 3 years ago

Have you mt7623 parts running in 4.4? Imho all should work before do upporting to have clue if codebase is wrong or your porting