From patchwork Tue Apr 13 10:57:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 12200195 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 99383C433B4 for ; Tue, 13 Apr 2021 11:17:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24ADF61019 for ; Tue, 13 Apr 2021 11:17:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24ADF61019 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yIZ/8dy9ht31GLDokCUIYgcHAQqflQiXmnoCaQRxxV0=; b=opUjGHKwuhM3tHhpQbappjoRl PbTD+RSolyc/LZej30HEJkQGr5PJIXVqcUu0nTlB2WPhxQE9qXrHxSzaQXqzKRKK1boJvvu2i5fY8 7TOa4ykVfHAmBDmKU4cY27XgmO0XdE9FBDZiG2pLyoC5RdRgCBSsq2nBUsZECs7TnIHgiudW0rL1F Lr+8uxZg1jjuFtds3bGUP4zb9fbb/185e/g56b/3nXR6lqHrwh69hov4KGfS2DSUCyH7mfFYNg68h 7SobOznDhhIqZpPeGh07hLKsQrPSBJHpJKcsFo4sl8AR8+2RIFehGFV5kg5UDACwgtZdyLaL2t1Kn PCC2Sx60w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWGzX-008zKC-DQ; Tue, 13 Apr 2021 11:14:14 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWGod-008wjZ-Be for linux-arm-kernel@desiato.infradead.org; Tue, 13 Apr 2021 11:02:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=AEevZzicEwLHfEzd+jcEv+agf2FgwIA+Zs1QVgtcMSw=; b=UoNSQhSACLKHWSje1bqGjWwoYD D0eKymy7fVvRSXbyfGYla/Kpd1892+H6cJhJEhgIVMd5f+Ff/c5Cd9bYMCextt2mxw4E8mIHj2xAo 7ZAg4IRVZF59Ftzn3ycpuLsps04AjnFy4HVXzTupyu7NKbiGmDR4lh2tvTrGx0oq4DmU+Uv7PSOj9 W4nUEbete4EvAmNEjIwK+RYS+aPyCvv9vCZAB4b2aJAtDVJK8AC1QHxDljh10Rf1hSnEeLxRxOOg2 SbPPXVlZoPp2fT1XTaXL/BeL/9dkrp+yK+n8p+EfalPI14mXL+IkKe+YTxttl/1plBdIOY6iqFqEa hAh3QXSw==; Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWGoa-006wrU-MA for linux-arm-kernel@lists.infradead.org; Tue, 13 Apr 2021 11:02:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1618311760; x=1649847760; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+ci3BxOvgqOJkzLlshiYqigPnpc/QcaJhMcnuW3svJs=; b=jyv590TY0Pw7CKD66UvDZVYSJ9NFrt3c+PoRD7FBpmEFvNESss4GBgBo ELVKbI2N/VzjNfSEaIL5Gn84BIK8QqqxJnDYxRLvNk6svlE5wv3HZafXp AKgAu2Xs07wc05NTfgr0la+WovDnJeANF+hR0ajLWKf9gz80/csnZJs3q 3rRZwkrDSIbcRLxna0YUcVbFybXKmP+wSNNVqURTv7J6l7METgHYyDjNt PsUhbbrTQdi/Y/Qn6AoxxB5ytyaD15QfZSMOwOGt9+qVlOVwkJckcQNNv gy8TvbYrfIUMp4Sz/jpNI9f8Wme/j9fcyWC1HrH7ywfy7rueZI2nUn7qh Q==; IronPort-SDR: exVtRFyQKFzY0Zbtpy+5qWmJYpYRkn68WNne2TIeReBWFXmfGjPa+ZTIgW574Xtgt1K9nTbPBH 1/qXMiGSTa8Ii2DvRtkOSYWFrEZ5WS44p9MV7pVcjg/bn64a+0NGezaDyvzHkL+79dO87a6Gxr J3nrHOsgGSO1HSOzwgPF0RUGT6APALna6Xz0akWmxlDsYBJRQvnWEahuDctHWH8A6SUMubfOAV zwB2WmnIvlgu8sC4R1e+JHV4S2UQsyXB8P7bGsrhMa5oPWivvhrjaAdpf/2e/H06PqITV54yZL iPs= X-IronPort-AV: E=Sophos;i="5.82,219,1613458800"; d="scan'208";a="110612093" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 13 Apr 2021 04:02:39 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 13 Apr 2021 04:02:39 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 13 Apr 2021 04:02:28 -0700 From: Eugen Hristev To: , , , CC: , , Eugen Hristev Subject: [PATCH v3 19/33] media: atmel: atmel-isc: add CC initialization function Date: Tue, 13 Apr 2021 13:57:17 +0300 Message-ID: <20210413105731.610028-20-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413105731.610028-1-eugen.hristev@microchip.com> References: <20210413105731.610028-1-eugen.hristev@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210413_040240_810117_068906D6 X-CRM114-Status: GOOD ( 11.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The CC submodule is a part of the atmel-isc pipeline, and stands for Color Correction. It is used to apply gains and offsets to the chroma (U, V) components of the YUV elements. Implement the CC submodule initialization, as a product specific function, which currently configures the neutral point in color correction. Signed-off-by: Eugen Hristev --- Changes in v3: - added module description in commit message Changes in v2: - addded function prototype to avoid warning with W=1 drivers/media/platform/atmel/atmel-isc-base.c | 1 + drivers/media/platform/atmel/atmel-isc.h | 3 +++ drivers/media/platform/atmel/atmel-sama5d2-isc.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index 66005cb3940f..182903803c05 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c @@ -653,6 +653,7 @@ static void isc_set_pipeline(struct isc_device *isc, u32 pipeline) isc->config_csc(isc); isc->config_cbc(isc); + isc->config_cc(isc); } static int isc_update_profile(struct isc_device *isc) diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h index f574bcc3ba67..a5f8d5001381 100644 --- a/drivers/media/platform/atmel/atmel-isc.h +++ b/drivers/media/platform/atmel/atmel-isc.h @@ -225,6 +225,8 @@ struct isc_reg_offsets { * specific CSC module * @config_cbc: pointer to a function that initializes product * specific CBC module + * @config_cc: pointer to a function that initializes product + * specific CC module * * @offsets: struct holding the product specific register offsets */ @@ -298,6 +300,7 @@ struct isc_device { struct { void (*config_csc)(struct isc_device *isc); void (*config_cbc)(struct isc_device *isc); + void (*config_cc)(struct isc_device *isc); }; struct isc_reg_offsets offsets; diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c index 0ff13198d732..0ce8293622f9 100644 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c @@ -56,6 +56,7 @@ void isc_sama5d2_config_csc(struct isc_device *isc); void isc_sama5d2_config_cbc(struct isc_device *isc); +void isc_sama5d2_config_cc(struct isc_device *isc); void isc_sama5d2_config_csc(struct isc_device *isc) { @@ -86,6 +87,19 @@ void isc_sama5d2_config_cbc(struct isc_device *isc) isc->ctrls.contrast); } +void isc_sama5d2_config_cc(struct isc_device *isc) +{ + struct regmap *regmap = isc->regmap; + + /* Configure each register at the neutral fixed point 1.0 or 0.0 */ + regmap_write(regmap, ISC_CC_RR_RG, (1 << 8)); + regmap_write(regmap, ISC_CC_RB_OR, 0); + regmap_write(regmap, ISC_CC_GR_GG, (1 << 8) << 16); + regmap_write(regmap, ISC_CC_GB_OG, 0); + regmap_write(regmap, ISC_CC_BR_BG, 0); + regmap_write(regmap, ISC_CC_BB_OB, (1 << 8)); +} + /* Gamma table with gamma 1/2.2 */ const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = { /* 0 --> gamma 1/1.8 */ @@ -233,6 +247,7 @@ static int atmel_isc_probe(struct platform_device *pdev) isc->config_csc = isc_sama5d2_config_csc; isc->config_cbc = isc_sama5d2_config_cbc; + isc->config_cc = isc_sama5d2_config_cc; isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET; isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET;