Message ID | 20220414053528.31460-1-yuji2.ishikawa@toshiba.co.jp (mailing list archive) |
---|---|
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1nesEB-00HZNU-Jr; Thu, 14 Apr 2022 05:41:13 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239910AbiDNFnc (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Thu, 14 Apr 2022 01:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239889AbiDNFnb (ORCPT <rfc822;linux-media@vger.kernel.org>); Thu, 14 Apr 2022 01:43:31 -0400 Received: from mo-csw.securemx.jp (mo-csw1514.securemx.jp [210.130.202.153]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D968C4832C; Wed, 13 Apr 2022 22:41:04 -0700 (PDT) Received: by mo-csw.securemx.jp (mx-mo-csw1514) id 23E5em7f017194; Thu, 14 Apr 2022 14:40:48 +0900 X-Iguazu-Qid: 34trQigfs9xr9iyGU3 X-Iguazu-QSIG: v=2; s=0; t=1649914848; q=34trQigfs9xr9iyGU3; m=6QxjmZsiG7UTivQvdF5fG5AwRycPM6hwoOZ4mSv5Jsg= Received: from imx12-a.toshiba.co.jp (imx12-a.toshiba.co.jp [61.202.160.135]) by relay.securemx.jp (mx-mr1512) id 23E5emnt009582 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 14 Apr 2022 14:40:48 +0900 X-SA-MID: 2385299 From: Yuji Ishikawa <yuji2.ishikawa@toshiba.co.jp> To: Mauro Carvalho Chehab <mchehab@kernel.org>, Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> Cc: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, yuji2.ishikawa@toshiba.co.jp Subject: [PATCH v2 0/5] Visconti: Add Toshiba Visconti Video Input Interface driver Date: Thu, 14 Apr 2022 14:35:23 +0900 X-TSB-HOP2: ON Message-Id: <20220414053528.31460-1-yuji2.ishikawa@toshiba.co.jp> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
Visconti: Add Toshiba Visconti Video Input Interface driver
|
|
Message
Yuji Ishikawa
April 14, 2022, 5:35 a.m. UTC
This series is the Video Input Interface driver for Toshiba's ARM SoC, Visconti[0]. This provides DT binding documentation, device driver, MAINTAINER fiels. Best regards, Yuji [0]: https://toshiba.semicon-storage.com/ap-en/semiconductor/product/image-recognition-processors-visconti.html dt-bindings: media: platform: visconti: Add Toshiba Visconti Video Input Interface bindings v1 -> v2: - No update media: platform: visconti: Add Toshiba Visconti Video Input Interface driver headers v1 -> v2: - moved driver headers to an individual patch media: platform: visconti: Add Toshiba Visconti Video Input Interface driver body v1 -> v2: - moved driver sources to an individual patch media: platform: visconti: Add Toshiba VIIF image signal processor driver v1 -> v2: - moved image signal processor driver to an individual patch MAINTAINERS: Add entries for Toshiba Visconti Video Input Interface v1 -> v2: - No update Change in V2: - moved files into individual patches to decrease patch size Yuji Ishikawa (5): dt-bindings: media: platform: visconti: Add Toshiba Visconti Video Input Interface bindings media: platform: visconti: Add Toshiba Visconti Video Input Interface driver headers media: platform: visconti: Add Toshiba Visconti Video Input Interface driver body media: platform: visconti: Add Toshiba VIIF image signal processor driver MAINTAINERS: Add entries for Toshiba Visconti Video Input Interface .../bindings/media/toshiba,visconti-viif.yaml | 103 + MAINTAINERS | 2 + drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 4 + drivers/media/platform/visconti/Kconfig | 9 + drivers/media/platform/visconti/Makefile | 9 + drivers/media/platform/visconti/hwd_viif.c | 2233 ++++++++++ drivers/media/platform/visconti/hwd_viif.h | 1776 ++++++++ .../media/platform/visconti/hwd_viif_csi2rx.c | 767 ++++ .../platform/visconti/hwd_viif_internal.h | 361 ++ .../media/platform/visconti/hwd_viif_l1isp.c | 3769 +++++++++++++++++ .../media/platform/visconti/hwd_viif_reg.h | 2802 ++++++++++++ drivers/media/platform/visconti/viif.c | 2384 +++++++++++ drivers/media/platform/visconti/viif.h | 134 + include/uapi/linux/visconti_viif.h | 1683 ++++++++ 15 files changed, 16038 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/toshiba,visconti-viif.yaml create mode 100644 drivers/media/platform/visconti/Kconfig create mode 100644 drivers/media/platform/visconti/Makefile create mode 100644 drivers/media/platform/visconti/hwd_viif.c create mode 100644 drivers/media/platform/visconti/hwd_viif.h create mode 100644 drivers/media/platform/visconti/hwd_viif_csi2rx.c create mode 100644 drivers/media/platform/visconti/hwd_viif_internal.h create mode 100644 drivers/media/platform/visconti/hwd_viif_l1isp.c create mode 100644 drivers/media/platform/visconti/hwd_viif_reg.h create mode 100644 drivers/media/platform/visconti/viif.c create mode 100644 drivers/media/platform/visconti/viif.h create mode 100644 include/uapi/linux/visconti_viif.h
Comments
Hi Yuji, On 14/04/2022 07:35, Yuji Ishikawa wrote: > This series is the Video Input Interface driver for Toshiba's ARM SoC, Visconti[0]. > This provides DT binding documentation, device driver, MAINTAINER fiels. > > Best regards, > Yuji > > [0]: https://toshiba.semicon-storage.com/ap-en/semiconductor/product/image-recognition-processors-visconti.html > > > dt-bindings: media: platform: visconti: Add Toshiba Visconti Video Input Interface bindings > v1 -> v2: > - No update > > media: platform: visconti: Add Toshiba Visconti Video Input Interface driver headers > v1 -> v2: > - moved driver headers to an individual patch > > media: platform: visconti: Add Toshiba Visconti Video Input Interface driver body > v1 -> v2: > - moved driver sources to an individual patch > > media: platform: visconti: Add Toshiba VIIF image signal processor driver > v1 -> v2: > - moved image signal processor driver to an individual patch > > MAINTAINERS: Add entries for Toshiba Visconti Video Input Interface > v1 -> v2: > - No update > > Change in V2: > - moved files into individual patches to decrease patch size Thank you for your patch series. However, there are quite a few things that need more work. I'll make some high level guidelines here, and go into a bit more detail in some of the patches. First of all, run your patches through 'scripts/checkpatch.pl --strict' and fix the many warnings, errors and checks. Use common sense, sometimes a check or warning isn't actually valid, but the vast majority of what checkpatch spits out appears reasonable. Another thing I noticed is code like this: + if (param->r_cr_in_offset > HWD_VIIF_CSC_MAX_OFFSET) + return -EINVAL; + + if (param->g_y_in_offset > HWD_VIIF_CSC_MAX_OFFSET) + return -EINVAL; + + if (param->b_cb_in_offset > HWD_VIIF_CSC_MAX_OFFSET) + return -EINVAL; + + if (param->r_cr_out_offset > HWD_VIIF_CSC_MAX_OFFSET) + return -EINVAL; + + if (param->g_y_out_offset > HWD_VIIF_CSC_MAX_OFFSET) + return -EINVAL; + + if (param->b_cb_out_offset > HWD_VIIF_CSC_MAX_OFFSET) + return -EINVAL; This can easily be combined into a single if: if (param->r_cr_in_offset > HWD_VIIF_CSC_MAX_OFFSET || param->g_y_in_offset > HWD_VIIF_CSC_MAX_OFFSET || param->b_cb_in_offset > HWD_VIIF_CSC_MAX_OFFSET || param->r_cr_out_offset > HWD_VIIF_CSC_MAX_OFFSET || param->g_y_out_offset > HWD_VIIF_CSC_MAX_OFFSET || param->b_cb_out_offset > HWD_VIIF_CSC_MAX_OFFSET) return -EINVAL; Easier to read and a lot shorter. Another thing to avoid is mixing lower and upper case in function names. A lot of functions have this prefix: 'hwd_VIIF_'. Just change that to 'hwd_viif_': that's much easier on the eyes. I also see a fair amount of code that is indented very far to the right. Often due to constructs like this: if (test) { // lots of code } return ret; Which can be changed to: if (!test) return ret; // lots of code return ret; The same can also happen in a for/while loop where you can just 'continue' instead of 'return'. This makes the code easier to read and review. It doesn't look like this driver uses the media controller API. This is probably something you want to look into, esp. in combination with libcamera support (https://libcamera.org/). I've added Laurent to this, since he's the expert on this. Regards, Hans > > Yuji Ishikawa (5): > dt-bindings: media: platform: visconti: Add Toshiba Visconti Video > Input Interface bindings > media: platform: visconti: Add Toshiba Visconti Video Input Interface > driver headers > media: platform: visconti: Add Toshiba Visconti Video Input Interface > driver body > media: platform: visconti: Add Toshiba VIIF image signal processor > driver > MAINTAINERS: Add entries for Toshiba Visconti Video Input Interface > > .../bindings/media/toshiba,visconti-viif.yaml | 103 + > MAINTAINERS | 2 + > drivers/media/platform/Kconfig | 2 + > drivers/media/platform/Makefile | 4 + > drivers/media/platform/visconti/Kconfig | 9 + > drivers/media/platform/visconti/Makefile | 9 + > drivers/media/platform/visconti/hwd_viif.c | 2233 ++++++++++ > drivers/media/platform/visconti/hwd_viif.h | 1776 ++++++++ > .../media/platform/visconti/hwd_viif_csi2rx.c | 767 ++++ > .../platform/visconti/hwd_viif_internal.h | 361 ++ > .../media/platform/visconti/hwd_viif_l1isp.c | 3769 +++++++++++++++++ > .../media/platform/visconti/hwd_viif_reg.h | 2802 ++++++++++++ > drivers/media/platform/visconti/viif.c | 2384 +++++++++++ > drivers/media/platform/visconti/viif.h | 134 + > include/uapi/linux/visconti_viif.h | 1683 ++++++++ > 15 files changed, 16038 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/toshiba,visconti-viif.yaml > create mode 100644 drivers/media/platform/visconti/Kconfig > create mode 100644 drivers/media/platform/visconti/Makefile > create mode 100644 drivers/media/platform/visconti/hwd_viif.c > create mode 100644 drivers/media/platform/visconti/hwd_viif.h > create mode 100644 drivers/media/platform/visconti/hwd_viif_csi2rx.c > create mode 100644 drivers/media/platform/visconti/hwd_viif_internal.h > create mode 100644 drivers/media/platform/visconti/hwd_viif_l1isp.c > create mode 100644 drivers/media/platform/visconti/hwd_viif_reg.h > create mode 100644 drivers/media/platform/visconti/viif.c > create mode 100644 drivers/media/platform/visconti/viif.h > create mode 100644 include/uapi/linux/visconti_viif.h >
Hi, Hans Thank you for your review and comment. > -----Original Message----- > From: Hans Verkuil <hverkuil@xs4all.nl> > Sent: Wednesday, April 20, 2022 4:55 PM > To: ishikawa yuji(石川 悠司 ○RDC□AITC○EA開) > <yuji2.ishikawa@toshiba.co.jp>; Mauro Carvalho Chehab > <mchehab@kernel.org>; iwamatsu nobuhiro(岩松 信洋 □SWC◯ACT) > <nobuhiro1.iwamatsu@toshiba.co.jp>; Laurent Pinchart > <laurent.pinchart@ideasonboard.com> > Cc: linux-media@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2 0/5] Visconti: Add Toshiba Visconti Video Input > Interface driver > > Hi Yuji, > > On 14/04/2022 07:35, Yuji Ishikawa wrote: > > This series is the Video Input Interface driver for Toshiba's ARM SoC, > Visconti[0]. > > This provides DT binding documentation, device driver, MAINTAINER fiels. > > > > Best regards, > > Yuji > > > > [0]: > > > https://toshiba.semicon-storage.com/ap-en/semiconductor/product/image- > > recognition-processors-visconti.html > > > > > > dt-bindings: media: platform: visconti: Add Toshiba Visconti Video Input > Interface bindings > > v1 -> v2: > > - No update > > > > media: platform: visconti: Add Toshiba Visconti Video Input Interface driver > headers > > v1 -> v2: > > - moved driver headers to an individual patch > > > > media: platform: visconti: Add Toshiba Visconti Video Input Interface driver > body > > v1 -> v2: > > - moved driver sources to an individual patch > > > > media: platform: visconti: Add Toshiba VIIF image signal processor driver > > v1 -> v2: > > - moved image signal processor driver to an individual patch > > > > MAINTAINERS: Add entries for Toshiba Visconti Video Input Interface > > v1 -> v2: > > - No update > > > > Change in V2: > > - moved files into individual patches to decrease patch size > > Thank you for your patch series. > > However, there are quite a few things that need more work. I'll make some high > level guidelines here, and go into a bit more detail in some of the patches. > > First of all, run your patches through 'scripts/checkpatch.pl --strict' and fix the > many warnings, errors and checks. Use common sense, sometimes a check or > warning isn't actually valid, but the vast majority of what checkpatch spits out > appears reasonable. I'll execute checkpatch.pl with --strict option. > > Another thing I noticed is code like this: > > + if (param->r_cr_in_offset > HWD_VIIF_CSC_MAX_OFFSET) > + return -EINVAL; > + > + if (param->g_y_in_offset > HWD_VIIF_CSC_MAX_OFFSET) > + return -EINVAL; > + > + if (param->b_cb_in_offset > HWD_VIIF_CSC_MAX_OFFSET) > + return -EINVAL; > + > + if (param->r_cr_out_offset > HWD_VIIF_CSC_MAX_OFFSET) > + return -EINVAL; > + > + if (param->g_y_out_offset > HWD_VIIF_CSC_MAX_OFFSET) > + return -EINVAL; > + > + if (param->b_cb_out_offset > HWD_VIIF_CSC_MAX_OFFSET) > + return -EINVAL; > > This can easily be combined into a single if: > > if (param->r_cr_in_offset > HWD_VIIF_CSC_MAX_OFFSET || > param->g_y_in_offset > HWD_VIIF_CSC_MAX_OFFSET || > param->b_cb_in_offset > HWD_VIIF_CSC_MAX_OFFSET > || > param->r_cr_out_offset > HWD_VIIF_CSC_MAX_OFFSET > || > param->g_y_out_offset > HWD_VIIF_CSC_MAX_OFFSET > || > param->b_cb_out_offset > > HWD_VIIF_CSC_MAX_OFFSET) > return -EINVAL; > > Easier to read and a lot shorter. I'll fix them > > Another thing to avoid is mixing lower and upper case in function names. > A lot of functions have this prefix: 'hwd_VIIF_'. Just change that to > 'hwd_viif_': that's much easier on the eyes. I'll fix them. I'm also wondering if the common prefix hwd_viif_ is acceptable for the identifiers in Visconti VIIIF driver. > I also see a fair amount of code that is indented very far to the right. > Often due to constructs like this: > > if (test) { > // lots of code > } > return ret; > > Which can be changed to: > > if (!test) > return ret; > // lots of code > return ret; > > The same can also happen in a for/while loop where you can just 'continue' > instead of 'return'. > > This makes the code easier to read and review. Yes, the indents are too deep. I'll try fix them. > It doesn't look like this driver uses the media controller API. This is probably > something you want to look into, esp. in combination with libcamera support > (https://libcamera.org/). I've added Laurent to this, since he's the expert on > this. Thank you for great advice. I wanted to know how to control/aggregate functions of VIIF. As I'm completely new to media controller API, I'll check the documents first. Regards, Yuji > Regards, > > Hans > > > > > Yuji Ishikawa (5): > > dt-bindings: media: platform: visconti: Add Toshiba Visconti Video > > Input Interface bindings > > media: platform: visconti: Add Toshiba Visconti Video Input Interface > > driver headers > > media: platform: visconti: Add Toshiba Visconti Video Input Interface > > driver body > > media: platform: visconti: Add Toshiba VIIF image signal processor > > driver > > MAINTAINERS: Add entries for Toshiba Visconti Video Input Interface > > > > .../bindings/media/toshiba,visconti-viif.yaml | 103 + > > MAINTAINERS | 2 + > > drivers/media/platform/Kconfig | 2 + > > drivers/media/platform/Makefile | 4 + > > drivers/media/platform/visconti/Kconfig | 9 + > > drivers/media/platform/visconti/Makefile | 9 + > > drivers/media/platform/visconti/hwd_viif.c | 2233 ++++++++++ > > drivers/media/platform/visconti/hwd_viif.h | 1776 ++++++++ > > .../media/platform/visconti/hwd_viif_csi2rx.c | 767 ++++ > > .../platform/visconti/hwd_viif_internal.h | 361 ++ > > .../media/platform/visconti/hwd_viif_l1isp.c | 3769 > +++++++++++++++++ > > .../media/platform/visconti/hwd_viif_reg.h | 2802 ++++++++++++ > > drivers/media/platform/visconti/viif.c | 2384 +++++++++++ > > drivers/media/platform/visconti/viif.h | 134 + > > include/uapi/linux/visconti_viif.h | 1683 ++++++++ > > 15 files changed, 16038 insertions(+) create mode 100644 > > Documentation/devicetree/bindings/media/toshiba,visconti-viif.yaml > > create mode 100644 drivers/media/platform/visconti/Kconfig > > create mode 100644 drivers/media/platform/visconti/Makefile > > create mode 100644 drivers/media/platform/visconti/hwd_viif.c > > create mode 100644 drivers/media/platform/visconti/hwd_viif.h > > create mode 100644 drivers/media/platform/visconti/hwd_viif_csi2rx.c > > create mode 100644 > > drivers/media/platform/visconti/hwd_viif_internal.h > > create mode 100644 drivers/media/platform/visconti/hwd_viif_l1isp.c > > create mode 100644 drivers/media/platform/visconti/hwd_viif_reg.h > > create mode 100644 drivers/media/platform/visconti/viif.c > > create mode 100644 drivers/media/platform/visconti/viif.h > > create mode 100644 include/uapi/linux/visconti_viif.h > >