Skip to content

Commit 2e353c0

Browse files
gouravk-qualcommkas User
authored andcommitted
video: Kbuild: detect x1p42100-videocc.h at build time
The dt-bindings header <dt-bindings/clock/qcom,x1p42100-videocc.h> is present in qcom-specific kernel trees (qcom-6.18, qcom-next) but is not yet available in linux-yocto based trees (yocto-6.18, yocto-next). A file-existence check cannot be replaced by a version number because both kernel families share the same version. Add a build-time probe in video/Kbuild that tests for the header and, when found, passes -DMSM_VIDC_HAS_X1P42100_VIDEOCC=1 to compiler. Guard the include of that header and the three clock-table entries whose initialiser values (VIDEO_CC_MVS0C_CLK, VIDEO_CC_MVS0_CLK, VIDEO_CC_MVS0_BSE_CLK) are defined exclusively by it with the same macro. Also guard the qcom,x1p42100-iris entry in msm_vidc_dt_match[] so that the kernel does not associate the driver with the purwa device at all on kernels where the header is absent. Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
1 parent 19d02d4 commit 2e353c0

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

driver/platform/purwa/src/purwa.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
*/
55

66
#include <dt-bindings/clock/qcom,x1e80100-gcc.h>
7+
#ifdef MSM_VIDC_HAS_X1P42100_VIDEOCC
78
#include <dt-bindings/clock/qcom,x1p42100-videocc.h>
9+
#endif
810
#include <media/v4l2_vidc_extensions.h>
911

1012
#include "msm_vidc_purwa.h"
@@ -1809,11 +1811,13 @@ static const char * const purwa_opp_pd_table[] = { "mxc", "mmcx", NULL };
18091811
/* name, clock id, scaling */
18101812
static const struct clk_table purwa_clk_table[] = {
18111813
{ "iface", GCC_VIDEO_AXI0_CLK, 0},
1814+
#ifdef MSM_VIDC_HAS_X1P42100_VIDEOCC
18121815
{ "core", VIDEO_CC_MVS0C_CLK, 0},
18131816
{ "vcodec0_core", VIDEO_CC_MVS0_CLK, 1,
18141817
(u64[]) {500000000, 424000000, 335000000, 300000000, 210000000}, 5},
18151818
{ "vcodec0_bse", VIDEO_CC_MVS0_BSE_CLK, 1,
18161819
(u64[]) {250000000, 212000000, 167500000, 150000000, 105000000}, 5},
1820+
#endif
18171821
};
18181822

18191823
/* name */

driver/vidc/src/msm_vidc_probe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ static const struct of_device_id msm_vidc_dt_match[] = {
172172
{.compatible = "qcom,kera-vidc"},
173173
{.compatible = "qcom,x1e80100-vidc"},
174174
{.compatible = "qcom,x1e80100-iris"},
175+
#ifdef MSM_VIDC_HAS_X1P42100_VIDEOCC
175176
{.compatible = "qcom,x1p42100-iris"},
177+
#endif
176178
{.compatible = "qcom,sa8775p-iris"},
177179
{.compatible = "qcom,qcs8300-iris"},
178180
{.compatible = "qcom,sc7280-venus"},

video/Kbuild

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22

3+
# KERNEL_SRC may not be set in all build environments; fall back to srctree
4+
# which is always defined by the kernel build system.
5+
KERNEL_SRC ?= $(srctree)
6+
37
VIDEO_DRIVER_ABS_PATH := $(VIDEO_ROOT)/video/driver
48
VIDEO_DRIVER_REL_PATH := ../video/driver
59

@@ -9,6 +13,12 @@ ifeq ($(HAS_UBWC_HELPERS),yes)
913
ccflags-y += -DMSM_VIDC_HAS_QCOM_UBWC_HELPERS=1
1014
endif
1115

16+
X1P42100_VIDEOCC_H := $(KERNEL_SRC)/include/dt-bindings/clock/qcom,x1p42100-videocc.h
17+
HAS_X1P42100_VIDEOCC := $(shell test -f $(X1P42100_VIDEOCC_H) && echo yes || echo no)
18+
ifeq ($(HAS_X1P42100_VIDEOCC),yes)
19+
ccflags-y += -DMSM_VIDC_HAS_X1P42100_VIDEOCC=1
20+
endif
21+
1222
MDT_LOADER_H := $(KERNEL_SRC)/include/linux/soc/qcom/mdt_loader.h
1323

1424
HAS_MDT_PAS_LOAD := $(shell grep -qs 'qcom_mdt_pas_load' $(MDT_LOADER_H) && echo yes || echo no)

0 commit comments

Comments
 (0)