From patchwork Mon Apr 19 14:33:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathias Steiger X-Patchwork-Id: 12211991 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_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 4A824C433ED for ; Mon, 19 Apr 2021 14:33:58 +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 C039861245 for ; Mon, 19 Apr 2021 14:33:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C039861245 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:Subject:To: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=rEpV6JpmDg1PKEZXUSd80cEizGv6qRqNK36P5LDWp8k=; b=S5MbMN4aAT3q43 Vqh+RdJYIRbdP3UFaOSrEFJSJsLoOO7YyDGbtEkXAXaQgN0ikgIWJSfDOW/+t6a/4ebHsbMkrynlD mZaLaV2zCCHiiwTCzx7FNEyX+7kZRoKgkbuGomh3gKKYCSFBwVE9B6UEGor171TGW7W70US+de8e3 +tCkjKus+eGYkKrtw3yWaZ7GhuvPqUpdexaV/moTmoEBXWeJhCvS4Yja25oApSrpEoUPrPYEkPrnW ssNRyLx1Whm+myMgyhq4ha71licTQkVVxsn0tiawGMF1nuzXG6+y6PvhXNmkbjbbuNX2MczKCm14p s5obd88ehYlADngQSkkg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYUyB-00A7DN-Ui; Mon, 19 Apr 2021 14:33:48 +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 1lYUy9-00A7D4-ND for linux-amlogic@desiato.infradead.org; Mon, 19 Apr 2021 14:33:45 +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:Subject:To:From:Sender:Reply-To:Cc: Content-ID:Content-Description:In-Reply-To:References; bh=oKZAehqJ4oAgTXaYrnAjdz/9vs3QBaSC/v5Wi00rjQY=; b=o7hCPWVbQbfrovR22YjsUYYkWa IcpkIx1QBCZzn2t/Nj15Sq6dNnB6V5RSrW/k2sNNyd9KPTifjSncEyjzpKVaxBAqqtnedTM8iQxtq h7AFd1piJLt1naoQX2kAAYWcnFFrOWRDLzCt0rltp3yCgrzn5fCfAeW9LiWnR/QUXpSnGUAKek9yJ 0nNEAtUPgXxu4Ve4GCAzCurgsUbro5o3Hd0GBAJq/IP4J4pNY1d23KdOdMl34Ewjk4zJ2QEnajI3D xkwOIIEE9t4r8GDvVgwjo/WZxImX72Xvi/i6VAPkl+PjRPR2R0a8bak5rrdjrSj+xSm03T5hXwem3 o022wXyQ==; Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYUy6-00BSH9-PL for linux-amlogic@lists.infradead.org; Mon, 19 Apr 2021 14:33:44 +0000 Received: by mail-ed1-x531.google.com with SMTP id bx20so39848874edb.12 for ; Mon, 19 Apr 2021 07:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=oKZAehqJ4oAgTXaYrnAjdz/9vs3QBaSC/v5Wi00rjQY=; b=a4aAfTXpmWCq7/xR9/53kW7ari2bmGi6wvp63W6JjnTW3XoH1xKiM5e6M+EUCXi0Lc gMeDuf//scl+Tln44hwnF2/f8/Rgx3VKoLbseKhI0cPavGQOdpTrlCf57b+hHQFKcOk5 wmCcqor/5KcMjGvSL6U7g52zCNgpIBpuZAt0KRBt0CVyM12EF1NRpDDNYdCzgFBkJj2z +lPyV9ZhjoxVdy2tEN6H91R7SHNGvu4lQUfDlfzIvfZyiz91PsaheVj5fO8DOx8yv3MA /kvxaZZpmy0SEWtY241XEFXVjs2VJac2pvtgKaFt4XLaEvDUuxYDw4ENzRk0r1vCGECA kqyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=oKZAehqJ4oAgTXaYrnAjdz/9vs3QBaSC/v5Wi00rjQY=; b=K0sum5r68n6a6U7T4t52lXZU8AgjBfVB4JAmZqASBpUhQyneW3N+BUyeAtN5cxNpgA DsrDpfXxXlSPrP3tp1gMeoD9ahJtJSsiUxu22c/YezCLZEZ6IyA0sHw4BmGLYaEOf/YV Lo/Yn+9lc7skDHZqokSwNg7TYNQxyO28UZ6wD0ze/DYikChQUqW/069/tqN0/tytcba4 J/zD5yfgOymiM3wopN/mnxnq3lYvSME/TNOTg6aQnPNOVwJFEVV7soJT3usHCHVMwx6A 51IsBJtYL5mm4MgQVlM4tVOv0HZFmkIhamVBtoamELlBEt7zdZIymnuUbV3npoiB0Iy5 mqtA== X-Gm-Message-State: AOAM532/AnOvw/z7D4vyiQqapaaZdh40obiATb7HVPy7QB0jCxcpCIEZ az9T7qpvF4tSv+xTbljuoxM31B4SaJ4= X-Google-Smtp-Source: ABdhPJwxShnbjmCItEjd1W7Ev4y+gJluRa69/x5TG/XGGFY/Lq0DjgYz9X+pcKBlJ2pYyrYXFScZ1A== X-Received: by 2002:a05:6402:1051:: with SMTP id e17mr26217520edu.42.1618842820446; Mon, 19 Apr 2021 07:33:40 -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 yr16sm10491584ejb.63.2021.04.19.07.33.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Apr 2021 07:33:39 -0700 (PDT) From: Mathias Steiger X-Google-Original-From: Mathias Steiger To: linux-amlogic@lists.infradead.org Subject: [PATCH] fix green/pink color distortion from HDR set during vendor Uboot Message-ID: <50fb92c7-28f2-f3c8-7986-425cdac77c78@gmail.com> Date: Mon, 19 Apr 2021 16:33:39 +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-20210419_073342_846677_2C5A53DB X-CRM114-Status: UNSURE ( 9.31 ) 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 I also wrote a program to set this via /dev/mem from user space: https://github.com/ballerburg9005/android-tvbox-2-linux-pc-and-server/blob/main/fix_greenpink.c . Tested-by: Neil Armstrong diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 453d8b4c5..7d929b5b2 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -308,6 +308,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)         drm->mode_config.funcs = &meson_mode_config_funcs;         drm->mode_config.helper_private = &meson_mode_config_helpers; +       /* undo settings made in vendor Uboot */ + +       writel_bits_relaxed(15 << 13, 0, priv->io_base + _REG(OSD1_HDR2_CTRL)); // fixes green/pink color distortion - reg_only_mat must be 0 +         /* Hardware Initialization */         meson_vpu_init(priv); diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h index 446e7961d..91351f9a3 100644 --- a/drivers/gpu/drm/meson/meson_registers.h +++ b/drivers/gpu/drm/meson/meson_registers.h @@ -634,6 +634,9 @@  #define VPP_WRAP_OSD3_MATRIX_PRE_OFFSET2 0x3dbc  #define VPP_WRAP_OSD3_MATRIX_EN_CTRL 0x3dbd +/* osd1 HDR */ +#define OSD1_HDR2_CTRL 0x38a0 +  /* osd2 scaler */  #define OSD2_VSC_PHASE_STEP 0x3d00  #define OSD2_VSC_INI_PHASE 0x3d01