Skip to content

Commit 2da185d

Browse files
Gnuroumchehab
authored andcommitted
media: mtk-vcodec: fix build breakage when one of VPU or SCP is enabled
The addition of MT8183 support added a dependency on the SCP remoteproc module. However the initial patch used the "select" Kconfig directive, which may result in the SCP module to not be compiled if remoteproc was disabled. In such a case, mtk-vcodec would try to link against non-existent SCP symbols. "select" was clearly misused here as explained in kconfig-language.txt. Replace this by a "depends" directive on at least one of the VPU and SCP modules, to allow the driver to be compiled as long as one of these is enabled, and adapt the code to support this new scenario. Also adapt the Kconfig text to explain the extra requirements for MT8173 and MT8183. Reported-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Alexandre Courbot <acourbot@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: bf1d556 ("media: mtk-vcodec: abstract firmware interface") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 46233e9 commit 2da185d

3 files changed

Lines changed: 47 additions & 9 deletions

File tree

drivers/media/platform/Kconfig

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,31 @@ config VIDEO_MEDIATEK_VCODEC
253253
depends on MTK_IOMMU || COMPILE_TEST
254254
depends on VIDEO_DEV && VIDEO_V4L2
255255
depends on ARCH_MEDIATEK || COMPILE_TEST
256+
depends on VIDEO_MEDIATEK_VPU || MTK_SCP
257+
# The two following lines ensure we have the same state ("m" or "y") as
258+
# our dependencies, to avoid missing symbols during link.
259+
depends on VIDEO_MEDIATEK_VPU || !VIDEO_MEDIATEK_VPU
260+
depends on MTK_SCP || !MTK_SCP
256261
select VIDEOBUF2_DMA_CONTIG
257262
select V4L2_MEM2MEM_DEV
258-
select VIDEO_MEDIATEK_VPU
259-
select MTK_SCP
263+
select VIDEO_MEDIATEK_VCODEC_VPU if VIDEO_MEDIATEK_VPU
264+
select VIDEO_MEDIATEK_VCODEC_SCP if MTK_SCP
260265
help
261-
Mediatek video codec driver provides HW capability to
262-
encode and decode in a range of video formats
263-
This driver rely on VPU driver to communicate with VPU.
266+
Mediatek video codec driver provides HW capability to
267+
encode and decode in a range of video formats on MT8173
268+
and MT8183.
269+
270+
Note that support for MT8173 requires VIDEO_MEDIATEK_VPU to
271+
also be selected. Support for MT8183 depends on MTK_SCP.
272+
273+
To compile this driver as modules, choose M here: the
274+
modules will be called mtk-vcodec-dec and mtk-vcodec-enc.
275+
276+
config VIDEO_MEDIATEK_VCODEC_VPU
277+
bool
264278

265-
To compile this driver as modules, choose M here: the
266-
modules will be called mtk-vcodec-dec and mtk-vcodec-enc.
279+
config VIDEO_MEDIATEK_VCODEC_SCP
280+
bool
267281

268282
config VIDEO_MEM2MEM_DEINTERLACE
269283
tristate "Deinterlace support"

drivers/media/platform/mtk-vcodec/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,11 @@ mtk-vcodec-enc-y := venc/venc_vp8_if.o \
2525
mtk-vcodec-common-y := mtk_vcodec_intr.o \
2626
mtk_vcodec_util.o \
2727
mtk_vcodec_fw.o \
28-
mtk_vcodec_fw_vpu.o \
29-
mtk_vcodec_fw_scp.o
28+
29+
ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU),)
30+
mtk-vcodec-common-y += mtk_vcodec_fw_vpu.o
31+
endif
32+
33+
ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP),)
34+
mtk-vcodec-common-y += mtk_vcodec_fw_scp.o
35+
endif

drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_priv.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,26 @@ struct mtk_vcodec_fw_ops {
2727
void (*release)(struct mtk_vcodec_fw *fw);
2828
};
2929

30+
#if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU)
3031
struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
3132
enum mtk_vcodec_fw_use fw_use);
33+
#else
34+
static inline struct mtk_vcodec_fw *
35+
mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
36+
enum mtk_vcodec_fw_use fw_use)
37+
{
38+
return ERR_PTR(-ENODEV);
39+
}
40+
#endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_VPU */
41+
42+
#if IS_ENABLED(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP)
3243
struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev);
44+
#else
45+
static inline struct mtk_vcodec_fw *
46+
mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev)
47+
{
48+
return ERR_PTR(-ENODEV);
49+
}
50+
#endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_SCP */
3351

3452
#endif /* _MTK_VCODEC_FW_PRIV_H_ */

0 commit comments

Comments
 (0)