Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp1074773ima; Wed, 6 Feb 2019 13:16:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IbabPPxoGmtHnhbSd34kU1YfG6q3+40A5LdsqNKeSsNkGLc+EyUuxGSIzB3ng3FBGtr2gz9 X-Received: by 2002:a17:902:b489:: with SMTP id y9mr12952967plr.193.1549487805780; Wed, 06 Feb 2019 13:16:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549487805; cv=none; d=google.com; s=arc-20160816; b=XNJfhkQpM/Bf05VOTvSk7skkRi3AH5hgu9mrS9mBlap/R+oG65GGetw319PG9HfLiG YtpSGgO0gKXbPGhGd0XEWOJxSAB80Oa+62lbyHGKHOJf8n0XrharRY+0tsy5/KDeTOJY QepAoTWibW1oWLU8CrOc5W+eDYjs9n+6nZu81HG20ON8c3YIWrC9D/DNeZIbIi8UOxse tIN9JEPUGdrqGoURMItugqVXgfAJVXIPgiRrKfdkmAqeCDPkkI4x1igAYdo0IPKpJKGd SmWQwp57SggYslng8P0gDXclKrp8SqRZjiYBxORqhWSwlAGJ8DgY2NrmZA8+Rw1KWz5K gOXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tbt0I8VAI9m0cUbhuE5lTmK9SWbYIiDPJg0CIQEXzm4=; b=0nyNixVLmrEdxdB1rHSpcg89QqsoUbsxtBZoTJ4RpJzrkrJqtaTscBTUKSKY62JVhu VB4+iRW/PU7+Rjaz/it9EK9v5biqS99+qDit+LxkH7+PTN3EkqbMzS2hIHvrTYlJKlPP BLmiXxgh3ePME9OJqnA+VFiE6JTkmtmioZiwMSpTXkOWxcGANG7ydBJdGkSeWURHEy6b G6ZZr3lya+qtmOGCVBWhIFTskqS5NpCSaowxCnt34MFleJCAhmw4Hgc9YXmXH6Gl1r7V HxVOrW9ePLn06Ah8wYzX6SH6+QWRNXGu9WE9Jkz0MvTIEq737nxZ8zHfN4lrP3/SdWGh yBsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e35si4198697pgb.548.2019.02.06.13.16.20; Wed, 06 Feb 2019 13:16:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726958AbfBFVQL (ORCPT + 99 others); Wed, 6 Feb 2019 16:16:11 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:41037 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfBFVQL (ORCPT ); Wed, 6 Feb 2019 16:16:11 -0500 Received: from localhost (lfbn-1-10718-76.w90-89.abo.wanadoo.fr [90.89.68.76]) (Authenticated sender: maxime.ripard@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 1E9AE240007; Wed, 6 Feb 2019 21:16:05 +0000 (UTC) Date: Wed, 6 Feb 2019 22:16:05 +0100 From: Maxime Ripard To: Sakari Ailus Cc: Hans Verkuil , Mauro Carvalho Chehab , Thomas Petazzoni , Laurent Pinchart , linux-media@vger.kernel.org, Andrzej Hajda , Chen-Yu Tsai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Mark Rutland , Rob Herring , Frank Rowand Subject: Re: [PATCH v2 3/5] media: sunxi: Add A10 CSI driver Message-ID: <20190206211605.27cq2lxuv3gtyyux@flea> References: <20190129123949.qdmqnfaym3y42dvj@paasikivi.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190129123949.qdmqnfaym3y42dvj@paasikivi.fi.intel.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sakari, Thanks for your review, I have a few questions though, and the rest will be addressed in the next version. On Tue, Jan 29, 2019 at 02:39:49PM +0200, Sakari Ailus wrote: > > +static int csi_notify_complete(struct v4l2_async_notifier *notifier) > > +{ > > + struct sun4i_csi *csi = container_of(notifier, struct sun4i_csi, > > + notifier); > > + int ret; > > + > > + ret = v4l2_device_register_subdev_nodes(&csi->v4l); > > + if (ret < 0) > > + return ret; > > + > > + ret = sun4i_csi_v4l2_register(csi); > > + if (ret < 0) > > + return ret; > > + > > + return media_create_pad_link(&csi->src_subdev->entity, csi->src_pad, > > + &csi->vdev.entity, 0, > > + MEDIA_LNK_FL_ENABLED | > > + MEDIA_LNK_FL_IMMUTABLE); > > This appears to create a link directly from the sensor entity to the video > device entity. Is that intentional? I'd expect to see a CSI-2 receiver > sub-device as well, which I don't see being created by the driver. > > This is indeed a novel proposal. I have some concerns though. > > The user doesn't have access to the configured media bus format (reflecting > the format on the CSI-2 bus on receiver's side). It's thus difficult to > figure out whether the V4L2 pixel format configured on the video node > matches what the sensor outputs. Admittedly, we don't have a perfect > solution to that whenever the DMA hardware supports multiple V4L2 pixel > formats on a single media bus format. We might need to have a different > solution for this one, should it be without that receiver sub-device. > > Could you add the CSI-2 receiver sub-device, please? Even though the name of the controller is *very* confusing, this isn't a MIPI-CSI receiver, but a parallel one that supports RGB and BT656 buses. > > + csi->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; > > Could you make it IMMUTABLE and ENABLED? If there is no need to disable it, > that is. The link is already created with those flags, and as far as I know it doesn't exist for the pads > > +static int csi_release(struct file *file) > > +{ > > + struct sun4i_csi *csi = video_drvdata(file); > > + int ret; > > + > > + mutex_lock(&csi->lock); > > + > > + ret = v4l2_fh_release(file); > > v4l2_fh_release() always returns 0. I guess it could be changed to return > void. The reason it has int is that it could be used as the release > callback as such. > > > + v4l2_pipeline_pm_use(&csi->vdev.entity, 0); > > + pm_runtime_put(csi->dev); > > + > > + mutex_unlock(&csi->lock); > > + > > + return ret; > > +} Do you want me to change the construct then? Thanks! Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com