From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E328ECDFB4 for ; Thu, 19 Jul 2018 03:43:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3218120673 for ; Thu, 19 Jul 2018 03:43:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3218120673 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=magewell.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727117AbeGSEYd (ORCPT ); Thu, 19 Jul 2018 00:24:33 -0400 Received: from out20-38.mail.aliyun.com ([115.124.20.38]:39236 "EHLO out20-38.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725739AbeGSEYd (ORCPT ); Thu, 19 Jul 2018 00:24:33 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07598314|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07423;MF=yong.deng@magewell.com;NM=1;PH=DS;RN=27;RT=27;SR=0;TI=SMTPD_---.CSaQ2Fr_1531971789; Received: from John(mailfrom:yong.deng@magewell.com fp:SMTPD_---.CSaQ2Fr_1531971789) by smtp.aliyun-inc.com(10.147.44.145); Thu, 19 Jul 2018 11:43:09 +0800 Date: Thu, 19 Jul 2018 11:43:06 +0800 From: Yong To: Sakari Ailus Cc: Sakari Ailus , Maxime Ripard , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Chen-Yu Tsai , "David S. Miller" , Greg Kroah-Hartman , Andrew Morton , Linus Walleij , Randy Dunlap , Hans Verkuil , Arnd Bergmann , Stanimir Varbanov , Philipp Zabel , Ramesh Shanmugasundaram , Jacob Chen , Yannick Fertre , Thierry Reding , Benjamin Gaignard , Todor Tomov , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v10 2/2] media: V3s: Add support for Allwinner CSI. Message-Id: <20180719114306.55b2e5f9e9a140a8922a2785@magewell.com> In-Reply-To: <20180718095513.4cm77g2iuilvfmd6@paasikivi.fi.intel.com> References: <1525417745-37964-1-git-send-email-yong.deng@magewell.com> <20180626110821.wkal6fcnoncsze6y@valkosipuli.retiisi.org.uk> <20180705154802.03604f156709be11892b19c0@magewell.com> <20180718095513.4cm77g2iuilvfmd6@paasikivi.fi.intel.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Jul 2018 12:55:14 +0300 Sakari Ailus wrote: > Hi Yong, > > On Thu, Jul 05, 2018 at 03:48:02PM +0800, Yong wrote: > > > > + > > > > +/* ----------------------------------------------------------------------------- > > > > + * Media Operations > > > > + */ > > > > +static int sun6i_video_formats_init(struct sun6i_video *video, > > > > + const struct media_pad *remote) > > > > +{ > > > > + struct v4l2_subdev_mbus_code_enum mbus_code = { 0 }; > > > > + struct sun6i_csi *csi = video->csi; > > > > + struct v4l2_format format; > > > > + struct v4l2_subdev *subdev; > > > > + u32 pad; > > > > + const u32 *pixformats; > > > > + int pixformat_count = 0; > > > > + u32 subdev_codes[32]; /* subdev format codes, 32 should be enough */ > > > > + int codes_count = 0; > > > > + int num_fmts = 0; > > > > + int i, j; > > > > + > > > > + pad = remote->index; > > > > + subdev = media_entity_to_v4l2_subdev(remote->entity); > > > > + if (subdev == NULL) > > > > + return -ENXIO; > > > > + > > > > + /* Get supported pixformats of CSI */ > > > > + pixformat_count = sun6i_csi_get_supported_pixformats(csi, &pixformats); > > > > + if (pixformat_count <= 0) > > > > + return -ENXIO; > > > > + > > > > + /* Get subdev formats codes */ > > > > + mbus_code.pad = pad; > > > > + mbus_code.which = V4L2_SUBDEV_FORMAT_ACTIVE; > > > > + while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, > > > > + &mbus_code)) { > > > > > > The formats supported by the external sub-device may depend on horizontal > > > and vertical flipping. You shouldn't assume any particular configuration > > > here: instead, bridge drivers generally just need to make sure the formats > > > match in link validation when streaming is started. At least the CSI-2 > > > receiver driver and the DMA engine driver (video device) should check the > > > configuration is valid. See e.g. the IPU3 driver: > > > drivers/media/pci/intel/ipu3/ipu3-cio2.c . > > > > Can mbus_code be added dynamically ? > > The code here only enum the mbus code and get the possible supported > > pairs of pixformat and mbus by SoC. Not try to check if the formats > > (width height ...) is valid or not. The formats validation will be > > in link validation when streaming is started as per your advise. > > The formats that can be enumerated from the sensor here are those settable > using SUBDEV_S_FMT. The enumeration will change on raw sensors if you use > the flipping controls. As the bridge driver implements MC as well as subdev > APIs, generally the sensor configuration is out of scope of this driver > since it's directly configured from the user space. > > Just check that the pipeline is valid before starting streaming in your > driver. OK. I will take some time to change these code. > > -- > Kind regards, > > Sakari Ailus > sakari.ailus@linux.intel.com Thanks, Yong From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yong Subject: Re: [PATCH v10 2/2] media: V3s: Add support for Allwinner CSI. Date: Thu, 19 Jul 2018 11:43:06 +0800 Message-ID: <20180719114306.55b2e5f9e9a140a8922a2785@magewell.com> References: <1525417745-37964-1-git-send-email-yong.deng@magewell.com> <20180626110821.wkal6fcnoncsze6y@valkosipuli.retiisi.org.uk> <20180705154802.03604f156709be11892b19c0@magewell.com> <20180718095513.4cm77g2iuilvfmd6@paasikivi.fi.intel.com> Reply-To: yong.deng-+3dxTMOEIRNWk0Htik3J/w@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org In-Reply-To: <20180718095513.4cm77g2iuilvfmd6-z7MJbOB4PBP+e+fPlCVrcFDQ4js95KgL@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Sakari Ailus Cc: Sakari Ailus , Maxime Ripard , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Chen-Yu Tsai , "David S. Miller" , Greg Kroah-Hartman , Andrew Morton , Linus Walleij , Randy Dunlap , Hans Verkuil , Arnd Bergmann , Stanimir Varbanov , Philipp Zabel , Ramesh Shanmugasundaram , Jacob Chen , Yannick Fertre , Thierry Reding , Benjamin Gaignard , Todor Tomov , linux-media-fy+rA21nqHI@public.gmane.org List-Id: devicetree@vger.kernel.org On Wed, 18 Jul 2018 12:55:14 +0300 Sakari Ailus wrote: > Hi Yong, > > On Thu, Jul 05, 2018 at 03:48:02PM +0800, Yong wrote: > > > > + > > > > +/* ----------------------------------------------------------------------------- > > > > + * Media Operations > > > > + */ > > > > +static int sun6i_video_formats_init(struct sun6i_video *video, > > > > + const struct media_pad *remote) > > > > +{ > > > > + struct v4l2_subdev_mbus_code_enum mbus_code = { 0 }; > > > > + struct sun6i_csi *csi = video->csi; > > > > + struct v4l2_format format; > > > > + struct v4l2_subdev *subdev; > > > > + u32 pad; > > > > + const u32 *pixformats; > > > > + int pixformat_count = 0; > > > > + u32 subdev_codes[32]; /* subdev format codes, 32 should be enough */ > > > > + int codes_count = 0; > > > > + int num_fmts = 0; > > > > + int i, j; > > > > + > > > > + pad = remote->index; > > > > + subdev = media_entity_to_v4l2_subdev(remote->entity); > > > > + if (subdev == NULL) > > > > + return -ENXIO; > > > > + > > > > + /* Get supported pixformats of CSI */ > > > > + pixformat_count = sun6i_csi_get_supported_pixformats(csi, &pixformats); > > > > + if (pixformat_count <= 0) > > > > + return -ENXIO; > > > > + > > > > + /* Get subdev formats codes */ > > > > + mbus_code.pad = pad; > > > > + mbus_code.which = V4L2_SUBDEV_FORMAT_ACTIVE; > > > > + while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, > > > > + &mbus_code)) { > > > > > > The formats supported by the external sub-device may depend on horizontal > > > and vertical flipping. You shouldn't assume any particular configuration > > > here: instead, bridge drivers generally just need to make sure the formats > > > match in link validation when streaming is started. At least the CSI-2 > > > receiver driver and the DMA engine driver (video device) should check the > > > configuration is valid. See e.g. the IPU3 driver: > > > drivers/media/pci/intel/ipu3/ipu3-cio2.c . > > > > Can mbus_code be added dynamically ? > > The code here only enum the mbus code and get the possible supported > > pairs of pixformat and mbus by SoC. Not try to check if the formats > > (width height ...) is valid or not. The formats validation will be > > in link validation when streaming is started as per your advise. > > The formats that can be enumerated from the sensor here are those settable > using SUBDEV_S_FMT. The enumeration will change on raw sensors if you use > the flipping controls. As the bridge driver implements MC as well as subdev > APIs, generally the sensor configuration is out of scope of this driver > since it's directly configured from the user space. > > Just check that the pipeline is valid before starting streaming in your > driver. OK. I will take some time to change these code. > > -- > Kind regards, > > Sakari Ailus > sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org Thanks, Yong From mboxrd@z Thu Jan 1 00:00:00 1970 From: yong.deng@magewell.com (Yong) Date: Thu, 19 Jul 2018 11:43:06 +0800 Subject: [PATCH v10 2/2] media: V3s: Add support for Allwinner CSI. In-Reply-To: <20180718095513.4cm77g2iuilvfmd6@paasikivi.fi.intel.com> References: <1525417745-37964-1-git-send-email-yong.deng@magewell.com> <20180626110821.wkal6fcnoncsze6y@valkosipuli.retiisi.org.uk> <20180705154802.03604f156709be11892b19c0@magewell.com> <20180718095513.4cm77g2iuilvfmd6@paasikivi.fi.intel.com> Message-ID: <20180719114306.55b2e5f9e9a140a8922a2785@magewell.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, 18 Jul 2018 12:55:14 +0300 Sakari Ailus wrote: > Hi Yong, > > On Thu, Jul 05, 2018 at 03:48:02PM +0800, Yong wrote: > > > > + > > > > +/* ----------------------------------------------------------------------------- > > > > + * Media Operations > > > > + */ > > > > +static int sun6i_video_formats_init(struct sun6i_video *video, > > > > + const struct media_pad *remote) > > > > +{ > > > > + struct v4l2_subdev_mbus_code_enum mbus_code = { 0 }; > > > > + struct sun6i_csi *csi = video->csi; > > > > + struct v4l2_format format; > > > > + struct v4l2_subdev *subdev; > > > > + u32 pad; > > > > + const u32 *pixformats; > > > > + int pixformat_count = 0; > > > > + u32 subdev_codes[32]; /* subdev format codes, 32 should be enough */ > > > > + int codes_count = 0; > > > > + int num_fmts = 0; > > > > + int i, j; > > > > + > > > > + pad = remote->index; > > > > + subdev = media_entity_to_v4l2_subdev(remote->entity); > > > > + if (subdev == NULL) > > > > + return -ENXIO; > > > > + > > > > + /* Get supported pixformats of CSI */ > > > > + pixformat_count = sun6i_csi_get_supported_pixformats(csi, &pixformats); > > > > + if (pixformat_count <= 0) > > > > + return -ENXIO; > > > > + > > > > + /* Get subdev formats codes */ > > > > + mbus_code.pad = pad; > > > > + mbus_code.which = V4L2_SUBDEV_FORMAT_ACTIVE; > > > > + while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, > > > > + &mbus_code)) { > > > > > > The formats supported by the external sub-device may depend on horizontal > > > and vertical flipping. You shouldn't assume any particular configuration > > > here: instead, bridge drivers generally just need to make sure the formats > > > match in link validation when streaming is started. At least the CSI-2 > > > receiver driver and the DMA engine driver (video device) should check the > > > configuration is valid. See e.g. the IPU3 driver: > > > drivers/media/pci/intel/ipu3/ipu3-cio2.c . > > > > Can mbus_code be added dynamically ? > > The code here only enum the mbus code and get the possible supported > > pairs of pixformat and mbus by SoC. Not try to check if the formats > > (width height ...) is valid or not. The formats validation will be > > in link validation when streaming is started as per your advise. > > The formats that can be enumerated from the sensor here are those settable > using SUBDEV_S_FMT. The enumeration will change on raw sensors if you use > the flipping controls. As the bridge driver implements MC as well as subdev > APIs, generally the sensor configuration is out of scope of this driver > since it's directly configured from the user space. > > Just check that the pipeline is valid before starting streaming in your > driver. OK. I will take some time to change these code. > > -- > Kind regards, > > Sakari Ailus > sakari.ailus at linux.intel.com Thanks, Yong