mbox series

[00/17] CAMSS: SM8250 support (and some fixes)

Message ID 20210608223513.23193-1-jonathan@marek.ca
Headers show
Series CAMSS: SM8250 support (and some fixes) | expand

Message

Jonathan Marek June 8, 2021, 10:34 p.m. UTC
This adds initial support for SM8250 and its 4 VFEs and 6 CSIPHYs.
The only big change is the added camss-vfe-480.c to support the
Titan 480 VFE.

v2:
 - Fixed some typos in commit messages (patches 02 and 08)
 - patch 03 ("media: camss: csiphy-3ph: add support for SM8250 CSI DPHY"):
   - moved definition of CAMSS_8250 to this patch,
   - removed unused lane_enable variable
   - added a default unreachable case to avoid a warning
   - added a is_gen2 variable (minor rework)
 - Undo DECODE_FORMAT_PAYLOAD_ONLY change, add comment instead (patch 04)
 - "ops" reworks in addition to removing dead code (patch 12)
 - renamed csid-170 to csid-gen2, added defines for offsets, add missing
   camnoc_axi clock to sm8250 vfe resources (patch 16/17)

Jonathan Marek (17):
  media: camss: csiphy-3ph: don't print HW version as an error
  media: camss: csiphy-3ph: disable interrupts
  media: camss: csiphy-3ph: add support for SM8250 CSI DPHY
  media: camss: csid-170: fix non-10bit formats
  media: camss: csid-170: don't enable unused irqs
  media: camss: csid-170: remove stray comment
  media: camss: csid-170: support more than one lite vfe
  media: camss: csid-170: set the right HALT_CMD when disabled
  media: camss: csid: allow csid to work without a regulator
  media: camss: remove vdda-csiN from sdm845 resources
  media: camss: fix VFE irq name
  media: camss: remove some vfe ops and clean up dead vfe-170 code
  media: camss: vfe-170: fix "VFE halt timeout" error
  media: camss: Add initial support for VFE hardware version Titan 480
  media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW
  media: camss: add support for SM8250 camss
  media: dt-bindings: media: camss: Add qcom,sm8250-camss binding

 .../bindings/media/qcom,sm8250-camss.yaml     | 399 +++++++++++++
 drivers/media/platform/qcom/camss/Makefile    |   3 +-
 .../{camss-csid-170.c => camss-csid-gen2.c}   |  32 +-
 .../media/platform/qcom/camss/camss-csid.c    |  45 +-
 .../media/platform/qcom/camss/camss-csid.h    |   2 +-
 .../qcom/camss/camss-csiphy-3ph-1-0.c         | 184 ++++--
 .../media/platform/qcom/camss/camss-csiphy.c  |   9 +-
 .../media/platform/qcom/camss/camss-vfe-170.c | 101 +---
 .../media/platform/qcom/camss/camss-vfe-4-1.c |  25 +-
 .../media/platform/qcom/camss/camss-vfe-4-7.c |  63 +-
 .../media/platform/qcom/camss/camss-vfe-4-8.c |  65 +--
 .../media/platform/qcom/camss/camss-vfe-480.c | 545 ++++++++++++++++++
 .../platform/qcom/camss/camss-vfe-gen1.c      |  94 +--
 .../platform/qcom/camss/camss-vfe-gen1.h      |  39 +-
 drivers/media/platform/qcom/camss/camss-vfe.c |  29 +-
 drivers/media/platform/qcom/camss/camss-vfe.h |  17 +-
 .../media/platform/qcom/camss/camss-video.c   |   5 +-
 drivers/media/platform/qcom/camss/camss.c     | 205 ++++++-
 drivers/media/platform/qcom/camss/camss.h     |   1 +
 19 files changed, 1523 insertions(+), 340 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml
 rename drivers/media/platform/qcom/camss/{camss-csid-170.c => camss-csid-gen2.c} (95%)
 create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-480.c

Comments

Jonathan Marek June 8, 2021, 10:35 p.m. UTC | #1
Delete vfe_isr_ops. In all cases the right function can just be called
directly.
kernel test robot June 9, 2021, 3:23 a.m. UTC | #2
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.13-rc5]
[also build test WARNING on next-20210608]
[cannot apply to linuxtv-media/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Marek/CAMSS-SM8250-support-and-some-fixes/20210609-064108
base:    614124bea77e452aa6df7a8714e8bc820b489922
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/3c204c01a75526c1bc39788a012adb7e495c39f4
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jonathan-Marek/CAMSS-SM8250-support-and-some-fixes/20210609-064108
        git checkout 3c204c01a75526c1bc39788a012adb7e495c39f4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/media/platform/qcom/camss/camss-vfe-gen1.c:683: warning: expecting prototype for vfe_isr_comp_done(). Prototype was for vfe_gen1_isr_comp_done() instead

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
   Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
   Selected by
   - SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
   - SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC


vim +683 drivers/media/platform/qcom/camss/camss-vfe-gen1.c

   676	
   677	/**
   678	 * vfe_isr_comp_done() - Process composite image done interrupt
   679	 * @vfe: VFE Device
   680	 * @comp: Composite image id
   681	 */
   682	void vfe_gen1_isr_comp_done(struct vfe_device *vfe, u8 comp)
 > 683	{
   684		unsigned int i;
   685	
   686		for (i = 0; i < ARRAY_SIZE(vfe->wm_output_map); i++)
   687			if (vfe->wm_output_map[i] == VFE_LINE_PIX) {
   688				vfe_gen1_isr_wm_done(vfe, i);
   689				break;
   690			}
   691	}
   692	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Rob Herring June 9, 2021, 4:16 p.m. UTC | #3
On Tue, 08 Jun 2021 18:35:06 -0400, Jonathan Marek wrote:
> Add bindings for qcom,sm8250-camss in order to support the camera
> subsystem for SM8250.
> 
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
>  .../bindings/media/qcom,sm8250-camss.yaml     | 399 ++++++++++++++++++
>  1 file changed, 399 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/media/qcom,sm8250-camss.example.dts:20:18: fatal error: dt-bindings/clock/qcom,camcc-sm8250.h: No such file or directory
   20 |         #include <dt-bindings/clock/qcom,camcc-sm8250.h>
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:380: Documentation/devicetree/bindings/media/qcom,sm8250-camss.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1416: dt_binding_check] Error 2
\ndoc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1489658

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Jonathan Marek June 9, 2021, 10:32 p.m. UTC | #4
On 6/9/21 6:10 PM, Rob Herring wrote:
> On Tue, Jun 08, 2021 at 06:35:06PM -0400, Jonathan Marek wrote:
>> Add bindings for qcom,sm8250-camss in order to support the camera
>> subsystem for SM8250.

...

>> +    items:
>> +      - const: csiphy0
>> +      - const: csiphy1
>> +      - const: csiphy2
>> +      - const: csiphy3
>> +      - const: csiphy4
>> +      - const: csiphy5
> 
> Should be separate phy nodes? Same/similar DPHY or CPHY as QCom DSI PHY?
> 

This is not a new driver, this series only adds support for a new SoC - 
the design has already been decided (and this binding is similar to 
qcom,sdm845-camss.yaml).

