Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1694854rwo; Wed, 2 Aug 2023 20:09:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWmYcbKlVHD7zjvHTIQ+Nr5ObLXBhb8KVYY97XhzTfOq63wjVEAdU6QaTLilXG2ITnTqPn X-Received: by 2002:a05:6a20:d90b:b0:13d:af0e:4ee5 with SMTP id jd11-20020a056a20d90b00b0013daf0e4ee5mr11948391pzb.18.1691032152728; Wed, 02 Aug 2023 20:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691032152; cv=none; d=google.com; s=arc-20160816; b=RJ+vcR3rOqSnKp1gY+rht/We1xN6Upm0Ny0Jlg8uMtX8d07wxFDAnu/c/+HRbearf1 tldzWOO3H1O4GVQZ0BiB5Qpv4cB74B5zgMg5OxnJHqrhP2OOcL42M1IATiuPSMPOaw3G 5KmGl5VsNt3Owl2bwaDJIC08F6tQ3luyhJ29l2Ir6M+oA7FWVSraLK2m/I41Wu3LMWWm U1AK4VlwdKvogqkcWNAdx/o2W1zkVE9UOFt9D4Px5JT+cjw9DEqDNQfLEllHYhw1Wxre Y9RC0V0mErFteaZCVpSH5sViBTBnvfyVH9zGTSdKqhAYD1xnQTbwVHmr4hjApQPKdoan qg3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Zmxwfx/r1inW19bL2vLPgWvCh2kO1sAGPwyDTVrSmLs=; fh=YaHi5PV+VYqjMq/AB/vbuxNRZGMKgTaIIrT/OOWEZuM=; b=E50bta6nodtjHmDoLVuqs4G7X5dgEoFJvwS0YYzalqHzhujT4v0FzmoCwcmEAmNpcw VKUnfIsz94+GoFnIIwLPp3Dgc4QQsUb3EKZ+FnGhVMWAlzgGql4cOOTxlDi5JCLGZQ8h xcEaUbzYbBWOB/x+bdLAix0luM7tJrkFqdlHXmBK8j0fQsgQw6Es9EZK5jaSwrxwXRZX kE0FYl0N3gH/SDm9Bar7zbQ//Bg0YUeYqDAV/sk5guq2EbheOxTJpHu4qmDYCWQRr3h1 cgfSQmt5qC56YWxUTMMOv0QkI4JJigjKmpXPW58bfrI+0YDlgqJWP/0oBW+sdSm5BdRr CVSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a170902c40600b001b22c8d0dc5si12680828plk.437.2023.08.02.20.09.00; Wed, 02 Aug 2023 20:09:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232873AbjHCClW (ORCPT + 99 others); Wed, 2 Aug 2023 22:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbjHCClT (ORCPT ); Wed, 2 Aug 2023 22:41:19 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009DFE0; Wed, 2 Aug 2023 19:41:11 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 8ABAF7FDC; Thu, 3 Aug 2023 10:41:09 +0800 (CST) Received: from EXMBX073.cuchost.com (172.16.6.83) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 3 Aug 2023 10:41:09 +0800 Received: from [192.168.1.218] (180.164.60.184) by EXMBX073.cuchost.com (172.16.6.83) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 3 Aug 2023 10:41:08 +0800 Message-ID: <45879269-e72b-b13a-00bc-2d10e9f90c2c@starfivetech.com> Date: Thu, 3 Aug 2023 10:41:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v7 5/6] media: starfive: camss: Add ISP driver Content-Language: en-US To: Laurent Pinchart CC: Mauro Carvalho Chehab , Robert Foss , Todor Tomov , , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , Philipp Zabel , Hans Verkuil , Eugen Hristev , Ezequiel Garcia , , , , References: <20230619112838.19797-1-jack.zhu@starfivetech.com> <20230619112838.19797-6-jack.zhu@starfivetech.com> <20230727204103.GJ25174@pendragon.ideasonboard.com> <2504080f-86af-161f-5c0d-284e89e33ce1@starfivetech.com> <20230802104840.GC5269@pendragon.ideasonboard.com> From: Jack Zhu In-Reply-To: <20230802104840.GC5269@pendragon.ideasonboard.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [180.164.60.184] X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX073.cuchost.com (172.16.6.83) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, On 2023/8/2 18:48, Laurent Pinchart wrote: > Hi Jack, > > On Wed, Aug 02, 2023 at 05:57:57PM +0800, Jack Zhu wrote: >> On 2023/7/28 4:41, Laurent Pinchart wrote: >> > On Mon, Jun 19, 2023 at 07:28:37PM +0800, Jack Zhu wrote: >> >> Add ISP driver for StarFive Camera Subsystem. >> >> >> >> Signed-off-by: Jack Zhu >> >> --- >> >> .../media/platform/starfive/camss/Makefile | 2 + >> >> .../media/platform/starfive/camss/stf_camss.c | 76 ++- >> >> .../media/platform/starfive/camss/stf_camss.h | 3 + >> >> .../media/platform/starfive/camss/stf_isp.c | 519 ++++++++++++++++++ >> >> .../media/platform/starfive/camss/stf_isp.h | 479 ++++++++++++++++ >> >> .../platform/starfive/camss/stf_isp_hw_ops.c | 468 ++++++++++++++++ >> >> 6 files changed, 1544 insertions(+), 3 deletions(-) >> >> create mode 100644 drivers/media/platform/starfive/camss/stf_isp.c >> >> create mode 100644 drivers/media/platform/starfive/camss/stf_isp.h >> >> create mode 100644 drivers/media/platform/starfive/camss/stf_isp_hw_ops.c > > [snip] > >> >> diff --git a/drivers/media/platform/starfive/camss/stf_isp.c b/drivers/media/platform/starfive/camss/stf_isp.c >> >> new file mode 100644 >> >> index 000000000000..933a583b398c >> >> --- /dev/null >> >> +++ b/drivers/media/platform/starfive/camss/stf_isp.c >> >> @@ -0,0 +1,519 @@ >> >> +// SPDX-License-Identifier: GPL-2.0 >> >> +/* >> >> + * stf_isp.c >> >> + * >> >> + * StarFive Camera Subsystem - ISP Module >> >> + * >> >> + * Copyright (C) 2021-2023 StarFive Technology Co., Ltd. >> >> + */ >> >> +#include >> > >> > This doesn't seem needed. >> > >> >> +#include >> >> + >> >> +#include "stf_camss.h" >> >> + >> >> +#define SINK_FORMATS_INDEX 0 >> >> +#define UO_FORMATS_INDEX 1 >> > >> > What does "UO" stand for ? >> >> "UO" is Usual Out, just represents output. :-) > > Maybe "out", "output" or "source" would make the code easier to read > then ? > >> >> + >> >> +static int isp_set_selection(struct v4l2_subdev *sd, >> >> + struct v4l2_subdev_state *state, >> >> + struct v4l2_subdev_selection *sel); >> >> + >> >> +static const struct isp_format isp_formats_sink[] = { >> >> + { MEDIA_BUS_FMT_SRGGB10_1X10, 10 }, >> >> + { MEDIA_BUS_FMT_SGRBG10_1X10, 10 }, >> >> + { MEDIA_BUS_FMT_SGBRG10_1X10, 10 }, >> >> + { MEDIA_BUS_FMT_SBGGR10_1X10, 10 }, >> >> +}; > > [snip] > >> >> diff --git a/drivers/media/platform/starfive/camss/stf_isp.h b/drivers/media/platform/starfive/camss/stf_isp.h >> >> new file mode 100644 >> >> index 000000000000..1e5c98482350 >> >> --- /dev/null >> >> +++ b/drivers/media/platform/starfive/camss/stf_isp.h >> >> @@ -0,0 +1,479 @@ > > [snip] > >> >> +/* The output line of ISP */ >> > >> > What is an ISP "line" ? >> >> A pipeline contains ISP. > > Patch 6/6 uses STF_ISP_LINE_MAX to iterate over the ISP lines. This > makes the code somehow generic, but you only support a single line at > the moment. Does this or other SoCs in your product line integrate the > same ISP with multiple lines ? If so, would it be possible to share a > block diagram, to better understand the other hardware architectures > that this driver will need to support in the future ? > Yes, OK, I will add a block diagram and a more detailed description in the starfive_camss.rst file in the next version. >> >> +enum isp_line_id { >> >> + STF_ISP_LINE_INVALID = -1, >> >> + STF_ISP_LINE_SRC = 1, >> >> + STF_ISP_LINE_MAX = STF_ISP_LINE_SRC >> >> +}; > > [snip] > >> >> +void stf_isp_init_cfg(struct stf_isp_dev *isp_dev) >> >> +{ >> >> + stf_isp_reg_write(isp_dev->stfcamss, ISP_REG_DC_CFG_1, DC_AXI_ID(0x0)); >> >> + stf_isp_reg_write(isp_dev->stfcamss, ISP_REG_DEC_CFG, >> >> + DEC_V_KEEP(0x0) | >> >> + DEC_V_PERIOD(0x0) | >> >> + DEC_H_KEEP(0x0) | >> >> + DEC_H_PERIOD(0x0)); >> >> + >> >> + stf_isp_config_obc(isp_dev->stfcamss); >> >> + stf_isp_config_oecf(isp_dev->stfcamss); >> >> + stf_isp_config_lccf(isp_dev->stfcamss); >> >> + stf_isp_config_awb(isp_dev->stfcamss); >> >> + stf_isp_config_grgb(isp_dev->stfcamss); >> >> + stf_isp_config_cfa(isp_dev->stfcamss); >> >> + stf_isp_config_ccm(isp_dev->stfcamss); >> >> + stf_isp_config_gamma(isp_dev->stfcamss); >> >> + stf_isp_config_r2y(isp_dev->stfcamss); >> >> + stf_isp_config_y_curve(isp_dev->stfcamss); >> >> + stf_isp_config_sharpen(isp_dev->stfcamss); >> >> + stf_isp_config_dnyuv(isp_dev->stfcamss); >> >> + stf_isp_config_sat(isp_dev->stfcamss); >> > >> > All these parameters are hardcoded, why are they not exposed to >> > userspace ? >> >> Here is a basic startup configuration for the ISP registers. The >> function name is confusing, as if it is configuring a specific >> function. In fact, it is just a basic init configuration. > > Did I miss a place in the patch series where all these parameters can be > configured by userspace, or is that not possible at the moment ? If it > isn't possible, do you plan to implement that ? > Yes, we are doing related development internally. >> >> + >> >> + stf_isp_reg_write(isp_dev->stfcamss, ISP_REG_CSI_MODULE_CFG, >> >> + CSI_DUMP_EN | CSI_SC_EN | CSI_AWB_EN | >> >> + CSI_LCCF_EN | CSI_OECF_EN | CSI_OBC_EN | CSI_DEC_EN); >> >> + stf_isp_reg_write(isp_dev->stfcamss, ISP_REG_ISP_CTRL_1, >> >> + CTRL_SAT(1) | CTRL_DBC | CTRL_CTC | CTRL_YHIST | >> >> + CTRL_YCURVE | CTRL_BIYUV | CTRL_SCE | CTRL_EE | >> >> + CTRL_CCE | CTRL_RGE | CTRL_CME | CTRL_AE | CTRL_CE); >> >> +} > > [snip] > Regards, Jack Zhu