public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: bingbu.cao@intel.com
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
	andriy.shevchenko@linux.intel.com, hdegoede@redhat.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 17/17] media: ipu6/isys: support new v4l2 subdev state APIs
Date: Thu, 11 Jan 2024 12:37:37 +0000	[thread overview]
Message-ID: <ZZ_hEdib8KMf_vvo@kekkonen.localdomain> (raw)
In-Reply-To: <20240111065531.2418836-18-bingbu.cao@intel.com>

Hi Bingbu,

On Thu, Jan 11, 2024 at 02:55:31PM +0800, bingbu.cao@intel.com wrote:
> From: Bingbu Cao <bingbu.cao@intel.com>
> 
> Add support for the upcoming v4l2-subdev API changes in kernel 6.8.
> This patch is based on Sakari's branch:
> <URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata>

These changes should be squashed to the preceding patches, the driver
currently won't compile without this patch.

> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
> ---
>  drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c |  8 +++-----
>  .../media/pci/intel/ipu6/ipu6-isys-subdev.c   | 19 +++++++++++--------
>  .../media/pci/intel/ipu6/ipu6-isys-subdev.h   |  2 --
>  .../media/pci/intel/ipu6/ipu6-isys-video.c    |  3 +--
>  4 files changed, 15 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> index a6430d531129..6f258cf92fc1 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> @@ -403,12 +403,11 @@ static int ipu6_isys_csi2_set_sel(struct v4l2_subdev *sd,
>  	if (!sink_ffmt)
>  		return -EINVAL;
>  
> -	src_ffmt = v4l2_subdev_state_get_stream_format(state, sel->pad,
> -						       sel->stream);
> +	src_ffmt = v4l2_subdev_state_get_format(state, sel->pad, sel->stream);
>  	if (!src_ffmt)
>  		return -EINVAL;
>  
> -	crop = v4l2_subdev_state_get_stream_crop(state, sel->pad, sel->stream);
> +	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
>  	if (!crop)
>  		return -EINVAL;
>  
> @@ -453,7 +452,7 @@ static int ipu6_isys_csi2_get_sel(struct v4l2_subdev *sd,
>  	if (!sink_ffmt)
>  		return -EINVAL;
>  
> -	crop = v4l2_subdev_state_get_stream_crop(state, sel->pad, sel->stream);
> +	crop = v4l2_subdev_state_get_crop(state, sel->pad, sel->stream);
>  	if (!crop)
>  		return -EINVAL;
>  
> @@ -480,7 +479,6 @@ static const struct v4l2_subdev_video_ops csi2_sd_video_ops = {
>  };
>  
>  static const struct v4l2_subdev_pad_ops csi2_sd_pad_ops = {
> -	.init_cfg = ipu6_isys_subdev_init_cfg,
>  	.get_fmt = v4l2_subdev_get_fmt,
>  	.set_fmt = ipu6_isys_subdev_set_fmt,
>  	.get_selection = ipu6_isys_csi2_get_sel,
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c b/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c
> index 3c9263ac02a3..aeccd6f93986 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c
> @@ -156,8 +156,7 @@ int ipu6_isys_subdev_set_fmt(struct v4l2_subdev *sd,
>  	format->format.field = V4L2_FIELD_NONE;
>  
>  	/* Store the format and propagate it to the source pad. */
> -	fmt = v4l2_subdev_state_get_stream_format(state, format->pad,
> -						  format->stream);
> +	fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
>  	if (!fmt)
>  		return -EINVAL;
>  
> @@ -182,8 +181,7 @@ int ipu6_isys_subdev_set_fmt(struct v4l2_subdev *sd,
>  	if (ret)
>  		return -EINVAL;
>  
> -	crop = v4l2_subdev_state_get_stream_crop(state, other_pad,
> -						 other_stream);
> +	crop = v4l2_subdev_state_get_crop(state, other_pad, other_stream);
>  	/* reset crop */
>  	crop->left = 0;
>  	crop->top = 0;
> @@ -241,7 +239,7 @@ int ipu6_isys_get_stream_pad_fmt(struct v4l2_subdev *sd, u32 pad, u32 stream,
>  		return -EINVAL;
>  
>  	state = v4l2_subdev_lock_and_get_active_state(sd);
> -	fmt = v4l2_subdev_state_get_stream_format(state, pad, stream);
> +	fmt = v4l2_subdev_state_get_format(state, pad, stream);
>  	if (fmt)
>  		*format = *fmt;
>  	v4l2_subdev_unlock_state(state);
> @@ -259,7 +257,7 @@ int ipu6_isys_get_stream_pad_crop(struct v4l2_subdev *sd, u32 pad, u32 stream,
>  		return -EINVAL;
>  
>  	state = v4l2_subdev_lock_and_get_active_state(sd);
> -	rect = v4l2_subdev_state_get_stream_crop(state, pad, stream);
> +	rect = v4l2_subdev_state_get_crop(state, pad, stream);
>  	if (rect)
>  		*crop = *rect;
>  	v4l2_subdev_unlock_state(state);
> @@ -291,8 +289,8 @@ u32 ipu6_isys_get_src_stream_by_src_pad(struct v4l2_subdev *sd, u32 pad)
>  	return source_stream;
>  }
>  
> -int ipu6_isys_subdev_init_cfg(struct v4l2_subdev *sd,
> -			      struct v4l2_subdev_state *state)
> +static int ipu6_isys_subdev_init_state(struct v4l2_subdev *sd,
> +				       struct v4l2_subdev_state *state)
>  {
>  	struct v4l2_subdev_route route = {
>  		.sink_pad = 0,
> @@ -317,6 +315,10 @@ int ipu6_isys_subdev_set_routing(struct v4l2_subdev *sd,
>  	return subdev_set_routing(sd, state, routing);
>  }
>  
> +static const struct v4l2_subdev_internal_ops ipu6_isys_subdev_internal_ops = {
> +	.init_state = ipu6_isys_subdev_init_state,
> +};
> +
>  int ipu6_isys_subdev_init(struct ipu6_isys_subdev *asd,
>  			  const struct v4l2_subdev_ops *ops,
>  			  unsigned int nr_ctrls,
> @@ -334,6 +336,7 @@ int ipu6_isys_subdev_init(struct ipu6_isys_subdev *asd,
>  			 V4L2_SUBDEV_FL_STREAMS;
>  	asd->sd.owner = THIS_MODULE;
>  	asd->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
> +	asd->sd.internal_ops = &ipu6_isys_subdev_internal_ops;
>  
>  	asd->pad = devm_kcalloc(&asd->isys->adev->auxdev.dev, num_pads,
>  				sizeof(*asd->pad), GFP_KERNEL);
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.h b/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.h
> index adea2a55761d..f4e32b094b5b 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.h
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-subdev.h
> @@ -46,8 +46,6 @@ int ipu6_isys_get_stream_pad_fmt(struct v4l2_subdev *sd, u32 pad, u32 stream,
>  				 struct v4l2_mbus_framefmt *format);
>  int ipu6_isys_get_stream_pad_crop(struct v4l2_subdev *sd, u32 pad, u32 stream,
>  				  struct v4l2_rect *crop);
> -int ipu6_isys_subdev_init_cfg(struct v4l2_subdev *sd,
> -			      struct v4l2_subdev_state *state);
>  int ipu6_isys_subdev_set_routing(struct v4l2_subdev *sd,
>  				 struct v4l2_subdev_state *state,
>  				 enum v4l2_subdev_format_whence which,
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> index 1a023bf1e1a6..62d4043fc2a1 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
> @@ -389,8 +389,7 @@ static int link_validate(struct media_link *link)
>  
>  	v4l2_subdev_lock_state(s_state);
>  
> -	s_fmt = v4l2_subdev_state_get_stream_format(s_state, s_pad->index,
> -						    s_stream);
> +	s_fmt = v4l2_subdev_state_get_format(s_state, s_pad->index, s_stream);
>  	if (!s_fmt) {
>  		dev_err(dev, "failed to get source pad format\n");
>  		goto unlock;

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2024-01-11 12:37 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
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 [this message]
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=ZZ_hEdib8KMf_vvo@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