From patchwork Thu Dec 14 06:50:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changhuang Liang X-Patchwork-Id: 178516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8359018dys; Wed, 13 Dec 2023 22:51:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXcf0TYMW4UbjjC56x6JL8JCaveJhWUdBnlLmtQ6x04Kyv2QeIm2lk/eQm3f463SseFUvA X-Received: by 2002:a05:6e02:184b:b0:35d:6d53:5439 with SMTP id b11-20020a056e02184b00b0035d6d535439mr14615493ilv.11.1702536719297; Wed, 13 Dec 2023 22:51:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702536719; cv=none; d=google.com; s=arc-20160816; b=WJXQ6URu6EBiKyh3GKRA53dl3oYD6jhViKJYSZgGO6OPZvo+HMrKhyXz5PsU9HIyK2 4+YIImZBypqL6ZKqpF/K2nfUEdf35+pd/IUIzk9RhRO1MNF3NJUsOOtk4X1WsMTcwFlR JJHBVYjMcA5nbki5Iav989xgpCkNsadDQO7C4pjcRamob/JpKHMZhUUNtceDQyt5XY4B xAfKTtT2TQPjsJQXUengEzSJOxdK9G2wfAeC8kfw73WDRVwuWZe6joHPutPrLj2i2AQS ITUH1ZX+UeKcHJmjxlDArkbty19h9RQD76lrDSR1nA7FHTN9ucdy5eJmA3fkA2WHIHou Ml2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vCZcF7IeV7yuKdGJRyLf+lmvc672QR3h+iZaBpdzF8I=; fh=XQ3Ja9wKcqhsASYYLMElzkCFsrajr0VCo6/O7Hk5SL4=; b=xo60myDE0iEMY4KbfnM0ds+5M8qVL1pwVrXq4k49KbQkXaM5EWt+QLNLpr3YyWdREY v4dPVE2U9tnE3RcIw79TX18uM2RoRjN2nwdIzvOt/sknqcF8Sq5Le0cLMSh+SG3XUrhz x+E1YAbb/vYJG7RXGZJucebBGDUAoT1gQIheHzcm4CGiDFGZ8PhjIJmvXRR8BZtivUPk ss5gTvI4JKsEQE8TFaK+JzRUL8mg7YphwzZXV/osyx91Qw0VDubCMuSfDnXk9OLNPnr/ /AiluMtpqxmz8RDl/DU4FCC9N6HcLzA1AWsqkIErDaJEG5WsYcIwbnYBSdKRMgtQ078h OJAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id az4-20020a170902a58400b001d05ec3be0bsi10765100plb.130.2023.12.13.22.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 22:51:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E377080DD86D; Wed, 13 Dec 2023 22:51:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443308AbjLNGvA convert rfc822-to-8bit (ORCPT + 99 others); Thu, 14 Dec 2023 01:51:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443261AbjLNGuj (ORCPT ); Thu, 14 Dec 2023 01:50:39 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EEAFE8; Wed, 13 Dec 2023 22:50:46 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id B2D1024E2FB; Thu, 14 Dec 2023 14:50:44 +0800 (CST) Received: from EXMBX062.cuchost.com (172.16.6.62) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 14 Dec 2023 14:50:44 +0800 Received: from ubuntu.mshome.net (113.72.145.168) by EXMBX062.cuchost.com (172.16.6.62) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 14 Dec 2023 14:50:40 +0800 From: Changhuang Liang To: Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans Verkuil , "Marvin Lin" , Bryan O'Donoghue , "Ming Qian" , Laurent Pinchart , Nicolas Dufresne , Benjamin Gaignard , Tomi Valkeinen , Mingjia Zhang , Geert Uytterhoeven , Sakari Ailus , Dan Carpenter CC: Jack Zhu , Changhuang Liang , , , Subject: [PATCH v1 6/9] staging: media: starfive: camss: Update ISP initialise config for 3A Date: Wed, 13 Dec 2023 22:50:24 -0800 Message-ID: <20231214065027.28564-7-changhuang.liang@starfivetech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231214065027.28564-1-changhuang.liang@starfivetech.com> References: <20231214065027.28564-1-changhuang.liang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.145.168] X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX062.cuchost.com (172.16.6.62) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 22:51:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785239142511073532 X-GMAIL-MSGID: 1785239142511073532 Upadte ISP initialise for 3A statistics collection data. Signed-off-by: Changhuang Liang --- .../media/starfive/camss/stf-isp-hw-ops.c | 23 +++++++++++++++++++ .../staging/media/starfive/camss/stf-isp.h | 11 +++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c b/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c index c6295a14d509..a1ab4f11718e 100644 --- a/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c +++ b/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c @@ -319,6 +319,25 @@ static void stf_isp_config_sat(struct stfcamss *stfcamss) stf_isp_reg_write(stfcamss, ISP_REG_YADJ1, YOMAX(0x3ff) | YOMIN(0x1)); } +static void stf_isp_config_sc(struct stfcamss *stfcamss) +{ + stf_isp_reg_write(stfcamss, ISP_REG_SCD_CFG_1, AXI_ID(0)); + stf_isp_reg_write(stfcamss, ISP_REG_SC_CFG_0, HSTART(0) | VSTART(0xc)); + stf_isp_reg_write(stfcamss, ISP_REG_SC_CFG_1, + SC_WIDTH(0x1d) | SC_HEIGHT(0x15) | + AWB_PS_GRB_BA(0x10) | SEL_TYPE(0x3)); +} + +static void stf_isp_config_yhist(struct stfcamss *stfcamss) +{ + stf_isp_reg_write(stfcamss, ISP_REG_YHIST_CFG_0, 0); + stf_isp_reg_write(stfcamss, ISP_REG_YHIST_CFG_1, + YH_WIDTH(0x77f) | YH_HEIGHT(0x437)); + stf_isp_reg_write(stfcamss, ISP_REG_YHIST_CFG_2, + YH_DEC_ETW(2) | YH_DEC_ETH(1)); + stf_isp_reg_write(stfcamss, ISP_REG_YHIST_CFG_3, 0); +} + int stf_isp_reset(struct stf_isp_dev *isp_dev) { stf_isp_reg_set_bit(isp_dev->stfcamss, ISP_REG_ISP_CTRL_0, @@ -351,7 +370,11 @@ void stf_isp_init_cfg(struct stf_isp_dev *isp_dev) stf_isp_config_sharpen(isp_dev->stfcamss); stf_isp_config_dnyuv(isp_dev->stfcamss); stf_isp_config_sat(isp_dev->stfcamss); + stf_isp_config_sc(isp_dev->stfcamss); + stf_isp_config_yhist(isp_dev->stfcamss); + stf_isp_reg_write(isp_dev->stfcamss, ISP_REG_DUMP_CFG_1, + DUMP_BURST_LEN(3) | DUMP_SD(0xb80)); 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); diff --git a/drivers/staging/media/starfive/camss/stf-isp.h b/drivers/staging/media/starfive/camss/stf-isp.h index bfb7196cefff..149f06b25416 100644 --- a/drivers/staging/media/starfive/camss/stf-isp.h +++ b/drivers/staging/media/starfive/camss/stf-isp.h @@ -417,6 +417,17 @@ #define DNRM_F(n) ((n) << 16) #define CCM_M_DAT(n) ((n) << 0) +#define ISP_REG_YHIST_CFG_0 0xcc8 + +#define ISP_REG_YHIST_CFG_1 0xccc +#define YH_HEIGHT(n) ((n) << 16) +#define YH_WIDTH(n) ((n) << 0) + +#define ISP_REG_YHIST_CFG_2 0xcd0 +#define YH_DEC_ETH(n) ((n) << 16) +#define YH_DEC_ETW(n) ((n) << 0) + +#define ISP_REG_YHIST_CFG_3 0xcd4 #define ISP_REG_YHIST_CFG_4 0xcd8 #define ISP_REG_YHIST_ACC_0 0xd00