From patchwork Fri Nov 4 14:09:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Ranquet X-Patchwork-Id: 15572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp429608wru; Fri, 4 Nov 2022 07:15:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VIiBJNSzibRpBZI9qd+4+dtZjgBGv3FukgPKTgyt4C8z5ybVU0JauL9uwlHDGD89p5fcI X-Received: by 2002:a05:6a00:8d6:b0:56d:67d8:10a with SMTP id s22-20020a056a0008d600b0056d67d8010amr27558578pfu.28.1667571350250; Fri, 04 Nov 2022 07:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667571350; cv=none; d=google.com; s=arc-20160816; b=QG2XVtV8aM64B5YvNXxsz7ERO011eGB6obY4wjqcswZD8lHCeIkZ571vaZYLq+tuTp kpoLYVrrAL30qLV/c1My7oXDWUSQWr7BWVioTr55pxZkQq/7EemMb8+PTqOk+tje7AAE ZrmXzINnF3gvRflX6XN7kAsbPMZ1X39a7vEf3iNtQKM8pxe5lw/AtDFIGOl8XgyxgKkn WYpicDdI4j4aWxfg2YvZ4lfUycGxlPEs9wNk+YS18URl2mFKUAg6vzfbkZVxtXOgmrOK +Xdy1LCFZdgX3E9txhrllGybuIIKBwx2ThpyQ+dpLTBrTU4ZTnB0VrWOZKZKWGLisMlq iv0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=6zHUtmTd6RGvQvohicUDo1+C3cWxOXttYxoZ7C1AyNM=; b=EVk9sSHZcXr2VB9gtjnUXh6Qv2qfI2kkso80j1NkDzimgR6Mh8AJh2oHdC8JEOKnQW yO2iDVXNCfPlzTyMp6zPaQ3Fm3Y3HLtHOW+pfb+hxErpSVu4BPBEk/U1+yPwhdU4/u7V ssYs/LZqLj/PLBPQRYXsqhEfDJtu88J0gjNmeBFJIOCyuzqRmSQNO0tlCwRB/hoeR2E3 N5MiZEUkHLd+IjQuipvjwAoEe1rj29BF0EB2rxR4AXj61nIE/ecEf3SXRZki/qmTxZzN prE8KW8CrpNdeULXkzM9JAlDspVHnR8rMVRwzWQwgOl4GXrpavbbI9B2fvwwJqEIJDBM MTkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=sZpvZ48Z; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il2-20020a17090b164200b002130aae4825si4218263pjb.9.2022.11.04.07.15.34; Fri, 04 Nov 2022 07:15:50 -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 header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=sZpvZ48Z; 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 S231911AbiKDOOf (ORCPT + 99 others); Fri, 4 Nov 2022 10:14:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231205AbiKDOOU (ORCPT ); Fri, 4 Nov 2022 10:14:20 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD4927173 for ; Fri, 4 Nov 2022 07:14:19 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id v7so3129035wmn.0 for ; Fri, 04 Nov 2022 07:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6zHUtmTd6RGvQvohicUDo1+C3cWxOXttYxoZ7C1AyNM=; b=sZpvZ48ZfL7ZHUcpdBGfIoKduwmTvL5EhX1uFBCa2jEXcfr8mcna8xs2xPZJpfBmCq mKRUawmP8LzwcDAHLdITjH8mTdt2rR/RHm1wZbUujLSRnEaBYxYpn8k2tVgkyGqcQHXZ V3C4NsMONBKoa75jZtvRtV2C9MrRVBEZzGCdJ8s56Uwi3/Lddwv3enOncogOyPK1oHB6 rsOArGEyYJi+GvlMMLK73qYd9vDx/0+mDExpKhenqU3UezG2QL2qCgSZgsJLuUh4zEs4 zmr8dooJSIFg7feKCmSZNEit3n9En4LRHKD0xhcwlvot+bE9rHyuuqSiZ9Zm+n/EpSJE qCyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6zHUtmTd6RGvQvohicUDo1+C3cWxOXttYxoZ7C1AyNM=; b=hQB9FzN/yyB7gETaBgapEXWKAtHHP48ac2EkdmyFEB/fBHRf8gw+loEdBSA0B5oaU4 FsNi8U3JOCq8VYP3FG1ODlxe1HII6OnVSPtTPxZog2bJsa5Rg1/wRxtAldsLEjMH6/+a SYd0ZkJCo7YOXLQYnNWzfyGHsZzRc2Kn/g8BwoMQpkFqK4ZfLzQpW2gjrH558Xgosm6z OBgz3rC5uPeFgkvojEaEmgdfn/rymFlHNb/QdinIoyfUxr5NuXJQItmfxxY20aVn6LAy PILgQ+dX0i7iyF5gWlfAW9W2AsV8uiOkq6MgY8fJThk8PDp2hoMJTUW2AmRr3BL1Uqz0 KqFQ== X-Gm-Message-State: ACrzQf0yjiBXrR51lT0gfQfXk+h/ffDFEgvPJbQ5nuo47v/uX7I5W8Pb 7OCBoSuWNry+4GlXmmSlkZfugQ== X-Received: by 2002:a05:600c:4252:b0:3cf:678a:d189 with SMTP id r18-20020a05600c425200b003cf678ad189mr23153902wmm.51.1667571258161; Fri, 04 Nov 2022 07:14:18 -0700 (PDT) Received: from [127.0.0.1] (2a02-8440-6440-7fff-3074-96af-9642-0003.rev.sfr.net. [2a02:8440:6440:7fff:3074:96af:9642:3]) by smtp.gmail.com with ESMTPSA id bj9-20020a0560001e0900b002365cd93d05sm3594512wrb.102.2022.11.04.07.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 07:14:17 -0700 (PDT) From: Guillaume Ranquet Date: Fri, 04 Nov 2022 15:09:52 +0100 Subject: [PATCH v3 06/12] drm/mediatek: hdmi: add frame_colorimetry flag MIME-Version: 1.0 Message-Id: <20220919-v3-6-a803f2660127@baylibre.com> References: <20220919-v3-0-a803f2660127@baylibre.com> In-Reply-To: <20220919-v3-0-a803f2660127@baylibre.com> To: Rob Herring , Chun-Kuang Hu , Chunfeng Yun , Jitao shi , Matthias Brugger , Vinod Koul , CK Hu , Daniel Vetter , David Airlie , Krzysztof Kozlowski , Philipp Zabel , Kishon Vijay Abraham I Cc: Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, stuart.lee@mediatek.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, AngeloGioacchino Del Regno , linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, Guillaume Ranquet , mac.shen@mediatek.com, linux-phy@lists.infradead.org X-Mailer: b4 0.11.0-dev X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748575296080038284?= X-GMAIL-MSGID: =?utf-8?q?1748575296080038284?= Add a flag to indicate support for frame colorimetry. Signed-off-by: Guillaume Ranquet --- drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 11 +++++++++++ drivers/gpu/drm/mediatek/mtk_hdmi_common.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c index 3635ca66817b..933c51b5f6d7 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c @@ -120,6 +120,17 @@ int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi, u8 *buffer, size_t bufsz return err; } + if (hdmi->conf->has_frame_colorimetry) { + frame.colorimetry = hdmi->colorimtery; + if (frame.colorimetry == HDMI_COLORIMETRY_EXTENDED) + frame.extended_colorimetry = hdmi->extended_colorimetry; + + /* quantiation range:limited or full */ + if (frame.colorspace == HDMI_COLORSPACE_RGB) + frame.quantization_range = hdmi->quantization_range; + else + frame.ycc_quantization_range = hdmi->ycc_quantization_range; + } err = hdmi_avi_infoframe_pack(&frame, buffer, bufsz); if (err < 0) { diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h index 921bde150e11..2e8e5feec377 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h @@ -32,6 +32,7 @@ struct mtk_hdmi_conf { bool tz_disabled; bool cea_modes_only; bool has_cec; + bool has_frame_colorimetry; unsigned long max_mode_clock; const struct drm_bridge_funcs *bridge_funcs; void (*mtk_hdmi_output_init)(struct mtk_hdmi *hdmi);