From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FF414A24; Thu, 26 Sep 2024 17:48:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727372908; cv=none; b=YCQFD+/K2g78+dGFxcyDRr2mD/8tSPgnel2ky18h+ydXkjb+gvKIjHj1F4vPw1/+JlA8yWXPLh427s8VE1mJocFTaEILezsPpK0Z/eA0pqPQoBH5/3JaCZMM3m3yV13Cu33CHgQ770HGMdZ0PmaBsuDAKyx4SdnoJQTtKegEs+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727372908; c=relaxed/simple; bh=GqLH4dC8Wk7BOLguF4xiTuSKGoyO7U82IHOcy3yXBCE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AOsXX1pC5uWQCKsJ2rubwQdqQwtQDFclQB5Zs16bXaJ3nLGx35vdNV46+jnJz4QzDXORKZRTGjXUljTDQeOxZbbWQvepFLmNM7hnXpXoGwMthFs32qnYncUFTTrwYt5I8SvdAI1jhDVaU3wtn/yq8lT3LBQKgYZCMuOxpTf1L6Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=uzqXQvja; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uzqXQvja" Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7658E163; Thu, 26 Sep 2024 19:46:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727372813; bh=GqLH4dC8Wk7BOLguF4xiTuSKGoyO7U82IHOcy3yXBCE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uzqXQvjaPSRAQUGls3RL8ziGEY1+tU4SRdEp6aLdU821q78nuw0QJfrcnhSUP+jaC u/Zxc5nLxDbWO17cVZkH47a4gjmGk4H4KYtPopKhIDoOFdhOnWgx7I7CMiW0acUNDP A6bBds09S2i0BmNPQ/9RqFxMXUU+jq4Vm+5FaPm4= Date: Thu, 26 Sep 2024 20:48:19 +0300 From: Laurent Pinchart To: Sakari Ailus Cc: Prabhakar , Kieran Bingham , Tomi Valkeinen , Jacopo Mondi , Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Biju Das , Fabrizio Castro , Lad Prabhakar Subject: Re: [PATCH v2 11/11] media: i2c: ov5645: Report streams using frame descriptors Message-ID: <20240926174819.GK21788@pendragon.ideasonboard.com> References: <20240910170610.226189-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20240910170610.226189-12-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Sep 26, 2024 at 03:45:26PM +0000, Sakari Ailus wrote: > Hi Prabhakar, > > Thanks for the set. It looks largely very nice to me, after addressing > Laurent's comments. A few comments here and possibly on other patches... > > On Tue, Sep 10, 2024 at 06:06:10PM +0100, Prabhakar wrote: > > From: Lad Prabhakar > > > > Implement the .get_frame_desc() subdev operation to report information > > about streams to the connected CSI-2 receiver. This is required to let > > the CSI-2 receiver driver know about virtual channels and data types for > > each stream. > > > > Signed-off-by: Lad Prabhakar > > --- > > drivers/media/i2c/ov5645.c | 28 ++++++++++++++++++++++++++++ > > 1 file changed, 28 insertions(+) > > > > diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c > > index 7f1133292ffc..c24eb6e7a7b5 100644 > > --- a/drivers/media/i2c/ov5645.c > > +++ b/drivers/media/i2c/ov5645.c > > @@ -28,6 +28,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -829,6 +830,32 @@ static const struct v4l2_ctrl_ops ov5645_ctrl_ops = { > > .s_ctrl = ov5645_s_ctrl, > > }; > > > > +static int ov5645_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, > > + struct v4l2_mbus_frame_desc *fd) > > +{ > > + const struct v4l2_mbus_framefmt *fmt; > > + struct v4l2_subdev_state *state; > > + > > + if (pad != OV5645_PAD_SOURCE) > > + return -EINVAL; > > As you have a single source pad, and pretty much all sensor drivers will, I > think it'd be nice to add a check for this (that it's not an internal pad) > to the caller side in v4l2-subdev.c. And of course drop this one. What check would you add, just verifying that the pad is a source pad ? > > + > > + state = v4l2_subdev_lock_and_get_active_state(sd); > > + fmt = v4l2_subdev_state_get_format(state, OV5645_PAD_SOURCE, 0); > > + v4l2_subdev_unlock_state(state); > > + > > + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; > > + fd->num_entries = 1; > > + > > + memset(fd->entry, 0, sizeof(fd->entry)); > > + > > + fd->entry[0].pixelcode = fmt->code; > > + fd->entry[0].stream = 0; > > + fd->entry[0].bus.csi2.vc = 0; > > + fd->entry[0].bus.csi2.dt = MIPI_CSI2_DT_YUV422_8B; > > + > > + return 0; > > +} > > + > > static int ov5645_enum_mbus_code(struct v4l2_subdev *sd, > > struct v4l2_subdev_state *sd_state, > > struct v4l2_subdev_mbus_code_enum *code) > > @@ -1062,6 +1089,7 @@ static const struct v4l2_subdev_video_ops ov5645_video_ops = { > > }; > > > > static const struct v4l2_subdev_pad_ops ov5645_subdev_pad_ops = { > > + .get_frame_desc = ov5645_get_frame_desc, > > .enum_mbus_code = ov5645_enum_mbus_code, > > .enum_frame_size = ov5645_enum_frame_size, > > .get_fmt = v4l2_subdev_get_fmt, > > -- Regards, Laurent Pinchart