From patchwork Tue Apr 27 23:11:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Steiger X-Patchwork-Id: 12227813 X-Patchwork-Delegate: neil.armstrong@linaro.org 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=-12.2 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 6B1CFC433ED for ; Tue, 27 Apr 2021 23:12:13 +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 DBEFA6101E for ; Tue, 27 Apr 2021 23:12:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBEFA6101E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:To:Subject:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3rD5rH/NQvvKH0B0l8IvehLykQp8AfUKGqdi6q5+duA=; b=C27UEoFtNDjfCw RhMBBUC3gjMO4oL7daP19GmkgJj0+krQzPm5bu+9yTn+HyhnqKPYN8rC2IYT0QVwF4sIcyTZrZOgS 8rK35b6zc6bC9FPxQotb1blBxr5C9zRTWQX1C39OSwqdEidKMXkdRrwQU0Z0+2oVBnzw1+HZW4yes Ew++MYFRC/gPZAP+nvPH6+OJaObCNUPYxzU9wZxHgDfahl0gVwp/fLfK7I9g31WyWbtRGAWT7aEyV K//9Uus3wulRdh7CaHb/lmLMJoPXXSvHDid7eir350J5Uo3hzBUhmdi4vsHJaZ/lkSB89vZXmROkN HhRpMxQaFQku9zdnSDwg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbWs9-002PSY-C4; Tue, 27 Apr 2021 23:12:05 +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 1lbWs6-002PS9-Vm for linux-amlogic@desiato.infradead.org; Tue, 27 Apr 2021 23:12:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Date:Message-ID:To:Subject:From:Sender:Reply-To:Cc: Content-ID:Content-Description:In-Reply-To:References; bh=AcibveHDn93ooDnTAsAtrJ7uAfFOj7nW+iC8w4TrfVU=; b=SNIf5TxW9QPbW4NSzdQL0gR0uJ lCYUELG28jbGLcxcYDECJQSUJ/aMG2rVmZxy+P/vtw+R0UpRj7gUyah5O4WyOp7ZbhAnYq1+HrpAS eXM1EU+4nJ9pROrMWjAhc0mPrgOKJUAAdVfYtFhC73dp5JqiWYkFtUxhF35DfetTAIG6mjpcjf5NP y6fzQ7n40ncTymhO7Dl1qbDlsI6OJNTHma6eMpTJ+SM8FMjojdh+ziQjUp8Wt86AdYL4vz0/jZx/j KVShsci28nYPmpDE5DWc8EvwEpWiMlpznUH3sjqKT9P7YhZFBYL03geYuHHhBifAB9/RJg2QYgKh7 8j13dYQQ==; Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbWs4-00H5NH-Bj for linux-amlogic@lists.infradead.org; Tue, 27 Apr 2021 23:12:01 +0000 Received: by mail-ej1-x633.google.com with SMTP id n2so91784921ejy.7 for ; Tue, 27 Apr 2021 16:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=AcibveHDn93ooDnTAsAtrJ7uAfFOj7nW+iC8w4TrfVU=; b=tJXAkiBqPChc390/gx1OD4URBRqxDfbgigAwVixE3owSsvc6hGeJ/+/5PPgZin5djG RLCoy/d2vy98AukHw1+9rjXxcpJzOHBrnTBHIFY9+RC/LX7kYIa5wW5djFACL+5RfKer whHMUKz3HD67fSP/HvgvZvDfEXlYYdMFo9IlaRP6iang2aYRu9bDPXKNo+i+itCXf67/ hYrJWQ3POgICoeFWF/RT29iy3cpiNbsBIYUAUZifr6tgusj7WJN+IuMWzEQD/E/0oQDT ksshwxYfk6X+66vLdOkDM0Ql2Qp3CLYZ9YU1afT0rtKvIfEySCNhUofT4G33pQg6zMGH zcRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=AcibveHDn93ooDnTAsAtrJ7uAfFOj7nW+iC8w4TrfVU=; b=cV+Nh/ZEPBWFWBMIIg7UdLBpL3m1YlAkeLEEdjVvU2BHKOomvJNCxv5wdj0tKXmnkv i+qLkvJVdocI9bQNiA0pjLLScjWpArr05VEyAbizdwqxfk1GQfCh+oP5FnkNpJZHVFMH r9sPEyEGgfaZ9x/FeWvNy6GSPE4TKQO7zecX/dyA6Zrx7r/PM1QM4B5+gpPfskOG6Ebb KZNOQdvcBZ+KMhTWDlzFyZlPgUR6APviO+csR9ILqZUhRUAgzOGev14WwwDwuFRpsaQH bphH1j5e2589Oxhlp/NHNJRX9ua/jyvr8e1SDKsu/H/q7BdReMBEOgzKRAZaKvMgd+1h Br3A== X-Gm-Message-State: AOAM531GsHYeQokfPrJWvtYiJpgIAufkRUYarYeOAEv7UdgsWR5ac/jV 8nNIpfFVHvOUjTWYRtV6vTJ2ZHMbKz0= X-Google-Smtp-Source: ABdhPJyD/iqpq6J0/9N40pD6BqE3O51J486Hb8krQkaAizZwxbAhgYjhqxLaJgYEQW9FrvlfV76T8w== X-Received: by 2002:a17:906:6789:: with SMTP id q9mr25836382ejp.295.1619565118005; Tue, 27 Apr 2021 16:11:58 -0700 (PDT) Received: from [192.168.178.24] (dslb-002-203-240-209.002.203.pools.vodafone-ip.de. [2.203.240.209]) by smtp.gmail.com with ESMTPSA id g4sm27642edq.0.2021.04.27.16.11.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Apr 2021 16:11:57 -0700 (PDT) From: Mathias Steiger X-Google-Original-From: Mathias Steiger Subject: drm/meson: fix green/pink color distortion from HDR set during vendor Uboot To: linux-amlogic@lists.infradead.org Message-ID: <553e127c-9839-d15b-d435-c01f18c7be48@gmail.com> Date: Wed, 28 Apr 2021 01:11:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_161200_433195_5F1E6523 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Fixes: 728883948b0d ("drm/meson: Add G12A Support for VIU setup") Tested-by: Neil Armstrong diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h --- a/drivers/gpu/drm/meson/meson_registers.h +++ b/drivers/gpu/drm/meson/meson_registers.h @@ -634,6 +634,11 @@ #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd +/* osd1 HDR */ +#define OSD1_HDR2_CTRL 0x38a0 +#define OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN BIT(13) +#define OSD1_HDR2_CTRL_REG_ONLY_MAT BIT(16) + /* osd2 scaler */ #define OSD2_VSC_PHASE_STEP 0x3d00 #define OSD2_VSC_INI_PHASE 0x3d01 diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c --- a/drivers/gpu/drm/meson/meson_viu.c +++ b/drivers/gpu/drm/meson/meson_viu.c @@ -426,8 +426,14 @@ void meson_viu_init(struct meson_drm *priv) meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL)) meson_viu_load_matrix(priv); else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) + { meson_viu_set_g12a_osd1_matrix(priv, RGB709_to_YUV709l_coeff, true); + /* fix green/pink color distortion from vendor uboot */ + writel_bits_relaxed(OSD1_HDR2_CTRL_REG_ONLY_MAT | + OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN, 0, + priv->io_base + _REG(OSD1_HDR2_CTRL)); + } /* Initialize OSD1 fifo control register */ reg = VIU_OSD_DDR_PRIORITY_URGENT |