The hardware supports D-PHY and C-PHY, but the driver isn't aware of 
this and assumes D-PHY. sdm845 and msm8996 hardware also support C-PHY, 
so it isn't a problem specific to this series.

>> +      - const: vfe0
>> +      - const: vfe1
>> +      - const: vfe_lite0
>> +      - const: vfe_lite1
>> +
kernel test robot June 10, 2021, 5:23 a.m. UTC | #5
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.13-rc5]
[also build test WARNING on next-20210609]
[cannot apply to linuxtv-media/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Marek/CAMSS-SM8250-support-and-some-fixes/20210609-064108
base:    614124bea77e452aa6df7a8714e8bc820b489922
config: x86_64-randconfig-a001-20210609 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d2012d965d60c3258b3a69d024491698f8aec386)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/3c204c01a75526c1bc39788a012adb7e495c39f4
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jonathan-Marek/CAMSS-SM8250-support-and-some-fixes/20210609-064108
        git checkout 3c204c01a75526c1bc39788a012adb7e495c39f4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/media/platform/qcom/camss/camss-vfe-gen1.c:683: warning: expecting prototype for vfe_isr_comp_done(). Prototype was for vfe_gen1_isr_comp_done() instead


vim +683 drivers/media/platform/qcom/camss/camss-vfe-gen1.c

   676	
   677	/**
   678	 * vfe_isr_comp_done() - Process composite image done interrupt
   679	 * @vfe: VFE Device
   680	 * @comp: Composite image id
   681	 */
   682	void vfe_gen1_isr_comp_done(struct vfe_device *vfe, u8 comp)
 > 683	{
   684		unsigned int i;
   685	
   686		for (i = 0; i < ARRAY_SIZE(vfe->wm_output_map); i++)
   687			if (vfe->wm_output_map[i] == VFE_LINE_PIX) {
   688				vfe_gen1_isr_wm_done(vfe, i);
   689				break;
   690			}
   691	}
   692	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Robert Foss June 10, 2021, 12:37 p.m. UTC | #6
Hey Jonathan,

