From patchwork Tue Oct 31 16:48:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 160256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp374681vqg; Tue, 31 Oct 2023 09:52:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFClgVclnbObSxX3mm/XZVDMYpa9RYIuJTojtMnxq4lBtBvu904IErIEF9YUYIdaIWWqQl X-Received: by 2002:a05:6a21:7905:b0:16b:c019:f5d2 with SMTP id bg5-20020a056a21790500b0016bc019f5d2mr11536398pzc.45.1698771172582; Tue, 31 Oct 2023 09:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698771172; cv=none; d=google.com; s=arc-20160816; b=s4fViTbvbIcm6m64kAy4pddvZH+o+SnOcgAV0tFrvgOT0D5yUSul6eam9+/52+yci5 YMzUm07EiHwv6r6zxnLOsAlevXqo7nrDhYymz4nQdt1rHiaZvQxaB8U5l7GkgdVCINng P8hCfgMCeVkFkhSUFRcnZ5YpjdzGpxHG1SK2dHVp6v4pktqC9yoF+Sv2scBpS43b+fn7 QPAPc44EnTtKwPEXhzPBA9ANmmLr8NrXRa7vU8/cmfoCc7lLs+P9faGbid1mTQuF2hRc vMQbp6M7GAXUwwtoxS/lrzcFcDWY1Rt68Vta2E+XjhK8VRJ/28nDLKteQxMteN2Lf9Dk zRKQ== 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=+rlSDhaQCsxmaARemwMLGNU9Uo8fDlmHmVAkqHMoUdU=; fh=e6/uyeFf2k7v8JUtB6fPyaAS5iN3eSA1hjtg35V2Rzw=; b=ip2AOHUsJMSfVnSl46TXOE5I+4hhsdwI8qs21qfCmhyYYc7g8awjCFJ6le8FIm5bIy tS4erYtsNLO4zDAdTMUWBdUmeEHqNyq462PMMbrnq9fw8rG2K2yysu52B4CLLTnOgyPC gwA5iStnZRWmtSqL4y4OWuhP2VB4sA1NAjup5Eb1b9QZGIf7C4myWnsK7r8CyvmqLydo J9EXIqloyEZ4KFTGutCwxWlTQKzIOEVmRdnfp3b9mWvqxKxQFJm49RTc3XWrDggL8END sypVHZ2sjoICihG6fYiTk8nDaIVjOmobsLJy9JFJMRC9p61t4W/9+eg8DHuRPmrpworr 1Abg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o1VANXog; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id k16-20020a6568d0000000b00565ecee8793si1196445pgt.875.2023.10.31.09.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:52:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o1VANXog; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E6EB78033DE9; Tue, 31 Oct 2023 09:52:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346984AbjJaQwe (ORCPT + 33 others); Tue, 31 Oct 2023 12:52:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346944AbjJaQwK (ORCPT ); Tue, 31 Oct 2023 12:52:10 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDE41BF; Tue, 31 Oct 2023 09:49:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64222C433CC; Tue, 31 Oct 2023 16:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698770977; bh=vxR+qUPDNITjlXpsuvoNcEUlFJrjEuDeYp+w/DlrP3Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=o1VANXog3kSIx8h8rNlpNxp/cGTYrXwZGop9X1Ix3uM6/dt60nOEriuLBNHury/9Y 5P03ewULxlGQhkvPrQ2pBKYCqOpyN4uZC7ShrHefGpLNNExKOetolH4Q8FxW9d9i01 ghLlK7s2f8/AUK2nby33wK5nvl/N+mvFIHIGl8i99mFVcOwrrQHn3ZKDekqAu1E9Hb HxgDGlQoACmZKLYjpI9g6XTcQWP70xkrmRpgM6AmBMmXuNC7O/z8S6aJOaxALz4s35 LJQ/eiLRx/lc6nysTNl5Pcp5j/kI9m1GcaRPPMgwvEWmJp04qIHEiSBZ7gya9xn1jW s9xzX8eWh5vDQ== From: Maxime Ripard Date: Tue, 31 Oct 2023 17:48:35 +0100 Subject: [PATCH RFC v3 22/37] drm/rockchip: inno_hdmi: Remove useless output format MIME-Version: 1.0 Message-Id: <20231031-kms-hdmi-connector-state-v3-22-328b0fae43a7@kernel.org> References: <20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@kernel.org> In-Reply-To: <20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Emma Anholt , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3790; i=mripard@kernel.org; h=from:subject:message-id; bh=vxR+qUPDNITjlXpsuvoNcEUlFJrjEuDeYp+w/DlrP3Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmO+vce1THOuRqx+09q30PRMy5CctZXXVfFWBlxrropu zPuyIaWjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEykvoaRYeoCnffylyf1+Hrv aX59v2O+xSqfD7MSmkrf2NueX2r1LIzhn9rkBQe2b/R5uPqa8FO2jReqrPNnWHxfdzQo/WKG1jd bb0YA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:52:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781290680940121170 X-GMAIL-MSGID: 1781290680940121170 Similarly to the input format, the driver has a lot of code to deal with various output format, but the driver hardcodes it to RGB always. Let's get rid of the dead code. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/rockchip/inno_hdmi.c | 57 ++++-------------------------------- 1 file changed, 6 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index e0696ab16da3..0c6c550e0ce7 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -28,7 +28,6 @@ #include "inno_hdmi.h" struct hdmi_data_info { - unsigned int enc_out_format; unsigned int colorimetry; }; @@ -296,26 +295,14 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, &hdmi->connector, mode); - - if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444) - frame.avi.colorspace = HDMI_COLORSPACE_YUV444; - else if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV422) - frame.avi.colorspace = HDMI_COLORSPACE_YUV422; - else - frame.avi.colorspace = HDMI_COLORSPACE_RGB; + frame.avi.colorspace = HDMI_COLORSPACE_RGB; return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI, 0, 0, 0); } static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) { - struct hdmi_data_info *data = &hdmi->hdmi_data; - int c0_c2_change = 0; - int csc_enable = 0; - int csc_mode = 0; - int auto_csc = 0; int value; - int i; /* Input video mode is SDR RGB24bit, data enable signal from external */ hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL1, v_DE_EXTERNAL | @@ -327,43 +314,13 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) v_VIDEO_INPUT_CSP(0); hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value); - if (HDMI_COLORSPACE_RGB == data->enc_out_format) { - value = v_SOF_DISABLE | v_COLOR_DEPTH_NOT_INDICATED(1); - hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value); - - hdmi_modb(hdmi, HDMI_VIDEO_CONTRL, - m_VIDEO_AUTO_CSC | m_VIDEO_C0_C2_SWAP, - v_VIDEO_AUTO_CSC(AUTO_CSC_DISABLE) | - v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE)); - return 0; - } - - if (data->colorimetry == HDMI_COLORIMETRY_ITU_601) { - if (data->enc_out_format == HDMI_COLORSPACE_YUV444) { - csc_mode = CSC_RGB_0_255_TO_ITU601_16_235_8BIT; - auto_csc = AUTO_CSC_DISABLE; - c0_c2_change = C0_C2_CHANGE_DISABLE; - csc_enable = v_CSC_ENABLE; - } - } else { - if (data->enc_out_format == HDMI_COLORSPACE_YUV444) { - csc_mode = CSC_RGB_0_255_TO_ITU709_16_235_8BIT; - auto_csc = AUTO_CSC_DISABLE; - c0_c2_change = C0_C2_CHANGE_DISABLE; - csc_enable = v_CSC_ENABLE; - } - } - - for (i = 0; i < 24; i++) - hdmi_writeb(hdmi, HDMI_VIDEO_CSC_COEF + i, - coeff_csc[csc_mode][i]); - - value = v_SOF_DISABLE | csc_enable | v_COLOR_DEPTH_NOT_INDICATED(1); + value = v_SOF_DISABLE | v_COLOR_DEPTH_NOT_INDICATED(1); hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value); - hdmi_modb(hdmi, HDMI_VIDEO_CONTRL, m_VIDEO_AUTO_CSC | - m_VIDEO_C0_C2_SWAP, v_VIDEO_AUTO_CSC(auto_csc) | - v_VIDEO_C0_C2_SWAP(c0_c2_change)); + hdmi_modb(hdmi, HDMI_VIDEO_CONTRL, + m_VIDEO_AUTO_CSC | m_VIDEO_C0_C2_SWAP, + v_VIDEO_AUTO_CSC(AUTO_CSC_DISABLE) | + v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE)); return 0; } @@ -425,8 +382,6 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, struct drm_display_info *display = &hdmi->connector.display_info; u8 vic = drm_match_cea_mode(mode); - hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; - if ((vic == 6) || (vic == 7) || (vic == 21) || (vic == 22) || (vic == 2) || (vic == 3) ||