From patchwork Fri Dec 22 17:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757553 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 C89D32C188; Fri, 22 Dec 2023 17:42: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="YZvAyPix" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-336746c7b6dso1673114f8f.0; Fri, 22 Dec 2023 09:42:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266943; x=1703871743; 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=xcMMn1wo5ecoqzzFfZ/NThvc+Exg7NREzlaFXx0npiA=; b=YZvAyPixlMQtq36mNN6T+kSNM7T7SmI6b26dVE07xaIQZYnOd0+dLrGLEUN+7BlGYt UlK1tUjkk9yJWWJ6H3+h9wFKkiCwQSksJItdCErFEdh1/1kFus7BS4byporKRp/zWeGL 08VYTlh86qyMw2nKfF995t8FaiHRg2B7Rb6Gz8Q9wN+PMxsHm9P+3fMySvfRrdpm+ETD +yo3HUERartESOzrJVKPa9Bp8JQCEk1I7p59/A8ZZff46b7Gfbvs+cDJgEMsY/iZhXtg iTpvRdYNibIdzCQQD7BJAvE+fcmIY3pe1k2UdkMCZvg6YJskkjV+wnTH3fpaTCR30Ylm Slvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266943; x=1703871743; 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=xcMMn1wo5ecoqzzFfZ/NThvc+Exg7NREzlaFXx0npiA=; b=WGi32pBxN1XKu/sp6uJgFiXg2Tz5WvvvfTKFKQzCbW4T/WEfA8RnMohEoDsCirk/jr RIlxx2S+BelInDkCIAH7r9IspKTUO3OXl5i1GToO7p9BFfoQANlTqYyOmHdsoYFFLWSV Gf0lIHezvSBWpkUrdgjZNY7SxV8QGjcmLZyQfsWPQy1Ax4Zncfisxsk0YZF00GpYs26L RNkNLgmd7ol5NUHajUKLjR+OCsIsab/LBQFU7WIPSsUNKoWV3OrrP/74yhVbQsSbWU6U k1KvpNIQA7gg/AQUa9VFibttTBZfaAmokg5GtUtup2CajYR8HMeGgQuo8I/vJ2DGPjAS Lmeg== X-Gm-Message-State: AOJu0YxWDUW3IKsv24k6dOImoDZj1MxNtmL7MguV1FHlImZQeD+uiRlA i7u3UdMELgKkHV1oV0gYDA== X-Google-Smtp-Source: AGHT+IH55tOdjFEvsimvQ0AWwkhlparYzELlSEvcxba6ID4XqVa/0ncC9dCVT9baJ10rAbzbikAuQg== X-Received: by 2002:a5d:6546:0:b0:336:7794:4475 with SMTP id z6-20020a5d6546000000b0033677944475mr992813wrv.109.1703266943072; Fri, 22 Dec 2023 09:42:23 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:22 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee , Conor Dooley Subject: [PATCH v4 01/29] dt-bindings: display: rockchip,inno-hdmi: Document RK3128 compatible Date: Fri, 22 Dec 2023 18:41:52 +0100 Message-ID: <20231222174220.55249-2-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - collect RB changes in v4: - none .../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 Fri Dec 22 17:41:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757910 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 B7C8228DD2; Fri, 22 Dec 2023 17:42: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="dwJU9ftp" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3368d1c7b23so1336666f8f.0; Fri, 22 Dec 2023 09:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266944; x=1703871744; 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=S0neXejdyKcMYrQeMYfWnn6/UkX9PKjLjeZy6MNbiAE=; b=dwJU9ftp43M/s8kTuFvinvim4AUho8Bbhu9R087+4ZiDt2sey5MxfFFgmvgKQcd3CH wyvuKkwWlTbD+87sh0PDF9sW0pTR7eNhMagLV0EflKnivZ8u5KpXD+TvD6AAjvCDBkfF imRVWpGniu+kK4cbHEOKrXWEhhIizyrk8K6a/WCapaWjoDSLHD+LU1TYF1PzJ5YepEhX 9MHbEKMo/p4Gt4ZIrRN+XZGtmIkkR6HwyUjY7/2+0SSxYjhRQ5Ibx6iADJTPgDuvadBn 0Qv5oTkteUBgz1x0N3+PNxpQYgz7vkya12PvyS03pm+OFEdYEcrNOiVzjQtbwIC1zhQq gO+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266944; x=1703871744; 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=S0neXejdyKcMYrQeMYfWnn6/UkX9PKjLjeZy6MNbiAE=; b=nqlBtGMibJLhHrTRWR/KG8LqhXMoNJng8+h9C4r57fG7OXUYuu1rOpl/pQrLcxZT0l 8ekuq3YzOUKWFaM/kZwLeIxRvC2cVwKRlHq33TEyCBsofilV2rHN7gnL0Cmzk4XCX8dY bH+06PW+OZAXLd+rMnjTwTa+fAoI4j3O7aUCC828nd0v5AALr0u9xH11C35hkSLH23lz C5/zz0c+KBG43gA2hPbMKl0JNkJKwgdCEc9fbnlWW9e+kwxpWeCzTX5CvxKALpd3b757 6/cSQEGzzVgrU4SVs/XNhsWgoE3ZB61IyjuYAHelPGCV1yq3Zi6XFzoKeyZiLbK6Gsaz stcQ== X-Gm-Message-State: AOJu0Yw06xnWBY82Xdo8VPMLynkdGrkH55i33RKaF9aRp/Wk16oxMqXH jsqIOXnPiFHlFBf/ySI9nA== X-Google-Smtp-Source: AGHT+IHgMx+o2VEbHPVQJ4P/KXTppQFx3koXaTkd1ZRvghWFSrx8ldGUAziC02wAFGucwtqAJI5Y4A== X-Received: by 2002:a5d:5341:0:b0:336:8485:d870 with SMTP id t1-20020a5d5341000000b003368485d870mr954023wrv.65.1703266943886; Fri, 22 Dec 2023 09:42:23 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:23 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 02/29] drm/rockchip: vop: Add output selection registers for RK312x Date: Fri, 22 Dec 2023 18:41:53 +0100 Message-ID: <20231222174220.55249-3-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - none changes in v4: - none 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 Fri Dec 22 17:41:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757552 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.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 638D928E0F; Fri, 22 Dec 2023 17:42: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="aFlrU6rx" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-336990fb8fbso479621f8f.1; Fri, 22 Dec 2023 09:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266944; x=1703871744; 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=U2HtmTELSCmQNqADg2Zx1cwuvSj7RPiUvZpCNIv/8+8=; b=aFlrU6rxyla4IxXOsIeCl7F/7d6bITx3266c0l5z7qislwEgZ0TIoaR/H1EIWvwQlK rRQKfGl37/nd+j/rN7A3AMufdCl8YKMLmCtK0bH8Mtq/lyITyvXOuVbr9p0ylFRXoL87 posnWcjs9KtlkfSNlqsnu++MACaF5X2xTU/F/UuWsHN0Ubp2/hXaw/SEh8LQWoiwK3Jr BdjaKlaCZIsUGdQdYOMjzWT9z5v5/3NiuUxrNFURAEOAZXr2qAi177tOpn6sl4qCF26L 1knk/ZEpLhoTWagxZm7t2KG4I4iWQGSQPZZh6a0m8XNLmMbW6TZPPAx8qLVs8D55FyjP Zq6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266944; x=1703871744; 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=U2HtmTELSCmQNqADg2Zx1cwuvSj7RPiUvZpCNIv/8+8=; b=vlfzoCC1PL3aSW3yHT2qXhADsKckxXtdhpA+WXr+Nu2bbt22rnH8K2cROwwDdTMEed VJjEgigVR4qMjk2err4jMc7t9hOAARJYlmicDI1fWnYN2xIPVlZp90HkWGsHQ8TbpzBj qjAcAi7ZQL+3YkrKmwgPggqsZ6/iPSOAKQ4CS+TdM/KdvM6BX/yUV43qfkgxE/qAoTOz RYmOnygHNFfJpvo3abucf81edi4Uxc2HHuWnZx0k50NwoCr1RcojPC6M0LdqbeXegeDN oKBFKpbttM8r5Ox98xAxPlqxVndU6JH9m7IpyPG2h5s/6r9pIG4Xbxlk8vePBMf5Tw0b If9g== X-Gm-Message-State: AOJu0YyHelIJ8nrwlIpU8nxlpHlNm7OGsF9XX6qMsfaKUy5M6CddsC3R 4/gNPH+dNFjOuKEr8hW5sA== X-Google-Smtp-Source: AGHT+IFV/fIOXodbE6RmpDPeWLOnH4XmVWoyKpBmq+L8MCu5fyIARaUJmQScH13sxNwDp3moadiGgQ== X-Received: by 2002:adf:dd8c:0:b0:336:77a3:2fbf with SMTP id x12-20020adfdd8c000000b0033677a32fbfmr947364wrl.31.1703266944629; Fri, 22 Dec 2023 09:42:24 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:24 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee , Zheng Yang Subject: [PATCH v4 03/29] drm/rockchip: inno_hdmi: Fix video timing Date: Fri, 22 Dec 2023 18:41:54 +0100 Message-ID: <20231222174220.55249-4-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - none changes in v4: - 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 Fri Dec 22 17:41:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757909 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.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 111642C18E; Fri, 22 Dec 2023 17:42: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="BwPVE8U3" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3368b1e056eso1517282f8f.3; Fri, 22 Dec 2023 09:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266945; x=1703871745; 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=8AvJnFMeaIBZd6lDR2+1UVvuB0inJkI3zLE1woR+vGw=; b=BwPVE8U3KMgTNbTn15J746FQfGQCUhcix4w7AomMwWE0KlJhEEcqOj+u215SjVlJZO S55R44pBIIQqRDdaBSguL0C4tov3pR5to3zSspjl3NP4kt0ac7vEJjhQdz7SlBV/BT1+ YI6i11wqaX62plZdNVpbWwM/cvVglhOOTdtUFFF6viQDNd6fIPY8eyiA2ymN/eqK5hNR lM3PzSbg3zTKHACQJ6MnS5RaYTOXhOq/+VnFeWt/6Yf23YpYnsd7k5ZiNP2FTVo/JUnF hGtAtHu0mvNLzkDbW4gXNAaB1WDfZbH71ywLQvfr4owrRAV7lkE9iJ0CDhVEgQrkDcsZ 8Y+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266945; x=1703871745; 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=8AvJnFMeaIBZd6lDR2+1UVvuB0inJkI3zLE1woR+vGw=; b=bRuKwtDXrC0HQs0H5NvCWfiFlH3rTo8WqnFDGXTssMqQxVgP4+90pMN6WzMggOZeEh DDDehYWpRzJyCTOXaHDLy48kFdHllzwP+vqpzy5T9aS2Umc8TbxaEjhHXZwr+QPr7jEn OKtV0XfMDIZgt2TFZS2OzNCQ8T24VKOOkwID8u3aUqdce1LzWhneabCjDm+uM+tvRqrJ 7UA4h0j0RtfvikStqA2Zvz/IVNfuMZxgWXZ7V/2icbVqS0NTRAh54XgluD6LG5qI9ok5 XJWYaiqRqx+FhocZC6Bb7j7cNfvutBKXMC2tr9J6ps6UoZKfxGytO4It3eqXP5Jut7H0 ZQOw== X-Gm-Message-State: AOJu0YyMjiuhAbF4M4s5CWPjj36PRcOLb/bNbrU2KRKN3HMNvxdmALdE /w9NuSPfEuDv4DnIx0raSw== X-Google-Smtp-Source: AGHT+IHILFPGV8bXVLgso5JM9ZKyQoow6IG9KXyZ1hSIhSMLEgPOaAW0iXyaQSbizVOd8/5R10rStQ== X-Received: by 2002:adf:f749:0:b0:336:8af1:5127 with SMTP id z9-20020adff749000000b003368af15127mr1196473wrp.97.1703266945283; Fri, 22 Dec 2023 09:42:25 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:25 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 04/29] drm/rockchip: inno_hdmi: Remove useless mode_fixup Date: Fri, 22 Dec 2023 18:41:55 +0100 Message-ID: <20231222174220.55249-5-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 Fri Dec 22 17:41:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757551 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE7762C1AD; Fri, 22 Dec 2023 17:42:27 +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="KUaqBvH5" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-336979a566aso574527f8f.1; Fri, 22 Dec 2023 09:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266946; x=1703871746; 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=JDZw6NA00pLIWCPFGMihyx1IVwowkY8XOiwDd7TasQE=; b=KUaqBvH5GO1wdJGC+MVz/Mo4nrDj902m5Ln7T5abvoDa/r9pLVpXLCrAY0qrEN+w+F giDGPRQ2MB9eagvsp6vBv+w3PbepESL83+7VQrk/V3SEON9nDGFugkfoMmgOq1qMoTes NqOqol5rmU9TIFsH/CzSNCDOA1Air/oejKEWiqiMf8YDWYsLcTttSR8j2uOnMp0pe0s8 0DwFOUnWlZL6IUrYO0SpD+KWlYRf+Z7rDkYvSwSLtCixsZzhdhDQTeu37yjZ/MUp5RL/ Ledkw1rNmEdDk1q9LDreQ3qdvfmYdt6GWOP6U3qvwlT+qJdv8bvuTeU+qhXGNgDdz5dK +t7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266946; x=1703871746; 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=JDZw6NA00pLIWCPFGMihyx1IVwowkY8XOiwDd7TasQE=; b=uDeeT0jJhk8iGnHd/7bVfZbr7CHRqC5XIDadhPAYb7b3ZmSVLmvkahtNCgN1yXqymD DHIEPUWaB9OeIApDkdXM/stPVdV3ttgsS1mPCm05DkFt19kGG3kgxRSSvwc8zS4M4Ff6 AN9Wkrvc9zSWIWOWt3XaMqSAlcX6RnKTEf40hPUS3lLXRi1hwhPI4ojH/6/OvaJbHaO2 ALzaQM5tQzle5i3IPcyHzy6dOqaXkMq4Z89qcaqsG+zBluUm39BzCIfH8ryMRyhYP0Ov tMomYxOd98ctO1WHIxtUzslcP4R/iRxzXuMyWH+PHVGd2Hh7IsCidRC38Yp8+yCPUemt uwjg== X-Gm-Message-State: AOJu0YxCdvs6UgD+eTcpnJGGb7b8bzONSOVuB+wOrWCSh9gfY8QzFfVF oYBmFeerRGfG9T0pd9lSaw== X-Google-Smtp-Source: AGHT+IGOfU9ODiH9NLfSXETtkHv9WTh+X98b43SlP0OW8MLrcFPW+Mc6NKBN1yINEst4gkgEd8TDVw== X-Received: by 2002:a5d:58c1:0:b0:336:48fd:3458 with SMTP id o1-20020a5d58c1000000b0033648fd3458mr1123123wrf.68.1703266945929; Fri, 22 Dec 2023 09:42:25 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:25 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 05/29] drm/rockchip: inno_hdmi: Remove useless copy of drm_display_mode Date: Fri, 22 Dec 2023 18:41:56 +0100 Message-ID: <20231222174220.55249-6-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 Fri Dec 22 17:41:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757908 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.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 7DE282E636; Fri, 22 Dec 2023 17:42:28 +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="cXa9anQf" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3368b9bbeb4so1508525f8f.2; Fri, 22 Dec 2023 09:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266947; x=1703871747; 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=oTMG9bpN8fCN8EPMeR+JAUJcfO1Vw55kh4J57dK4YOA=; b=cXa9anQfKgRisLavyIIrZwnuhzDbmeqZQh/10O0tH5mdrpJFKIjW0/c+0MYFILBZf3 NrluJOTGe+OvC8vuUAFWJQIi072y/E1ciK9PHpLISSz0U2LtiAKoZ40InfuaZfcAnSeI aU107C87PdxCzCONdn68AoeMZEMGNZOdpvb4SeO8iViyM96mtzNv9tEzjeaDha2ppZZw a6yUd9k/VW4KA3kXlJb2t5VDCFC800ApgqHaoscMFVIQCV2XBOGPBIN9tMiMbf6ZRrqb mbPWDXbiqmSCkTaQcENDI/6+OanjQGLgI9Kg4a/0qzLJxluxxPaPPGA2VKDZtcP7G1ZL tvJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266947; x=1703871747; 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=oTMG9bpN8fCN8EPMeR+JAUJcfO1Vw55kh4J57dK4YOA=; b=Kz/mCFLu1swk9d4b2FKB+nj08QFBsGED0KyJONyA0cQhowM2Ul6pNNcheGIWzkdA/r +X2Ls2GuPr2CB85GpIQuvLbLOVsPYaHQdBkB3m4bdLu6PDEWzbjgE0nB/DVCj91xMAmX iae3pAylnukaUiYaQoT2yaLDke0ITqctzCx+Ug3+yLJEbat5ElJvhNAwjVbXXGP/UEV8 0uy4p/iDkijtKivNg0zxciXnl988XTluP5YbLgEUwFN/5s6E2Are6Am+/CN300/WkGEq VtMEL2sRCBZUp26WjRRSIebylDss5bjfamkTiRnFY2nrPJFBTapKJhWl+Nac1EKJtvNS I+bA== X-Gm-Message-State: AOJu0YxLrd2/rSRqX+kSYEQBGJVNxeizz9j4TDluYOM2F8tlsEg2OWQN FOskup/x37903G1FQ4yRgw== X-Google-Smtp-Source: AGHT+IGaMdHthok3Ci5B1MBDr0uxIQrDsOWWhXIDOKVME9KH+r0ZoYCnGYwHSy8GjEePUs75tpwEzg== X-Received: by 2002:adf:e5c7:0:b0:336:607f:4bab with SMTP id a7-20020adfe5c7000000b00336607f4babmr607801wrn.187.1703266946623; Fri, 22 Dec 2023 09:42:26 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:26 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 06/29] drm/rockchip: inno_hdmi: Switch encoder hooks to atomic Date: Fri, 22 Dec 2023 18:41:57 +0100 Message-ID: <20231222174220.55249-7-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 Fri Dec 22 17:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757550 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.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 F1F2C2E826; Fri, 22 Dec 2023 17:42:28 +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="Iw/f5pss" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-336788cb261so1662129f8f.3; Fri, 22 Dec 2023 09:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266947; x=1703871747; 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=s3GkVjgO7xCOhsoyA3/cHuRL2/Yb9XCTkkYsuRn5/o8=; b=Iw/f5pssDhztQKeAAtTOCYb1VhSRdml6Y/HVm162l6g0ZJEn/FdEdhhTIrlPoIk+7r pdQsYFQ9hV3iMVUuVzJNVxAtZdAu3J2AnQ6z4Os0s3JXBVwNJX/dPZr4S1VJXY49gNDT suY7Hixj5rMvBUbqhxIqXNSj9SmpMIq/jFURJZmfkQWxfyoWsyqab9jdk4g61VtAdnj+ vfB3PkZKtRNehZmh7Jz/23ItSNwULA5KJnX0xcdR40N78J/Z82xkQSB7shthYV43Yrj0 AUnln+17/GYtLrimkpeQqALKBK7I0VqRHI7obOA+xB0FPNd9kQYoOniQexcYIJZr3OZ3 S79Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266947; x=1703871747; 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=s3GkVjgO7xCOhsoyA3/cHuRL2/Yb9XCTkkYsuRn5/o8=; b=KeWstFnfDZ+Ou48TpC9LjqgsgPvb+Lr4vhMZoQ/E2GWhKi9kfjXmnJrp3O40dIKB7n N01lPXRekaINGyT47h5RtV/lLStkFvc9iIQreyKciEV9gX7MnbBsJ99hGJBxoAcZJJrk Uk93oRNKxVlSEfkywp8AmXyXoeuTN6yP9/Dw5BoH1cPTorZFATiXK/RdTpM0Xrwf5pmW AnB1wC/gGtavmyWqlhhx9/lI+nVvBi0QXx+T+cxxFOA0Pm5xsTTJqjWvQ6xXSajCu0RN C0sCgJt3N50TQ0zmxL/BPYHu4zpUfbAVqb39CWS0romEYgKhslFWBFfkGCID8X/VSsH5 NJ4w== X-Gm-Message-State: AOJu0Yz6Sp3BtFW9z4XBK/6lQnGIQlc9/mEQKoTam5v3/nbNWZbPpavc vY/r7qI55UOtj8q6HScTvA== X-Google-Smtp-Source: AGHT+IHX+9/MPXHlLJ3T80hITMDfMHWCaU/WAybii+j6ocgFvzMfV97yoJKax2k3/7nsxxV6QrfASA== X-Received: by 2002:a5d:4cc3:0:b0:336:788b:f064 with SMTP id c3-20020a5d4cc3000000b00336788bf064mr959130wrt.23.1703266947305; Fri, 22 Dec 2023 09:42:27 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:27 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 07/29] drm/rockchip: inno_hdmi: Get rid of mode_set Date: Fri, 22 Dec 2023 18:41:58 +0100 Message-ID: <20231222174220.55249-8-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 Fri Dec 22 17:41:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757907 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.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 F0AFE2EAE1; Fri, 22 Dec 2023 17:42:29 +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="DgAoPUop" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3368d1c7b23so1336731f8f.0; Fri, 22 Dec 2023 09:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266948; x=1703871748; 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=/kgyib+/6QRevWIU1dtxLSbx62QPgtFJTlVAtzjG6Is=; b=DgAoPUopw05zK9RNEJwNjb/El2mEa79NaoPmCy/rE0fsdXn0BGD9h1P/w/rT7G3PU2 FzctkPprZNuVOnnP9W7d5ud/twRWrQYUfB2hevv3CJ3gAjUtBo175r/HIMV/2qoff1MF b6uTg200lAt9UeIhyUfR3fUhr3SVapqkIJavCYsUNnedYwvTH6LnW7Yf1uUNvuUCEWbP Dm4z4NU5YwZs94bVARWWUj3Q0JcCtZs6dk3jZVlSu3XwP2Lap8kl6r84TYhpYBioSsMN kUuHZpo4nBTuy3Zi/dsOAkhUG9qipUoi2oC6uom+i7qgTMsC5jDynE/wOREk8k2Nqi/c Qfvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266948; x=1703871748; 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=/kgyib+/6QRevWIU1dtxLSbx62QPgtFJTlVAtzjG6Is=; b=nO+a6Q2QqOkrVus0lf94nPF0/IN39Vlj5ELcpeJC9H4D3u7hqLxohHCOXI+2aNRwZX ERsmGunHFm4oHeprkw3KBVfpi+nNEl3PDdn9EuVZ2QCmlMoldVia6p5ocdz/6tUpu+gi JEpwIbdN7bJFFez5hqTxr9LlcvDcwciDJiCMFPEUCeDTFkG67QMoNB7xkLsN581lPUD3 MeKx+Oi9y7NKtQLavGY0LO/WZgr7CQBwgnDpuMZwThKtelScwMo0e2ef045oidL6mQSd QRXniePziw1v7p+ssFRSrXKGx/t+gdxFOn5hBF1DGb9JZSCUwuyPkP6m4UjaOtInpbld HgkA== X-Gm-Message-State: AOJu0YxJ2jArkeOyWv4aVURk+AlJM/7YJDfuHYZFuioETE5u+60mI4u/ l4evFTZOcWyAtvudO2w6Jw== X-Google-Smtp-Source: AGHT+IEt/69sUBqxWe1PRE1w6MCXmB6NT4MwzHjZjfhAIB1uVmcCKnZlBEfqCpNWf7fYGOh8JR0yEw== X-Received: by 2002:adf:e911:0:b0:336:4bfe:5ab2 with SMTP id f17-20020adfe911000000b003364bfe5ab2mr864375wrm.8.1703266948004; Fri, 22 Dec 2023 09:42:28 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:27 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 08/29] drm/rockchip: inno_hdmi: no need to store vic Date: Fri, 22 Dec 2023 18:41:59 +0100 Message-ID: <20231222174220.55249-9-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Tested-by: Alex Bee [made checkpatch happy] Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - none changes in v4: - none 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 Fri Dec 22 17:42:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757549 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.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 7C9B628DD2; Fri, 22 Dec 2023 17:42:30 +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="jWzeEN7Z" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3368ac0f74dso1459798f8f.0; Fri, 22 Dec 2023 09:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266949; x=1703871749; 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=soAjE8acoLO25uetbn7sq4B8XVGjHmzUhDkeJCVuw6s=; b=jWzeEN7ZlvoA6aOKh+rBf6cbnCFAEiXZRNVR+eL9pvM/WT2JdtbhaaeGxRme9KdWhL tgotUVR2tDxXhacTpmVTKdR9p/14VT6ACvuvdzOFTbSyw9y0NSy08XJjTdsbS9bA/m6U WGmbj+Su4ZBz/ysyt2cgepNB3bzGo8kB7aYezYFf/mteBNzThcTe6XR5yfG0WlHodvL1 kwb+oQ6SExt/5G2gDKgf0Bcxm4BHuQvvLY3zy1TARo4OTBvodOpd58Kw4C5cs6J9sS8l Wl6VJ+jVt77uMuM+uxSyX5IlmqToOl8DAeaGGZ/DvOY2zRfCD07cBubTTwf4VZ54tnNl HI0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266949; x=1703871749; 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=soAjE8acoLO25uetbn7sq4B8XVGjHmzUhDkeJCVuw6s=; b=LZGGmtxNwW8/JYY5ixigH4V54DJHW3B+MlhGVb2EnQbd3RepkEepvIJJubsQnQKWCk bU/CedXhxxpu54s6HHVq9XUipe5ZCbZz9DUJhLxae2dbkGoExe06gufMxBCYW2x6bz6Z hqM1G15SB0HpamB4gp/T2ZmCpMKl6Zqf4/Gr74Mw8kH4F8cVEST1iBtAeHJXkPmKgWbZ 3C2EZNRq3oha4WjLLfgK2ri1I9zX9ZNUdWdb29U6/qCLD68ZfoJNfNmpklReOE4ZencQ 02C8JemLF80Lwzqv9qbEAealst42nOFoT0Nu50rzcPoCY7Trb1lJ4qPMjT9fiD05VtOS lf2Q== X-Gm-Message-State: AOJu0Yz+tRsyFQCs7ZQ5L0dgzPsnuoE8qY7bD8HD9aJsb5zJRO3kZZjm t+p3xmi4TFeBo9WsjaLhcg== X-Google-Smtp-Source: AGHT+IHah4jnfoc/iQDiaH04TqQnyPss1cyXKoR1c4+dSrS+PxFbwT+bgS5fPTlfRhKEEGTVhCzfJw== X-Received: by 2002:adf:8b1d:0:b0:336:6e32:3fe3 with SMTP id n29-20020adf8b1d000000b003366e323fe3mr1295901wra.54.1703266948656; Fri, 22 Dec 2023 09:42:28 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:28 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 09/29] drm/rockchip: inno_hdmi: Remove unneeded has audio flag Date: Fri, 22 Dec 2023 18:42:00 +0100 Message-ID: <20231222174220.55249-10-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 Fri Dec 22 17:42:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757906 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 5990E2FC32; Fri, 22 Dec 2023 17:42:30 +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="UqBH+jvu" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3366e78d872so1831080f8f.3; Fri, 22 Dec 2023 09:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266949; x=1703871749; 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=18puqwXb3goOQbFDudDa/Se4Vi5XO1rypLRUSz/S/Ls=; b=UqBH+jvueCrYvBL4exg1GGPny87AagLrwzZ032y/kJr44KBytmCpjYS33xda4ZUddt 6Y/v15XjEBZPOVhAx62U93n6ZxHPC3MYKhyiWLcwJnK0DK1MFcA8+gfvddUsWQR0RZIS fg+s0T7RbgTzlbWmBTDFCE3RtTibup+30/RlLnucnkCvdllecdyo3CLa3H8xs5VNOdLt DnyjJT5R67b0KtETXPenfnW6F9XiLhl+Hej1fGJmaV5kPWSOFB6eNF0+Q1GwPbxgi+2u q4GSy98X3DM+d9AwDyEZVy+SaZ1G68AcwUnT/20tLADJJG50eypZ/OmFTURBR4nzPdAQ c0fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266949; x=1703871749; 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=18puqwXb3goOQbFDudDa/Se4Vi5XO1rypLRUSz/S/Ls=; b=GIqnyIFA21aL8G+q+fvXuy7Um0h8cy9HPqq20WPyjfRp4A3iNje/sztPghKeYGHkzD SzY8PIAk4rz8uVQv0E1W5e5llwbUf1Aiti6p40RQO7c65nWifUxdbmRcZvX6KkP/PnLU O7yidZ7B7UndOyXb86A4+ws4i61GBNhbTbUP85wMN83BMFA1yu8M4Tf/8c/keludNa2q flJD1KiSRoYl+kCmsVcMoZD7fW+Hw2ryusT6pqZGeVPwI+oJ2V2Q5nCmdpvJNpv4GUfE 0jgXFTMNrbSFuBaNYwv82gW1Y8fy0KUy/u71fmPniS5gias5I3sIB0T+y1TttOmf+VDf HCNA== X-Gm-Message-State: AOJu0YxvlRlarJTwqK5biRo87yekUC9L0bsMxd9oRe4zTlviOvHqt0Qd MslYRsrW2zaBq2ygrUSsPQ== X-Google-Smtp-Source: AGHT+IE03Z0mQGd0T3nK7PKVrcK3l3OP/j7ot+vY4dUtl68sK0OpL60w9QcThMcJWjmzodRVbjaPtA== X-Received: by 2002:adf:f7cb:0:b0:333:3bc9:e246 with SMTP id a11-20020adff7cb000000b003333bc9e246mr513195wrq.33.1703266949433; Fri, 22 Dec 2023 09:42:29 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:29 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 10/29] drm/rockchip: inno_hdmi: Remove useless input format Date: Fri, 22 Dec 2023 18:42:01 +0100 Message-ID: <20231222174220.55249-11-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Tested-by: Alex Bee [made checkpatch happy] Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - none changes in v4: - none 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 Fri Dec 22 17:42:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757548 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 05CEC2FC5B; Fri, 22 Dec 2023 17:42:31 +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="mIHED4K/" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-336755f1688so1824551f8f.0; Fri, 22 Dec 2023 09:42:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266950; x=1703871750; 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=mvwlyAlnXeNL9AzDIrE6gEzR9A8598VoqwlyqljJPww=; b=mIHED4K/XVxWagcSpVCqUAMd/NOEuH+mtHLhJljAtZ07jZI9P/IAlSqg8KbJCC0Mj/ lVb5IxBfnEWGdsKAM8tg4IY185AxWGeS4OTF4LKpUfRWAQ5rUGD9C0eBpfas0eVR2Rzb nIQCM0G/rGUmQgP3BM7KXrnn8OB6EOxNbgp+7f37Q2708GKs0hPmv6G8PUA0KgP+R6w3 MD5iV5oMsdwp0Bcx5zOxVrxakeohclaWc3/0p38IWwZd8OFp7kZRGURRp6CvW06hQDg/ ldcJWBy8/m3cRluSFBaOX/qpHck82Ynx2dwzQcTDORe1nQbBuaSKa053WAn2uTvbx5Ve atsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266950; x=1703871750; 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=mvwlyAlnXeNL9AzDIrE6gEzR9A8598VoqwlyqljJPww=; b=BTdqBA2dytuCcjm9VEBLz0lZpW0R1GF50uYXcTZGB9LaphMF5wP/O4RVVqSf88UanV yUugCrPwhh2gyLREb3HAnLPtJeB1f9n9OuZU6MUx83QMx15vYZq7G0eQVS8tWQ587U6D H8cW/8uew86y7sfbHEirsIvvAG2Hgqrgn53n4j24GzNRPrL5scPnF/Xs2Ibk0EUDriFA D3NK/cMAVcRdLsdV9lrAgkOE5lx8CsmRzEh/O/KBfh0L6ZFOYyEbOcK8ewE72s5dHBuw rV3hsXaH5meTZbJ3n3+Oc/YcLjNO56aa9ztzS9S3z8Lg1tLSDl2yu3ubOqqXfR1CxWU+ yHgQ== X-Gm-Message-State: AOJu0YxOEWQlPilidy3WK7AIi7R7W3mMfNtzky1BU2D3J01XAeIDL4u2 aPjHf77ERIlliLetEDOESQ== X-Google-Smtp-Source: AGHT+IFlH1FXt4AEcnW4RXoWxNep1h0V1fV019/19FThEs51/7Aby/yM7fFwgKONy2ZfswfDCXMW+w== X-Received: by 2002:adf:cd89:0:b0:334:b2bb:6d1e with SMTP id q9-20020adfcd89000000b00334b2bb6d1emr1133231wrj.17.1703266950277; Fri, 22 Dec 2023 09:42:30 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:29 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 11/29] drm/rockchip: inno_hdmi: Remove YUV-based csc coefficents Date: Fri, 22 Dec 2023 18:42:02 +0100 Message-ID: <20231222174220.55249-12-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - none changes in v4: - none 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 Fri Dec 22 17:42:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757905 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF23131720; Fri, 22 Dec 2023 17:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kCWtWR6I" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3368b9bbeb4so1508576f8f.2; Fri, 22 Dec 2023 09:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266951; x=1703871751; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W4073SJzbMTg0LalE15NpNk7khJfelMofNbr9L2QfJw=; b=kCWtWR6IFnjNHrZP4QFAiXJ9l4zIfi90Z5RCrIOWIrbJthrlHDDIb+orwxVLug8t9c CsDl/Hkzz2kuX95P0R+h/uaEzuRcLuHe8d9BZEGmZQVvHzM5Y+HySQrcycuvk/2ivNKA 4bZyeVAfqMQyqudAfuOl4QsMzqIgo0qo2WLU1Yvm53AIRUJUYeTBSLeJQK4lw4h7XMrn C5sRNVuLEYr1xhb7eoQSgBFBskauoyYC/MxBP5xhQFaIjwGxF+zMaX4g3pVdls37DdfP r7rdD1wGj0PSTFw2J/eiMl++f/a78SIr3fiFqI0hts2nGDEMVZ/FYVNU9SO1q0NOJDen w9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266951; x=1703871751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W4073SJzbMTg0LalE15NpNk7khJfelMofNbr9L2QfJw=; b=Sg8q72lfa6UjfYl9iZ3jTcbInIcp4J1sDTZul8cH6ko6vMonleyfuFGIp/9a5TqViB JTUzbPJ9vpJf1lKL5sVGvo1xMOK6jgCUXHeVTgs/G4ogsursRRIekcb2MsvH+t4iMAq6 glwPyxqVBDXUa9amdDF2X0cy7J0D5nryklrUVv5sr3KlEHpOtj4+Y+wiOAYlOBSG/1Zb Ez1oE0acGMRFKW0SJVFwsSctkSL8w5XMicji79m+3+G44+Xn5g9ExtsRSzAJNLeJYTQC hgVAhFwfZWS19d3z75PLj8rs7PGMteW7RCSuzmSIYb1kkFAQd8nkQOszFyw6k0SSbdYd 4pCg== X-Gm-Message-State: AOJu0Ywlr/YPOCfX0STsli3JB86Wo3ChPcQQG4IuxFXHaaMzarcVsOPA 2CBAACc37EwZzTmE6eSxNvJ4ZzaOOg== X-Google-Smtp-Source: AGHT+IFKE1CB3AU8VJ2Br9gEAWpX4rtGxNpDqQ9zPsAgY7yUcLcKeEvfj88neb+uEsF/9Yhz0hxezQ== X-Received: by 2002:adf:e74d:0:b0:336:9067:c656 with SMTP id c13-20020adfe74d000000b003369067c656mr575213wrn.262.1703266950919; Fri, 22 Dec 2023 09:42:30 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:30 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 12/29] drm/rockchip: inno_hdmi: Remove tmds rate from structure Date: Fri, 22 Dec 2023 18:42:03 +0100 Message-ID: <20231222174220.55249-13-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Maxime Ripard The tmds_rate field in the inno_hdmi structure is used mostly to configure the internal i2c controller divider through a call to the inno_hdmi_i2c_init() function. We can simply make that rate an argument to that function, which also removes a workaround to initialize the divider at probe time when we don't have a mode yet. Signed-off-by: Maxime Ripard Tested-by: Alex Bee Signed-off-by: Alex Bee --- changes in v3: - imported patch changes in v4: - none drivers/gpu/drm/rockchip/inno_hdmi.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 04344ee1265d..102195837206 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -56,8 +56,6 @@ struct inno_hdmi { struct inno_hdmi_i2c *i2c; struct i2c_adapter *ddc; - unsigned int tmds_rate; - struct hdmi_data_info hdmi_data; }; @@ -134,11 +132,11 @@ static inline void hdmi_modb(struct inno_hdmi *hdmi, u16 offset, hdmi_writeb(hdmi, offset, temp); } -static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi) +static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi, unsigned long long rate) { - int ddc_bus_freq; + unsigned long long ddc_bus_freq = rate >> 2; - ddc_bus_freq = (hdmi->tmds_rate >> 2) / HDMI_SCL_RATE; + do_div(ddc_bus_freq, HDMI_SCL_RATE); hdmi_writeb(hdmi, DDC_BUS_FREQ_L, ddc_bus_freq & 0xFF); hdmi_writeb(hdmi, DDC_BUS_FREQ_H, (ddc_bus_freq >> 8) & 0xFF); @@ -421,8 +419,7 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, * DCLK_LCDC, so we need to init the TMDS rate to mode pixel * clock rate, and reconfigure the DDC clock. */ - hdmi->tmds_rate = mode->clock * 1000; - inno_hdmi_i2c_init(hdmi); + inno_hdmi_i2c_init(hdmi, mode->clock * 1000); /* Unmute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, @@ -800,8 +797,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, * PCLK_HDMI, so we need to init the TMDS rate to PCLK rate, * and reconfigure the DDC clock. */ - hdmi->tmds_rate = clk_get_rate(hdmi->pclk); - inno_hdmi_i2c_init(hdmi); + inno_hdmi_i2c_init(hdmi, clk_get_rate(hdmi->pclk)); ret = inno_hdmi_register(drm, hdmi); if (ret) From patchwork Fri Dec 22 17:42:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757547 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.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 7658931750; Fri, 22 Dec 2023 17:42:33 +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="bR1HT6OQ" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-33666fb9318so1833330f8f.2; Fri, 22 Dec 2023 09:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266951; x=1703871751; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LfMKOfn5qhMsr90aHA0q/zpw4x0Di/ZdGH16UYVoiok=; b=bR1HT6OQCga+s2dH5iI9/3UWB7DUa3iF4Wrx1kk8Vt0VSAyw00e9I/V8m99sdQ5rkO YXpsKkAUh0yTsEHw7RNEDKPhhH8Ef2qHdvzsZII4GRM8SbR6te0K51rTuXduGb5ZhugQ IsW1010ODyYyHKIDXVhZomSDxku4MpY6Q3F1Z9vPq1nFUbq+EwBakhEqvHuW4EHs0zgJ 9ZL0Jmh5m4mT7E2HVewSvXovQ15ER89sk63dD6FV6ddn4tL43f6mkG4JQFNq7HX8JJQ0 akCDC7AYPtfEsXz/16suYNGdX9gijn2FmPR11GtZox+NiBRXtwDYboDtaVfghUHX/fTh CXhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266951; x=1703871751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LfMKOfn5qhMsr90aHA0q/zpw4x0Di/ZdGH16UYVoiok=; b=UVDs77r0NoHDwyegvdsuOXP80oynOsZcIeRPLhUFYkO3VLcuEchbx0SIsMg5dNT4eS tMxyjU40tJUR/aLrrBJtB82D9Tg4N5tfRzUzswsn6VhQeeXe8AJR7MFEAGfnHPB4oZS4 2f8Ildf3uUqog8m9etGjZ/miVym9Rvzmx/TSrZrTLKaAulvJH6uu71ITKb3ImgNIcvMa 4TLwSvGjh8EYdGXmFVH37ibG/SVv5BbJDA9NvtLNQlAyk27CJXlmmsdiJSh2zRNI+PRw g7LuM6gIEleqclYK3s6Twz1UTbC2J1lN2YYmytJbIkcJHhmPhUqmC0+tcoDQ3rThYzSD 6olw== X-Gm-Message-State: AOJu0Yw76ED49QsL6qa2etOx3no1rZ5biat9dObiBeyGRJP1794vQioG FfgcLD9B0ZpRp6HaPVBD1Q== X-Google-Smtp-Source: AGHT+IG3YWjTrYpe1ubpbeRtz8cVdvTTRZfBcpLPWcobSABejxp0JmC9wWRL1LNQLRIzXRY/WodRrQ== X-Received: by 2002:a05:6000:235:b0:333:12a3:644a with SMTP id l21-20020a056000023500b0033312a3644amr946812wrz.18.1703266951663; Fri, 22 Dec 2023 09:42:31 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:31 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Jonker , Alex Bee Subject: [PATCH v4 13/29] drm/rockchip: inno_hdmi: Drop HDMI Vendor Infoframe support Date: Fri, 22 Dec 2023 18:42:04 +0100 Message-ID: <20231222174220.55249-14-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 102195837206..5c9f1325441f 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -206,11 +206,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); @@ -226,28 +230,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) { @@ -265,7 +252,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) @@ -408,10 +395,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 Fri Dec 22 17:42:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757904 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.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 1C5B033060; Fri, 22 Dec 2023 17:42:33 +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="fSeZit46" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-336979a566aso574617f8f.1; Fri, 22 Dec 2023 09:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266952; x=1703871752; 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=hxV163vg4WaEsUhoUGEXFBcX2Ll0vd6Pc97F0FYEm9Q=; b=fSeZit465fX7FzYQ8pKLFqekXEZnFXH3RNRFU2mMU5ZrHnz8h0tP4V+VD3yTXA10oC d2Bn7EbX+31XkAex8+39zKrHOp+szwZn8/v8diM9HOydt8du+YDk78lzzjnLbMgqxnEb EBAMM1VVFNV7X6V49GxkQ7axRDY9URCBxRva+qfVuikB3+VBMTf3HBoLnany5WpUAq5W aZcVjG17xObmTedR7CdFfjJMPqra4mA00u/WqjcZm2FkvNeGYx1+t6Fshd5oHtrXHK53 M/y4iwc1gKHPakCykaq1kiFGjHmO0HvCKui2O1d/H5O7HBaisWbAQ7c9J9/Dt/yhw5fr 1gvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266952; x=1703871752; 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=hxV163vg4WaEsUhoUGEXFBcX2Ll0vd6Pc97F0FYEm9Q=; b=fQBc1m+zKZitdJrqTCuyI+7YA8PpGRMDOMUUZQ2trtWMS0EZLCiROT3o+hHd3OR7AW M21OPAe5d+u0q9oxyl1ILHe5KI8//7vvaYGoBhwVCdtFIY3fUxZIV3tkEXODMBfz4+Pr 8ua/n6BX0eOwwltorRufWb7rbuzyfRLu3t0pZYW7tMIxb2pYxKUpRZeyCUEhwTg7pBia kFcAyxOK0ZFTG9WqmixsFprwLDRBgY4qgPWirFGl/A6vD/OT0E0S2LquBeh+695ln99A 0062o7LhZF/jqJaCJYQhqRF76PQBSFaco2N53ZZfenWggmORwXGWlK3yUXm1vD/dTThB rsLQ== X-Gm-Message-State: AOJu0Yzzm8uXhMyA2m/GT13T6hazJgpWYlLjcsKOMIWnKtBvIlSZ/UiT uE7uCZ3iapOfcyuuGbw4ew== X-Google-Smtp-Source: AGHT+IECszl5yDhXXOpNKzi8n8qsuV7BMf+6/+DcPImMeEO1sJKFSTRO7RRtsvDcoVqGutyEkY+Vcg== X-Received: by 2002:adf:e4d1:0:b0:336:5fac:d845 with SMTP id v17-20020adfe4d1000000b003365facd845mr1065480wrm.34.1703266952323; Fri, 22 Dec 2023 09:42:32 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:32 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 14/29] drm/rockchip: inno_hdmi: Move infoframe disable to separate function Date: Fri, 22 Dec 2023 18:42:05 +0100 Message-ID: <20231222174220.55249-15-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 5c9f1325441f..10466c2aa520 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -205,34 +205,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, @@ -244,6 +254,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; @@ -252,7 +266,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 Fri Dec 22 17:42:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757546 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 75ACF33077; Fri, 22 Dec 2023 17:42:34 +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="Hbr/wFZP" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-33687627ad0so1708173f8f.2; Fri, 22 Dec 2023 09:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266953; x=1703871753; 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=Sgl1aYbfeN4t6iirxrjmyWdX/BacrfEEhrH3G2xuU9s=; b=Hbr/wFZP8bW2McHeAiywbFLntm3k/cMV9c7Diwtaaq+DkPSQ22HvAmRh1VumQTCMXK iYbR7QHUaYLvm6xZxzE0XNBDsYr3QTUuArKXazo5yV+n2pWc91B2W6i2ZjXwOvOa2PCQ 8h/7ebwJlnDR/iARF0PrPNWTHCH9mrTqUzdV8B1DGcBHR92oOV5g+bCk1eBZ/+3R0iOY 7KgcL9xpmbl5npgNHFUCInLuwb7xawEJUPcijXWFRemQhOaUdWtNtXVB24QrgD8Fx5HA P3AQi2PcQ6qC2FW2vGmlUPv2FbxZntKmmAEUAzYrT9ufcPn4rOqMhW2GtbPOvef2DKFX OacA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266953; x=1703871753; 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=Sgl1aYbfeN4t6iirxrjmyWdX/BacrfEEhrH3G2xuU9s=; b=PgNVoNzZ5In8WACBj5j039xbzXX3jIq24N/ZkSRumm1zjtqguy7MOtTwQdhfHDDGyo x0OhtKsvgZZ/9K8tyJX3LMMaLqV3BzZedFBrbh+8cTU/XnSdBycUXAewbnZe9lAmRUzf M6xhZpvmK67rnCtkosEPEIiQ6MCqimMFuovUfhk7HzXb+9liCOg1AqzErkK6wzRP8ZYB sGmK9AQ2uAbHd3F8CLfek4qJ8asWfOyxn7JtSczO/yRBvIBYUeJ/xT/3qQN4wa4yqiDc hm59heCDhin65gvL64qtVy95OWcMc0bhCFG5qgnUjsv5rOP6XZtcvQrDFjNOcbXD41On R7xQ== X-Gm-Message-State: AOJu0Yz6S/ToKLogVzOQqkpCtSmEFEfDiqutre768iRGdHDFVJfrQ2EF vw2OcEnWSSmAp2l33/ZFKGvovDADRA== X-Google-Smtp-Source: AGHT+IHWWQ7yvErxF9OIA7H6637gH3kNjMNDPqZnBLODlsTBGOFq4IWWwm5YOObU5TbJYQmMyuwAkA== X-Received: by 2002:a05:6000:230:b0:336:774c:d0f5 with SMTP id l16-20020a056000023000b00336774cd0f5mr1070493wrz.10.1703266952968; Fri, 22 Dec 2023 09:42:32 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:32 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 15/29] drm/rockchip: inno_hdmi: Switch to infoframe type Date: Fri, 22 Dec 2023 18:42:06 +0100 Message-ID: <20231222174220.55249-16-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 10466c2aa520..49367ca24125 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -205,33 +205,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)); @@ -255,7 +256,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; } @@ -266,7 +267,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 Fri Dec 22 17:42:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757903 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 5B38A33CDA; Fri, 22 Dec 2023 17:42:35 +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="gT9sfwCg" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40d2e56f3a6so12306485e9.1; Fri, 22 Dec 2023 09:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266953; x=1703871753; 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=f/FPPxJuSjh4vXrR5zkAljtm7LBwORW2untky7snjAo=; b=gT9sfwCgPtehT+kyIgTPNzUWhV/f5IMpsuywWKbmjMkRy3QOQrK2ffHmyyTu4P4Odv LFVX0ZUUBYYRi8I0hleYyfLn9fN1jCN63G5En1PxKyuTikQoyy+u2cWLckWrlVbaYu3m 2uOIZgWZNZ2LyT/ljnFC88ll/CO9vsfI1QJSB/ZFhxHF+WTXp45NXTk5/N9VMzItDIoc j2TBzPum1Tbt6kN4VgQgdsGuzJHTISoESGFIElEb+JjypHTA2uH1/d9g0THF/bnUzfrd ieNYbrFbhtkEC1LIhHYeY5aQZ7w5Bnlo//P6J/uQjDC/8jMgzOWAvq/26EOgbNSv5WSE 0rPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266953; x=1703871753; 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=f/FPPxJuSjh4vXrR5zkAljtm7LBwORW2untky7snjAo=; b=hW2ldS481gndJAA0HIvSh6dVNqZpfy+F/SO9CUa9sVIciV/Ja/Bdi+3PYeTYMXvKew 2Vb0kifNVdkgFEgfZLWa8h6OS4mVii2GJNGDvgTDsOoxvLX889Drrgi+6ep53csit32m AsBglgkdvmbxFkJ2v47pdXwFJlsUMfJksvW75aolpn2v7v535aXLEGnaQV7Uk+EvJkJw FJs/QVz1rRdiykRJwalqO/7IQCZZn4HlJ1/UIN4Gvt4wWZcoC1Ia5rPPMEhhVL4wzoSu hH2mPBUHxgclOWguXJSzvMpv8Bj2YF6GKRVEhp+Lo1cQ2hdAOnWST3uXgeHLQT10JLVq 4NKw== X-Gm-Message-State: AOJu0YwfKvNehZ/JrnmBpAoitT0QqfZwYk3FPVbnq2kqVpIVTpU/DtdJ 3VE2ZpyOUGI0fKC3Zq6lDw== X-Google-Smtp-Source: AGHT+IESVQNuwVKMm5k3RVva8Soc6Echl59mQa32aRicQaMoyZBUEGDXAro7m0A3Md1PmbcYnl/kjw== X-Received: by 2002:a05:600c:3c9c:b0:40d:40ea:a0ea with SMTP id bg28-20020a05600c3c9c00b0040d40eaa0eamr911042wmb.130.1703266953617; Fri, 22 Dec 2023 09:42:33 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:33 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 16/29] drm/rockchip: inno_hdmi: Remove unused drm device pointer Date: Fri, 22 Dec 2023 18:42:07 +0100 Message-ID: <20231222174220.55249-17-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 Signed-off-by: Alex Bee --- changes in v2: - imported patch changes in v3: - added my SoB changes in v4: - none 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 49367ca24125..51c1a69dfcc0 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; @@ -757,7 +756,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 Fri Dec 22 17:42:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757545 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 1841035EEB; Fri, 22 Dec 2023 17:42:35 +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="DVq0kSZ3" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-336746a545fso1256661f8f.0; Fri, 22 Dec 2023 09:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266954; x=1703871754; 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=fVOgOlLPAvEr0sLISb9E6/KYZz//LU2ejxtiVGPulEQ=; b=DVq0kSZ3Gi2uNQEj24tCvX8m5HTjKxRFhMlYeehzN2dKuam8p1auBI0t/REFkWvLjS /6VuLMr/vVs/8uPIEUs+xmsW99QJ+wLi2K697ZMF6OUlGRRHVbXdc1Yi7hrdDK9sPziz 2bS0FJ/8z+3+IltDrNPscv0J7orEuxe060N/rfyHWfvDGVWSMaLHmm4CHrLs1CVuKmkN W6/gE8RE9j1AjVWsIEYXUrJ4tmXl41dXdb+mzR9BYW1Gx7xln8qNLWt7zkUK8oBwC0AV XNA8wt/dDEq+bVo3QB1jJ8ZdHx/eyU7qfxH0qamOoxivHpt6spa9lkjMQCuiY+8tw4s9 GJsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266954; x=1703871754; 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=fVOgOlLPAvEr0sLISb9E6/KYZz//LU2ejxtiVGPulEQ=; b=t/PRUDPpUqq4KaHEOH9giibOPvYo18HyD8h5Jx8pmBFLK30C7/BcXNfHGcExnblhn5 KtvFnVveeXF6uN5k6l5q0UIPI/KN89iUu0J9WowCAzb29XZc4QeR+L9fq44uJ5qw2KgH AgOsNHWGwm4DXqWnNvBoyiHN8aWrw+3K6MFeZzPs+ei9L1s/28XDwMtpbxBQdzPJ6nVD xzajJH30IdWIkg2+iOQ9LwsFlztmagpuI3wqJYr2MA7X7uWdDQFsusiWuPOKyF472ML2 SZn4vuXu3vti3L280USW4MMYiFmnDC4xstnAoNxQwBvuN9vJv3YfTEZoza7n+4LbNl9l 3q3g== X-Gm-Message-State: AOJu0Yy1uLkHqWEI1HefKNqtMgQtTPrWSED99uFn+M2tctHJ7rpQ149O 6pxoHTj5ZH1GcQw3exX0+w== X-Google-Smtp-Source: AGHT+IG0VO/bIXEiwSNnQQTPGjLRg14lP+2fe564PcKz/X7g3SD2+YUJXu7x0ci0ig2sXjCTtOJ87A== X-Received: by 2002:adf:f74a:0:b0:336:8030:214d with SMTP id z10-20020adff74a000000b003368030214dmr748542wrp.19.1703266954331; Fri, 22 Dec 2023 09:42:34 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:34 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 17/29] drm/rockchip: inno_hdmi: Drop irq struct member Date: Fri, 22 Dec 2023 18:42:08 +0100 Message-ID: <20231222174220.55249-18-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - collect RB changes in v4: - none 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 51c1a69dfcc0..138cd4287dea 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 Fri Dec 22 17:42:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757902 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 9CFA635F1C; Fri, 22 Dec 2023 17:42:36 +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="DqPUl6h+" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-33666fb9318so1833376f8f.2; Fri, 22 Dec 2023 09:42:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266955; x=1703871755; 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=EoHup+tJ34Km8AW+9n07V9L+jLAh9fwpCrHBqqRCe/E=; b=DqPUl6h+jeKUhEhX7g3uF44PAkkTMAUGKkL1G4MuZGHH/QiQWJr0L1TZCpHo/RCP1h 0wocgZocYFrVYY5KPYizuXdGZdRbbYHdOY4zroZ/NPxJFxXpKXk+i4sRKlqRqVSFl56A qHQHYN7psI/Kv8VjbiH7xY1QsostTvRT41QZeeT3vAqTVS9RPcaQf4FEkCWNYhw025qE RfV+XzBBN4Bce27+ZiOsLljtKvWFnivvIYiSrcmUtHcbnMl8jgfzLLq/kOvjUPp23kMY DXwwkHfpyLxUpILDGZTFurMMqCey+q5d2J0xf30vA77njMSD21W7iQY168oU1dXZZ6Ta kJcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266955; x=1703871755; 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=EoHup+tJ34Km8AW+9n07V9L+jLAh9fwpCrHBqqRCe/E=; b=c/MJok5O1A9nwdzJUOwe+MJMs8Ooq1MUqowm0mCNzevSZFiTBvyAQptCA9Owc8khKi Lkrr+D17Xrqzl5D4VX1zzbu7L3D956ONlXBz0wg+Ik34uA9hGY3Bfgkv1lLoL4+q+COd KDNHAYNZimfVuZLf6bGkDAbHqjpp9wWb+h8iUQ5Zdpb9juhH14dthIddBOfLIHiclLwz XBehu+ZtHqq5YY9TlnRecYpKd3OihWvSjcN30PuDvV7yjQyRor1Fb+vbkRsJDuyiX6Tm Vq9KGTvGVHiq84K3TK4aBBXT3hsXnIcaYa9w5KJlSSxGgGe4wXLMqv0hdUKFqTvCKfSR APtQ== X-Gm-Message-State: AOJu0Yz7kmzS33qPiANxFoJ3A2ShW7xGNTwLt4h47cIleucALvvKQJJz Dd7NVpJjVsmZrMi2r3L+Zg== X-Google-Smtp-Source: AGHT+IEnGIoJqNWWyiWZwjEzr0L5g9377mlPC0xqKPYwtqdze7Um6irPMyQs814kV87bqN1XpP/smQ== X-Received: by 2002:a5d:400f:0:b0:336:8063:e066 with SMTP id n15-20020a5d400f000000b003368063e066mr798319wrp.52.1703266954984; Fri, 22 Dec 2023 09:42:34 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:34 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 18/29] drm/rockchip: inno_hdmi: Remove useless include Date: Fri, 22 Dec 2023 18:42:09 +0100 Message-ID: <20231222174220.55249-19-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - collect RB changes in v4: - none 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 138cd4287dea..c306db90832a 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 Fri Dec 22 17:42:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757544 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 A936E381CF; Fri, 22 Dec 2023 17:42:37 +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="YAFRndZi" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-33621d443a7so2019738f8f.3; Fri, 22 Dec 2023 09:42:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266956; x=1703871756; 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=nTJLdrH0LrbSbPhi76eSCJAOBnRdB++mitsqsoondcw=; b=YAFRndZi0g13Jf1g2/ncQ66LWlkNdnlNYu9ecbT3C/YTjPFjpZ9UX06V/9mLMi52jL cXLEPpI6FG31C3TX2cl3a65TMycowe7orBPtnZaDBtZGYBfjwzBQmDgp8GlPkg+wZnP1 wxHvf5hDzrLijHOC9K2VsGH3Zy51F4cMrtrRJdh+pjovzYNIaoCIVUx25bbh8XEs7llG IjQxMp+RZGwtcOINMVkXuEynoQ9XiPrznHhAvXPQwBO0+rITmWfcpAtZlscOQFazwLgk 5HswGgPKNBWfnMR7xkFRBndUSWMlnMeOXvwpNLj+eiunoHBbMy0Nz5zpZoWjt84JH0YN ZblQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266956; x=1703871756; 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=nTJLdrH0LrbSbPhi76eSCJAOBnRdB++mitsqsoondcw=; b=HEBNz5R9Pua7PYym2XWG7zHJCfkjcmd/ntbhd+MSvL+gis3dtB9ywWnQdS4N3Zj7ao c1O6U3YIoGPmpw/ZPr+vglik5kpvIiq+kUtc7oMsmfo6eaN5ASwlJfwEOE1tD9tM2RdR nsTGBjqnLj8YGZ6u0XzeaCAaMCHxpP7K53rDW0Pa9q2WXok9jowidPBcXRtDRKQLg/JE Ft1tk0ms4tRY3SzRwcOui2NsHmVPkDPgK7Zb0g7y4YNm5QLv/ZWBtR230fEN2S0uKSe9 j7P41qsxLIbQuY0p/MfZ0qdBo+2gac7qabY/dnJNtOPg9E7qyy6YzCsMVeVVvHA0zzSW pQmA== X-Gm-Message-State: AOJu0YyM7wOuteVQrGeR8Lcgg+lUGle7feYgF4AAdeWHTiNo+otr6Hfl evJAzzaDS0rXIdc0cgUmGA== X-Google-Smtp-Source: AGHT+IH/eqhhQrbQNb9jDPPXogkNUwK+iKCCinjmR4Spd1WlqPNxfwU5vXPt4aNHH23pnHO1bk0eYA== X-Received: by 2002:adf:b318:0:b0:336:7a35:4115 with SMTP id j24-20020adfb318000000b003367a354115mr868279wrd.0.1703266955745; Fri, 22 Dec 2023 09:42:35 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:35 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 19/29] drm/rockchip: inno_hdmi: Subclass connector state Date: Fri, 22 Dec 2023 18:42:10 +0100 Message-ID: <20231222174220.55249-20-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - added missing customizations of reset and atomic_destroy_state connector hooks - moved inno_conn_state member assignments to atomic_check changes in v4: - added missing state destroy in reset hook drivers/gpu/drm/rockchip/inno_hdmi.c | 117 ++++++++++++++++++++------- 1 file changed, 90 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index c306db90832a..e43fce968310 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; @@ -52,8 +47,12 @@ struct inno_hdmi { struct inno_hdmi_i2c *i2c; struct i2c_adapter *ddc; +}; - 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) @@ -68,6 +67,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(conn_state) \ + container_of_const(conn_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, @@ -246,6 +248,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; @@ -257,9 +263,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; @@ -269,7 +275,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; @@ -287,7 +296,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); @@ -298,15 +307,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; @@ -383,17 +392,6 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, struct drm_display_mode *mode) { struct drm_display_info *display = &hdmi->connector.display_info; - u8 vic = drm_match_cea_mode(mode); - - hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; - - if (vic == 6 || vic == 7 || - vic == 21 || vic == 22 || - vic == 2 || vic == 3 || - vic == 17 || vic == 18) - hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601; - else - hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; /* Mute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, @@ -458,10 +456,24 @@ 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 drm_display_mode *mode = &crtc_state->adjusted_mode; + u8 vic = drm_match_cea_mode(mode); + struct inno_hdmi_connector_state *inno_conn_state = + to_inno_hdmi_conn_state(conn_state); s->output_mode = ROCKCHIP_OUT_MODE_P888; s->output_type = DRM_MODE_CONNECTOR_HDMIA; + if (vic == 6 || vic == 7 || + vic == 21 || vic == 22 || + vic == 2 || vic == 3 || + vic == 17 || vic == 18) + inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_601; + else + inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_709; + + inno_conn_state->enc_out_format = HDMI_COLORSPACE_RGB; + return 0; } @@ -519,13 +531,63 @@ static void inno_hdmi_connector_destroy(struct drm_connector *connector) drm_connector_cleanup(connector); } +static void +inno_hdmi_connector_destroy_state(struct drm_connector *connector, + struct drm_connector_state *state) +{ + struct inno_hdmi_connector_state *inno_conn_state = + to_inno_hdmi_conn_state(state); + + __drm_atomic_helper_connector_destroy_state(&inno_conn_state->base); + kfree(inno_conn_state); +} + +static void inno_hdmi_connector_reset(struct drm_connector *connector) +{ + struct inno_hdmi_connector_state *inno_conn_state; + + if (connector->state) { + inno_hdmi_connector_destroy_state(connector, connector->state); + connector->state = NULL; + } + + inno_conn_state = kzalloc(sizeof(*inno_conn_state), GFP_KERNEL); + if (!inno_conn_state) + return; + + __drm_atomic_helper_connector_reset(connector, &inno_conn_state->base); + + inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_709; + inno_conn_state->enc_out_format = HDMI_COLORSPACE_RGB; +} + +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_destroy_state = drm_atomic_helper_connector_destroy_state, + .reset = inno_hdmi_connector_reset, + .atomic_duplicate_state = inno_hdmi_connector_duplicate_state, + .atomic_destroy_state = inno_hdmi_connector_destroy_state, }; static struct drm_connector_helper_funcs inno_hdmi_connector_helper_funcs = { From patchwork Fri Dec 22 17:42:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757901 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.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 2AAA938FA3; Fri, 22 Dec 2023 17:42:38 +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="M3SWqONi" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40d48304efdso4205555e9.0; Fri, 22 Dec 2023 09:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266956; x=1703871756; 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=SzkYbwlGueFkeXw8MQWVExgytplkJ2Nf/UnR4OES2p8=; b=M3SWqONiCNGloE3SGnpEhyq0l3y9cuz9EtsSlWRrZFNhKVOJ8Ia7K4337/ukErlIQD KxvAhr2xYW/LRMb5hplGOxSx+M5KO+BIZ+WF0JY16e/Fkturyd7UWxxK/R/NczulmXX1 HmuDrvc+N/+QUOv9T9eD9KqaHoPVvZA+FkSFJGnFrMr3taJLLBiP97hnPFoQwkyONZ84 B9KayxYmMbDU01UjA7EgJEPpipgCZA9sOEtVb6n9b5RsDpY3fHbIo6vX4T1nc9jeMjjV w/rJQNuJkYb3SOxjMhVJi66FMy5TNWp7533nnPun3adZs0uPzQBDQ9rg9ZR6tUo8n1PW nrDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266956; x=1703871756; 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=SzkYbwlGueFkeXw8MQWVExgytplkJ2Nf/UnR4OES2p8=; b=GlhkX9MKYXDGBYVZ2G16urtd0HzS5KgPgEcWAE7klrCnmgQk2krnUgcUxovho5pXY2 6eZPoZ7e9MYvQYeo34M15NQFg4Yl0xGHcQAUvYqGZAdk2m+Ktm6VnAe6KvMnxdZ5CW2Z KYLPVHEFh10NSy2zFrsgwJ0/BwGTIymc1YWuybZ8g6oAwWi/lwCPE1bEhHPp0ptlVBzc RHH8E82IKnNFd6jp02EJvbZgO+qbyJ0223nmHQishbbC32IVP7OzJYY909P0luY2vXPk MfLd/IJFHFtb3fj34y5Bx59W9mQ/fTvC9zOqZDAu+ZgOLL0o8UT3flvOqW8p8m0swQZJ rCyA== X-Gm-Message-State: AOJu0YzecwHhSBrqTwY2hjBoTPifn5EU4Er9mCYUbXEfniXADXaciPMB icLmZxDTkP8e4LmObpnkFg== X-Google-Smtp-Source: AGHT+IGjw9eaTW3bYuJzaeJRxodZiDLkX0kYbSh2SunwyP2K37rlC164b3cp2fGSEgNHWdq2zTdZoQ== X-Received: by 2002:a05:600c:4e87:b0:40b:4808:5d0a with SMTP id f7-20020a05600c4e8700b0040b48085d0amr983939wmq.17.1703266956443; Fri, 22 Dec 2023 09:42:36 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:36 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 20/29] drm/rockchip: inno_hdmi: Correctly setup HDMI quantization range Date: Fri, 22 Dec 2023 18:42:11 +0100 Message-ID: <20231222174220.55249-21-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - moved assignment of rgb_limited_range to atomic check changes in v4: - none 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 e43fce968310..f3b90b479ab9 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -53,6 +53,7 @@ struct inno_hdmi_connector_state { struct drm_connector_state base; unsigned int enc_out_format; unsigned int colorimetry; + bool rgb_limited_range; }; static struct inno_hdmi *encoder_to_inno_hdmi(struct drm_encoder *encoder) @@ -270,6 +271,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); } @@ -297,29 +310,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; + } } } @@ -473,6 +494,8 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_709; inno_conn_state->enc_out_format = HDMI_COLORSPACE_RGB; + inno_conn_state->rgb_limited_range = + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED; return 0; } @@ -559,6 +582,7 @@ static void inno_hdmi_connector_reset(struct drm_connector *connector) inno_conn_state->colorimetry = HDMI_COLORIMETRY_ITU_709; inno_conn_state->enc_out_format = HDMI_COLORSPACE_RGB; + inno_conn_state->rgb_limited_range = false; } static struct drm_connector_state * From patchwork Fri Dec 22 17:42:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 757543 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.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 D85533A8CB; Fri, 22 Dec 2023 17:42:38 +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="LevdbF8H" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-32f8441dfb5so1845487f8f.0; Fri, 22 Dec 2023 09:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266957; x=1703871757; 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=3qEiW87NdWMqG1i3IC5TsTsEJY+4saJvfxd4Py7tBWk=; b=LevdbF8H8aKPQSKZzVdn4GfVcUq1oo9ngdsz9kCh1qajfv1ufrBjDn92UH9enaTQ9c hnH46PkparVDBMVLMMD3EEz77bYaCbkbjMytpo4KeArCE4E3ps7NTPQF1PEwqXdpVopY tMI7bbCI/xXCQ5Ygp2zAMxMK/LDR12sw6P7KT2Unf7fU32otdPW5rGHZLa36XvcqrK56 GXCnkJwptGHNpLy4kn4yt6gAhUEbILwkk6z4jAuhOQ1DTD0TNXvjDe3meoO9TpTz5uz8 3ElQMpEtVWxV4ljGjv26lj5Ksat3LBtz6aC5S3hfCIYhFzdjt5IMARUc/VBExHlHmR95 Au0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266957; x=1703871757; 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=3qEiW87NdWMqG1i3IC5TsTsEJY+4saJvfxd4Py7tBWk=; b=aewNuYm5pEcIFPrR4CqPs+SVPwcxrLnNmGXGdtpEMq//sqJQc9ppdVoz0xlfeM04Ic vUzk5XWdalV9yEuML7bjAOOPgfPAzCwPoI33qDiNA0/pX1hw0OAoAm4xitzu08Mow4GU zqdQnt7BTTrRYS3ZFmfxUrMhNAK022dBWgPQ5NZRtH7w5I8C8ZEI0yXZBFLOxo7+pt5F DWJqMXaa83yCD7PDKCvHD5cWIxJ78Mdp1Sh1Omr97FNQ6QOi4FzZbR6cqLmL19/OOfxa QXSqwBfOIODrFJyP09ERhjDkSigfD8lTyl4YnEByGiFfcNA4GoA6q/JTpHEA6nzHMU9R AnVw== X-Gm-Message-State: AOJu0YwwOlf11n/kUb00Mm/P8bHpmtlGuQmTpUzc9E0B6X1unJ6lZV7H i+CMqBdXC1Wx/j/C8d3iYQ== X-Google-Smtp-Source: AGHT+IF/ILntBURjV10Ff56yN/onR9KNU6i4awRUbCKr+V/5OKfVGrXyAKwoOVxh00kqNwRL7i24VQ== X-Received: by 2002:adf:dd8b:0:b0:336:8940:c4dd with SMTP id x11-20020adfdd8b000000b003368940c4ddmr968833wrl.8.1703266957184; Fri, 22 Dec 2023 09:42:37 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:36 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 21/29] drm/rockchip: inno_hdmi: Don't power up the phy after resetting Date: Fri, 22 Dec 2023 18:42:12 +0100 Message-ID: <20231222174220.55249-22-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 inno_hdmi_reset is only ever called when initializing the controller. At this point it’s completely uneccessary to power up the PHY, since all what has to work at this point is the DDC bus. The phy will be powered up correctly when a mode is set in inno_hdmi_encoder_enable and disabled in inno_hdmi_encoder_disable. Set it to LOWER_PWR after resetting the controller. Signed-off-by: Alex Bee --- changes in v3: - new patch changes in v4: - none drivers/gpu/drm/rockchip/inno_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index f3b90b479ab9..52b49f44a4f4 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -202,7 +202,7 @@ static void inno_hdmi_reset(struct inno_hdmi *hdmi) val = v_REG_CLK_INV | v_REG_CLK_SOURCE_SYS | v_PWR_ON | v_INT_POL_HIGH; hdmi_modb(hdmi, HDMI_SYS_CTRL, msk, val); - inno_hdmi_set_pwr_mode(hdmi, NORMAL); + inno_hdmi_set_pwr_mode(hdmi, LOWER_PWR); } static void inno_hdmi_disable_frame(struct inno_hdmi *hdmi, From patchwork Fri Dec 22 17:42: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: 757900 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.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 82DF73B19D; Fri, 22 Dec 2023 17:42:39 +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="jYdOF7vz" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-33687627ad0so1708236f8f.2; Fri, 22 Dec 2023 09:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266958; x=1703871758; 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=nfTDEigy6tmq2Mn9E1wnnsAPUxEbWwuqi0N9nc+qdGo=; b=jYdOF7vzKRhpy8++/ZXyEzpvN0070HBaPQg7+JDxaJw4nsK8XDguLnMrriun1sHzQE jdGlJsrFY3bgnsvqnsqMCMtJ7pZjU1aSLlq1O4y+10RzKb33EYIx2UlDNN81RpBH83VE 711nJjgM4KTiHJwKFA9jbPfZLC5FcBwefjnrdSficY1qYVteE0DJvJooTXUWQ3JCjQvL Zksf+rYNBP6OzweW4jGbzF/mUhMmKj3qLoiX9x3LlKjNmYu4blyY2puaZHHWBV4m2Uzo 7AtNfyBUgx973PZMD4tpW36b2OnKE9AS/g8cz9eZOkwXfQJ7JWSRSK2ECQmTkegjlTVF FtIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266958; x=1703871758; 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=nfTDEigy6tmq2Mn9E1wnnsAPUxEbWwuqi0N9nc+qdGo=; b=Y6O795ECjaD0xKMu+A8rhOAH2yybZAuta1TJr6DZdvLGD62r4gtlgs9Cp6RzXCVTdS aafHjPjgwwY0jd1v1O43s1d9R92V5AIDHH7kzR1QwqvX74sfNVs1C4u8oDPGQIvCn6L1 9dd5qWGfi6ex1X8zfJW75nDmtGa2khELXaxEJ3vPorrnk8ApgVpQKnHwtBYeO4ARSAe+ N6n+nKEIey669qbHyWI95wYV6MbAXStd2gQC0OWV7CMtYyN1XpUzoXYfs9TpdYZxuWSN oRv8h7KfEq4QNj28RLb/mlfcqSi0zASblB10hso00JXgLdjR7ZpE7u4eBlZj7wmKwBL1 bXMQ== X-Gm-Message-State: AOJu0YwGSY7TkDGfhq+WLaWPzB5R1tgirBJf6WfPGx/R9353RfVYQlGk vMDHJflhGNhsfhlLDY1m5A== X-Google-Smtp-Source: AGHT+IHD1sMRR0b9UfvVWSWGlPGdgDIwu7H3ElnGmo67e7+XKWlpbK8y3mbb/mtv5CeniedxhpSZ1Q== X-Received: by 2002:adf:e74b:0:b0:332:e667:4277 with SMTP id c11-20020adfe74b000000b00332e6674277mr1205025wrn.40.1703266957871; Fri, 22 Dec 2023 09:42:37 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:37 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 22/29] drm/rockchip: inno_hdmi: Split power mode setting Date: Fri, 22 Dec 2023 18:42:13 +0100 Message-ID: <20231222174220.55249-23-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This splits setting the power mode of the controller / phy in two functions. It's done in preparation of setting up the phy based on the pixelclock. No functional changes intended. Signed-off-by: Alex Bee --- changes in v3: - new patch changes in v4: - none drivers/gpu/drm/rockchip/inno_hdmi.c | 54 +++++++++++++--------------- drivers/gpu/drm/rockchip/inno_hdmi.h | 5 --- 2 files changed, 24 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 52b49f44a4f4..44c311e7e2d3 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -154,38 +154,31 @@ static void inno_hdmi_sys_power(struct inno_hdmi *hdmi, bool enable) hdmi_modb(hdmi, HDMI_SYS_CTRL, m_POWER, v_PWR_OFF); } -static void inno_hdmi_set_pwr_mode(struct inno_hdmi *hdmi, int mode) +static void inno_hdmi_standby(struct inno_hdmi *hdmi) { - switch (mode) { - case NORMAL: - inno_hdmi_sys_power(hdmi, false); + inno_hdmi_sys_power(hdmi, false); - hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x6f); - hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0xbb); - - hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); - hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x14); - hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x10); - hdmi_writeb(hdmi, HDMI_PHY_CHG_PWR, 0x0f); - hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x00); - hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x01); - - inno_hdmi_sys_power(hdmi, true); - break; + hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0x00); + hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x00); + hdmi_writeb(hdmi, HDMI_PHY_CHG_PWR, 0x00); + hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); +}; - case LOWER_PWR: - inno_hdmi_sys_power(hdmi, false); - hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0x00); - hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x00); - hdmi_writeb(hdmi, HDMI_PHY_CHG_PWR, 0x00); - hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); +static void inno_hdmi_power_up(struct inno_hdmi *hdmi) +{ + inno_hdmi_sys_power(hdmi, false); - break; + hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x6f); + hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0xbb); + hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); + hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x14); + hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x10); + hdmi_writeb(hdmi, HDMI_PHY_CHG_PWR, 0x0f); + hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x00); + hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x01); - default: - DRM_DEV_ERROR(hdmi->dev, "Unknown power mode %d\n", mode); - } -} + inno_hdmi_sys_power(hdmi, true); +}; static void inno_hdmi_reset(struct inno_hdmi *hdmi) { @@ -202,7 +195,7 @@ static void inno_hdmi_reset(struct inno_hdmi *hdmi) val = v_REG_CLK_INV | v_REG_CLK_SOURCE_SYS | v_PWR_ON | v_INT_POL_HIGH; hdmi_modb(hdmi, HDMI_SYS_CTRL, msk, val); - inno_hdmi_set_pwr_mode(hdmi, LOWER_PWR); + inno_hdmi_standby(hdmi); } static void inno_hdmi_disable_frame(struct inno_hdmi *hdmi, @@ -441,6 +434,8 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, v_AUDIO_MUTE(0) | v_VIDEO_MUTE(0)); + inno_hdmi_power_up(hdmi); + return 0; } @@ -460,7 +455,6 @@ static void inno_hdmi_encoder_enable(struct drm_encoder *encoder, return; inno_hdmi_setup(hdmi, &crtc_state->adjusted_mode); - inno_hdmi_set_pwr_mode(hdmi, NORMAL); } static void inno_hdmi_encoder_disable(struct drm_encoder *encoder, @@ -468,7 +462,7 @@ static void inno_hdmi_encoder_disable(struct drm_encoder *encoder, { struct inno_hdmi *hdmi = encoder_to_inno_hdmi(encoder); - inno_hdmi_set_pwr_mode(hdmi, LOWER_PWR); + inno_hdmi_standby(hdmi); } static int diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.h b/drivers/gpu/drm/rockchip/inno_hdmi.h index 93245b55f967..a7edf3559e60 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.h +++ b/drivers/gpu/drm/rockchip/inno_hdmi.h @@ -10,11 +10,6 @@ #define DDC_SEGMENT_ADDR 0x30 -enum PWR_MODE { - NORMAL, - LOWER_PWR, -}; - #define HDMI_SCL_RATE (100*1000) #define DDC_BUS_FREQ_L 0x4b #define DDC_BUS_FREQ_H 0x4c From patchwork Fri Dec 22 17:42: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: 757542 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 5651541740; Fri, 22 Dec 2023 17:42:40 +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="Sve8O9Kl" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-336746a545fso1256686f8f.0; Fri, 22 Dec 2023 09:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266958; x=1703871758; 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=OuPa/UCZ+S+tpMXY2+ZSGIMlsWF9xT2DWjDbU4B7UZI=; b=Sve8O9Kl1AxBAf+S33RJOOmXK4QuNDROQYUVtamTi7ETSSu8bBoLc6rzsCB77DYTxq RYVIazZaazud7nsZ3zcvwDU8U96dU5TL8o3ZFy38Xm3FhtCRO+yKWeJkB/QU//TBAMJ3 HEp1eZ1EEyLsQgSUOZscRoRRn6BfZ2tfHiTrEQls3bt3iD+Igak/ulOG//dH9x6pqJqX 0QOe4IfOMKFR9gh88w9Wemcrh9T1u9dq3LlSBHHbWQaCqhAjvl4mQS1n+kJ4qrrd19v3 2BJbs0BArmb6EMyYQ7k0FwO0ToKFXG0lDd/JR17hIGOQQcqmkl3DyuCvhpXlDrcqnAof CyLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266958; x=1703871758; 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=OuPa/UCZ+S+tpMXY2+ZSGIMlsWF9xT2DWjDbU4B7UZI=; b=VYaecsPKs27vZiH+ftJXYzWftb7A/+8qp2RVdZ4id+p5bTImlS12KXthEyNMcPDYAK 3GogjP4Fz4WRpvydAG3M9qgSB/bJZngD99r+XRVehZ+Z90ZSgQOyupcV56F1Q7e32uPw rqB3F95hADuYsu+pzRHuXo+E8/cQER3sSgBZFCcnWDEHBgVCFiydBq8DqNmiyygX/Pfj PgYWl/NmKVn2z71FMDQ+5/Jv1FEk7sGLhAZ5SqVe7ZrT4t6Ba2eSiPZWgPdfDAgpoL/z waeEdeGlmztq8gXOlqwtld+uy719mCSiOXIr9IUh5z4+qx6hoR6mRSKXjvx5VmFa2mF8 Ed2Q== X-Gm-Message-State: AOJu0YzzMjvdFXLgcGAPPSTyYedV60yW8pUc3MvGDQu8xhZVluLzMP/b sHwgBgoIbg5MSP8vxBFQiQ== X-Google-Smtp-Source: AGHT+IEjk2JX3cryTNZLnr1na63oKaFCjP2+oPseqP9/67kTJYx/j+qLJatXCAdYf2yZBPppd7BLkQ== X-Received: by 2002:a05:6000:1c9:b0:336:6dd3:bfd3 with SMTP id t9-20020a05600001c900b003366dd3bfd3mr1061282wrx.37.1703266958541; Fri, 22 Dec 2023 09:42:38 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:38 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 23/29] drm/rockchip: inno_hdmi: Add variant support Date: Fri, 22 Dec 2023 18:42:14 +0100 Message-ID: <20231222174220.55249-24-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - adapt to the newly introduced inno_hdmi_power_up / inno_hdmi_standby functions changes in v4: - none drivers/gpu/drm/rockchip/inno_hdmi.c | 74 ++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 44c311e7e2d3..34f0358e8d7b 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 { @@ -113,6 +126,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); @@ -164,12 +201,25 @@ static void inno_hdmi_standby(struct inno_hdmi *hdmi) hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); }; -static void inno_hdmi_power_up(struct inno_hdmi *hdmi) +static void inno_hdmi_power_up(struct inno_hdmi *hdmi, + unsigned long mpixelclock) { + struct inno_hdmi_phy_config *phy_config; + int ret = inno_hdmi_find_phy_config(hdmi, mpixelclock); + + if (ret < 0) { + phy_config = hdmi->variant->default_phy_config; + DRM_DEV_ERROR(hdmi->dev, + "Using default phy configuration for TMDS rate %lu", + mpixelclock); + } else { + phy_config = &hdmi->variant->phy_configs[ret]; + } + inno_hdmi_sys_power(hdmi, false); - 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); hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x10); @@ -406,6 +456,7 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, struct drm_display_mode *mode) { struct drm_display_info *display = &hdmi->connector.display_info; + unsigned long mpixelclock = mode->clock * 1000; /* Mute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, @@ -428,13 +479,13 @@ 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. */ - inno_hdmi_i2c_init(hdmi, mode->clock * 1000); + inno_hdmi_i2c_init(hdmi, mpixelclock); /* Unmute video and audio output */ hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK, v_AUDIO_MUTE(0) | v_VIDEO_MUTE(0)); - inno_hdmi_power_up(hdmi); + inno_hdmi_power_up(hdmi, mpixelclock); return 0; } @@ -827,6 +878,7 @@ 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 +888,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); @@ -929,8 +987,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 Fri Dec 22 17:42: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: 757899 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 19E1A446C3; Fri, 22 Dec 2023 17:42:40 +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="LR7K5+E7" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3367903b4dcso1994251f8f.1; Fri, 22 Dec 2023 09:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266959; x=1703871759; 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=PRDLrc4Pqc9q8YV3BNYLNdW1nNQ91cRb/kLeFqZo5Z4=; b=LR7K5+E7qWUu6IM23FVY2fu583rdm10wZUP14OqI0o+AZ+Sw6hiruj3KCqof+EaktR 6f2mbOj1fKGvKWPLG6piOTf6jbAjdjVA8fkIHVDnxL4COKYZWX9asv25WsCc03/T+P64 Yt6MKyESi/pmAZjk1qMn0YRPxPFYtI9Tqvnj+7+lTB1UYIC6QA56WmspbAwVnGkOlmmJ hHHJH/YqURYW3gOYKCnvwJ7tnYlRjMmMABT/2IXtknmz3/AITNGi6HHIbNL3UuFhrcFd UIkpkZ/D428ohsKaUfPMXFaDTULlSt0p2alr79Z8+6NTUjGRB71jY+r3hud/J+UmEttE DbEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266959; x=1703871759; 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=PRDLrc4Pqc9q8YV3BNYLNdW1nNQ91cRb/kLeFqZo5Z4=; b=k5jbc6OcOpMZFxOgscxInIxymePvahcqTY8osu+oMyyhnzYhkGeAgbzfio4FKkA5SK mtZw3pvosHPD5bqq5V+9fvCA1EIsYdhMOYBCthXbVgmKe5Er3cj2SMx2fSQQQgciC+BQ rxo7G+3PjimMztKvvSc9wYpywoQFGP6sQfPz3buvoQmaLrC7oIPlRdPec1jN23VAo7Ag p1iX6mGU7ZQoQMrFoKGsUHXDdGhe2pCdF2F0rexau+ueM7N1C3JpGn+TkpidL98mv8aE oY5PXxduLGh9Q7XDiJN69AGbce9OcHCU9MbnanmxpbaJRSTfoJA92oZTwDzm6wW5ojx0 vIfw== X-Gm-Message-State: AOJu0YyR2IYDuke2UQfZmg5Am6+awDKtKTw/GsngWtIHSgpKxh0pmGnw MJZH3/+ZDuY4zzsTa5VqPg== X-Google-Smtp-Source: AGHT+IE2+DqN7baMUSo6d5TvP8kuW5Y4xLA/e6OLwP2k9pd79ImZ8Ug8T4zNqmw73cYCUbKdboHsaA== X-Received: by 2002:a5d:66c6:0:b0:336:7a37:27ed with SMTP id k6-20020a5d66c6000000b003367a3727edmr931646wrw.20.1703266959411; Fri, 22 Dec 2023 09:42:39 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:38 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 24/29] drm/rockchip: inno_hdmi: Add RK3128 support Date: Fri, 22 Dec 2023 18:42:15 +0100 Message-ID: <20231222174220.55249-25-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - no changes changes in v4: - none 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 34f0358e8d7b..3b76929deefe 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; @@ -132,6 +133,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) { @@ -911,6 +918,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; @@ -927,12 +948,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 the 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. */ - inno_hdmi_i2c_init(hdmi, clk_get_rate(hdmi->pclk)); + if (hdmi->refclk) + inno_hdmi_i2c_init(hdmi, clk_get_rate(hdmi->refclk)); + else + inno_hdmi_i2c_init(hdmi, clk_get_rate(hdmi->pclk)); ret = inno_hdmi_register(drm, hdmi); if (ret) @@ -956,6 +981,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; } @@ -969,6 +996,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); } @@ -992,10 +1020,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 Fri Dec 22 17:42: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: 757541 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 B52B848788; Fri, 22 Dec 2023 17:42:41 +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="DCVK1nRD" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-33687627ad0so1708269f8f.2; Fri, 22 Dec 2023 09:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266960; x=1703871760; 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=UAPEf6VCNcNpH+vS9Jy42mEPmnbb20QERJ8qe9km2VY=; b=DCVK1nRDcOTtlQ4GZ8a9kVSvqA51q76OqpYuGQNhujoTa9FQDuA5sxP1IDIb/99iTC FEZpjWCCEKQ5kndlP3lTniHXh4vtvKpj6fzc1XM+CDIDmO6cp0wX1iMTaV4SwIr2oOin YA58sibHR1Ns2t5lzQSZFOnhlCFM+hvWx1QXe5OfB4V7+WVMVNx12VgMlN4XNaDMmzpB TuSqspMHRFblJHVgyJN2ik6tiZbSY4JDxdYpX0H4e1/5K/oTU7UEsD2ChrlHNianxduD CuDw/x6+nW6tS4UPJaa3zKNWHkJBMCi5iB0oPglgK098DZxIXIFZd6onmhl6CYucf7c3 2uuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266960; x=1703871760; 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=UAPEf6VCNcNpH+vS9Jy42mEPmnbb20QERJ8qe9km2VY=; b=ahKwLTK1Tx+veUmtwXJErGJnrckMgG7ht1Q+r3My7VDOJG5qD5plDucqtK6fi8XGl3 uhvmKGuLrGjJNgaiFoDwD8ayf2GOl+0EBmr7M/zVljwML3sWV/bR9FBGAp/NXEZzWpCL jvqg+Dd/THf4xwfE2LVfjf3FOhLdQqsWQkdfftkry6cdUnFmdv39JdmTzphaNtlg+gwm +UG+0YFZyjZaXTJUswtQlGNJ/p9/nTAeSZC1FYZ+YRUGTFzPYg/NNE3ulnzr+dnkY1X/ r7jcNfMhDfjTPRYNX0nQ28uvWWobRJrf0lHkkPFIsF6DKFDNgrLZrLEAXePjtuHXtYlo gTuA== X-Gm-Message-State: AOJu0Yxwm3tvh0DoDpahhxEGQPxTuNZ28o3Q4S2uB/7icRTSfYXC2fPU nBjnY7XbmEOTJqQDQ77YAA== X-Google-Smtp-Source: AGHT+IFGJNcPl+paeHR0rYagd/KoMDxco3f6zFqUGim2MwyHSQksycGDsS4WvE51htk1ZWVRV10PAg== X-Received: by 2002:a5d:4fcd:0:b0:336:5f15:5533 with SMTP id h13-20020a5d4fcd000000b003365f155533mr1181108wrw.54.1703266960101; Fri, 22 Dec 2023 09:42:40 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:39 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 25/29] drm/rockchip: inno_hdmi: Add basic mode validation Date: Fri, 22 Dec 2023 18:42:16 +0100 Message-ID: <20231222174220.55249-26-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - collect RB changes in v4: - none 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 3b76929deefe..a074451a0c49 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; @@ -497,6 +499,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) { @@ -529,6 +563,7 @@ 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); struct drm_display_mode *mode = &crtc_state->adjusted_mode; u8 vic = drm_match_cea_mode(mode); struct inno_hdmi_connector_state *inno_conn_state = @@ -549,7 +584,8 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, inno_conn_state->rgb_limited_range = drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED; - 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 = { @@ -590,7 +626,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 Fri Dec 22 17:42: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: 757898 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.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 5717928E18; Fri, 22 Dec 2023 17:42:42 +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="SJ87EL41" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-336746c7b6dso1673345f8f.0; Fri, 22 Dec 2023 09:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266960; x=1703871760; 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=34BUg2B4LjsKRfrLMHkMQRe61oTuxBkBwcQpvuibjEM=; b=SJ87EL41OA5aeB5Cl2TcRdpScY2Jw00p35WdvucvXNM8p0PaVhHaUyPK1JylutDivR g7paADpEd0BYGaMvFkZyWi1LE/hVd8piPl3EvfkwsZzO2aAnB30CBPlwqpY5acSnOhIz I2w4U33YeNKUZMV6ZJvIDi1bSBEC1tdga5OZZQW2rvHzdNayKZB/zG1S2UX/kYVYFX3G nz6PSBVe/EBkje8hz4vj/PB0fftr3EvkYlVXRJlNionyx2z9eGnjWhlwo7E8O7luHJ0m ft3KJZ7VrQDjlOkFXvnqtuYY9gTlYFcNUkMhj5txFlFabJr8AogliQ0Qcl3Fo7InkK7j Cz4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266960; x=1703871760; 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=34BUg2B4LjsKRfrLMHkMQRe61oTuxBkBwcQpvuibjEM=; b=syyRLyhMeRluHZao7LKg9RqwN+3Fy/5b3cqZ/UdvVMVLyk+wNw0Bvb16t3t/stcoj8 DIjYGzHY8i2c+qop+9LAAzskxHhxZ8I7ddPYfYukABT/tnFEdX3gPYOfcb9cAB8KLSeX gQdPhHOc7s1DmmRicAaTprx0xMhr4U2vfsgNyGBA21+Eaa60jD+D7OjyJk+7KdsoLlAv qLjk12NvKPPjtmCaxAi86tm3CdsBDSGuDh8fR+Dtp0KlU4iuMYHZa4anyW46lH4RdYKi l7cHaKvJvYE/ousOLnxzW0XkNDugGcdhjj2tFYo5vAJU85eAnmEBDSXXU+oFWMQ+QUVm sC8Q== X-Gm-Message-State: AOJu0YzIENrS9LTYp6LsWQB+RjuZyGmeIbDzCdfDC1txabuG2SbxVFwP 8H9RAGCvfUZ5r6mG0Pn2bDdYWoXW0g== X-Google-Smtp-Source: AGHT+IEHhKrxlJJC6hecqKp88hOj5Ill1eBn0UyrmY0K3DyD2qK8+a7I0eGYkTkRAt5FV0hLxk4sUA== X-Received: by 2002:adf:e7c7:0:b0:336:619f:4647 with SMTP id e7-20020adfe7c7000000b00336619f4647mr905229wrn.108.1703266960737; Fri, 22 Dec 2023 09:42:40 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:40 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 26/29] drm/rockchip: inno_hdmi: Drop custom fill_modes hook Date: Fri, 22 Dec 2023 18:42:17 +0100 Message-ID: <20231222174220.55249-27-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - collect RB changes in v4: - none 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 a074451a0c49..d7453c36d37a 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -630,13 +630,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); @@ -695,7 +688,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 = inno_hdmi_connector_reset, From patchwork Fri Dec 22 17:42: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: 757540 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 278814BA80; Fri, 22 Dec 2023 17:42:42 +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="HJBJX406" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33697caf9a6so423074f8f.1; Fri, 22 Dec 2023 09:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266961; x=1703871761; 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=rLzYp4+k7Wco/dLyvbXtMOp2x7OPvW43+Ey3FkfhV04=; b=HJBJX4064ItY7m0sOVKX0/6ZuYm39OTR3kE/VOMLDktoXydxnt59RDOWeVbY+pC2yU +sL1u5C6qyOK85zsXLhjJDWJ2tu4Yv5VSxdTad0KXQmLrIdojGJjtHIaan5iw5DDjFTp 0KEZXzc8zPfsDP9dWHblNRDtGujceOxS2ipDYTKCUgaGwAW6vM4fgiQVT2T3KKGy75PV HVomIKXlk5ghEMVQEV5nXAQpJhytmwaSOHeHfhiE9WjlzgRpIK7NecRjBxI6kz2X/cUn gsDfH3hXJvJ1J/i5161FkDrScTfuuT/bu6Kwp8q2Jwk6S7gdg5AdMTXSKBrYPDmtSvi6 mbJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266961; x=1703871761; 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=rLzYp4+k7Wco/dLyvbXtMOp2x7OPvW43+Ey3FkfhV04=; b=AdzPvKo8Dk1bOMzDbOq18WKMwkfrlMGMUzwksPB6imC5IiJqpphQVB4sNTctUErWvP xzVdAiGYBvTAUeSa0+4S6la6QrbzrTqmMEj/FuGVShu/5pZhI+SVmRGcnpBHc/rh7Nvg R63kTtfKckbHjxuO3cFb4yfekM6YnRdWB5YE+5s5DjgTlLjlrupjFy68ezAaJM9H5JzK g9zlwylgzBhb8OPxKnTKj25f61201ue/lvIhENfJ+cCIKR1onUwqVTDLXFnGbyI06NEp d6fYBxuDYzuVzaiiyqKytGmXfxT+HEK9Jn/5V0tSFwTww98qtbRA426AekvspdPSxYnb pimg== X-Gm-Message-State: AOJu0YwWpTDnYVVG7hYh2e1CIyCJdqHEquhl0/D4+iAA7s09odR9UJzt Gs3HKS8RoRNsIujDpFhZ8w== X-Google-Smtp-Source: AGHT+IGbd8E/7UYhaxEGvqWFhQLwqbcpgCocA70NL6yVomx8hW0OvFLh92M66p/2d8jdHube5d2uBA== X-Received: by 2002:a5d:6046:0:b0:336:8d2e:77a1 with SMTP id j6-20020a5d6046000000b003368d2e77a1mr945167wrt.47.1703266961379; Fri, 22 Dec 2023 09:42:41 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:41 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 27/29] ARM: dts: rockchip: Add display subsystem for RK3128 Date: Fri, 22 Dec 2023 18:42:18 +0100 Message-ID: <20231222174220.55249-28-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - no changes changes in v4: - none 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 Fri Dec 22 17:42: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: 757897 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.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 01AA64C3BD; Fri, 22 Dec 2023 17:42:43 +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="IQvqrBuX" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40d3c4bfe45so20995465e9.1; Fri, 22 Dec 2023 09:42:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266962; x=1703871762; 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=gRLz1zrBuFNm0Af22mx0D2/7q2j0Q/CWyrbrvtrtVPY=; b=IQvqrBuX1Gbwts2bdRJiK0/oYpTqptzaZVw6pLSntKSCfAApvbpPz2j/nqWv9CULkg 64u/P5KicooPaSKAgtxLJRitGT5tw1KuwVqrRq8UELJveJrMfR9jOHMGYtKBnv+nJ9Ms C96oInaa/4krNSR4XsKtWArJv4Bd5Z55Tt8g3G4YGClTBp214c6D3K0RD17O611M81i+ NVKIajVhXrlE6IjM/hE2t8q9KJ5rN1G+ivn+bx7rDzSylncJ6zVqcSvXLr/RPk3Jc9jH pPdla6gJNf/5QQ5cTKgGxc56C7g6hhTMgHaNZGM4/AK6U0JKwstqdi/6s012AE1r/lmb RNtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266962; x=1703871762; 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=gRLz1zrBuFNm0Af22mx0D2/7q2j0Q/CWyrbrvtrtVPY=; b=oRuMKD+5YyOuWZebNJSoOWd8hFzi0vx5j1Byg3A7mfQGkR8h+D+/R18TkQPvwG6E+k dtGxHdrek3ftefReU9fGVPFWXWAUHLRNtMfu7YzIX3PdePzpfW8juBUnWzT+q1380lVI G+0Pj7neL5kRzw9krNXFV4usxwYEkvGRVpBZ/OYcIFgp5Kap9lt0ZtI/D9RhQpTEc/rI HuDAqUE67v1eskWywtJNMz02QsFHEz6zq2gjbw7X000EH9/OwtMfWqn+co2srC+w5V5l e9uJPeqJ7pC16k3dbz7amaWTsSaYHpBvk+Ljz+t5O81Iysl96rUq97rOd87j9impjsBy ZOLg== X-Gm-Message-State: AOJu0Ywz8R+2ga8tMCrZB6V6EIcuyo9cfWFfDDSLbkx+JtBOcozE3a8B fysssyxQwduenP98K9X2fg== X-Google-Smtp-Source: AGHT+IEHpUVIRCbHP3AshFALoArBl6E2zYs7rd6xJQGGfnJ//3nhB9bjJ/XDbpPL3zjGmIJ8dwji1w== X-Received: by 2002:a05:600c:a02:b0:40d:3868:6b85 with SMTP id z2-20020a05600c0a0200b0040d38686b85mr544367wmp.198.1703266962256; Fri, 22 Dec 2023 09:42:42 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:41 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 28/29] ARM: dts: rockchip: Add HDMI node for RK3128 Date: Fri, 22 Dec 2023 18:42:19 +0100 Message-ID: <20231222174220.55249-29-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - no changes changes in v4: - none 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 Fri Dec 22 17:42: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: 757539 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 A615D4C618; Fri, 22 Dec 2023 17:42:44 +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="DNrsA2GV" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-336897b6bd6so1795736f8f.2; Fri, 22 Dec 2023 09:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703266963; x=1703871763; 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=DSehpxE7VFQUy0YWI/0+kwR1zv6c+kt9jZ6SUI8YNPA=; b=DNrsA2GV7j+BqN527P2MlgiifrPCHya3w1+jh2y07aAM/BmAX34bI4La17bjdnv3Ye uOy/4XTkjudE8DRnGqQavrNYuQHMqmWYuQ74WsKIWS6tSYTy18BLMZARmj78a84PvJpT H2eSMZjy6mPF4YVlpO5uEtWpwQcJiJFamrDDfGEH4yDW2sC6gQTzqIY9F2O2n8K9tiFa suHr0s8VyRWaX6W7KYUjl3v+VvtpYAE96O7mkPI0P176AXL5O7ZiBXh45XKb2X46cF/o mHjyvBdA+Qen16fNd2+/XHR4g2Tz78kQWpRK+I9sHzhoRftHyYc1/QeFCoNskKyPWKJi Xjnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703266963; x=1703871763; 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=DSehpxE7VFQUy0YWI/0+kwR1zv6c+kt9jZ6SUI8YNPA=; b=LyYmfZvcx1P4htsmcZrbzM7x6EKXeR8vRSO5nJ8sW3FNPyLYHoy9BUC7fHIwFsddJ0 i6v28pnWTFbkVCbViUONrVGfWneGILIemToFhFeeClWsLGQA7+XKRBIbAQArRNuW6gcf F7GvvQi2EZvNES3BvvrwofliLr0zFHp7AraCwVJ+sMgzE/FW9El+jeh8VASSUGrETrZO 2RaQYqKDXN7NUsSlIpf7gNvvQThS5/jGglpaQ2mwUGgk8Wo7SjcXtPTBRP8i7PHn/yOh Q7HD99ANxcLIXaYx0RIbhwD127Oh2fxrrG/biSEsx6uRVIttfAGClSRKAEghQkjyI9EA vgJw== X-Gm-Message-State: AOJu0Yz1/Oh++PjHnEotwmA51rDSVl3aT0F7eXajfCCGWavj8QKw0Aaj 8R8ADgZxE3pe4v/f+MhqjA== X-Google-Smtp-Source: AGHT+IGLyV7PwzD0uMRgFbjueBNdwVNWCv/14yX+9ci/Je+qQb52KMqiGZ6KKsCnxRVJYWwB1HUPrw== X-Received: by 2002:adf:ed47:0:b0:332:e337:7c5f with SMTP id u7-20020adfed47000000b00332e3377c5fmr904774wro.61.1703266963000; Fri, 22 Dec 2023 09:42:43 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:f3ae:2788:7e03:f44]) by smtp.gmail.com with ESMTPSA id w10-20020adfec4a000000b00336670abdcasm4777116wrn.40.2023.12.22.09.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 09:42:42 -0800 (PST) From: Alex Bee To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH v4 29/29] ARM: dts: rockchip: Enable HDMI output for XPI-3128 Date: Fri, 22 Dec 2023 18:42:20 +0100 Message-ID: <20231222174220.55249-30-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222174220.55249-1-knaerzche@gmail.com> References: <20231222174220.55249-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: 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 changes in v3: - no changes changes in v4: - none .../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"; +};