media: qcom: camss: vfe: Add VBIF setting support

Some devices need writing values to VFE VBIF registers.
Add helper functions to do this.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Vincent Knecht
2025-10-30 08:59:13 +01:00
committed by Hans Verkuil
parent 2f1ff4e132
commit f0e8ffb46b
6 changed files with 69 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ qcom-camss-objs += \
camss-vfe-680.o \
camss-vfe-gen3.o \
camss-vfe-gen1.o \
camss-vfe-vbif.o \
camss-vfe.o \
camss-video.o \
camss-format.o \

View File

@@ -15,6 +15,7 @@
#include "camss.h"
#include "camss-vfe.h"
#include "camss-vfe-gen1.h"
#include "camss-vfe-vbif.h"
#define VFE_0_HW_VERSION 0x000
@@ -733,6 +734,7 @@ static void vfe_set_qos(struct vfe_device *vfe)
{
u32 val = VFE_0_BUS_BDG_QOS_CFG_0_CFG;
u32 val7 = VFE_0_BUS_BDG_QOS_CFG_7_CFG;
int ret;
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_0);
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_1);
@@ -742,6 +744,16 @@ static void vfe_set_qos(struct vfe_device *vfe)
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_5);
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_6);
writel_relaxed(val7, vfe->base + VFE_0_BUS_BDG_QOS_CFG_7);
/* SoC-specific VBIF settings */
if (vfe->res->has_vbif) {
ret = vfe_vbif_apply_settings(vfe);
if (ret < 0) {
dev_err_ratelimited(vfe->camss->dev,
"VFE: VBIF error %d\n",
ret);
}
}
}
static void vfe_set_ds(struct vfe_device *vfe)

View File

@@ -0,0 +1,25 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* camss-vfe-vbif.c
*
* Qualcomm MSM Camera Subsystem - VFE VBIF Module
*
* Copyright (c) 2025, The Linux Foundation. All rights reserved.
*
*/
#include <linux/io.h>
#include "camss.h"
#include "camss-vfe.h"
#include "camss-vfe-vbif.h"
void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val)
{
writel_relaxed(val, vfe->vbif_base + reg);
}
int vfe_vbif_apply_settings(struct vfe_device *vfe)
{
return 0;
}

View File

@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* camss-vfe-vbif.h
*
* Qualcomm MSM Camera Subsystem - VFE VBIF Module
*
* Copyright (c) 2025, The Linux Foundation. All rights reserved.
*
*/
#ifndef QC_MSM_CAMSS_VFE_VBIF_H
#define QC_MSM_CAMSS_VFE_VBIF_H
#include "camss-vfe.h"
void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val);
int vfe_vbif_apply_settings(struct vfe_device *vfe);
#endif /* QC_MSM_CAMSS_VFE_VBIF_H */

View File

@@ -1829,6 +1829,15 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
return PTR_ERR(vfe->base);
}
if (vfe->res->has_vbif) {
vfe->vbif_base = devm_platform_ioremap_resource_byname(pdev,
vfe->res->vbif_name);
if (IS_ERR(vfe->vbif_base)) {
dev_err(dev, "could not map vbif memory\n");
return PTR_ERR(vfe->vbif_base);
}
}
/* Interrupt */
ret = platform_get_irq_byname(pdev, res->interrupt[0]);

View File

@@ -136,6 +136,8 @@ struct vfe_subdev_resources {
u8 line_num;
bool has_pd;
char *pd_name;
bool has_vbif;
char *vbif_name;
const struct vfe_hw_ops *hw_ops;
const struct camss_formats *formats_rdi;
const struct camss_formats *formats_pix;
@@ -145,6 +147,7 @@ struct vfe_device {
struct camss *camss;
u8 id;
void __iomem *base;
void __iomem *vbif_base;
u32 irq;
char irq_name[30];
struct camss_clock *clock;