On Wed, 9 Jun 2021 at 00:38, Jonathan Marek <jonathan@marek.ca> wrote:
>
> Delete vfe_isr_ops. In all cases the right function can just be called
> directly.
>
> From vfe_hw_ops:
>  - enable_irq_common is completely dead
>  - isr_read/violation_read dont need ops (call right function directly)
>  - reg_update/reg_update_clear moved to gen1 ops, vfe-170 can call the
>    right function directly
>
> This reveals dead function in vfe-170 which are deleted. comp_done IRQ
> handling is also removed for vfe-170 - only RDI is supported.
>
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
>  .../media/platform/qcom/camss/camss-vfe-170.c | 89 ++----------------
>  .../media/platform/qcom/camss/camss-vfe-4-1.c | 25 +++--
>  .../media/platform/qcom/camss/camss-vfe-4-7.c | 63 ++++++-------
>  .../media/platform/qcom/camss/camss-vfe-4-8.c | 65 ++++++-------
>  .../platform/qcom/camss/camss-vfe-gen1.c      | 94 ++++++++++---------
>  .../platform/qcom/camss/camss-vfe-gen1.h      | 39 +++++++-
>  drivers/media/platform/qcom/camss/camss-vfe.c | 16 ----
>  drivers/media/platform/qcom/camss/camss-vfe.h | 16 ----
>  8 files changed, 169 insertions(+), 238 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c
> index 8594d275b41d1..1de793b218194 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c
> @@ -188,20 +188,6 @@ static void vfe_hw_version_read(struct vfe_device *vfe, struct device *dev)
>         dev_err(dev, "VFE HW Version = %u.%u.%u\n", gen, rev, step);
>  }
>
> -static inline void vfe_reg_clr(struct vfe_device *vfe, u32 reg, u32 clr_bits)
> -{
> -       u32 bits = readl_relaxed(vfe->base + reg);
> -
> -       writel_relaxed(bits & ~clr_bits, vfe->base + reg);
> -}
> -
> -static inline void vfe_reg_set(struct vfe_device *vfe, u32 reg, u32 set_bits)
> -{
> -       u32 bits = readl_relaxed(vfe->base + reg);
> -
> -       writel_relaxed(bits | set_bits, vfe->base + reg);
> -}
> -
>  static void vfe_global_reset(struct vfe_device *vfe)
>  {
>         u32 reset_bits = GLOBAL_RESET_CMD_CORE          |
> @@ -305,38 +291,16 @@ static inline void vfe_reg_update_clear(struct vfe_device *vfe,
>
>  static void vfe_enable_irq_common(struct vfe_device *vfe)
>  {
> -       vfe_reg_set(vfe, VFE_IRQ_MASK_0, ~0u);
> -       vfe_reg_set(vfe, VFE_IRQ_MASK_1, ~0u);
> +       writel_relaxed(~0u, vfe->base + VFE_IRQ_MASK_0);
> +       writel_relaxed(~0u, vfe->base + VFE_IRQ_MASK_1);
>
>         writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(0));
>         writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(1));
>         writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(2));
>  }
>
> -static void vfe_isr_halt_ack(struct vfe_device *vfe)
> -{
> -       complete(&vfe->halt_complete);
> -}
> -
> -static void vfe_isr_read(struct vfe_device *vfe, u32 *status0, u32 *status1)
> -{
> -       *status0 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_0);
> -       *status1 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_1);
> -
> -       writel_relaxed(*status0, vfe->base + VFE_IRQ_CLEAR_0);
> -       writel_relaxed(*status1, vfe->base + VFE_IRQ_CLEAR_1);
> -
> -       /* Enforce ordering between IRQ Clear and Global IRQ Clear */
> -       wmb();
> -       writel_relaxed(CMD_GLOBAL_CLEAR, vfe->base + VFE_IRQ_CMD);
> -}
> -
> -static void vfe_violation_read(struct vfe_device *vfe)
> -{
> -       u32 violation = readl_relaxed(vfe->base + VFE_VIOLATION_STATUS);
> -
> -       pr_err_ratelimited("VFE: violation = 0x%08x\n", violation);
> -}
> +static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id);
> +static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm);
>
>  /*
>   * vfe_isr - VFE module interrupt handler
> @@ -369,24 +333,16 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>         writel_relaxed(1, vfe->base + VFE_BUS_IRQ_CLEAR_GLOBAL);
>
>         if (status0 & STATUS_0_RESET_ACK)
> -               vfe->isr_ops.reset_ack(vfe);
> +               vfe_isr_reset_ack(vfe);
>
>         for (i = VFE_LINE_RDI0; i <= VFE_LINE_RDI2; i++)
>                 if (status0 & STATUS_0_RDI_REG_UPDATE(i))
> -                       vfe->isr_ops.reg_update(vfe, i);
> -
> -       for (i = VFE_LINE_RDI0; i <= VFE_LINE_RDI2; i++)
> -               if (status0 & STATUS_1_RDI_SOF(i))
> -                       vfe->isr_ops.sof(vfe, i);
> -
> -       for (i = 0; i < MSM_VFE_COMPOSITE_IRQ_NUM; i++)
> -               if (vfe_bus_status[0] & STATUS0_COMP_BUF_DONE(i))
> -                       vfe->isr_ops.comp_done(vfe, i);
> +                       vfe_isr_reg_update(vfe, i);
>
>         for (wm = 0; wm < MSM_VFE_IMAGE_MASTERS_NUM; wm++)
>                 if (status0 & BIT(9))
>                         if (vfe_bus_status[1] & STATUS1_WM_CLIENT_BUF_DONE(wm))
> -                               vfe->isr_ops.wm_done(vfe, wm);
> +                               vfe_isr_wm_done(vfe, wm);
>
>         return IRQ_HANDLED;
>  }
> @@ -456,7 +412,6 @@ static int vfe_enable_output(struct vfe_line *line)
>  {
>         struct vfe_device *vfe = to_vfe(line);
>         struct vfe_output *output = &line->output;
> -       const struct vfe_hw_ops *ops = vfe->ops;
>         struct media_entity *sensor;
>         unsigned long flags;
>         unsigned int frame_skip = 0;
> @@ -474,7 +429,7 @@ static int vfe_enable_output(struct vfe_line *line)
>
>         spin_lock_irqsave(&vfe->output_lock, flags);
>
> -       ops->reg_update_clear(vfe, line->id);
> +       vfe_reg_update_clear(vfe, line->id);
>
>         if (output->state != VFE_OUTPUT_OFF) {
>                 dev_err(vfe->camss->dev, "Output is not in reserved state %d\n",
> @@ -501,7 +456,7 @@ static int vfe_enable_output(struct vfe_line *line)
>                 vfe_wm_update(vfe, output->wm_idx[0], output->buf[i]->addr[0], line);
>         }
>
> -       ops->reg_update(vfe, line->id);
> +       vfe_reg_update(vfe, line->id);
>
>         spin_unlock_irqrestore(&vfe->output_lock, flags);
>
> @@ -607,16 +562,6 @@ static int vfe_disable(struct vfe_line *line)
>         return 0;
>  }
>
> -/*
> - * vfe_isr_sof - Process start of frame interrupt
> - * @vfe: VFE Device
> - * @line_id: VFE line
> - */
> -static void vfe_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id)
> -{
> -       /* nop */
> -}
> -
>  /*
>   * vfe_isr_reg_update - Process reg update interrupt
>   * @vfe: VFE Device
> @@ -628,7 +573,7 @@ static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
>         unsigned long flags;
>
>         spin_lock_irqsave(&vfe->output_lock, flags);
> -       vfe->ops->reg_update_clear(vfe, line_id);
> +       vfe_reg_update_clear(vfe, line_id);
>
>         output = &vfe->line[line_id].output;
>
> @@ -747,15 +692,6 @@ static int vfe_queue_buffer(struct camss_video *vid,
>         return 0;
>  }
>
> -static const struct vfe_isr_ops vfe_isr_ops_170 = {
> -       .reset_ack = vfe_isr_reset_ack,
> -       .halt_ack = vfe_isr_halt_ack,
> -       .reg_update = vfe_isr_reg_update,
> -       .sof = vfe_isr_sof,
> -       .comp_done = vfe_isr_comp_done,
> -       .wm_done = vfe_isr_wm_done,
> -};
> -
>  static const struct camss_video_ops vfe_video_ops_170 = {
>         .queue_buffer = vfe_queue_buffer,
>         .flush_buffers = vfe_flush_buffers,
> @@ -763,7 +699,6 @@ static const struct camss_video_ops vfe_video_ops_170 = {
>
>  static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  {
> -       vfe->isr_ops = vfe_isr_ops_170;
>         vfe->video_ops = vfe_video_ops_170;
>
>         vfe->line_num = VFE_LINE_NUM_GEN2;
> @@ -772,15 +707,11 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  const struct vfe_hw_ops vfe_ops_170 = {
>         .global_reset = vfe_global_reset,
>         .hw_version_read = vfe_hw_version_read,
> -       .isr_read = vfe_isr_read,
>         .isr = vfe_isr,
>         .pm_domain_off = vfe_pm_domain_off,
>         .pm_domain_on = vfe_pm_domain_on,
> -       .reg_update_clear = vfe_reg_update_clear,
> -       .reg_update = vfe_reg_update,
>         .subdev_init = vfe_subdev_init,
>         .vfe_disable = vfe_disable,
>         .vfe_enable = vfe_enable,
>         .vfe_halt = vfe_halt,
> -       .violation_read = vfe_violation_read,
>  };
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
> index 53c56a8d45458..873f348cf2fae 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
> @@ -898,34 +898,34 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>         u32 value0, value1;
>         int i, j;
>
> -       vfe->ops->isr_read(vfe, &value0, &value1);
> +       vfe_isr_read(vfe, &value0, &value1);
>
>         dev_dbg(vfe->camss->dev, "VFE: status0 = 0x%08x, status1 = 0x%08x\n",
>                 value0, value1);
>
>         if (value0 & VFE_0_IRQ_STATUS_0_RESET_ACK)
> -               vfe->isr_ops.reset_ack(vfe);
> +               vfe_isr_reset_ack(vfe);
>
>         if (value1 & VFE_0_IRQ_STATUS_1_VIOLATION)
> -               vfe->ops->violation_read(vfe);
> +               vfe_violation_read(vfe);
>
>         if (value1 & VFE_0_IRQ_STATUS_1_BUS_BDG_HALT_ACK)
> -               vfe->isr_ops.halt_ack(vfe);
> +               vfe_gen1_isr_halt_ack(vfe);
>
>         for (i = VFE_LINE_RDI0; i <= VFE_LINE_PIX; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_line_n_REG_UPDATE(i))
> -                       vfe->isr_ops.reg_update(vfe, i);
> +                       vfe_gen1_reg_update(vfe, i);
>
>         if (value0 & VFE_0_IRQ_STATUS_0_CAMIF_SOF)
> -               vfe->isr_ops.sof(vfe, VFE_LINE_PIX);
> +               vfe_gen1_isr_sof(vfe, VFE_LINE_PIX);
>
>         for (i = VFE_LINE_RDI0; i <= VFE_LINE_RDI2; i++)
>                 if (value1 & VFE_0_IRQ_STATUS_1_RDIn_SOF(i))
> -                       vfe->isr_ops.sof(vfe, i);
> +                       vfe_gen1_isr_sof(vfe, i);
>
>         for (i = 0; i < MSM_VFE_COMPOSITE_IRQ_NUM; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_IMAGE_COMPOSITE_DONE_n(i)) {
> -                       vfe->isr_ops.comp_done(vfe, i);
> +                       vfe_gen1_isr_comp_done(vfe, i);
>                         for (j = 0; j < ARRAY_SIZE(vfe->wm_output_map); j++)
>                                 if (vfe->wm_output_map[j] == VFE_LINE_PIX)
>                                         value0 &= ~VFE_0_IRQ_MASK_0_IMAGE_MASTER_n_PING_PONG(j);
> @@ -933,7 +933,7 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>
>         for (i = 0; i < MSM_VFE_IMAGE_MASTERS_NUM; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_IMAGE_MASTER_n_PING_PONG(i))
> -                       vfe->isr_ops.wm_done(vfe, i);
> +                       vfe_gen1_isr_wm_done(vfe, i);
>
>         return IRQ_HANDLED;
>  }
> @@ -991,11 +991,12 @@ static const struct vfe_hw_ops_gen1 vfe_ops_gen1_4_1 = {
>         .wm_set_pong_addr = vfe_wm_set_pong_addr,
>         .wm_set_subsample = vfe_wm_set_subsample,
>         .wm_set_ub_cfg = vfe_wm_set_ub_cfg,
> +       .reg_update_clear = vfe_reg_update_clear,
> +       .reg_update = vfe_reg_update,
>  };
>
>  static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  {
> -       vfe->isr_ops = vfe_isr_ops_gen1;
>         vfe->ops_gen1 = &vfe_ops_gen1_4_1;
>         vfe->video_ops = vfe_video_ops_gen1;
>
> @@ -1005,15 +1006,11 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  const struct vfe_hw_ops vfe_ops_4_1 = {
>         .global_reset = vfe_global_reset,
>         .hw_version_read = vfe_hw_version_read,
> -       .isr_read = vfe_isr_read,
>         .isr = vfe_isr,
>         .pm_domain_off = vfe_pm_domain_off,
>         .pm_domain_on = vfe_pm_domain_on,
> -       .reg_update_clear = vfe_reg_update_clear,
> -       .reg_update = vfe_reg_update,
>         .subdev_init = vfe_subdev_init,
>         .vfe_disable = vfe_gen1_disable,
>         .vfe_enable = vfe_gen1_enable,
>         .vfe_halt = vfe_gen1_halt,
> -       .violation_read = vfe_violation_read,
>  };
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
> index a596352177583..35178f66360eb 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
> @@ -1037,7 +1037,25 @@ static int vfe_camif_wait_for_stop(struct vfe_device *vfe, struct device *dev)
>         return ret;
>  }
>
> +static void vfe_isr_read(struct vfe_device *vfe, u32 *value0, u32 *value1)
> +{
> +       *value0 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_0);
> +       *value1 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_1);
>
> +       writel_relaxed(*value0, vfe->base + VFE_0_IRQ_CLEAR_0);
> +       writel_relaxed(*value1, vfe->base + VFE_0_IRQ_CLEAR_1);
> +
> +       /* Enforce barrier between local & global IRQ clear */
> +       wmb();
> +       writel_relaxed(VFE_0_IRQ_CMD_GLOBAL_CLEAR, vfe->base + VFE_0_IRQ_CMD);
> +}
> +
> +static void vfe_violation_read(struct vfe_device *vfe)
> +{
> +       u32 violation = readl_relaxed(vfe->base + VFE_0_VIOLATION_STATUS);
> +
> +       pr_err_ratelimited("VFE: violation = 0x%08x\n", violation);
> +}
>
>  /*
>   * vfe_isr - VFE module interrupt handler
> @@ -1052,34 +1070,34 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>         u32 value0, value1;
>         int i, j;
>
> -       vfe->ops->isr_read(vfe, &value0, &value1);
> +       vfe_isr_read(vfe, &value0, &value1);
>
>         dev_dbg(vfe->camss->dev, "VFE: status0 = 0x%08x, status1 = 0x%08x\n",
>                 value0, value1);
>
>         if (value0 & VFE_0_IRQ_STATUS_0_RESET_ACK)
> -               vfe->isr_ops.reset_ack(vfe);
> +               vfe_isr_reset_ack(vfe);
>
>         if (value1 & VFE_0_IRQ_STATUS_1_VIOLATION)
> -               vfe->ops->violation_read(vfe);
> +               vfe_violation_read(vfe);
>
>         if (value1 & VFE_0_IRQ_STATUS_1_BUS_BDG_HALT_ACK)
> -               vfe->isr_ops.halt_ack(vfe);
> +               vfe_gen1_isr_halt_ack(vfe);
>
>         for (i = VFE_LINE_RDI0; i < vfe->line_num; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_line_n_REG_UPDATE(i))
> -                       vfe->isr_ops.reg_update(vfe, i);
> +                       vfe_gen1_reg_update(vfe, i);
>
>         if (value0 & VFE_0_IRQ_STATUS_0_CAMIF_SOF)
> -               vfe->isr_ops.sof(vfe, VFE_LINE_PIX);
> +               vfe_gen1_isr_sof(vfe, VFE_LINE_PIX);
>
>         for (i = VFE_LINE_RDI0; i <= VFE_LINE_RDI2; i++)
>                 if (value1 & VFE_0_IRQ_STATUS_1_RDIn_SOF(i))
> -                       vfe->isr_ops.sof(vfe, i);
> +                       vfe_gen1_isr_sof(vfe, i);
>
>         for (i = 0; i < MSM_VFE_COMPOSITE_IRQ_NUM; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_IMAGE_COMPOSITE_DONE_n(i)) {
> -                       vfe->isr_ops.comp_done(vfe, i);
> +                       vfe_gen1_isr_comp_done(vfe, i);
>                         for (j = 0; j < ARRAY_SIZE(vfe->wm_output_map); j++)
>                                 if (vfe->wm_output_map[j] == VFE_LINE_PIX)
>                                         value0 &= ~VFE_0_IRQ_MASK_0_IMAGE_MASTER_n_PING_PONG(j);
> @@ -1087,24 +1105,11 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>
>         for (i = 0; i < MSM_VFE_IMAGE_MASTERS_NUM; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_IMAGE_MASTER_n_PING_PONG(i))
> -                       vfe->isr_ops.wm_done(vfe, i);
> +                       vfe_gen1_isr_wm_done(vfe, i);
>
>         return IRQ_HANDLED;
>  }
>
> -static void vfe_isr_read(struct vfe_device *vfe, u32 *value0, u32 *value1)
> -{
> -       *value0 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_0);
> -       *value1 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_1);
> -
> -       writel_relaxed(*value0, vfe->base + VFE_0_IRQ_CLEAR_0);
> -       writel_relaxed(*value1, vfe->base + VFE_0_IRQ_CLEAR_1);
> -
> -       /* Enforce barrier between local & global IRQ clear */
> -       wmb();
> -       writel_relaxed(VFE_0_IRQ_CMD_GLOBAL_CLEAR, vfe->base + VFE_0_IRQ_CMD);
> -}
> -
>  /*
>   * vfe_pm_domain_off - Disable power domains specific to this VFE.
>   * @vfe: VFE Device
> @@ -1141,13 +1146,6 @@ static int vfe_pm_domain_on(struct vfe_device *vfe)
>         return 0;
>  }
>
> -static void vfe_violation_read(struct vfe_device *vfe)
> -{
> -       u32 violation = readl_relaxed(vfe->base + VFE_0_VIOLATION_STATUS);
> -
> -       pr_err_ratelimited("VFE: violation = 0x%08x\n", violation);
> -}
> -
>  static const struct vfe_hw_ops_gen1 vfe_ops_gen1_4_7 = {
>         .bus_connect_wm_to_rdi = vfe_bus_connect_wm_to_rdi,
>         .bus_disconnect_wm_from_rdi = vfe_bus_disconnect_wm_from_rdi,
> @@ -1183,11 +1181,12 @@ static const struct vfe_hw_ops_gen1 vfe_ops_gen1_4_7 = {
>         .wm_set_pong_addr = vfe_wm_set_pong_addr,
>         .wm_set_subsample = vfe_wm_set_subsample,
>         .wm_set_ub_cfg = vfe_wm_set_ub_cfg,
> +       .reg_update_clear = vfe_reg_update_clear,
> +       .reg_update = vfe_reg_update,
>  };
>
>  static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  {
> -       vfe->isr_ops = vfe_isr_ops_gen1;
>         vfe->ops_gen1 = &vfe_ops_gen1_4_7;
>         vfe->video_ops = vfe_video_ops_gen1;
>
> @@ -1197,15 +1196,11 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  const struct vfe_hw_ops vfe_ops_4_7 = {
>         .global_reset = vfe_global_reset,
>         .hw_version_read = vfe_hw_version_read,
> -       .isr_read = vfe_isr_read,
>         .isr = vfe_isr,
>         .pm_domain_off = vfe_pm_domain_off,
>         .pm_domain_on = vfe_pm_domain_on,
> -       .reg_update_clear = vfe_reg_update_clear,
> -       .reg_update = vfe_reg_update,
>         .subdev_init = vfe_subdev_init,
>         .vfe_disable = vfe_gen1_disable,
>         .vfe_enable = vfe_gen1_enable,
>         .vfe_halt = vfe_gen1_halt,
> -       .violation_read = vfe_violation_read,
>  };
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c
> index 998429dbb65cd..d4ddbbf44f514 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c
> @@ -968,6 +968,26 @@ static int vfe_camif_wait_for_stop(struct vfe_device *vfe, struct device *dev)
>         return ret;
>  }
>
> +static void vfe_isr_read(struct vfe_device *vfe, u32 *value0, u32 *value1)
> +{
> +       *value0 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_0);
> +       *value1 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_1);
> +
> +       writel_relaxed(*value0, vfe->base + VFE_0_IRQ_CLEAR_0);
> +       writel_relaxed(*value1, vfe->base + VFE_0_IRQ_CLEAR_1);
> +
> +       /* Enforce barrier between local & global IRQ clear */
> +       wmb();
> +       writel_relaxed(VFE_0_IRQ_CMD_GLOBAL_CLEAR, vfe->base + VFE_0_IRQ_CMD);
> +}
> +
> +static void vfe_violation_read(struct vfe_device *vfe)
> +{
> +       u32 violation = readl_relaxed(vfe->base + VFE_0_VIOLATION_STATUS);
> +
> +       pr_err_ratelimited("VFE: violation = 0x%08x\n", violation);
> +}
> +
>  /*
>   * vfe_isr - VFE module interrupt handler
>   * @irq: Interrupt line
> @@ -981,34 +1001,34 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>         u32 value0, value1;
>         int i, j;
>
> -       vfe->ops->isr_read(vfe, &value0, &value1);
> +       vfe_isr_read(vfe, &value0, &value1);
>
>         dev_dbg(vfe->camss->dev, "VFE: status0 = 0x%08x, status1 = 0x%08x\n",
>                 value0, value1);
>
>         if (value0 & VFE_0_IRQ_STATUS_0_RESET_ACK)
> -               vfe->isr_ops.reset_ack(vfe);
> +               vfe_isr_reset_ack(vfe);
>
>         if (value1 & VFE_0_IRQ_STATUS_1_VIOLATION)
> -               vfe->ops->violation_read(vfe);
> +               vfe_violation_read(vfe);
>
>         if (value1 & VFE_0_IRQ_STATUS_1_BUS_BDG_HALT_ACK)
> -               vfe->isr_ops.halt_ack(vfe);
> +               vfe_gen1_isr_halt_ack(vfe);
>
>         for (i = VFE_LINE_RDI0; i < vfe->line_num; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_line_n_REG_UPDATE(i))
> -                       vfe->isr_ops.reg_update(vfe, i);
> +                       vfe_gen1_reg_update(vfe, i);
>
>         if (value0 & VFE_0_IRQ_STATUS_0_CAMIF_SOF)
> -               vfe->isr_ops.sof(vfe, VFE_LINE_PIX);
> +               vfe_gen1_isr_sof(vfe, VFE_LINE_PIX);
>
>         for (i = VFE_LINE_RDI0; i <= VFE_LINE_RDI2; i++)
>                 if (value1 & VFE_0_IRQ_STATUS_1_RDIn_SOF(i))
> -                       vfe->isr_ops.sof(vfe, i);
> +                       vfe_gen1_isr_sof(vfe, i);
>
>         for (i = 0; i < MSM_VFE_COMPOSITE_IRQ_NUM; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_IMAGE_COMPOSITE_DONE_n(i)) {
> -                       vfe->isr_ops.comp_done(vfe, i);
> +                       vfe_gen1_isr_comp_done(vfe, i);
>                         for (j = 0; j < ARRAY_SIZE(vfe->wm_output_map); j++)
>                                 if (vfe->wm_output_map[j] == VFE_LINE_PIX)
>                                         value0 &= ~VFE_0_IRQ_MASK_0_IMAGE_MASTER_n_PING_PONG(j);
> @@ -1016,7 +1036,7 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>
>         for (i = 0; i < MSM_VFE_IMAGE_MASTERS_NUM; i++)
>                 if (value0 & VFE_0_IRQ_STATUS_0_IMAGE_MASTER_n_PING_PONG(i))
> -                       vfe->isr_ops.wm_done(vfe, i);
> +                       vfe_gen1_isr_wm_done(vfe, i);
>
>         return IRQ_HANDLED;
>  }
> @@ -1081,19 +1101,6 @@ static void vfe_set_ds(struct vfe_device *vfe)
>         writel_relaxed(val16, vfe->base + VFE_0_BUS_BDG_DS_CFG_16);
>  }
>
> -static void vfe_isr_read(struct vfe_device *vfe, u32 *value0, u32 *value1)
> -{
> -       *value0 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_0);
> -       *value1 = readl_relaxed(vfe->base + VFE_0_IRQ_STATUS_1);
> -
> -       writel_relaxed(*value0, vfe->base + VFE_0_IRQ_CLEAR_0);
> -       writel_relaxed(*value1, vfe->base + VFE_0_IRQ_CLEAR_1);
> -
> -       /* Enforce barrier between local & global IRQ clear */
> -       wmb();
> -       writel_relaxed(VFE_0_IRQ_CMD_GLOBAL_CLEAR, vfe->base + VFE_0_IRQ_CMD);
> -}
> -
>  /*
>   * vfe_pm_domain_off - Disable power domains specific to this VFE.
>   * @vfe: VFE Device
> @@ -1125,13 +1132,6 @@ static int vfe_pm_domain_on(struct vfe_device *vfe)
>         return 0;
>  }
>
> -static void vfe_violation_read(struct vfe_device *vfe)
> -{
> -       u32 violation = readl_relaxed(vfe->base + VFE_0_VIOLATION_STATUS);
> -
> -       pr_err_ratelimited("VFE: violation = 0x%08x\n", violation);
> -}
> -
>  static const struct vfe_hw_ops_gen1 vfe_ops_gen1_4_8 = {
>         .bus_connect_wm_to_rdi = vfe_bus_connect_wm_to_rdi,
>         .bus_disconnect_wm_from_rdi = vfe_bus_disconnect_wm_from_rdi,
> @@ -1167,11 +1167,12 @@ static const struct vfe_hw_ops_gen1 vfe_ops_gen1_4_8 = {
>         .wm_set_pong_addr = vfe_wm_set_pong_addr,
>         .wm_set_subsample = vfe_wm_set_subsample,
>         .wm_set_ub_cfg = vfe_wm_set_ub_cfg,
> +       .reg_update_clear = vfe_reg_update_clear,
> +       .reg_update = vfe_reg_update,
>  };
>
>  static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  {
> -       vfe->isr_ops = vfe_isr_ops_gen1;
>         vfe->ops_gen1 = &vfe_ops_gen1_4_8;
>         vfe->video_ops = vfe_video_ops_gen1;
>
> @@ -1181,15 +1182,11 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
>  const struct vfe_hw_ops vfe_ops_4_8 = {
>         .global_reset = vfe_global_reset,
>         .hw_version_read = vfe_hw_version_read,
> -       .isr_read = vfe_isr_read,
>         .isr = vfe_isr,
>         .pm_domain_off = vfe_pm_domain_off,
>         .pm_domain_on = vfe_pm_domain_on,
> -       .reg_update_clear = vfe_reg_update_clear,
> -       .reg_update = vfe_reg_update,
>         .subdev_init = vfe_subdev_init,
>         .vfe_disable = vfe_gen1_disable,
>         .vfe_enable = vfe_gen1_enable,
>         .vfe_halt = vfe_gen1_halt,
> -       .violation_read = vfe_violation_read,
>  };
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen1.c b/drivers/media/platform/qcom/camss/camss-vfe-gen1.c
> index 4fd265d018834..2c0cd14bbdf8e 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-gen1.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen1.c
> @@ -37,7 +37,6 @@ static int vfe_disable_output(struct vfe_line *line)
>  {
>         struct vfe_device *vfe = to_vfe(line);
>         struct vfe_output *output = &line->output;
> -       const struct vfe_hw_ops *ops = vfe->ops;
>         unsigned long flags;
>         unsigned long time;
>         unsigned int i;
> @@ -55,7 +54,7 @@ static int vfe_disable_output(struct vfe_line *line)
>         for (i = 0; i < output->wm_num; i++)
>                 vfe->ops_gen1->wm_enable(vfe, output->wm_idx[i], 0);
>
> -       ops->reg_update(vfe, line->id);
> +       vfe->ops_gen1->reg_update(vfe, line->id);
>         output->wait_reg_update = 1;
>         spin_unlock_irqrestore(&vfe->output_lock, flags);
>
> @@ -162,21 +161,21 @@ static void vfe_output_frame_drop(struct vfe_device *vfe,
>                 vfe->ops_gen1->wm_set_framedrop_pattern(vfe, output->wm_idx[i], drop_pattern);
>         }
>
> -       vfe->ops->reg_update(vfe, container_of(output, struct vfe_line, output)->id);
> +       vfe->ops_gen1->reg_update(vfe, container_of(output, struct vfe_line, output)->id);
>  }
>
>  static int vfe_enable_output(struct vfe_line *line)
>  {
>         struct vfe_device *vfe = to_vfe(line);
>         struct vfe_output *output = &line->output;
> -       const struct vfe_hw_ops *ops = vfe->ops;
> +       const struct vfe_hw_ops_gen1 *ops = vfe->ops_gen1;
>         struct media_entity *sensor;
>         unsigned long flags;
>         unsigned int frame_skip = 0;
>         unsigned int i;
>         u16 ub_size;
>
> -       ub_size = vfe->ops_gen1->get_ub_size(vfe->id);
> +       ub_size = ops->get_ub_size(vfe->id);
>         if (!ub_size)
>                 return -EINVAL;
>
> @@ -236,38 +235,38 @@ static int vfe_enable_output(struct vfe_line *line)
>         vfe_output_init_addrs(vfe, output, 0, line);
>
>         if (line->id != VFE_LINE_PIX) {
> -               vfe->ops_gen1->set_cgc_override(vfe, output->wm_idx[0], 1);
> -               vfe->ops_gen1->enable_irq_wm_line(vfe, output->wm_idx[0], line->id, 1);
> -               vfe->ops_gen1->bus_connect_wm_to_rdi(vfe, output->wm_idx[0], line->id);
> -               vfe->ops_gen1->wm_set_subsample(vfe, output->wm_idx[0]);
> -               vfe->ops_gen1->set_rdi_cid(vfe, line->id, 0);
> -               vfe->ops_gen1->wm_set_ub_cfg(vfe, output->wm_idx[0],
> +               ops->set_cgc_override(vfe, output->wm_idx[0], 1);
> +               ops->enable_irq_wm_line(vfe, output->wm_idx[0], line->id, 1);
> +               ops->bus_connect_wm_to_rdi(vfe, output->wm_idx[0], line->id);
> +               ops->wm_set_subsample(vfe, output->wm_idx[0]);
> +               ops->set_rdi_cid(vfe, line->id, 0);
> +               ops->wm_set_ub_cfg(vfe, output->wm_idx[0],
>                                             (ub_size + 1) * output->wm_idx[0], ub_size);
> -               vfe->ops_gen1->wm_frame_based(vfe, output->wm_idx[0], 1);
> -               vfe->ops_gen1->wm_enable(vfe, output->wm_idx[0], 1);
> -               vfe->ops_gen1->bus_reload_wm(vfe, output->wm_idx[0]);
> +               ops->wm_frame_based(vfe, output->wm_idx[0], 1);
> +               ops->wm_enable(vfe, output->wm_idx[0], 1);
> +               ops->bus_reload_wm(vfe, output->wm_idx[0]);
>         } else {
>                 ub_size /= output->wm_num;
>                 for (i = 0; i < output->wm_num; i++) {
> -                       vfe->ops_gen1->set_cgc_override(vfe, output->wm_idx[i], 1);
> -                       vfe->ops_gen1->wm_set_subsample(vfe, output->wm_idx[i]);
> -                       vfe->ops_gen1->wm_set_ub_cfg(vfe, output->wm_idx[i],
> +                       ops->set_cgc_override(vfe, output->wm_idx[i], 1);
> +                       ops->wm_set_subsample(vfe, output->wm_idx[i]);
> +                       ops->wm_set_ub_cfg(vfe, output->wm_idx[i],
>                                                      (ub_size + 1) * output->wm_idx[i], ub_size);
> -                       vfe->ops_gen1->wm_line_based(vfe, output->wm_idx[i],
> +                       ops->wm_line_based(vfe, output->wm_idx[i],
>                                                      &line->video_out.active_fmt.fmt.pix_mp, i, 1);
> -                       vfe->ops_gen1->wm_enable(vfe, output->wm_idx[i], 1);
> -                       vfe->ops_gen1->bus_reload_wm(vfe, output->wm_idx[i]);
> +                       ops->wm_enable(vfe, output->wm_idx[i], 1);
> +                       ops->bus_reload_wm(vfe, output->wm_idx[i]);
>                 }
> -               vfe->ops_gen1->enable_irq_pix_line(vfe, 0, line->id, 1);
> -               vfe->ops_gen1->set_module_cfg(vfe, 1);
> -               vfe->ops_gen1->set_camif_cfg(vfe, line);
> -               vfe->ops_gen1->set_realign_cfg(vfe, line, 1);
> -               vfe->ops_gen1->set_xbar_cfg(vfe, output, 1);
> -               vfe->ops_gen1->set_demux_cfg(vfe, line);
> -               vfe->ops_gen1->set_scale_cfg(vfe, line);
> -               vfe->ops_gen1->set_crop_cfg(vfe, line);
> -               vfe->ops_gen1->set_clamp_cfg(vfe);
> -               vfe->ops_gen1->set_camif_cmd(vfe, 1);
> +               ops->enable_irq_pix_line(vfe, 0, line->id, 1);
> +               ops->set_module_cfg(vfe, 1);
> +               ops->set_camif_cfg(vfe, line);
> +               ops->set_realign_cfg(vfe, line, 1);
> +               ops->set_xbar_cfg(vfe, output, 1);
> +               ops->set_demux_cfg(vfe, line);
> +               ops->set_scale_cfg(vfe, line);
> +               ops->set_crop_cfg(vfe, line);
> +               ops->set_clamp_cfg(vfe);
> +               ops->set_camif_cmd(vfe, 1);
>         }
>
>         ops->reg_update(vfe, line->id);
> @@ -508,7 +507,7 @@ static void vfe_buf_update_wm_on_new(struct vfe_device *vfe,
>   * vfe_isr_halt_ack - Process halt ack
>   * @vfe: VFE Device
>   */
> -static void vfe_isr_halt_ack(struct vfe_device *vfe)
> +void vfe_gen1_isr_halt_ack(struct vfe_device *vfe)
>  {
>         complete(&vfe->halt_complete);
>         vfe->ops_gen1->halt_clear(vfe);
> @@ -519,7 +518,7 @@ static void vfe_isr_halt_ack(struct vfe_device *vfe)
>   * @vfe: VFE Device
>   * @line_id: VFE line
>   */
> -static void vfe_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id)
> +void vfe_gen1_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id)
>  {
>         struct vfe_output *output;
>         unsigned long flags;
> @@ -538,14 +537,14 @@ static void vfe_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id)
>   * @vfe: VFE Device
>   * @line_id: VFE line
>   */
> -static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
> +void vfe_gen1_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
>  {
>         struct vfe_output *output;
>         struct vfe_line *line = &vfe->line[line_id];
>         unsigned long flags;
>
>         spin_lock_irqsave(&vfe->output_lock, flags);
> -       vfe->ops->reg_update_clear(vfe, line_id);
> +       vfe->ops_gen1->reg_update_clear(vfe, line_id);
>
>         output = &line->output;
>
> @@ -605,7 +604,7 @@ static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
>   * @vfe: VFE Device
>   * @wm: Write master id
>   */
> -static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm)
> +void vfe_gen1_isr_wm_done(struct vfe_device *vfe, u8 wm)
>  {
>         struct camss_buffer *ready_buf;
>         struct vfe_output *output;
> @@ -675,6 +674,22 @@ static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm)
>         spin_unlock_irqrestore(&vfe->output_lock, flags);
>  }
>
> +/**
> + * vfe_isr_comp_done() - Process composite image done interrupt
> + * @vfe: VFE Device
> + * @comp: Composite image id
> + */
> +void vfe_gen1_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) {
> +                       vfe_gen1_isr_wm_done(vfe, i);
> +                       break;
> +               }
> +}
> +
>  /*
>   * vfe_queue_buffer - Add empty buffer
>   * @vid: Video device structure
> @@ -727,15 +742,6 @@ int vfe_word_per_line(u32 format, u32 width)
>         return val;
>  }
>
> -const struct vfe_isr_ops vfe_isr_ops_gen1 = {
> -       .reset_ack = vfe_isr_reset_ack,
> -       .halt_ack = vfe_isr_halt_ack,
> -       .reg_update = vfe_isr_reg_update,
> -       .sof = vfe_isr_sof,
> -       .comp_done = vfe_isr_comp_done,
> -       .wm_done = vfe_isr_wm_done,
> -};
> -
>  const struct camss_video_ops vfe_video_ops_gen1 = {
>         .queue_buffer = vfe_queue_buffer,
>         .flush_buffers = vfe_flush_buffers,
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen1.h b/drivers/media/platform/qcom/camss/camss-vfe-gen1.h
> index 6d5f9656562c8..2619df66aa713 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-gen1.h
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen1.h
> @@ -55,6 +55,9 @@ struct vfe_hw_ops_gen1 {
>         void (*wm_set_pong_addr)(struct vfe_device *vfe, u8 wm, u32 addr);
>         int (*wm_get_ping_pong_status)(struct vfe_device *vfe, u8 wm);
>         void (*wm_enable)(struct vfe_device *vfe, u8 wm, u8 enable);
> +       void (*reg_update)(struct vfe_device *vfe, enum vfe_line_id line_id);
> +       void (*reg_update_clear)(struct vfe_device *vfe,
> +                                enum vfe_line_id line_id);
>  };
>
>  /*
> @@ -95,13 +98,47 @@ int vfe_gen1_disable(struct vfe_line *line);
>  int vfe_gen1_enable(struct vfe_line *line);
>
>  /*
> - * vfe_gen1_enable - Halt VFE module
> + * vfe_gen1_halt - Halt VFE module
>   * @vfe: VFE device
>   *
>   * Return 0 on success
>   */
>  int vfe_gen1_halt(struct vfe_device *vfe);
>
> +/*
> + * vfe_gen1_isr_halt_ack - Process halt ack
> + * @vfe: VFE Device
> + */
> +void vfe_gen1_isr_halt_ack(struct vfe_device *vfe);
> +
> +/*
> + * vfe_gen1_isr_sof - Process start of frame interrupt
> + * @vfe: VFE Device
> + * @line_id: VFE line
> + */
> +void vfe_gen1_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id);
> +
> +/*
> + * vfe_gen1_reg_update - Process reg update interrupt
> + * @vfe: VFE Device
> + * @line_id: VFE line
> + */
> +void vfe_gen1_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id);
> +
> +/*
> + * vfe_gen1_isr_wm_done - Process write master done interrupt
> + * @vfe: VFE Device
> + * @wm: Write master id
> + */
> +void vfe_gen1_isr_wm_done(struct vfe_device *vfe, u8 wm);
> +
> +/**
> + * vfe_gen1_isr_comp_done() - Process composite image done interrupt
> + * @vfe: VFE Device
> + * @comp: Composite image id
> + */
> +void vfe_gen1_isr_comp_done(struct vfe_device *vfe, u8 comp);
> +
>  /*
>   * vfe_word_per_line - Calculate number of words per frame width
>   * @format: V4L2 format
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
> index dec89079c6ae4..3e467034710b9 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c
> @@ -405,22 +405,6 @@ int vfe_put_output(struct vfe_line *line)
>         return 0;
>  }
>
> -/**
> - * vfe_isr_comp_done() - Process composite image done interrupt
> - * @vfe: VFE Device
> - * @comp: Composite image id
> - */
> -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) {
> -                       vfe->isr_ops.wm_done(vfe, i);
> -                       break;
> -               }
> -}
> -
>  void vfe_isr_reset_ack(struct vfe_device *vfe)
>  {
>         complete(&vfe->reset_complete);
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h
> index 844b9275031d9..97a1361996308 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.h
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.h
> @@ -101,30 +101,15 @@ struct vfe_line {
>  struct vfe_device;
>
>  struct vfe_hw_ops {
> -       void (*enable_irq_common)(struct vfe_device *vfe);
>         void (*global_reset)(struct vfe_device *vfe);
>         void (*hw_version_read)(struct vfe_device *vfe, struct device *dev);
>         irqreturn_t (*isr)(int irq, void *dev);
> -       void (*isr_read)(struct vfe_device *vfe, u32 *value0, u32 *value1);
>         void (*pm_domain_off)(struct vfe_device *vfe);
>         int (*pm_domain_on)(struct vfe_device *vfe);
> -       void (*reg_update)(struct vfe_device *vfe, enum vfe_line_id line_id);
> -       void (*reg_update_clear)(struct vfe_device *vfe,
> -                                enum vfe_line_id line_id);
>         void (*subdev_init)(struct device *dev, struct vfe_device *vfe);
>         int (*vfe_disable)(struct vfe_line *line);
>         int (*vfe_enable)(struct vfe_line *line);
>         int (*vfe_halt)(struct vfe_device *vfe);
> -       void (*violation_read)(struct vfe_device *vfe);
> -};
> -
> -struct vfe_isr_ops {
> -       void (*reset_ack)(struct vfe_device *vfe);
> -       void (*halt_ack)(struct vfe_device *vfe);
> -       void (*reg_update)(struct vfe_device *vfe, enum vfe_line_id line_id);
> -       void (*sof)(struct vfe_device *vfe, enum vfe_line_id line_id);
> -       void (*comp_done)(struct vfe_device *vfe, u8 comp);
> -       void (*wm_done)(struct vfe_device *vfe, u8 wm);
>  };
>
>  struct vfe_device {
> @@ -149,7 +134,6 @@ struct vfe_device {
>         u8 was_streaming;
>         const struct vfe_hw_ops *ops;
>         const struct vfe_hw_ops_gen1 *ops_gen1;
> -       struct vfe_isr_ops isr_ops;
>         struct camss_video_ops video_ops;
>  };
>

With the kernel test robot complaint fixed, I'm happy with this patch.

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Andrey Konovalov June 16, 2021, 6:16 p.m. UTC | #7
Hi Jonathan,

I've given this patchset a try on RB3 board (SDM845) with ov8856 camera sensor - works OK,
no regressions.

Thanks,
Andrey

On 09.06.2021 01:34, Jonathan Marek wrote:
> This adds initial support for SM8250 and its 4 VFEs and 6 CSIPHYs.
> The only big change is the added camss-vfe-480.c to support the
> Titan 480 VFE.
> 
> v2:
>   - Fixed some typos in commit messages (patches 02 and 08)
>   - patch 03 ("media: camss: csiphy-3ph: add support for SM8250 CSI DPHY"):
>     - moved definition of CAMSS_8250 to this patch,
>     - removed unused lane_enable variable
>     - added a default unreachable case to avoid a warning
>     - added a is_gen2 variable (minor rework)
>   - Undo DECODE_FORMAT_PAYLOAD_ONLY change, add comment instead (patch 04)
>   - "ops" reworks in addition to removing dead code (patch 12)
>   - renamed csid-170 to csid-gen2, added defines for offsets, add missing
>     camnoc_axi clock to sm8250 vfe resources (patch 16/17)
> 
> Jonathan Marek (17):
>    media: camss: csiphy-3ph: don't print HW version as an error
>    media: camss: csiphy-3ph: disable interrupts
>    media: camss: csiphy-3ph: add support for SM8250 CSI DPHY
>    media: camss: csid-170: fix non-10bit formats
>    media: camss: csid-170: don't enable unused irqs
>    media: camss: csid-170: remove stray comment
>    media: camss: csid-170: support more than one lite vfe
>    media: camss: csid-170: set the right HALT_CMD when disabled
>    media: camss: csid: allow csid to work without a regulator
>    media: camss: remove vdda-csiN from sdm845 resources
>    media: camss: fix VFE irq name
>    media: camss: remove some vfe ops and clean up dead vfe-170 code
>    media: camss: vfe-170: fix "VFE halt timeout" error
>    media: camss: Add initial support for VFE hardware version Titan 480
>    media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW
>    media: camss: add support for SM8250 camss
>    media: dt-bindings: media: camss: Add qcom,sm8250-camss binding
> 
>   .../bindings/media/qcom,sm8250-camss.yaml     | 399 +++++++++++++
>   drivers/media/platform/qcom/camss/Makefile    |   3 +-
>   .../{camss-csid-170.c => camss-csid-gen2.c}   |  32 +-
>   .../media/platform/qcom/camss/camss-csid.c    |  45 +-
>   .../media/platform/qcom/camss/camss-csid.h    |   2 +-
>   .../qcom/camss/camss-csiphy-3ph-1-0.c         | 184 ++++--
>   .../media/platform/qcom/camss/camss-csiphy.c  |   9 +-
>   .../media/platform/qcom/camss/camss-vfe-170.c | 101 +---
>   .../media/platform/qcom/camss/camss-vfe-4-1.c |  25 +-
>   .../media/platform/qcom/camss/camss-vfe-4-7.c |  63 +-
>   .../media/platform/qcom/camss/camss-vfe-4-8.c |  65 +--
>   .../media/platform/qcom/camss/camss-vfe-480.c | 545 ++++++++++++++++++
>   .../platform/qcom/camss/camss-vfe-gen1.c      |  94 +--
>   .../platform/qcom/camss/camss-vfe-gen1.h      |  39 +-
>   drivers/media/platform/qcom/camss/camss-vfe.c |  29 +-
>   drivers/media/platform/qcom/camss/camss-vfe.h |  17 +-
>   .../media/platform/qcom/camss/camss-video.c   |   5 +-
>   drivers/media/platform/qcom/camss/camss.c     | 205 ++++++-
>   drivers/media/platform/qcom/camss/camss.h     |   1 +
>   19 files changed, 1523 insertions(+), 340 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml
>   rename drivers/media/platform/qcom/camss/{camss-csid-170.c => camss-csid-gen2.c} (95%)
>   create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-480.c
>