[PATCH 55/74] media: qcom: camss: vfe: Make is_pix the only test for the pixel path

From: bod

Date: Mon Oct 05 2026 - 13:35:22 EST


From: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>

camss-vfe.c decides whether a line is the pixel path by its index in
most places, comparing against VFE_LINE_PIX. On a VFE lite index 3 is
RDI3, so the lite's fourth RDI picks up the pixel path's selection API,
crop clamp, PIX formats, PIX bytes-per-line alignment, line-based mode
and clock computation.

Make line->is_pix the single test:

- a backend declares its pixel line by setting is_pix; a lite never does
- formats are chosen after the backend's subdev_init(), once is_pix is
known
- every VFE_LINE_PIX comparison in camss-vfe.c becomes an is_pix test
- add VFE_LINE_RDI3 as the name of index 3 on a lite

vfe-780 already declares its pixel line. vfe-340 declares it here; it is
the only other backend whose tables still give a full VFE four lines.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss-vfe-340.c | 1 +
drivers/media/platform/qcom/camss/camss-vfe.c | 36 +++++++++++++----------
drivers/media/platform/qcom/camss/camss-vfe.h | 3 +-
3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/qcom/camss/camss-vfe-340.c b/drivers/media/platform/qcom/camss/camss-vfe-340.c
index e5a0a70eed1e6..708dad42186f9 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-340.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-340.c
@@ -356,6 +356,7 @@ static const struct camss_video_ops vfe_video_ops_520 = {
static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
{
vfe->video_ops = vfe_video_ops_520;
+ vfe->line[VFE_LINE_PIX].is_pix = true;
}

static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index 82a23be7cae9c..0c7be87d7bd57 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -1059,7 +1059,8 @@ void vfe_isr_comp_done(struct vfe_device *vfe, u8 comp)
unsigned int i;

for (i = 0; i < ARRAY_SIZE(vfe->wm_output_map); i++)
- if (vfe->wm_output_map[i] == VFE_LINE_PIX) {
+ if (vfe->wm_output_map[i] != VFE_LINE_NONE &&
+ vfe->line[vfe->wm_output_map[i]].is_pix) {
vfe->isr_ops.wm_done(vfe, i);
break;
}
@@ -1167,7 +1168,7 @@ static int vfe_set_clock_rates(struct vfe_device *vfe)
u32 tmp;
u8 bpp;

- if (j == VFE_LINE_PIX) {
+ if (vfe->line[j].is_pix) {
tmp = pixel_clock[j];
} else {
struct vfe_line *l = &vfe->line[j];
@@ -1248,7 +1249,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe)
u32 tmp;
u8 bpp;

- if (j == VFE_LINE_PIX) {
+ if (vfe->line[j].is_pix) {
tmp = pixel_clock[j];
} else {
struct vfe_line *l = &vfe->line[j];
@@ -1566,7 +1567,7 @@ static void vfe_try_format(struct vfe_line *line,

fmt->code = vfe_src_pad_code(line, fmt->code, 0, code);

- if (line->id == VFE_LINE_PIX) {
+ if (line->is_pix) {
struct v4l2_rect *rect;

rect = __vfe_get_crop(line, sd_state, which);
@@ -1844,7 +1845,7 @@ static int vfe_set_format(struct v4l2_subdev *sd,
vfe_try_format(line, sd_state, MSM_VFE_PAD_SRC, format,
fmt->which);

- if (line->id != VFE_LINE_PIX)
+ if (!line->is_pix)
return 0;

/* Reset sink pad compose selection */
@@ -1878,7 +1879,7 @@ static int vfe_get_selection(struct v4l2_subdev *sd,
struct v4l2_rect *rect;
int ret;

- if (line->id != VFE_LINE_PIX)
+ if (!line->is_pix)
return -EINVAL;

if (sel->pad == MSM_VFE_PAD_SINK)
@@ -1949,7 +1950,7 @@ static int vfe_set_selection(struct v4l2_subdev *sd,
struct v4l2_rect *rect;
int ret;

- if (line->id != VFE_LINE_PIX)
+ if (!line->is_pix)
return -EINVAL;

if (sel->target == V4L2_SEL_TGT_COMPOSE &&
@@ -2173,18 +2174,21 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
init_completion(&l->output[0].sof);
init_completion(&l->output[0].reg_update);

- if (i == VFE_LINE_PIX) {
- l->nformats = res->vfe.formats_pix->nformats;
- l->formats = res->vfe.formats_pix->formats;
- } else {
- l->nformats = res->vfe.formats_rdi->nformats;
- l->formats = res->vfe.formats_rdi->formats;
- }

}

vfe->res->hw_ops->subdev_init(dev, vfe);

+ /* Only now does a line know whether it is the pixel path */
+ for (i = 0; i < vfe->res->line_num; i++) {
+ struct vfe_line *l = &vfe->line[i];
+ const struct camss_formats *f = l->is_pix ? res->vfe.formats_pix :
+ res->vfe.formats_rdi;
+
+ l->nformats = f->nformats;
+ l->formats = f->formats;
+ }
+
init_completion(&vfe->reset_complete);
init_completion(&vfe->halt_complete);

@@ -2331,7 +2335,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
v4l2_subdev_init(sd, &vfe_v4l2_ops);
sd->internal_ops = &vfe_v4l2_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
- if (i == VFE_LINE_PIX && vfe->res->is_lite == false)
+ if (vfe->line[i].is_pix)
snprintf(sd->name, ARRAY_SIZE(sd->name), "%s%d_%s",
MSM_VFE_NAME, vfe->id, "pix");
else
@@ -2371,7 +2375,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
}

video_out->ops = &vfe->video_ops;
- if (i == VFE_LINE_PIX) {
+ if (vfe->line[i].is_pix) {
video_out->bpl_alignment = vfe_bpl_align_pix(vfe);
video_out->line_based = 1;
} else {
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h
index 318b025702007..2b354d6bcc1f5 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.h
+++ b/drivers/media/platform/qcom/camss/camss-vfe.h
@@ -59,7 +59,8 @@ enum vfe_line_id {
VFE_LINE_RDI0 = 0,
VFE_LINE_RDI1 = 1,
VFE_LINE_RDI2 = 2,
- VFE_LINE_PIX = 3,
+ VFE_LINE_RDI3 = 3, /* IFE lite */
+ VFE_LINE_PIX = 3, /* full IFE, when line->is_pix */
VFE_LINE_NUM_MAX = 4
};


--
2.55.0