Skip to content

Commit 28d46b9

Browse files
vknechtTravMurav
authored andcommitted
UPSTREAM: 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 <[email protected]> Signed-off-by: Vincent Knecht <[email protected]> Signed-off-by: André Apitzsch <[email protected]> Signed-off-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 275f76f commit 28d46b9

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed

drivers/media/platform/qcom/camss/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ qcom-camss-objs += \
2323
camss-vfe-680.o \
2424
camss-vfe-gen3.o \
2525
camss-vfe-gen1.o \
26+
camss-vfe-vbif.o \
2627
camss-vfe.o \
2728
camss-video.o \
2829
camss-format.o \

drivers/media/platform/qcom/camss/camss-vfe-4-1.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "camss.h"
1616
#include "camss-vfe.h"
1717
#include "camss-vfe-gen1.h"
18+
#include "camss-vfe-vbif.h"
1819

1920
#define VFE_0_HW_VERSION 0x000
2021

@@ -733,6 +734,7 @@ static void vfe_set_qos(struct vfe_device *vfe)
733734
{
734735
u32 val = VFE_0_BUS_BDG_QOS_CFG_0_CFG;
735736
u32 val7 = VFE_0_BUS_BDG_QOS_CFG_7_CFG;
737+
int ret;
736738

737739
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_0);
738740
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)
742744
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_5);
743745
writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_6);
744746
writel_relaxed(val7, vfe->base + VFE_0_BUS_BDG_QOS_CFG_7);
747+
748+
/* SoC-specific VBIF settings */
749+
if (vfe->res->has_vbif) {
750+
ret = vfe_vbif_apply_settings(vfe);
751+
if (ret < 0) {
752+
dev_err_ratelimited(vfe->camss->dev,
753+
"VFE: VBIF error %d\n",
754+
ret);
755+
}
756+
}
745757
}
746758

747759
static void vfe_set_ds(struct vfe_device *vfe)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* camss-vfe-vbif.c
4+
*
5+
* Qualcomm MSM Camera Subsystem - VFE VBIF Module
6+
*
7+
* Copyright (c) 2025, The Linux Foundation. All rights reserved.
8+
*
9+
*/
10+
11+
#include <linux/io.h>
12+
13+
#include "camss.h"
14+
#include "camss-vfe.h"
15+
#include "camss-vfe-vbif.h"
16+
17+
void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val)
18+
{
19+
writel_relaxed(val, vfe->vbif_base + reg);
20+
}
21+
22+
int vfe_vbif_apply_settings(struct vfe_device *vfe)
23+
{
24+
return 0;
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* camss-vfe-vbif.h
4+
*
5+
* Qualcomm MSM Camera Subsystem - VFE VBIF Module
6+
*
7+
* Copyright (c) 2025, The Linux Foundation. All rights reserved.
8+
*
9+
*/
10+
#ifndef QC_MSM_CAMSS_VFE_VBIF_H
11+
#define QC_MSM_CAMSS_VFE_VBIF_H
12+
13+
#include "camss-vfe.h"
14+
15+
void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val);
16+
17+
int vfe_vbif_apply_settings(struct vfe_device *vfe);
18+
19+
#endif /* QC_MSM_CAMSS_VFE_VBIF_H */

drivers/media/platform/qcom/camss/camss-vfe.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,15 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
18271827
return PTR_ERR(vfe->base);
18281828
}
18291829

1830+
if (vfe->res->has_vbif) {
1831+
vfe->vbif_base = devm_platform_ioremap_resource_byname(pdev,
1832+
vfe->res->vbif_name);
1833+
if (IS_ERR(vfe->vbif_base)) {
1834+
dev_err(dev, "could not map vbif memory\n");
1835+
return PTR_ERR(vfe->vbif_base);
1836+
}
1837+
}
1838+
18301839
/* Interrupt */
18311840

18321841
ret = platform_get_irq_byname(pdev, res->interrupt[0]);

drivers/media/platform/qcom/camss/camss-vfe.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ struct vfe_subdev_resources {
136136
u8 line_num;
137137
bool has_pd;
138138
char *pd_name;
139+
bool has_vbif;
140+
char *vbif_name;
139141
const struct vfe_hw_ops *hw_ops;
140142
const struct camss_formats *formats_rdi;
141143
const struct camss_formats *formats_pix;
@@ -145,6 +147,7 @@ struct vfe_device {
145147
struct camss *camss;
146148
u8 id;
147149
void __iomem *base;
150+
void __iomem *vbif_base;
148151
u32 irq;
149152
char irq_name[30];
150153
struct camss_clock *clock;

0 commit comments

Comments
 (0)