Message ID | 20231128-kms-hdmi-connector-state-v4-33-c7602158306e@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3814978vqx; Tue, 28 Nov 2023 02:29:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuVSQSfh4ooxmTrjbNbPVtc//A2v+PsCIhUTbVbnobRdsVFgfDS6qTeDUTQy8/SRBn2q6x X-Received: by 2002:a17:902:a5c4:b0:1cf:b1df:47cd with SMTP id t4-20020a170902a5c400b001cfb1df47cdmr10563595plq.25.1701167351204; Tue, 28 Nov 2023 02:29:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701167351; cv=none; d=google.com; s=arc-20160816; b=trWeD3rvpgnfH9AQlddfHbdTCUw88N/EBJHIxwehxXGqdhAWZqHaFYD424wazYL8Cv v2Nh2YthXwJD8nR1OtHBCocksip4gEn17bMZCXdzBd4SEiV0rqWqKFItemdqR8DjaPKu IyxficR0S1c9kCQgJDi7j82dN8isso1ZCupyUgOJyCwFJ/tIePMLkshrS1Z+kOBvdhE8 zsM3myBdJ237KtzJOPlAL9cuJi/9s2ZbRTOZ+BqK5qby6GmeNEUOTfeYsZxqJzLUcHbk DJe1Yk9k3Oi4WZ7a9fJNkgRNkaFct0GMHfHWf8aYlmSGWUKgl0HyVfV3E3R9A/13r7Hf qSSQ== 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=p0S+1JCbHRBjf4KEMC1MhYa37tQLdP/h0qOmTVSb2zU=; fh=e6/uyeFf2k7v8JUtB6fPyaAS5iN3eSA1hjtg35V2Rzw=; b=GAGAmEwxnePWu5XtHWrO86XeC4ECmI7G9xBDzENXOPiX+iItD02+9hpzrGC29yAXqQ Qo0wR/HQbA8r9VAdJoz6bCt0uQpSJxMnaop5DoCnYk1ahkwVIE/LJQ2EWMGERr9AHpKn NchtjmTAB2aDzo05n5ro5/DPb2IdFaBhSsvldpzuwLtZviZi/HgZp2vxv1+eEs4mPlz0 0Cwm1/HAeV6G0bCczPt9sIZLUTdlVjSB3Fz1x7jyytqhMhi9Qe6msI1QHmzPUiwm2mgg xTezbQNYh+dgU289QMGZwCM0R073dHyPEihZXS3f3oOj8fu9tgMJOcL3lprMQhqHrdOI ns5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WXFJdbm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f4-20020a170902ce8400b001cdf9442d20si7426666plg.336.2023.11.28.02.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 02:29:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WXFJdbm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 0E465805092B; Tue, 28 Nov 2023 02:29:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbjK1K2y (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Tue, 28 Nov 2023 05:28:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234863AbjK1K2B (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Nov 2023 05:28:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3273819AF for <linux-kernel@vger.kernel.org>; Tue, 28 Nov 2023 02:25:57 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD6D5C433C7; Tue, 28 Nov 2023 10:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701167157; bh=+5JYn8V0UryLv4NGrPj7TOsjDrccf86rOvDhC/BodNA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WXFJdbm6sZrcrZ7Z60m0NuYAnLiW84TfAfdil4M/s1OPHVhSmuzwGlKSMixqKGVaB g7hsqgVZqiWR8PoGzv2AppoJ7xqJNmJEyHAoV2rv0UTdYxpp2vkhcMAid73uhcGYlA ww9ZkG9Iu/7DHO9bvQAxNL7eobSGixOdNyVvAIEeYct6uz9AOc4cEw+uSkDGdA512e Y0QAcRyELQyM2rOswS6Ny3xkV7VvsTb54VqZMzW4dtFO0BpPT4ZnHN7bcYF8zp1SPU qSTr47YozWL0d4TeuTlbl7L813B8G8d0vC+RTUUHP5qLPsGtAfgJINWMsp+IRd9SuV jfPmimSXGx+8Q== From: Maxime Ripard <mripard@kernel.org> Date: Tue, 28 Nov 2023 11:24:44 +0100 Subject: [PATCH v4 33/45] drm/rockchip: inno_hdmi: Remove tmds rate from structure MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231128-kms-hdmi-connector-state-v4-33-c7602158306e@kernel.org> References: <20231128-kms-hdmi-connector-state-v4-0-c7602158306e@kernel.org> In-Reply-To: <20231128-kms-hdmi-connector-state-v4-0-c7602158306e@kernel.org> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Emma Anholt <emma@anholt.net>, Jonathan Corbet <corbet@lwn.net>, Sandy Huang <hjc@rock-chips.com>, =?utf-8?q?Heiko_St=C3=BCbner?= <heiko@sntech.de>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org> Cc: Hans Verkuil <hverkuil@xs4all.nl>, 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 <mripard@kernel.org> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2323; i=mripard@kernel.org; h=from:subject:message-id; bh=+5JYn8V0UryLv4NGrPj7TOsjDrccf86rOvDhC/BodNA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmp+y/dn8kl1bzD/ZzCohaDT6V66247rr39SuhU/pZvg aJyvNxfOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR92EM/yvWu3p/8vBU6Jw+ d8mjK3W8r/dbqZbM2DLhf/AC7oIfW9UY/mcvSErKjc1q6byWprGsw2Xv8qc2+2RFpvDUv2eWtbs znw8A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-1.2 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 lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 28 Nov 2023 02:29:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783803256316577353 X-GMAIL-MSGID: 1783803256316577353 |
Series |
drm/connector: Create HDMI Connector infrastructure
|
|
Commit Message
Maxime Ripard
Nov. 28, 2023, 10:24 a.m. UTC
The tmds_rate field in the inno_hdmi structure is used mostly to
configure the internal i2c controller divider through a call to the
inno_hdmi_i2c_init() function.
We can simply make that rate an argument to that function, which also
removes a workaround to initialize the divider at probe time when we
don't have a mode yet.
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/rockchip/inno_hdmi.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index f05417c6b637..35f44e556fcf 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -50,8 +50,6 @@ struct inno_hdmi { struct inno_hdmi_i2c *i2c; struct i2c_adapter *ddc; - - unsigned int tmds_rate; }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -155,11 +153,11 @@ static inline void hdmi_modb(struct inno_hdmi *hdmi, u16 offset, hdmi_writeb(hdmi, offset, temp); } -static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi) +static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi, unsigned long long rate) { - int ddc_bus_freq; + unsigned long long ddc_bus_freq = rate >> 2; - ddc_bus_freq = (hdmi->tmds_rate >> 2) / HDMI_SCL_RATE; + do_div(ddc_bus_freq, HDMI_SCL_RATE); hdmi_writeb(hdmi, DDC_BUS_FREQ_L, ddc_bus_freq & 0xFF); hdmi_writeb(hdmi, DDC_BUS_FREQ_H, (ddc_bus_freq >> 8) & 0xFF); @@ -389,8 +387,7 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, * DCLK_LCDC, so we need to init the TMDS rate to mode pixel * clock rate, and reconfigure the DDC clock. */ - hdmi->tmds_rate = mode->clock * 1000; - inno_hdmi_i2c_init(hdmi); + inno_hdmi_i2c_init(hdmi, mode->clock * 1000); /* Unmute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, @@ -768,8 +765,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, * PCLK_HDMI, so we need to init the TMDS rate to PCLK rate, * and reconfigure the DDC clock. */ - hdmi->tmds_rate = clk_get_rate(hdmi->pclk); - inno_hdmi_i2c_init(hdmi); + inno_hdmi_i2c_init(hdmi, clk_get_rate(hdmi->pclk)); ret = inno_hdmi_register(drm, hdmi); if (ret)