Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp956957rdb; Fri, 22 Dec 2023 09:46:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMB9uTKOMepQ5yr07geXf9kJIPA/rzGuYBIBo34lOgyWj4fIib28JaZDbKYrOoD3LZevCk X-Received: by 2002:a05:6870:7d17:b0:204:474e:dff9 with SMTP id os23-20020a0568707d1700b00204474edff9mr1496472oab.21.1703267187347; Fri, 22 Dec 2023 09:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703267187; cv=none; d=google.com; s=arc-20160816; b=Nv/LMSX4OQzrpjoENgGhu84JPWGvR5FKxukdgK7lXGmXRIdAZRcsPPKtdQ6Nn5PMzL BWVMJW0SdKhRCv/OETkk26cRHsgZoPiQEOSdZwX+7g5qqhPigqww2t8f6coe5ADw/8d9 qVVGT4LrmaQp/KvbfwwveYNR2GPz5SmJC0LzKotM1Qzrj5aZyVrtEsLVadAVN/tsrEHl I8Nm9Ghavv5wW9n/azV6FWCsrDwR3ctSqp7FXpjbd2dx3l37m/YVcPntgOw3mS7OyaLk ILWIjUSbtzfH50MlcVOYyHSkNNuylFGb70OONPrj2b78GVEYr4wtuWQOv8dvWHd9UW0t gcdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=W4073SJzbMTg0LalE15NpNk7khJfelMofNbr9L2QfJw=; fh=k7ZhfSDxugAUNAX9PFQjqQnTRGZ+rgCl5CN8/TdzbyU=; b=SYPPfQmblbCX95+Ip6HzaTZAXXO731NmAwhJPSoCu1wKJ9j771z3y/R8UqfrfG9smq JjZz3vbDhuT32015yGV6wSFfqMtP4oMtHQ8v9KJ9G3I7il7EJqIxh6BYYcftWpo9LBeK doSMa3wTB1lGb51JkSM8JTsQfq5k42IdZnYPR5nnjra2EZSembFuS3RYoZXU/sibk8uM e2oIErGrewcyWtreuN+yS8hNyeUSpWs8bz1CSIcDHqrn1oQ9rWnzGHBqEeZpseTmsANx pzrtOb1kbDu33wFSy+LgME0dUNCsUkzTgj0UH5ZtszuFWIV0f3AJIOjnxMN3moTbIbjc useQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kCWtWR6I; spf=pass (google.com: domain of linux-kernel+bounces-9961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 11-20020a63104b000000b005c61d17e6aasi3538843pgq.122.2023.12.22.09.46.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:46:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kCWtWR6I; spf=pass (google.com: domain of linux-kernel+bounces-9961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C53E5B22086 for ; Fri, 22 Dec 2023 17:45:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C26133CCA; Fri, 22 Dec 2023 17:42:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kCWtWR6I" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF23131720; Fri, 22 Dec 2023 17:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3368b9bbeb4so1508576f8f.2; Fri, 22 Dec 2023 09:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266951; x=1703871751; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W4073SJzbMTg0LalE15NpNk7khJfelMofNbr9L2QfJw=; b=kCWtWR6IFnjNHrZP4QFAiXJ9l4zIfi90Z5RCrIOWIrbJthrlHDDIb+orwxVLug8t9c CsDl/Hkzz2kuX95P0R+h/uaEzuRcLuHe8d9BZEGmZQVvHzM5Y+HySQrcycuvk/2ivNKA 4bZyeVAfqMQyqudAfuOl4QsMzqIgo0qo2WLU1Yvm53AIRUJUYeTBSLeJQK4lw4h7XMrn C5sRNVuLEYr1xhb7eoQSgBFBskauoyYC/MxBP5xhQFaIjwGxF+zMaX4g3pVdls37DdfP r7rdD1wGj0PSTFw2J/eiMl++f/a78SIr3fiFqI0hts2nGDEMVZ/FYVNU9SO1q0NOJDen w9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266951; x=1703871751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W4073SJzbMTg0LalE15NpNk7khJfelMofNbr9L2QfJw=; b=Sg8q72lfa6UjfYl9iZ3jTcbInIcp4J1sDTZul8cH6ko6vMonleyfuFGIp/9a5TqViB JTUzbPJ9vpJf1lKL5sVGvo1xMOK6jgCUXHeVTgs/G4ogsursRRIekcb2MsvH+t4iMAq6 glwPyxqVBDXUa9amdDF2X0cy7J0D5nryklrUVv5sr3KlEHpOtj4+Y+wiOAYlOBSG/1Zb Ez1oE0acGMRFKW0SJVFwsSctkSL8w5XMicji79m+3+G44+Xn5g9ExtsRSzAJNLeJYTQC hgVAhFwfZWS19d3z75PLj8rs7PGMteW7RCSuzmSIYb1kkFAQd8nkQOszFyw6k0SSbdYd 4pCg== X-Gm-Message-State: AOJu0Ywlr/YPOCfX0STsli3JB86Wo3ChPcQQG4IuxFXHaaMzarcVsOPA 2CBAACc37EwZzTmE6eSxNvJ4ZzaOOg== X-Received: by 2002:adf:e74d:0:b0:336:9067:c656 with SMTP id c13-20020adfe74d000000b003369067c656mr575213wrn.262.1703266950919; Fri, 22 Dec 2023 09:42:30 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:30 -0800 (PST) From: Alex Bee To: Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 12/29] drm/rockchip: inno_hdmi: Remove tmds rate from structure Date: Fri, 22 Dec 2023 18:42:03 +0100 Message-ID: <20231222174220.55249-13-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Maxime Ripard 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 Tested-by: Alex Bee Signed-off-by: Alex Bee --- changes in v3: - imported patch changes in v4: - none 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 04344ee1265d..102195837206 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -56,8 +56,6 @@ struct inno_hdmi { struct inno_hdmi_i2c *i2c; struct i2c_adapter *ddc; - unsigned int tmds_rate; - struct hdmi_data_info hdmi_data; }; @@ -134,11 +132,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); @@ -421,8 +419,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, @@ -800,8 +797,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) -- 2.43.0