From patchwork Wed Dec 13 19:51: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: 13491825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BA51C4332F for ; Wed, 13 Dec 2023 19:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=apauUJ5y+wmCCjplmXQ2oO8ThR1HPfpKN7Fh+GpMxNQ=; b=t9F+2Wq8lMNzjF BFltbwxTGw/q5GEU/DG3ZSrVWnwZPfcByYEHz6156WW5LCobh6jEHvIjXSuwos9CL8ftFPObUZ61T zWVg6WEH3BpOcSfrzxibKYkrhD3FK0k/E45AEzhiOTwqWNIKrpfbzSjIa88QWU/U1j4jLwQxaqzcX fzxXf9DEbEK6D9SxQDpbGXbhwRjftqHX15aPS/JTopdUfFHmY6Rye6FGc9ea9ta6HWoB53s+W7c9k LvMxtjGfjc1ziiWX1JZB+jGmrsmRz3ieaUPNHWvcNFPtqTdtOTWxulBUJf2OO89+eCFhNhxWlmCyk oLu/1U98uIGA61rxBI0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGj-00Fsf6-1I; Wed, 13 Dec 2023 19:51:45 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGV-00FsTI-1N; Wed, 13 Dec 2023 19:51:33 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40c3f68b79aso53860965e9.0; Wed, 13 Dec 2023 11:51:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497087; x=1703101887; darn=lists.infradead.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=ERQju2Bh+K8GCwYjh7yY4rIstgFgSHVz3s7kTSLi67E=; b=jWl0igKWS+fhVChyV6MTuHELgb+Glo9/8vqJZr9WAUrvhuSzTy2Ap8y75XjROTkPlN NmFBlP4cdzynINr8kTy8+F0dRul62yER4rrle4+gPshDBp3Q8LEnY3N0h5Yooxv/0JCL 0tjExnT3G+4a1YtP2zUGlHTZfg5sss5T9v9nh4IRBUWo++sNUQwbde2LqrFwJs6Rzsee wtZqaSNwakTKXNt+wgbHU7lNyIfl83b/YfFKDvoxpqaTOEHdbUvzKlU46Mo+iMdd0W7U 8ZSeFU/f/OlwkI7pPl5Qor5Y9Kr85boyEmCDFVw1jhoZQi1C6yTUC5WyAPmk/x8E6MbI F2UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497087; x=1703101887; 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=ERQju2Bh+K8GCwYjh7yY4rIstgFgSHVz3s7kTSLi67E=; b=qy1c4LCpYpztmKdci9w0Pv2lINBjeramo/ASXR0VSIUTvlHZKWfV4CKXacm7kwOr+G QfBWrX/mfAlHMUHw0gKfmi72cUioIlkonGj2qHUzAQViTF6JR4V6w6j/UcPEjQbD6PA1 ECCCmnoQiji4SegesOdHDTx/cdZXGIo9O/Fm3koSTEqj4xrjHovcPMgCcRjQ43JfAHe0 aXvS9Wd5iOJKmcQIREYk5d1QWGYW+DSdpSkWnY1KMHyqc4KuW8V96c5dmGKwzCPy7fJd juye2YyG0KLa1OpWEbqqRtIVJ1nRsCnyGt4BM6H47V1Mq6Kx34GHkttcp98CzkOgRkDt G9EA== X-Gm-Message-State: AOJu0Yw3A7gaElr3unMtkshWRiGGz8W33Lx2pM1aKfy2ymWg0lr+xSeA SA0XvPXFS+t63c+DpYnVYg== X-Google-Smtp-Source: AGHT+IFubGXtBYJHwawt+OjhdiJA2OK0SDjjVKO0Bx22olt+rzUfmcB1mZ2doozRlrhYe+3xiI98xg== X-Received: by 2002:a05:600c:54f1:b0:40b:5e21:dd2a with SMTP id jb17-20020a05600c54f100b0040b5e21dd2amr4691135wmb.88.1702497087589; Wed, 13 Dec 2023 11:51:27 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:27 -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 01/11] dt-bindings: display: rockchip,inno-hdmi: Document RK3128 compatible Date: Wed, 13 Dec 2023 20:51:15 +0100 Message-ID: <20231213195125.212923-2-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115131_461843_D8050563 X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Document the compatible for RK3128's HDMI controller block. The integration for this SoC is somewhat different here: It needs the PHY's reference clock rate to calculate the ddc bus frequency correctly. This clock is part of a power-domain (PD_VIO), so this gets added as an optional property too. Signed-off-by: Alex Bee --- .../display/rockchip/rockchip,inno-hdmi.yaml | 30 +++++++++++++++++-- 1 file changed, 28 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..9f00abcbfb38 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,21 @@ 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 + - enum: + - pclk + - ref + + power-domains: + maxItems: 1 ports: $ref: /schemas/graph.yaml#/properties/ports @@ -55,6 +67,20 @@ required: - pinctrl-names - ports +allOf: + - if: + properties: + compatible: + contains: + const: rockchip,rk3128-inno-hdmi + + then: + properties: + clocks: + minItems: 2 + clock-names: + minItems: 2 + additionalProperties: false examples: From patchwork Wed Dec 13 19:51: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: 13491822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D9CDC3DA7A for ; Wed, 13 Dec 2023 19:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WBwIBL2LfjbjQDFnhS2KochB6idYYC9cYJsG5WRAZXQ=; b=B8LzoF0il1pWDs s8L0Jx8TA+ZqoEpoZC/QM1tUORcY91YGJUwMpmn3i3NQ12EW9JZPp16OEte9oFzKtojg12O/F2qxg zFEQEU9Ha6F+cpdRb5/DCa1RvzmEI+2jzDC4h4HZcycNFObSR49CyxJMWOecGr8T2oE/BQzrnSUbN H1uoUEh0d3eGVeZgNiE7jUdi104gQFXkTefwRiLJZFARpL85MNsI7AE8JZnC8hY55wPZTtS6aPphF NL58MExcHbBXhrDdHJw4Dk0RUVMBa762PZDlC2a8cAyVQgJFbd8KtUEveiOcuqIL4Mv0ny6lueoTX //tEhWu1DT9rZQXgJ94Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGX-00FsVg-1B; Wed, 13 Dec 2023 19:51:33 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGU-00FsTM-1F; Wed, 13 Dec 2023 19:51:31 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40c38de1ee4so51156685e9.0; Wed, 13 Dec 2023 11:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497088; x=1703101888; darn=lists.infradead.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=FrtW0qmKYRNQLQV31syGJ5EsohgiI927CfneGFLgIjg=; b=de+p8NiMoiIxZwP7XO48uni5Fk3GyAQKpvvilrM+RA1UOpl4MfKCe/tK0LdNrvPOH7 xGx0dTyiEFVRD3GPtjrHBKdpzSoz2s5IXyjixTVo9wjpK+ex74WY66/hxLmjm4PRkuWG j7jeWOV3u/0XWTS4Y+ugQNDoFhQNPKVKsnapHlgh8Erg99g7ahVgD8oHZovm68KFN0kM NOxWGUCHSLQJqNX2ItYXogKIp/YNEqKg731xL0TK5JJmbcwNdHEfdzG6WsDwnYUXAeeA /kfaPSdQ38PU83nd+Q82HdywGWGYZYoWMZXX7CMVU+833gtcSnDT53yhE2PgX2pQqG/5 EvKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497088; x=1703101888; 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=FrtW0qmKYRNQLQV31syGJ5EsohgiI927CfneGFLgIjg=; b=oJW/xs9RhpEkIq8DBmKMsKD0L4ICClUW1/00AMCZvJxL1qMsU/ClaBc0KkTEJxjFf+ RIAHjsp5yBiIKXq6sswU8JZ+jSkv+7hBrwVGyTXiOich5NeLJz4//SyBqGWCZ0JN/fsk 1RUgVcdQTpYK+F8es1LuGk5+wePIz8zjZbYU/MB7GrmR7kF3cDaKvGbLqzsbnaOBtMMX x46JnYUD+r8D5/LkTBI3VwqYeFEVmUKs2yhlze4HEefRyolATNStq7u5EelIvCyCAZq1 Y4dx3g4x1Jf9Z+5CCUuP5YSxcwbQvBOYAMvHXr+1TngYh/cbMpcRUO3U6202Tv56Uw3+ mrlg== X-Gm-Message-State: AOJu0YwBAqxH+DCHBAEtOkmlykBRExt34wibhzCHOutor14n9ek24PlA 4BcW1nFpxjrRxrZ4hK7S+g== X-Google-Smtp-Source: AGHT+IHR1mhbvtfmEHVnytGHmx53+I43r/Hf1Na5JA56piJCh0CXRoRhmTkjC+PLrRTxjaxT4a38fQ== X-Received: by 2002:a05:600c:3b29:b0:40c:3290:7b80 with SMTP id m41-20020a05600c3b2900b0040c32907b80mr4610268wms.138.1702497088224; Wed, 13 Dec 2023 11:51:28 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:27 -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 02/11] drm/rockchip: vop: Add output selection registers for RK312x Date: Wed, 13 Dec 2023 20:51:16 +0100 Message-ID: <20231213195125.212923-3-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115130_424158_B5404309 X-CRM114-Status: GOOD ( 12.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 adds a new vop_output struct for rk3126_vop with the registers required to enable the appropriate output and setup the correct polarity. Signed-off-by: Alex Bee --- 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 Wed Dec 13 19:51: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: 13491827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCE04C4167D for ; Wed, 13 Dec 2023 19:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a1eWoqFAP7xQUaNuOp96zBvAXPSk49UP0PbxwAyBLsI=; b=yFtrlgfHQp+uOu lNaTNrfu3+4LmYKmdLyYBB31JrzGdGBU2WTnjxyUezu0mwUCTEZogeftwCht5Qhxcqg6U4ErcjtbN rZoW2lgArawxsnYJn9oxw7bQa1T5Zh+EyFO5vhAfDh6mETHvHKdmOWRthnnj8fsENzyc8KqjlWuiw eD+3KDtQkenYK8TMZ7pV9D42tLZ64WmpwGbYahr4JMNSIWhQS0wZuzQxYytdB0bytHLmnPxIzHEWK +D9PLeTWLEfLbodd03A2oP9qz2EEYxF4bMrHAyxoreh+/bdP8gKvwRZ3hXSCNvlIjCyfJxiOGMGyj QMq31H9xZWXSj8/DkC2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGk-00Fsg9-1i; Wed, 13 Dec 2023 19:51:46 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGW-00FsTN-0R; Wed, 13 Dec 2023 19:51:33 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40b5155e154so84053595e9.3; Wed, 13 Dec 2023 11:51:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497089; x=1703101889; darn=lists.infradead.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=5MfDHxrabIf+gmAYTXlhPOQXkHPRDrfLTxd0p36e6Hg=; b=Qgi5A/XSkTohlwRlKRtggpQZjVQiB4TMHLm3/5DeXTFVAUFvOGTi+LIdrzVZIsHzT0 Man6k+obkExeBOw81oeVfH8IuCTYiRHbOgQFgpnsCf6C2txKBtr38S4nnfjblJD9R/qH gg8jBcJ3+dR/IrF/ojXQv4kGCnDSWXFi4HqgxYQ80aYijS69mCACHUiY9a4VTN43jyCY FHyEBwGoJ/HQCHPtmT811bfN5BHCTUNRabRiqs63W9MZqMXHkzlXy6ryVFBRypSGG1Vv 2ECYLqCqyL3M9fOuHDlxJmf2I15N9YOybIjwwSDvMdLFtwKG/cEw5M7DPsq7BqKpCdDb lQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497089; x=1703101889; 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=5MfDHxrabIf+gmAYTXlhPOQXkHPRDrfLTxd0p36e6Hg=; b=PmBGQz+PrV+UrXy/5/QGS6sGlrWHJczklqubIxYttzY+lIs8BWpkZECoev/PIQXT/x oYzdT05S6/QLigfEDiDGyUOlj06ACpsTtNv94Pn+VBcUfM4vGk/P3PVvJrnnMIoFuWiG 3ZjReqBpZ9p0MuTkjgLns+NyvEih/SLOlbnO3pxpEzY1MGHRu4zbNF8/hWT57rA8rrDT cY/U595o00HO0vyHGwCkSUz+xveAe5949g8GYbum+vRT5LylVmGE9Ch0mFJTO4vGetOL UmiTGio9SnsxLk2wMBBJGpu2JUsATk9bILVgD3UzA0PAjE7YpJoiUICCoFHpnRKTsBBN enIw== X-Gm-Message-State: AOJu0YyNExZpKg5LMWAHzAJQmv6NS0ZGWgzYYiwsKgXon/slhsQ8oCO6 wUsvudARRiNDUtJTVpZe8Q== X-Google-Smtp-Source: AGHT+IGCytkAX3KBkCK2F8am/Dv9NsvC2yoOVaxaCHwDt9Jkj58Vtpb8hmL72hqJrd7flNDEA8saag== X-Received: by 2002:a7b:c4d0:0:b0:40c:3272:1fea with SMTP id g16-20020a7bc4d0000000b0040c32721feamr4145598wmk.87.1702497088887; Wed, 13 Dec 2023 11:51:28 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:28 -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 03/11] drm/rockchip: inno_hdmi: Fix video timing Date: Wed, 13 Dec 2023 20:51:17 +0100 Message-ID: <20231213195125.212923-4-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115132_201051_A6364A23 X-CRM114-Status: GOOD ( 12.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 Wed Dec 13 19:51: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: 13491826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A79CC4167B for ; Wed, 13 Dec 2023 19:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TH4i79Fvz1xx7Qt+8IYREV0t69UhQlS/pvVTZA/m7MU=; b=ATyPg/4EjpOs54 lBUnxvsbwIW8I3JNIt8bbqlDWyQ7dgNpgifMsRElcC1KjVcl3hB8qfTrOZDwBNoThPbdmql2mR3rH 502Fd4ixOaMJNOVX4yC0GsM9OV+euSm+Ili9IBvHpTeAqwHOHcEea2K2VfwziuoUi/fnl2l5OsCWH FjzhvtYJj8dQw+/1BDVD7Q8k3s5g2i1EYLdhFhS09SdLMw43nr5KaydJXDm6ZtxoCH1UXrRNHqDLc kDe7GrBZ981rw1bSZ1TKOqlv7V3Y6fmBB7kOC7ZONyBIBTnYieGnpVDpI95fZSXdIhYlEPcn4uTan iK9JD/Pt4nyrRgNTBH8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGi-00Fsdk-0x; Wed, 13 Dec 2023 19:51:44 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGV-00FsTS-04; Wed, 13 Dec 2023 19:51:33 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c2c5a8150so67221045e9.2; Wed, 13 Dec 2023 11:51:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497089; x=1703101889; darn=lists.infradead.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=sSS4lcTIGbMXkzXHnajhTMjU7KSYMMCUlsf0C4cS0VI=; b=DGqwY2tWyDjbk6harANtA426jRehiqjrg2nwkFd139hXcz0+GmCp87WCig39LdZKXF n+bf/Ggs+h4QH38JP6dCYDvm+vfS0gEOm/DyZm1dh6Pn7gWBy1HqJ5BQrNeH70QNj4AV gFhFU+eeAFpqzghXsX33g3xCGUejXlGElXDsXiN5zqxoLro4ORZE1FUpgxGMq530R0Q0 j2apIURst43FBNeCGbgamlMurtDh3K6Ae+mwao98O1/dBV3wQhRqwYfNCXVdl+YZ1q4M SXavrv4sjkgWA14IQecitsKAKe1AJk4CL3KWYsY6NSCGufCQbQdZlDTb+0xOrtfhGWZB suGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497089; x=1703101889; 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=sSS4lcTIGbMXkzXHnajhTMjU7KSYMMCUlsf0C4cS0VI=; b=vsRyUDVepU1x+DPTTSb7DE98UvrylysJ9gpmqCmC2+aG29aszhuMk0vCzaaU4oNbLK r3fOd63nNgN1+9+eWX+yxRTtoeKPYZTnMO9FoA9vduV/UJCHpc2+ojisD+jaltBzWIen zbjgdVKJ8nTMV96d6MWGefcVLLmbNfRpTwoRvtW7A/WWrDPWgXNaFo5EglLWNpS4/lYm oFWQoJLpqG8P9w3tW7JRCo3D/0aiHz/X47ex9XrNGclUKZSzqu7WlTby6MJ9HOO5q0LJ knqfn6UHDQwjBG359F8wADK75o3Ah6vhhgZw1togcDLDdvkhfwlF2pMj9nOhN+9V9m8T dIPQ== X-Gm-Message-State: AOJu0YwSfLNhbBjJ5XIYeSUnMFhNL51OW8JBME3tydY5eStvYnCslNh4 /b0zglb17mzghNZrcV/HFw== X-Google-Smtp-Source: AGHT+IEL8LZfudHWsCE9Gg/1An8TCTsUvrAJyoygGbQu539fT0PvYfdS0tzUat19DdSrjW62zZZjHw== X-Received: by 2002:a05:600c:3657:b0:40c:2d85:3a13 with SMTP id y23-20020a05600c365700b0040c2d853a13mr4530961wmq.185.1702497089612; Wed, 13 Dec 2023 11:51:29 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:29 -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 04/11] drm/rockchip: inno_hdmi: Correctly setup HDMI quantization range Date: Wed, 13 Dec 2023 20:51:18 +0100 Message-ID: <20231213195125.212923-5-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115131_057130_A4FD118D X-CRM114-Status: GOOD ( 14.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") Signed-off-by: Alex Bee --- drivers/gpu/drm/rockchip/inno_hdmi.c | 40 ++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 345253e033c5..32626a75723c 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -33,6 +33,7 @@ struct hdmi_data_info { unsigned int enc_in_format; unsigned int enc_out_format; unsigned int colorimetry; + bool rgb_limited_range; }; struct inno_hdmi_i2c { @@ -308,6 +309,18 @@ static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi, else frame.avi.colorspace = HDMI_COLORSPACE_RGB; + if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_RGB) { + drm_hdmi_avi_infoframe_quant_range(&frame.avi, + &hdmi->connector, mode, + hdmi->hdmi_data.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, rc, &frame, INFOFRAME_AVI, 0, 0, 0); } @@ -334,14 +347,22 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi) 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_in_format == HDMI_COLORSPACE_RGB && + data->enc_out_format == HDMI_COLORSPACE_RGB && + hdmi->hdmi_data.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; + } } } @@ -458,6 +479,9 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, else hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; + hdmi->hdmi_data.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 Wed Dec 13 19:51: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: 13491829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E4F1C4332F for ; Wed, 13 Dec 2023 19:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SkRaf/HLMeKAL5JV+JGd581m1Q+pdHKGE5IxEohBuh4=; b=zQUrkMl5L6JNA9 T8Rm0VCmEL9KkFhUn39Nj95ITdzJ64SzV4SksbXlzgPi3LI6bIC3hrxzXtcCRGpWfpXvNQRY5mecJ M1dkIO0jk1SUJC/yhNvcJx6BPILujess1o0BWB/TvNfwUIbWaLAWzkunQ08xWUHwCJoMYDAJLwzr9 2DuTWP4DSXsc8kha2pzwq/JD2VkhqHZlRnQwcsNcy8NMef10glOcEfAnDEJmX/zYF564bKaQVu4Yn cGSvIlHQ1yp9vI2BBjp5+0biy1irjN/rGmSK2ZXGufPODfwaRMTpfqH+Shs9OEgxfd7d4V32JKR7i LQj4FRqEkGUBBjgdD8QQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGm-00Fsiq-30; Wed, 13 Dec 2023 19:51:48 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGX-00FsTi-0r; Wed, 13 Dec 2023 19:51:35 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c32df9174so65259845e9.3; Wed, 13 Dec 2023 11:51:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497090; x=1703101890; darn=lists.infradead.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=SouF/Ke6EpeUvfoqZ3rKNuHloSyd05Y/ZVCgaagWqrY=; b=nKA5uGVh7RmReypKflse8PQu+kOx+bf7z6siU+UuOZyNKlqQpKZ0SGn6dvAgkakMwj jKy/Das1tHyW7LV2VbKvw53SYNrPuvudtANck3It4zEaTQxJS0QxF57civPGP1/zCFaF tjEat6WDz7t6v9fHd/XeiXZE4f4CLqvHTpAATC5YTTw+r+CR414UiZNuBeDKaYz2xe2a ipicFFR42JaP3hGLg4DYHiT6rQT2hUrVgDZpaHWuS8jirp6EaRhZB2z/RByt2ZOfEwxu lqLjQDz+Rrz9IqIGBBRJg5dX2Er96IMzqZUc7iSGsEv3tG/NsX0SIOOl8RLKdxSrdum8 Kk3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497090; x=1703101890; 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=SouF/Ke6EpeUvfoqZ3rKNuHloSyd05Y/ZVCgaagWqrY=; b=ikBFxsl/VViaXy+GYu0CVTX2OI0M+s4Yp4+oJdSMqW4QQ62ah3jmaO3S1hy6ZDoBDo ThSsRTTTfMCk1pHjzG0mLQmhTyymmSzFb9ifOUcOV7wkc2GikTZ9NNb3ZhpzOCTJ8Aza dgpXBIKGhVuR7yA4sbLNbCDdFQgtdSvtUsrbvo4pD2GJ3cZVz3hUV8/ih3PmmJQw80t9 Cv4xVEC7N1z15jItomD6TSFpA1SNB7kBDfxbKT2n7gD+juc2nNQcqqrsUTSw3OvhxSeO 86ITSXzRfEEHw7/k6TguH2hPuVvDzhv+kAMSFmlOs+Vf95xBR9TxGsgacPrNd/ixZNLH HFbg== X-Gm-Message-State: AOJu0YwaN994UUxr44C6lyzHhYZcMXtZOwFsgykv41o6eVMDH6Hrfx2k Aku9hNsLj1EOFB9F7VvfRw== X-Google-Smtp-Source: AGHT+IF3dmjdH+sKpem8q1BZFR4nFS4vYZs3puOpJfKUnCvQRp2cuFM4A3r5prEoc+CN23yNfvJiAQ== X-Received: by 2002:a05:600c:20e:b0:40c:22de:79 with SMTP id 14-20020a05600c020e00b0040c22de0079mr3015293wmi.226.1702497090248; Wed, 13 Dec 2023 11:51:30 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:30 -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 05/11] drm/rockchip: inno_hdmi: Add variant support Date: Wed, 13 Dec 2023 20:51:19 +0100 Message-ID: <20231213195125.212923-6-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115133_334574_477B605A X-CRM114-Status: GOOD ( 21.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- drivers/gpu/drm/rockchip/inno_hdmi.c | 68 +++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 32626a75723c..593b184bd0ad 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -27,6 +27,17 @@ #include "inno_hdmi.h" +struct inno_hdmi_phy_config { + unsigned int 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 hdmi_data_info { int vic; bool sink_has_audio; @@ -64,6 +75,14 @@ struct inno_hdmi { struct hdmi_data_info hdmi_data; struct drm_display_mode previous_mode; + + const struct inno_hdmi_variant *variant; +}; + +static struct inno_hdmi_phy_config rk3036_hdmi_phy_configs[] = { + { 74250000, 0x3f, 0xbb }, + { 165000000, 0x6f, 0xbb }, + { ~0UL, 0x00, 0x00 } }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -176,6 +195,24 @@ static inline void hdmi_modb(struct inno_hdmi *hdmi, u16 offset, hdmi_writeb(hdmi, offset, temp); } +static int inno_hdmi_find_phy_config(struct inno_hdmi *hdmi, + unsigned int 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 %u\n", + pixelclk); + + return -EINVAL; +} + static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi) { int ddc_bus_freq; @@ -200,12 +237,25 @@ 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) { + int ret; + struct inno_hdmi_phy_config *phy_config; + switch (mode) { case NORMAL: inno_hdmi_sys_power(hdmi, false); - hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x6f); - hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0xbb); + ret = inno_hdmi_find_phy_config(hdmi, 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 %u", + hdmi->tmds_rate); + } else { + phy_config = &hdmi->variant->phy_configs[ret]; + } + + 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); @@ -845,6 +895,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; @@ -853,6 +905,12 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, return -ENOMEM; hdmi->dev = dev; + + variant = of_device_get_match_data(hdmi->dev); + if (!variant) + return -EINVAL; + + hdmi->variant = variant; hdmi->drm_dev = drm; hdmi->regs = devm_platform_ioremap_resource(pdev, 0); @@ -949,8 +1007,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 Wed Dec 13 19:51: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: 13491824 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69831C4167D for ; Wed, 13 Dec 2023 19:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WggSi8EWXcf7gA93xZ+RCmHxVa8ruon3+1b/lQFjlto=; b=QAnYKRVmH1D9Wf CPYxLOZAVLeHL7zxr9O46pdq7sleKma2cQ5RywMYSWv3m+uPA6IvaQYCBFvCVY4dKtahK+5yw7z1v /ezdl2Tuoem+E2e5FJKjVxKS/+V4yV9AW/wPxK6F9AzNSbSmkdeLb9ZhSIzcwF5Q9L5W5CkSHixZh tIZHgwscYhqPZYLr9eE/YZMrLOwOEJhgfeb/Q+SjLsA3zU5VJERd/AlF9bWxJEqrdyAXTRyTt3/d6 Ctz16uGoaVV4xEPtjLLyO+iQ0FXQyp0or4c0iZQ0v8WIrjMLXKSvCgaGjo2PGbgGQYQOCrWd8gdsG GHMMzcFjBdULsuH4MlDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGl-00Fsgm-0b; Wed, 13 Dec 2023 19:51:47 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGW-00FsUd-0m; Wed, 13 Dec 2023 19:51:34 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c39e936b4so49405185e9.1; Wed, 13 Dec 2023 11:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497091; x=1703101891; darn=lists.infradead.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=NrdwEALPZcYaKjrlHh8nC5j/rhRtGd0pBvTiQkbpRHQ=; b=OZyTT5Nak6GpZmXvg0rttTRSI3uo5O0ocv4Sa8UHdXTXzY8Z/9xYjk8iQGLtMntGYU l932PKu6gyBaLzRuTp1Ew0LDFQAT+KVEv9SKhZT+5goePiJU3ORVZH9EEaLtkDKm2iTM xA7vEZIG82CLqOM+CMfuv5uUvhmjCCEnKm7ffRyB8UZurqRMgS3i3aOixIEAYqN06ZUK qLcFdFrBiHI9ICcxyYcSKH5KTYhV2ZhrPeDNucvS5UJ2LXztbyuc2bzWiTZIv7LOJFq7 BHULtGemuDACwc5IjL1Wm2uR//OfzU73FNC8ymOp4Y5yEd75W8OV3m2F+E0WI1JEwugu 83iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497091; x=1703101891; 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=NrdwEALPZcYaKjrlHh8nC5j/rhRtGd0pBvTiQkbpRHQ=; b=RA8rvfQQq9FVNqWGpOQyckFsiR2vZK711ybkOZX3nLTqwGkz+JKWvYPyIinAKudkZ8 85yUrDRtEifSWXQtaqCJo2ndyT628nqyQgq1MCS+AMKryqrqGOcJo5GaYwhWJGpVtSxq Lz00fx9Zl43weIM8BiTiBeWPMKs+XVCPFKghpZ2YmAckrK6tDRvYU6Q30Ym9Nv7Q5rpw NJMe07/dA0ymPR/rpOvxFVJ6I5QYLzI4PaN9wB+Why3Tvo2liCSk8lwSL42a+OSQHx8e SPBj4t/b5BPWcnuFhnOVEHW0aAtkykycwd+BzO52gnPDo1NC4xkC7X7lPGUNFwhvGNLV Vf6w== X-Gm-Message-State: AOJu0Yx6wZwoSF4PiBI/gC9OqQjWA/lGxmo72ay9MGcjj3hVKf8MiaLj rZCWL7Hfqjd8UDEGFpWK3Q== X-Google-Smtp-Source: AGHT+IGQU5KA/JqpSqsrp3zI8GWSKHo4cXHdH/serdCAU99kJFKSeVc9Xpk0T5VW4UF/tn/PaiNWlw== X-Received: by 2002:a05:600c:468d:b0:40c:3133:6efe with SMTP id p13-20020a05600c468d00b0040c31336efemr2320662wmo.358.1702497090968; Wed, 13 Dec 2023 11:51:30 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:30 -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 06/11] drm/rockchip: inno_hdmi: Add RK3128 support Date: Wed, 13 Dec 2023 20:51:20 +0100 Message-ID: <20231213195125.212923-7-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115132_279636_619D62BA X-CRM114-Status: GOOD ( 19.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 which is required to make the driver working for this variant as well. Signed-off-by: Alex Bee --- 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 593b184bd0ad..f7f0bec725f9 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -63,6 +63,7 @@ struct inno_hdmi { int irq; struct clk *pclk; + struct clk *refclk; void __iomem *regs; struct drm_connector connector; @@ -85,6 +86,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 struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) { struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder); @@ -930,6 +937,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; @@ -946,12 +967,16 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, } /* - * 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. */ - hdmi->tmds_rate = clk_get_rate(hdmi->pclk); + if (hdmi->refclk) + hdmi->tmds_rate = clk_get_rate(hdmi->refclk); + else + hdmi->tmds_rate = clk_get_rate(hdmi->pclk); inno_hdmi_i2c_init(hdmi); ret = inno_hdmi_register(drm, hdmi); @@ -976,6 +1001,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; } @@ -989,6 +1016,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); } @@ -1012,10 +1040,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 Wed Dec 13 19:51: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: 13491831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 435F5C41535 for ; Wed, 13 Dec 2023 19:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=awIm2ULCt0JCtkAIfpz4d89jUVoaQchdLoXrl+3I/AM=; b=JYMrfISfghiPbc gqJ7QD9pqs6GzosYw3c+ykvcLGlHfGIXDRkQGbbzqJBg7MLDPXeSkB6jL16HkLkMWqtraJI9cHn46 2VGhIIdffqxL0ErbNlG451LVrXbSpVgwGvrsyEFj+1byq1iOrUnQZICPbgYcdU0I5gv8OeH5eq1Ys /5OY4P2W8VVJRcsaFn6fhbXfSgcWL9L8PNvMtkITsirn7MU+CmeHPu0Gbf9MxYySetZr1tppzKg57 a14iS9LBXMuxMboc3hd7KsaOxvWQ3NAZqALsCNb1M+tTZchI1xY2AWrf2f7bgOqKIOVg40wCo1NZx 0rhqEpNWGl4h3/ipgifA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGu-00Fsr6-0M; Wed, 13 Dec 2023 19:51:56 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGa-00FsVa-0q; Wed, 13 Dec 2023 19:51:37 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40c580ba223so17947575e9.3; Wed, 13 Dec 2023 11:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497092; x=1703101892; darn=lists.infradead.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=eBLnvjeKj80rmtJP//IlHjPdLy+lYfLLyByJrZj8/N8=; b=PbaQ/2HZ+rdKiyJni7vXzW0bF8fAYxA/hLnL7+h6pQ01j+D+xhkdBoOrgDTjN/aE24 aJvE9p6ADH9LZ8MAoQrsDdZ4ifAhn0nR0CuqcyqlG1DsWfC8stGN5NRBfs3slo0KdFI6 8DDGU7Kv76oecEmkkLk7K+L4e7dKGj9RUEqjA46BOmlamvluRow5Mh5d/JoarJBceGiF KqOtPu1KRJj76kLO48WXaMmnXIMVPzBiCQHoj1fQacZ5dxwGKM1wNrio9Bf/KhC78Kn+ QRfWRtcy+oNdriXUqn+R58C/KbaT3IrhgIq1OM61ITAUmmvBEm7y6NILH6iCygJmtBkA 5+IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497092; x=1703101892; 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=eBLnvjeKj80rmtJP//IlHjPdLy+lYfLLyByJrZj8/N8=; b=dpk92cGBVjngtw3S35SRE0Mm+2EapWHi+8LlxCrCEJQ/AFQnw+feNHgodD7FCYOjVh 56mN6/fRm+31hZgRT0QVCvuoZmewgd6m/SavDco7YDPk5bmd/bF+c0SJ74JTj4bfFMyD JWKIgE8yBfirR/cDgmrWATdVqE5hZTQ/G9i989onjQ6D/Byoz+SKlyRs+jckiVnX7819 ZhayKNVmxVb6T1XeyoCKO/KZ2g6e/kdCPI9n7UX+GwScFT514yTTfYynw5zSecxOtGbH iqDNgFq1Mz/s1ESHFnSl+ZJFuVdCnKVE+ZEFU3ri6D6s4yyg1z+hlK9nVP+FmPnYPW7l EjPg== X-Gm-Message-State: AOJu0YzmFShPGUnRaO5pdluWWctMkeA1Lv/bX8oxgL4oWW7Bjg0j5t+k jYLrMTdms4pryaCkALlH3w== X-Google-Smtp-Source: AGHT+IF9yTALPZ/WtAhWe1OyfTmJhAh53BvI/LasLM9OYzL66wjl3/q0XJ3XWlvlHYku/I4Y0WR6ZQ== X-Received: by 2002:a05:600c:46c6:b0:40c:2ba6:809 with SMTP id q6-20020a05600c46c600b0040c2ba60809mr4457221wmo.157.1702497091606; Wed, 13 Dec 2023 11:51:31 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:31 -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 07/11] drm/rockchip: inno_hdmi: Add basic mode validation Date: Wed, 13 Dec 2023 20:51:21 +0100 Message-ID: <20231213195125.212923-8-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115136_313583_76006064 X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 there is a phy reference clock we can additionally validate against VESA DMT's recommendations. Those checks are added to the mode_valid hook of the connector and encoder's mode_fixup hook. Signed-off-by: Alex Bee --- drivers/gpu/drm/rockchip/inno_hdmi.c | 38 ++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index f7f0bec725f9..2f839ff31c1c 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -38,6 +38,8 @@ struct inno_hdmi_variant { struct inno_hdmi_phy_config *default_phy_config; }; +#define INNO_HDMI_MIN_TMDS_CLOCK 25000000U + struct hdmi_data_info { int vic; bool sink_has_audio; @@ -572,6 +574,34 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, return 0; } +static enum drm_mode_status inno_hdmi_mode_valid(struct inno_hdmi *hdmi, + struct drm_display_mode *mode) +{ + /* No support for double-clock modes */ + if (mode->flags & DRM_MODE_FLAG_DBLCLK) + return MODE_BAD; + + unsigned int 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) { + long refclk = clk_round_rate(hdmi->refclk, mpixelclk); + unsigned int max_tolerance = mpixelclk / 5000; + + /* Vesa DMT standard mentions +/- 0.5% max tolerance */ + if (abs(refclk - mpixelclk) > max_tolerance || + mpixelclk - refclk > max_tolerance) + return MODE_NOCLOCK; + } + + return MODE_OK; +} + static void inno_hdmi_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) @@ -602,7 +632,9 @@ 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; + struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); + + return inno_hdmi_mode_valid(hdmi, adj_mode) == MODE_OK; } static int @@ -659,7 +691,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_mode_valid(hdmi, mode); } static int From patchwork Wed Dec 13 19:51: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: 13491830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05EB6C4167B for ; Wed, 13 Dec 2023 19:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gDi+vJIA8C8SmiR9Xs4w/3ypk+aYYI0yUsyzCYgycW4=; b=fikwk39kanbqBo KGdcKMgGlNCL6j0h80ot4Kdy6LBfJbbHzC+147sn/VGeMwUlabLi9HpbnjPRPxdVkL+7HpINGEiwz 6pPuAHvslo4MYeoPAICn2OBeYup8Gho49Wy5MLbjInAVxSCi42YsaKwoGDQEjWKXjpGcQ0uz7RH1t vycBWgLFgX8mWfbjYUYrm/xLQwp6RpQHDXmkEn9x9MULaPvO6Y4iCLYYywL/XlsoYSPISjbgHoszd 7U2keeD8oWccfn/bU17gF2Ay4R2EHdmSnr7PYkkTqvF1HmujNF3P0Pg0BQBph/8aMve7ELTX0/Dv0 zJU1DSA6YywUdd3kexcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGr-00FsoW-2c; Wed, 13 Dec 2023 19:51:53 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGa-00FsVS-0A; Wed, 13 Dec 2023 19:51:37 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c3f68b69aso44461345e9.1; Wed, 13 Dec 2023 11:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497092; x=1703101892; darn=lists.infradead.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=SDq2fLVuR6T1GPARTMOS6b3H20znzfoIBUzVKBtShU4=; b=BsvB0ZBuO1gJVVQVgW989iFkngYXSOohx6UxfVrw3S+8YUFZdDn7Gq7UPH2C0AZhDn bjJUCj+8l+VV+jRZp5iD6PRiP5BewWovCAcp8nduSBB1uUj+fY+MzR1A8C22W+kzFJBS rgh0+mDHfEgPMmpJ+ai+uCxGGYhAUME/FYXvm2/rO44AMTcFL9frZiCvqDqBTFq96fGI P0YtPyymxgEzW2A0zY3+uSbsorrYYjTKdVihd8WQwz39DpJDx/2m5BOL7baR567XCumH cI6NbGkKoddLtKmr/7QzgjpaU8rJ4UoVGatlUfq98ELsEnRtcdZN6obV2R7PFDcSKTSw yXjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497092; x=1703101892; 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=SDq2fLVuR6T1GPARTMOS6b3H20znzfoIBUzVKBtShU4=; b=eDej5i67O3YQ+sevLG/o/OlNa/T8P6udg9tIMn42zI5OjaAxVga7UmG+W26ZYOxqvP E2jA1qsTztFoeEVcZzAtlaJZAVNyV/B8eGTMXam8w5o3bVwFI/XD391gsxScyK1WZWJA TvNLHztPfNkWZfejGfLsLaXIVFn8zIMSPxE3ZdQ5NYsxyfC/oucvp75Tf8T5ucHMfhIG /78tsW9yaWTWo6v3gtltjyks6jRqgLdZqcbz2gC1eHqjLvaB+Daj2vRJ9of/0aP0Umlv v7myUI44nX7rwkji2DTY/E7hQNY/6poFrnIPC8ydtiWhES83BVR7qk7hNjNdRd6+FC7j 6YEw== X-Gm-Message-State: AOJu0YxBev8xD99vHpegDb8uLb6oF/+KPw51TsSIJP43MSGnrBM+p/AK sk3AUq05OP1dUMn1Z1mdHg== X-Google-Smtp-Source: AGHT+IELl0hfWLjSptTvXIEl3IsyO0H+O35wlMRi+ihqAK0nI8r+NnvvoiYtiu2tVq5so95DtF4X5Q== X-Received: by 2002:a05:600c:4f48:b0:40c:426b:fd2d with SMTP id m8-20020a05600c4f4800b0040c426bfd2dmr3758370wmq.102.1702497092225; Wed, 13 Dec 2023 11:51:32 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:32 -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 08/11] drm/rockchip: inno_hdmi: Drop custom fill_modes hook Date: Wed, 13 Dec 2023 20:51:22 +0100 Message-ID: <20231213195125.212923-9-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115136_087055_640948B3 X-CRM114-Status: GOOD ( 11.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that we have proper pixelclock-based 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 --- 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 2f839ff31c1c..84520da8c995 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -696,13 +696,6 @@ inno_hdmi_connector_mode_valid(struct drm_connector *connector, return inno_hdmi_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); @@ -710,7 +703,7 @@ static void inno_hdmi_connector_destroy(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 Wed Dec 13 19:51: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: 13491832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 653BEC4332F for ; Wed, 13 Dec 2023 19:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=64eLTnRTMIg1hzyZn4WXwAzGVV4nbedtWXd6lUqGBT4=; b=haW5iOzRRsnqN6 6sekXM4uBu2PY+YiayRldl/XuTqI2yYRu7anjwXQ/33ZSji2/Dt09KUehMpfLK8H3G2aP+s4WbyZj Yg47IYovSUvwgZ9zV97PbE9RIBj1d7gB3rYNViBRb/ngr+Tce1xLd5dqjYKsOuPWOnlFGv2DKiL3c P0zv7xmOTrd9v2pSKJiMTjvq2qO3EKMb2lg2nzsN16VdGkxzEtXtBpwT10KeHV5do1jvacVA8yvk/ kVbeMaFuWez31rHMWj0AXG9lXAZkCRBkQXQ2lKivyG46hIv2z/0kMQqa0WszRtIpZLHNidgLNmlRc +1tTCX976rsQEztEzxNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGo-00Fskd-0t; Wed, 13 Dec 2023 19:51:50 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGY-00FsW1-0j; Wed, 13 Dec 2023 19:51:35 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c256ffdbcso75146425e9.2; Wed, 13 Dec 2023 11:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497093; x=1703101893; darn=lists.infradead.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=res/nVyNjutOW8BN3aTB9WUo0BBvwS0hIxu7mxFR92s=; b=dDRiVn00Uccg6Sc4kgUR7MDG3A+X6spllN1VSv572YFlth3xtV9wim0yXhmJt5pFiD 7XcSo5I+OXKZ0ZdK5QEIoF1Y9X4dPI0xcSjcP4ctpFlmAb0CgKnyEgo2yASh3ViF+mm9 N/fenfZ3c2bhV06a2kANZaXZNCrelC9t1NrFKMfwsmfTYFkjzUYInEKNfO/dx9Crl9By W7Zx1Iy6LoecNhgW9qOlQi6PTpJsY3HGpZ7CxlQ2jjfiNnI4IAVSiq0mDAEgKBvMfnY5 zQS6QecCiSpR2FlUbGQCIiBd1RDzFzApoceI4Jtjk0vqB3nUq/iGOE7GsfeTq8IiMy45 jLLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497093; x=1703101893; 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=res/nVyNjutOW8BN3aTB9WUo0BBvwS0hIxu7mxFR92s=; b=YYzvA3O9huFQq/GRdVR1CDjQEBaBNftamReZCt/KAldQbsBE0AJE+/ZtUlEIdjBuJZ m1smPaP0c8ePDf/jicksD5agvJ+stwvh3fOxC2su4o/N4ZNLedF0jHw1EPR4nIaXCWJK HlnOLLyk2CnfqlzB5LWZunA7zgB46pvj6MZI0y+Jj0mNRaYu7d8loROB4VXx1NNhbfO0 LCZDr01IGRoLYXFh0k7I+aJfB0vMlZp7x7Kw7OIRttIaLAGjHMtnVEpdVeDmd1R/wVEX dQYcpyU6vV2kCvG42btm2tNPRwoWCdsUrUw/9DiEQHPv6r1dhgs9Ketsu8ysuS9Q782K JBOw== X-Gm-Message-State: AOJu0YxFYASCwGJzudBM0ITd2exqyaU+rH2Tt92S7wuD7nax5OpyC1qr DLasZkPdaK18t2veMYZJbA== X-Google-Smtp-Source: AGHT+IFItZMtGB3SuUCkRPeMfs6P+z1aUcgQiQ9jDlsw7JgTG7OibMvG1NdHIBA0UOpU4R1v8MTSAg== X-Received: by 2002:a7b:cc8e:0:b0:40c:613a:8364 with SMTP id p14-20020a7bcc8e000000b0040c613a8364mr39998wma.134.1702497092872; Wed, 13 Dec 2023 11:51:32 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:32 -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 09/11] ARM: dts: rockchip: Add display subsystem for RK3128 Date: Wed, 13 Dec 2023 20:51:23 +0100 Message-ID: <20231213195125.212923-10-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115134_305406_1C33ACBC X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add vop and display-subsysem nodes to RK3128's device tree. Signed-off-by: Alex Bee --- 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 Wed Dec 13 19:51: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: 13491828 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9DDCBC4332F for ; Wed, 13 Dec 2023 19:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8fFOqwN/WrUpEUm3I79YnayHtgWoFE7rbfd2xH2mskc=; b=SdgFxz4Yen1Yy+ Ql0GP5bbJha/LCos5qx0Kz1c+TWhYhwLgWN8TcP79xozuUT4VYR5YSdwVMIvxPYFoAcZog0MQRztg qPaL8sXHhAMn/kEXVmO7XDT4t/sg/wQcbIf4bxtW5zO0RrU5HxJeLVU3JW7fqb/ben53QrESFHvdK jYelBNvajv+WoiBQd2LfU8vpKIbkBq5Wlm0fVZM2WSZ7pTe7MoYOL2QFRv5508GMzEVS1dk/30FGB 8vb1AeQbINPgPXGzrFgYrMrre0tZIjkkMCT8YDKqbjxIOz2Qq3oGxGZCIEbKupGzCp0FRNGhqndMR 27GD8lz9r+t5K5Pm4IMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGp-00FsmF-28; Wed, 13 Dec 2023 19:51:51 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGZ-00FsWr-0I; Wed, 13 Dec 2023 19:51:36 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40c55872d80so11677455e9.1; Wed, 13 Dec 2023 11:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497093; x=1703101893; darn=lists.infradead.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=+bG6mHprJzSYZBwi1h+X+EBITVK9IcgyHPusQHlrEts=; b=kDy0KVBVgsTqO+yDXgzHKcZ1wwGdC7Mkov6Y+XuK1U/q2gVxIsdb7mbHr3cKNlPr2N EbGBSkZV4a/xehZW1iwZ8YRNnOhU2HrCWl0uvxNLVR6LKH/Ksjl+TAm96TVxHPq4TaEt 28rqb7kHX5dpyeo3H8t9dWOR66PS2RuAPBq8ClUwn9vxgcUL6IWq0FNGWGgf7CcslGPe mDG4++6WOpZD1E/zvvJdMGzcyEg1rI6LKwoVy+6LY9xRUbLjq8Q8I5pfbavyOfRMhQgW 1fimsdJdesqRT+H2ohm7BQd9pXxxXnnt3WxhjJJkugPq8ed7HIucSOmc1ibLL2UQ40tx n9SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497093; x=1703101893; 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=+bG6mHprJzSYZBwi1h+X+EBITVK9IcgyHPusQHlrEts=; b=ZGMp3TkAruPAanF0BJZczx9Ll+gDxtFKaKeCovPLZU9iSlJkYP746G1Z1l+iXo45VN 32TFxEnbFx3SXUHQy/erGtfxGgAgq+oqaR1PwORE+DWUf4M3nLNU7E6ZNZRaCS8VBpSf dzkfU8bjokgbFMrT+fXc+jpKcodgcsYUmadsFlxAm3Dl65k1pOI1f4bnc5Z6Hv7jwHSg hCfOjcc8Pd6jcVqTHKa5EkDQlnUykBEw9+azHBM6/cvN+Ye4Nijgu+jWL016iMhTl5ai a5+S3BAmh8JWp8iG41BjrjlpZTKlA4cOCi/6EdDndOOjf9WFPu09naBY9i7SNT7PSV22 H7lQ== X-Gm-Message-State: AOJu0Yx+nO3XPIkGhfSpaeFE5ap1ujR3YUUv2bs4T7nS1A4Or72wZjN9 5S7hrB2/cxxEW+k0kHiHbA== X-Google-Smtp-Source: AGHT+IFRAbuvo+AB1xrGk5ZpZVLEeTXGFu7yh6ePcgyz+hlOtupWmzw76K4PJsqzujbcgJRctTp1qw== X-Received: by 2002:a05:600c:3381:b0:40b:5e4a:2360 with SMTP id o1-20020a05600c338100b0040b5e4a2360mr4804554wmp.98.1702497093548; Wed, 13 Dec 2023 11:51:33 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:33 -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 10/11] ARM: dts rockchip: Add HDMI node for RK3128 Date: Wed, 13 Dec 2023 20:51:24 +0100 Message-ID: <20231213195125.212923-11-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115135_131924_9A3C6E1C X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 Wed Dec 13 19:51: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: 13491833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A6AAC4332F for ; Wed, 13 Dec 2023 19:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MAkfHoaXptcAMONdqyCqFif62slzhS637LaZRyU8Mus=; b=RWP7HZFoUA1qp2 GAzzQweEh71N0Sf1t7Uh+Owx645/tfv1oDijgidzj4YhnGosTKPxXM0DYL722hmST895/vVknY0Ps 86u/27NhZ2wR5ckM/rd8y72we8kDs2IQSUNFpFq+UsfgsnblR/LMR43M0m9+qyOq1aEDwsXPGppbR yi9+jRmvCyMmBfd6IBfLE7q21hdj4mvF2641QF72koPJ+hee3OaZVstEocgDIBJGsO2dME0ZK7k3b TtLrg9euIQC8WGh/VRnW682MXMk0oB1/xVYIb5cuH/+FOduzWHburAM623zhpO1YKCFvhOqUbAV/N uopO/Wsd6I94VLab0y/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGw-00Fsto-0w; Wed, 13 Dec 2023 19:51:58 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDVGc-00FsXS-0L; Wed, 13 Dec 2023 19:51:39 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33621d443a7so3664257f8f.3; Wed, 13 Dec 2023 11:51:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702497094; x=1703101894; darn=lists.infradead.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=26TYtvJWQfom93EELDFR0hGRGZIq8W0h3c/9XO+9E4k=; b=mm/lBvq2/hss1m53Un+y/Rzu5L4hOIolgr3t152zP9jW7CctYBZjF6uj1v6PVBFT5Z 2kxX/FjXinlEm6eJEHkH/Rs9piHYop2ltdBbFZDZtYCwl4614dahTPA1iLsSEfyboNo3 DjXajzgT015QyrBgNk5FzhwUt+MrYAdgr1kUsyKwD3SkSslKVfYOin3rQCCVLTPJfGzt VPdJ/dKsIrHSQdhBMV5xt2cz7Id95+xDjtszgJzbxXKdcoMZKdN8QZPF0+efnpX14c2w TMPmkqjU21Fr0xqH3f48kR2rNpyO5J827vx8dbBgm3CRmvneMYUZ2KxOTEjArR/K758s alDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702497094; x=1703101894; 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=26TYtvJWQfom93EELDFR0hGRGZIq8W0h3c/9XO+9E4k=; b=E2mmPk85Ea7J9LAyLbcgmd6G9Pcz6Pti4OlYJh9nUTOVUDyZMMrG3I9ktAGZxEmm10 kPNUTZteT8Yjws+XApeh2ZBXq63DcKPFlxGXhGwpa88Hq2SZpsMdtXBc6O+XmEVl0kg8 NDax4xj4Ga6u6fGts2cpD/+dOAW/+z5svqlRF+lHG8XGM7jPyqC4KYPDBfhmyDFluEhz a/HaavDH9YEzWpxmMF91/hWkEhEkkoDUdkW03vXWopa4eCcdKA4UDerGyrAipeWVtkQ+ NWzYsjIkMAKIZIbCo6oGNKvESWT2z2n3slkRjvRcwMXtTrIJNoudxqMyXhGLrgm6bVF/ RoaA== X-Gm-Message-State: AOJu0Yz1TJjN5zv3rqKZj5lbheCp+d7pOUF7k/Tbr2xx4LcrGLIFfKbz e82mT9ng58uiEIiIA5wsnQ== X-Google-Smtp-Source: AGHT+IHGKyN60yuyPA3ry6yA1Jw305WgBGta1msCkC8kPAxdLBAYlT9Ne9SbYyRVW+lhrit0x6CTYw== X-Received: by 2002:a7b:c84b:0:b0:40c:3820:efeb with SMTP id c11-20020a7bc84b000000b0040c3820efebmr4553357wml.196.1702497094178; Wed, 13 Dec 2023 11:51:34 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:92dc:8b1c:e01c:b93c]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm24050698wmb.27.2023.12.13.11.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 11:51:33 -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 11/11] ARM: dts: rockchip: Enable HDMI output for XPI-3128 Date: Wed, 13 Dec 2023 20:51:25 +0100 Message-ID: <20231213195125.212923-12-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213195125.212923-1-knaerzche@gmail.com> References: <20231213195125.212923-1-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_115138_150877_54C36DFB X-CRM114-Status: GOOD ( 11.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add an hdmi-connector node and enable the hdmi, display-subsystem and vop nodes. Signed-off-by: Alex Bee --- .../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"; +};