Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vincent Knecht and committed by
Hans Verkuil
f0e8ffb4 2f1ff4e1

+69
+1
drivers/media/platform/qcom/camss/Makefile
··· 23 23 camss-vfe-680.o \ 24 24 camss-vfe-gen3.o \ 25 25 camss-vfe-gen1.o \ 26 + camss-vfe-vbif.o \ 26 27 camss-vfe.o \ 27 28 camss-video.o \ 28 29 camss-format.o \
+12
drivers/media/platform/qcom/camss/camss-vfe-4-1.c
··· 15 15 #include "camss.h" 16 16 #include "camss-vfe.h" 17 17 #include "camss-vfe-gen1.h" 18 + #include "camss-vfe-vbif.h" 18 19 19 20 #define VFE_0_HW_VERSION 0x000 20 21 ··· 734 733 { 735 734 u32 val = VFE_0_BUS_BDG_QOS_CFG_0_CFG; 736 735 u32 val7 = VFE_0_BUS_BDG_QOS_CFG_7_CFG; 736 + int ret; 737 737 738 738 writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_0); 739 739 writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_1); ··· 744 742 writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_5); 745 743 writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_6); 746 744 writel_relaxed(val7, vfe->base + VFE_0_BUS_BDG_QOS_CFG_7); 745 + 746 + /* SoC-specific VBIF settings */ 747 + if (vfe->res->has_vbif) { 748 + ret = vfe_vbif_apply_settings(vfe); 749 + if (ret < 0) { 750 + dev_err_ratelimited(vfe->camss->dev, 751 + "VFE: VBIF error %d\n", 752 + ret); 753 + } 754 + } 747 755 } 748 756 749 757 static void vfe_set_ds(struct vfe_device *vfe)
+25
drivers/media/platform/qcom/camss/camss-vfe-vbif.c
··· 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 + }
+19
drivers/media/platform/qcom/camss/camss-vfe-vbif.h
··· 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 */
+9
drivers/media/platform/qcom/camss/camss-vfe.c
··· 1829 1829 return PTR_ERR(vfe->base); 1830 1830 } 1831 1831 1832 + if (vfe->res->has_vbif) { 1833 + vfe->vbif_base = devm_platform_ioremap_resource_byname(pdev, 1834 + vfe->res->vbif_name); 1835 + if (IS_ERR(vfe->vbif_base)) { 1836 + dev_err(dev, "could not map vbif memory\n"); 1837 + return PTR_ERR(vfe->vbif_base); 1838 + } 1839 + } 1840 + 1832 1841 /* Interrupt */ 1833 1842 1834 1843 ret = platform_get_irq_byname(pdev, res->interrupt[0]);
+3
drivers/media/platform/qcom/camss/camss-vfe.h
··· 136 136 u8 line_num; 137 137 bool has_pd; 138 138 char *pd_name; 139 + bool has_vbif; 140 + char *vbif_name; 139 141 const struct vfe_hw_ops *hw_ops; 140 142 const struct camss_formats *formats_rdi; 141 143 const struct camss_formats *formats_pix; ··· 147 145 struct camss *camss; 148 146 u8 id; 149 147 void __iomem *base; 148 + void __iomem *vbif_base; 150 149 u32 irq; 151 150 char irq_name[30]; 152 151 struct camss_clock *clock;