From patchwork Sat Dec 16 16:26:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755224 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 425C930657; Sat, 16 Dec 2023 16:27:08 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="InjvMp1u" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40c6ea99429so12370485e9.3; Sat, 16 Dec 2023 08:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744026; x=1703348826; 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=obq8YELyZEbke3rZFXNs+HxX85EVdqoEFqpud8UWY9A=; b=InjvMp1uUR0NHOkuQAzAuWczkMefFNzt7gVR/8QLDdUggYFRsjrNxbhgeU8UQetO0x elrMGzoiOalbdSoqUqGlVrRrcJ/962Ky6GZl67a3CkQVSuHXQr5re/W1R1xt6eftm79N lstG6KDYfVhf7X/nSx1s4sqJzCPDq7A4ArtP7mnHLQbvmdB3ez9GLdeRrK9KaHEhZZUa KR45MptEyYnQrgC4cGxDD/kUfvwoHQEN8nltq1hdRou4/iScYh2Hpf2zHgLlhPNCUSRv BbFXhFObbPhl3Bl9TpUbdJJ8774Xg86k3oOb41kjx4OVFgsRTIEcfeAu7KhQ1G0kYrst JX7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744026; x=1703348826; 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=obq8YELyZEbke3rZFXNs+HxX85EVdqoEFqpud8UWY9A=; b=QrSqJe6fE0MWYLr08Tog8SK21BApy9G7Qqi3Sg0eFIOGeORuPWzihWu6I9uK+gEmo/ u4xxYU7JNNKRd39nU2Jd3YG1KZgPbcQPGM4SNQxtc2J1bICA7exuNAKRbBGx2ozHZEbC +GBEQd03KtIm1yG5+HWUrOjTmq3OpWW/BNGQ8wqmuV2z8ZXTJW1RTVFxi/eXOCvrp6Q4 lTNC1baXT5Jo4b+Oonu6ZKZ9zZfxWEmd/tg7YOOccJveTBwOpidltG66sWYFF985CAg2 BQmqeWTe6cxvbA9KCHVm6FcYibDeCPRH4vIbWZRKM3hjL+p5cjATphFo82iiDOzjhABN OrQA== X-Gm-Message-State: AOJu0YyCQz6tmPhfVnBX+ybEHQBxDHB+zu5hFzjNHe7cgBDlWbgsVixk gzl74yMeR9gztinGNtum8A== X-Google-Smtp-Source: AGHT+IGnNQencjmVxcsF2n4BTXIbiDj3zIdsmRa4iZ0r/ILDY0raJeyfz2VYhdxmAd1idrgHfog51w== X-Received: by 2002:a7b:c4c7:0:b0:40c:6567:1d85 with SMTP id g7-20020a7bc4c7000000b0040c65671d85mr1569882wmk.232.1702744026333; Sat, 16 Dec 2023 08:27:06 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:06 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 01/27] dt-bindings: display: rockchip,inno-hdmi: Document RK3128 compatible Date: Sat, 16 Dec 2023 17:26:12 +0100 Message-ID: <20231216162639.125215-2-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The integration for this SoC is different from the currently existing: It needs it's PHY's reference clock rate to calculate the DDC bus frequency correctly. The controller is also part of a powerdomain, so this gets added as an mandatory property for this variant. Signed-off-by: Alex Bee Reviewed-by: Conor Dooley --- changes in v2: - clarify that the controller itself is part of the powerdomain - simplify clock-names - made power-domains property only allowed (and required) for new variant .../display/rockchip/rockchip,inno-hdmi.yaml | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,inno-hdmi.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,inno-hdmi.yaml index 96889c86849a..be78dcfa1c76 100644 --- a/Documentation/devicetree/bindings/display/rockchip/rockchip,inno-hdmi.yaml +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,inno-hdmi.yaml @@ -14,6 +14,7 @@ properties: compatible: enum: - rockchip,rk3036-inno-hdmi + - rockchip,rk3128-inno-hdmi reg: maxItems: 1 @@ -22,10 +23,19 @@ properties: maxItems: 1 clocks: - maxItems: 1 + minItems: 1 + items: + - description: The HDMI controller main clock + - description: The HDMI PHY reference clock clock-names: - const: pclk + minItems: 1 + items: + - const: pclk + - const: ref + + power-domains: + maxItems: 1 ports: $ref: /schemas/graph.yaml#/properties/ports @@ -55,6 +65,32 @@ required: - pinctrl-names - ports +allOf: + - if: + properties: + compatible: + contains: + const: rockchip,rk3036-inno-hdmi + + then: + properties: + power-domains: false + + - if: + properties: + compatible: + contains: + const: rockchip,rk3128-inno-hdmi + + then: + properties: + clocks: + minItems: 2 + clock-names: + minItems: 2 + required: + - power-domains + additionalProperties: false examples: From patchwork Sat Dec 16 16:26:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754967 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 D305F30662; Sat, 16 Dec 2023 16:27:08 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NV/CDwrx" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a1f0616a15bso190965766b.2; Sat, 16 Dec 2023 08:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744027; x=1703348827; 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=4Lm26+4tm6Q9dy5TiKyQzH1wZ/PMiBfYpwbeTXzDXzY=; b=NV/CDwrxIKEOovhSvBgy9czdYvWrYP01xZCrxuRiYLtO5nn1ZRKtGUIWJ8g8WiDorU 0CU6hQfRm9F61WNNOT2NlAcW077SK0bM8nbiepAXWLLWInDGW0elbFq2mBvl7E1sEN10 wJJm+7aMHMPBbhZH9jdNs4tah3w8M/GrSoSFExQpSVazo5M/sdKk0DP8edCd9UU8F5t1 o6j6Db/7EBYDiXGpplV9LLdRe8Yj8qmF+HNTwKh5OqaYVWOH6Rdxl0Q/YnVDBK7Da4VF YH+yCdQAd2LefAkI7Ubt5Wi+MF0YhV/7l8HamY+OGWFmLq/uQZsHUdTL++G1QNpcM06q mgtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744027; x=1703348827; 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=4Lm26+4tm6Q9dy5TiKyQzH1wZ/PMiBfYpwbeTXzDXzY=; b=ltMvoS280ieEK6oqfjCUGKwcZzFuDpz2LCJUXYyDEyucxtivhsJGN7APxzphY8kvXr uyV5hwAo82GUTlq9iSQQtgP4JtH+AtOtscSEgHyjDuzJ2ftHuQRQgWt26hZNz7ePLux7 +03NSpiBTbPtsoTkxRdMmum9AQsHiKRBfJ+dJNvX8iW533/qf/8PaaRTsqoX0ncR1Mk7 e/gwxw/KP/UAhMTczDXLRJ8EsLeAUuJTJnsZEJXi1VQiiAseqtY05Uk1hvThsvlPfmdL 0tKVgFUhGqX8ygX4+HVT7x8vVc/7hLUEMlIUT6ZM3dvhlG3QT+AIoOqyZhYUotjdxSbW ceTw== X-Gm-Message-State: AOJu0YyOcZFIlTumT5luhX0LShe8eLOAth+8GYB6ay2bdBeqF3QYvf6E 9MpT24lCYQy3C7iYoPVHaQ== X-Google-Smtp-Source: AGHT+IGZ7VeNHGWq+1VZP4LYh9qX3NgWRdPWJnURnN0HnbB2LJH1KRm9aL1BAMwgow9ZPeylMhQF8w== X-Received: by 2002:a17:907:208f:b0:a19:a19b:78a7 with SMTP id pv15-20020a170907208f00b00a19a19b78a7mr7159079ejb.106.1702744027021; Sat, 16 Dec 2023 08:27:07 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:06 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 02/27] drm/rockchip: vop: Add output selection registers for RK312x Date: Sat, 16 Dec 2023 17:26:13 +0100 Message-ID: <20231216162639.125215-3-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In contrast to RK3036, RK312x SoCs have multiple output channels such as RGB (i.e. LVDS TTL), LVDS, DSI and HDMI. In order to support that, this splits output from RK3036 and defines an separate one for RK3126 with the registers required to enable the appropriate output and setup the correct polarity. Signed-off-by: Alex Bee --- changes in v2: - rephrase commit message drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 13 ++++++++++++- drivers/gpu/drm/rockchip/rockchip_vop_reg.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c index c51ca82320cb..b9ee02061d5b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c @@ -227,11 +227,22 @@ static const struct vop_win_data rk3126_vop_win_data[] = { .type = DRM_PLANE_TYPE_CURSOR }, }; +static const struct vop_output rk3126_output = { + .pin_pol = VOP_REG(RK3036_DSP_CTRL0, 0xf, 4), + .hdmi_pin_pol = VOP_REG(RK3126_INT_SCALER, 0x7, 4), + .hdmi_en = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 22), + .hdmi_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 23), + .rgb_en = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 24), + .rgb_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 25), + .mipi_en = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 28), + .mipi_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 29), +}; + static const struct vop_data rk3126_vop = { .intr = &rk3036_intr, .common = &rk3036_common, .modeset = &rk3036_modeset, - .output = &rk3036_output, + .output = &rk3126_output, .win = rk3126_vop_win_data, .win_size = ARRAY_SIZE(rk3126_vop_win_data), .max_output = { 1920, 1080 }, diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.h b/drivers/gpu/drm/rockchip/rockchip_vop_reg.h index 406e981c75bd..fbf1bcc68625 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.h +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.h @@ -872,6 +872,9 @@ /* rk3036 register definition end */ /* rk3126 register definition */ +#define RK3126_INT_SCALER 0x0c + +/* win1 register */ #define RK3126_WIN1_MST 0x4c #define RK3126_WIN1_DSP_INFO 0x50 #define RK3126_WIN1_DSP_ST 0x54 From patchwork Sat Dec 16 16:26:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754966 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 90DB230D1B; Sat, 16 Dec 2023 16:27:09 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MTLyyQTy" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-54c7744a93fso2051734a12.2; Sat, 16 Dec 2023 08:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744028; x=1703348828; 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=qyAWfNkXQL+v/gZSDlmmFF5ztG5yHb26ZkJxvxzB8Hc=; b=MTLyyQTyFUzMRpweOwN2a4P2t6HZlLsvqYYCzfi5ACj/FoJB7OPE/VxNKS1i5I1N7b UW3wpFOkZXX4uKUEhIMBuosEDvUZEKYA73lEESiZQy709pH1UAtjyT9bb6QVJv1MGmZL t3fPSVS6DJ4bJCSgFWvJ4vO5tTrVbDAeQ5lA+MJLGCmLfMatZ39zu//YbXMR5QAV2oga TbNw3EWQCsjReb0xOJpA9lZVjtGdHVZ5W98IDKxWeZpJ/TskKJWEprcWNUHBEXfPiC2T 5pl52dxrovT/7ZkgfEUFguRGimXLs5iMAmcx1Pza0sGv3asdSjpRQt5AuIST/6lWnwlb JbyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744028; x=1703348828; 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=qyAWfNkXQL+v/gZSDlmmFF5ztG5yHb26ZkJxvxzB8Hc=; b=D2HDZ5F9xsi9ODeoGbuJuUcMpFXwDBa9XeSuFZXAAXFElI+JFWeME1aE5/HlWlrAOp tZpxl4ch/3ibwGywpb4gYlKqxLUlXzUFtkIhnaPagqtQSpYrg4XB0NSbBbs1BCx0Y/ZV nY6UR9UPCITb1eUWiBki9GyQ+eVbEa2F8K8I70InlxtOSV2oUkMmjoVRZvnm9KFFwE/B NJhavkr/4dNxGUc92F6XxtJdKCgObznpzpLZqr7B6y0Ue7ZtjWOZBS0fGIp8ZcLryAwM HUflKt7OFmsenPO2rD303zKet0aHlHI8FFZzsrdY3+3mJoYlSueBV03FRRb+HKg4p0Jh gujw== X-Gm-Message-State: AOJu0Yx3s3lFrHjkV6ROrWeAphS6T0TYitsuVrfWyMHKnKd0oF1Z584N 2xh6gpsD9Y8rRiUsdb2xYg== X-Google-Smtp-Source: AGHT+IG3ytNKpYhW3AxvamdKVLTOk5M5VW41roA7N2pAlKA2C2kww6MnweL75Ttzw+MUjezGDENIdQ== X-Received: by 2002:a17:906:6a1d:b0:9c2:2d0a:320c with SMTP id qw29-20020a1709066a1d00b009c22d0a320cmr8522242ejc.46.1702744027873; Sat, 16 Dec 2023 08:27:07 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:07 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee , Zheng Yang Subject: [PATCH v2 03/27] drm/rockchip: inno_hdmi: Fix video timing Date: Sat, 16 Dec 2023 17:26:14 +0100 Message-ID: <20231216162639.125215-4-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The controller wants the difference between *total and *sync_start in the HDMI_VIDEO_EXT_*DELAY registers. Otherwise the signal is very unstable for certain non-VIC modes. See downstream commit [0]. [0] https://github.com/rockchip-linux/kernel/commit/8eb559f2502c Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") Co-developed-by: Zheng Yang Signed-off-by: Zheng Yang Signed-off-by: Alex Bee --- changes in v2: - none drivers/gpu/drm/rockchip/inno_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 6e5b922a121e..345253e033c5 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -412,7 +412,7 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi, hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HBLANK_L, value & 0xFF); hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HBLANK_H, (value >> 8) & 0xFF); - value = mode->hsync_start - mode->hdisplay; + value = mode->htotal - mode->hsync_start; hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDELAY_L, value & 0xFF); hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDELAY_H, (value >> 8) & 0xFF); @@ -427,7 +427,7 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi, value = mode->vtotal - mode->vdisplay; hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VBLANK, value & 0xFF); - value = mode->vsync_start - mode->vdisplay; + value = mode->vtotal - mode->vsync_start; hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VDELAY, value & 0xFF); value = mode->vsync_end - mode->vsync_start; From patchwork Sat Dec 16 16:26:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755223 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 91DE530F82; Sat, 16 Dec 2023 16:27:10 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SuKt+QWw" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-50e2d00f99cso316916e87.0; Sat, 16 Dec 2023 08:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744028; x=1703348828; 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=ujhT/xhztHbY8JzCzlkbXu+iQMCJG+MMsIZQaYuJZKs=; b=SuKt+QWwllwfQNJxmUaW56zDvhx/5cTx8u8lrzdrXaZo6u9+kOAMBmldhTWOkNkHeP xgBzALzo8XDjfLyjLesZwa4uQ4eNgdTrgCNMoxhQOB2/NMrznq9kI1D2fcC+ilMnH78t ujp9VolQ2ECcYITWu4lpqsvt9YLCAMlYUA4fflqDU7n1sBoCSF9pX4tKT9P3+TbIozJ+ HtcH81iUsKfFk9SMcabaPqky3MsCrgqaLOCNzjPqzJU3k12PO40y9b8ynIY15mAIGNdq dSgmJE9KMhcJY86dwajhZsctIXPUT9k7VjInFinXCs/2TQVlTx4P6sSIonnVAynIK2yF 4XFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744028; x=1703348828; 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=ujhT/xhztHbY8JzCzlkbXu+iQMCJG+MMsIZQaYuJZKs=; b=vXQj2B//5gcKGTYPUzQi5/jGzrZSsFMWgkqDX+CMvB6rjViLQlRfQgA1NGJkOz84aO HOo6sk3pIPV6j2fZRrnIIXjQ/CS1wGSa0r7cEIgoTZLpJqNCXiDk5VC/tqIlC2/IyjMU SzQlafJLIBN8MXrJ0rERDTl5DcaQaQMS8LYn0mGGE6zys8uKylVcdBsDn+U82cUdCm5C HUY6tyj6rtyWZvkzCW0htzOCB8ijWLQRyXn6hIUkBNowwqfsQezKJPlZxmG4mXcz4O9w VIO7zrwpjQPq+FcDIvAOM2K6Z7X6dOzYKadfQLpxam+WplGqzguA3eng4oRGqV28NEa4 mK4g== X-Gm-Message-State: AOJu0Yw4RgkGmnYSw0azIYx44j4PiYPreqjjJf2QmBXhEMynRAlL3bxP j325iFlybXSGkpQ/3jgEKQ== X-Google-Smtp-Source: AGHT+IEoZS1JzzGc12YB/MN689Vsdo/GX0yIsCmhRzmI2mChIP6YnFGPdCsy2rPk5UV5T25TnOSVWw== X-Received: by 2002:a19:8c0d:0:b0:50b:f55b:abb9 with SMTP id o13-20020a198c0d000000b0050bf55babb9mr6923253lfd.94.1702744028520; Sat, 16 Dec 2023 08:27:08 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:08 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 04/27] drm/rockchip: inno_hdmi: Remove useless mode_fixup Date: Sat, 16 Dec 2023 17:26:15 +0100 Message-ID: <20231216162639.125215-5-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The mode_fixup implementation doesn't do anything, so we can simply remove it. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 345253e033c5..0b1740b38c7b 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -517,13 +517,6 @@ static void inno_hdmi_encoder_disable(struct drm_encoder *encoder) inno_hdmi_set_pwr_mode(hdmi, LOWER_PWR); } -static bool inno_hdmi_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adj_mode) -{ - return true; -} - static int inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, @@ -540,7 +533,6 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = { .enable = inno_hdmi_encoder_enable, .disable = inno_hdmi_encoder_disable, - .mode_fixup = inno_hdmi_encoder_mode_fixup, .mode_set = inno_hdmi_encoder_mode_set, .atomic_check = inno_hdmi_encoder_atomic_check, }; From patchwork Sat Dec 16 16:26:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755222 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 CEBF6315A7; Sat, 16 Dec 2023 16:27:11 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L99+d5s8" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-552d39ac3ccso2600942a12.0; Sat, 16 Dec 2023 08:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744030; x=1703348830; 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=+K0So3uuQGg3yr+y8AKU1btAl7C7H8qZH5jAq4CxfOw=; b=L99+d5s8N5i0IuxxU2/QkU436ajp4zsDVmF3cLTGp+R8PVfoxoD/4CVWgEHnML6wQZ 6pmffHQuSQn1VSy+7eMF6lZQSIvFYbSJwGDfLmYPoojxOdSPT67xaCiuXCpGkHHoD3Gm cT16eR5ujV/Zz+5cFgpGFfGYZ1UJ4gq3IxQMO9NqmsAOvXqiskl+VDYrLm09QruHboWJ T3qryLawYOzx2LZOmO7z2RuK1d2U5U8JkzMKk0ZoyWmpImXhlVcZZvd6ISBYweZwi9fi BwEl/BJZC8c+ylekfWf4NQD6XiPp+Q18DD0VZmnio8zWD51aGf8c6qZMgWmWQG8zB1aD mN0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744030; x=1703348830; 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=+K0So3uuQGg3yr+y8AKU1btAl7C7H8qZH5jAq4CxfOw=; b=E9+3C7AA9IJfAtYsnp6TZ0PZzEKf3OLcr067DH4LKQfIuXI8XUoWYa25DBBYGSlpGM f3NaJcu3PEJV7j6Y0qtf7UX8AElQpo9RukUzX7CTpCGDEjH54GvSPmd5a9edSZn47Bnt y3HWqdlRoqEEeUCC1358WpbSg9hp2wn4SO7QVX/buTgjQ3EiO5aIp5Vg80zp+8tZuIqH hSw7QQnn+mpJ1wCmx0YdEU4TBVqD4K9ZTu9FtmZPyFMWcZT8s/QgZ3+OSjNyFi6GD2cb 9U6uC12RK/g6qWKn51MNwXejucdnimfA/C3G1oQkkYHgcHLrvhhSTE8wFI/CTSbGsiGR XmTg== X-Gm-Message-State: AOJu0YzxDhV65FC9H0J0Be7f6TcQzeLIhlKEK269lwaFjiqwLA9lITuR N3Ap4vH8fLdMvkkgTYEwoA== X-Google-Smtp-Source: AGHT+IExRugXG74sxCB2Guilb/nSJFlUmZY/5iuQd+cooSuE643BRC/59xoXydHOjqZElMPX6y5FtQ== X-Received: by 2002:a17:906:101e:b0:a01:ae9a:c1d3 with SMTP id 30-20020a170906101e00b00a01ae9ac1d3mr13645179ejm.11.1702744029174; Sat, 16 Dec 2023 08:27:09 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:08 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 05/27] drm/rockchip: inno_hdmi: Remove useless copy of drm_display_mode Date: Sat, 16 Dec 2023 17:26:16 +0100 Message-ID: <20231216162639.125215-6-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The driver maintains a copy of the adjusted mode but doesn't use it anywhere. Remove it. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 0b1740b38c7b..14d2ba92a606 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -62,7 +62,6 @@ struct inno_hdmi { unsigned int tmds_rate; struct hdmi_data_info hdmi_data; - struct drm_display_mode previous_mode; }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -498,9 +497,6 @@ static void inno_hdmi_encoder_mode_set(struct drm_encoder *encoder, struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); inno_hdmi_setup(hdmi, adj_mode); - - /* Store the display mode for plugin/DPMS poweron events */ - drm_mode_copy(&hdmi->previous_mode, adj_mode); } static void inno_hdmi_encoder_enable(struct drm_encoder *encoder) From patchwork Sat Dec 16 16:26:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755221 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 CD95A315A0; Sat, 16 Dec 2023 16:27:11 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hOAzxrEq" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a233a60f8feso5643166b.0; Sat, 16 Dec 2023 08:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744030; x=1703348830; 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=Hqi83IjE0rGQjBdIOPd+5QjMZSA3M3R/UCn49KPkLl0=; b=hOAzxrEqOoacTmD5j+we/J3dDRZJUGN0NX9nQWXkenW6TNgsnyjeK7sR6pg6/dB/yU EYBWboLCZ/bSSfbGUZ3zKWB9+lCkvHVFM//qswj4KFFtY4XTKe3BIS2oE9kIeLm5P9rh MmMB3T+of09V92+b/qIqDBexhIToWoZ0/5jx+EGseEuK+vFERYICnqwXwWKWRH0Y0MFG EcKm/sUuas9sulsY6gzus+wWAjmIJ4ZtF/QStb8nB6nQJIiGDK/dBZJdedQrQGRfvsxl YxXYcfYrbOaEusO2Q4gSIX37vYOGPWAuOEUYUH88DG2TwkXV5sglpOysCbHJgu1yeBbl fXZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744030; x=1703348830; 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=Hqi83IjE0rGQjBdIOPd+5QjMZSA3M3R/UCn49KPkLl0=; b=uglRtmk5vQNcpn6kO8Mwd8ChHlmsldN/jiGXJeUNl5rFGvFtJk9GjJ6FhwEERCyLKo e63EuC1zq+0rvjgNSkWnxO5TcBC9fMYm3RzMlkKdBPVxqWblEyXZF0fLR90dQzIt14n2 buDU+w1Sg3WR5tNZJIW/94mO274cH88CzaLzs49Z0gRTlqQ+eB+aEo/KhmjX5siZIvaG 3jl62P3qHqlXkwqZKmurGdxYRIg7wvmZujfsf3/Qr6xQgAkVM67+Qeq2E4bMGiIahL5f DOzzTR38P0E/Pqvx1y8snDo2/p79l49EVzPBlu7s8nmVrYIiAD7xdOZYNirVv9P9sjra GhCw== X-Gm-Message-State: AOJu0YwDEfPac6YGR/SL0xyEV4KkjPe1a6KqXId39mZkJvsp0iE14IzF ay6xThSk7hHDVcDYALGLTg== X-Google-Smtp-Source: AGHT+IHHkaSV0PLeGLYtGjjthyyJAnEZDrIREkjriPjfZBjDTW6VbnTr3UAM7Dj/3F63T9YuXxGXpg== X-Received: by 2002:a17:906:5352:b0:a1f:9617:99a with SMTP id j18-20020a170906535200b00a1f9617099amr4768328ejo.94.1702744029988; Sat, 16 Dec 2023 08:27:09 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:09 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 06/27] drm/rockchip: inno_hdmi: Switch encoder hooks to atomic Date: Sat, 16 Dec 2023 17:26:17 +0100 Message-ID: <20231216162639.125215-7-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The inno_hdmi encoder still uses the !atomic variants of enable, disable and modeset. Convert to their atomic equivalents. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 14d2ba92a606..48c4f010b260 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -491,22 +491,25 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, } static void inno_hdmi_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adj_mode) + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { + struct drm_display_mode *adj_mode = &crtc_state->adjusted_mode; struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); inno_hdmi_setup(hdmi, adj_mode); } -static void inno_hdmi_encoder_enable(struct drm_encoder *encoder) +static void inno_hdmi_encoder_enable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); inno_hdmi_set_pwr_mode(hdmi, NORMAL); } -static void inno_hdmi_encoder_disable(struct drm_encoder *encoder) +static void inno_hdmi_encoder_disable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); @@ -527,10 +530,10 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, } static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = { - .enable = inno_hdmi_encoder_enable, - .disable = inno_hdmi_encoder_disable, - .mode_set = inno_hdmi_encoder_mode_set, - .atomic_check = inno_hdmi_encoder_atomic_check, + .atomic_check = inno_hdmi_encoder_atomic_check, + .atomic_enable = inno_hdmi_encoder_enable, + .atomic_disable = inno_hdmi_encoder_disable, + .atomic_mode_set = inno_hdmi_encoder_mode_set, }; static enum drm_connector_status From patchwork Sat Dec 16 16:26:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754965 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 50ADF3174A; Sat, 16 Dec 2023 16:27:12 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GPCSFiem" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-552ff8d681aso883979a12.1; Sat, 16 Dec 2023 08:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744030; x=1703348830; 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=enGw8p8B5CzjGv0S8y8E93U6rzPMRXDY8CyOli66yco=; b=GPCSFiem7awZ/Bq4UJclcJ+kSLCXPlRXaYcUyQ6FoObu64eXXspw0ZL9jdL0EwKRhk I8/C82sq6L44awNvcHCgvfk+vMqp2nHcKZmDqgo86KzFdnRNRxvrasZwUGbg0w/07om5 Yzh4AxVjxNgywk1NBZ2WQPER5iCVujf1guN/XcUhYhdH6SF5rKHvBKJsYE6AIf6Q4azT ffbqriX/GsC2vlwXC4mHeTg0GVH1lJTtFEGfmFYa/icnvR0olWUBCeKqkHn4cuAlOavF xy6DKpjOCgAdWyFr2m776TZz70rMYjw5q121+lutTEfoQuv9XRLemyvxpsfj6L4jgNlm H9hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744030; x=1703348830; 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=enGw8p8B5CzjGv0S8y8E93U6rzPMRXDY8CyOli66yco=; b=Gumm/dgEIAuOgjtEs8uBeRdAp1pQy1+Mm7mt1asMR2fPvpvPIvpM9m0DAcVoRZbo5t 8HxPyLgKIz5Va1ocSOymiKzgE445JBL7of+711POs1WoMd12XQtZHQAHCG84YXl+U+sA EikNid/FLVMFZtNxdPIBRr3m34cWve/F9ED9q4mpGcCyzJPF8FlFxxgzf5VaNaMbySra Jmifi7KaM3VEoKy3jce1tOVQs8qWCbjHhwQ2gLcLnFrHczkLikzHoD5/j6n4GGMn863F RkkXfx1v+WAeIkXO5EIQx5l3RyVaPcHNDRppAAynVyU8qLShGx8ac10m1i3rPm3W2tKd KQTw== X-Gm-Message-State: AOJu0YyV/VetTANOkCcxYPvK5JHLRuyMGSutSbVFET1mCi6FvSP9eskU aYyJbF3ZM4fwQmJFM88WGbXNoNu4KQ== X-Google-Smtp-Source: AGHT+IGw7FiYDghqDzTy3nLXlydCF1Rdkl1jTzgPRe5Ngs12gDtlJP7mEFvi4eD8tZOZvQbZfPvCdw== X-Received: by 2002:a17:907:5c7:b0:a23:f56:98e1 with SMTP id wg7-20020a17090705c700b00a230f5698e1mr5449054ejb.18.1702744030650; Sat, 16 Dec 2023 08:27:10 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:10 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 07/27] drm/rockchip: inno_hdmi: Get rid of mode_set Date: Sat, 16 Dec 2023 17:26:18 +0100 Message-ID: <20231216162639.125215-8-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard We're not doing anything special in atomic_mode_set so we can simply merge it into atomic_enable. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 48c4f010b260..299770e481b7 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -490,21 +490,22 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, return 0; } -static void inno_hdmi_encoder_mode_set(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - struct drm_display_mode *adj_mode = &crtc_state->adjusted_mode; - struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); - - inno_hdmi_setup(hdmi, adj_mode); -} - static void inno_hdmi_encoder_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) { struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + + conn_state = drm_atomic_get_new_connector_state(state, &hdmi->connector); + if (WARN_ON(!conn_state)) + return; + + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + if (WARN_ON(!crtc_state)) + return; + inno_hdmi_setup(hdmi, &crtc_state->adjusted_mode); inno_hdmi_set_pwr_mode(hdmi, NORMAL); } @@ -533,7 +534,6 @@ static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = { .atomic_check = inno_hdmi_encoder_atomic_check, .atomic_enable = inno_hdmi_encoder_enable, .atomic_disable = inno_hdmi_encoder_disable, - .atomic_mode_set = inno_hdmi_encoder_mode_set, }; static enum drm_connector_status From patchwork Sat Dec 16 16:26:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754964 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 0B37031A82; Sat, 16 Dec 2023 16:27:12 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FBiMK0U4" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a22f59c6ae6so214831566b.1; Sat, 16 Dec 2023 08:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744031; x=1703348831; 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=xnlt5lgm9qwa/3Pu0kcziAAeIBysCmQzwYaw/MNqgTo=; b=FBiMK0U4LEVnUWTLbgWevpBKncqA8DQFQG00i8TDAJHMhTEvsb60p8BPY4hqZfQ37F /iqcLMrLwAc3dppfWvZT/8+IlWR+W9WUlYYaaLQkrRw4QLOctXSUdfhMcxx9+OIz5btf dYJXhTf7QlTpihi8AwKJsJs5i934L1Kt0R4rp8M2oCZEvnb/kdAU/4xIxgHSrDQhuyiG GjBXwJEl8ZbPitIdIKmIKWN5X0AhPTSHjENGAW/+IIm0cJdd5sMk1Z0vJtvz9SycE4Pz i+1NamNvyok/LpWxMaP0FpOTkkgdg5e/M7kpNEk3MHXPaQm9X2xtObuSEEiwpPP0swB1 0n9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744031; x=1703348831; 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=xnlt5lgm9qwa/3Pu0kcziAAeIBysCmQzwYaw/MNqgTo=; b=TpG314+1OQSqss4+VnAjlKKY/8bKt2mHQ3N1XpMaOOtL3VT78f4oM1O5qU2ScBY4DQ xPmboPS7s2/PhGGDLz8oMuUsKawiyABB497RT8PZVqGOlC5F6CHPhkpDd1HhfiaGMd5L Zo2hTfQLs1YhNKqTCWJhCA/1hGwzMGAULYk7Fklv2A8Fdc9i9GCuAq+a+WCRO/LnKd2a kt0Qn1lBC0YmuC3Rsph2LymBOB/ClambOKc3Vy/+/C8dxQvdtG51cBN6D6eqjqeRease nxTIejBe8jnKrWkjXmsUJqVOeAcM1wFWr0WdUXyiX1mxdPgF3t+D/8QAiX5ekV5gnPN5 w2ng== X-Gm-Message-State: AOJu0Yz+0eCfAOGy6ug1eFCq6HGna4qAI/upp7PgbmqpFsuSkM8Wn/oI 4ilJQsOzQrvJf1PFEL/qrU0gx9ytcQ== X-Google-Smtp-Source: AGHT+IFv2/zw0ooG1yd0ojMj7vmNs6hU7B/IUbAwB2DH7Qa5Ghq8j9jjVMSVxr66g2NaXt7MFLjh6w== X-Received: by 2002:a17:907:3da9:b0:a1c:898e:6a0c with SMTP id he41-20020a1709073da900b00a1c898e6a0cmr3708081ejc.210.1702744031312; Sat, 16 Dec 2023 08:27:11 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:11 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 08/27] drm/rockchip: inno_hdmi: no need to store vic Date: Sat, 16 Dec 2023 17:26:19 +0100 Message-ID: <20231216162639.125215-9-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The mode's VIC is only ever used in the inno_hdmi_setup() function so there's no need to store it in the main structure. Signed-off-by: Maxime Ripard [made checkpatch happy] Signed-off-by: Alex Bee Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 299770e481b7..d99896f1a73a 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 { - int vic; bool sink_has_audio; unsigned int enc_in_format; unsigned int enc_out_format; @@ -443,16 +442,15 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, struct drm_display_mode *mode) { struct drm_display_info *display = &hdmi->connector.display_info; - - hdmi->hdmi_data.vic = drm_match_cea_mode(mode); + u8 vic = drm_match_cea_mode(mode); hdmi->hdmi_data.enc_in_format = HDMI_COLORSPACE_RGB; hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; - if ((hdmi->hdmi_data.vic == 6) || (hdmi->hdmi_data.vic == 7) || - (hdmi->hdmi_data.vic == 21) || (hdmi->hdmi_data.vic == 22) || - (hdmi->hdmi_data.vic == 2) || (hdmi->hdmi_data.vic == 3) || - (hdmi->hdmi_data.vic == 17) || (hdmi->hdmi_data.vic == 18)) + if (vic == 6 || vic == 7 || + vic == 21 || vic == 22 || + vic == 2 || vic == 3 || + vic == 17 || vic == 18) hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601; else hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; From patchwork Sat Dec 16 16:26:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755220 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.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 CBF99321BB; Sat, 16 Dec 2023 16:27:13 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JYeTj5EW" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-551c03ae050so1814246a12.2; Sat, 16 Dec 2023 08:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744032; x=1703348832; 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=4O+Q+uG5M/KTzI1PKwCAfiw017Nj6I11OqkfEb5dgI8=; b=JYeTj5EWxkrhr2sfmegs/9eU2KoXflDfvUqzy1lPV7/Ml9expVTbESaWbEjYkeGZLf UBnrnJhMGEJADigqZB/fOKtwg6d4gDzXK4lsp4gNk21UzuZpzIz2Ehq7FWtJvNYt9psw 8+5wPoPiwdcc7wTlT7r5GL1+mG0P9jtq+4DrvsEdS487DnCBJGFUMOVp74LJTNLQR/aK NsWD4QPqVc2BojU9z66FqfftdVYueU8FKd14t1bXiIHYABw2WIkLNEtBeGwzHGtwG21r Zas4eRFRQNZGLYF6jqS4/v9H0vpkiiHTD0qvmYBIk6I4jwRQdUN5q3wHtV0ErsvPHUn4 gVvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744032; x=1703348832; 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=4O+Q+uG5M/KTzI1PKwCAfiw017Nj6I11OqkfEb5dgI8=; b=IKcSO4cdl3WyZgLnqWqCc7IYKuGS6jwHNMu6saONIxKdEyze3hwByDMHFTGfml5/LV ft/rB1YtR5fnMAAiQfreOyQ+zAyg6ybCN+2o9Ifn/hIEhDuAd5utPEdJ4bmvMU53zEeP fwommXxiDlpRUSazsinLp9fh7ZkLU/RqdSPHtqx4TBKPgYDE50BtrrgGs/qh7XyGjw6F r0340Rt7n7pOnvSB3Nqm12KJazw8LDyg/Fet3PSMlgrzTV9lOnVqcU4r4dFWZ9f3Bhmq Uhd/EBZ9kAkVVO3xIq3LJh5AvAVctPIb3WB1naghtOTS2bqMYglIFdaw8+Wk7RWmLURT At4Q== X-Gm-Message-State: AOJu0YxulT+WANsmC5u3p693cUm3+G1e4SEfa7vL6ruJnP/Kg5Iatbzs 4jgBthav5lk8CJxQXQhZSQ== X-Google-Smtp-Source: AGHT+IFyQOJtDkKfP/aGpoVbX9uCAPLdCE/IT1cjuph553xK4Po40z2xou+CG3MWlJoPZyeCd1bl/w== X-Received: by 2002:a17:906:d4:b0:a0a:f739:ad6e with SMTP id 20-20020a17090600d400b00a0af739ad6emr5182343eji.31.1702744032054; Sat, 16 Dec 2023 08:27:12 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:11 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 09/27] drm/rockchip: inno_hdmi: Remove unneeded has audio flag Date: Sat, 16 Dec 2023 17:26:20 +0100 Message-ID: <20231216162639.125215-10-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The sink_has_audio flag is not used anywhere in the driver so let's get rid of it. It's redundant with drm_display_info.has_audio anyway. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index d99896f1a73a..58aff7a9c09a 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 { - bool sink_has_audio; unsigned int enc_in_format; unsigned int enc_out_format; unsigned int colorimetry; @@ -554,7 +553,6 @@ static int inno_hdmi_connector_get_modes(struct drm_connector *connector) edid = drm_get_edid(connector, hdmi->ddc); if (edid) { - hdmi->hdmi_data.sink_has_audio = drm_detect_monitor_audio(edid); drm_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); kfree(edid); From patchwork Sat Dec 16 16:26:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754963 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 9E01C32C67; Sat, 16 Dec 2023 16:27:14 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gyg+l2bT" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-40c517d0de5so18402625e9.0; Sat, 16 Dec 2023 08:27:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744033; x=1703348833; 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=KAoRz0wHCs8LYRbt4lNTAJ8vx4780AGy/20pu4Etj/0=; b=gyg+l2bTeIwDBEi+sgVX2igib/bUciUDVznKwWMrQL8WS69i5FCUcUynsKlPOUHfOI Aoi/f0dAZfRfjZBi8w8uz6QPrGHovyICXAwwuLvJNK1HTrILEuylHgHx1AyCDXTGQTv+ 5sbPL6rF3QSuLPQYsWN7bBjGSqaUEaUuVC5uUbatxb+gKB3KWGIoFj5T5bwhL/n95u4W zXoRzG2mDaI/tIyJfWdKUNh/7+Pa9YUr78fqD4xTatZ/hWD1agvTrwu2uXICcjte68ng 6GPa1VNiB/qBzhNYygJxWIreu2jr4o4K0971O255hFaCTJnIkSuiLAB4vEIsPVg4smhw Qd9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744033; x=1703348833; 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=KAoRz0wHCs8LYRbt4lNTAJ8vx4780AGy/20pu4Etj/0=; b=wMYDdbCtSbGTPOLmALcuBrC21HadwzSO0KhXoofu5iesZXCo6++iwZ/IWGFjswcha9 8G1S0PPrccO2XEZW5iywQSPBpy7b4H+PYM+VJdG5IctEv5dMdqPNmVk3ivo819cXSycv ZVdtKwJ+7hxb7BChhlfxYy5IBq++3+r7vV3sOAxob/k1n40GrGf4OUlJhQpzReJE6+Cl lPmMsMR73ilQ/hgqAEEbRsZHyiXdpg2BgDQnorWP1KGtlwfId5EJAEbD2DJbyHetY+oF 2z/A7agL3UYR7rb93sD/npn/5hSy9L0bsoskUj7Uh2zDLau9ZOGF4ua2HkGkCTFCmrhx RXSA== X-Gm-Message-State: AOJu0YzvDmt5jBFLgHCkANVnCD4+Hs6JYhDuOeEmWStA6lbvJXf41mzP /5FI+mwnZtH7/xu93VcOCQ== X-Google-Smtp-Source: AGHT+IG0Hmya+9f+E9zucCIpHt7tAYGl7L/GXaMKN6CpdCLNuo7NhmcAilRqP2ZxOhD8YSjMeDmc/A== X-Received: by 2002:a05:600c:474e:b0:40c:4be1:be09 with SMTP id w14-20020a05600c474e00b0040c4be1be09mr4886690wmo.186.1702744032805; Sat, 16 Dec 2023 08:27:12 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:12 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 10/27] drm/rockchip: inno_hdmi: Remove useless input format Date: Sat, 16 Dec 2023 17:26:21 +0100 Message-ID: <20231216162639.125215-11-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The driver has a lot of logic to deal with multiple input formats, but hardcodes it to RGB. This means that most of that code has been dead code, so let's get rid of it. Signed-off-by: Maxime Ripard [made checkpatch happy] Signed-off-by: Alex Bee Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 41 ++++++++-------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 58aff7a9c09a..7c75feedacad 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_in_format; unsigned int enc_out_format; unsigned int colorimetry; }; @@ -328,47 +327,30 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) v_VIDEO_INPUT_CSP(0); hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value); - if (data->enc_in_format == data->enc_out_format) { - if ((data->enc_in_format == HDMI_COLORSPACE_RGB) || - (data->enc_in_format >= HDMI_COLORSPACE_YUV444)) { - 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->enc_out_format == HDMI_COLORSPACE_RGB) { + 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_in_format == HDMI_COLORSPACE_RGB) && - (data->enc_out_format == HDMI_COLORSPACE_YUV444)) { + 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_in_format == HDMI_COLORSPACE_YUV444) && - (data->enc_out_format == HDMI_COLORSPACE_RGB)) { - csc_mode = CSC_ITU601_16_235_TO_RGB_0_255_8BIT; - auto_csc = AUTO_CSC_ENABLE; - c0_c2_change = C0_C2_CHANGE_DISABLE; - csc_enable = v_CSC_DISABLE; } } else { - if ((data->enc_in_format == HDMI_COLORSPACE_RGB) && - (data->enc_out_format == HDMI_COLORSPACE_YUV444)) { + 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; - } else if ((data->enc_in_format == HDMI_COLORSPACE_YUV444) && - (data->enc_out_format == HDMI_COLORSPACE_RGB)) { - csc_mode = CSC_ITU709_16_235_TO_RGB_0_255_8BIT; - auto_csc = AUTO_CSC_ENABLE; - c0_c2_change = C0_C2_CHANGE_DISABLE; - csc_enable = v_CSC_DISABLE; } } @@ -443,7 +425,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_in_format = HDMI_COLORSPACE_RGB; hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; if (vic == 6 || vic == 7 || From patchwork Sat Dec 16 16:26:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755219 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 93BAC341BD; Sat, 16 Dec 2023 16:27:15 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UXIbdnTC" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a1d2f89ddabso191578366b.1; Sat, 16 Dec 2023 08:27:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744034; x=1703348834; 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=droXS1VwLjQHMIbiZwuYM0gMqlIpmFeRVQnM5SEX4co=; b=UXIbdnTCCrMG+WGyY3sIj01f/52yFssZkolV4cef4XuAPGt7lQ9wye8gZ6mjhdh9SP VC+QhuEdx2Dw6uBmnjxCjZd1tY6PHPteCXcQEbyFmTJTXt3c70tHYzqAsp4h0bJ6/W1L 6iKNsOu8fcWalGXtl/cjZulBeLCfnfnCqImsvO+8VYBSbe6sMKcaDtcnldmx2UWGPw35 0Fr/uIWE1AskOI/zbscXmEBBEkf1Elv1jgsgkwQ8DebK14dtE9Ph+XFyR0bjGFOD24V+ rLNv9S2kdnHmOwL7xc4uehZGHQiiT9b2tzfZR8dFjFZEEWLbt8FITlbAAWAjsaEXK2gZ vojQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744034; x=1703348834; 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=droXS1VwLjQHMIbiZwuYM0gMqlIpmFeRVQnM5SEX4co=; b=ZaOWPG7KMJa553YrT7sPrCukKj41JY3wtUdIFqjstWEnCU2vEjLX4pNn12FgmRdsDw hkgGYcUABM28o2Pn8wSdml2YW5IM54Ng2+w+8A3/io7Y4q8ctWqoUchrNPHiTLUUgqy8 BPaNFX2sx6kaovddpTZHK56zmcQEd63ARGyhzFrXAys/A5lynB01a+Gr8ZplCatbLwH5 p2STZPYQpgx2fbFuYERI7I5mPm6obIjqgFYsCFOZGnLGlHINibCT9IqL4D9gzgonPscz cqkoei/3ruBQx7upKZ6KVS/OMIDTXbxUhmm722kwdEo+StkXbHOQu7XonGygzXnntV6k whkA== X-Gm-Message-State: AOJu0YxWvO0/PZXgM5sXQGrZSvwcEZhBmjdsreyTcaZBkbHYUMzhf0yM zRXH9nQcXvZetiDMeHiWwg== X-Google-Smtp-Source: AGHT+IGCbJ2pPaCyxT0gqr9ykpy0r+mCHKKQDsnV4NSzT5q0D0O1ZspxzFhMLbO9gd0Z2KHRy7XNxg== X-Received: by 2002:a17:906:142:b0:a22:faf0:3bbc with SMTP id 2-20020a170906014200b00a22faf03bbcmr3702764ejh.139.1702744033851; Sat, 16 Dec 2023 08:27:13 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:13 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 11/27] drm/rockchip: inno_hdmi: Remove YUV-based csc coefficents Date: Sat, 16 Dec 2023 17:26:22 +0100 Message-ID: <20231216162639.125215-12-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that the unneeded support for YUV based input formats is gone, the csc coefficients for those formats can be dropped as well. Signed-off-by: Alex Bee --- changes in v2: - new patch drivers/gpu/drm/rockchip/inno_hdmi.c | 37 ---------------------------- 1 file changed, 37 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 7c75feedacad..04344ee1265d 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -74,49 +74,12 @@ static struct inno_hdmi *connector_to_inno_hdmi(struct drm_connector *connector) } enum { - CSC_ITU601_16_235_TO_RGB_0_255_8BIT, - CSC_ITU601_0_255_TO_RGB_0_255_8BIT, - CSC_ITU709_16_235_TO_RGB_0_255_8BIT, CSC_RGB_0_255_TO_ITU601_16_235_8BIT, CSC_RGB_0_255_TO_ITU709_16_235_8BIT, CSC_RGB_0_255_TO_RGB_16_235_8BIT, }; static const char coeff_csc[][24] = { - /* - * YUV2RGB:601 SD mode(Y[16:235], UV[16:240], RGB[0:255]): - * R = 1.164*Y + 1.596*V - 204 - * G = 1.164*Y - 0.391*U - 0.813*V + 154 - * B = 1.164*Y + 2.018*U - 258 - */ - { - 0x04, 0xa7, 0x00, 0x00, 0x06, 0x62, 0x02, 0xcc, - 0x04, 0xa7, 0x11, 0x90, 0x13, 0x40, 0x00, 0x9a, - 0x04, 0xa7, 0x08, 0x12, 0x00, 0x00, 0x03, 0x02 - }, - /* - * YUV2RGB:601 SD mode(YUV[0:255],RGB[0:255]): - * R = Y + 1.402*V - 248 - * G = Y - 0.344*U - 0.714*V + 135 - * B = Y + 1.772*U - 227 - */ - { - 0x04, 0x00, 0x00, 0x00, 0x05, 0x9b, 0x02, 0xf8, - 0x04, 0x00, 0x11, 0x60, 0x12, 0xdb, 0x00, 0x87, - 0x04, 0x00, 0x07, 0x16, 0x00, 0x00, 0x02, 0xe3 - }, - /* - * YUV2RGB:709 HD mode(Y[16:235],UV[16:240],RGB[0:255]): - * R = 1.164*Y + 1.793*V - 248 - * G = 1.164*Y - 0.213*U - 0.534*V + 77 - * B = 1.164*Y + 2.115*U - 289 - */ - { - 0x04, 0xa7, 0x00, 0x00, 0x07, 0x2c, 0x02, 0xf8, - 0x04, 0xa7, 0x10, 0xda, 0x12, 0x22, 0x00, 0x4d, - 0x04, 0xa7, 0x08, 0x74, 0x00, 0x00, 0x03, 0x21 - }, - /* * RGB2YUV:601 SD mode: * Cb = -0.291G - 0.148R + 0.439B + 128 From patchwork Sat Dec 16 16:26:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754962 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.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 6672E3457A; Sat, 16 Dec 2023 16:27:16 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nRsM2dgx" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a233bf14cafso3904266b.2; Sat, 16 Dec 2023 08:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744035; x=1703348835; 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=ECr4TU+4dWwEpyi0MRJHLZRYm5yt9s85NOlMMczFD3o=; b=nRsM2dgxziOh7IR/Ec0+3dhEvdlPxRuAShetYoQ4+ku8pSZoWLUF4HAkJjiWGUwoVX i8NKUJ7kZutYBqmji0Pa/Nrv0YhBEgjScztMRjj+6kvWqj6ydvIR176RRwg5yYHV3Uqf cSr+YBsX4UH6IFdyLCQ0n23E4vHcmz1C9nU6h2CFSK+1SjoYRHFoPa9iQzwRKudX1KYV ITleLTLdTbtiIWCFB8FwG/NHZTF9s/9Cj1WJNQlyqXszYMIUBs3FF55aPDoJXCFDUeIQ GF84dMArT868PtUJSx8kO685qhB6J0gIvJf5Rfq41JwYfO/3rfl5Ea4vVxF91ebjuDqF KT1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744035; x=1703348835; 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=ECr4TU+4dWwEpyi0MRJHLZRYm5yt9s85NOlMMczFD3o=; b=LTtBNN7LLoOJTUc29pZHTb19U6BFBXAvCct/MfVwvPHIkUHsAPMg4InDfGo7PILzB8 U82dsVF6wP8nLmiMeEG5UYawyWeknh5PwFvU+kAz/eN/JFJudRGuXRHXg04kdaoTKD+u QhWzIPmgII8H7lT1tNXwJW1eoZYel0TccyKR/w8cqGqWAy4sBeGfx46IkbbumvYx1+YQ QzhZaDoshrNof7qW1uS8ljZI37OPss699eWHm4hJmVkzHC/zjPzN/MxdHRIxE1eJ+qzP cJfsLzZ+hbS5qghvU1tKjSzSMEZFm/nlFuxXw/CI2QFRJnktBAh4/HCqGXyC3Rz0t+16 3aCg== X-Gm-Message-State: AOJu0YxWOdNvPrUrBZBry5K47q/UznndODZTUivtxIyk9usWjt3FcyU8 ua49CX6OIYd2OtgXvevkgw== X-Google-Smtp-Source: AGHT+IGGXCXV7iuVsJthNs7xfU7rsSHw66Q2y9j042wi558zp4keY2U5j+cevcIqQYjVqvV5U3yloQ== X-Received: by 2002:a17:906:e8d:b0:a19:a19b:c736 with SMTP id p13-20020a1709060e8d00b00a19a19bc736mr6780924ejf.134.1702744034682; Sat, 16 Dec 2023 08:27:14 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:14 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Jonker , Alex Bee Subject: [PATCH v2 12/27] drm/rockchip: inno_hdmi: Drop HDMI Vendor Infoframe support Date: Sat, 16 Dec 2023 17:26:23 +0100 Message-ID: <20231216162639.125215-13-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The HDMI vendor infoframe is only meant to be sent with 4k60 modes and higher, but the controller doesn't support them. Let's drop them from the kernel. Suggested-by: Johan Jonker Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 35 ++++++++-------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 04344ee1265d..1dd757845547 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -208,11 +208,15 @@ static void inno_hdmi_reset(struct inno_hdmi *hdmi) } static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, int setup_rc, - union hdmi_infoframe *frame, u32 frame_index, - u32 mask, u32 disable, u32 enable) + union hdmi_infoframe *frame, u32 frame_index) { - if (mask) - hdmi_modb(hdmi, HDMI_PACKET_SEND_AUTO, mask, disable); + struct drm_connector *connector = &hdmi->connector; + + if (frame_index != INFOFRAME_AVI) { + drm_err(connector->dev, + "Unsupported infoframe type: %u\n", frame_index); + return 0; + } hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_BUF_INDEX, frame_index); @@ -228,28 +232,11 @@ static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, int setup_rc, for (i = 0; i < rc; i++) hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_ADDR + i, packed_frame[i]); - - if (mask) - hdmi_modb(hdmi, HDMI_PACKET_SEND_AUTO, mask, enable); } return setup_rc; } -static int inno_hdmi_config_video_vsi(struct inno_hdmi *hdmi, - struct drm_display_mode *mode) -{ - union hdmi_infoframe frame; - int rc; - - rc = drm_hdmi_vendor_infoframe_from_display_mode(&frame.vendor.hdmi, - &hdmi->connector, - mode); - - return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_VSI, - m_PACKET_VSI_EN, v_PACKET_VSI_EN(0), v_PACKET_VSI_EN(1)); -} - static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, struct drm_display_mode *mode) { @@ -267,7 +254,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, else frame.avi.colorspace = HDMI_COLORSPACE_RGB; - return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI, 0, 0, 0); + return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI); } static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) @@ -410,10 +397,8 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, inno_hdmi_config_video_csc(hdmi); - if (display->is_hdmi) { + if (display->is_hdmi) inno_hdmi_config_video_avi(hdmi, mode); - inno_hdmi_config_video_vsi(hdmi, mode); - } /* * When IP controller have configured to an accurate video From patchwork Sat Dec 16 16:26:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755218 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 0D89334CF1; Sat, 16 Dec 2023 16:27:16 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lC6ELqZ6" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-552d39ac3ccso2601012a12.0; Sat, 16 Dec 2023 08:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744035; x=1703348835; 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=i9QZuywAC4EI3NrqImc1jlnBGMQF6PpPHDhHez7fyFw=; b=lC6ELqZ66HTWeSk1fO0gBvzesZIupydZdhYexTiF+MkbiTU5N/qM7wSmLB5pHdpTkS TjEtvBs9cF+Y8aAnIspe6BvXUxA0n2IFXhgAdZyA0kIGQ25adKkRD9l7PXAtuYIzYpnZ PqrT54vqL90GuU3BpIKvksbJUWFoHPZ4MjL1C8hsNDrPzEB2nel52fRdMjjcmjT5JN4z FeWilNCsbghNXjR6LZlWkcJua5jETJ0T/S4l9Ubmxa8h4Azn23WrxF+pt+Ul+CsgRiwV gXCdP1K4dZvuH0TBn4AIM9K33F+Z14Ym7++tj3xph6JuV1UBWjOfg0inKo5D1nErkBM5 Tmqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744035; x=1703348835; 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=i9QZuywAC4EI3NrqImc1jlnBGMQF6PpPHDhHez7fyFw=; b=syoHOsqdoK0Ofx0XWULxmx/Lv5d4HJgUUunuJHBSZeRk1eDbq2BCp9xddSezmitd3u DPtueQthTV2vZx0L/8VqdOz5VdTlDRcRDVpzelM/Bc4MOUBXftYL2V3SIsfPfEd0NvfQ iVulnx/FGNL9uS7TMaxDx35UA4IbLQotM6LmLvsFo/0omLY8l6etUo0MSH4sjWVYGjRq VW9x0AHCL6u5drOiOIJvqGdp8OV6nUg5W0s7Pm83Oqg+qw5BaGdQZ2kjRpwIp4G2pOWM FzADyGeIprYHIX2lZvJKGOjxpm4MuUjXKkpxYytu9H+fbVXZE/dWyTOFTTh2vyvf7gBs BoSA== X-Gm-Message-State: AOJu0YzaGLQoxMwzuu+rXghMdNFPU2Ea0+z00Uh+mqi5CHE/DnsKy8au uYMPrBDglQOFYyvty5P83sumhHz9KA== X-Google-Smtp-Source: AGHT+IHGbh6ggRb8WI42dSTU+fAZTkS0f9QpcbJqWKC6qLhps1dmDmupPrITbbQTUiS7sKzLN0d+eQ== X-Received: by 2002:a17:906:610:b0:a19:a409:37dc with SMTP id s16-20020a170906061000b00a19a40937dcmr14010099ejb.53.1702744035357; Sat, 16 Dec 2023 08:27:15 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:15 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 13/27] drm/rockchip: inno_hdmi: Move infoframe disable to separate function Date: Sat, 16 Dec 2023 17:26:24 +0100 Message-ID: <20231216162639.125215-14-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The code to upload infoframes to the controller uses a weird construct which, based on the previous function call return code, will either disable or enable that infoframe. In order to get rid of that argument, let's split the function to disable the infoframe into a separate function and make it obvious what we are doing in the error path. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 46 ++++++++++++++++++---------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 1dd757845547..6354949bfd8e 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -207,34 +207,44 @@ static void inno_hdmi_reset(struct inno_hdmi *hdmi) inno_hdmi_set_pwr_mode(hdmi, NORMAL); } -static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, int setup_rc, - union hdmi_infoframe *frame, u32 frame_index) +static void inno_hdmi_disable_frame(struct inno_hdmi *hdmi, u32 frame_index) { struct drm_connector *connector = &hdmi->connector; if (frame_index != INFOFRAME_AVI) { drm_err(connector->dev, "Unsupported infoframe type: %u\n", frame_index); - return 0; + return; } hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_BUF_INDEX, frame_index); +} - if (setup_rc >= 0) { - u8 packed_frame[HDMI_MAXIMUM_INFO_FRAME_SIZE]; - ssize_t rc, i; - - rc = hdmi_infoframe_pack(frame, packed_frame, - sizeof(packed_frame)); - if (rc < 0) - return rc; +static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, + union hdmi_infoframe *frame, u32 frame_index) +{ + struct drm_connector *connector = &hdmi->connector; + u8 packed_frame[HDMI_MAXIMUM_INFO_FRAME_SIZE]; + ssize_t rc, i; - for (i = 0; i < rc; i++) - hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_ADDR + i, - packed_frame[i]); + if (frame_index != INFOFRAME_AVI) { + drm_err(connector->dev, + "Unsupported infoframe type: %u\n", frame_index); + return 0; } - return setup_rc; + inno_hdmi_disable_frame(hdmi, frame_index); + + rc = hdmi_infoframe_pack(frame, packed_frame, + sizeof(packed_frame)); + if (rc < 0) + return rc; + + for (i = 0; i < rc; i++) + hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_ADDR + i, + packed_frame[i]); + + return 0; } static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, @@ -246,6 +256,10 @@ 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 (rc) { + inno_hdmi_disable_frame(hdmi, INFOFRAME_AVI); + return rc; + } if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444) frame.avi.colorspace = HDMI_COLORSPACE_YUV444; @@ -254,7 +268,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, else frame.avi.colorspace = HDMI_COLORSPACE_RGB; - return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI); + return inno_hdmi_upload_frame(hdmi, &frame, INFOFRAME_AVI); } static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) From patchwork Sat Dec 16 16:26:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754961 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 D6B3E3527F; Sat, 16 Dec 2023 16:27:17 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X6rqeUoM" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-40c60dfa5bfso20167155e9.0; Sat, 16 Dec 2023 08:27:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744036; x=1703348836; 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=mG1054x2y8+5VXwex9KrJL2EhA9y28dmW4DfXU50wTY=; b=X6rqeUoMewdEbdxKdatXx/6CxrZQVCowouNMZNs0U1LuHiQIBWeTu+nMx5RjvJG5Yd dtIgfJbyyAnAohClB/CVXWUk9lrXH7HjlX5ss+KND56MWvffk8QNNlK4uEiQhDm+ImMF cxf/g1b7bfnMeDIuaUR/TRzsWnClyplK/9GYW0ND0gKE5wmx120n2lqx/gAVRojdwfW3 2uPGtIMQsI9bVl3RyNq/sAfH1nVTvHyoark/V9vodgmuB6WVJ70K7wv25qvUX4i6SHsK 4jeE00mXi7yFX3nAMclo5vMtwgTbinbCYq1Gjn2cprJm1s+JphpQBJcr8deF6/cq6JYi 3EYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744036; x=1703348836; 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=mG1054x2y8+5VXwex9KrJL2EhA9y28dmW4DfXU50wTY=; b=VH/uP8gFV+/x1RnERivK4deyEpB2mnp68jiN1y8Oz790tPaIfLCRyCGPXCYOrhtVPn A6MhDAWv27yY0AIoP02wMymOIxZI2nhiObD8LDqxPeMgucqQhxyTth4iPS3uPJokjLe2 g7yl/7b0e7PFziZaoq/xTa4CJpIlDH90K9TyeqO9t5iG/UKCFWhn87r6fos+s4+iF7sE iOKwvAOyIOt3wQ0prX9qRdG+qsbV6vXA+aCzsJljCQ07aUcWosAux9MsmzvUCYMl7OGa kNvmeLHBYZEqIcsETWT53VebFwT7ThDPrdzeCaePtxWquwhshyvMyJFEnyE4hipV+Zxx Ljww== X-Gm-Message-State: AOJu0Yw5dEHac9g4m16xzfshND47HDV2SqV4YJijZms3pHX17r0UcDcq w7sM0kQrWtsfB9Z+iE0WjA== X-Google-Smtp-Source: AGHT+IF5X6IwmDt2ZPPo2v31K2XP7aYkHF2OwxSE29V+DEh/kHK4gFeglJFBDfi5S8oMxOTw9YPbPA== X-Received: by 2002:a05:600c:3596:b0:40c:ab87:9d9c with SMTP id p22-20020a05600c359600b0040cab879d9cmr547390wmq.53.1702744036134; Sat, 16 Dec 2023 08:27:16 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:15 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 14/27] drm/rockchip: inno_hdmi: Switch to infoframe type Date: Sat, 16 Dec 2023 17:26:25 +0100 Message-ID: <20231216162639.125215-15-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The inno_hdmi driver relies on its own internal infoframe type matching the hardware. This works fine, but in order to make further reworks easier, let's switch to the HDMI spec definition of those types. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 6354949bfd8e..b6b34f4b8cda 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -207,33 +207,34 @@ static void inno_hdmi_reset(struct inno_hdmi *hdmi) inno_hdmi_set_pwr_mode(hdmi, NORMAL); } -static void inno_hdmi_disable_frame(struct inno_hdmi *hdmi, u32 frame_index) +static void inno_hdmi_disable_frame(struct inno_hdmi *hdmi, + enum hdmi_infoframe_type type) { struct drm_connector *connector = &hdmi->connector; - if (frame_index != INFOFRAME_AVI) { + if (type != HDMI_INFOFRAME_TYPE_AVI) { drm_err(connector->dev, - "Unsupported infoframe type: %u\n", frame_index); + "Unsupported infoframe type: %u\n", type); return; } - hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_BUF_INDEX, frame_index); + hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_BUF_INDEX, INFOFRAME_AVI); } static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, - union hdmi_infoframe *frame, u32 frame_index) + union hdmi_infoframe *frame, enum hdmi_infoframe_type type) { struct drm_connector *connector = &hdmi->connector; u8 packed_frame[HDMI_MAXIMUM_INFO_FRAME_SIZE]; ssize_t rc, i; - if (frame_index != INFOFRAME_AVI) { + if (type != HDMI_INFOFRAME_TYPE_AVI) { drm_err(connector->dev, - "Unsupported infoframe type: %u\n", frame_index); + "Unsupported infoframe type: %u\n", type); return 0; } - inno_hdmi_disable_frame(hdmi, frame_index); + inno_hdmi_disable_frame(hdmi, type); rc = hdmi_infoframe_pack(frame, packed_frame, sizeof(packed_frame)); @@ -257,7 +258,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, &hdmi->connector, mode); if (rc) { - inno_hdmi_disable_frame(hdmi, INFOFRAME_AVI); + inno_hdmi_disable_frame(hdmi, HDMI_INFOFRAME_TYPE_AVI); return rc; } @@ -268,7 +269,7 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, else frame.avi.colorspace = HDMI_COLORSPACE_RGB; - return inno_hdmi_upload_frame(hdmi, &frame, INFOFRAME_AVI); + return inno_hdmi_upload_frame(hdmi, &frame, HDMI_INFOFRAME_TYPE_AVI); } static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) From patchwork Sat Dec 16 16:26:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755217 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 B8FD4321BB; Sat, 16 Dec 2023 16:27:18 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EjcS9X4K" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a1ef2f5ed01so216691866b.0; Sat, 16 Dec 2023 08:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744037; x=1703348837; 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=73XUcSiZm29Hst8BGY/CNDIJrl23XpjPpmNwnFVb4KY=; b=EjcS9X4KdVNULbVGSH9dKIdFJ+b2Be0IHxPzAGMQuIssww7sP2z/ouZIaRf1Zu8D0q 7iHBKO1rhMslEaofNfIUlyC5IQX8KINU2ETtmonBkHyNw6YGe8OM0DYbvsWTceHpv2ES WZ0/o8Np40jKWVjZxAXPXKG7RV9avQ8Ep1/hHR7VuF78fR26es8h5EWPisXU7+s1JMt/ lhCSr0oS5oKLllL1D+wqkdYQ1RcfXVjXSoH0g5XYsoLst2UaJrnbirfAbjh0dlX0DfHT LksCFtWEslvR/zAwDTn5R8aDpVv2Wk/nRvXhCRqISflRdgn7CFk/GFXg9g5sr5jsh7NW 73BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744037; x=1703348837; 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=73XUcSiZm29Hst8BGY/CNDIJrl23XpjPpmNwnFVb4KY=; b=T2iKX+KePhBmW3Ffs4yD0L3cgOpokuOSg1lnUg3/XMVfoNOShogVdGY1Jgq5zNVFiB rtSWe4YC7H+ChnhfXcGuWDoqlNU6FfGzYZy6L1S4b2zDdDOPJDiUKuA7RM6KvLo4mASe Ml2BFH890jFFSkAU72g117JjIk3yFW1StKqQ594b0Pxsx82+tcqZvrBQe450uNPKvK/k tKZFmMRi+wMLiTBGB9s+DEHlzfBECG10w1fqnHW+JIJD0lrb0jqi9No6XhDlPRTs5LT1 Zrj9zSY6OJJnezsPF2jcVe3JsySlcFEgzxJA5cwkgaXY07sISxv0WA5IwR6VaDg/m/Kq +8og== X-Gm-Message-State: AOJu0YwotkEfCBHcNAItpgE70QzNqq5DaLNmpwIrvWgjb2xX2CyfJJk6 ETa+/mp1AlFAFcIKYCKfdQ== X-Google-Smtp-Source: AGHT+IFqBPxW/2QVy0WrDKBDbe9uYBS+XAaayLmej63jccZiISHw1g3uoqKtiDcxw89fuZb28tBdPQ== X-Received: by 2002:a17:907:724d:b0:a1c:a39d:dcbd with SMTP id ds13-20020a170907724d00b00a1ca39ddcbdmr4339820ejc.232.1702744036964; Sat, 16 Dec 2023 08:27:16 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:16 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 15/27] drm/rockchip: inno_hdmi: Remove unused drm device pointer Date: Sat, 16 Dec 2023 17:26:26 +0100 Message-ID: <20231216162639.125215-16-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The drm_dev field in the inno_hdmi struct stores a pointer to the DRM device but is never used anywhere in the driver. Let's remove it. Signed-off-by: Maxime Ripard Tested-by: Alex Bee --- changes in v2: - imported patch drivers/gpu/drm/rockchip/inno_hdmi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index b6b34f4b8cda..e37023d8fa39 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -44,7 +44,6 @@ struct inno_hdmi_i2c { struct inno_hdmi { struct device *dev; - struct drm_device *drm_dev; int irq; struct clk *pclk; @@ -760,7 +759,6 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, return -ENOMEM; hdmi->dev = dev; - hdmi->drm_dev = drm; hdmi->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(hdmi->regs)) From patchwork Sat Dec 16 16:26:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754960 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 635DC36AFF; Sat, 16 Dec 2023 16:27:19 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K0UQKqHi" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-54c7744a93fso2051844a12.2; Sat, 16 Dec 2023 08:27:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744038; x=1703348838; 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=XVVbI3UTdjEdNjMJt0TLf0s4Teux8aF6Z8rzwOg5CSc=; b=K0UQKqHiw9tDZDZT/KfV2Ussx8ubQuVhxW5BWsEgjx/C7ww9K6XZlFPbAcdUYoyc/B B3vnOwYoIhVSD+G88UNtMxuGwxoBk2Bb9LB+u12l0xsoB6fuLxzR5E8FEx45GTNHBEmP v6Ej0SruINPF5rMf29jkhMa+jQiHjlOkfhmpGV5QMbYmUOjYaDvgNq8tlly2cK6sTu/D tswcZ4pOjMJpfILGJWeO0L/5Cs7Q0o9uD8GU6JfIhxtW7uz4N0yxjsLnepsyZEvWNM3G eJNU2DzB1W5KXNbB4DH+5XLPeLs04Z5X983Yq62HP2GsPYjQuVPDpnoRMteufl6ImlBf gYMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744038; x=1703348838; 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=XVVbI3UTdjEdNjMJt0TLf0s4Teux8aF6Z8rzwOg5CSc=; b=C9jMjErM25zwNX9J7jVXeT4V/CTfzXyI4XZziEJZCT73DOiOwr10n3blLnfU2NrTyv hFIT8Fwx9YpXGoTsORkhy9geNJsf/XSPCHspW1esnwUMarf+DysZLIbkFBe/gcKex3LR InxUCmlx5Ft8RF6IpY58kUnlB7narvklH48S81Ww72Zztb3SXs2yq24IsVcuFQh60FxE qxCTIsKYNw9fG38Vgjfbg7O3MNTIu39cX1uUQpTfw43PpvJel/V7IepFQoGrSmbffxZN jvixV7o2BKTc7QWdFFYmaIOCQyOQXRrvIZfWqEhihxuM6fbuftOtjhSzhG9BhTHvFzI/ W0Tg== X-Gm-Message-State: AOJu0Yzi5ON/kzJu3GWCLL62WX4/w80Q8km830TUxQ9iJ4l2Jwu1J4mr lr0XVQSgo9SzJzl6NweyEogEg4DG4A== X-Google-Smtp-Source: AGHT+IHHs7PgwtHCDlp/FqUXAIhufy7iNz+SxosjtQiOzqhHkLXHcAd6A1Uk8Np38VLThP5p396hkg== X-Received: by 2002:a17:906:287:b0:a23:2ccc:8eb1 with SMTP id 7-20020a170906028700b00a232ccc8eb1mr368904ejf.134.1702744037655; Sat, 16 Dec 2023 08:27:17 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:17 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 16/27] drm/rockchip: inno_hdmi: Drop irq struct member Date: Sat, 16 Dec 2023 17:26:27 +0100 Message-ID: <20231216162639.125215-17-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The struct member irq isn't used anywhere. Drop it. Signed-off-by: Alex Bee Reviewed-by: Maxime Ripard --- changes in v2: - new patch drivers/gpu/drm/rockchip/inno_hdmi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index e37023d8fa39..d9eb8cdc0148 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -45,7 +45,6 @@ struct inno_hdmi_i2c { struct inno_hdmi { struct device *dev; - int irq; struct clk *pclk; void __iomem *regs; From patchwork Sat Dec 16 16:26:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755216 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 E0AB13066C; Sat, 16 Dec 2023 16:27:19 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ORln11Q0" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a1ca24776c3so523898566b.0; Sat, 16 Dec 2023 08:27:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744038; x=1703348838; 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=uYVqczyH7NXnPG1SGiVfMuDstNC9AVi+qa/g94ih5J4=; b=ORln11Q06AfwRwzKAvM8o7KJiraB3oCCa5aGGo5jVqP1cB4xe3f6thvQVeITtDUjq8 ZpzYllZEIGyr7dvdHbeDud22Zch7jNU/roOaxvB6b01rscPOgp/jbDZLLgzC5IPo8yzT +DeYXfr4X+SyZyDBp4stQObeZGq/AgEMoWUOzRqR842CbBQnJBpqKl55AIIu6znojW2F l1MjzX6rWvoyrJ6gTd2V59/xMqm0wQBq4Vk0ryfIWwHsR5oqK32qeqeDVF6/e1eWR+SD LPF8kV/hAtVKikxKqTa0zN0cXVNrD3b3ZyOkqG6p2aI9YRemeP91euqudwiyjKP+othv tNYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744038; x=1703348838; 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=uYVqczyH7NXnPG1SGiVfMuDstNC9AVi+qa/g94ih5J4=; b=F4JBGOd6YQlZmK5tMoe72XZHUr0MVycZDqd7FhPaHwBOaCCQ9nE3U3saad1ZEqr54d /jxW3+ZQJE6tv9MuVlbdcKkS1wcFeTNK5ds+wVLnl5nKmPIbO0sAPG7Ggp1tVR7v3Hc5 v0rLgxKOuDkB/oAnyLYL+XCUhouAMNiJhvUtfBz4P6M10Sp1DAeo54g7ZqR9kvg3LgfN +UD14Xg2MBY/v9rEmWXoJMkof0nRBwSKvTf0wWGZWo8k9auOnbCEBv7EURBNHtQy9JEf lZvBMCxRHW3xH0cg2sPOvyH7TrwCpOubI2Zwbr9+Ukp/teMe+bEog0Yflk1OoD4nqjtV j3hw== X-Gm-Message-State: AOJu0YzqEQqOiijq5wgagfLQpYS09CrLPVYDgIbrw9fHrJQ3XzK+hCHZ 3ioGhI8yP19O3V5DOiWUyhr59MSLfA== X-Google-Smtp-Source: AGHT+IFQguCjqhAt5YMtNc7JRxmN3MqTnMpRgT1krDRhGkQTlTpXIYTPCKozsi5nGRJMmdtgCFPTcg== X-Received: by 2002:a17:907:12d6:b0:a23:3828:573c with SMTP id vp22-20020a17090712d600b00a233828573cmr157926ejb.3.1702744038296; Sat, 16 Dec 2023 08:27:18 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:18 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 17/27] drm/rockchip: inno_hdmi: Remove useless include Date: Sat, 16 Dec 2023 17:26:28 +0100 Message-ID: <20231216162639.125215-18-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The inclusion syscon.h isn't used anywhere. Remove it. Signed-off-by: Alex Bee Reviewed-by: Maxime Ripard --- changes in v2: - new patch drivers/gpu/drm/rockchip/inno_hdmi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index d9eb8cdc0148..62c7e2275246 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include From patchwork Sat Dec 16 16:26:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754959 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.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 A457F37D1F; Sat, 16 Dec 2023 16:27:20 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LlnoPjCR" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a1ef2f5ed01so216693566b.0; Sat, 16 Dec 2023 08:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744039; x=1703348839; 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=R/eFbXWfaMM0I74IrKyTPfTKiYx+jg35hR0AyiA/w9A=; b=LlnoPjCRW5tMBVZSdBvvWV1668s2ZS1ltUQD0IaWBMQPxogH5zfNeqY7WdMscuOfe6 q9YM7hbPfzEVHp9qTVbjMWZ3OSPqqcemLW28X1uMAo75PRds71eVUHJJWN2olIv7D+zg F6/cvUBEWV6uc5/TS+u1iZ+bVAdCIB05fAYaO5nbENSbCBLfMzqcult+8Xn26om7B62d CttXnzZw4YG0dJIdT+RSv9z2uATw/ex+KaeeP6L030pI71V3gVhX/VJ9rKg9pRYRPV8Y a9P0yELvgjhrA0G+iaXbAUFDvG30bmtzvihVto8d3bE+qnGS4eSh5OAp6INtL5ObsWPJ xgow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744039; x=1703348839; 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=R/eFbXWfaMM0I74IrKyTPfTKiYx+jg35hR0AyiA/w9A=; b=nDN4Q2qBXeQ3lETtZ6B8rGgn45n9ZLo7kTCL4yjkgzKe6jjiOBnvHGqr5mq3SSkmVv FY7rnumohx1nQ+0pv2GELl+BcZXOMu6jGYVc7fQcCKO+8l7d5s2JsBvH/YLrRRT+ZOK2 VYx8ANSu1/OriDEdCaL4vZOcQ0EYoQgd/SFafJmita9VeXNqFyPZzflWqUJLtzbCx7gR LvcMpM8UgcnmmAYm226d5XjvPi6AAAuMK/JWoqJ31A45YnqsYwduVQvno1FJJsdmtDY/ mqE+5SlVlLDUJhwpb+BJsor/7DileVJR3Vr1tNs9AvQFqQ1I9O0Ewf4NfCTSgDoOO8ih K0XA== X-Gm-Message-State: AOJu0YwTcRH16yX6YDujPFXg1f8pAR2Jy5BTs1okKoZUKjn2MqakW26K gQa1sT0AzlzY4D0cGWxlNw== X-Google-Smtp-Source: AGHT+IFcXZmVFLxYHlvqMbP/xbdnhMTM7dR1bMRRMLYfTq4p6bSRSS6zHWkOWzhS8av038yeCD6ZRw== X-Received: by 2002:a17:907:cbc8:b0:a19:a1ba:bae1 with SMTP id vk8-20020a170907cbc800b00a19a1babae1mr4432738ejc.135.1702744039030; Sat, 16 Dec 2023 08:27:19 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:18 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 18/27] drm/rockchip: inno_hdmi: Subclass connector state Date: Sat, 16 Dec 2023 17:26:29 +0100 Message-ID: <20231216162639.125215-19-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The data which is currently hold in hdmi_data should not be part of device itself but of the connector state. Introduce a connector state subclass and move the data from hdmi_data in there. Suggested-by: Maxime Ripard Signed-off-by: Alex Bee --- changes in v2: - new patch drivers/gpu/drm/rockchip/inno_hdmi.c | 67 +++++++++++++++++++++------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 62c7e2275246..f9bfae1e97a2 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -26,11 +26,6 @@ #include "inno_hdmi.h" -struct hdmi_data_info { - unsigned int enc_out_format; - unsigned int colorimetry; -}; - struct inno_hdmi_i2c { struct i2c_adapter adap; @@ -54,8 +49,12 @@ struct inno_hdmi { struct i2c_adapter *ddc; unsigned int tmds_rate; +}; - struct hdmi_data_info hdmi_data; +struct inno_hdmi_connector_state { + struct drm_connector_state base; + unsigned int enc_out_format; + unsigned int colorimetry; }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -70,6 +69,9 @@ static struct inno_hdmi *connector_to_inno_hdmi(struct drm_connector *connector) return container_of(connector, struct inno_hdmi, connector); } +#define to_inno_hdmi_conn_state(_state) \ + container_of_const(_state, struct inno_hdmi_connector_state, base) + enum { CSC_RGB_0_255_TO_ITU601_16_235_8BIT, CSC_RGB_0_255_TO_ITU709_16_235_8BIT, @@ -248,6 +250,10 @@ static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, struct drm_display_mode *mode) { + struct drm_connector *connector = &hdmi->connector; + struct drm_connector_state *conn_state = connector->state; + struct inno_hdmi_connector_state *inno_conn_state = + to_inno_hdmi_conn_state(conn_state); union hdmi_infoframe frame; int rc; @@ -259,9 +265,9 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, return rc; } - if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444) + if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_YUV444) frame.avi.colorspace = HDMI_COLORSPACE_YUV444; - else if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV422) + else if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_YUV422) frame.avi.colorspace = HDMI_COLORSPACE_YUV422; else frame.avi.colorspace = HDMI_COLORSPACE_RGB; @@ -271,7 +277,10 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) { - struct hdmi_data_info *data = &hdmi->hdmi_data; + struct drm_connector *connector = &hdmi->connector; + struct drm_connector_state *conn_state = connector->state; + struct inno_hdmi_connector_state *inno_conn_state = + to_inno_hdmi_conn_state(conn_state); int c0_c2_change = 0; int csc_enable = 0; int csc_mode = 0; @@ -289,7 +298,7 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) v_VIDEO_INPUT_CSP(0); hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value); - if (data->enc_out_format == HDMI_COLORSPACE_RGB) { + if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_RGB) { value = v_SOF_DISABLE | v_COLOR_DEPTH_NOT_INDICATED(1); hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value); @@ -300,15 +309,15 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) return 0; } - if (data->colorimetry == HDMI_COLORIMETRY_ITU_601) { - if (data->enc_out_format == HDMI_COLORSPACE_YUV444) { + if (inno_conn_state->colorimetry == HDMI_COLORIMETRY_ITU_601) { + if (inno_conn_state->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) { + if (inno_conn_state->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; @@ -386,16 +395,20 @@ 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); + struct drm_connector *connector = &hdmi->connector; + struct drm_connector_state *conn_state = connector->state; + struct inno_hdmi_connector_state *inno_conn_state = + to_inno_hdmi_conn_state(conn_state); - hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; + inno_conn_state->enc_out_format = HDMI_COLORSPACE_RGB; if (vic == 6 || vic == 7 || vic == 21 || vic == 22 || vic == 2 || vic == 3 || vic == 17 || vic == 18) - hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601; + inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_601; else - hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; + inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_709; /* Mute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, @@ -522,12 +535,32 @@ static void inno_hdmi_connector_destroy(struct drm_connector *connector) drm_connector_cleanup(connector); } +static struct drm_connector_state * +inno_hdmi_connector_duplicate_state(struct drm_connector *connector) +{ + struct inno_hdmi_connector_state *inno_conn_state; + + if (WARN_ON(!connector->state)) + return NULL; + + inno_conn_state = kmemdup(to_inno_hdmi_conn_state(connector->state), + sizeof(*inno_conn_state), GFP_KERNEL); + + if (!inno_conn_state) + return NULL; + + __drm_atomic_helper_connector_duplicate_state(connector, + &inno_conn_state->base); + + return &inno_conn_state->base; +} + static const struct drm_connector_funcs inno_hdmi_connector_funcs = { .fill_modes = inno_hdmi_probe_single_connector_modes, .detect = inno_hdmi_connector_detect, .destroy = inno_hdmi_connector_destroy, .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_duplicate_state = inno_hdmi_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; From patchwork Sat Dec 16 16:26:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755215 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 51058381B2; Sat, 16 Dec 2023 16:27:21 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eunQT72/" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-548ce39b101so1996812a12.2; Sat, 16 Dec 2023 08:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744039; x=1703348839; 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=xquaKm3YPbbfHci/n27FNskS85Fe2FEHpYLHWs9wnrA=; b=eunQT72/2oqPu2ddLmo+onfpQsJkJ+S4avC2v9wcjvAYsyllXxZfBaF4qgeojNea+V LQQs34MxoKsRJ2VsEtYuCdDRihDf2Nj0M6AQKlq+XWpspGVStDUI5kzCzzaam5DO5p+/ yttIxUjBd7s1HJ1LbxR8kJPzUuTABJ5O+zadxD7dIsE+R/oNYpFoxjKI+OqnEb/t9BGw hSNFYwDeKTO2wx2O/34DkdKdN4Cdz6eAcsHTjdq9J7Y2nUUHNBijJhx7LQUwpHsYvHQD 0G9u9KHA/LErvBLtehFl0nVdHv6eLDSrAzZueI1Q+jVTFfPgeiYBn7UTQvstuH5D4gjt hMNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744039; x=1703348839; 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=xquaKm3YPbbfHci/n27FNskS85Fe2FEHpYLHWs9wnrA=; b=JMqEa71EEABFS1YanCvigLl6W3SFDM64FHkISUmV6bFsUUj8AEGi9cHTWEDsYWgH0i jJpAk02+AS5Qjqms1JPQF6JSBJ9yo1Tf7Q8vj0TmZ+rFlEOpU1Zk7LhZRS10M1WvQn8f Rp52sLWms78+iCmIUQueeuxc10TZz7grcphtVz03vQ69XtyrHBMqT6zBWO79dVAy72jL zPdp+NR0lB9d+UC1zOROYVxyoUK5Yo+0L5itRFycH82wEhF0bo3NGG/p+vD2VMXPIMyT lFU1IxKfNNYcFRq1AgKGon0+EM3i8zL7L19DAX/ohDf3fEi2whkrtxVIK/JJCye7RY1I sOrw== X-Gm-Message-State: AOJu0YwWqiwIgZfbPnmH4yh2kKw8AofO7gzn3DbXV7Pm13T088aknXR3 A2fc9A+w1M9augoE4u8KVw== X-Google-Smtp-Source: AGHT+IFUzerbBkuL8ogyxF7tayR3DeWeoAa4xKPEYCPluQhDzstDriEv+K+qp24yTyj3tqDUtQcT3Q== X-Received: by 2002:a17:906:2c7:b0:a23:2aa7:d48b with SMTP id 7-20020a17090602c700b00a232aa7d48bmr212918ejk.14.1702744039643; Sat, 16 Dec 2023 08:27:19 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:19 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 19/27] drm/rockchip: inno_hdmi: Move tmds rate to connector state subclass Date: Sat, 16 Dec 2023 17:26:30 +0100 Message-ID: <20231216162639.125215-20-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Similar to the othter members of inno_hdmi_connector_state the tmds_rate is not a property of the device, but of the connector state. Move it to inno_hdmi_connector_state and make it a long to comply with the clock framework. To get arround the issue of not having the connector state when inno_hdmi_i2c_init is called in the bind path, getting the tmds rate is wrapped in function which returns the fallback rate if the connector doesn't have a state yet. Signed-off-by: Alex Bee --- changes in v2: - new patch drivers/gpu/drm/rockchip/inno_hdmi.c | 36 +++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index f9bfae1e97a2..6799d24501b8 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -47,14 +47,13 @@ struct inno_hdmi { struct inno_hdmi_i2c *i2c; struct i2c_adapter *ddc; - - unsigned int tmds_rate; }; struct inno_hdmi_connector_state { struct drm_connector_state base; unsigned int enc_out_format; unsigned int colorimetry; + unsigned long tmds_rate; }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -133,11 +132,33 @@ static inline void hdmi_modb(struct inno_hdmi *hdmi, u16 offset, hdmi_writeb(hdmi, offset, temp); } +static unsigned long inno_hdmi_tmds_rate(struct inno_hdmi *hdmi) +{ + struct drm_connector *connector = &hdmi->connector; + struct drm_connector_state *conn_state = connector->state; + struct inno_hdmi_connector_state *inno_conn_state; + + if (conn_state) { + inno_conn_state = to_inno_hdmi_conn_state(conn_state); + return inno_conn_state->tmds_rate; + } + + /* + * When IP controller haven't configured to an accurate video + * timing, then the TMDS clock source would be switched to + * PCLK_HDMI, so we need to init the TMDS rate to PCLK rate, + * and reconfigure the DDC clock. + */ + + return clk_get_rate(hdmi->pclk); +} + static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi) { int ddc_bus_freq; + unsigned long tmds_rate = inno_hdmi_tmds_rate(hdmi); - ddc_bus_freq = (hdmi->tmds_rate >> 2) / HDMI_SCL_RATE; + ddc_bus_freq = (tmds_rate >> 2) / 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); @@ -431,7 +452,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_conn_state->tmds_rate = mode->clock * 1000; inno_hdmi_i2c_init(hdmi); /* Unmute video and audio output */ @@ -823,13 +844,6 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, goto err_disable_clk; } - /* - * When IP controller haven't configured to an accurate video - * timing, then the TMDS clock source would be switched to - * 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); ret = inno_hdmi_register(drm, hdmi); From patchwork Sat Dec 16 16:26:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754958 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 DE56739ADF; Sat, 16 Dec 2023 16:27:21 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ayixFSuC" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a22f59c6ae6so214841866b.1; Sat, 16 Dec 2023 08:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744040; x=1703348840; 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=eeP9TO9V+vEKe4+An2VukwFpdenqcBYIdbA3kdqXnt8=; b=ayixFSuC79q4Aon/eqqsjXLpWOzUbexVLV0QQk50ieBw8gmS+IUrfi5He+vzqlnD8t OCyp2Pt7aR06oGf//vj1pTCmBRJDBqPK9sCaJ1HuG1Q7pLgij1Br9XddV/ju5FILp70q Yrr/Bwi2fS6YWS0iwrRbQqxc9TytkWdoLvWTHM8do4SFDlwBVI0hmD1BWDgenKmG5h12 mLT+/kIanu6zQg9cVM+n96b/1CtoUBYll38vlx7uOG0X2uENXUqfL3gB1TQhrmTQnFe8 Nq+nfs/EEBerervkXU1W5W7PDHHknIPj2BxJbbcJ9iuHfB9Rt1KmZYTtnb8jlUsGLgKb 0TPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744040; x=1703348840; 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=eeP9TO9V+vEKe4+An2VukwFpdenqcBYIdbA3kdqXnt8=; b=inBgFGBTHt2hpdnyhrUzRKaUpc4ulsx62uaf7Pc4ZxiRrAWB8qVgqsceaS6JYC97I3 RA5pMBhFKPuvUYxNu+RHQvobCVCXoSVVcEhPo8JKboS1UNbEPEwTj6fOsLhULxJSRwpD uqrcLKZLz4OSeaffjTqqAZlU490UVxaMoFSVuD6zS+ZrZ6psiEo5nqztxmhvbwqxiVhZ sbktkMbt4ZXe07Ln2+pjZP2CWI2pu7m8M9/zaernfpaO5fktC1lkp9gS8+cBYGGXMXId zR4ZNjiKNSH17LlQBalH/BzjmVWzI1en8F4zvV3D65xSdF/Q/dRlghcV2tuFTqgQLyUP DlEQ== X-Gm-Message-State: AOJu0Ywtc/7kiByhSHfOqOSJTgygC0uoZECA3ej5acQGM0/g92fT6guv Q4IDIvEctm7aorMTT4XOXw== X-Google-Smtp-Source: AGHT+IEy38X0xbtf3xBfqjoxplLyZkqC6IMsseY2tnTm+ch8eIhob3KOfE1WsE0GkDI5Mc3Qu6NtmA== X-Received: by 2002:a17:906:24e:b0:a1d:b7b9:3274 with SMTP id 14-20020a170906024e00b00a1db7b93274mr3725525ejl.169.1702744040255; Sat, 16 Dec 2023 08:27:20 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:20 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 20/27] drm/rockchip: inno_hdmi: Correctly setup HDMI quantization range Date: Sat, 16 Dec 2023 17:26:31 +0100 Message-ID: <20231216162639.125215-21-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The display controller will always give full range RGB regardless of the mode set, but HDMI requires certain modes to be transmitted in limited range RGB. This is especially required for HDMI sinks which do not support non-standard quantization ranges. This enables color space conversion for those modes and sets the quantization range accordingly in the AVI infoframe. Signed-off-by: Alex Bee --- changes in v2: - made rgb_limited_range part of the new custom connector state drivers/gpu/drm/rockchip/inno_hdmi.c | 60 +++++++++++++++++++--------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 6799d24501b8..9f27a5faf12d 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -54,6 +54,7 @@ struct inno_hdmi_connector_state { unsigned int enc_out_format; unsigned int colorimetry; unsigned long tmds_rate; + bool rgb_limited_range; }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -293,6 +294,18 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, else frame.avi.colorspace = HDMI_COLORSPACE_RGB; + if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_RGB) { + drm_hdmi_avi_infoframe_quant_range(&frame.avi, + connector, mode, + inno_conn_state->rgb_limited_range ? + HDMI_QUANTIZATION_RANGE_LIMITED : + HDMI_QUANTIZATION_RANGE_FULL); + } else { + frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; + frame.avi.ycc_quantization_range = + HDMI_YCC_QUANTIZATION_RANGE_LIMITED; + } + return inno_hdmi_upload_frame(hdmi, &frame, HDMI_INFOFRAME_TYPE_AVI); } @@ -320,29 +333,37 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value); if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_RGB) { - 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 (inno_conn_state->colorimetry == HDMI_COLORIMETRY_ITU_601) { - if (inno_conn_state->enc_out_format == HDMI_COLORSPACE_YUV444) { - csc_mode = CSC_RGB_0_255_TO_ITU601_16_235_8BIT; + if (inno_conn_state->rgb_limited_range) { + csc_mode = CSC_RGB_0_255_TO_RGB_16_235_8BIT; auto_csc = AUTO_CSC_DISABLE; c0_c2_change = C0_C2_CHANGE_DISABLE; csc_enable = v_CSC_ENABLE; + + } else { + 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; } } else { - if (inno_conn_state->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; + if (inno_conn_state->colorimetry == HDMI_COLORIMETRY_ITU_601) { + if (inno_conn_state->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 (inno_conn_state->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; + } } } @@ -431,6 +452,9 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, else inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_709; + inno_conn_state->rgb_limited_range = + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED; + /* Mute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, v_AUDIO_MUTE(1) | v_VIDEO_MUTE(1)); From patchwork Sat Dec 16 16:26:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755214 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 AA7B23A8E4; Sat, 16 Dec 2023 16:27:22 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y/pwDwu1" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40c31f18274so20681285e9.0; Sat, 16 Dec 2023 08:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744041; x=1703348841; 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=PQiEPu38i3aFFXbXmZDuj9Z5I3dO6tjlHXJ/GQ5qAv8=; b=Y/pwDwu1SWujJS+mfrve8neCtZsuD4WmJyhhphEWSD/s3C6RcBe0nLFXBo7QrVAhQ5 kbi85GwxW6KDY0NDl5VfCGWnc8t/UNB9Edzqu1+J+gAOjQQ4YGO6Vnn5Zc9FiZdsV69z rU84Z51GYweEidt5wP7HJkciwmQHfAVu5DrVQBBtgbjpVQKWDz/p3LFcQ9LBmQolAivv sL396AGUqQoHQOja9VRtS1QCB18lzS+YU+NZQugrhPbIAWCKxGaSygAKJUF1SGJusOHx OFwPS5PX15ReAHNSbsapEAlkpJmbg90K9fXuiPgW5nUyKFVvxHpL2uZSt+p+s8qURyWz nBqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744041; x=1703348841; 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=PQiEPu38i3aFFXbXmZDuj9Z5I3dO6tjlHXJ/GQ5qAv8=; b=Y4M1gKLmw+P05c+iTlYgViibFuBIVGmiG23NfTsYGuTKurpqCuwA6xhkoYyFd4Pk8l 2l+aiI8+UyAKMJE+eEBlBLCrsBnloi1elXh5UtJl+WPxHrIi16wbTUZwiEW0k5IWJWam R1cm1SbJEwn6UJkxSpdkmdqtTx2SjU2YfxP2wyuFxM8EL1JHFWJzVkQcGKOUcPkPfik0 mK6eiKwc6DAWnWfrrz5aC3LVv2GmQ4QqrYAyKC/WI16Do0WpMXrjBhkckCH4U9X5pPMs Gseu9DK2/7YSOgOB55nCaTem4q2MUWeo1luLs1Gcj1k+yGKztawOJu8/HPJFr8iyD2Xw 5k+w== X-Gm-Message-State: AOJu0YzdT0TadIHxLdABXDpV5KWzLNKjU9PkV+8xX11k/m/Xh2xuMGmH QHmK7Y3miPZ9z9C3/lsRZg== X-Google-Smtp-Source: AGHT+IGQCWmeafdHQEypddGMm/p+SelPFJgQl85DV9NvkhBX+hUyEJqHE51Oq1RSeni9fFl9ZjpDOw== X-Received: by 2002:a05:600c:524e:b0:40c:18e9:d610 with SMTP id fc14-20020a05600c524e00b0040c18e9d610mr6278994wmb.71.1702744040982; Sat, 16 Dec 2023 08:27:20 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:20 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 21/27] drm/rockchip: inno_hdmi: Add variant support Date: Sat, 16 Dec 2023 17:26:32 +0100 Message-ID: <20231216162639.125215-22-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In preparation to support RK3128's integration of the controller, this patch adds a simple variant implementation. They mainly differ in the phy configuration required, so those are part of the match_data. The values have been taken from downstream. The pixelclocks in there are meant to be max-inclusive. Signed-off-by: Alex Bee --- changes in v2: - no changes drivers/gpu/drm/rockchip/inno_hdmi.c | 69 +++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 9f27a5faf12d..579baba6a61b 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -26,6 +26,17 @@ #include "inno_hdmi.h" +struct inno_hdmi_phy_config { + unsigned long pixelclock; + u8 pre_emphasis; + u8 voltage_level_control; +}; + +struct inno_hdmi_variant { + struct inno_hdmi_phy_config *phy_configs; + struct inno_hdmi_phy_config *default_phy_config; +}; + struct inno_hdmi_i2c { struct i2c_adapter adap; @@ -47,6 +58,8 @@ struct inno_hdmi { struct inno_hdmi_i2c *i2c; struct i2c_adapter *ddc; + + const struct inno_hdmi_variant *variant; }; struct inno_hdmi_connector_state { @@ -114,6 +127,30 @@ static const char coeff_csc[][24] = { }, }; +static struct inno_hdmi_phy_config rk3036_hdmi_phy_configs[] = { + { 74250000, 0x3f, 0xbb }, + { 165000000, 0x6f, 0xbb }, + { ~0UL, 0x00, 0x00 } +}; + +static int inno_hdmi_find_phy_config(struct inno_hdmi *hdmi, + unsigned long pixelclk) +{ + const struct inno_hdmi_phy_config *phy_configs = + hdmi->variant->phy_configs; + int i; + + for (i = 0; phy_configs[i].pixelclock != ~0UL; i++) { + if (pixelclk <= phy_configs[i].pixelclock) + return i; + } + + DRM_DEV_DEBUG(hdmi->dev, "No phy configuration for pixelclock %lu\n", + pixelclk); + + return -EINVAL; +} + static inline u8 hdmi_readb(struct inno_hdmi *hdmi, u16 offset) { return readl_relaxed(hdmi->regs + (offset) * 0x04); @@ -179,12 +216,26 @@ static void inno_hdmi_sys_power(struct inno_hdmi *hdmi, bool enable) static void inno_hdmi_set_pwr_mode(struct inno_hdmi *hdmi, int mode) { + struct inno_hdmi_phy_config *phy_config; + int ret; + unsigned long tmds_rate; + switch (mode) { case NORMAL: inno_hdmi_sys_power(hdmi, false); + tmds_rate = inno_hdmi_tmds_rate(hdmi); + ret = inno_hdmi_find_phy_config(hdmi, tmds_rate); + if (ret < 0) { + phy_config = hdmi->variant->default_phy_config; + DRM_DEV_ERROR(hdmi->dev, + "Using default phy configuration for TMDS rate %lu", + tmds_rate); + } else { + phy_config = &hdmi->variant->phy_configs[ret]; + } - hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x6f); - hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0xbb); + hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, phy_config->pre_emphasis); + hdmi_writeb(hdmi, HDMI_PHY_DRIVER, phy_config->voltage_level_control); hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x14); @@ -827,6 +878,8 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm = data; struct inno_hdmi *hdmi; + const struct inno_hdmi_variant *variant; + int irq; int ret; @@ -836,6 +889,12 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, hdmi->dev = dev; + variant = of_device_get_match_data(hdmi->dev); + if (!variant) + return -EINVAL; + + hdmi->variant = variant; + hdmi->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(hdmi->regs)) return PTR_ERR(hdmi->regs); @@ -923,8 +982,14 @@ static void inno_hdmi_remove(struct platform_device *pdev) component_del(&pdev->dev, &inno_hdmi_ops); } +static const struct inno_hdmi_variant rk3036_inno_hdmi_variant = { + .phy_configs = rk3036_hdmi_phy_configs, + .default_phy_config = &rk3036_hdmi_phy_configs[1], +}; + static const struct of_device_id inno_hdmi_dt_ids[] = { { .compatible = "rockchip,rk3036-inno-hdmi", + .data = &rk3036_inno_hdmi_variant, }, {}, }; From patchwork Sat Dec 16 16:26:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754957 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 4EFD83C487; Sat, 16 Dec 2023 16:27:23 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YY/RmLFO" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40c6e2a47f6so13693595e9.0; Sat, 16 Dec 2023 08:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744041; x=1703348841; 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=BFps/f+CAs2Nk6z2SsJd+Q0Norbs9x1sCDtq35o8jMc=; b=YY/RmLFOGakkb7BP+E3CEnrzuRGnqDL1QzDYS6OAzpad1MPRYJ+YkP/feS9LnzHkMZ Zb4a+1n9CU6TphEDQM9tgpfZ5LC7umgIZ2KyywkDteqKSIfJFStIsOkQWxDbvSlPcLGK 3P+T/KCYBUSoDu+2pDI8astw1wa2oM5igk9Ma8JFUH8FyFGjbRn0w4JsUutcfTkG4wEt 3ZI0JwmJOGlAfGkrqoAM4AlZlEntAdVHS727w5peEXZ83YTMyHB+pW6vn01oj6EWnalP Zhz7bgsgi8PGmKKnbbplF0fabGf9fmGGN3StWf7gZWQB9E5FHjsbzNJGrKPuj6qA5Nc8 wErg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744041; x=1703348841; 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=BFps/f+CAs2Nk6z2SsJd+Q0Norbs9x1sCDtq35o8jMc=; b=RY2srUuwapDJKaRHEQ5wdMzTveF4GjRubJzjFVr8VV/x/r54Zs2CGhRNKMrsFRmf8H 7zPxoCyyFjmkzu3UydxSO3GvheLB8QnXCdA77mbta0t6NLlrWi6lnGJOcHjCDLYqjynY RmcvSnIaCxfQjgsNziMzA5Q0NRGJXo7Tfw6Q3ytFYij8yHA9jA8FOQToe9HDSTfec6Sw 2i+kpXa/43tu+ECYiq35vckn88Mm90kUkfJqpUXN9/poZRwMXl0WjD1Ms2bgc8F4je3Y CcyZkROiyczK6itKgaJKhh9kWXsXCD6gFOZMv7jsFqLGaqIKXVRiG8C8ovqLtjG21AJf 6Nzw== X-Gm-Message-State: AOJu0YwMwRKDsuhDq1hmRK1q7wQ6sDMHW87Pb7cL2CMeRyJ6SdMBuDDL fM+8imcc2O8fJIcP25o4xw== X-Google-Smtp-Source: AGHT+IGBF4gaRoU/EL0I7tI8RwIyRSfbuxuXO3TR0CaxGjhOjNNy6BcBWFK0VOilT5H96GBjjIme0g== X-Received: by 2002:a05:600c:3d10:b0:40c:dda4:3582 with SMTP id bh16-20020a05600c3d1000b0040cdda43582mr264470wmb.314.1702744041618; Sat, 16 Dec 2023 08:27:21 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:21 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 22/27] drm/rockchip: inno_hdmi: Add RK3128 support Date: Sat, 16 Dec 2023 17:26:33 +0100 Message-ID: <20231216162639.125215-23-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This variant requires the phy reference clock to be enabled before the DDC block can work and the (initial) DDC bus frequency is calculated based on the rate of this clock. Besides the only difference is phy configuration required to make the driver working for this variant as well. Signed-off-by: Alex Bee --- changes in v2: - no changes drivers/gpu/drm/rockchip/inno_hdmi.c | 46 +++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 579baba6a61b..792e5fad09bf 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -51,6 +51,7 @@ struct inno_hdmi { struct device *dev; struct clk *pclk; + struct clk *refclk; void __iomem *regs; struct drm_connector connector; @@ -133,6 +134,12 @@ static struct inno_hdmi_phy_config rk3036_hdmi_phy_configs[] = { { ~0UL, 0x00, 0x00 } }; +static struct inno_hdmi_phy_config rk3128_hdmi_phy_configs[] = { + { 74250000, 0x3f, 0xaa }, + { 165000000, 0x5f, 0xaa }, + { ~0UL, 0x00, 0x00 } +}; + static int inno_hdmi_find_phy_config(struct inno_hdmi *hdmi, unsigned long pixelclk) { @@ -182,13 +189,17 @@ static unsigned long inno_hdmi_tmds_rate(struct inno_hdmi *hdmi) } /* - * When IP controller haven't configured to an accurate video - * timing, then the TMDS clock source would be switched to - * PCLK_HDMI, so we need to init the TMDS rate to PCLK rate, - * and reconfigure the DDC clock. + * When IP controller isn't configured to an accurate + * video timing and there is no reference clock available, + * then the TMDS clock source would be switched to PCLK_HDMI, + * so we need to init the TMDS rate to PCLK rate, and + * reconfigure the DDC clock. */ - return clk_get_rate(hdmi->pclk); + if (hdmi->refclk) + return clk_get_rate(hdmi->refclk); + else + return clk_get_rate(hdmi->pclk); } static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi) @@ -912,6 +923,20 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, return ret; } + hdmi->refclk = devm_clk_get_optional(hdmi->dev, "ref"); + if (IS_ERR(hdmi->refclk)) { + DRM_DEV_ERROR(hdmi->dev, "Unable to get HDMI reference clock\n"); + ret = PTR_ERR(hdmi->refclk); + goto err_disable_pclk; + } + + ret = clk_prepare_enable(hdmi->refclk); + if (ret) { + DRM_DEV_ERROR(hdmi->dev, + "Cannot enable HDMI reference clock: %d\n", ret); + goto err_disable_pclk; + } + irq = platform_get_irq(pdev, 0); if (irq < 0) { ret = irq; @@ -951,6 +976,8 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, err_put_adapter: i2c_put_adapter(hdmi->ddc); err_disable_clk: + clk_disable_unprepare(hdmi->refclk); +err_disable_pclk: clk_disable_unprepare(hdmi->pclk); return ret; } @@ -964,6 +991,7 @@ static void inno_hdmi_unbind(struct device *dev, struct device *master, hdmi->encoder.encoder.funcs->destroy(&hdmi->encoder.encoder); i2c_put_adapter(hdmi->ddc); + clk_disable_unprepare(hdmi->refclk); clk_disable_unprepare(hdmi->pclk); } @@ -987,10 +1015,18 @@ static const struct inno_hdmi_variant rk3036_inno_hdmi_variant = { .default_phy_config = &rk3036_hdmi_phy_configs[1], }; +static const struct inno_hdmi_variant rk3128_inno_hdmi_variant = { + .phy_configs = rk3128_hdmi_phy_configs, + .default_phy_config = &rk3128_hdmi_phy_configs[1], +}; + static const struct of_device_id inno_hdmi_dt_ids[] = { { .compatible = "rockchip,rk3036-inno-hdmi", .data = &rk3036_inno_hdmi_variant, }, + { .compatible = "rockchip,rk3128-inno-hdmi", + .data = &rk3128_inno_hdmi_variant, + }, {}, }; MODULE_DEVICE_TABLE(of, inno_hdmi_dt_ids); From patchwork Sat Dec 16 16:26:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755213 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 633D73D0DD; Sat, 16 Dec 2023 16:27:24 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ElayTmm+" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-50bf3efe2cbso1827092e87.2; Sat, 16 Dec 2023 08:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744042; x=1703348842; 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=E8OEv0l6dNVJqHF1ONziiRRjeg+pBs39OamlQeNnAzk=; b=ElayTmm+GXaHUkL7hbPK4rZxtF6XsrGsoQe0xrUK83FScyzB6U5XdkPgUowADgUBA0 swggymZAPhzNWNJB6ct/SsGrzwgf1MrKnerb+Td73qLH2n/HEHtcWSwbM9H1JQr72fyl /y4IUb3blKyRNI9EfbZySMxdoPC8BMFDGFofikCm2657Pd0o9ZFVP5As98PR8seNyJ3y +cKeVDXWG0b7RDn9AVONchVCKx/GjLg6gKmqdrDFT0qhOBReIQaKceIpbTUbNkmeW7SD 4ni9qc88HfB8acRanhzYFwdAofeTaTaSTIwpx6QERkXBH7Lu36U77S2ZSZ2cIc5fcA1X UCIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744042; x=1703348842; 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=E8OEv0l6dNVJqHF1ONziiRRjeg+pBs39OamlQeNnAzk=; b=C5ki7xYIWPvLYyyBRIsduTSeM9CWIG5wHsK1rnrs8pQ73WWpaN/pNx578zc69FAUf0 PB7HAnJbq+GlrKh4N/yQIa0ciEaoCRGxICObpMDaX9iLlM+xGPrUIEQ5tJDnvlgDUUT9 raDxiDSxrvKuMXKcM+VNhS/nU6drfkG4um7875OPkhbBEpGVfB/f5klL98xmEgMGGjh4 S3CaCe7D5C+ypi0FPNk4WEmhFYA8V04wOr2K6zVctBWS2tRUZ5JBfozHfzRFX91SRZ4J nBCS5UPw9KJaqslqh2B30tTVpsKZ+1aFO4znpaJpDLDruPY4wo5VjZNDnZw9WVHXSTRV +Wzw== X-Gm-Message-State: AOJu0YwvSolG/jSju4M/QoOrrda7JVoH/V718ETCHY2wlF3GAupBCSMq ItBZb2LBuFRC7+fLIBEX1A== X-Google-Smtp-Source: AGHT+IFEHvRQbTKnZvTIoMFV/ssuD2uNon+ejyGS9XyVQHiyLyghPQz2Vh5IUyEFL7l0qFs8Pgr0pg== X-Received: by 2002:a05:6512:1327:b0:50d:6249:17cc with SMTP id x39-20020a056512132700b0050d624917ccmr3309272lfu.245.1702744042393; Sat, 16 Dec 2023 08:27:22 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:22 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 23/27] drm/rockchip: inno_hdmi: Add basic mode validation Date: Sat, 16 Dec 2023 17:26:34 +0100 Message-ID: <20231216162639.125215-24-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As per TRM this controller supports pixelclocks starting from 25 MHz. The maximum supported pixelclocks are defined by the phy configurations we have. Also it can't support modes that require doubled clocks. If the variant has a phy reference clock we can additionally validate against VESA DMT'srecommendations. Signed-off-by: Alex Bee Reviewed-by: Maxime Ripard --- changes in v2: - rename inno_mode_valid -> inno_hdmi_display_mode_valid - fixed max_tolerance calculation - use abs_diff() instead of abs() - call in inno_hdmi_display_mode_valid in atomic_check drivers/gpu/drm/rockchip/inno_hdmi.c | 42 ++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 792e5fad09bf..14473ca96e0f 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -26,6 +26,8 @@ #include "inno_hdmi.h" +#define INNO_HDMI_MIN_TMDS_CLOCK 25000000U + struct inno_hdmi_phy_config { unsigned long pixelclock; u8 pre_emphasis; @@ -548,6 +550,38 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, return 0; } +static enum drm_mode_status inno_hdmi_display_mode_valid(struct inno_hdmi *hdmi, + struct drm_display_mode *mode) +{ + unsigned long mpixelclk, max_tolerance; + long rounded_refclk; + + /* No support for double-clock modes */ + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + return MODE_BAD; + + mpixelclk = mode->clock * 1000; + + if (mpixelclk < INNO_HDMI_MIN_TMDS_CLOCK) + return MODE_CLOCK_LOW; + + if (inno_hdmi_find_phy_config(hdmi, mpixelclk) < 0) + return MODE_CLOCK_HIGH; + + if (hdmi->refclk) { + rounded_refclk = clk_round_rate(hdmi->refclk, mpixelclk); + if (rounded_refclk < 0) + return MODE_BAD; + + /* Vesa DMT standard mentions +/- 0.5% max tolerance */ + max_tolerance = mpixelclk / 200; + if (abs_diff((unsigned long)rounded_refclk, mpixelclk) > max_tolerance) + return MODE_NOCLOCK; + } + + return MODE_OK; +} + static void inno_hdmi_encoder_enable(struct drm_encoder *encoder, struct drm_atomic_state *state) { @@ -581,11 +615,13 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, struct drm_connector_state *conn_state) { struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); + struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); s->output_mode = ROCKCHIP_OUT_MODE_P888; s->output_type = DRM_MODE_CONNECTOR_HDMIA; - return 0; + return inno_hdmi_display_mode_valid(hdmi, + &crtc_state->adjusted_mode) == MODE_OK ? 0 : -EINVAL; } static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = { @@ -626,7 +662,9 @@ static enum drm_mode_status inno_hdmi_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { - return MODE_OK; + struct inno_hdmi *hdmi = connector_to_inno_hdmi(connector); + + return inno_hdmi_display_mode_valid(hdmi, mode); } static int From patchwork Sat Dec 16 16:26:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754956 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 EB2103E49E; Sat, 16 Dec 2023 16:27:24 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C8jvLg2y" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-50bce78f145so1846987e87.0; Sat, 16 Dec 2023 08:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744043; x=1703348843; 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=EMBynW0XhMl+E8jO2xYw0fAFMrIK4HAqJAW8qk9Tvbk=; b=C8jvLg2yo94U0E3qS9G97SOZUwQSoR9mkAiQJal4CunhY7huXN23BLFT1+7I7MVpY8 7gN/nlMwq1PAVeXe5hlt0H0NAJPZmqfY6j6ez+WwUq8BTXW+WnRxOr0hTjYgP7ZgSU5L iWs0Dhl6bqOUXmLxTKEQ78kUTv1beq03q+IAMFG8cjoRBo3xL/24BbyaMvF2WbQ6HZb9 RIe/BZCHACsi+3gn3w/66HBI8LcjazSqEzQKzCigYMhgyGHsU3ZYoYXjF5C5PKwSZEsZ JdG+U3faZASuSIktIE3Yp+I4hPulwsKHSPpOykG/HAnGz3yKQGRgyhu0fCJWjXfAdGPG KIog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744043; x=1703348843; 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=EMBynW0XhMl+E8jO2xYw0fAFMrIK4HAqJAW8qk9Tvbk=; b=YLpig4KoOOHYytrKbjmaYQjADg7h2SONDZ2QRJWerOSxTthUF+0xArpQVFET1ZdBJO SwrO9ajBgAWV9xXwpnrL1L8x46r28bC6AgAIgqgi6nO1j+xpyTX9Z8AHBhm8J6ICJKPx pRQl9Oi2/r18+r1Xes1gAO3Xj7K2gjgvmfgKuTAkENRA/+WNonl3M7yYIkMO4zZrnCkq D0lQOqN7qfJNSFBiK2BghVSy7ccikPddppWkOJrkCeDFZqsNVPjCZIzHjI9pHaDftZBb BYhFkDNDl36zY1c1BVJFkxokZ+d2GwyvZTJEI4meGz33WN3XylX3SyRe9n+vQXBXOprl CzXw== X-Gm-Message-State: AOJu0Yww4M9iAOc+pYKF3vr5uEg785bHtPXpxXUQp9ar0mu3e60fblop r896bmywoVl9Cq5arsvSQeKJfSoK2w== X-Google-Smtp-Source: AGHT+IETdaeg0faWSQ1kmwbaQCOpBidvPKReyG1VUQs/IwAoTIeCSP7GXEKcKNtGmATpxPyBDsVDVg== X-Received: by 2002:a05:6512:2352:b0:50e:1b0c:1143 with SMTP id p18-20020a056512235200b0050e1b0c1143mr1151682lfu.53.1702744043055; Sat, 16 Dec 2023 08:27:23 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:22 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 24/27] drm/rockchip: inno_hdmi: Drop custom fill_modes hook Date: Sat, 16 Dec 2023 17:26:35 +0100 Message-ID: <20231216162639.125215-25-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that we have proper pixelclock-based mode validation we can drop the custom fill_modes hook. CRTC size validation for the display controller has been added with Commit 8e140cb60270 ("drm/rockchip: vop: limit maximum resolution to hardware capabilities") Signed-off-by: Alex Bee Reviewed-by: Maxime Ripard --- changes in v2: - no changes drivers/gpu/drm/rockchip/inno_hdmi.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 14473ca96e0f..d477d2872195 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -667,13 +667,6 @@ inno_hdmi_connector_mode_valid(struct drm_connector *connector, return inno_hdmi_display_mode_valid(hdmi, mode); } -static int -inno_hdmi_probe_single_connector_modes(struct drm_connector *connector, - uint32_t maxX, uint32_t maxY) -{ - return drm_helper_probe_single_connector_modes(connector, 1920, 1080); -} - static void inno_hdmi_connector_destroy(struct drm_connector *connector) { drm_connector_unregister(connector); @@ -701,7 +694,7 @@ inno_hdmi_connector_duplicate_state(struct drm_connector *connector) } static const struct drm_connector_funcs inno_hdmi_connector_funcs = { - .fill_modes = inno_hdmi_probe_single_connector_modes, + .fill_modes = drm_helper_probe_single_connector_modes, .detect = inno_hdmi_connector_detect, .destroy = inno_hdmi_connector_destroy, .reset = drm_atomic_helper_connector_reset, From patchwork Sat Dec 16 16:26:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755212 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 98D493FB28; Sat, 16 Dec 2023 16:27:25 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UmHbQRHi" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-50dfac6c0beso2049402e87.2; Sat, 16 Dec 2023 08:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744044; x=1703348844; 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=Hsk09sD/JLCR2XzE8w6SDzRrfieu6a8GLQCzTQyHXNU=; b=UmHbQRHiBqsmz6rv68has3iNL+fLsZ9Dg2eq3izLeazy7g86CbGog6ROe4hYN/RJXE 9XIeSQznefCbjJ4POnU2yGG/abb0oC469on+51pnuFfK9gYrjyRU5dj4WeVqat2GUsD8 PrJcBaNAJlTtwUa/FIuFq/tja1FYrBQpctOWBzynnU/ezoVKUzDAgtS9efWs/BGvTSYQ 8yzx7Xsxhc3bcF0sTNQk1desbZT0AwUI82E6zKHH5s/mgmfbOFOA1oqgr3dIRcKCjozc rdhqUpgM2Ja2/Z6bHJeIe+IGy6LmA6EiRPq4eL9yZtVPVSZh5QQWO7qyYTyKeRI89SXy eASQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744044; x=1703348844; 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=Hsk09sD/JLCR2XzE8w6SDzRrfieu6a8GLQCzTQyHXNU=; b=ND1xKsgCZNJxa6wH6SVqVJ6pKbQduDyJbHO1RscSHhR3t4WSgfjIijI+lrQokhfyfe O+V4+KcJWy1z7WwssLV7wnJnpkvoQ/ocTb6v8loJszsZ5NMJ+93J/CVu0dNbvBWlTlcu EUbDcgWCctorcIoVrsrMIAm6tYwZ7KYjbTQGloS/LpHgWt81K6m1KPexyi97DCgkmOWE jT+iVHO1/so5+ybWfaVWJ3zP42Es5Wmml0s6i0Pl/+b95qBaXu/3zHdQ9wyO+vHIJ7u6 2yMAOxvCqdSB31+doqZVNuwMpczL+CTRN8D7FzAtxz86Rfug180RChcI02fdT3E5aDvR +DZw== X-Gm-Message-State: AOJu0YzZybyaInWfRpaF6+KQIOBW33pdyU69v78uF97LygzOT/Ea24l6 jji66KDW9Ckti1zOHUhSNg== X-Google-Smtp-Source: AGHT+IFQnfl2cq6EqsmtxXsPX3+nF6bpvttzxEQVr2y36+9o0INXQQPP8fOuEmzzU29lPjunAhL3Kg== X-Received: by 2002:a05:6512:3b0d:b0:50e:d07:597c with SMTP id f13-20020a0565123b0d00b0050e0d07597cmr5112150lfv.66.1702744043722; Sat, 16 Dec 2023 08:27:23 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:23 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 25/27] ARM: dts: rockchip: Add display subsystem for RK3128 Date: Sat, 16 Dec 2023 17:26:36 +0100 Message-ID: <20231216162639.125215-26-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add vop and display-subsystem nodes to RK3128's device tree. Signed-off-by: Alex Bee --- changes in v2: - no changes arch/arm/boot/dts/rockchip/rk3128.dtsi | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/boot/dts/rockchip/rk3128.dtsi b/arch/arm/boot/dts/rockchip/rk3128.dtsi index e2264c40b924..1a3bc8b2bc6e 100644 --- a/arch/arm/boot/dts/rockchip/rk3128.dtsi +++ b/arch/arm/boot/dts/rockchip/rk3128.dtsi @@ -115,6 +115,12 @@ opp-1200000000 { }; }; + display_subsystem: display-subsystem { + compatible = "rockchip,display-subsystem"; + ports = <&vop_out>; + status = "disabled"; + }; + gpu_opp_table: opp-table-1 { compatible = "operating-points-v2"; @@ -246,6 +252,27 @@ power-domain@RK3128_PD_GPU { }; }; + vop: vop@1010e000 { + compatible = "rockchip,rk3126-vop"; + reg = <0x1010e000 0x300>; + interrupts = ; + clocks = <&cru ACLK_LCDC0>, <&cru DCLK_VOP>, + <&cru HCLK_LCDC0>; + clock-names = "aclk_vop", "dclk_vop", + "hclk_vop"; + resets = <&cru SRST_VOP_A>, <&cru SRST_VOP_H>, + <&cru SRST_VOP_D>; + reset-names = "axi", "ahb", + "dclk"; + power-domains = <&power RK3128_PD_VIO>; + status = "disabled"; + + vop_out: port { + #address-cells = <1>; + #size-cells = <0>; + }; + }; + qos_gpu: qos@1012d000 { compatible = "rockchip,rk3128-qos", "syscon"; reg = <0x1012d000 0x20>; From patchwork Sat Dec 16 16:26:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 754955 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 287D3405C9; Sat, 16 Dec 2023 16:27:25 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X4vwsXgm" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-54f4f7e88feso2226137a12.3; Sat, 16 Dec 2023 08:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744044; x=1703348844; 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=gBYs3PhPVI6eUxnSZWKmlMF4qjz6lpemR7OHeO6knFA=; b=X4vwsXgmJtdXN2FoJGkbpqnZwDCti0O6EOx0bwYTIR/bUATGMAXRdJvtmRSSquE8Cg PzjcQznfsaUL+OYvcAquvgd4wqAbvIxzAnsqttJxZhftXmBClB5jA4slHlC7qPeNLRGN 8iJNu7oDS5yjyQ4xNMNjRrAOYmxgUhXFvwQ+SmVNesz+a9Sap3axX1E5O7ibtJeQFtiN XE5EkPX0ROGsI/QlTK7eXmLNZCY4oFSRUWUr0H+5SLaw16uMpbVmEgf+4aErHGvoM7yS XIsy6jSBT5V9XpEPaZoN7EF/8kgbNvP27/i2b0F0PgRWDIyUaOkZ3+RMdSRow6PeB1TB Drow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744044; x=1703348844; 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=gBYs3PhPVI6eUxnSZWKmlMF4qjz6lpemR7OHeO6knFA=; b=Sq6g29FfBYJ2M/QmDSZoXCQGGmzklRkSqNf7iaF3GJeVrqUDEPo1AHncxFBZoXXmGW cktyNeqfHMQcemYMhk6YHmQDGtPhnXpSkEgTKgWbdwa4x96o3BT7DFzeslqHAXecDszK iPUdifIAJMU4hbxL6HP+WtY/ppnKQNJSFH5r9eaOt+Tpn0k1RWfg7asjsj/FgKWske7z pFH0wkgfQMFZwMyfDlYFVUQmjBZM20sXM7r40Tc7Xj64V6ua4zPNaZgYIKB59q5w1Cbq SS0ASBNLwjkAinGmS5wtwMEfV3TbguNFi9/YeYt2iiTkUilPwQ0WLu7kkBW8z3SqGzzD Hztw== X-Gm-Message-State: AOJu0YxqZmKAevokw+mUo65tqe/ouvAnHxWIQhzJdO/rsnKtJn/66bYF S5KKK7M1WTV9O45NGbuYLw== X-Google-Smtp-Source: AGHT+IFL//jIxTYByWAR+rnaaAeoTcePi2y7wDdwHT2lbXxpOe8v9YhxlqSjIVwsz6sRq5BVkqL4xw== X-Received: by 2002:a17:906:3199:b0:a23:2e05:8465 with SMTP id 25-20020a170906319900b00a232e058465mr339276ejy.6.1702744044454; Sat, 16 Dec 2023 08:27:24 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:24 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 26/27] ARM: dts: rockchip: Add HDMI node for RK3128 Date: Sat, 16 Dec 2023 17:26:37 +0100 Message-ID: <20231216162639.125215-27-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 RK3128 has Innosilicon based HDMI TX controller similar to the one found in RK3036. Add it and the respective port nodes to the SoC device tree. Signed-off-by: Alex Bee --- changes in v2: - no changes arch/arm/boot/dts/rockchip/rk3128.dtsi | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/arm/boot/dts/rockchip/rk3128.dtsi b/arch/arm/boot/dts/rockchip/rk3128.dtsi index 1a3bc8b2bc6e..fb98873fd94e 100644 --- a/arch/arm/boot/dts/rockchip/rk3128.dtsi +++ b/arch/arm/boot/dts/rockchip/rk3128.dtsi @@ -270,6 +270,11 @@ vop: vop@1010e000 { vop_out: port { #address-cells = <1>; #size-cells = <0>; + + vop_out_hdmi: endpoint@0 { + reg = <0>; + remote-endpoint = <&hdmi_in_vop>; + }; }; }; @@ -463,6 +468,34 @@ usb2phy_otg: otg-port { }; }; + hdmi: hdmi@20034000 { + compatible = "rockchip,rk3128-inno-hdmi"; + reg = <0x20034000 0x4000>; + interrupts = ; + clocks = <&cru PCLK_HDMI>, <&cru DCLK_VOP>; + clock-names = "pclk", "ref"; + pinctrl-names = "default"; + pinctrl-0 = <&hdmii2c_xfer &hdmi_hpd &hdmi_cec>; + power-domains = <&power RK3128_PD_VIO>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + hdmi_in: port@0 { + reg = <0>; + hdmi_in_vop: endpoint { + remote-endpoint = <&vop_out_hdmi>; + }; + }; + + hdmi_out: port@1 { + reg = <1>; + }; + }; + }; + timer0: timer@20044000 { compatible = "rockchip,rk3128-timer", "rockchip,rk3288-timer"; reg = <0x20044000 0x20>; From patchwork Sat Dec 16 16:26:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 755211 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 D84C539ADF; Sat, 16 Dec 2023 16:27:26 +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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ob16htJb" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40c824b199fso5376535e9.1; Sat, 16 Dec 2023 08:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702744045; x=1703348845; 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=S3iOjCbwZExjH9kB2lsGfCX5u0yghPXFIA3BH7zrUI8=; b=Ob16htJbCr6zZfzQ0CQbBguVoUb6B6dcKsLpJGMRIg647BLuWhFzv11zII2A7aqgJ3 NJz3aJzyCI1ayN8+zzl1QzxoJI3LxNpVeCiYUmaV2EltIaEZ9yjdU3K5h48rf+mQ34+Y OboqVgo5q05DIOSCaR0VT6JSQnM7eFRpW8SZFpQCe8IOXPIpJJKiRu2Lnu3sLTsqkvry +bgbhHBT4gMS9vW0bt/9B/6QBXrE4TIkSXCdCPJpzoI3V2neoz+q3/Y5IBkB8JCGQQRq WP9iLyjo1o/p7wD8SfNE5itA1gxeXuE8keao8fNMu79Ttm3UPO4PkgBh6QD+c9Sv8kEP emLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702744045; x=1703348845; 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=S3iOjCbwZExjH9kB2lsGfCX5u0yghPXFIA3BH7zrUI8=; b=LYiOCEW8Ja20X0jTBv9Z7AgIyzAbPlMkw17CFwVYer7ZvbDD7EH/XN07ybqx0bNWjj 3XpJiifUlasPslD/gz2F2LDqyPvdOcml2YlxVUb3KpTqNRxzXq9sZb2zSZJgX5AVJTDQ 6G5EFCbS4QBPDWjgUScpyBxFQqv0oSp1FU+adYr/qXvOF+c9EdzySkAufzEcc+FBegt9 P1Nf622/uoMCQiUBU+bSO2bw4Ow5nknJpc8MfLJfq+JBztdmdUOwB6yyGxwWR7Ald2rc mx4fLDg7KcvMonxTR3b7nUbiKnxt2zb8C7yG0Ku6rvIPaoda6101jb3MmZhBGFtYnqzi LIzQ== X-Gm-Message-State: AOJu0Yx4ZOkqUyCriTQXEyZrmKz5ERiJ9CLjV/2wk/v9SVozncUpScdm r8HuVwXRBzHm+eIjfi2bGw== X-Google-Smtp-Source: AGHT+IEiefvMCshqhAareV6PB6nvkF+yNy6rY3P4T12kiqX015mu1E2d8HLFar6wnBfSX8rNq1mToA== X-Received: by 2002:a05:600c:4ca7:b0:40c:2871:9729 with SMTP id g39-20020a05600c4ca700b0040c28719729mr7088382wmp.188.1702744045068; Sat, 16 Dec 2023 08:27:25 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:e807:d345:6f47:1db9]) by smtp.gmail.com with ESMTPSA id st10-20020a170907c08a00b00a1cd0794696sm11990362ejc.53.2023.12.16.08.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:27:24 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v2 27/27] ARM: dts: rockchip: Enable HDMI output for XPI-3128 Date: Sat, 16 Dec 2023 17:26:38 +0100 Message-ID: <20231216162639.125215-28-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216162639.125215-1-knaerzche@gmail.com> References: <20231216162639.125215-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add an hdmi-connector node and enable the hdmi, display-subsystem and vop nodes. Signed-off-by: Alex Bee --- changes in v2: - no changes .../arm/boot/dts/rockchip/rk3128-xpi-3128.dts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm/boot/dts/rockchip/rk3128-xpi-3128.dts b/arch/arm/boot/dts/rockchip/rk3128-xpi-3128.dts index 03a97881519a..21c1678f4e91 100644 --- a/arch/arm/boot/dts/rockchip/rk3128-xpi-3128.dts +++ b/arch/arm/boot/dts/rockchip/rk3128-xpi-3128.dts @@ -47,6 +47,17 @@ dc_5v: dc-5v-regulator { regulator-boot-on; }; + hdmi-connnector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi_connector_out>; + }; + }; + }; + /* * This is a vbus-supply, which also supplies the GL852G usb hub, * thus has to be always-on @@ -239,6 +250,10 @@ &cpu0 { cpu-supply = <&vdd_arm>; }; +&display_subsystem { + status = "okay"; +}; + &emmc { bus-width = <8>; vmmc-supply = <&vcc_io>; @@ -328,6 +343,16 @@ &gpu { status = "okay"; }; +&hdmi { + status = "okay"; +}; + +&hdmi_out { + hdmi_connector_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; +}; + &mdio { phy0: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; @@ -423,3 +448,7 @@ &usb2phy_host { &usb2phy_otg { status = "okay"; }; + +&vop { + status = "okay"; +};