Linux Media Controller development
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: bingbu.cao@intel.com, linux-media@vger.kernel.org,
	laurent.pinchart@ideasonboard.com,
	andriy.shevchenko@linux.intel.com, ilpo.jarvinen@linux.intel.com,
	claus.stovgaard@gmail.com, tomi.valkeinen@ideasonboard.com,
	tfiga@chromium.org, senozhatsky@chromium.org,
	andreaskleist@gmail.com, bingbu.cao@linux.intel.com,
	tian.shu.qiu@intel.com, hongju.wang@intel.com
Subject: Re: [PATCH v3 01/17] media: intel/ipu6: add Intel IPU6 PCI device driver
Date: Mon, 15 Jan 2024 13:45:12 +0000	[thread overview]
Message-ID: <ZaU26ASJG2wNCuYZ@kekkonen.localdomain> (raw)
In-Reply-To: <e16874f9-cc9b-405f-9618-3f955e205f42@redhat.com>

Hi Hans,

On Mon, Jan 15, 2024 at 02:36:43PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 1/11/24 07:55, bingbu.cao@intel.com wrote:
> > From: Bingbu Cao <bingbu.cao@intel.com>
> > 
> > Intel Image Processing Unit 6th Gen includes input and processing systems
> > but the hardware presents itself as a single PCI device in system.
> > 
> > IPU6 PCI device driver basically does PCI configurations and load
> > the firmware binary, initialises IPU virtual bus, and sets up platform
> > specific variants to support multiple IPU6 devices in single device
> > driver.
> > 
> > Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
> 
> Just one small thing I noticed, not a full review.
> 
> <snip>
> 
> > +static u32 ipu6se_csi_offsets[] = {
> > +	IPU6_CSI_PORT_A_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_B_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_C_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_D_ADDR_OFFSET
> > +};
> > +
> > +/*
> > + * IPU6 on TGL support maximum 8 csi2 ports
> > + * IPU6SE on JSL and IPU6EP on ADL support maximum 4 csi2 ports
> > + * IPU6EP on MTL support maximum 6 csi2 ports
> > + */
> > +static u32 ipu6_tgl_csi_offsets[] = {
> > +	IPU6_CSI_PORT_A_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_B_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_C_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_D_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_E_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_F_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_G_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_H_ADDR_OFFSET
> > +};
> > +
> > +static u32 ipu6ep_mtl_csi_offsets[] = {
> > +	IPU6_CSI_PORT_A_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_B_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_C_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_D_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_E_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_F_ADDR_OFFSET
> > +};
> > +
> > +static u32 ipu6_csi_offsets[] = {
> > +	IPU6_CSI_PORT_A_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_B_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_C_ADDR_OFFSET,
> > +	IPU6_CSI_PORT_D_ADDR_OFFSET
> > +};
> 
> These 4 arrays all are the same, except for their lengths.
> 
> Please just use a single array wuth the full 8 A-H
> entries and then just directly code the amount of ports
> here:
> 
> > +static void ipu6_internal_pdata_init(struct ipu6_device *isp)
> > +{
> <snip>
> 
> > +	isys_ipdata.csi2.nports = ARRAY_SIZE(ipu6_csi_offsets);
> 
> So put the default 4 here instead of ARRAY_SIZE(),
> 
> <snip>
> 
> > +	if (is_ipu6_tgl(hw_ver)) {
> > +		isys_ipdata.csi2.nports = ARRAY_SIZE(ipu6_tgl_csi_offsets);
> 
> and then put 8 here instead of ARRAY_SIZE(), etc.
> 
> Then there no longer is a need to have 4 different arrays just
> to have them a different lenght.

Instead of having these arrays at all, you could directly use CSI_REG_BASE
+ CSI_REG_BASE_PORT(port_number) as the base address. There's only need to
store nr_of_ports in that case.

I'd prefer adding a macro for the numbers of ports on various devices, if
the information remains embedded in a function (rather than the big device
description elsewhere).

> 
> And this line:
> 
> > +		isys_ipdata.csi2.offsets = ipu6_tgl_csi_offsets;
> 
> Can then be fully dropped as well as similar lines below.
> 
> 
> > +	}
> > +
> > +	if (is_ipu6ep_mtl(hw_ver)) {
> > +		isys_ipdata.csi2.nports = ARRAY_SIZE(ipu6ep_mtl_csi_offsets);
> > +		isys_ipdata.csi2.offsets = ipu6ep_mtl_csi_offsets;
> 
> E.g. this one can also be dropped.

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2024-01-15 13:45 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  6:55 [PATCH v3 00/15] Intel IPU6 and IPU6 input system drivers bingbu.cao
2024-01-11  6:55 ` [PATCH v3 01/17] media: intel/ipu6: add Intel IPU6 PCI device driver bingbu.cao
2024-01-15 13:36   ` Hans de Goede
2024-01-15 13:45     ` Sakari Ailus [this message]
2024-01-11  6:55 ` [PATCH v3 02/17] media: intel/ipu6: add IPU auxiliary devices bingbu.cao
2024-01-11  6:55 ` [PATCH v3 03/17] media: intel/ipu6: add IPU6 buttress interface driver bingbu.cao
2024-01-11  6:55 ` [PATCH v3 04/17] media: intel/ipu6: CPD parsing for get firmware components bingbu.cao
2024-01-11  6:55 ` [PATCH v3 05/17] media: intel/ipu6: add IPU6 DMA mapping API and MMU table bingbu.cao
2024-01-11  6:55 ` [PATCH v3 06/17] media: intel/ipu6: add syscom interfaces between firmware and driver bingbu.cao
2024-01-11  6:55 ` [PATCH v3 07/17] media: intel/ipu6: input system ABI " bingbu.cao
2024-01-15 12:17   ` Sakari Ailus
2024-01-11  6:55 ` [PATCH v3 08/17] media: intel/ipu6: add IPU6 CSI2 receiver v4l2 sub-device bingbu.cao
2024-01-11  6:55 ` [PATCH v3 09/17] media: intel/ipu6: add the CSI2 DPHY implementation bingbu.cao
2024-01-11  6:55 ` [PATCH v3 10/17] media: intel/ipu6: add input system driver bingbu.cao
2024-01-11 14:05   ` Sakari Ailus
2024-02-07  9:36   ` Andreas Helbech Kleist
2024-02-12 18:31     ` Sakari Ailus
2024-02-15  6:43       ` Andreas Helbech Kleist
2024-02-15  8:06         ` Sakari Ailus
2024-01-11  6:55 ` [PATCH v3 11/17] media: intel/ipu6: input system video capture nodes bingbu.cao
2024-03-08  9:58   ` Andreas Helbech Kleist
2024-01-11  6:55 ` [PATCH v3 12/17] media: add Kconfig and Makefile for IPU6 bingbu.cao
2024-01-11  6:55 ` [PATCH v3 13/17] MAINTAINERS: add maintainers for Intel IPU6 input system driver bingbu.cao
2024-01-11  6:55 ` [PATCH v3 14/17] Documentation: add Intel IPU6 ISYS driver admin-guide doc bingbu.cao
2024-01-11  6:55 ` [PATCH v3 15/17] Documentation: add documentation of Intel IPU6 driver and hardware overview bingbu.cao
2024-01-11  6:55 ` [PATCH v3 16/17] media: ipu6/isys: support line-based metadata capture support bingbu.cao
2024-01-11 12:52   ` Sakari Ailus
2024-01-11 21:20   ` kernel test robot
2024-01-12  3:31   ` kernel test robot
2024-01-11  6:55 ` [PATCH v3 17/17] media: ipu6/isys: support new v4l2 subdev state APIs bingbu.cao
2024-01-11 12:37   ` Sakari Ailus
2024-01-16 16:12 ` [PATCH v3 00/15] Intel IPU6 and IPU6 input system drivers Hans de Goede
2024-01-16 16:18   ` Laurent Pinchart
2024-01-16 16:38     ` Hans de Goede
2024-01-16 16:42       ` Laurent Pinchart
2024-01-16 16:43         ` Hans de Goede
2024-01-16 16:54   ` Sakari Ailus
2024-01-16 16:57     ` Hans de Goede
2024-01-16 17:48       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZaU26ASJG2wNCuYZ@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=andreaskleist@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=claus.stovgaard@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=hongju.wang@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=tian.shu.qiu@intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox