When compiling a kernel in cosmo I've got this error in the attached picture.
The header file is in https://github.com/gemian/cosmo-linux-kerne.../helio-dvfsrc.h
Please, can someone help me ?
Thank you all.
Your build is most likely including the wrong mtk_dvfsrc_reg.h (there are multiples) which then includes the wrong mtk_dvfsrc_reg_mt6771.h and then defines DVFSRC_LEVEL incorrectly. The kernel sources don't build out of the box, as you discovered. My guess is you had to add a pile of -I include directives to get the kernel to build, or you created a bunch of symlinks to required headers in a directory already specified with a -I directive in the default build. I assume MediaTek's build environment presents a boatload of -I directives to the make process, but our sources lack this.
I modified drivers/devfreq/helio-dvfsrc.c to force it to pull in the correct header (specifically the last one) from the same directory as helio-dvfsrc.c itself:
#include "drivers/devfreq/helio-dvfsrc.h"
#include "drivers/devfreq/helio-dvfsrc-opp.h"
#include "drivers/devfreq/mtk_dvfsrc_reg.h"
Note the change from an angled path <....h> in the original source to a quoted path "....h".
There are four mtk_dvfsrc_reg.h in the kernel sources:
./drivers/devfreq/mtk_dvfsrc_reg.h
./drivers/misc/mediatek/base/power/include/mtk_dvfsrc_reg.h
./drivers/misc/mediatek/base/power/include/spm_v3/mtk_dvfsrc_reg.h
./drivers/misc/mediatek/base/power/include/spm_v4/mtk_dvfsrc_reg.h
You want to make sure helio-dvfsrc.c includes the top one, which using a quoted #include will accomplish. You probably have a -I directive to drivers/misc/mediatek/base/power/include/spm_v4, which includes a different mtk_dvfsrc_reg_mt6771.h, which in turn #define's a different DVFSRC_LEVEL macro than the *other* mtk_dvfsrc_reg_mt6771.h in the source tree (yep, there are two), causing your build to fail as the preprocessor expands the wrong DVRSRC_LEVEL macro into something it can't process.