Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp828046rwo; Wed, 2 Aug 2023 05:02:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlGZdGBewPjldcig7c4xZyuNSKcq7NgQYR1nRI8i7lpJRmbPyrV4j9TWs9XOe7hBcNthDHRt X-Received: by 2002:a2e:9bc2:0:b0:2b6:c528:4940 with SMTP id w2-20020a2e9bc2000000b002b6c5284940mr4896644ljj.3.1690977751027; Wed, 02 Aug 2023 05:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690977750; cv=none; d=google.com; s=arc-20160816; b=DjSPlFvlTwICTAZQ1mFqn352Ll/0+u270lmm7oSogqQp7yZVRCCQzJxqLD4eV/tmp/ UtgFcMxqEERaDu5PQHYcScxegIAhR4wjGuhv+e6b2Dx+MAAKZ8NAVaS9UR6YRdsK+N+R RGFU2KU/EvLtZrLKdy4iuMGXqbyDHW5mlRlogEnMAhAAy2qb1mfGpDU2y3wX6p0T/E8q t/gBme1UoGsciBv0GO6/4oXmYpqlokJscWSc5bhpcIlfRxUes3CkFzYoAkmZ9FshTM4u eOVz4057Wxlf5tadlaGZeABqMQNlyU6Nj0dGxmcQCndp084sVCg8t3dSp6weR1fkH8On QUHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PM6E4sXjIJEtI55w4Br5UGIKe+yMx1/GPEvSLC6Rl5U=; fh=YrNRKSOJ9n58k/QyW1NHfB6HsEAto67M2el7wCk3fus=; b=LBm2axCczTgk5PgL7nSsXF1Zvh9Zp7HwrZc1wFmHzmwXm0Prb2ACQ9DreVziS1XIvM 2ECtYbrpdBGecAS/WviJHN2k7JvuMxdHpvFAv0ZK8kUJBrQym29u4I78p0BWhWfY4FeS tW1FSyiEzJm24yD0QAtBc5mOexjoXQCXEnKzBtZPvCFyn/ZdslTKj+y89mH0oBjNLPE3 YCO1QnMfbj5dVWTExw3rdHn28ctnX2XXyRijZZ3ocI7vx+ME9Ae1pPr/kKjcp7CshNBj yIc8HTyZLPfhvpKhrGsn2s9nyIdeA3EUpOnwdMsRruYOtCT8sERusn4rEH5ijpWRgZJu 4wGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=MDbOx5sf; 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 v23-20020a1709063bd700b009827e07cca6si1460275ejf.17.2023.08.02.05.01.52; Wed, 02 Aug 2023 05:02:30 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=MDbOx5sf; 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 S232904AbjHBKs4 (ORCPT + 99 others); Wed, 2 Aug 2023 06:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbjHBKsi (ORCPT ); Wed, 2 Aug 2023 06:48:38 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29300127; Wed, 2 Aug 2023 03:48:36 -0700 (PDT) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C0608DA; Wed, 2 Aug 2023 12:47:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690973251; bh=BQQuyIYqigAYelg5Ief38eObVX2dLE8ROydCS9EGEEM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MDbOx5sfyvuE7MogjBFDsqypfGjddGYz8O8dq9ValVjbY1at1P15qHSG8/uF9P0h2 p0NhuPlH/mq8knezlapfPfMXeX0ro0arIIJsau3E9K+KJRxPUX8MNt+V6vjsQrVelv Md1pcJ6qAM86P56V864lUr1ZmFBJFeuHyL/Hy0EQ= Date: Wed, 2 Aug 2023 13:48:40 +0300 From: Laurent Pinchart To: Jack Zhu Cc: Mauro Carvalho Chehab , Robert Foss , Todor Tomov , bryan.odonoghue@linaro.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Hans Verkuil , Eugen Hristev , Ezequiel Garcia , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, changhuang.liang@starfivetech.com Subject: Re: [PATCH v7 5/6] media: starfive: camss: Add ISP driver Message-ID: <20230802104840.GC5269@pendragon.ideasonboard.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2504080f-86af-161f-5c0d-284e89e33ce1@starfivetech.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 ? > >> +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 ? > >> + > >> + 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, Laurent Pinchart